2017-03-02 Tomas Popela Incorrect RELEASE_ASSERT in JSGlobalObject::addStaticGlobals() https://bugs.webkit.org/show_bug.cgi?id=169034 Reviewed by Mark Lam. It should not assign to offset, but compare to offset. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::addStaticGlobals): 2017-02-09 Mark Lam B3::Procedure::deleteOrphans() should neutralize upsilons with dead phis. https://bugs.webkit.org/show_bug.cgi?id=167437 Reviewed by Filip Pizlo. * b3/B3Procedure.cpp: (JSC::B3::Procedure::deleteOrphans): 2017-02-09 Keith Miller We should not allow Function.caller to be used on native functions https://bugs.webkit.org/show_bug.cgi?id=165628 Reviewed by Mark Lam. Also remove unneeded dynamic cast. * runtime/JSFunction.cpp: (JSC::RetrieveCallerFunctionFunctor::RetrieveCallerFunctionFunctor): (JSC::JSFunction::callerGetter): 2017-01-17 Michael Saboff Nested parenthesized regular expressions with non-zero minimum counts appear to hang and use lots of memory https://bugs.webkit.org/show_bug.cgi?id=167125 Reviewed by Filip Pizlo. Changed Yarr to handle nested parenthesized subexpressions where the minimum count is not 0 directly in the Yarr interpreter. Previously we'd factor an expression like (a|b)+ into (a|b)(a|b)* with special handling for captures. This factoring was done using a deep copy that doubled the size of the resulting expresion for each nested parenthesized subexpression. Now the Yarr interpreter can directly process a regexp like (a|b){2,42}. The parser will allow one level of nested, non-zero minimum, counted parenthesis using the old copy method. After one level, it will generate parenthesis terms with a non-zero minimum. Such an expression wasn't handled by the Yarr JIT before the change, so this change isn't a performance regression. Added a minimum count to the YarrPattern and ByteTerm classes, and then factored that minimum into the interpreter. A non-zero minimum is only handled by the Yarr interpreter. If the Yarr JIT see such a term, it punts back to the interpreter. * yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::backtrackPatternCharacter): (JSC::Yarr::Interpreter::backtrackPatternCasedCharacter): (JSC::Yarr::Interpreter::matchCharacterClass): (JSC::Yarr::Interpreter::backtrackCharacterClass): (JSC::Yarr::Interpreter::matchBackReference): (JSC::Yarr::Interpreter::backtrackBackReference): (JSC::Yarr::Interpreter::matchParenthesesOnceBegin): (JSC::Yarr::Interpreter::matchParenthesesOnceEnd): (JSC::Yarr::Interpreter::backtrackParenthesesOnceBegin): (JSC::Yarr::Interpreter::backtrackParenthesesOnceEnd): (JSC::Yarr::Interpreter::matchParenthesesTerminalBegin): (JSC::Yarr::Interpreter::backtrackParenthesesTerminalBegin): (JSC::Yarr::Interpreter::matchParentheticalAssertionBegin): (JSC::Yarr::Interpreter::matchParentheticalAssertionEnd): (JSC::Yarr::Interpreter::backtrackParentheticalAssertionBegin): (JSC::Yarr::Interpreter::backtrackParentheticalAssertionEnd): (JSC::Yarr::Interpreter::matchParentheses): (JSC::Yarr::Interpreter::backtrackParentheses): (JSC::Yarr::Interpreter::matchDisjunction): (JSC::Yarr::ByteCompiler::atomPatternCharacter): (JSC::Yarr::ByteCompiler::atomCharacterClass): (JSC::Yarr::ByteCompiler::atomBackReference): (JSC::Yarr::ByteCompiler::atomParentheticalAssertionEnd): (JSC::Yarr::ByteCompiler::atomParenthesesSubpatternEnd): (JSC::Yarr::ByteCompiler::atomParenthesesOnceEnd): (JSC::Yarr::ByteCompiler::atomParenthesesTerminalEnd): (JSC::Yarr::ByteCompiler::emitDisjunction): * yarr/YarrInterpreter.h: (JSC::Yarr::ByteTerm::ByteTerm): * yarr/YarrJIT.cpp: (JSC::Yarr::YarrGenerator::generatePatternCharacterOnce): (JSC::Yarr::YarrGenerator::generatePatternCharacterFixed): (JSC::Yarr::YarrGenerator::generatePatternCharacterGreedy): (JSC::Yarr::YarrGenerator::backtrackPatternCharacterNonGreedy): (JSC::Yarr::YarrGenerator::generateCharacterClassFixed): (JSC::Yarr::YarrGenerator::generateCharacterClassGreedy): (JSC::Yarr::YarrGenerator::backtrackCharacterClassNonGreedy): (JSC::Yarr::YarrGenerator::generateTerm): (JSC::Yarr::YarrGenerator::backtrackTerm): (JSC::Yarr::YarrGenerator::generate): (JSC::Yarr::YarrGenerator::backtrack): (JSC::Yarr::YarrGenerator::opCompileParenthesesSubpattern): * yarr/YarrPattern.cpp: (JSC::Yarr::YarrPatternConstructor::copyTerm): (JSC::Yarr::YarrPatternConstructor::quantifyAtom): (JSC::Yarr::YarrPatternConstructor::checkForTerminalParentheses): (JSC::Yarr::YarrPattern::YarrPattern): * yarr/YarrPattern.h: (JSC::Yarr::PatternTerm::PatternTerm): (JSC::Yarr::PatternTerm::quantify): (JSC::Yarr::YarrPattern::reset): 2016-11-15 Mark Lam The jsc shell's setImpureGetterDelegate() should ensure that the set value is an ImpureGetter. https://bugs.webkit.org/show_bug.cgi?id=164781 Reviewed by Geoffrey Garen and Michael Saboff. * jsc.cpp: (functionSetImpureGetterDelegate): 2016-10-31 Joseph Pecoraro Web Inspector: Provide an opportunity to clear ScriptValues associated with debugged target https://bugs.webkit.org/show_bug.cgi?id=164167 Reviewed by Mark Lam. * inspector/InspectorAgentBase.h: (Inspector::InspectorAgentBase::discardValues): * inspector/InspectorAgentRegistry.cpp: (Inspector::AgentRegistry::~AgentRegistry): (Inspector::AgentRegistry::discardValues): * inspector/InspectorAgentRegistry.h: New standard agent method to allow the agent to discard values. * inspector/agents/InspectorConsoleAgent.h: * inspector/agents/InspectorConsoleAgent.cpp: (Inspector::InspectorConsoleAgent::discardValues): Discard ScriptValues in ConsoleMessages. * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::globalObjectDestroyed): Global object is going away, discard values. 2016-12-06 Mark Lam Introduce the concept of Immutable Prototype Exotic Objects to comply with the spec. https://bugs.webkit.org/show_bug.cgi?id=165227 Reviewed by Saam Barati. * runtime/JSObject.cpp: (JSC::JSObject::setPrototypeWithCycleCheck): - This is where we check for immutable prototype exotic objects and refuse to set the prototype if needed. See https://tc39.github.io/ecma262/#sec-immutable-prototype-exotic-objects. * runtime/JSTypeInfo.h: (JSC::TypeInfo::isImmutablePrototypeExoticObject): * runtime/Structure.h: - Add flag for declaring immutable prototype exotic objects. * runtime/ObjectPrototype.h: - Declare that Object.prototype is an immutable prototype exotic object. See https://tc39.github.io/ecma262/#sec-properties-of-the-object-prototype-object. * runtime/ObjectConstructor.cpp: (JSC::objectConstructorSetPrototypeOf): - Use better error messages. 2016-11-30 Mark Lam Proxy is not allowed in the global prototype chain. https://bugs.webkit.org/show_bug.cgi?id=165205 Reviewed by Geoffrey Garen. * runtime/ProgramExecutable.cpp: (JSC::ProgramExecutable::initializeGlobalProperties): - We'll now throw a TypeError if we detect a Proxy in the global prototype chain. 2016-10-27 Mark Lam JSFunction::put() should not allow caching of lazily reified properties. https://bugs.webkit.org/show_bug.cgi?id=164081 Reviewed by Geoffrey Garen. It is incorrect for JSFunction::put() to return PutPropertySlots that indicates that its lazily reified properties (e.g. .caller, and .arguments) are cacheable. The reason for this is: 1. Currently, a cacheable put may only consist of the following types of put operations: a. putting a new property at an offset in the object storage. b. changing the value of an existing property at an offset in the object storage. c. invoking the setter for a property at an offset in the object storage. Returning a PutPropertySlot that indicates the property is cacheable means that the property put must be one of the above operations. For lazily reified properties, JSFunction::put() implements complex conditional behavior that is different than the set of cacheable put operations above. Hence, it should not claim that the property put is cacheable. 2. Cacheable puts are cached on the original structure of the object before the put operation. Reifying a lazy property will trigger a structure transition. Even though subsequent puts to such a property may be cacheable after the structure transition, it is incorrect to indicate that the property put is cacheable because the caching is on the original structure, not the new transitioned structure. Also fixed some missing exception checks. * jit/JITOperations.cpp: * runtime/JSFunction.cpp: (JSC::JSFunction::put): (JSC::JSFunction::reifyLazyPropertyIfNeeded): (JSC::JSFunction::reifyBoundNameIfNeeded): * runtime/JSFunction.h: 2016-10-12 Joseph Pecoraro Web Inspector: Improve support for logging Proxy objects in console https://bugs.webkit.org/show_bug.cgi?id=163323 Reviewed by Timothy Hatcher. This is based off of similiar patches in Blink for Proxy handling. * bindings/ScriptValue.cpp: (Deprecated::ScriptValue::isEqual): Use strict equality. This is the intent, and it prevents the possibility of triggering primitive conversion on objects in previous ConsoleMessage argument lists. * inspector/InjectedScriptSource.js: (InjectedScript.prototype._propertyDescriptors): Bail if the object is a Proxy. (InjectedScript.prototype._describe): Provide a friendlier name, "Proxy" instead of "ProxyObject". (InjectedScript.RemoteObject): When generating a preview for a Proxy object, generate it from the final target and mark it as lossy so that the object can always be expanded to get the internal target/handler properties. * inspector/JSInjectedScriptHost.h: * inspector/JSInjectedScriptHost.cpp: (Inspector::JSInjectedScriptHost::subtype): New subtype for Proxy objects. (Inspector::JSInjectedScriptHost::proxyTargetValue): Resolve the final target value for a Proxy. * inspector/JSInjectedScriptHostPrototype.cpp: (Inspector::JSInjectedScriptHostPrototype::finishCreation): (Inspector::jsInjectedScriptHostPrototypeFunctionProxyTargetValue): Add the new method. * inspector/ScriptArguments.cpp: (Inspector::ScriptArguments::getFirstArgumentAsString): Avoid triggering Proxy traps on a Proxy object when getting a quick string description for ConsoleMessages. * inspector/protocol/Runtime.json: Add new "proxy" subtype. 2016-09-27 Filip Pizlo B3::lowerMacros forgets to before->updatePredecessorsAfter() when lowering ChillMod on ARM64 https://bugs.webkit.org/show_bug.cgi?id=162644 Reviewed by Keith Miller. If you forget to update the predecessors of your successors, then bad things will happen if you do something that requires accurate predecessors for correctness. lowerMacros() uses BlockInsertionSet, which relies on accurate predecessors. * b3/B3LowerMacros.cpp: 2016-09-13 Mark Lam DFG NewArrayBuffer node should watch for "have a bad time" state change. https://bugs.webkit.org/show_bug.cgi?id=161927 Reviewed by Geoffrey Garen. * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): 2016-10-25 Christopher Reid jsc.cpp is leaking memory allocated by readline in runInteractive https://bugs.webkit.org/show_bug.cgi?id=163958 According to http://web.mit.edu/gnu/doc/html/rlman_2.html, "The line readline returns is allocated with malloc (); you should free () the line when you are done with it." The memory allocated by readline is not being freed when it should. Reviewed by Mark Lam. * jsc.cpp: 2016-10-20 Zan Dobersek Fix JSC cast-align compiler warnings on ARMv7 https://bugs.webkit.org/show_bug.cgi?id=163744 Reviewed by Mark Lam. Use the reinterpret_cast_ptr workaround in a few places where the cast alignment warning is being thrown by the GCC compiler when compiling for the ARMv7 architecture. * heap/Heap.cpp: (JSC::Zombify::visit): * heap/HeapCell.h: (JSC::HeapCell::zap): (JSC::HeapCell::isZapped): * heap/MarkedBlock.cpp: (JSC::MarkedBlock::Handle::specializedSweep): 2016-09-27 Michael Catanzaro [GTK] Install binaries to pkglibexecdir rather than bindir https://bugs.webkit.org/show_bug.cgi?id=162602 Reviewed by Carlos Garcia Campos. Install jsc shell to LIBEXEC_INSTALL_DIR rather than EXEC_INSTALL_DIR. Note these locations are the same on non-GTK ports. * shell/CMakeLists.txt: 2016-09-23 Carlos Garcia Campos REGRESSION(r194387): Crash on github.com in IntlDateTimeFormat::resolvedOptions in C locale https://bugs.webkit.org/show_bug.cgi?id=162139 Reviewed by Michael Catanzaro. The crash happens in unix ports because the resolved locale is empty when system locale is "C". IntlObject considers any language tag with a size < 2 to be an invalid language, so "C" is not a valid language to resolve the locale. We should ensure that WTF::platformUserPreferredLanguages() never returns invalid languages, but that's not enough, because languages can be overriden from the public API, so we need to handle those cases and throw exceptions instead of crashing. * runtime/IntlCollator.cpp: (JSC::IntlCollator::initializeCollator): Throw a exception when we fail to resolve the locale. * runtime/IntlDateTimeFormat.cpp: (JSC::IntlDateTimeFormat::initializeDateTimeFormat): Ditto. * runtime/IntlNumberFormat.cpp: (JSC::IntlNumberFormat::initializeNumberFormat): Ditto. 2016-09-20 Jonathan Bedard Undefined behavior: Left shift negative number https://bugs.webkit.org/show_bug.cgi?id=161866 Reviewed by Keith Miller. Left shifting a negative number is undefined behavior in C/C++, although most implementations do define it. Explicitly clarifying the intended behavior due to shifting negative number in some cases. * dfg/DFGAbstractHeap.h: (JSC::DFG::AbstractHeap::encode): Explicitly cast signed integer for left shift. 2016-09-09 Filip Pizlo jsc.cpp should call initializeMainThread() to make sure that GC thread assertions work https://bugs.webkit.org/show_bug.cgi?id=161801 Reviewed by Keith Miller. The GC has debug assertions that certain things don't happen on GC threads. Those assertions are no-ops unless initializeGCThreads() is called, and I think the most canonical way to do that is to call initializeMainThread(). * jsc.cpp: (jscmain): 2016-09-09 Saam Barati Make hasOwnProperty ALWAYS_INLINE https://bugs.webkit.org/show_bug.cgi?id=161775 Reviewed by Ryosuke Niwa. Speedometer spends around 2.5% of its time in hasOwnProperty. Let's reduce the overhead of calling that function by marking it as inline. Also, it's likely that the function will call into JSObject::getOwnPropertySlot. I added a check to see if that's the function we're calling, if it is, we do a direct call instead of an indirect call. * runtime/JSObject.cpp: (JSC::JSObject::hasOwnProperty): Deleted. * runtime/JSObjectInlines.h: (JSC::JSObject::hasOwnProperty): 2016-09-08 Filip Pizlo Heap::isMarked() shouldn't pay the price of concurrent lazy flipping https://bugs.webkit.org/show_bug.cgi?id=161760 Reviewed by Mark Lam. To fix a race condition in marking, I made Heap::isMarked() and Heap::isLive() atomic by using flipIfNecessaryConcurrently() instead of flipIfNecessary(). This introduces three unnecessary overheads: - isLive() is not called by marking, so that change was not necessary. - isMarked() gets calls many times outside of marking, so it shouldn't always do the concurrent thing. This adds isMarkedConcurrently() for use in marking, and reverts isMarked(). - isMarked() and isMarkedConcurrently() don't actually have to do the lazy flip. They can return false if the flip is necessary. I added a bunch of debug assertions to make sure that isLive() and isMarked() are not called during marking. If we needed to, we could remove most of the calls to isMarkedConcurrently(). As a kind of optimization, CodeBlock does an initial fixpoint iteration during marking, and so all of the code called from CodeBlock's fixpoint iterator needs to use isMarkedConcurrently(). But we could probably arrange for CodeBlock only do fixpoint iterating during the weak reference thing. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::visitWeakly): (JSC::CodeBlock::shouldJettisonDueToOldAge): (JSC::shouldMarkTransition): (JSC::CodeBlock::propagateTransitions): (JSC::CodeBlock::determineLiveness): * bytecode/PolymorphicAccess.cpp: (JSC::AccessCase::propagateTransitions): * heap/Heap.h: * heap/HeapInlines.h: (JSC::Heap::isLive): (JSC::Heap::isMarked): (JSC::Heap::isMarkedConcurrently): * heap/MarkedBlock.cpp: (JSC::MarkedBlock::flipIfNecessarySlow): (JSC::MarkedBlock::flipIfNecessaryConcurrentlySlow): (JSC::MarkedBlock::needsFlip): * heap/MarkedBlock.h: (JSC::MarkedBlock::needsFlip): (JSC::MarkedBlock::flipIfNecessary): (JSC::MarkedBlock::flipIfNecessaryConcurrently): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::appendToMarkStack): (JSC::SlotVisitor::markAuxiliary): (JSC::SlotVisitor::visitChildren): * runtime/Structure.cpp: (JSC::Structure::isCheapDuringGC): (JSC::Structure::markIfCheap): 2016-09-08 Saam Barati We should inline operationConvertJSValueToBoolean into JIT code https://bugs.webkit.org/show_bug.cgi?id=161729 Reviewed by Filip Pizlo. This patch introduces an AssemblyHelpers emitter function that replaces operationConvertJSValueToBoolean. This operation was showing up when I was doing performance analysis for the speedometer benchmark. I saw that it was spending about 1% of its time in this function. Hopefully this patch can help us speedup up speedometer by a little bit. * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compileLogicalNot): (JSC::DFG::SpeculativeJIT::emitBranch): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compileLogicalNot): (JSC::DFG::SpeculativeJIT::emitBranch): * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::emitConvertValueToBoolean): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitAllocateDestructibleObject): Deleted. * jit/JIT.cpp: (JSC::JIT::privateCompileSlowCases): * jit/JIT.h: * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_jfalse): (JSC::JIT::emit_op_jtrue): (JSC::JIT::emitSlow_op_jfalse): Deleted. (JSC::JIT::emitSlow_op_jtrue): Deleted. * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_jfalse): (JSC::JIT::emit_op_jtrue): (JSC::JIT::emitSlow_op_jfalse): Deleted. (JSC::JIT::emitSlow_op_jtrue): Deleted. * jit/JITOperations.cpp: * jit/JITOperations.h: 2016-09-08 Filip Pizlo Heap version should be 32-bit https://bugs.webkit.org/show_bug.cgi?id=161751 Reviewed by Mark Lam. 32-bit devices are probably getting hurt by the 64-bit version number. The reason why I made it 64-bit initially is so that I wouldn't have to worry about wrap-around. But wrap-around is easy to handle. * heap/CellContainer.h: * heap/CellContainerInlines.h: (JSC::CellContainer::flipIfNecessary): * heap/ConservativeRoots.cpp: (JSC::ConservativeRoots::genericAddPointer): (JSC::ConservativeRoots::genericAddSpan): * heap/ConservativeRoots.h: * heap/Heap.h: * heap/HeapInlines.h: (JSC::Heap::testAndSetMarked): * heap/HeapUtil.h: (JSC::HeapUtil::findGCObjectPointersForMarking): * heap/MarkedBlock.cpp: (JSC::MarkedBlock::MarkedBlock): * heap/MarkedBlock.h: (JSC::MarkedBlock::flipIfNecessary): (JSC::MarkedBlock::flipIfNecessaryConcurrently): (JSC::MarkedBlock::Handle::flipIfNecessary): (JSC::MarkedBlock::Handle::flipIfNecessaryConcurrently): * heap/MarkedSpace.cpp: (JSC::MarkedSpace::flip): * heap/MarkedSpace.h: (JSC::MarkedSpace::version): * heap/SlotVisitor.cpp: (JSC::SlotVisitor::SlotVisitor): * heap/SlotVisitor.h: 2016-09-08 Mark Lam Add support for a ternary sub32 emitter for ARM64 and 32-bit ARM. https://bugs.webkit.org/show_bug.cgi?id=161724 Reviewed by Filip Pizlo. ARM architectures support ternary sub instructions. We should make use of them in emitAllocateWithNonNullAllocator(). * assembler/MacroAssemblerARM.h: (JSC::MacroAssemblerARM::sub32): * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::sub32): * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::sub32): * assembler/MacroAssemblerSH4.h: (JSC::MacroAssemblerSH4::sub32): * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::sub32): * b3/air/AirOpcode.opcodes: * b3/testb3.cpp: (JSC::B3::testTernarySubInstructionSelection): (JSC::B3::run): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator): 2016-09-07 Andy VanWagoner [INTL] some valid language tags cause errors in Intl constructors https://bugs.webkit.org/show_bug.cgi?id=161672 Reviewed by Mark Lam. Fix private use tag parsing to match spec, allowing single character parts. https://www.rfc-editor.org/rfc/bcp/bcp47.txt ``` privateuse = "x" 1*("-" (1*8alphanum)) ``` * runtime/IntlObject.cpp: (JSC::privateUseLangTag): Allow singleton parts in private use tag. 2016-09-07 Filip Pizlo Make emitAllocateWithNonNullAllocator's sub32() disallow-scratch-friendly https://bugs.webkit.org/show_bug.cgi?id=161706 Reviewed by Geoffrey Garen. You can't sub32(Addr, Reg) on not-x86 without using a scratch register. So, on those CPUs, we have to do something different. * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator): 2016-09-07 Csaba Osztrogonác Fix the ENABLE(WEBASSEMBLY) build on Linux https://bugs.webkit.org/show_bug.cgi?id=161685 Unreviewed buildfix. * wasm/JSWASMModule.cpp: 2016-09-15 Filip Pizlo REGRESSION (r205462): Lot of leaks https://bugs.webkit.org/show_bug.cgi?id=161946 Reviewed by Saam Barati. We were forgetting to delete LargeAllocations on VM exit! * heap/MarkedSpace.cpp: (JSC::MarkedSpace::~MarkedSpace): 2016-09-06 Saam Barati ProxyObject's structure should not have ObjectPrototype as its prototype and it should not have special behavior for intercepting "__proto__" https://bugs.webkit.org/show_bug.cgi?id=161558 Reviewed by Benjamin Poulain. ProxyObject had ObjectPrototype as its direct prototype. This could lead to infinite loops when doing a getDirectPrototype() loop. Fixing this bug revealed another bug, which I made when implementing Proxy. We should not special case "__proto__" in get and set for Proxy Object's hooks. "__proto__" should just go through the normal set and get path. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/ProxyObject.cpp: (JSC::performProxyGet): (JSC::ProxyObject::put): 2016-09-06 Saam Barati Member call on NULL pointer in JavaScriptCore/dfg/DFGAbstractInterpretterInlines.h https://bugs.webkit.org/show_bug.cgi?id=160870 Reviewed by Darin Adler. Credit goes to Jonathan Bedard for finding this bug using the undefined behavior sanitizer. The rule for MaterializeNewObject inside AI was assuming that the graph is in SSA form. This used to be true when MaterializeNewObject was only inserted by the allocation sinking phase. However, Filip added more uses of MaterializeNewObject in his RegExp constant folding patch. This fixes the bug by using the structure set inside the Node's OpInfo rather than generating it from m_phiChildren inside AI. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter::executeEffects): 2016-09-06 Saam Barati Make JSMap and JSSet faster https://bugs.webkit.org/show_bug.cgi?id=160989 Reviewed by Filip Pizlo. This patch revamps how we implement Map and Set. It uses a new hash map implementation. The hash map uses linear probing and it uses Wang's 64 bit hash function for JSValues that aren't strings. Strings use StringImpl's hash function. The reason I wanted to roll our own HashTable is twofold: I didn't want to inline WTF::HashMap's implementation into our JIT, since that seems error prone and unmaintainable. Also, I wanted a different structure for hash map buckets where buckets also exist in a linked list. The reason for making buckets part of a linked list is that iteration is now simple. Iteration works by just traversing a linked list. This design also allows for a simple implementation when doing iteration while the hash table is mutating. Whenever we remove a bucket from the hash table, it is removed from the list, meaning items in the list don't point to it. However, the removed bucket will still point to things that are either in the list, or have also been removed. e.g, from a removed bucket, you can always follow pointers until you either find an item in the list, or you find the tail of the list. This is a really nice property because it means that a Map or Set does not need to reason about the all the iterators that point into its list. Also, whenever we add items to the Map or Set, we hijack the tail as the new item, and make the new item point to a newly created tail. This means that any iterator that pointed to the "tail" now points to non-tail items. This makes the implementation of adding things to the Map/Set while iterating easy. I also made Map.prototype.get, Map.prototype.has, and Set.prototype.has into intrinsics in the DFG. The IR can now reason about hash map operations and can even do CSE over Wang's hash function, hash map bucket lookups, hash map bucket loads, and testing if a key is in the hash table. This makes code patterns for Map like so, super fast in the FTL, since we will only be doing a single hash and hash bucket lookup: ``` function getKeyIfPresent(map, key) { if (map.has(key)) return map.get(key); } ``` This patch is roughly an 8% speedup on ES6SampleBench. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::not64): * bytecode/SpeculatedType.cpp: (JSC::speculationFromClassInfo): * bytecode/SpeculatedType.h: * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter::executeEffects): (JSC::DFG::AbstractInterpreter::execute): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::handleIntrinsicCall): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): * dfg/DFGEdge.h: (JSC::DFG::Edge::shift): (JSC::DFG::Edge::makeWord): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGHeapLocation.cpp: (WTF::printInternal): * dfg/DFGHeapLocation.h: * dfg/DFGNode.h: (JSC::DFG::Node::hasHeapPrediction): * dfg/DFGNodeType.h: * dfg/DFGOperations.cpp: * dfg/DFGOperations.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::SafeToExecuteEdge::operator()): (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::speculateMapObject): (JSC::DFG::SpeculativeJIT::speculateSetObject): (JSC::DFG::SpeculativeJIT::speculate): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::callOperation): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGUseKind.cpp: (WTF::printInternal): * dfg/DFGUseKind.h: (JSC::DFG::typeFilterFor): (JSC::DFG::isCell): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileMapHash): (JSC::FTL::DFG::LowerDFGToB3::compileGetMapBucket): (JSC::FTL::DFG::LowerDFGToB3::compileLoadFromJSMapBucket): (JSC::FTL::DFG::LowerDFGToB3::compileIsNonEmptyMapBucket): (JSC::FTL::DFG::LowerDFGToB3::lowMapObject): (JSC::FTL::DFG::LowerDFGToB3::lowSetObject): (JSC::FTL::DFG::LowerDFGToB3::lowMapBucket): (JSC::FTL::DFG::LowerDFGToB3::speculate): (JSC::FTL::DFG::LowerDFGToB3::speculateMapObject): (JSC::FTL::DFG::LowerDFGToB3::speculateSetObject): (JSC::FTL::DFG::LowerDFGToB3::setMapBucket): (JSC::FTL::DFG::LowerDFGToB3::lowRegExpObject): Deleted. (JSC::FTL::DFG::LowerDFGToB3::lowStorage): Deleted. (JSC::FTL::DFG::LowerDFGToB3::speculateRegExpObject): Deleted. (JSC::FTL::DFG::LowerDFGToB3::setStorage): Deleted. * jit/AssemblyHelpers.cpp: (JSC::AssemblyHelpers::wangsInt64Hash): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitAllocateDestructibleObject): Deleted. * jit/JITOperations.h: * parser/ModuleAnalyzer.cpp: (JSC::ModuleAnalyzer::ModuleAnalyzer): * runtime/HashMapImpl.cpp: Added. (JSC::HashMapBucket::visitChildren): (JSC::HashMapImpl::visitChildren): (JSC::HashMapImpl::copyBackingStore): * runtime/HashMapImpl.h: Added. (JSC::HashMapBucket::selectStructure): (JSC::HashMapBucket::createStructure): (JSC::HashMapBucket::create): (JSC::HashMapBucket::HashMapBucket): (JSC::HashMapBucket::setNext): (JSC::HashMapBucket::setPrev): (JSC::HashMapBucket::setKey): (JSC::HashMapBucket::setValue): (JSC::HashMapBucket::key): (JSC::HashMapBucket::value): (JSC::HashMapBucket::next): (JSC::HashMapBucket::prev): (JSC::HashMapBucket::deleted): (JSC::HashMapBucket::setDeleted): (JSC::HashMapBucket::offsetOfKey): (JSC::HashMapBucket::offsetOfValue): (JSC::HashMapBuffer::allocationSize): (JSC::HashMapBuffer::buffer): (JSC::HashMapBuffer::create): (JSC::areKeysEqual): (JSC::normalizeMapKey): (JSC::jsMapHash): (JSC::HashMapImpl::selectStructure): (JSC::HashMapImpl::createStructure): (JSC::HashMapImpl::create): (JSC::HashMapImpl::HashMapImpl): (JSC::HashMapImpl::buffer): (JSC::HashMapImpl::finishCreation): (JSC::HashMapImpl::emptyValue): (JSC::HashMapImpl::isEmpty): (JSC::HashMapImpl::deletedValue): (JSC::HashMapImpl::isDeleted): (JSC::HashMapImpl::findBucket): (JSC::HashMapImpl::get): (JSC::HashMapImpl::has): (JSC::HashMapImpl::add): (JSC::HashMapImpl::remove): (JSC::HashMapImpl::size): (JSC::HashMapImpl::clear): (JSC::HashMapImpl::bufferSizeInBytes): (JSC::HashMapImpl::offsetOfBuffer): (JSC::HashMapImpl::offsetOfCapacity): (JSC::HashMapImpl::head): (JSC::HashMapImpl::tail): (JSC::HashMapImpl::approximateSize): (JSC::HashMapImpl::findBucketAlreadyHashedAndNormalized): (JSC::HashMapImpl::rehash): (JSC::HashMapImpl::makeAndSetNewBuffer): * runtime/Intrinsic.h: * runtime/JSCJSValue.h: * runtime/JSCJSValueInlines.h: (JSC::sameValue): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/JSMap.cpp: (JSC::JSMap::destroy): Deleted. (JSC::JSMap::estimatedSize): Deleted. (JSC::JSMap::visitChildren): Deleted. (JSC::JSMap::copyBackingStore): Deleted. (JSC::JSMap::has): Deleted. (JSC::JSMap::size): Deleted. (JSC::JSMap::get): Deleted. (JSC::JSMap::set): Deleted. (JSC::JSMap::clear): Deleted. (JSC::JSMap::remove): Deleted. * runtime/JSMap.h: (JSC::JSMap::createStructure): (JSC::JSMap::create): (JSC::JSMap::get): (JSC::JSMap::set): (JSC::JSMap::JSMap): (JSC::JSMap::Entry::key): Deleted. (JSC::JSMap::Entry::value): Deleted. (JSC::JSMap::Entry::visitChildren): Deleted. (JSC::JSMap::Entry::setKey): Deleted. (JSC::JSMap::Entry::setKeyWithoutWriteBarrier): Deleted. (JSC::JSMap::Entry::setValue): Deleted. (JSC::JSMap::Entry::clear): Deleted. * runtime/JSMapIterator.cpp: (JSC::JSMapIterator::finishCreation): (JSC::JSMapIterator::visitChildren): (JSC::JSMapIterator::clone): * runtime/JSMapIterator.h: (JSC::JSMapIterator::advanceIter): (JSC::JSMapIterator::next): (JSC::JSMapIterator::nextKeyValue): (JSC::JSMapIterator::JSMapIterator): (JSC::JSMapIterator::setIterator): (JSC::JSMapIterator::finish): Deleted. (JSC::JSMapIterator::iteratorData): Deleted. * runtime/JSModuleLoader.cpp: (JSC::JSModuleLoader::finishCreation): * runtime/JSModuleLoader.h: (JSC::JSModuleLoader::create): * runtime/JSModuleRecord.cpp: (JSC::JSModuleRecord::finishCreation): * runtime/JSModuleRecord.h: (JSC::JSModuleRecord::create): * runtime/JSSet.cpp: (JSC::JSSet::destroy): Deleted. (JSC::JSSet::estimatedSize): Deleted. (JSC::JSSet::visitChildren): Deleted. (JSC::JSSet::copyBackingStore): Deleted. (JSC::JSSet::has): Deleted. (JSC::JSSet::size): Deleted. (JSC::JSSet::add): Deleted. (JSC::JSSet::clear): Deleted. (JSC::JSSet::remove): Deleted. * runtime/JSSet.h: (JSC::JSSet::createStructure): (JSC::JSSet::create): (JSC::JSSet::add): (JSC::JSSet::JSSet): (JSC::JSSet::Entry::key): Deleted. (JSC::JSSet::Entry::value): Deleted. (JSC::JSSet::Entry::visitChildren): Deleted. (JSC::JSSet::Entry::setKey): Deleted. (JSC::JSSet::Entry::setKeyWithoutWriteBarrier): Deleted. (JSC::JSSet::Entry::setValue): Deleted. (JSC::JSSet::Entry::clear): Deleted. * runtime/JSSetIterator.cpp: (JSC::JSSetIterator::finishCreation): (JSC::JSSetIterator::visitChildren): (JSC::JSSetIterator::clone): * runtime/JSSetIterator.h: (JSC::JSSetIterator::advanceIter): (JSC::JSSetIterator::next): (JSC::JSSetIterator::JSSetIterator): (JSC::JSSetIterator::setIterator): (JSC::JSSetIterator::finish): Deleted. (JSC::JSSetIterator::iteratorData): Deleted. * runtime/JSType.h: * runtime/MapBase.cpp: Added. (JSC::MapBase::visitChildren): (JSC::MapBase::estimatedSize): * runtime/MapBase.h: Added. (JSC::MapBase::size): (JSC::MapBase::has): (JSC::MapBase::clear): (JSC::MapBase::remove): (JSC::MapBase::findBucket): (JSC::MapBase::offsetOfHashMapImpl): (JSC::MapBase::impl): (JSC::MapBase::finishCreation): (JSC::MapBase::MapBase): * runtime/MapConstructor.cpp: (JSC::constructMap): * runtime/MapIteratorPrototype.cpp: (JSC::MapIteratorPrototypeFuncNext): * runtime/MapPrototype.cpp: (JSC::MapPrototype::finishCreation): (JSC::getMap): (JSC::privateFuncIsMap): (JSC::privateFuncMapIteratorNext): * runtime/PropertyDescriptor.cpp: (JSC::sameValue): Deleted. * runtime/PropertyDescriptor.h: * runtime/SetConstructor.cpp: (JSC::constructSet): * runtime/SetIteratorPrototype.cpp: (JSC::SetIteratorPrototypeFuncNext): * runtime/SetPrototype.cpp: (JSC::SetPrototype::finishCreation): (JSC::getSet): (JSC::privateFuncSetIteratorNext): * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: 2016-09-06 Benjamin Poulain [JSC] Make ArithClz32 work with Cell arguments https://bugs.webkit.org/show_bug.cgi?id=161369 Reviewed by Geoffrey Garen. ArithClz32 was already working with all primitive types thanks to the magic of ValueToInt32. This patch adds support for cell arguments through a function call. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter::executeEffects): * dfg/DFGClobberize.h: (JSC::DFG::clobberize): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGNodeType.h: * dfg/DFGOperations.cpp: * dfg/DFGOperations.h: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileArithClz32): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::callOperation): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileArithClz32): 2016-09-05 Filip Pizlo Heap::isMarked() should use concurrent lazy flipping https://bugs.webkit.org/show_bug.cgi?id=161613 Reviewed by Michael Catanzaro. I found out about this race condition via https://bugs.webkit.org/show_bug.cgi?id=160125#c233. The problem is that we use isMarked, and maybe even isLive, inside the concurrent mark phase. So, they need to lazy-flip in a non-racy way. * heap/HeapInlines.h: (JSC::Heap::isLive): (JSC::Heap::isMarked): 2016-08-31 Filip Pizlo Butterflies should be allocated in Auxiliary MarkedSpace instead of CopiedSpace and we should rewrite as much of the GC as needed to make this not a regression https://bugs.webkit.org/show_bug.cgi?id=160125 Reviewed by Geoffrey Garen and Keith Miller. In order to make the GC concurrent (bug 149432), we would either need to enable concurrent copying or we would need to not copy. Concurrent copying carries a 1-2% throughput overhead from the barriers alone. Considering that MarkedSpace does a decent job of avoiding fragmentation, it's unlikely that it's worth paying 1-2% throughput for copying. So, we want to get rid of copied space. This change moves copied space's biggest client over to marked space. Moving butterflies to marked space means having them use the new Auxiliary HeapCell allocation path. This is a fairly mechanical change, but it caused performance regressions everywhere, so this change also fixes MarkedSpace's performance issues. At a high level the mechanical changes are: - We use AuxiliaryBarrier instead of CopyBarrier. - We use tryAllocateAuxiliary instead of tryAllocateStorage. I got rid of the silly CheckedBoolean stuff, since it's so much more trouble than it's worth. - The JITs have to emit inlined marked space allocations instead of inline copy space allocations. - Everyone has to get used to zeroing their butterflies after allocation instead of relying on them being pre-zeroed by the GC. Copied space would zero things for you, while marked space doesn't. That's about 1/3 of this change. But this led to performance problems, which I fixed with optimizations that amounted to a major MarkedSpace rewrite: - MarkedSpace always causes internal fragmentation for array allocations because the vector length we choose when we resize usually leads to a cell size that doesn't correspond to any size class. I got around this by making array allocations usually round up vectorLength to the maximum allowed by the size class that we would have allocated in. Also, ensureLengthSlow() and friends first make sure that the requested length can't just be fulfilled with the current allocation size. This safeguard means that not every array allocation has to do size class queries. For example, the fast path of new Array(length) never does any size class queries, under the assumption that (1) the speed gained from avoiding an ensureLengthSlow() call, which then just changes the vectorLength by doing the size class query, is too small to offset the speed lost by doing the query on every allocation and (2) new Array(length) is a pretty good hint that resizing is not very likely. - Size classes in MarkedSpace were way too precise, which led to external fragmentation. This changes MarkedSpace size classes to use a linear progression for very small sizes followed by a geometric progression that naturally transitions to a hyperbolic progression. We want hyperbolic sizes when we get close to blockSize: for example the largest size we want is payloadSize / 2 rounded down, to ensure we get exactly two cells with minimal slop. The next size down should be payloadSize / 3 rounded down, and so on. After the last precise size (80 bytes), we proceed using a geometric progression, but round up each size to minimize slop at the end of the block. This naturally causes the geometric progression to turn hyperbolic for large sizes. The size class configuration happens at VM start-up, so it can be controlled with runtime options. I found that a base of 1.4 works pretty well. - Large allocations caused massive internal fragmentation, since the smallest large allocation had to use exactly blockSize, and the largest small allocation used blockSize / 2. The next size up - the first large allocation size to require two blocks - also had 50% internal fragmentation. This is because we required large allocations to be blockSize aligned, so that MarkedBlock::blockFor() would work. I decided to rewrite all of that. Cells no longer have to be owned by a MarkedBlock. They can now alternatively be owned by a LargeAllocation. These two things are abstracted as CellContainer. You know that a cell is owned by a LargeAllocation if the MarkedBlock::atomSize / 2 bit is set. Basically, large allocations are deliberately misaligned by 8 bytes. This actually works out great since (1) typed arrays won't use large allocations anyway since they have their own malloc fallback and (2) large array butterflies already have a 8 byte header, which means that the 8 byte base misalignment aligns the large array payload on a 16 byte boundary. I took extreme care to make sure that the isLargeAllocation bit checks are as rare as possible; for example, ExecState::vm() skips the check because we know that callees must be small allocations. It's also possible to use template tricks to do one check for cell container kind, and then invoke a function specialized for MarkedBlock or a function specialized for LargeAllocation. LargeAllocation includes stubs for all MarkedBlock methods that get used from functions that are template-specialized like this. That's mostly to speed up the GC marking code. Most other code can use CellContainer API or HeapCell API directly. That's another thing: HeapCell, the common base of JSCell and auxiliary allocations, is now smart enough to do a lot of things for you, like HeapCell::vm(), HeapCell::heap(), HeapCell::isLargeAllocation(), and HeapCell::cellContainer(). The size cutoff for large allocations is runtime-configurable, so long as you don't choose something so small that callees end up large. I found that 400 bytes is roughly optimal. This means that the MarkedBlock size classes end up being: 16, 32, 48, 64, 80, 112, 160, 224, 320 The next size class would have been 432, but that's above the 400 byte cutoff. All of this is configurable with --sizeClassProgression and --largeAllocationCutoff. You can see what size classes you end up with by doing --dumpSizeClasses=true. - Copied space uses 64KB blocks, while marked space used to use 16KB blocks. Allocating a lot of stuff in 16KB blocks was slower than allocating it in 64KB blocks because the GC had a lot of per-block overhead. I removed this overhead: It's now 2x faster to scan all MarkedBlocks because the list that contains the interesting meta-data is allocated on the side, for better locality during a sequential walk. It's no longer necessary to scan MarkedBlocks to find WeakSets, since the sets of WeakSets for eden scan and full scan are maintained on-the-fly. It's no longer necessary to scan all MarkedBlocks to clear mark bits because we now use versioned mark bits: to clear then, just increment the 64-bit heap version. It's no longer necessary to scan retired MarkedBlocks while allocating because marking retires them on-the-fly. It's no longer necessary to sort all blocks in the IncrementalSweeper's snapshot because blocks now know if they are in the snapshot. Put together, these optimizations allowed me to reduce block size to 16KB without losing much performance. There is some small perf loss on JetStream/splay, but not enough to hurt JetStream overall. I tried reducing block sizes further, to 4KB, since that is a progression on membuster. That's not possible yet, since there is still enough per-block overhead yet that such a reduction hurts JetStream too much. I filed a bug about improving this further: https://bugs.webkit.org/show_bug.cgi?id=161581. - Even after all of that, copying butterflies was still faster because it allowed us to skip sweeping dead space. A good GC allocates over dead bytes without explicitly freeing them, so the GC pause is O(size of live), not O(size of live + dead). O(dead) is usually much larger than O(live), especially in an eden collection. Copying satisfies this premise while mark+sweep does not. So, I invented a new kind of allocator: bump'n'pop. Previously, our MarkedSpace allocator was a freelist pop. That's simple and easy to inline but requires that we walk the block to build a free list. This means walking dead space. The new allocator allows totally free MarkedBlocks to simply set up a bump-pointer arena instead. The allocator is a hybrid of bump-pointer and freelist pop. It tries bump first. The bump pointer always bumps by cellSize, so the result of filling a block with bumping looks as if we had used freelist popping to fill it. Additionally, each MarkedBlock now has a bit to quickly tell if the block is entirely free. This makes sweeping O(1) whenever a MarkedBlock is completely empty, which is the common case because of the generational hypothesis: the number of objects that survive an eden collection is a tiny fraction of the number of objects that had been allocated, and this fraction is so small that there are typically fewer than one survivors per MarkedBlock. This change was enough to make this change a net win over tip-of-tree. - FTL now shares the same allocation fast paths as everything else, which is great, because bump'n'pop has gnarly control flow. We don't really want B3 to have to think about that control flow, since it won't be able to improve the machine code we write ourselves. GC fast paths are best written in assembly. So, I've empowered B3 to have even better support for Patchpoint terminals. It's now totally fine for a Patchpoint terminal to be non-Void. So, the new FTL allocation fast paths are just Patchpoint terminals that call through to AssemblyHelpers::emitAllocate(). B3 still reasons about things like constant-folding the size class calculation and constant-hoisting the allocator. Also, I gave the FTL the ability to constant-fold some allocator logic (in case we first assume that we're doing a variable-length allocation but then realize that the length is known). I think it makes sense to have constant folding rules in FTL::Output, or whatever the B3 IR builder is, since this makes lowering easier (you can constant fold during lowering more easily) and it reduces the amount of malloc traffic. In the future, we could teach B3 how to better constant-fold this code. That would require allowing loads to be constant-folded, which is doable but hella tricky. - It used to be that if a logical object allocation required two physical allocations (first the butterfly and then the cell), then the JIT would emit the code in such a way that a failure in the second fast path would cause us to forget the successful first physical allocation. This was pointlessly wasteful. It turns out that it's very cheap to devote a register to storing either the butterfly or null, because the butterfly register is anyway going to be free inside the first allocation. The only overhead here is zeroing the butterfly register. With that in place, we can just pass the butterfly-or-null to the slow path, which can then either allocate a butterfly or not. So now we never waste a successful allocation. This patch implements such a solution both in DFG (where it's easy to do this since we control registers already) and in FTL (where it's annoying, because mutable "butterfly-or-null" variables are hard to say in SSA; also I realized that we had code duplicated the JSArray allocation utility, so I deduplicated it). This came up because in one version of this patch, this wastage would resonate with some Kraken benchmark: the benchmark would always allocate N small things followed by one bigger thing. The problem was I accidentally adjusted the various fixed overheads in MarkedBlock in such a way that the JSObject size class, which both the small and big thing shared for their cell, could hold exactly N cells per MarkedBlock. Then the benchmark would always call slow path when it allocated the big thing. So, it would end up having to allocate the big thing's large butterfly twice, every single time! Ouch! - It used to be that we zeroed CopiedBlocks using memset, and so array allocations enjoyed amortization of the cost of zeroing. This doesn't work anymore - it's now up to the client of the allocator to initialize the object to whatever state they need. It used to be that we would just use a dumb loop. I initially changed this so that we would end up in memset for large allocations, but this didn't actually help performance that much. I got a much better result by playing with different memsets written in assembly. First I wrote one using non-temporal stores. That was a small speed-up over memset. Then I tried the classic "rep stos" approach, and holy cow that version was fast. It's a ~20% speed-up on array allocation microbenchmarks. So, this patch adds code paths to do "rep stos" on x86_64, or memset, or use a loop, as appropriate, for both "contiguous" arrays (holes are zero) and double arrays (holes are PNaN). Note that the JIT always emits either a loop or a flat slab of stores (if the size is known), but those paths in the JIT won't trigger for NewArrayWithSize() if the size is large, since that takes us to the operationNewArrayWithSize() slow path, which calls into JSArray::create(). That's why the optimizations here are all in JSArray::create() - that's the hot place for large arrays that need to be filled with holes. All of this put together gives us neutral perf on JetStream, membuster, and PLT3, a ~1% regression on Speedometer, and up to a 4% regression Kraken. The Kraken regression is because Kraken was allocating exactly 1024 element arrays at a rate of 400MB/sec. This is a best-case scenario for bump allocation. I think that we should fix bmalloc to make up the difference, but take the hit for now because it's a crazy corner case. By comparison, the alternative approach of using a copy barrier would have cost us 1-2%. That's the real apples-to-apples comparison if your premise is that we should have a concurrent GC. After we finish removing copied space, we will be barrier-ready for concurrent GC: we already have a marking barrier and we simply won't need a copying barrier. This change gets us there for the purposes of our benchmarks, since the remaining clients of copied space are not very important. On the other hand, if we keep copying, then getting barrier-ready would mean adding back the copy barrier, which costs more perf. We might get bigger speed-ups once we remove CopiedSpace altogether. That requires moving typed arrays and a few other weird things over to Aux MarkedSpace. This also includes some header sanitization. The introduction of AuxiliaryBarrier, HeapCell, and CellContainer meant that I had to include those files from everywhere. Fortunately, just including JSCInlines.h (instead of manually including the files that includes) is usually enough. So, I made most of JSC's cpp files include JSCInlines.h, which is something that we were already basically doing. In places where JSCInlines.h would be too much, I just included HeapInlines.h. This got weird, because we previously included HeapInlines.h from JSObject.h. That's bad because it led to some circular dependencies, so I fixed it - but that meant having to manually include HeapInlines.h from the places that previously got it implicitly via JSObject.h. But that led to more problems for some reason: I started getting build errors because non-JSC files were having trouble including Opcode.h. That's just silly, since Opcode.h is meant to be an internal JSC header. So, I made it an internal header and made it impossible to include it from outside JSC. This was a lot of work, but it was necessary to get the patch to build on all ports. It's also a net win. There were many places in WebCore that were transitively including a *ton* of JSC headers just because of the JSObject.h->HeapInlines.h edge and a bunch of dependency edges that arose from some public (for WebCore) JSC headers needing Interpreter.h or Opcode.h for bad reasons. * API/JSManagedValue.mm: (-[JSManagedValue initWithValue:]): * API/JSTypedArray.cpp: * API/ObjCCallbackFunction.mm: * API/tests/testapi.mm: (testObjectiveCAPI): (testWeakValue): Deleted. * CMakeLists.txt: * JavaScriptCore.xcodeproj/project.pbxproj: * Scripts/builtins/builtins_generate_combined_implementation.py: (BuiltinsCombinedImplementationGenerator.generate_secondary_header_includes): * Scripts/builtins/builtins_generate_internals_wrapper_implementation.py: (BuiltinsInternalsWrapperImplementationGenerator.generate_secondary_header_includes): * Scripts/builtins/builtins_generate_separate_implementation.py: (BuiltinsSeparateImplementationGenerator.generate_secondary_header_includes): * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::JumpList::link): (JSC::AbstractMacroAssembler::JumpList::linkTo): * assembler/MacroAssembler.h: * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::add32): * assembler/MacroAssemblerCodeRef.cpp: Added. (JSC::MacroAssemblerCodePtr::createLLIntCodePtr): (JSC::MacroAssemblerCodePtr::dumpWithName): (JSC::MacroAssemblerCodePtr::dump): (JSC::MacroAssemblerCodeRef::createLLIntCodeRef): (JSC::MacroAssemblerCodeRef::dump): * assembler/MacroAssemblerCodeRef.h: (JSC::MacroAssemblerCodePtr::createLLIntCodePtr): Deleted. (JSC::MacroAssemblerCodePtr::dumpWithName): Deleted. (JSC::MacroAssemblerCodePtr::dump): Deleted. (JSC::MacroAssemblerCodeRef::createLLIntCodeRef): Deleted. (JSC::MacroAssemblerCodeRef::dump): Deleted. * b3/B3BasicBlock.cpp: (JSC::B3::BasicBlock::appendBoolConstant): * b3/B3BasicBlock.h: * b3/B3DuplicateTails.cpp: * b3/B3StackmapGenerationParams.h: * b3/testb3.cpp: (JSC::B3::testPatchpointTerminalReturnValue): (JSC::B3::run): * bindings/ScriptValue.cpp: * bytecode/AdaptiveInferredPropertyValueWatchpointBase.cpp: * bytecode/BytecodeBasicBlock.cpp: * bytecode/BytecodeLivenessAnalysis.cpp: * bytecode/BytecodeUseDef.h: * bytecode/CallLinkInfo.cpp: (JSC::CallLinkInfo::callTypeFor): * bytecode/CallLinkInfo.h: (JSC::CallLinkInfo::callTypeFor): Deleted. * bytecode/CallLinkStatus.cpp: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::finishCreation): (JSC::CodeBlock::clearLLIntGetByIdCache): (JSC::CodeBlock::predictedMachineCodeSize): * bytecode/CodeBlock.h: (JSC::CodeBlock::jitCodeMap): Deleted. (JSC::clearLLIntGetByIdCache): Deleted. * bytecode/ExecutionCounter.h: * bytecode/Instruction.h: * bytecode/LLIntPrototypeLoadAdaptiveStructureWatchpoint.cpp: (JSC::LLIntPrototypeLoadAdaptiveStructureWatchpoint::fireInternal): * bytecode/ObjectAllocationProfile.h: (JSC::ObjectAllocationProfile::isNull): (JSC::ObjectAllocationProfile::initialize): * bytecode/Opcode.h: (JSC::padOpcodeName): * bytecode/PolymorphicAccess.cpp: (JSC::AccessCase::generateImpl): (JSC::PolymorphicAccess::regenerate): * bytecode/PolymorphicAccess.h: * bytecode/PreciseJumpTargets.cpp: * bytecode/StructureStubInfo.cpp: * bytecode/StructureStubInfo.h: * bytecode/UnlinkedCodeBlock.cpp: (JSC::UnlinkedCodeBlock::vm): Deleted. * bytecode/UnlinkedCodeBlock.h: * bytecode/UnlinkedInstructionStream.cpp: * bytecode/UnlinkedInstructionStream.h: * dfg/DFGOperations.cpp: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateRawObject): (JSC::DFG::SpeculativeJIT::compileMakeRope): (JSC::DFG::SpeculativeJIT::compileAllocatePropertyStorage): (JSC::DFG::SpeculativeJIT::compileReallocatePropertyStorage): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::emitAllocateJSCell): (JSC::DFG::SpeculativeJIT::emitAllocateJSObject): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): (JSC::DFG::SpeculativeJIT::compileAllocateNewArrayWithSize): * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): * ftl/FTLAbstractHeapRepository.h: * ftl/FTLCompile.cpp: * ftl/FTLJITFinalizer.cpp: * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileCreateDirectArguments): (JSC::FTL::DFG::LowerDFGToB3::compileCreateRest): (JSC::FTL::DFG::LowerDFGToB3::allocateArrayWithSize): (JSC::FTL::DFG::LowerDFGToB3::compileNewArrayWithSize): (JSC::FTL::DFG::LowerDFGToB3::compileMakeRope): (JSC::FTL::DFG::LowerDFGToB3::compileMaterializeNewObject): (JSC::FTL::DFG::LowerDFGToB3::initializeArrayElements): (JSC::FTL::DFG::LowerDFGToB3::allocatePropertyStorageWithSizeImpl): (JSC::FTL::DFG::LowerDFGToB3::allocateHeapCell): (JSC::FTL::DFG::LowerDFGToB3::allocateCell): (JSC::FTL::DFG::LowerDFGToB3::allocateObject): (JSC::FTL::DFG::LowerDFGToB3::allocatorForSize): (JSC::FTL::DFG::LowerDFGToB3::allocateVariableSizedObject): (JSC::FTL::DFG::LowerDFGToB3::allocateJSArray): (JSC::FTL::DFG::LowerDFGToB3::compileAllocateArrayWithSize): Deleted. * ftl/FTLOutput.cpp: (JSC::FTL::Output::constBool): (JSC::FTL::Output::add): (JSC::FTL::Output::shl): (JSC::FTL::Output::aShr): (JSC::FTL::Output::lShr): (JSC::FTL::Output::zeroExt): (JSC::FTL::Output::equal): (JSC::FTL::Output::notEqual): (JSC::FTL::Output::above): (JSC::FTL::Output::aboveOrEqual): (JSC::FTL::Output::below): (JSC::FTL::Output::belowOrEqual): (JSC::FTL::Output::greaterThan): (JSC::FTL::Output::greaterThanOrEqual): (JSC::FTL::Output::lessThan): (JSC::FTL::Output::lessThanOrEqual): (JSC::FTL::Output::select): (JSC::FTL::Output::appendSuccessor): (JSC::FTL::Output::addIncomingToPhi): * ftl/FTLOutput.h: * ftl/FTLValueFromBlock.h: (JSC::FTL::ValueFromBlock::operator bool): (JSC::FTL::ValueFromBlock::ValueFromBlock): Deleted. * ftl/FTLWeightedTarget.h: (JSC::FTL::WeightedTarget::frequentedBlock): * heap/CellContainer.h: Added. (JSC::CellContainer::CellContainer): (JSC::CellContainer::operator bool): (JSC::CellContainer::isMarkedBlock): (JSC::CellContainer::isLargeAllocation): (JSC::CellContainer::markedBlock): (JSC::CellContainer::largeAllocation): * heap/CellContainerInlines.h: Added. (JSC::CellContainer::isMarked): (JSC::CellContainer::isMarkedOrNewlyAllocated): (JSC::CellContainer::noteMarked): (JSC::CellContainer::cellSize): (JSC::CellContainer::weakSet): (JSC::CellContainer::flipIfNecessary): * heap/ConservativeRoots.cpp: (JSC::ConservativeRoots::ConservativeRoots): (JSC::ConservativeRoots::~ConservativeRoots): (JSC::ConservativeRoots::grow): (JSC::ConservativeRoots::genericAddPointer): (JSC::ConservativeRoots::genericAddSpan): * heap/ConservativeRoots.h: (JSC::ConservativeRoots::roots): * heap/CopyToken.h: * heap/FreeList.cpp: Added. (JSC::FreeList::dump): * heap/FreeList.h: Added. (JSC::FreeList::FreeList): (JSC::FreeList::list): (JSC::FreeList::bump): (JSC::FreeList::operator==): (JSC::FreeList::operator!=): (JSC::FreeList::operator bool): (JSC::FreeList::allocationWillFail): (JSC::FreeList::allocationWillSucceed): * heap/GCTypeMap.h: Added. (JSC::GCTypeMap::operator[]): * heap/Heap.cpp: (JSC::Heap::Heap): (JSC::Heap::lastChanceToFinalize): (JSC::Heap::finalizeUnconditionalFinalizers): (JSC::Heap::markRoots): (JSC::Heap::copyBackingStores): (JSC::Heap::gatherStackRoots): (JSC::Heap::gatherJSStackRoots): (JSC::Heap::gatherScratchBufferRoots): (JSC::Heap::clearLivenessData): (JSC::Heap::visitSmallStrings): (JSC::Heap::visitConservativeRoots): (JSC::Heap::removeDeadCompilerWorklistEntries): (JSC::Heap::gatherExtraHeapSnapshotData): (JSC::Heap::removeDeadHeapSnapshotNodes): (JSC::Heap::visitProtectedObjects): (JSC::Heap::visitArgumentBuffers): (JSC::Heap::visitException): (JSC::Heap::visitStrongHandles): (JSC::Heap::visitHandleStack): (JSC::Heap::visitSamplingProfiler): (JSC::Heap::traceCodeBlocksAndJITStubRoutines): (JSC::Heap::converge): (JSC::Heap::visitWeakHandles): (JSC::Heap::updateObjectCounts): (JSC::Heap::clearUnmarkedExecutables): (JSC::Heap::deleteUnmarkedCompiledCode): (JSC::Heap::collectAllGarbage): (JSC::Heap::collect): (JSC::Heap::collectWithoutAnySweep): (JSC::Heap::collectImpl): (JSC::Heap::suspendCompilerThreads): (JSC::Heap::willStartCollection): (JSC::Heap::flushOldStructureIDTables): (JSC::Heap::flushWriteBarrierBuffer): (JSC::Heap::stopAllocation): (JSC::Heap::prepareForMarking): (JSC::Heap::reapWeakHandles): (JSC::Heap::pruneStaleEntriesFromWeakGCMaps): (JSC::Heap::sweepArrayBuffers): (JSC::MarkedBlockSnapshotFunctor::MarkedBlockSnapshotFunctor): (JSC::MarkedBlockSnapshotFunctor::operator()): (JSC::Heap::snapshotMarkedSpace): (JSC::Heap::deleteSourceProviderCaches): (JSC::Heap::notifyIncrementalSweeper): (JSC::Heap::writeBarrierCurrentlyExecutingCodeBlocks): (JSC::Heap::resetAllocators): (JSC::Heap::updateAllocationLimits): (JSC::Heap::didFinishCollection): (JSC::Heap::resumeCompilerThreads): (JSC::Zombify::visit): (JSC::Heap::forEachCodeBlockImpl): * heap/Heap.h: (JSC::Heap::allocatorForObjectWithoutDestructor): (JSC::Heap::allocatorForObjectWithDestructor): (JSC::Heap::allocatorForAuxiliaryData): (JSC::Heap::jitStubRoutines): (JSC::Heap::codeBlockSet): (JSC::Heap::storageAllocator): Deleted. * heap/HeapCell.h: (JSC::HeapCell::isZapped): Deleted. * heap/HeapCellInlines.h: Added. (JSC::HeapCell::isLargeAllocation): (JSC::HeapCell::cellContainer): (JSC::HeapCell::markedBlock): (JSC::HeapCell::largeAllocation): (JSC::HeapCell::heap): (JSC::HeapCell::vm): (JSC::HeapCell::cellSize): (JSC::HeapCell::allocatorAttributes): (JSC::HeapCell::destructionMode): (JSC::HeapCell::cellKind): * heap/HeapInlines.h: (JSC::Heap::heap): (JSC::Heap::isLive): (JSC::Heap::isMarked): (JSC::Heap::testAndSetMarked): (JSC::Heap::setMarked): (JSC::Heap::cellSize): (JSC::Heap::forEachCodeBlock): (JSC::Heap::allocateObjectOfType): (JSC::Heap::subspaceForObjectOfType): (JSC::Heap::allocatorForObjectOfType): (JSC::Heap::allocateAuxiliary): (JSC::Heap::tryAllocateAuxiliary): (JSC::Heap::tryReallocateAuxiliary): (JSC::Heap::isPointerGCObject): Deleted. (JSC::Heap::isValueGCObject): Deleted. * heap/HeapOperation.cpp: Added. (WTF::printInternal): * heap/HeapOperation.h: * heap/HeapUtil.h: Added. (JSC::HeapUtil::findGCObjectPointersForMarking): (JSC::HeapUtil::isPointerGCObjectJSCell): (JSC::HeapUtil::isValueGCObject): * heap/IncrementalSweeper.cpp: (JSC::IncrementalSweeper::sweepNextBlock): * heap/IncrementalSweeper.h: * heap/LargeAllocation.cpp: Added. (JSC::LargeAllocation::tryCreate): (JSC::LargeAllocation::LargeAllocation): (JSC::LargeAllocation::lastChanceToFinalize): (JSC::LargeAllocation::shrink): (JSC::LargeAllocation::visitWeakSet): (JSC::LargeAllocation::reapWeakSet): (JSC::LargeAllocation::flip): (JSC::LargeAllocation::isEmpty): (JSC::LargeAllocation::sweep): (JSC::LargeAllocation::destroy): (JSC::LargeAllocation::dump): * heap/LargeAllocation.h: Added. (JSC::LargeAllocation::fromCell): (JSC::LargeAllocation::cell): (JSC::LargeAllocation::isLargeAllocation): (JSC::LargeAllocation::heap): (JSC::LargeAllocation::vm): (JSC::LargeAllocation::weakSet): (JSC::LargeAllocation::clearNewlyAllocated): (JSC::LargeAllocation::isNewlyAllocated): (JSC::LargeAllocation::isMarked): (JSC::LargeAllocation::isMarkedOrNewlyAllocated): (JSC::LargeAllocation::isLive): (JSC::LargeAllocation::hasValidCell): (JSC::LargeAllocation::cellSize): (JSC::LargeAllocation::aboveLowerBound): (JSC::LargeAllocation::belowUpperBound): (JSC::LargeAllocation::contains): (JSC::LargeAllocation::attributes): (JSC::LargeAllocation::flipIfNecessary): (JSC::LargeAllocation::flipIfNecessaryConcurrently): (JSC::LargeAllocation::testAndSetMarked): (JSC::LargeAllocation::setMarked): (JSC::LargeAllocation::clearMarked): (JSC::LargeAllocation::noteMarked): (JSC::LargeAllocation::headerSize): * heap/MarkedAllocator.cpp: (JSC::MarkedAllocator::MarkedAllocator): (JSC::MarkedAllocator::isPagedOut): (JSC::MarkedAllocator::retire): (JSC::MarkedAllocator::filterNextBlock): (JSC::MarkedAllocator::setNextBlockToSweep): (JSC::MarkedAllocator::tryAllocateWithoutCollectingImpl): (JSC::MarkedAllocator::tryAllocateWithoutCollecting): (JSC::MarkedAllocator::allocateSlowCase): (JSC::MarkedAllocator::tryAllocateSlowCase): (JSC::MarkedAllocator::allocateSlowCaseImpl): (JSC::blockHeaderSize): (JSC::MarkedAllocator::blockSizeForBytes): (JSC::MarkedAllocator::tryAllocateBlock): (JSC::MarkedAllocator::addBlock): (JSC::MarkedAllocator::removeBlock): (JSC::MarkedAllocator::stopAllocating): (JSC::MarkedAllocator::reset): (JSC::MarkedAllocator::lastChanceToFinalize): (JSC::MarkedAllocator::setFreeList): (JSC::isListPagedOut): Deleted. (JSC::MarkedAllocator::tryAllocateHelper): Deleted. (JSC::MarkedAllocator::tryPopFreeList): Deleted. (JSC::MarkedAllocator::tryAllocate): Deleted. (JSC::MarkedAllocator::allocateBlock): Deleted. * heap/MarkedAllocator.h: (JSC::MarkedAllocator::takeLastActiveBlock): (JSC::MarkedAllocator::offsetOfFreeList): (JSC::MarkedAllocator::offsetOfCellSize): (JSC::MarkedAllocator::tryAllocate): (JSC::MarkedAllocator::allocate): (JSC::MarkedAllocator::forEachBlock): (JSC::MarkedAllocator::offsetOfFreeListHead): Deleted. (JSC::MarkedAllocator::MarkedAllocator): Deleted. (JSC::MarkedAllocator::init): Deleted. (JSC::MarkedAllocator::stopAllocating): Deleted. * heap/MarkedBlock.cpp: (JSC::MarkedBlock::tryCreate): (JSC::MarkedBlock::Handle::Handle): (JSC::MarkedBlock::Handle::~Handle): (JSC::MarkedBlock::MarkedBlock): (JSC::MarkedBlock::Handle::specializedSweep): (JSC::MarkedBlock::Handle::sweep): (JSC::MarkedBlock::Handle::sweepHelperSelectScribbleMode): (JSC::MarkedBlock::Handle::sweepHelperSelectStateAndSweepMode): (JSC::MarkedBlock::Handle::unsweepWithNoNewlyAllocated): (JSC::SetNewlyAllocatedFunctor::SetNewlyAllocatedFunctor): (JSC::SetNewlyAllocatedFunctor::operator()): (JSC::MarkedBlock::Handle::stopAllocating): (JSC::MarkedBlock::Handle::lastChanceToFinalize): (JSC::MarkedBlock::Handle::resumeAllocating): (JSC::MarkedBlock::Handle::zap): (JSC::MarkedBlock::Handle::forEachFreeCell): (JSC::MarkedBlock::flipIfNecessary): (JSC::MarkedBlock::Handle::flipIfNecessary): (JSC::MarkedBlock::flipIfNecessarySlow): (JSC::MarkedBlock::flipIfNecessaryConcurrentlySlow): (JSC::MarkedBlock::clearMarks): (JSC::MarkedBlock::assertFlipped): (JSC::MarkedBlock::needsFlip): (JSC::MarkedBlock::Handle::needsFlip): (JSC::MarkedBlock::Handle::willRemoveBlock): (JSC::MarkedBlock::Handle::didConsumeFreeList): (JSC::MarkedBlock::markCount): (JSC::MarkedBlock::Handle::isEmpty): (JSC::MarkedBlock::clearHasAnyMarked): (JSC::MarkedBlock::noteMarkedSlow): (WTF::printInternal): (JSC::MarkedBlock::create): Deleted. (JSC::MarkedBlock::destroy): Deleted. (JSC::MarkedBlock::callDestructor): Deleted. (JSC::MarkedBlock::specializedSweep): Deleted. (JSC::MarkedBlock::sweep): Deleted. (JSC::MarkedBlock::sweepHelper): Deleted. (JSC::MarkedBlock::stopAllocating): Deleted. (JSC::MarkedBlock::clearMarksWithCollectionType): Deleted. (JSC::MarkedBlock::lastChanceToFinalize): Deleted. (JSC::MarkedBlock::resumeAllocating): Deleted. (JSC::MarkedBlock::didRetireBlock): Deleted. * heap/MarkedBlock.h: (JSC::MarkedBlock::VoidFunctor::returnValue): (JSC::MarkedBlock::CountFunctor::CountFunctor): (JSC::MarkedBlock::CountFunctor::count): (JSC::MarkedBlock::CountFunctor::returnValue): (JSC::MarkedBlock::Handle::hasAnyNewlyAllocated): (JSC::MarkedBlock::Handle::isOnBlocksToSweep): (JSC::MarkedBlock::Handle::setIsOnBlocksToSweep): (JSC::MarkedBlock::Handle::state): (JSC::MarkedBlock::needsDestruction): (JSC::MarkedBlock::handle): (JSC::MarkedBlock::Handle::block): (JSC::MarkedBlock::firstAtom): (JSC::MarkedBlock::atoms): (JSC::MarkedBlock::isAtomAligned): (JSC::MarkedBlock::Handle::cellAlign): (JSC::MarkedBlock::blockFor): (JSC::MarkedBlock::Handle::allocator): (JSC::MarkedBlock::Handle::heap): (JSC::MarkedBlock::Handle::vm): (JSC::MarkedBlock::vm): (JSC::MarkedBlock::Handle::weakSet): (JSC::MarkedBlock::weakSet): (JSC::MarkedBlock::Handle::shrink): (JSC::MarkedBlock::Handle::visitWeakSet): (JSC::MarkedBlock::Handle::reapWeakSet): (JSC::MarkedBlock::Handle::cellSize): (JSC::MarkedBlock::cellSize): (JSC::MarkedBlock::Handle::attributes): (JSC::MarkedBlock::attributes): (JSC::MarkedBlock::Handle::needsDestruction): (JSC::MarkedBlock::Handle::destruction): (JSC::MarkedBlock::Handle::cellKind): (JSC::MarkedBlock::Handle::markCount): (JSC::MarkedBlock::Handle::size): (JSC::MarkedBlock::atomNumber): (JSC::MarkedBlock::flipIfNecessary): (JSC::MarkedBlock::flipIfNecessaryConcurrently): (JSC::MarkedBlock::Handle::flipIfNecessary): (JSC::MarkedBlock::Handle::flipIfNecessaryConcurrently): (JSC::MarkedBlock::Handle::flipForEdenCollection): (JSC::MarkedBlock::assertFlipped): (JSC::MarkedBlock::Handle::assertFlipped): (JSC::MarkedBlock::isMarked): (JSC::MarkedBlock::testAndSetMarked): (JSC::MarkedBlock::Handle::isNewlyAllocated): (JSC::MarkedBlock::Handle::setNewlyAllocated): (JSC::MarkedBlock::Handle::clearNewlyAllocated): (JSC::MarkedBlock::Handle::isMarkedOrNewlyAllocated): (JSC::MarkedBlock::isMarkedOrNewlyAllocated): (JSC::MarkedBlock::Handle::isLive): (JSC::MarkedBlock::isAtom): (JSC::MarkedBlock::Handle::isLiveCell): (JSC::MarkedBlock::Handle::forEachCell): (JSC::MarkedBlock::Handle::forEachLiveCell): (JSC::MarkedBlock::Handle::forEachDeadCell): (JSC::MarkedBlock::Handle::needsSweeping): (JSC::MarkedBlock::Handle::isAllocated): (JSC::MarkedBlock::Handle::isMarked): (JSC::MarkedBlock::Handle::isFreeListed): (JSC::MarkedBlock::hasAnyMarked): (JSC::MarkedBlock::noteMarked): (WTF::MarkedBlockHash::hash): (JSC::MarkedBlock::FreeList::FreeList): Deleted. (JSC::MarkedBlock::allocator): Deleted. (JSC::MarkedBlock::heap): Deleted. (JSC::MarkedBlock::shrink): Deleted. (JSC::MarkedBlock::visitWeakSet): Deleted. (JSC::MarkedBlock::reapWeakSet): Deleted. (JSC::MarkedBlock::willRemoveBlock): Deleted. (JSC::MarkedBlock::didConsumeFreeList): Deleted. (JSC::MarkedBlock::markCount): Deleted. (JSC::MarkedBlock::isEmpty): Deleted. (JSC::MarkedBlock::destruction): Deleted. (JSC::MarkedBlock::cellKind): Deleted. (JSC::MarkedBlock::size): Deleted. (JSC::MarkedBlock::capacity): Deleted. (JSC::MarkedBlock::setMarked): Deleted. (JSC::MarkedBlock::clearMarked): Deleted. (JSC::MarkedBlock::isNewlyAllocated): Deleted. (JSC::MarkedBlock::setNewlyAllocated): Deleted. (JSC::MarkedBlock::clearNewlyAllocated): Deleted. (JSC::MarkedBlock::isLive): Deleted. (JSC::MarkedBlock::isLiveCell): Deleted. (JSC::MarkedBlock::forEachCell): Deleted. (JSC::MarkedBlock::forEachLiveCell): Deleted. (JSC::MarkedBlock::forEachDeadCell): Deleted. (JSC::MarkedBlock::needsSweeping): Deleted. (JSC::MarkedBlock::isAllocated): Deleted. (JSC::MarkedBlock::isMarkedOrRetired): Deleted. * heap/MarkedSpace.cpp: (JSC::MarkedSpace::initializeSizeClassForStepSize): (JSC::MarkedSpace::MarkedSpace): (JSC::MarkedSpace::~MarkedSpace): (JSC::MarkedSpace::lastChanceToFinalize): (JSC::MarkedSpace::allocate): (JSC::MarkedSpace::tryAllocate): (JSC::MarkedSpace::allocateLarge): (JSC::MarkedSpace::tryAllocateLarge): (JSC::MarkedSpace::sweep): (JSC::MarkedSpace::sweepLargeAllocations): (JSC::MarkedSpace::zombifySweep): (JSC::MarkedSpace::resetAllocators): (JSC::MarkedSpace::visitWeakSets): (JSC::MarkedSpace::reapWeakSets): (JSC::MarkedSpace::stopAllocating): (JSC::MarkedSpace::prepareForMarking): (JSC::MarkedSpace::resumeAllocating): (JSC::MarkedSpace::isPagedOut): (JSC::MarkedSpace::freeBlock): (JSC::MarkedSpace::freeOrShrinkBlock): (JSC::MarkedSpace::shrink): (JSC::MarkedSpace::clearNewlyAllocated): (JSC::VerifyMarked::operator()): (JSC::MarkedSpace::flip): (JSC::MarkedSpace::objectCount): (JSC::MarkedSpace::size): (JSC::MarkedSpace::capacity): (JSC::MarkedSpace::addActiveWeakSet): (JSC::MarkedSpace::didAddBlock): (JSC::MarkedSpace::didAllocateInBlock): (JSC::MarkedSpace::forEachAllocator): Deleted. (JSC::VerifyMarkedOrRetired::operator()): Deleted. (JSC::MarkedSpace::clearMarks): Deleted. * heap/MarkedSpace.h: (JSC::MarkedSpace::sizeClassToIndex): (JSC::MarkedSpace::indexToSizeClass): (JSC::MarkedSpace::version): (JSC::MarkedSpace::blocksWithNewObjects): (JSC::MarkedSpace::largeAllocations): (JSC::MarkedSpace::largeAllocationsNurseryOffset): (JSC::MarkedSpace::largeAllocationsOffsetForThisCollection): (JSC::MarkedSpace::largeAllocationsForThisCollectionBegin): (JSC::MarkedSpace::largeAllocationsForThisCollectionEnd): (JSC::MarkedSpace::largeAllocationsForThisCollectionSize): (JSC::MarkedSpace::forEachLiveCell): (JSC::MarkedSpace::forEachDeadCell): (JSC::MarkedSpace::allocatorFor): (JSC::MarkedSpace::destructorAllocatorFor): (JSC::MarkedSpace::auxiliaryAllocatorFor): (JSC::MarkedSpace::allocateWithoutDestructor): (JSC::MarkedSpace::allocateWithDestructor): (JSC::MarkedSpace::allocateAuxiliary): (JSC::MarkedSpace::tryAllocateAuxiliary): (JSC::MarkedSpace::forEachBlock): (JSC::MarkedSpace::forEachAllocator): (JSC::MarkedSpace::optimalSizeFor): (JSC::MarkedSpace::didAddBlock): Deleted. (JSC::MarkedSpace::didAllocateInBlock): Deleted. (JSC::MarkedSpace::objectCount): Deleted. (JSC::MarkedSpace::size): Deleted. (JSC::MarkedSpace::capacity): Deleted. * heap/SlotVisitor.cpp: (JSC::SlotVisitor::SlotVisitor): (JSC::SlotVisitor::didStartMarking): (JSC::SlotVisitor::reset): (JSC::SlotVisitor::append): (JSC::SlotVisitor::appendJSCellOrAuxiliary): (JSC::SlotVisitor::setMarkedAndAppendToMarkStack): (JSC::SlotVisitor::appendToMarkStack): (JSC::SlotVisitor::markAuxiliary): (JSC::SlotVisitor::noteLiveAuxiliaryCell): (JSC::SlotVisitor::visitChildren): * heap/SlotVisitor.h: * heap/WeakBlock.cpp: (JSC::WeakBlock::create): (JSC::WeakBlock::WeakBlock): (JSC::WeakBlock::visit): (JSC::WeakBlock::reap): * heap/WeakBlock.h: (JSC::WeakBlock::disconnectContainer): (JSC::WeakBlock::disconnectMarkedBlock): Deleted. * heap/WeakSet.cpp: (JSC::WeakSet::~WeakSet): (JSC::WeakSet::sweep): (JSC::WeakSet::shrink): (JSC::WeakSet::addAllocator): * heap/WeakSet.h: (JSC::WeakSet::container): (JSC::WeakSet::setContainer): (JSC::WeakSet::WeakSet): (JSC::WeakSet::visit): (JSC::WeakSet::shrink): Deleted. * heap/WeakSetInlines.h: (JSC::WeakSet::allocate): * inspector/InjectedScriptManager.cpp: * inspector/JSGlobalObjectInspectorController.cpp: * inspector/JSJavaScriptCallFrame.cpp: * inspector/ScriptDebugServer.cpp: * inspector/agents/InspectorDebuggerAgent.cpp: * interpreter/CachedCall.h: (JSC::CachedCall::CachedCall): * interpreter/Interpreter.cpp: (JSC::loadVarargs): (JSC::StackFrame::sourceID): Deleted. (JSC::StackFrame::sourceURL): Deleted. (JSC::StackFrame::functionName): Deleted. (JSC::StackFrame::computeLineAndColumn): Deleted. (JSC::StackFrame::toString): Deleted. * interpreter/Interpreter.h: (JSC::StackFrame::isNative): Deleted. * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::emitAllocateWithNonNullAllocator): (JSC::AssemblyHelpers::emitAllocate): (JSC::AssemblyHelpers::emitAllocateJSCell): (JSC::AssemblyHelpers::emitAllocateJSObject): (JSC::AssemblyHelpers::emitAllocateJSObjectWithKnownSize): (JSC::AssemblyHelpers::emitAllocateVariableSized): * jit/GCAwareJITStubRoutine.cpp: (JSC::GCAwareJITStubRoutine::GCAwareJITStubRoutine): * jit/JIT.cpp: (JSC::JIT::compileCTINativeCall): (JSC::JIT::link): * jit/JIT.h: (JSC::JIT::compileCTINativeCall): Deleted. * jit/JITExceptions.cpp: (JSC::genericUnwind): * jit/JITExceptions.h: * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_new_object): (JSC::JIT::emitSlow_op_new_object): (JSC::JIT::emit_op_create_this): (JSC::JIT::emitSlow_op_create_this): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_new_object): (JSC::JIT::emitSlow_op_new_object): (JSC::JIT::emit_op_create_this): (JSC::JIT::emitSlow_op_create_this): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emitWriteBarrier): * jit/JITThunks.cpp: * jit/JITThunks.h: * jsc.cpp: (functionDescribeArray): (main): * llint/LLIntData.cpp: (JSC::LLInt::Data::performAssertions): * llint/LLIntExceptions.cpp: * llint/LLIntThunks.cpp: * llint/LLIntThunks.h: * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter.cpp: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * parser/ModuleAnalyzer.cpp: * parser/NodeConstructors.h: * parser/Nodes.h: * profiler/ProfilerBytecode.cpp: * profiler/ProfilerBytecode.h: * profiler/ProfilerBytecodeSequence.cpp: * runtime/ArrayConventions.h: (JSC::indexingHeaderForArrayStorage): (JSC::baseIndexingHeaderForArrayStorage): (JSC::indexingHeaderForArray): Deleted. (JSC::baseIndexingHeaderForArray): Deleted. * runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncSplice): (JSC::concatAppendOne): (JSC::arrayProtoPrivateFuncConcatMemcpy): * runtime/ArrayStorage.h: (JSC::ArrayStorage::vectorLength): (JSC::ArrayStorage::totalSizeFor): (JSC::ArrayStorage::totalSize): (JSC::ArrayStorage::availableVectorLength): (JSC::ArrayStorage::optimalVectorLength): (JSC::ArrayStorage::sizeFor): Deleted. * runtime/AuxiliaryBarrier.h: Added. (JSC::AuxiliaryBarrier::AuxiliaryBarrier): (JSC::AuxiliaryBarrier::clear): (JSC::AuxiliaryBarrier::get): (JSC::AuxiliaryBarrier::slot): (JSC::AuxiliaryBarrier::operator bool): (JSC::AuxiliaryBarrier::setWithoutBarrier): * runtime/AuxiliaryBarrierInlines.h: Added. (JSC::AuxiliaryBarrier::AuxiliaryBarrier): (JSC::AuxiliaryBarrier::set): * runtime/Butterfly.h: * runtime/ButterflyInlines.h: (JSC::Butterfly::availableContiguousVectorLength): (JSC::Butterfly::optimalContiguousVectorLength): (JSC::Butterfly::createUninitialized): (JSC::Butterfly::growArrayRight): * runtime/ClonedArguments.cpp: (JSC::ClonedArguments::createEmpty): * runtime/CommonSlowPathsExceptions.cpp: * runtime/CommonSlowPathsExceptions.h: * runtime/DataView.cpp: * runtime/DirectArguments.h: * runtime/ECMAScriptSpecInternalFunctions.cpp: * runtime/Error.cpp: * runtime/Error.h: * runtime/ErrorInstance.cpp: * runtime/ErrorInstance.h: * runtime/Exception.cpp: * runtime/Exception.h: * runtime/GeneratorFrame.cpp: * runtime/GeneratorPrototype.cpp: * runtime/InternalFunction.cpp: (JSC::InternalFunction::InternalFunction): * runtime/IntlCollator.cpp: * runtime/IntlCollatorConstructor.cpp: * runtime/IntlCollatorPrototype.cpp: * runtime/IntlDateTimeFormat.cpp: * runtime/IntlDateTimeFormatConstructor.cpp: * runtime/IntlDateTimeFormatPrototype.cpp: * runtime/IntlNumberFormat.cpp: * runtime/IntlNumberFormatConstructor.cpp: * runtime/IntlNumberFormatPrototype.cpp: * runtime/IntlObject.cpp: * runtime/IteratorPrototype.cpp: * runtime/JSArray.cpp: (JSC::JSArray::tryCreateUninitialized): (JSC::JSArray::setLengthWritable): (JSC::JSArray::unshiftCountSlowCase): (JSC::JSArray::setLengthWithArrayStorage): (JSC::JSArray::appendMemcpy): (JSC::JSArray::setLength): (JSC::JSArray::pop): (JSC::JSArray::push): (JSC::JSArray::fastSlice): (JSC::JSArray::shiftCountWithArrayStorage): (JSC::JSArray::shiftCountWithAnyIndexingType): (JSC::JSArray::unshiftCountWithArrayStorage): (JSC::JSArray::fillArgList): (JSC::JSArray::copyToArguments): * runtime/JSArray.h: (JSC::createContiguousArrayButterfly): (JSC::createArrayButterfly): (JSC::JSArray::create): (JSC::JSArray::tryCreateUninitialized): Deleted. * runtime/JSArrayBufferView.h: * runtime/JSCInlines.h: * runtime/JSCJSValue.cpp: (JSC::JSValue::dumpInContextAssumingStructure): * runtime/JSCallee.cpp: (JSC::JSCallee::JSCallee): * runtime/JSCell.cpp: (JSC::JSCell::estimatedSize): * runtime/JSCell.h: (JSC::JSCell::cellStateOffset): Deleted. * runtime/JSCellInlines.h: (JSC::ExecState::vm): (JSC::JSCell::classInfo): (JSC::JSCell::callDestructor): (JSC::JSCell::vm): Deleted. * runtime/JSFunction.cpp: (JSC::JSFunction::create): (JSC::JSFunction::allocateAndInitializeRareData): (JSC::JSFunction::initializeRareData): (JSC::JSFunction::getOwnPropertySlot): (JSC::JSFunction::put): (JSC::JSFunction::deleteProperty): (JSC::JSFunction::defineOwnProperty): (JSC::JSFunction::setFunctionName): (JSC::JSFunction::reifyLength): (JSC::JSFunction::reifyName): (JSC::JSFunction::reifyLazyPropertyIfNeeded): (JSC::JSFunction::reifyBoundNameIfNeeded): * runtime/JSFunction.h: * runtime/JSFunctionInlines.h: (JSC::JSFunction::createWithInvalidatedReallocationWatchpoint): (JSC::JSFunction::JSFunction): * runtime/JSGenericTypedArrayViewInlines.h: (JSC::JSGenericTypedArrayView::slowDownAndWasteMemory): * runtime/JSInternalPromise.cpp: * runtime/JSInternalPromiseConstructor.cpp: * runtime/JSInternalPromiseDeferred.cpp: * runtime/JSInternalPromisePrototype.cpp: * runtime/JSJob.cpp: * runtime/JSMapIterator.cpp: * runtime/JSModuleNamespaceObject.cpp: * runtime/JSModuleRecord.cpp: * runtime/JSObject.cpp: (JSC::JSObject::visitButterfly): (JSC::JSObject::notifyPresenceOfIndexedAccessors): (JSC::JSObject::createInitialIndexedStorage): (JSC::JSObject::createInitialUndecided): (JSC::JSObject::createInitialInt32): (JSC::JSObject::createInitialDouble): (JSC::JSObject::createInitialContiguous): (JSC::JSObject::createArrayStorage): (JSC::JSObject::createInitialArrayStorage): (JSC::JSObject::convertUndecidedToInt32): (JSC::JSObject::convertUndecidedToContiguous): (JSC::JSObject::convertUndecidedToArrayStorage): (JSC::JSObject::convertInt32ToDouble): (JSC::JSObject::convertInt32ToArrayStorage): (JSC::JSObject::convertDoubleToArrayStorage): (JSC::JSObject::convertContiguousToArrayStorage): (JSC::JSObject::putByIndexBeyondVectorLength): (JSC::JSObject::putDirectIndexBeyondVectorLength): (JSC::JSObject::getNewVectorLength): (JSC::JSObject::increaseVectorLength): (JSC::JSObject::ensureLengthSlow): (JSC::JSObject::growOutOfLineStorage): (JSC::JSObject::copyButterfly): Deleted. (JSC::JSObject::copyBackingStore): Deleted. * runtime/JSObject.h: (JSC::JSObject::globalObject): (JSC::JSObject::putDirectInternal): (JSC::JSObject::setStructureAndReallocateStorageIfNecessary): Deleted. * runtime/JSObjectInlines.h: * runtime/JSPromise.cpp: * runtime/JSPromiseConstructor.cpp: * runtime/JSPromiseDeferred.cpp: * runtime/JSPromisePrototype.cpp: * runtime/JSPropertyNameIterator.cpp: * runtime/JSScope.cpp: (JSC::JSScope::resolve): * runtime/JSScope.h: (JSC::JSScope::globalObject): (JSC::JSScope::vm): Deleted. * runtime/JSSetIterator.cpp: * runtime/JSStringIterator.cpp: * runtime/JSTemplateRegistryKey.cpp: * runtime/JSTypedArrayViewConstructor.cpp: * runtime/JSTypedArrayViewPrototype.cpp: * runtime/JSWeakMap.cpp: * runtime/JSWeakSet.cpp: * runtime/MapConstructor.cpp: * runtime/MapIteratorPrototype.cpp: * runtime/MapPrototype.cpp: * runtime/NativeErrorConstructor.cpp: * runtime/NativeStdFunctionCell.cpp: * runtime/Operations.h: (JSC::scribbleFreeCells): (JSC::scribble): * runtime/Options.h: * runtime/PropertyTable.cpp: * runtime/ProxyConstructor.cpp: * runtime/ProxyObject.cpp: * runtime/ProxyRevoke.cpp: * runtime/RegExp.cpp: (JSC::RegExp::match): (JSC::RegExp::matchConcurrently): (JSC::RegExp::matchCompareWithInterpreter): * runtime/RegExp.h: * runtime/RegExpConstructor.h: * runtime/RegExpInlines.h: (JSC::RegExp::matchInline): * runtime/RegExpMatchesArray.h: (JSC::tryCreateUninitializedRegExpMatchesArray): (JSC::createRegExpMatchesArray): * runtime/RegExpPrototype.cpp: (JSC::genericSplit): * runtime/RuntimeType.cpp: * runtime/SamplingProfiler.cpp: (JSC::SamplingProfiler::processUnverifiedStackTraces): * runtime/SetConstructor.cpp: * runtime/SetIteratorPrototype.cpp: * runtime/SetPrototype.cpp: * runtime/StackFrame.cpp: Added. (JSC::StackFrame::sourceID): (JSC::StackFrame::sourceURL): (JSC::StackFrame::functionName): (JSC::StackFrame::computeLineAndColumn): (JSC::StackFrame::toString): * runtime/StackFrame.h: Added. (JSC::StackFrame::isNative): * runtime/StringConstructor.cpp: * runtime/StringIteratorPrototype.cpp: * runtime/StructureInlines.h: (JSC::Structure::propertyTable): * runtime/TemplateRegistry.cpp: * runtime/TestRunnerUtils.cpp: (JSC::finalizeStatsAtEndOfTesting): * runtime/TestRunnerUtils.h: * runtime/TypeProfilerLog.cpp: * runtime/TypeSet.cpp: * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::ensureStackCapacityForCLoop): (JSC::VM::isSafeToRecurseSoftCLoop): * runtime/VM.h: * runtime/VMEntryScope.h: * runtime/VMInlines.h: (JSC::VM::ensureStackCapacityFor): (JSC::VM::isSafeToRecurseSoft): * runtime/WeakMapConstructor.cpp: * runtime/WeakMapData.cpp: * runtime/WeakMapPrototype.cpp: * runtime/WeakSetConstructor.cpp: * runtime/WeakSetPrototype.cpp: * testRegExp.cpp: (testOneRegExp): * tools/JSDollarVM.cpp: * tools/JSDollarVMPrototype.cpp: (JSC::JSDollarVMPrototype::isInObjectSpace): 2016-09-03 Joseph Pecoraro Use ASCIILiteral in some more places https://bugs.webkit.org/show_bug.cgi?id=161557 Reviewed by Darin Adler. * runtime/TypeSet.h: (JSC::StructureShape::setConstructorName): 2016-09-02 Benjamin Poulain [JSC] Remove some more useless cases from FTL Capabilities https://bugs.webkit.org/show_bug.cgi?id=161466 Reviewed by Geoffrey Garen. Some cases do not make sense: -In: Fixup only generate CellUse. -PutByIdXXX: same. -GetIndexedPropertyStorage: those cases are the only ones supported by DFG. We would have crashed in SpeculativeJIT if other modes were generated. * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compilePutById): (JSC::FTL::DFG::LowerDFGToB3::compileGetIndexedPropertyStorage): (JSC::FTL::DFG::LowerDFGToB3::compileIn): 2016-09-02 Caio Lima Register usage optimization in mathIC when LHS and RHS are constants isn't configured correctly https://bugs.webkit.org/show_bug.cgi?id=160802 Reviewed by Saam Barati. This patch is fixing a broken mechanism of MathIC that avoids allocate a register to LHS or RHS if one of these operands are proven as valid constant for JIT*Generator. In previous implementation, even if the JIT*Generator was not using an operand register because it was proven as a constant, compileMathIC and emitICFast were allocating a register for it. This was broken because mathIC->isLeftOperandValidConstant and mathIC->isLeftOperandValidConstant were being called before its Generator be properly initialized. We changed this mechanism to enable Generators write their validConstant rules using static methods isLeftOperandValidConstant(SnippetOperand) and isRightOperandValidConstant(SnippetOperand). * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileMathIC): * jit/JITAddGenerator.h: (JSC::JITAddGenerator::JITAddGenerator): (JSC::JITAddGenerator::isLeftOperandValidConstant): (JSC::JITAddGenerator::isRightOperandValidConstant): * jit/JITArithmetic.cpp: (JSC::JIT::emitMathICFast): * jit/JITMathIC.h: * jit/JITMulGenerator.h: (JSC::JITMulGenerator::JITMulGenerator): (JSC::JITMulGenerator::isLeftOperandValidConstant): (JSC::JITMulGenerator::isRightOperandValidConstant): * jit/JITSubGenerator.h: (JSC::JITSubGenerator::isLeftOperandValidConstant): (JSC::JITSubGenerator::isRightOperandValidConstant): 2016-09-02 JF Bastien GetByValWithThis: fix opInfo in DFG creation https://bugs.webkit.org/show_bug.cgi?id=161541 Reviewed by Saam Barati. super-get-by-val-with-this-monomorphic might be 1.0148x faster after this change. * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): fix OpInfo 2016-09-01 JF Bastien jsc: fix cmake build missing symbol getPropertySlot https://bugs.webkit.org/show_bug.cgi?id=161521 Reviewed by Saam Barati. * runtime/IntlDateTimeFormat.cpp: include JSCInlines.h * runtime/IntlNumberFormat.cpp: include JSCInlines.h 2016-09-01 Mark Lam Move some JSObject and JSArray inline functions to their respective Inlines.h files. https://bugs.webkit.org/show_bug.cgi?id=161499 Reviewed by Saam Barati. This is just a refactoring patch to move some inline functions to their Inlines.h files. This will be needed to enable https://bugs.webkit.org/show_bug.cgi?id=161498 later. * bindings/ScriptValue.cpp: * interpreter/Interpreter.cpp: * runtime/IntlDateTimeFormatPrototype.cpp: * runtime/IntlNumberFormatPrototype.cpp: * runtime/JSArray.cpp: * runtime/JSArray.h: (JSC::getLength): Deleted. (JSC::toLength): Deleted. * runtime/JSArrayInlines.h: (JSC::JSArray::mergeIndexingTypeForCopying): (JSC::JSArray::canFastCopy): (JSC::getLength): (JSC::toLength): * runtime/JSInternalPromise.cpp: * runtime/JSInternalPromiseDeferred.cpp: * runtime/JSJob.cpp: * runtime/JSModuleRecord.cpp: * runtime/JSObject.h: (JSC::JSObject::getPropertySlot): Deleted. (JSC::JSObject::getNonIndexPropertySlot): Deleted. * runtime/JSObjectInlines.h: (JSC::JSObject::getPropertySlot): (JSC::JSObject::getNonIndexPropertySlot): * runtime/JSPromiseDeferred.cpp: * runtime/JSTypedArrayViewPrototype.cpp: * runtime/MapConstructor.cpp: * runtime/SamplingProfiler.cpp: * runtime/SetConstructor.cpp: * runtime/WeakMapConstructor.cpp: * runtime/WeakSetConstructor.cpp: 2016-09-01 JF Bastien GetByIdWithThis/GetByValWithThis should have ValueProfiles so that they can predict their result types https://bugs.webkit.org/show_bug.cgi?id=160922 Reviewed by Keith Miller. Add value profiling to GetBy{Id,Val}WithThis. * bytecode/BytecodeList.json: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): (JSC::CodeBlock::finishCreation): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitGetById): (JSC::BytecodeGenerator::emitGetByVal): * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGNode.h: (JSC::DFG::Node::hasHeapPrediction): * dfg/DFGPredictionPropagationPhase.cpp: * llint/LowLevelInterpreter.asm: * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): 2016-09-01 Keith Miller Rename WASM classes dropping the WASM prefix https://bugs.webkit.org/show_bug.cgi?id=161500 Reviewed by Mark Lam. Having to write WASM::WASMModule seems silly. Also, this patch merges WASMFunctionReturnType and WASMValueType into one type that is a typedef of B3::Type. Using B3::Type as the WASM primitive type makes it trivial to convert a Vector of WASM types into a Vector of B3 types. * b3/B3Type.h: * wasm/JSWASMModule.h: (JSC::JSWASMModule::signatures): (JSC::JSWASMModule::functionImports): (JSC::JSWASMModule::functionImportSignatures): (JSC::JSWASMModule::globalVariableTypes): (JSC::JSWASMModule::functionDeclarations): (JSC::JSWASMModule::functionPointerTables): * wasm/WASMB3IRGenerator.cpp: (JSC::WASM::toB3Op): (JSC::WASM::B3IRGenerator::addLocal): (JSC::WASM::B3IRGenerator::unaryOp): (JSC::WASM::B3IRGenerator::binaryOp): (JSC::WASM::B3IRGenerator::addConstant): (JSC::WASM::parseAndCompile): * wasm/WASMB3IRGenerator.h: * wasm/WASMFormat.h: * wasm/WASMFunctionParser.h: (JSC::WASM::FunctionParser::FunctionParser): (JSC::WASM::FunctionParser::parse): (JSC::WASM::FunctionParser::parseBlock): (JSC::WASM::FunctionParser::parseExpression): (JSC::WASM::WASMFunctionParser::WASMFunctionParser): Deleted. (JSC::WASM::WASMFunctionParser::parse): Deleted. (JSC::WASM::WASMFunctionParser::parseBlock): Deleted. (JSC::WASM::WASMFunctionParser::parseExpression): Deleted. * wasm/WASMModuleParser.cpp: (JSC::WASM::ModuleParser::parse): (JSC::WASM::ModuleParser::parseFunctionTypes): (JSC::WASM::ModuleParser::parseFunctionSignatures): (JSC::WASM::ModuleParser::parseFunctionDefinitions): (JSC::WASM::WASMModuleParser::parse): Deleted. (JSC::WASM::WASMModuleParser::parseFunctionTypes): Deleted. (JSC::WASM::WASMModuleParser::parseFunctionSignatures): Deleted. (JSC::WASM::WASMModuleParser::parseFunctionDefinitions): Deleted. * wasm/WASMModuleParser.h: (JSC::WASM::ModuleParser::ModuleParser): (JSC::WASM::ModuleParser::functionInformation): (JSC::WASM::WASMModuleParser::WASMModuleParser): Deleted. (JSC::WASM::WASMModuleParser::functionInformation): Deleted. * wasm/WASMOps.h: * wasm/WASMParser.h: (JSC::WASM::Parser::Parser): (JSC::WASM::Parser::consumeCharacter): (JSC::WASM::Parser::consumeString): (JSC::WASM::Parser::parseUInt32): (JSC::WASM::Parser::parseUInt7): (JSC::WASM::Parser::parseVarUInt1): (JSC::WASM::Parser::parseValueType): (JSC::WASM::WASMParser::WASMParser): Deleted. (JSC::WASM::WASMParser::consumeCharacter): Deleted. (JSC::WASM::WASMParser::consumeString): Deleted. (JSC::WASM::WASMParser::parseUInt32): Deleted. (JSC::WASM::WASMParser::parseUInt7): Deleted. (JSC::WASM::WASMParser::parseVarUInt1): Deleted. (JSC::WASM::WASMParser::parseValueType): Deleted. * wasm/WASMPlan.cpp: (JSC::WASM::Plan::Plan): * wasm/WASMSections.cpp: (JSC::WASM::Sections::lookup): (JSC::WASM::WASMSections::lookup): Deleted. * wasm/WASMSections.h: (JSC::WASM::Sections::validateOrder): (JSC::WASM::WASMSections::validateOrder): Deleted. 2016-09-01 Filip Pizlo ObjectAllocationSinkingPhase::insertOSRHintsForUpdate() fails to emit updated hints in some cases https://bugs.webkit.org/show_bug.cgi?id=161492 Reviewed by Mark Lam. If you materialize a sunken object that is referenced from another sunken object, then you have to emit a PutHint to tell OSR that the latter object now refers to a materialized object rather than to the old sunken one. The ObjectAllocationSinkingPhase totally knows how to do this, but for some reason it only did it when the PromotedLocationDescriptor for the field used for referring to the other object is !neededForMaterialization(), i.e. it's a NamedPropertyPLoc or a ClosureVarPLoc. I can sort of imagine why we thought that would be right - neededForMaterialization() means it's a special meta-data field initialized on construction. But just because it's immutable and special doesn't mean that materialization can't change its physical representation. Removing the requirement that it's !neededForMaterialization() fixes the test and doesn't regress anything. * dfg/DFGObjectAllocationSinkingPhase.cpp: 2016-09-01 Saam Barati JITMathIC was misusing maxJumpReplacementSize https://bugs.webkit.org/show_bug.cgi?id=161356 Reviewed by Benjamin Poulain. JITMathIC was assuming that maxJumpReplacementSize is the size you'd get if you emitted a patchableJump() using the macro assembler. This is not true, however. It happens to be true on arm64, x86 and x86-64, however, it is not true on armv7. This patch introduces an alternative to maxJumpReplacementSize called patchableJumpSize, and switches JITMathIC to use that number instead. * assembler/ARM64Assembler.h: (JSC::ARM64Assembler::patchableJumpSize): (JSC::ARM64Assembler::maxJumpReplacementSize): Deleted. * assembler/ARMv7Assembler.h: (JSC::ARMv7Assembler::patchableJumpSize): (JSC::ARMv7Assembler::maxJumpReplacementSize): Deleted. * assembler/MacroAssemblerARM64.h: (JSC::MacroAssemblerARM64::patchableJumpSize): * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::patchableJumpSize): * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::patchableJumpSize): * assembler/X86Assembler.h: (JSC::X86Assembler::patchableJumpSize): (JSC::X86Assembler::maxJumpReplacementSize): Deleted. * jit/JITMathIC.h: (JSC::JITMathIC::generateInline): 2016-08-31 Yusuke Suzuki [JSC] Add initiator parameter to module pipeline https://bugs.webkit.org/show_bug.cgi?id=161470 Reviewed by Saam Barati. The fetching semantics of the