Allow high fidelity type profiling to be enabled and disabled.
https://bugs.webkit.org/show_bug.cgi?id=135423

Patch by Saam Barati <sbarati@apple.com> on 2014-08-14
Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

- Merged op_put_to_scope_with_profile and op_get_from_scope_with_profile into
  op_profile_types_with_high_fidelity by adding extra arguments to the opcode.
- Altered SymbolTable to use less memory by adding a rare data structure for
  type profiling.
- Created an interface to turn on and off type profiling from the Web
  Inspector.
- Refactored how entries are written to HighFidelityLog to make it
  easier to inline when generating machine code.
- Implemented op_profile_types_with_high_fidelity in the baseline JIT
  by inlining the process of writing to the log and doing a small amount
  of type inference optimizations.

* bytecode/BytecodeList.json:
* bytecode/BytecodeUseDef.h:
(JSC::computeUsesForBytecodeOffset):
(JSC::computeDefsForBytecodeOffset):
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::CodeBlock):
(JSC::CodeBlock::finalizeUnconditionally):
(JSC::CodeBlock::scopeDependentProfile): Deleted.
* bytecode/CodeBlock.h:
* bytecode/TypeLocation.h:
(JSC::TypeLocation::TypeLocation):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::generate):
(JSC::BytecodeGenerator::emitMove):
(JSC::BytecodeGenerator::emitProfileTypesWithHighFidelity):
(JSC::BytecodeGenerator::emitGetFromScopeWithProfile): Deleted.
(JSC::BytecodeGenerator::emitPutToScopeWithProfile): Deleted.
* bytecompiler/BytecodeGenerator.h:
* bytecompiler/NodesCodegen.cpp:
(JSC::ThisNode::emitBytecode):
(JSC::ResolveNode::emitBytecode):
(JSC::BracketAccessorNode::emitBytecode):
(JSC::DotAccessorNode::emitBytecode):
(JSC::FunctionCallValueNode::emitBytecode):
(JSC::FunctionCallResolveNode::emitBytecode):
(JSC::FunctionCallBracketNode::emitBytecode):
(JSC::FunctionCallDotNode::emitBytecode):
(JSC::CallFunctionCallDotNode::emitBytecode):
(JSC::ApplyFunctionCallDotNode::emitBytecode):
(JSC::PostfixNode::emitResolve):
(JSC::PostfixNode::emitBracket):
(JSC::PostfixNode::emitDot):
(JSC::PrefixNode::emitResolve):
(JSC::PrefixNode::emitBracket):
(JSC::PrefixNode::emitDot):
(JSC::ReadModifyResolveNode::emitBytecode):
(JSC::AssignResolveNode::emitBytecode):
(JSC::AssignDotNode::emitBytecode):
(JSC::ReadModifyDotNode::emitBytecode):
(JSC::AssignBracketNode::emitBytecode):
(JSC::ReadModifyBracketNode::emitBytecode):
(JSC::ReturnNode::emitBytecode):
(JSC::FunctionBodyNode::emitBytecode):
* inspector/agents/InspectorRuntimeAgent.cpp:
(Inspector::InspectorRuntimeAgent::InspectorRuntimeAgent):
(Inspector::InspectorRuntimeAgent::getRuntimeTypesForVariablesAtOffsets):
(Inspector::TypeRecompiler::operator()):
(Inspector::recompileAllJSFunctionsForTypeProfiling):
(Inspector::InspectorRuntimeAgent::willDestroyFrontendAndBackend):
(Inspector::InspectorRuntimeAgent::enableHighFidelityTypeProfiling):
(Inspector::InspectorRuntimeAgent::disableHighFidelityTypeProfiling):
(Inspector::InspectorRuntimeAgent::setHighFidelityTypeProfilingEnabledState):
* inspector/agents/InspectorRuntimeAgent.h:
* inspector/agents/JSGlobalObjectRuntimeAgent.cpp:
(Inspector::JSGlobalObjectRuntimeAgent::willDestroyFrontendAndBackend):
* inspector/protocol/Runtime.json:
* jit/JIT.cpp:
(JSC::JIT::privateCompileMainPass):
(JSC::JIT::privateCompile):
* jit/JIT.h:
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_profile_types_with_high_fidelity):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_profile_types_with_high_fidelity):
* jit/JITOperations.cpp:
* jit/JITOperations.h:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
(JSC::LLInt::getFromScopeCommon): Deleted.
(JSC::LLInt::putToScopeCommon): Deleted.
* llint/LLIntSlowPaths.h:
* llint/LowLevelInterpreter.asm:
* runtime/CodeCache.cpp:
(JSC::CodeCache::getGlobalCodeBlock):
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/CommonSlowPaths.h:
* runtime/HighFidelityLog.cpp:
(JSC::HighFidelityLog::initializeHighFidelityLog):
(JSC::HighFidelityLog::~HighFidelityLog):
(JSC::HighFidelityLog::processHighFidelityLog):
* runtime/HighFidelityLog.h:
(JSC::HighFidelityLog::LogEntry::structureIDOffset):
(JSC::HighFidelityLog::LogEntry::valueOffset):
(JSC::HighFidelityLog::LogEntry::locationOffset):
(JSC::HighFidelityLog::recordTypeInformationForLocation):
(JSC::HighFidelityLog::logEndPtr):
(JSC::HighFidelityLog::logStartOffset):
(JSC::HighFidelityLog::currentLogEntryOffset):
* runtime/HighFidelityTypeProfiler.cpp:
(JSC::HighFidelityTypeProfiler::logTypesForTypeLocation):
(JSC::descriptorMatchesTypeLocation):
* runtime/HighFidelityTypeProfiler.h:
* runtime/SymbolTable.cpp:
(JSC::SymbolTable::SymbolTable):
(JSC::SymbolTable::cloneCapturedNames):
(JSC::SymbolTable::prepareForHighFidelityTypeProfiling):
(JSC::SymbolTable::uniqueIDForVariable):
(JSC::SymbolTable::uniqueIDForRegister):
(JSC::SymbolTable::globalTypeSetForRegister):
(JSC::SymbolTable::globalTypeSetForVariable):
* runtime/SymbolTable.h:
(JSC::SymbolTable::add):
(JSC::SymbolTable::set):
* runtime/TypeLocationCache.cpp:
(JSC::TypeLocationCache::getTypeLocation):
* runtime/TypeSet.cpp:
(JSC::TypeSet::getRuntimeTypeForValue):
(JSC::TypeSet::addTypeInformation):
(JSC::TypeSet::allPrimitiveTypeNames):
(JSC::TypeSet::addTypeForValue): Deleted.
* runtime/TypeSet.h:
* runtime/VM.cpp:
(JSC::VM::VM):
(JSC::VM::nextTypeLocation):
(JSC::VM::enableHighFidelityTypeProfiling):
(JSC::VM::disableHighFidelityTypeProfiling):
(JSC::VM::dumpHighFidelityProfilingTypes):
* runtime/VM.h:
(JSC::VM::nextLocation): Deleted.

