Batch compile the set of static trampolines at the point Machine is constructed, using a single allocation.
Refactor out m_callFrame from CTI, since this is only needed to access the global data (instead store a
pointer to the global data directly, since this is available at the point the Machine is constructed).
Add a method to align the code buffer, to allow JIT generation for multiple trampolines in one block.

wtf/Vector.h:
(WTF::VectorBufferBase::deallocateBuffer): Set capacity to 0 as
well as size, otherwise shrinking capacity to 0 can fail to reset
the capacity and thus cause a future crash.
(WTF::Vector::~Vector): Shrink size not capacity; we only need
to call destructors, the buffer will be freed anyway.
(WTF::Vector::clear): Change this to shrinkCapacity(0), not just shrink(0).
(WTF::::shrinkCapacity): Use shrink() instead of resize() for case where
the size is greater than the new capacity, to work with types that have no
default constructor.

rendering/RenderThemeWin.cpp:
(WebCore::RenderThemeWin::systemColor): If we can't determine a good
Win32 system color to use, defer to RenderTheme instead of asserting.
This matches what RenderThemeMac does.

Logging channels can now be enabled by setting the WebCoreLogLevel
environment variable to a hexadecimal number.

Reviewed by Anders Carlsson.

WebCore.vcproj/WebCore.vcproj: Added LoggingWin.cpp.

platform/win/LoggingWin.cpp: Copied from WebCore/platform/mac/LoggingMac.mm.
(WebCore::initializeWithUserDefault): Read in the WebCoreLogLevel
environment variable, parse its value as a hexadecimal number, and
turn the channel on/off based on whether the mask bit is set.
(WebCore::InitializeLoggingChannelsIfNecessary): Initialize each
logging channel in turn.

WebKit/win:

Fix Bug 22158: Would like to turn on WebCore logging channels via an
environment variable

With the recent change to adopt asType() style cast functions with
assertions instead of static_casts in many places, the assertion for
the asObject() call in JSCallbackObject::getOwnPropertySlot() has been
failing when using any nontrivial client of the JavaScriptCore API.
The cast isn't even necessary to call slot.setCustom(), so it should
be removed.

This broke when the meaning of FrameView::invalidate changed.
I changed setNeedsReapplyStyles to no longer depend on invalidate.

dom/Document.cpp: (WebCore::Document::shouldScheduleLayout):
Removed the part of this function that duplicated what's already in
FrameView::needsLayout, since the copy here left out a few key things.
For example, it didn't handle the fact that "needs reapply styles"
counts as needing layout.

page/Frame.cpp: (WebCore::Frame::setNeedsReapplyStyles): This called
FrameView::invalidate before. There were two things wrong with that.
1) It requested that the entire view repaint even if the style change
didn't necessitate that. 2) FrameView::invalidate no longer causes any
repainting at all in certain cases, because of Hyatt's changes to how
widgets and the host window are involved in the repainting process.
So call FrameView::scheduleRelayout instead, which is more precisely
what we want and need here.

page/FrameView.cpp:
(WebCore::FrameView::scheduleRelayout): Add a call to needsLayout here
so that Document::shouldScheduleLayout doesn't have to replicate the
logic that's in needsLayout and can instead rely on the fact that it
was already called.
(WebCore::FrameView::needsLayout): Tweaked the comments and formatting
in this function.

parser/Nodes.h: Removed unused includes and forward declarations.
Removed Precedence enum. Made many more members private instead of
protected or public. Removed unused NodeStack typedef. Moved the
VarStack and FunctionStack typedefs from Node to ScopeNode. Made
Node::emitCode pure virtual and changed classes that don't emit
any code to inherit from ParserRefCounted rather than Node.
Moved isReturnNode from Node to StatementNode. Removed the
streamTo, precedence, and needsParensIfLeftmost functions from
all classes. Removed the ImmediateNumberNode class and make
NumberNode::setValue nonvirtual.

bytecompiler/CodeGenerator.h:
(JSC::CodeGenerator::emitNode): Check depth and emit an exception if we exceed
the maximum depth.

parser/Nodes.cpp:
(JSC::NodeReleaser::releaseAllNodes): Added. To be called inside node destructors
to avoid recursive calls to destructors for nodes inside this one.
(JSC::NodeReleaser::release): Added. To be called inside releaseNodes functions.
Also added releaseNodes functions and calls to releaseAllNodes inside destructors
for each class derived from Node that has RefPtr to other nodes.
(JSC::NodeReleaser::adopt): Added. Used by the release function.
(JSC::NodeReleaser::adoptFunctionBodyNode): Added.