Source/WebCore:

PageRuntimeAgent and WorkerRuntimeAgent now call their super
class's (InspectorRuntimeAgent) implementation of willDestroyFrontendAndBackend
to give InspectorRuntimeAgent a chance to recompile all JavaScript
functions, if necessary, for type profiling.

* inspector/PageRuntimeAgent.cpp:
(WebCore::PageRuntimeAgent::willDestroyFrontendAndBackend):
* inspector/WorkerRuntimeAgent.cpp:
(WebCore::WorkerRuntimeAgent::willDestroyFrontendAndBackend):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172614 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Web Inspector: Split console toggle button wrong - Images/Images/SplitToggleUp.svg does not exist
https://bugs.webkit.org/show_bug.cgi?id=135957

Patch by Joseph Pecoraro <pecoraro@apple.com> on 2014-08-14
Reviewed by Timothy Hatcher.

* UserInterface/Views/LogContentView.js:
(WebInspector.LogContentView):
Wrong image path passed to platformImagePath.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172615 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Implement scroll snapping animations on Mac
https://bugs.webkit.org/show_bug.cgi?id=135768

Patch by Wenson Hsieh <wenson_hsieh@apple.com> on 2014-08-14
Reviewed by Beth Dakin.

Implementing the scroll snap animations required for snapping in both overflow and mainframe areas on Mac.
Since we receive a series of discrete wheel events, we need to predict the distance we need to traverse,
compute the appropriate snap point, and then compute an animation curve to that location. The snap animations
are split into two types: snapping, which handles letting go of the trackpad with zero velocity, and gliding,
which handles flick gestures. In both cases, sinusoidal curves are used to ease animation to the target
location. In the former case, the initial velocity is low, and increases to a maximum value during the middle
of the animation before decreasing to 0. In the latter case, the curve is computed such that the initial
velocity matches the user's scroll velocity, and the final velocity matches a lower final velocity that is
somewhat arbitrarily computed. (See the FIXME in AxisScrollSnapOffsets::initializeGlideParameters). How the
equations and constants were chosen is described in greater detail in the comments above
AxisScrollSnapOffsets::computeGlideDelta and AxisScrollSnapOffsets::computeSnapDelta. Note that the final
velocity should ideally be equal to 0. However, with this particular curve, this caused the animation to feel
too slow near the snap point.

No tests, since there is no observable change in behavior. Tests will be included when iOS and Mac scrolling
areas hook into this code.

* PlatformMac.cmake:
* WebCore.xcodeproj/project.pbxproj:
* page/scrolling/AxisScrollSnapOffsets.cpp:
(WebCore::closestSnapOffset): Computes the closest snap offset given velocity and prdicted destination.
* page/scrolling/AxisScrollSnapOffsets.h:
* platform/mac/AxisScrollSnapAnimator.h: Added.
(WebCore::AxisScrollSnapAnimatorClient::~AxisScrollSnapAnimatorClient):
* platform/mac/AxisScrollSnapAnimator.mm: Added.
(WebCore::toWheelEventStatus): Converts a pair of PlatformWheelEventPhases to a WheelEventStatus.
(WebCore::projectedInertialScrollDistance): Attempts to predict the distance covered by the inertial scrolling phase.
(WebCore::AxisScrollSnapAnimator::AxisScrollSnapAnimator):
(WebCore::AxisScrollSnapAnimator::handleWheelEvent): Updates the internal state of the AxisScrollSnapAnimator, given a PlatformWheelEvent
(WebCore::AxisScrollSnapAnimator::shouldOverrideWheelEvent): Determines whether or not we should override a wheel event given the animator's internal state.
(WebCore::AxisScrollSnapAnimator::scrollSnapAnimationUpdate): Updates a single loop of the scroll snapping animation.
(WebCore::AxisScrollSnapAnimator::beginScrollSnapAnimation):
(WebCore::AxisScrollSnapAnimator::endScrollSnapAnimation):
(WebCore::AxisScrollSnapAnimator::computeSnapDelta): See comments for more information.
(WebCore::AxisScrollSnapAnimator::computeGlideDelta): See comments for more information.
(WebCore::AxisScrollSnapAnimator::initializeGlideParameters):
(WebCore::AxisScrollSnapAnimator::pushInitialWheelDelta):
(WebCore::AxisScrollSnapAnimator::averageInitialWheelDelta):
(WebCore::AxisScrollSnapAnimator::clearInitialWheelDeltaWindow):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@172616 268f45cc-cd09-0410-ab3c-d52691b4dbfc