parser/Nodes.h: Added declarations of releaseNodes and destructors in all classes
that needed it. Eliminated use of ListRefPtr and releaseNext, which are the two parts
of an older solution to the non-recursive destruction problem that works only for
lists, whereas the new solution works for other graphs. Changed ReverseBinaryOpNode
to use BinaryOpNode as a base class to avoid some duplicated code.

platform/graphics/Color.cpp: For some reason MSVC doesn't follow the rules
about needed a separate definition for static const integer data members.
Until I get to the bottom of this, put the definitions inside an ifdef.

WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::frameLoadCompleted): Added comments, and got rid of
a local variable to make this code match the code in the function below
more closely.
(WebFrameLoaderClient::provisionalLoadStarted): Added comments.

WebView/WebFrameView.mm:
(-[WebFrameView _scrollView]): Tweaked formatting.
(-[WebFrameView initWithFrame:]): Ditto.
(-[WebFrameView setFrameSize:]): Added a comment and tweaked formatting.
(-[WebFrameView viewDidMoveToWindow]): Added. This is the change that fixes
the bug. Calls setDrawsBackground:YES as appropriate since moving the view
out of the window to switch to another view disrupts the special technique
for showing the old page during the start of loading. This is the identical
reason for the setFrameSize: method above, and the code is almost the same.

platform/graphics/Color.cpp: Added definitions for the static data members
in this class. Static data members need a definition, even when they are the
simple integer constant kind that can be initialized in the header.

fast/canvas/gradient-addColorStop-with-invalid-color.html: Regenerated with
make-js-test-wrappers script; removes the canvas element that was in here.

fast/canvas/linearGradient-infinite-values.html: Ditto.

fast/canvas/radialGradient-infinite-values.html: Ditto.

fast/canvas/resources/gradient-addColorStop-with-invalid-color.js:
Fixed spelling error and changed code to use createElement to make a canvas
element rather than using getElementById to find an existing canvas element.

page/DOMWindow.cpp:
(WebCore::DOMWindow::localStorage): Changed to return 0 if local storage
is disabled in settings.
(WebCore::DOMWindow::openDatabase): Changed to return 0 if databases
are disabled in settings.

Use a stack-based object to simplify the pushLayoutState/popLayoutState
code. LayoutStateMaintainer either pushes in the constructor, or allows
an explicit push() later. Both cases require an explicit pop().

Rename the m_nextGlobal, m_nextParameter, and m_nextConstant member
variables of CodeGenerator to m_nextGlobalIndex, m_nextParameterIndex,
and m_nextConstantIndex respectively. This is to distinguish these from
member variables like m_lastConstant, which are actually RefPtrs to
Registers.

page/EventHandler.cpp: (WebCore::EventHandler::handleAccessKey):
Restore old Shift key behavior. We ignore Shift key state when matching access keys (which
matches neither IE nor Firefox), and this patch made WebKit behave like Firefox
inadvertently. This may or may not be a good thing, but it's certainly not something that
should change by accident.

page/mac/EventHandlerMac.mm: (WebCore::EventHandler::accessKeyModifiers):
Use Ctrl when VoiceOver is enabled, because a conflict with Emacs-style key bindings is
less troublesome than one with VO keys.

page/EventHandler.cpp: (WebCore::EventHandler::handleAccessKey):
Also fix an access key matching bug introduced in r32424 - Any superset of specified
modifier set invoked access keys. We can use simple equality comparison instead because
CapsLock is not part of modifiers(), so it doesn't need to be ignored explicitly.

WebView.cpp:
(WebView::canMakeTextLarger): Consider the zoomsTextOnly setting when computing this.
(WebView::makeTextLarger): ditto.
(WebView::canMakeTextSmaller): ditto.
(WebView::makeTextSmaller): ditto.
(WebView::canMakeTextStandardSize):
Don't consider the setting in this case since we need to reset both text zoom and page zoom regardless of the setting.
(WebView::makeTextStandardSize):
(WebView::notifyPreferencesChanged): Set the WebCore settings to match the WebPreference for WebKitZoomsTextOnly.

Mark pages allocated by the FastMalloc mmap code path executable with
PROT_EXEC. This fixes crashes seen on CPUs and kernels that enforce
non-executable memory (like ExecShield on Fedora Linux) when the JIT
is enabled.

This patch does not resolve the issue on debug builds so affected
developers may still need to pass --disable-jit to configure.

null-check symbols loaded from plugin modules, initialize the function
table (like Win already does) and update it with the latest
additions. Adjust whitespace for easy diff'ing with the Win port code
from which it was forked.

This fixes crashes with libnspr4.so and any other plugins that don't
provide the symbols we expect.