2014-11-22 Gyuyoung Kim Clean up OwnPtr and PassOwnPtr in some of JS classes https://bugs.webkit.org/show_bug.cgi?id=138724 Reviewed by Filip Pizlo. As a step to use std::unique_ptr<> and std::make_unique<>, this patch replaces OwnPtr with std::unique_ptr<>. Besides create() factory function is removed as well. * builtins/BuiltinExecutables.h: (JSC::BuiltinExecutables::create): Deleted. * bytecode/CodeBlock.h: (JSC::CodeBlock::createRareDataIfNecessary): * bytecode/StructureStubInfo.h: * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::hasRareData): (JSC::UnlinkedCodeBlock::createRareDataIfNecessary): * runtime/CodeCache.cpp: (JSC::CodeCache::getGlobalCodeBlock): * runtime/CodeCache.h: (JSC::CodeCache::create): Deleted. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::clearRareData): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::createRareDataIfNeeded): * runtime/RegExpConstructor.h: * runtime/SmallStrings.cpp: (JSC::SmallStrings::createSingleCharacterString): (JSC::SmallStrings::singleCharacterStringRep): * runtime/SmallStrings.h: * runtime/VM.cpp: (JSC::VM::VM): * runtime/VM.h: 2014-11-21 Michael Saboff r176455: ASSERT(!m_vector.isEmpty()) in IntendedStructureChain.cpp(143) https://bugs.webkit.org/show_bug.cgi?id=139000 Reviewed by Darin Adler. Check that the chainCount is non-zero before using a StructureChain. * bytecode/ComplexGetStatus.cpp: (JSC::ComplexGetStatus::computeFor): 2014-11-21 Michael Saboff Allocate local ScopeChain register https://bugs.webkit.org/show_bug.cgi?id=138793 Reviewed by Geoffrey Garen. Now we allocate the scope register as a local. The allocated register is stored in the CodeBlock for use by other components. Update the DFG to work with a local scope register. Changed usage of JSStack::ScopeChain access to the CallFrame header to use the allocated local register. * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): Updated to properly represent the operand inputs and bytecode result. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::CodeBlock): * bytecode/CodeBlock.h: (JSC::CodeBlock::setScopeRegister): (JSC::CodeBlock::scopeRegister): * bytecode/UnlinkedCodeBlock.h: (JSC::UnlinkedCodeBlock::setScopeRegister): (JSC::UnlinkedCodeBlock::scopeRegister): Added scope register member and accessors. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::allocateAndEmitScope): * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::scopeRegister): Change m_scopeRegister to an allocated register. Added allocateAndEmitScope helper to allocate the scope register, set the CodeBlock with its value and emit op_get_scope. * debugger/DebuggerCallFrame.cpp: (JSC::DebuggerCallFrame::scope): Changed to access the scope using the new convention. * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::get): (JSC::DFG::ByteCodeParser::flush): (JSC::DFG::ByteCodeParser::inlineCall): (JSC::DFG::ByteCodeParser::parseBlock): Changed op_create_lexical_environment to set the scope VirtualRegister operand. Filled out op_get_scope processing to emit a GetScope node putting the result in the scope VirtualRegister result operand. Added Phantoms where appropriate to keep the Scope register alive in places where it use is optimized away, but where the baseline JIT would need to use its value. Eliminated uses of JSStack::ScopeChain. * dfg/DFGStackLayoutPhase.cpp: (JSC::DFG::StackLayoutPhase::run): Make sure that the scope register stack location is allocated using the same place that the codeBlock expects. * dfg/DFGStrengthReductionPhase.cpp: (JSC::DFG::StrengthReductionPhase::handleNode): Allow strength reduction of Flush to skip of GetScope nodes looking for a prior corresponding SetLocal. * interpreter/CallFrame.h: (JSC::ExecState::scope): (JSC::ExecState::setScope): Added new scope() and setScope() helpers that take a VirtualRegister offset. * interpreter/Interpreter.cpp: (JSC::eval): Changed eval() to get the scope from the caller's scope register instead of from the temporary frame created for eval. * interpreter/Interpreter.cpp: (JSC::Interpreter::unwind): Changed unwind() to manipulate the scope n the allocated register instead of from the call frame slot. * interpreter/StackVisitor.cpp: (JSC::StackVisitor::readNonInlinedFrame): (JSC::StackVisitor::readInlinedFrame): * interpreter/StackVisitor.h: (JSC::StackVisitor::Frame::callee): (JSC::StackVisitor::Frame::scope): Deleted. Eliminated the scope member as it needed to change and no StackVisitor users use it. * jit/JITOperations.cpp: (JSC::operationPushNameScope): (JSC::operationPushWithScope): * runtime/JSNameScope.h: (JSC::JSNameScope::create): * runtime/JSWithScope.h: (JSC::JSWithScope::create): Deleted. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): Deleted JSNameScope::create() and JSWithScope::create() flavors tht used the ScopeChain slot in the CallFrame header. Changed the only user of these function, op_push_name_scope and op_push_with_scope helpers, to use the remaining create variants that require explicit scope. Those operations get the scope from the register pointed to by their scope operands. * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: Changed resolveScope to use the allocated register. 2014-11-21 Csaba Osztrogonác [JSC] Disable verifyHeap https://bugs.webkit.org/show_bug.cgi?id=138962 Reviewed by Mark Lam. * runtime/Options.h: 2014-11-20 Mark Lam Add some comments to describe the DFG UseKind representations. Reviewed by Filip Pizlo. * dfg/DFGUseKind.h: - Also regrouped the UseKind enums by representation to be more readable. 2014-11-20 Mark Lam Add Heap verification infrastructure. Reviewed by Geoffrey Garen. The verification infrastructure code is always built in but disabled by default. When disabled, the cost is minimal: 1. Heap has a m_verifier field. 2. GC does a few "if (m_verifier)" checks that should fail. 3. HeapVerifier takes up code space though not used. When enabled: 1. The HeapVerifier will keep N number of GC cycle data. Each GC cycle will contain a "before marking" and "after marking" live object list. The GC cycles is a circular buffer. Only data for the last N GC cycles will be retained. 2. During GC, the current GC cycle's live objects lists will be populated before and after marking. 3. The current GC cycle's live object lists will be validated before GC, after marking, and after GC. Currently, the only validation being done is to verify that object butterflies are allocated from valid blocks in the Storage (aka Copied) space. * CMakeLists.txt: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: * JavaScriptCore.xcodeproj/project.pbxproj: * heap/Heap.cpp: (JSC::Heap::Heap): (JSC::Heap::collect): * heap/Heap.h: * heap/HeapVerifier.cpp: Added. (JSC::LiveObjectList::findObject): (JSC::HeapVerifier::HeapVerifier): (JSC::HeapVerifier::collectionTypeName): (JSC::HeapVerifier::phaseName): (JSC::getButterflyDetails): (JSC::HeapVerifier::initializeGCCycle): (JSC::GatherLiveObjFunctor::GatherLiveObjFunctor): (JSC::GatherLiveObjFunctor::operator()): (JSC::HeapVerifier::gatherLiveObjects): (JSC::HeapVerifier::liveObjectListForGathering): (JSC::trimDeadObjectsFromList): (JSC::HeapVerifier::trimDeadObjects): (JSC::HeapVerifier::verifyButterflyIsInStorageSpace): (JSC::HeapVerifier::verify): (JSC::HeapVerifier::reportObject): (JSC::HeapVerifier::checkIfRecorded): * heap/HeapVerifier.h: Added. (JSC::LiveObjectData::LiveObjectData): (JSC::LiveObjectList::LiveObjectList): (JSC::LiveObjectList::reset): (JSC::HeapVerifier::GCCycle::GCCycle): (JSC::HeapVerifier::GCCycle::collectionTypeName): (JSC::HeapVerifier::incrementCycle): (JSC::HeapVerifier::currentCycle): (JSC::HeapVerifier::cycleForIndex): * runtime/Options.h: 2014-11-20 Yusuke Suzuki Rename String.prototype.contains to String.prototype.includes https://bugs.webkit.org/show_bug.cgi?id=138923 As per the latest TC39 meeting[1, 2], String.prototype.contains is renamed to String.prototype.includes. This is because the name `contains` breaks the web since it conflicts with existing `contains` implementations in major libraries. [1]: https://github.com/mathiasbynens/String.prototype.includes [2]: https://github.com/tc39/test262/pull/119 Reviewed by Geoffrey Garen. * runtime/StringPrototype.cpp: (JSC::StringPrototype::finishCreation): (JSC::stringProtoFuncIncludes): (JSC::stringProtoFuncContains): Deleted. 2014-11-19 Mark Lam WTFCrashWithSecurityImplication under SpeculativeJIT::compile() when loading a page from theblaze.com. Reviewed by Filip Pizlo. In the DFG, we have a ConstantFolding phase that occurs after all LocalCSE phases have already transpired. Hence, Identity nodes introduced in the ConstantFolding phase will be left in the node graph. Subsequently, the DFG code generator asserts that CSE phases have consumed all Identity nodes. This turns out to not be true. Hence, the crash. We fix this by teaching the DFG code generator to emit code for Identity nodes. Unlike the DFG, the FTL does not have this issue. That is because the FTL plan has GlobalCSE phases that come after ConstantFolding and any other phases that can generate Identity nodes. Hence, for the FTL, it is true that CSE will consume all Identity nodes, and the code generator should not see any Identity nodes. * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): 2014-11-19 Joseph Pecoraro Web Inspector: JSContext inspection Resource search does not work https://bugs.webkit.org/show_bug.cgi?id=131252 Reviewed by Timothy Hatcher. * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::searchInContent): * inspector/protocol/Debugger.json: Do some cleanup of the description and implementation of content searching. 2014-11-19 Joseph Pecoraro Web Inspector: Provide $exception in the console for the thrown exception value https://bugs.webkit.org/show_bug.cgi?id=138726 Reviewed by Timothy Hatcher. * debugger/DebuggerScope.cpp: (JSC::DebuggerScope::caughtValue): * debugger/DebuggerScope.h: Access the caught value if this scope is a catch scope. * runtime/JSNameScope.h: (JSC::JSNameScope::isFunctionNameScope): (JSC::JSNameScope::isCatchScope): (JSC::JSNameScope::value): Provide an accessor for the single value in the JSNameScope (with / catch block). * inspector/InjectedScriptSource.js: Save the exception value and expose it via $exception. Since the command line api is recreated on each evaluation, $exception is essentially readonly. * inspector/ScriptDebugServer.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::dispatchDidPause): (Inspector::ScriptDebugServer::exceptionOrCaughtValue): When pausing, get the exception or caught value. The exception will be provided if we are breaking on an explicit exception. When inside of a catch block, we can get the caught value by walking up the scope chain. * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::InspectorDebuggerAgent): (Inspector::InspectorDebuggerAgent::resume): (Inspector::InspectorDebuggerAgent::stepOver): (Inspector::InspectorDebuggerAgent::stepInto): (Inspector::InspectorDebuggerAgent::stepOut): Clearing state can be done in didContinue. (Inspector::InspectorDebuggerAgent::didPause): Set the exception value explicitly in the injected script when we have it. (Inspector::InspectorDebuggerAgent::didContinue): Clear state saved when we had paused, including clearly an exception value if needed. (Inspector::InspectorDebuggerAgent::clearDebuggerBreakpointState): (Inspector::InspectorDebuggerAgent::clearExceptionValue): Call into the injected script only when needed. * inspector/InjectedScript.cpp: (Inspector::InjectedScript::setExceptionValue): (Inspector::InjectedScript::clearExceptionValue): * inspector/InjectedScript.h: * inspector/InjectedScriptManager.cpp: (Inspector::InjectedScriptManager::clearExceptionValue): * inspector/InjectedScriptManager.h: Clear on all injected scripts. 2014-11-19 Joseph Pecoraro Unreviewed build fixes after r176329. - export all of the codegen python files as they are included by the main generator - update the imports of the main generator to match __init__.py - remove bundling the python scripts as framework resources, just have them PrivateHeaders * JavaScriptCore.xcodeproj/project.pbxproj: * inspector/scripts/generate-inspector-protocol-bindings.py: 2014-11-18 Brian J. Burg Web Inspector: standardize language-specific protocol generator file, class, and method prefixes https://bugs.webkit.org/show_bug.cgi?id=138237 Reviewed by Joseph Pecoraro. Settle on cpp/objc/js file prefixes and Cpp/ObjC/JS class prefixes for generators. Move C++-specific static methods into CppGenerator and add cpp_ prefixes where relevant. Split the templates file into language-specific template files. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: * JavaScriptCore.xcodeproj/project.pbxproj: * inspector/scripts/codegen/__init__.py: * inspector/scripts/codegen/cpp_generator.py: Copied from Source/JavaScriptCore/inspector/scripts/codegen/generator.py. * inspector/scripts/codegen/cpp_generator_templates.py: Copied from Source/JavaScriptCore/inspector/scripts/codegen/generator_templates.py. (CppGeneratorTemplates): * inspector/scripts/codegen/generate_cpp_alternate_backend_dispatcher_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_alternate_backend_dispatcher_header.py. * inspector/scripts/codegen/generate_cpp_backend_dispatcher_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_backend_dispatcher_header.py. * inspector/scripts/codegen/generate_cpp_backend_dispatcher_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_backend_dispatcher_implementation.py. * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_frontend_dispatcher_header.py. * inspector/scripts/codegen/generate_cpp_frontend_dispatcher_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_frontend_dispatcher_implementation.py. * inspector/scripts/codegen/generate_cpp_protocol_types_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_protocol_types_header.py. * inspector/scripts/codegen/generate_cpp_protocol_types_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_protocol_types_implementation.py. * inspector/scripts/codegen/generate_js_backend_commands.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_backend_commands.py. * inspector/scripts/codegen/generate_objc_backend_dispatcher_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_backend_dispatcher_header.py. * inspector/scripts/codegen/generate_objc_backend_dispatcher_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_backend_dispatcher_implementation.py. * inspector/scripts/codegen/generate_objc_configuration_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_configuration_header.py. * inspector/scripts/codegen/generate_objc_configuration_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_configuration_implementation.py. * inspector/scripts/codegen/generate_objc_conversion_helpers.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_conversion_helpers.py. * inspector/scripts/codegen/generate_objc_frontend_dispatcher_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_frontend_dispatcher_implementation.py. * inspector/scripts/codegen/generate_objc_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_header.py. * inspector/scripts/codegen/generate_objc_internal_header.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_internal_header.py. * inspector/scripts/codegen/generate_objc_protocol_types_implementation.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c_types_implementation.py. * inspector/scripts/codegen/generator.py: * inspector/scripts/codegen/generator_templates.py: * inspector/scripts/codegen/objc_generator.py: Renamed from Source/JavaScriptCore/inspector/scripts/codegen/generate_objective_c.py. * inspector/scripts/codegen/objc_generator_templates.py: Added. * inspector/scripts/generate-inspector-protocol-bindings.py: 2014-11-19 Juergen Ributzka Update WebKit to build with LLVM TOT https://bugs.webkit.org/show_bug.cgi?id=138519 Reviewed by Alexey Proskuryakov. * Configurations/LLVMForJSC.xcconfig: * llvm/LLVMAPIFunctions.h: * llvm/library/LLVMExports.cpp: (initializeAndGetJSCLLVMAPI): 2014-11-18 David Kilzer FeatureDefines.xcconfig: Switch from using PLATFORM_NAME to SDK selectors Reviewed by Mark Rowe. * Configurations/FeatureDefines.xcconfig: Switch to using SDK selectors. 2014-11-18 Chris Dumez Update the Vector API to deal with unsigned types instead of size_t https://bugs.webkit.org/show_bug.cgi?id=138824 Reviewed by Andreas Kling. Update code base to fix build errors related to the typing changes in the Vector API (size_t -> unsigned). * bytecode/PreciseJumpTargets.cpp: * replay/EncodedValue.h: 2014-11-18 Commit Queue Unreviewed, rolling out r176207. https://bugs.webkit.org/show_bug.cgi?id=138836 Not ready yet (Requested by ap on #webkit). Reverted changeset: "Update WebKit to build with LLVM TOT" https://bugs.webkit.org/show_bug.cgi?id=138519 http://trac.webkit.org/changeset/176207 2014-11-17 Mark Lam Add printing functionality in JITted code for debugging purposes. Reviewed by Geoffrey Garen. Sometimes, for debugging, it'd be nice to be able to just print the values of constants or registers used in JITted code, or even just a string to log that certain pieces of JITted code have been executed. Using the JIT probe mechanism, we can make this happen. * assembler/ARMv7Assembler.h: * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::CPUState::registerName): (JSC::AbstractMacroAssembler::CPUState::registerValue): (JSC::AbstractMacroAssembler::print): (JSC::AbstractMacroAssembler::PrintArg::PrintArg): (JSC::AbstractMacroAssembler::appendPrintArg): (JSC::AbstractMacroAssembler::printInternal): (JSC::AbstractMacroAssembler::printCallback): * assembler/MacroAssemblerARM.cpp: (JSC::MacroAssemblerARM::printCPURegisters): (JSC::MacroAssemblerARM::printRegister): * assembler/MacroAssemblerARM.h: * assembler/MacroAssemblerARMv7.cpp: (JSC::MacroAssemblerARMv7::printCPURegisters): (JSC::MacroAssemblerARMv7::printRegister): * assembler/MacroAssemblerARMv7.h: * assembler/MacroAssemblerX86Common.cpp: (JSC::MacroAssemblerX86Common::printRegister): * assembler/MacroAssemblerX86Common.h: 2014-11-17 Anders Carlsson Fix JavaScriptCore build with newer versions of clang. * heap/Heap.cpp: (JSC::Heap::visitTempSortVectors): (JSC::Heap::deleteAllCompiledCode): Deleted. * inspector/agents/InspectorConsoleAgent.h: 2014-11-17 Juergen Ributzka Update WebKit to build with LLVM TOT https://bugs.webkit.org/show_bug.cgi?id=138519 Reviewed by Alexey Proskuryakov. * Configurations/LLVMForJSC.xcconfig: * llvm/LLVMAPIFunctions.h: * llvm/library/LLVMExports.cpp: (initializeAndGetJSCLLVMAPI): 2014-11-14 Benjamin Poulain STRH can store values with the wrong offset https://bugs.webkit.org/show_bug.cgi?id=138723 Reviewed by Michael Saboff. This is the counterpart of r176083 for the str instruction. I believe this code is currently unreachable because there is only one client of strh() in the MacroAssembler and it always setup the scale explicitely. * assembler/ARMv7Assembler.h: (JSC::ARMv7Assembler::strh): 2014-11-13 Mark Lam Reduce amount of cut-and-paste needed for probe mechanism implementations. Reviewed by Geoffrey Garen. The existing code requires that each MacroAssembler implementation provide their own copy of all of the probe implementations even when most of it is identical. This patch hoists the common parts into AbstractMacroAssembler (with some minor renaming). Each target specific MacroAssembler now only need to implement a few target specific methods that are expected by and documented in AbstractMacroAssembler.h in the ENABLE(MASM_PROBE) section. In this patch, I also simplified the X86 and X86_64 ports to use the same port implementation. The ARMv7 probe implementation should not conditionally exclude the higher FP registers (since the JIT doesn't). Fixed the ARMv7 probe code to include the higher FP registers always. This is all done in preparation to add printing functionality in JITted code for debugging. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::Label::Label): (JSC::AbstractMacroAssembler::ConvertibleLoadLabel::ConvertibleLoadLabel): (JSC::AbstractMacroAssembler::DataLabelPtr::DataLabelPtr): (JSC::AbstractMacroAssembler::DataLabel32::DataLabel32): (JSC::AbstractMacroAssembler::DataLabelCompact::DataLabelCompact): (JSC::AbstractMacroAssembler::Jump::link): (JSC::AbstractMacroAssembler::Jump::linkTo): (JSC::AbstractMacroAssembler::JumpList::link): (JSC::AbstractMacroAssembler::JumpList::linkTo): (JSC::AbstractMacroAssembler::ProbeContext::print): (JSC::AbstractMacroAssembler::printIndent): (JSC::AbstractMacroAssembler::printCPU): (JSC::AbstractMacroAssembler::CachedTempRegister::CachedTempRegister): - Except for the 3 printing methods (which are for the probe), the rest are touched simply because we need to add the MacroAssemblerType to the template args. The MacroAssemblerType is used by the abstract probe code to call the few probe methods that need to have CPU specific implementations. * assembler/MacroAssemblerARM.cpp: (JSC::MacroAssemblerARM::printCPURegisters): - This was refactored from ProbeContext::dumpCPURegisters() which no longer exists. (JSC::MacroAssemblerARM::ProbeContext::dumpCPURegisters): Deleted. (JSC::MacroAssemblerARM::ProbeContext::dump): Deleted. * assembler/MacroAssemblerARM.h: * assembler/MacroAssemblerARM64.h: * assembler/MacroAssemblerARMv7.cpp: (JSC::MacroAssemblerARMv7::printCPURegisters): - This was refactored from ProbeContext::dumpCPURegisters() which no longer exists. (JSC::MacroAssemblerARMv7::ProbeContext::dumpCPURegisters): Deleted. (JSC::MacroAssemblerARMv7::ProbeContext::dump): Deleted. * assembler/MacroAssemblerARMv7.h: * assembler/MacroAssemblerMIPS.h: * assembler/MacroAssemblerSH4.h: * assembler/MacroAssemblerX86.h: (JSC::MacroAssemblerX86::trustedImm32FromPtr): Deleted. (JSC::MacroAssemblerX86::probe): Deleted. * assembler/MacroAssemblerX86Common.cpp: (JSC::MacroAssemblerX86Common::printCPURegisters): - This was refactored from ProbeContext::dumpCPURegisters() which no longer exists. (JSC::MacroAssemblerX86Common::probe): - This implementation of probe() is based on the one originally in MacroAssemblerX86_64.h. It is generic and should work for both 32-bit and 64-bit. (JSC::MacroAssemblerX86Common::ProbeContext::dumpCPURegisters): Deleted. (JSC::MacroAssemblerX86Common::ProbeContext::dump): Deleted. * assembler/MacroAssemblerX86Common.h: * assembler/MacroAssemblerX86_64.h: (JSC::MacroAssemblerX86_64::trustedImm64FromPtr): Deleted. (JSC::MacroAssemblerX86_64::probe): Deleted. * jit/JITStubsARMv7.h: 2014-11-13 Michael Saboff Add scope operand to op_new_func* byte codes https://bugs.webkit.org/show_bug.cgi?id=138707 Reviewed by Mark Lam. Added scope operand to op_new_func and op_new_func_expr to replace the implicit use of exec->scope(). * bytecode/BytecodeList.json: Increased size of op_new_func & op_new_func_expr bytecodes. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): Added scope operand to dump output. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitNewFunctionInternal): (JSC::BytecodeGenerator::emitNewFunctionExpression): Emit scope operand. * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): Added new scope source nodes to NewFunction, NewFunctionExpression & NewFunctionNoCheck. * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileNewFunctionNoCheck): (JSC::DFG::SpeculativeJIT::compileNewFunctionExpression): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): Use scope children when making new function JIT_Operation calls. Use JSScope* value instead of exec->scope(). * dfg/DFGOperations.h: * dfg/DFGOperations.cpp: * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::callOperation): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_new_func): (JSC::JIT::emit_op_new_func_exp): * jit/JITOperations.cpp: * jit/JITOperations.h: Added new Jsc JIT_Operation parameter type for JSScope* values. Created declarations and definitions for new JIT_Operations with Jsc parameters. Use the JSScope* parameters in lieu of exec->scope() in operationNewFunction(). Removed comment for unused Jsa (JSLexicalEnvironment*) JIT_Operation parameter type. * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): Use the scope operand instead of exec->scope(). * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: Changed the operand indecies for added scope operand. 2014-11-13 Mark Lam Change X86/64 JIT probes to save/restore xmm regs as double instead of __m128. [Follow up] Reviewed by Michael Saboff. Removed a stale comment and a now unnecessary #include. * assembler/X86Assembler.h: 2014-11-13 Commit Queue Unreviewed, rolling out r176087. https://bugs.webkit.org/show_bug.cgi?id=138714 Broke the build (Requested by ap on #webkit). Reverted changeset: "Update WebKit to build with LLVM TOT" https://bugs.webkit.org/show_bug.cgi?id=138519 http://trac.webkit.org/changeset/176087 2014-11-13 Mark Lam Change X86/64 JIT probes to save/restore xmm regs as double instead of __m128. Reviewed by Michael Saboff. The JIT code only uses the xmm regs as double registers. This patch changes the storage types of the FP registers in X86Assembler.h to double instead of __m128, and updates the X86 and X86_64 JIT probe implementations accordingly. Also made some minor cosmetic changes in the output of the probe dump functions. * assembler/MacroAssemblerX86Common.cpp: (JSC::MacroAssemblerX86Common::ProbeContext::dumpCPURegisters): * assembler/X86Assembler.h: * jit/JITStubsX86.h: * jit/JITStubsX86Common.h: * jit/JITStubsX86_64.h: 2014-11-13 Juergen Ributzka Update WebKit to build with LLVM TOT https://bugs.webkit.org/show_bug.cgi?id=138519 Reviewed by Geoffrey Garen. * Configurations/LLVMForJSC.xcconfig: * llvm/LLVMAPIFunctions.h: * llvm/library/LLVMExports.cpp: (initializeAndGetJSCLLVMAPI): 2014-11-13 Benjamin Poulain ARMv7(s) Assembler: LDRH with immediate offset is loading from the wrong offset https://bugs.webkit.org/show_bug.cgi?id=136914 Reviewed by Michael Saboff. TLDR: the immediate offset of half-word load was divided by 2. Story time: So I started getting those weird reports of :nth-child() behaving bizarrely on ARMv7 and ARMv7s. To make things worse, the behavior changes depending on style updates. I started looking the disassembly on the tests cases... The first thing I noticed was that the computation of An+B looked wrong. For example, in the case of n+6, the instruction should have been: subs r1, r1, #6 but was subs r1, r1, #2 After spending a lot of time trying to find the error in the assembler, I discovered the problem was not real, but just a bug in the disassembler. This is the first fix: ARMv7DOpcodeAddSubtractImmediate3's immediate3() was truncating the value to 2 bits instead of 3 bits. The disassembler being fixed, I still have no lead on the weird bug. Some disassembly later, I realize the LDRH instruction is not decoded at all. The reason is that both LDRH and STRH were under the umbrella ARMv7DOpcodeLoadStoreRegisterImmediateHalfWord but the pattern only matched SRTH. I fix that next, ARMv7DOpcodeLoadStoreRegisterImmediateHalfWord is split into ARMv7DOpcodeStoreRegisterImmediateHalfWord and ARMv7DOpcodeLoadRegisterImmediateHalfWord, each with their own pattern and their instruction group. Now that I can see the LDRHs correctly, there is something fishy about them, their offset is way too small for the data I load. This time, looking at the binary, the generated code is indeed incorrect. It turns out that the ARMv7 assembler shifted the offset of half-word load as if they were byte load: divided by 4. As a result, all the load of half-words with more than zero offset were loading values with a smaller offset than what they should have. That being fixed, I dump the assembly: still wrong. I am ready to throw my keyboard through my screen at that point. Looking at the disassembler, there is yet again a bug. The computation of the scale() adjustment of the offset was incorrect for anything but word loads. I replaced it by a switch-case to make it explicit. STRH is likely incorrect too. I'll fix that in a follow up, I want to survey all the 16 bits cases that are not directly used by the CSS JIT. * assembler/ARMv7Assembler.h: (JSC::ARMv7Assembler::ldrh): Fix the immediate scaling. Add an assertion to make sure the alignment of the input is correct. * disassembler/ARMv7/ARMv7DOpcode.cpp: (JSC::ARMv7Disassembler::ARMv7DOpcodeLoadStoreRegisterImmediate::scale): Fix the scaling code. Just hardcode instruction-to-scale table. * disassembler/ARMv7/ARMv7DOpcode.h: (JSC::ARMv7Disassembler::ARMv7DOpcodeAddSubtractImmediate3::immediate3): The mask for a 3 bits immediate is not 3 :) (JSC::ARMv7Disassembler::ARMv7DOpcodeLoadStoreRegisterImmediate::scale): Deleted. 2014-11-13 Andreas Kling Generate put_by_id for bracket assignment with constant string subscript. Reviewed by Geoffrey Garen. Transform o["f"]=x to o.f=x when generating bytecode. This allows our JIT to inline-cache those accesses instead of always dropping out to C++. Just like the get_by_id transformations, this gets a bunch of use on real-web content (and Speedometer) but little/none on raw JS benchmarks. * bytecompiler/NodesCodegen.cpp: (JSC::AssignBracketNode::emitBytecode): 2014-11-12 Mark Lam Create canonical lists of registers used by both the Assemblers and the JIT probes. Reviewed by Filip Pizlo. * assembler/ARMAssembler.h: * assembler/ARMv7Assembler.h: * assembler/X86Assembler.h: - The FP register storage type is still defined as __m128 because the JIT probe code still expects that amount of storage to be available. Will change this to double when the JIT probe code is updated accordingly in a later patch. 2014-11-12 Andreas Kling Generate get_by_id for bracket access with constant string subscript. Reviewed by Michael Saboff. Transform o["f"] into o.f when generating bytecode. This allows our JIT to inline-cache those accesses instead of always dropping out to C++. This is surprisingly common in real-web content, less so in benchmarks. Interestingly, Speedometer does hit the optimization quite a bit. * bytecompiler/NodesCodegen.cpp: (JSC::BracketAccessorNode::emitBytecode): 2014-11-12 Mark Lam Rename USE(MASM_PROBE) to ENABLE(MASM_PROBE). Reviewed by Michael Saboff. Also move the switch for enabling the use of MASM_PROBE from JavaScriptCore's config.h to WTF's Platform.h. This ensures that the setting is consistently applied even when building WebCore parts as well. * assembler/ARMAssembler.h: * assembler/ARMv7Assembler.h: * assembler/MacroAssemblerARM.cpp: * assembler/MacroAssemblerARM.h: * assembler/MacroAssemblerARMv7.cpp: * assembler/MacroAssemblerARMv7.h: * assembler/MacroAssemblerX86.h: * assembler/MacroAssemblerX86Common.cpp: * assembler/MacroAssemblerX86Common.h: * assembler/MacroAssemblerX86_64.h: * assembler/X86Assembler.h: * config.h: * jit/JITStubs.h: * jit/JITStubsARM.h: * jit/JITStubsARMv7.h: * jit/JITStubsX86.h: * jit/JITStubsX86Common.h: * jit/JITStubsX86_64.h: 2014-11-12 peavo@outlook.com [WinCairo] Incorrect names for test executables in debug mode. https://bugs.webkit.org/show_bug.cgi?id=138659 Reviewed by Alex Christensen. In debug mode, jsc.exe, and testapi.exe are not created, causing JSC test failures. * JavaScriptCore.vcxproj/jsc/jscLauncher.vcxproj: * JavaScriptCore.vcxproj/testapi/testapiLauncher.vcxproj: 2014-11-11 Michael Saboff Change DFG to use scope operand for op_resolve_scope https://bugs.webkit.org/show_bug.cgi?id=138651 Reviewed by Geoffrey Garen. Changed to use the provided scope VirtualRegister. * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getScope): Changed to use an argument scope register. (JSC::DFG::ByteCodeParser::parseBlock): Created VirtualRegister from scope operand. 2014-11-11 Gyuyoung Kim Remove IncrementalSweeper::create() https://bugs.webkit.org/show_bug.cgi?id=138243 Reviewed by Filip Pizlo. As a step to use std::unique_ptr<> and std::make_unique<>, this patch removes IncrementalSweeper::create(), then set constructor of IncrementalSweeper to public. Now we begins to use std::make_unique<> to create IncrementalSweeper instance. * heap/Heap.cpp: (JSC::Heap::Heap): (JSC::Heap::setIncrementalSweeper): * heap/Heap.h: * heap/IncrementalSweeper.cpp: (JSC::IncrementalSweeper::create): Deleted. * heap/IncrementalSweeper.h: 2014-11-11 Joseph Pecoraro Web Inspector: Handle activating extra agents properly after inspector has connected https://bugs.webkit.org/show_bug.cgi?id=138639 Reviewed by Timothy Hatcher. Instead of having the protocol configuration directly add the extra agent to the inspector registry, isntead go through the augmentable controller. The controller will initialize as required if we are already connected or not, and will add to the registry. The functional change here is that the frontend can be notified to activate extra agents multiple times as agents eventually become available. * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::appendExtraAgent): * inspector/JSGlobalObjectInspectorController.h: * inspector/agents/InspectorAgent.cpp: (Inspector::InspectorAgent::activateExtraDomain): * inspector/agents/InspectorAgent.h: * inspector/augmentable/AugmentableInspectorController.h: * inspector/scripts/codegen/generator_templates.py: * inspector/scripts/tests/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result: * inspector/scripts/tests/expected/enum-values.json-result: * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result: Rebased results. 2014-11-11 Michael Saboff Use scope register when processing op_resolve_scope in LLInt and Baseline JIT https://bugs.webkit.org/show_bug.cgi?id=138637 Reviewed by Mark Lam. Filled out op_resolve_scope processing to use the scope operand to access the current scope chain. * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOperations.cpp: * jit/JITOperations.h: Added scope virtual register parameter to emitResolveClosure(). Added new callOperation() to support the additional argument. * jit/JITPropertyAccess.cpp: (JSC::JIT::emitResolveClosure): (JSC::JIT::emit_op_resolve_scope): (JSC::JIT::emitSlow_op_resolve_scope): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emitResolveClosure): (JSC::JIT::emit_op_resolve_scope): (JSC::JIT::emitSlow_op_resolve_scope): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): Added "scope" parameter to emitResolveClosure(). Passed scope register index to slow path. Used scope virtual register instead of JSStack::ScopeChain. 2014-11-11 Joseph Pecoraro Web Inspector: Don't require a debugger be attached for inspector auto attach https://bugs.webkit.org/show_bug.cgi?id=138638 Reviewed by Timothy Hatcher. * inspector/remote/RemoteInspector.mm: (Inspector::RemoteInspector::updateDebuggableAutomaticInspectCandidate): 2014-11-11 Akos Kiss Handle cases in StackVisitor::Frame::existingArguments() when lexicalEnvironment and/or unmodifiedArgumentsRegister is not set up yet https://bugs.webkit.org/show_bug.cgi?id=138543 Reviewed by Geoffrey Garen. Exception fuzzing may may raise exceptions in places where they would be otherwise impossible. Therefore, a callFrame may lack activation even if the codeBlock signals need of activation. Also, even if codeBlock signals the use of arguments, the unmodifiedArgumentsRegister may not be initialized yet (neither locally nor in lexicalEnvironment). If codeBlock()->needsActivation() is false, unmodifiedArgumentsRegister is already checked for Undefined. This patch applies the same check when the condition is true (and also checks whether callFrame()->hasActivation()). * interpreter/CallFrame.h: (JSC::ExecState::hasActivation): Moved to interpreter/CallFrameInlines.h. * interpreter/CallFrameInlines.h: (JSC::CallFrame::hasActivation): Fixed to verify that the JSValue returned by uncheckedActivation() is a cell. * interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::existingArguments): 2014-11-11 Andreas Kling Another assertion fix for debug builds after r175846. generateByIdStub() can now be called with an empty prototype chain if kind == GetUndefined, so tweak the assertion to cover that. * jit/Repatch.cpp: (JSC::generateByIdStub): 2014-11-10 Andreas Kling Assertion fix for debug builds after r175846. PropertySlot::slotBase() will assert if the slot is unset, so reorder the tests to check for isCacheableValue() first. * jit/Repatch.cpp: (JSC::tryCacheGetByID): 2014-11-10 Andreas Kling The JIT should cache property lookup misses. Add support for inline caching of missed property lookups. Previously this would banish us to C++ slow path. It's implemented as a simple GetById cache that returns jsUndefined() as long as the Structure chain check passes. There's no DFG exploitation of this knowledge in this patch. Test: js/regress/undefined-property-access.js (~5.5x speedup) Reviewed by Filip Pizlo. * bytecode/PolymorphicGetByIdList.h: * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeForStubInfo): Add GetByIdAccess::SimpleMiss so we can communicate to the DFG that the access has been cached. * jit/Repatch.cpp: (JSC::toString): (JSC::kindFor): (JSC::generateByIdStub): (JSC::tryCacheGetByID): (JSC::tryBuildGetByIDList): Added a GetUndefined stub kind, just a simple "store jsUndefined()" snippet. Use this to cache missed lookups, piggybacking mostly on the GetValue kind. * runtime/PropertySlot.h: (JSC::PropertySlot::isUnset): Exposed the unset state so PropertySlot can communicate that lookup failed. 2014-11-10 Michael Saboff Add scope operand to op_create_lexical_environment https://bugs.webkit.org/show_bug.cgi?id=138588 Reviewed by Geoffrey Garen. Added a second operand to op_create_lexical_environment that contains the scope register to update. Note that the DFG relies on operationCreateActivation() to update the scope register since we can't issue a set() with a non-local, non-argument register. This is temporary until the scope register is allocated as a local. * bytecode/BytecodeList.json: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): Added the scope register operand. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): Filled in the scope register operand. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_create_lexical_environment): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_create_lexical_environment): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: Set the scope register with the result of the appropriate create activation slow call. 2014-11-09 Akos Kiss Fix 'noreturn' function does return warning in LLVMOverrides.cpp https://bugs.webkit.org/show_bug.cgi?id=138306 Reviewed by Filip Pizlo. Adding NO_RETURN where needed. * llvm/library/LLVMExports.cpp: (initializeAndGetJSCLLVMAPI): * llvm/library/LLVMOverrides.cpp: * llvm/library/LLVMTrapCallback.h: 2014-11-07 Dániel Bátyai Fix an alignment issue with operationPushCatchScope on ARMv7 https://bugs.webkit.org/show_bug.cgi?id=138510 Reviewed by Csaba Osztrogonác. * jit/CCallHelpers.h: (JSC::CCallHelpers::setupArgumentsWithExecState): * jit/JITInlines.h: (JSC::JIT::callOperation): 2014-11-07 Michael Saboff Update scope related slow path code to use scope register added to opcodes https://bugs.webkit.org/show_bug.cgi?id=138254 Reviewed by Mark Lam. Updated slow paths for op_pop_scope, op_push_name_scope and op_push_with_scope. Added scope register index parameter to the front of the relevant argument lists of the slow functions. In the case of op_push_name_scope for x86 (32 bit), there aren't enough registers to accomodate all the parameters. Therefore, added two new JSVALUE32_64 slow paths called operationPushCatchScope() and operationPushFunctionNameScope() to eliminate the last "type" argument. * assembler/MacroAssemblerCodeRef.h: (JSC::FunctionPtr::FunctionPtr): Added a new template to take 6 arguments. * jit/CCallHelpers.h: (JSC::CCallHelpers::setupArgumentsWithExecState): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): New variants of setupArgumentsWithExecState() and callOperation() to handle the new combinations of argument types and counts. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_push_with_scope): (JSC::JIT::emit_op_pop_scope): (JSC::JIT::emit_op_push_name_scope): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_push_with_scope): (JSC::JIT::emit_op_pop_scope): (JSC::JIT::emit_op_push_name_scope): Use the new slow paths. * jit/JITOperations.cpp: * jit/JITOperations.h: Updates to set the scope result using the scope register index. Added operationPushCatchScope() and operationPushFunctionNameScope(). * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): Updated the scope slow paths to use the scope register index in the instruction to read and write the register instead of using CallFrame::scope() and CallFrame::setScope(). 2014-11-07 Gyuyoung Kim Apply std::unique_ptr to slowPathCall() https://bugs.webkit.org/show_bug.cgi?id=138489 Reviewed by Mark Lam. As a step to use std::unique_ptr<>, this patch makes slowPathCall() use std::unique_ptr<>, std::make_unique<>, and WTF::move(). * dfg/DFGSlowPathGenerator.h: (JSC::DFG::slowPathCall): (JSC::DFG::slowPathMove): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateJSArray): (JSC::DFG::SpeculativeJIT::addSlowPathGenerator): (JSC::DFG::SpeculativeJIT::arrayify): (JSC::DFG::SpeculativeJIT::compileIn): (JSC::DFG::SpeculativeJIT::compileGetByValOnString): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::cachedGetById): (JSC::DFG::SpeculativeJIT::cachedPutById): (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompare): (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::cachedGetById): (JSC::DFG::SpeculativeJIT::cachedPutById): (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeCompare): (JSC::DFG::SpeculativeJIT::nonSpeculativeNonPeepholeStrictEq): (JSC::DFG::SpeculativeJIT::compile): 2014-11-06 Mark Lam slow_path_get_direct_pname() needs to be hardened against a constant baseValue. Reviewed by Michael Saboff. slow_path_get_direct_pname() currently assumes that the baseValue is always a non-constant virtual register. However, this is not always the case like in the following: function foo() { var o = { a:1 }; for (var n in o) 0[n]; } foo(); This patch fixes it to also check for constant virtual register indexes. * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): 2014-11-06 Michael Saboff REGRESSION (r174985-174986): Site display disappears https://bugs.webkit.org/show_bug.cgi?id=138082 Reviewed by Geoffrey Garen. In support of the change in WebCore, this adds a new functor class to unwind to our caller's frame possibly skipping of intermediate C++ frames. * interpreter/StackVisitor.h: (JSC::CallerFunctor::CallerFunctor): (JSC::CallerFunctor::callerFrame): (JSC::CallerFunctor::operator()): 2014-11-06 Gyuyoung Kim Use std::unique_ptr in CodeBlock class https://bugs.webkit.org/show_bug.cgi?id=138395 Reviewed by Darin Adler. * bytecode/CodeBlock.h: Use std::unique_ptr. (JSC::CodeBlock::setJITCodeMap): * jit/CompactJITCodeMap.h: Use std::unique_ptr instead of OwnPtr|PassOwnPtr. (JSC::CompactJITCodeMap::CompactJITCodeMap): (JSC::CompactJITCodeMap::Encoder::finish): Use std::unique_ptr instead of PassOwnPtr. 2014-11-05 Mark Lam PutById inline caches should have a store barrier when it triggers a structure transition. Reviewed by Geoffrey Garen. After r174025, we no longer insert DFG store barriers when the payload of a PutById operation is not a cell. However, this can lead to a crash when we have PutById inline cache code transitioning the structure and re-allocating the butterfly of an old gen object. The lack of a store barrier in that inline cache results in the old gen object not being noticed during an eden GC scan. As a result, its newly allocated butterfly will not be kept alive, which leads to a stale butterfly pointer and, eventually, a crash. It is also possible that the new structure can be collected by the eden GC if (at GC time): 1. It is in the eden gen. 2. The inline cache that installed it has been evicted. 3. There are no live eden gen objects referring to it. The chances of this should be more rare than the butterfly re-allocation, but it is still possible. Hence, the fix is to always add a store barrier if the inline caches performs a structure transition. * jit/Repatch.cpp: (JSC::emitPutTransitionStub): - Added store barrier code based on SpeculativeJIT::storeToWriteBarrierBuffer()'s implementation. 2014-11-05 Gyuyoung Kim Use std::unique_ptr in JSClassRef and JSCallbackObject https://bugs.webkit.org/show_bug.cgi?id=138402 Reviewed by Geoffrey Garen. * API/JSCallbackObject.h: Use std::unique_ptr instead of OwnPtr|PassOwnPtr. (JSC::JSCallbackObjectData::setPrivateProperty): ditto. * API/JSClassRef.cpp: ditto. * API/JSClassRef.h: ditto. 2014-11-05 Michael Saboff Disable flakey float32-repeat-out-of-bounds.js and int8-repeat-out-of-bounds.js tests for ARM64 https://bugs.webkit.org/show_bug.cgi?id=138381 Reviewed by Mark Lam. Disabled these test for ARM64. Will address the failures and then re-enable. * tests/stress/float32-repeat-out-of-bounds.js: * tests/stress/int8-repeat-out-of-bounds.js: 2014-11-05 Alexey Proskuryakov Incorrect sandbox_check in RemoteInspector.mm https://bugs.webkit.org/show_bug.cgi?id=138408 Reviewed by Joseph Pecoraro. * inspector/remote/RemoteInspector.mm: (Inspector::canAccessWebInspectorMachPort): 2014-11-03 Dean Jackson Add ENABLE_FILTERS_LEVEL_2 feature guard. https://bugs.webkit.org/show_bug.cgi?id=138362 Reviewed by Tim Horton. Add a new feature define for Level 2 of CSS Filters. http://dev.w3.org/fxtf/filters-2/ * Configurations/FeatureDefines.xcconfig: 2014-11-04 Mark Lam Rename checkMarkByte() to jumpIfIsRememberedOrInEden(). Reviewed by Geoffrey Garen. Write barriers are needed for GC Eden collections so that we can scan pointers pointing from old generation objects to eden generation objects. The barrier currently checks the mark byte in a cell to see if we should skip adding the cell to the GC remembered set. The addition should be skipped if: 1. The cell is in the young generation. It has no old to eden pointers by definition. 2. The cell is already in the remembered set. While it is ok to add the cell to the GC remembered set more than once, it would be redundant. Hence, we skip this as an optimization to avoid doing unnecessary work. The barrier currently names this check as checkMarkByte(). We should rename it to jumpIfIsRememberedOrInEden() to be clearer about its intent. Similarly, Jump results of this check are currently named ownerNotMarkedOrAlreadyRemembered. This can be misinterpreted as the owner is not marked or not already remembered. We should rename it to ownerIsRememberedOrInEden which is clearer about the intent of the check. What we are really checking for is that the cell is in the eden gen, which is implied by it being "not marked". * dfg/DFGOSRExitCompilerCommon.cpp: (JSC::DFG::osrWriteBarrier): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::writeBarrier): * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::writeBarrier): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::writeBarrier): * jit/AssemblyHelpers.h: (JSC::AssemblyHelpers::jumpIfIsRememberedOrInEden): (JSC::AssemblyHelpers::checkMarkByte): Deleted. * jit/JITPropertyAccess.cpp: (JSC::JIT::emitWriteBarrier): * llint/LowLevelInterpreter.asm: * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: * runtime/JSCell.h: 2014-11-04 Joseph Pecoraro Web Inspector: Pause on exceptions should show the actual exception https://bugs.webkit.org/show_bug.cgi?id=63096 Reviewed by Timothy Hatcher. * debugger/Debugger.h: Expose accessor for the pause reason to subclasses. * inspector/JSInjectedScriptHost.cpp: (Inspector::JSInjectedScriptHost::type): New "error" subtype for error objects. * inspector/InjectedScriptSource.js: When an object is an error object, use toString to provide a richer description. * inspector/protocol/Runtime.json: Expose a new "error" subtype for Error types (TypeError, ReferenceError, EvalError, etc). * inspector/protocol/Debugger.json: Provide type checked objects for different Debugger.pause pause reasons. An exception provides the thrown object, but assert / CSP pauses provide a richer typed object as the auxiliary data. * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::dispatchDidPause): When paused because of an exception, pass the exception on. * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::handleConsoleAssert): (Inspector::InspectorDebuggerAgent::scriptExecutionBlockedByCSP): Provide richer data in pause events. * inspector/scripts/codegen/generate_backend_commands.py: (BackendCommandsGenerator.generate_domain.is_anonymous_enum_param): (BackendCommandsGenerator.generate_domain): * inspector/scripts/tests/expected/enum-values.json-result: Generate frontend enums for anonymous enum event parameters. 2014-11-04 Michael Saboff Disable flakey float32-repeat-out-of-bounds.js and int8-repeat-out-of-bounds.js tests for ARM64 https://bugs.webkit.org/show_bug.cgi?id=138381 Reviewed by Mark Lam. Disabled these test for ARM64. Will address the failures and then re-enable. * tests/stress/float32-repeat-out-of-bounds.js: * tests/stress/int8-repeat-out-of-bounds.js: 2014-11-04 Joseph Pecoraro Web Inspector: Enum value collisions between different generators https://bugs.webkit.org/show_bug.cgi?id=138343 Reviewed by Brian Burg. Each generator was using its own filtered list of domains_to_generate to build the shared unique list of enum value encodings. This list was slightly different across different generators. Instead always use the list of all non-supplemental domains to generate the shared list of enum values. * inspector/scripts/codegen/generator.py: (Generator.non_supplemental_domains): (Generator.domains_to_generate): (Generator._traverse_and_assign_enum_values): * inspector/scripts/tests/enum-values.json: Added. * inspector/scripts/tests/expected/enum-values.json-result: Added. 2014-11-03 Akos Kiss Workaround for Cortex-A53 erratum 835769 https://bugs.webkit.org/show_bug.cgi?id=138315 Reviewed by Filip Pizlo. This patch introduces CMake variable and preprocessor macro WTF_CPU_ARM64_CORTEXA53 with the aim of enabling Cortex-A53-specific code paths, if set true. The patch also implements one case where such code paths are needed: the workaround for Cortex-A53 erratum 835769. If WTF_CPU_ARM64_CORTEXA53 is set then: - CMake checks whether the compiler already has support for a workaround and adds -mfix-cortex-a53-835769 to the compiler flags if so, - the ARM64 backend of offlineasm inserts a nop between memory and multiply-accumulate instructions, and - the ARM64 assembler also inserts a nop between memory and (64-bit) multiply-accumulate instructions. * assembler/ARM64Assembler.h: (JSC::ARM64Assembler::madd): Call nopCortexA53Fix835769() to insert a nop if CPU(ARM64_CORTEXA53) and if necessary. (JSC::ARM64Assembler::msub): Likewise. (JSC::ARM64Assembler::smaddl): Likewise. (JSC::ARM64Assembler::smsubl): Likewise. (JSC::ARM64Assembler::umaddl): Likewise. (JSC::ARM64Assembler::umsubl): Likewise. (JSC::ARM64Assembler::nopCortexA53Fix835769): Added. Insert a nop if the previously emitted instruction was a load, a store, or a prefetch, and if the current instruction is 64-bit. * offlineasm/arm64.rb: Add the arm64CortexA53Fix835769 phase and call it from getModifiedListARM64 to insert nopCortexA53Fix835769 between appropriate macro instructions. Also, lower nopCortexA53Fix835769 to nop if CPU(ARM64_CORTEXA53), to nothing otherwise. * offlineasm/instructions.rb: Define macro instruction nopFixCortexA53Err835769. 2014-11-03 Commit Queue Unreviewed, rolling out r175509. https://bugs.webkit.org/show_bug.cgi?id=138349 broke some builds (Requested by msaboff on #webkit). Reverted changeset: "Update scope related slow path code to use scope register added to opcodes" https://bugs.webkit.org/show_bug.cgi?id=138254 http://trac.webkit.org/changeset/175509 2014-11-03 Michael Saboff Update scope related slow path code to use scope register added to opcodes https://bugs.webkit.org/show_bug.cgi?id=138254 Reviewed by Mark Lam. Updated slow paths for op_pop_scope, op_push_name_scope and op_push_with_scope. Added scope register index parameter to the front of the relevant argument lists of the slow functions. In the case of op_push_name_scope for x86 (32 bit), there aren't enough registers to accomodate all the parameters. Therefore, added two new JSVALUE32_64 slow paths called operationPushCatchScope() and operationPushFunctionNameScope() to eliminate the last "type" argument. * assembler/MacroAssemblerCodeRef.h: (JSC::FunctionPtr::FunctionPtr): Added a new template to take 6 arguments. * jit/CCallHelpers.h: (JSC::CCallHelpers::setupArgumentsWithExecState): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): New variants of setupArgumentsWithExecState() and callOperation() to handle the new combinations of argument types and counts. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_push_with_scope): (JSC::JIT::emit_op_pop_scope): (JSC::JIT::emit_op_push_name_scope): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_push_with_scope): (JSC::JIT::emit_op_pop_scope): (JSC::JIT::emit_op_push_name_scope): Use the new slow paths. * jit/JITOperations.cpp: * jit/JITOperations.h: Updates to set the scope result using the scope register index. Added operationPushCatchScope() and operationPushFunctionNameScope(). * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): Updated the scope slow paths to use the scope register index in the instruction to read and write the register instead of using CallFrame::scope() and CallFrame::setScope(). 2014-11-03 Michael Saboff Add "get scope" byte code https://bugs.webkit.org/show_bug.cgi?id=138326 Reviewed by Mark Lam. Added op_get_scope. Added implementations for the LLInt and baseline JIT. Provided nop implementation for DFG and FTL. The new byte code is emitted after op_enter for any function, program or eval. It is expected that the DFG will be implemented such that unneeded op_get_scope would be eliminated during DFG compilation. * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): Added new op_get_scope bytecode. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitGetScope): * bytecompiler/BytecodeGenerator.h: Emit new op_get_scope bytecode. * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): Added framework for new op_get_scope bytecode. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_get_scope): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_get_scope): * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: Implementation of op_get_scope bytecode. 2014-11-03 Joseph Pecoraro Web Inspector: Fix RWIProtocol 64-to-32 bit conversion warnings https://bugs.webkit.org/show_bug.cgi?id=138325 Reviewed by Timothy Hatcher. * inspector/InspectorValues.h: Vector's length really is an unsigned, so a static_cast here is fine. * inspector/scripts/codegen/generate_objective_c.py: (ObjCGenerator.objc_type_for_raw_name): Use int instead of NSInteger for APIs that eventually map to InspectorObject's setInteger, which takes an int. * inspector/scripts/tests/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/expected/events-with-optional-parameters.json-result: * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result: * inspector/scripts/tests/expected/type-declaration-object-type.json-result: * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result: Rebaselined results with the type change. 2014-11-03 Joseph Pecoraro Web Inspector: Show Selector's Specificity https://bugs.webkit.org/show_bug.cgi?id=138189 Reviewed by Timothy Hatcher. * inspector/protocol/CSS.json: Create a new named type CSSSelector to include a selector's text and specificity. The specificity tuple is optional as it may soon be made dynamic in some cases. 2014-11-03 Joseph Pecoraro Web Inspector: ObjC Protocol Interfaces should throw exceptions for nil arguments https://bugs.webkit.org/show_bug.cgi?id=138221 Reviewed by Timothy Hatcher. The RWIProtocol APIs will now raise exceptions when: - any properties are set on a type with a nil value or key (handled by RWIProtocolJSONObject) - required parameters in type constructors have nil value - required or optional command return parameters have nil values - required or optional event parameters have nil values The exceptions include the name of the field when possible. * inspector/scripts/codegen/generate_objective_c.py: (ObjCGenerator.is_type_objc_pointer_type): Provide a quick check to see if type would be a pointer or not in the ObjC API. Enums for example are not pointers in the API because we manage converting them to/from strings. * inspector/scripts/codegen/generate_objective_c_backend_dispatcher_implementation.py: (ObjectiveCConfigurationImplementationGenerator._generate_success_block_for_command): * inspector/scripts/codegen/generate_objective_c_frontend_dispatcher_implementation.py: (ObjectiveCFrontendDispatcherImplementationGenerator._generate_event): * inspector/scripts/codegen/generate_objective_c_types_implementation.py: (ObjectiveCTypesImplementationGenerator._generate_init_method_for_required_members): (ObjectiveCTypesImplementationGenerator._generate_setter_for_member): Throw exceptions when nil values are disallowed. * inspector/scripts/tests/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/expected/events-with-optional-parameters.json-result: * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result: * inspector/scripts/tests/expected/type-declaration-object-type.json-result: * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result: Rebaseline tests which include the exception raise calls. 2014-11-03 Joseph Pecoraro Web Inspector: ALTERNATE_DISPATCHERS Let the frontend know about extra agents https://bugs.webkit.org/show_bug.cgi?id=138236 Reviewed by Brian Burg. Inform the frontend about any extra domains the backend may have above and beyond the default list of domains for the debuggable type. This approach means there is almost no cost to normal debugging. When a JSContext is debugged with extra agents, a message is sent to the frontend letting it know which domains to then activate, and perform any initialization work that may be required. * inspector/InspectorAgentBase.h: (Inspector::InspectorAgentBase::domainName): * inspector/InspectorAgentRegistry.cpp: (Inspector::InspectorAgentRegistry::appendExtraAgent): * inspector/InspectorAgentRegistry.h: * inspector/scripts/codegen/generator_templates.py: Provide a way to get a list of just the extra domains. To aggregate this list provide a different "append" specifically for extra agents. * inspector/JSGlobalObjectInspectorController.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::connectFrontend): When a frontend connects, inform it of the extra domains. * inspector/protocol/Inspector.json: * inspector/agents/InspectorAgent.h: * inspector/agents/InspectorAgent.cpp: (Inspector::InspectorAgent::enable): (Inspector::InspectorAgent::activateExtraDomains): Send an event with the extra domains to activate. 2014-11-01 Michael Saboff Add scope operand to op_resolve_scope https://bugs.webkit.org/show_bug.cgi?id=138253 Reviewed by Mark Lam. Added scope operand to op_resolve_scope. Although the scope register is filled in with the ScopeChain register, this operand is not used in the processing of the bytecode. That will be addressed in a future patch. * bytecode/BytecodeList.json: Lengthened the three bytecodes. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): Added code to dump the scope operand. (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::finalizeUnconditionally): Updated the operand indecies for the processing of op_resolve_scope. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitResolveScope): (JSC::BytecodeGenerator::emitGetOwnScope): (JSC::BytecodeGenerator::emitReturn): Added scope register to these emit functions and the bytecodes they emit. * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): * dfg/DFGCapabilities.cpp: (JSC::DFG::capabilityLevel): * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_resolve_scope): (JSC::JIT::emitSlow_op_resolve_scope): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_resolve_scope): (JSC::JIT::emitSlow_op_resolve_scope): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: Updated the operand indecies for the processing of op_resolve_scope. 2014-11-01 Carlos Garcia Campos REGRESSION(CMake): Make it possible to build without introspection https://bugs.webkit.org/show_bug.cgi?id=138006 Reviewed by Philippe Normand. Do not install introspection files when introspection is disabled. * PlatformGTK.cmake: 2014-10-31 Gyuyoung Kim Use std::unique_ptr for TypeCountSet https://bugs.webkit.org/show_bug.cgi?id=138242 Reviewed by Andreas Kling. * heap/Heap.cpp: (JSC::Heap::protectedObjectTypeCounts): Use std::unique_ptr<> instead of PassOwnPtr|OwnPtr. (JSC::Heap::objectTypeCounts): ditto. * heap/Heap.h: 2014-10-31 Michael Saboff Add scope operand to op_push_with_scope, op_push_name_scope and op_pop_scope https://bugs.webkit.org/show_bug.cgi?id=138252 Reviewed by Geoffrey Garen. Added scope operand to op_push_with_scope, op_push_name_scope and op_pop_scope. Although the scope register is filled in with the ScopeChain register for all three bytecodes, this operand is not used in the processing of the bytecodes. That will be addressed in a future patch. * bytecode/BytecodeList.json: Lengthened the three bytecodes. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): Added code to dump the scope operand. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::emitPushWithScope): (JSC::BytecodeGenerator::emitPopScope): (JSC::BytecodeGenerator::emitComplexPopScopes): (JSC::BytecodeGenerator::emitPopScopes): (JSC::BytecodeGenerator::emitPushFunctionNameScope): (JSC::BytecodeGenerator::emitPushCatchScope): * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::scopeRegister): Added scope register to these emit functions and the bytecodes they emit. New m_scopeRegister and accessor. * bytecompiler/NodesCodegen.cpp: (JSC::ContinueNode::emitBytecode): (JSC::BreakNode::emitBytecode): (JSC::ReturnNode::emitBytecode): (JSC::WithNode::emitBytecode): (JSC::TryNode::emitBytecode): Created a RegisterID for the ScopeChain register and used it to emit the updated bytecodes. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_push_with_scope): (JSC::JIT::emit_op_push_name_scope): * jit/JITOpcodes32_64.cpp: (JSC::JIT::emit_op_push_with_scope): (JSC::JIT::emit_op_push_name_scope): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LowLevelInterpreter.asm: Updated the operand indecies for the processing of the updated bytecodes. 2014-10-31 Andreas Kling Make writes to RegExpObject.lastIndex cacheable. Reviewed by Geoffrey Garen. We were neglecting to IC the puts to RegExpObject.lastIndex on Octane/regexp, and ended up spending 4.5% of a time profile in operationPutByIdNonStrict. ~3% progression on Octane/regexp. * runtime/RegExpObject.cpp: (JSC::regExpObjectSetLastIndexStrict): (JSC::regExpObjectSetLastIndexNonStrict): (JSC::RegExpObject::put): 2014-10-31 Chris Dumez Fix a couple of warnings in JSC reported by clang static analyzer https://bugs.webkit.org/show_bug.cgi?id=138240 Reviewed by Geoffrey Garen. Fix a couple of warnings in JSC reported by clang static analyzer about value stored in variables never being read. This is addressed by reducing the scope of the variable or removing the variable entirely. * dfg/DFGConstantFoldingPhase.cpp: (JSC::DFG::ConstantFoldingPhase::emitGetByOffset): * runtime/VM.cpp: (JSC::VM::throwException): 2014-10-30 Dana Burkart Prepare for the mysterious future Reviewed by Lucas Forschler. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: * Configurations/FeatureDefines.xcconfig: * Configurations/Version.xcconfig: 2014-10-30 Saam Barati AST Nodes should keep track of their end offset https://bugs.webkit.org/show_bug.cgi?id=138143 Reviewed by Filip Pizlo. AST nodes nodes now have an int property for their end text offsets. This change lays some foundational work that will be needed in profiling which basic blocks have executed. * parser/ASTBuilder.h: (JSC::ASTBuilder::setEndOffset): * parser/Nodes.h: (JSC::Node::endOffset): (JSC::Node::setEndOffset): * parser/Parser.cpp: (JSC::Parser::parseStatement): (JSC::Parser::parseFunctionInfo): (JSC::Parser::parseExpression): (JSC::Parser::parseProperty): * parser/Parser.h: (JSC::Parser::parse): * parser/SyntaxChecker.h: (JSC::SyntaxChecker::operatorStackPop): 2014-10-30 Joseph Pecoraro Web Inspector: Generate ObjC inspector protocol types and alternate dispatcher interfaces https://bugs.webkit.org/show_bug.cgi?id=138048 Reviewed by Brian Burg. Generate Objective-C interfaces for inspector protocol types, command, and event dispatchers. This is very much like the InspectorProtocolTypes, BackendDispatchers, and FrontendDispatchers, but with an ObjC spin on things. The private API that clients would use is all encapsulated in RWIProtocol.h. It includes the types interfaces, command handler protocol, and event dispatcher interface. Where possible the API uses real enums, which hides the raw protocol enum strings from clients. Inspector protocol types are, like InspectorProtocolObjects, built on top of an InspectorObject. This offers the flexibilty of adding arbitrary key/values using the RWIProtocolJSONObject interface, which may be required for certain protocol objects like "Network.Headers" which have no fields, but expect arbitrary properties to be added. Command handler protocols always have two callbacks. An error callback and a success callback. The signature is very much like BackendDispatchers. In parameters are passed directly to the selectors, and out parameters are defined by the success callback. It will be the client's responsibility to call either of these callbacks to complete handling of a request. Event dispatcher interfaces are straight forward, just packaging up the arguments and sending the message to the frontend. ObjC <-> Protocol conversion happens in each of the generated files. In type getters / setters, in commands parameters and event parameters. For this to work we generate conversion helpers for all enums, ObjC enum <-> protocol strings. For NSArray <-> InspectorArray there are some static helpers to do the conversions. We do lose some type safety in these conversions. * JavaScriptCore.xcodeproj/project.pbxproj: * inspector/scripts/codegen/__init__.py: * inspector/scripts/codegen/generate_alternate_backend_dispatcher_header.py: (AlternateBackendDispatcherHeaderGenerator._generate_handler_declarations_for_domain): * inspector/scripts/codegen/generate_backend_dispatcher_header.py: (BackendDispatcherHeaderGenerator._generate_alternate_handler_forward_declarations_for_domains.AlternateInspector): (BackendDispatcherHeaderGenerator._generate_handler_declarations_for_domain): (BackendDispatcherHeaderGenerator._generate_dispatcher_declarations_for_domain): * inspector/scripts/codegen/generate_backend_dispatcher_implementation.py: (BackendDispatcherImplementationGenerator._generate_handler_class_destructor_for_domain): (BackendDispatcherImplementationGenerator._generate_dispatcher_implementations_for_domain): * inspector/scripts/codegen/generate_frontend_dispatcher_header.py: (FrontendDispatcherHeaderGenerator._generate_dispatcher_declarations_for_domain): * inspector/scripts/codegen/generate_frontend_dispatcher_implementation.py: (FrontendDispatcherImplementationGenerator._generate_dispatcher_implementations_for_domain): * inspector/scripts/codegen/generate_objective_c.py: Added. (join_type_and_name): (strip_comment_markers): (remove_duplicate_from_str): (ObjCTypeCategory): (ObjCTypeCategory.category_of_type): (ObjCGenerator): (ObjCGenerator.identifier_to_objc_identifier): (ObjCGenerator.objc_identifier_to_identifier): (ObjCGenerator.should_generate_domain_types_filter): (ObjCGenerator.should_generate_domain_types_filter.should_generate_domain_types): (ObjCGenerator.should_generate_domain_command_handler_filter): (ObjCGenerator.should_generate_domain_command_handler_filter.should_generate_domain_command_handler): (ObjCGenerator.should_generate_domain_event_dispatcher_filter): (ObjCGenerator.should_generate_domain_event_dispatcher_filter.should_generate_domain_event_dispatcher): (ObjCGenerator.objc_name_for_type): (ObjCGenerator.objc_enum_name_for_anonymous_enum_declaration): (ObjCGenerator.objc_enum_name_for_anonymous_enum_member): (ObjCGenerator.objc_enum_name_for_anonymous_enum_parameter): (ObjCGenerator.objc_enum_name_for_non_anonymous_enum): (ObjCGenerator.variable_name_prefix_for_domain): (ObjCGenerator.objc_accessor_type_for_raw_name): (ObjCGenerator.objc_type_for_raw_name): (ObjCGenerator.objc_class_for_raw_name): (ObjCGenerator.protocol_type_for_raw_name): (ObjCGenerator.protocol_type_for_type): (ObjCGenerator.objc_class_for_type): (ObjCGenerator.objc_accessor_type_for_member): (ObjCGenerator.objc_accessor_type_for_member_internal): (ObjCGenerator.objc_type_for_member): (ObjCGenerator.objc_type_for_member_internal): (ObjCGenerator.objc_type_for_param): (ObjCGenerator.objc_type_for_param_internal): (ObjCGenerator.objc_protocol_export_expression_for_variable): (ObjCGenerator.objc_protocol_import_expression_for_member): (ObjCGenerator.objc_protocol_import_expression_for_parameter): (ObjCGenerator.objc_protocol_import_expression_for_variable): (ObjCGenerator.objc_to_protocol_expression_for_member): (ObjCGenerator.protocol_to_objc_expression_for_member): (ObjCGenerator.objc_setter_method_for_member): (ObjCGenerator.objc_setter_method_for_member_internal): (ObjCGenerator.objc_getter_method_for_member): (ObjCGenerator.objc_getter_method_for_member_internal): * inspector/scripts/codegen/generate_objective_c_backend_dispatcher_header.py: Copied from Source/JavaScriptCore/inspector/scripts/codegen/generate_alternate_backend_dispatcher_header.py. (ObjectiveCBackendDispatcherHeaderGenerator): (ObjectiveCBackendDispatcherHeaderGenerator.output_filename): (ObjectiveCBackendDispatcherHeaderGenerator.domains_to_generate): (ObjectiveCBackendDispatcherHeaderGenerator.generate_output): (ObjectiveCBackendDispatcherHeaderGenerator._generate_objc_forward_declarations): (ObjectiveCBackendDispatcherHeaderGenerator._generate_objc_forward_declarations_for_domains): (ObjectiveCBackendDispatcherHeaderGenerator._generate_objc_handler_declarations_for_domain): (ObjectiveCBackendDispatcherHeaderGenerator._generate_objc_handler_declaration_for_command): * inspector/scripts/codegen/generate_objective_c_backend_dispatcher_implementation.py: Added. (ObjectiveCConfigurationImplementationGenerator): (ObjectiveCConfigurationImplementationGenerator.__init__): (ObjectiveCConfigurationImplementationGenerator.output_filename): (ObjectiveCConfigurationImplementationGenerator.domains_to_generate): (ObjectiveCConfigurationImplementationGenerator.generate_output): (ObjectiveCConfigurationImplementationGenerator._generate_handler_implementation_for_domain): (ObjectiveCConfigurationImplementationGenerator._generate_handler_implementation_for_command): (ObjectiveCConfigurationImplementationGenerator._generate_success_block_for_command): (ObjectiveCConfigurationImplementationGenerator._generate_conversions_for_command): (ObjectiveCConfigurationImplementationGenerator._generate_invocation_for_command): * inspector/scripts/codegen/generate_objective_c_configuration_header.py: Copied from Source/JavaScriptCore/inspector/scripts/codegen/generate_alternate_backend_dispatcher_header.py. (ObjectiveCConfigurationHeaderGenerator): (ObjectiveCConfigurationHeaderGenerator.output_filename): (ObjectiveCConfigurationHeaderGenerator.generate_output): (ObjectiveCConfigurationHeaderGenerator._generate_configuration_interface_for_domains): (ObjectiveCConfigurationHeaderGenerator._generate_properties_for_domain): * inspector/scripts/codegen/generate_objective_c_configuration_implementation.py: Added. (ObjectiveCBackendDispatcherImplementationGenerator): (ObjectiveCBackendDispatcherImplementationGenerator.__init__): (ObjectiveCBackendDispatcherImplementationGenerator.output_filename): (ObjectiveCBackendDispatcherImplementationGenerator.generate_output): (ObjectiveCBackendDispatcherImplementationGenerator._generate_configuration_implementation_for_domains): (ObjectiveCBackendDispatcherImplementationGenerator._generate_ivars): (ObjectiveCBackendDispatcherImplementationGenerator._generate_dealloc): (ObjectiveCBackendDispatcherImplementationGenerator._generate_handler_setter_for_domain): (ObjectiveCBackendDispatcherImplementationGenerator._generate_event_dispatcher_getter_for_domain): * inspector/scripts/codegen/generate_objective_c_conversion_helpers.py: Added. (add_whitespace_separator): (ObjectiveCConversionHelpersGenerator): (ObjectiveCConversionHelpersGenerator.__init__): (ObjectiveCConversionHelpersGenerator.output_filename): (ObjectiveCConversionHelpersGenerator.domains_to_generate): (ObjectiveCConversionHelpersGenerator.generate_output): (ObjectiveCConversionHelpersGenerator._generate_enum_conversion_functions): (ObjectiveCConversionHelpersGenerator._generate_anonymous_enum_conversion_for_declaration): (ObjectiveCConversionHelpersGenerator._generate_anonymous_enum_conversion_for_member): (ObjectiveCConversionHelpersGenerator._generate_anonymous_enum_conversion_for_parameter): (ObjectiveCConversionHelpersGenerator._generate_enum_objc_to_protocol_string): (ObjectiveCConversionHelpersGenerator._generate_enum_from_protocol_string): * inspector/scripts/codegen/generate_objective_c_frontend_dispatcher_implementation.py: Added. (ObjectiveCFrontendDispatcherImplementationGenerator): (ObjectiveCFrontendDispatcherImplementationGenerator.__init__): (ObjectiveCFrontendDispatcherImplementationGenerator.output_filename): (ObjectiveCFrontendDispatcherImplementationGenerator.domains_to_generate): (ObjectiveCFrontendDispatcherImplementationGenerator.generate_output): (ObjectiveCFrontendDispatcherImplementationGenerator._generate_event_dispatcher_implementations): (ObjectiveCFrontendDispatcherImplementationGenerator._generate_event): (ObjectiveCFrontendDispatcherImplementationGenerator._generate_event_signature): (ObjectiveCFrontendDispatcherImplementationGenerator._generate_event_out_parameters): * inspector/scripts/codegen/generate_objective_c_header.py: Added. (add_whitespace_separator): (ObjectiveCHeaderGenerator): (ObjectiveCHeaderGenerator.__init__): (ObjectiveCHeaderGenerator.output_filename): (ObjectiveCHeaderGenerator.generate_output): (ObjectiveCHeaderGenerator._generate_forward_declarations): (ObjectiveCHeaderGenerator._generate_enums): (ObjectiveCHeaderGenerator._generate_types): (ObjectiveCHeaderGenerator._generate_anonymous_enum_for_declaration): (ObjectiveCHeaderGenerator._generate_anonymous_enum_for_member): (ObjectiveCHeaderGenerator._generate_anonymous_enum_for_parameter): (ObjectiveCHeaderGenerator._generate_enum): (ObjectiveCHeaderGenerator._generate_enum.NS_ENUM): (ObjectiveCHeaderGenerator._generate_type_interface): (ObjectiveCHeaderGenerator._generate_init_method_for_required_members): (ObjectiveCHeaderGenerator._generate_member_property): (ObjectiveCHeaderGenerator._generate_command_protocols): (ObjectiveCHeaderGenerator._generate_single_command_protocol): (ObjectiveCHeaderGenerator._callback_block_for_command): (ObjectiveCHeaderGenerator._generate_event_interfaces): (ObjectiveCHeaderGenerator._generate_single_event_interface): * inspector/scripts/codegen/generate_objective_c_internal_header.py: Copied from Source/JavaScriptCore/inspector/scripts/codegen/generate_alternate_backend_dispatcher_header.py. (ObjectiveCTypesInternalHeaderGenerator): (ObjectiveCTypesInternalHeaderGenerator.output_filename): (ObjectiveCTypesInternalHeaderGenerator.generate_output): (ObjectiveCTypesInternalHeaderGenerator._generate_event_dispatcher_private_interfaces): * inspector/scripts/codegen/generate_objective_c_types_implementation.py: Added. (add_whitespace_separator): (ObjectiveCTypesImplementationGenerator): (ObjectiveCTypesImplementationGenerator.__init__): (ObjectiveCTypesImplementationGenerator.output_filename): (ObjectiveCTypesImplementationGenerator.domains_to_generate): (ObjectiveCTypesImplementationGenerator.generate_output): (ObjectiveCTypesImplementationGenerator.generate_type_implementations): (ObjectiveCTypesImplementationGenerator.generate_type_implementation): (ObjectiveCTypesImplementationGenerator._generate_init_method_for_required_members): (ObjectiveCTypesImplementationGenerator._generate_setter_for_member): (ObjectiveCTypesImplementationGenerator._generate_getter_for_member): * inspector/scripts/codegen/generate_protocol_types_header.py: (ProtocolTypesHeaderGenerator._generate_forward_declarations): (_generate_typedefs_for_domain): (_generate_builders_for_domain): * inspector/scripts/codegen/generator.py: (Generator.wrap_with_guard_for_domain): (Generator): (Generator.wrap_with_guard): * inspector/scripts/codegen/generator_templates.py: (AlternateInspector): (ObjCInspector): * inspector/scripts/codegen/models.py: (Framework.fromString): (Frameworks): * inspector/scripts/generate-inspector-protocol-bindings.py: (generate_from_specification): * inspector/scripts/tests/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result: * inspector/scripts/tests/expected/events-with-optional-parameters.json-result: * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result: * inspector/scripts/tests/expected/same-type-id-different-domain.json-result: * inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result: * inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result: * inspector/scripts/tests/expected/type-declaration-array-type.json-result: * inspector/scripts/tests/expected/type-declaration-enum-type.json-result: * inspector/scripts/tests/expected/type-declaration-object-type.json-result: * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result: 2014-10-30 Andreas Kling Unreviewed assertion fix. RegExpCachedResult::m_reified is now the dedicated member that knows whether the result was reified into an array or not. Check that instead of m_result which is now single-purpose. * runtime/RegExpCachedResult.cpp: (JSC::RegExpCachedResult::setInput): 2014-10-29 Andreas Kling Use plain JSArray for RegExp matches instead of a lazily populated custom object. Reviewed by Geoffrey Garen. We're already offering two RegExp matching APIs, one that collects subpattern matches (exec), and one that simply tests for a match (test). Given that, it was pretty overkill to lazily populate the resulting array of matches, since the user could simply use test() if they didn't need them. This allows the JIT to generate better code for RegExp match arrays, and also enables some fast paths in the JSC runtime that check if an object isJSArray(). Looks like ~1.5% improvement on Octane/regexp according to run-jsc-benchmarks. * jit/Repatch.cpp: (JSC::tryCacheGetByID): * runtime/JSArray.h: (JSC::createArrayButterflyWithExactLength): Deleted. * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::init): * runtime/RegExpCachedResult.cpp: (JSC::RegExpCachedResult::visitChildren): (JSC::RegExpCachedResult::lastResult): (JSC::RegExpCachedResult::leftContext): (JSC::RegExpCachedResult::rightContext): * runtime/RegExpCachedResult.h: (JSC::RegExpCachedResult::RegExpCachedResult): (JSC::RegExpCachedResult::record): (JSC::RegExpCachedResult::input): * runtime/RegExpConstructor.cpp: (JSC::RegExpConstructor::getBackref): (JSC::RegExpConstructor::getLastParen): (JSC::RegExpConstructor::getLeftContext): (JSC::RegExpConstructor::getRightContext): * runtime/RegExpMatchesArray.cpp: (JSC::createRegExpMatchesArray): (JSC::RegExpMatchesArray::RegExpMatchesArray): Deleted. (JSC::RegExpMatchesArray::create): Deleted. (JSC::RegExpMatchesArray::finishCreation): Deleted. (JSC::RegExpMatchesArray::visitChildren): Deleted. (JSC::RegExpMatchesArray::reifyAllProperties): Deleted. (JSC::RegExpMatchesArray::reifyMatchProperty): Deleted. (JSC::RegExpMatchesArray::leftContext): Deleted. (JSC::RegExpMatchesArray::rightContext): Deleted. * runtime/RegExpMatchesArray.h: (JSC::RegExpMatchesArray::createStructure): Deleted. (JSC::RegExpMatchesArray::reifyAllPropertiesIfNecessary): Deleted. (JSC::RegExpMatchesArray::reifyMatchPropertyIfNecessary): Deleted. (JSC::RegExpMatchesArray::getOwnPropertySlot): Deleted. (JSC::RegExpMatchesArray::getOwnPropertySlotByIndex): Deleted. (JSC::RegExpMatchesArray::put): Deleted. (JSC::RegExpMatchesArray::putByIndex): Deleted. (JSC::RegExpMatchesArray::deleteProperty): Deleted. (JSC::RegExpMatchesArray::deletePropertyByIndex): Deleted. (JSC::RegExpMatchesArray::getOwnPropertyNames): Deleted. (JSC::RegExpMatchesArray::defineOwnProperty): Deleted. (JSC::isRegExpMatchesArray): Deleted. * runtime/RegExpObject.cpp: (JSC::RegExpObject::exec): * runtime/StringPrototype.cpp: (JSC::stringProtoFuncMatch): 2014-10-29 Joseph Pecoraro Web Inspector: Fix Type Dependency Issues https://bugs.webkit.org/show_bug.cgi?id=125664 Reviewed by Brian Burg. Now that all JSON protocol files are processed together again in r174892, we can remove the duplicated types which were only needed when the domains were split. * inspector/protocol/Console.json: * inspector/protocol/Runtime.json: 2014-10-28 Commit Queue Unreviewed, rolling out r175249. https://bugs.webkit.org/show_bug.cgi?id=138138 Appears to be failing some JS tests (Requested by mlam_ on #webkit). Reverted changeset: "Holes are not copied properly when Arrays change shape to ArrayStorage type." https://bugs.webkit.org/show_bug.cgi?id=138118 http://trac.webkit.org/changeset/175249 2014-10-27 Mark Lam Holes are not copied properly when Arrays change shape to ArrayStorage type. Reviewed by Mark Hahnenberg. When we convert non-ArrayStorage typed arrays into ArrayStorage typed arrays, we skipped the holes. As a result, the slots in the ArrayStorage vector that corresponds to those holes are uninitialize. This is now fixed. * runtime/JSObject.cpp: (JSC::JSObject::convertUndecidedToArrayStorage): (JSC::JSObject::convertInt32ToArrayStorage): (JSC::JSObject::convertDoubleToArrayStorage): (JSC::JSObject::convertContiguousToArrayStorage): 2014-10-27 Mark Lam Crash when attempting to perform array iteration on a non-array with numeric keys not initialized. Reviewed by Geoffrey Garen. The arrayIteratorNextThunkGenerator() thunk was not checking for the case where the butterfly may be NULL. This was the source of the crash, and is now fixed. In addition, it is also not checking for the case where a property named "length" may have been set on the iterated object. The thunk only checks the butterfly's publicLength for its iteration operation. Array objects will work fine with this because it always updates its butterfly's publicLength when its length changes. In the case of iterable non-Array objects, the "length" property will require a look up outside of the scope of this thunk. The fix is simply to limit the fast case checks in this thunk to Array objects. * jit/ThunkGenerators.cpp: (JSC::arrayIteratorNextThunkGenerator): 2014-10-27 Mark Lam Simplified some JSObject methods for converting arrays to ArrayStorage shape. Reviewed by Filip Pizlo. Currently, for each Undecided, Int32, Double, and Contiguous array shapes, there are 3 JSObject methods to convert them to ArrayStorage shape: ArrayStorage* convertToArrayStorage(VM&, NonPropertyTransition, unsigned neededLength); ArrayStorage* convertToArrayStorage(VM&, NonPropertyTransition); ArrayStorage* convertToArrayStorage(VM&); However, the neededLength that is passed is always m_butterfly->vectorLength(). Hence, the method that takes a neededLength is really not needed. This patch removes this unneeded verbosity. * runtime/JSObject.cpp: (JSC::JSObject::convertUndecidedToArrayStorage): (JSC::JSObject::convertInt32ToArrayStorage): - Also reordered the placement of the DeferGC statement so this Int32 function will look more similar to the others. (JSC::JSObject::convertDoubleToArrayStorage): (JSC::JSObject::convertContiguousToArrayStorage): * runtime/JSObject.h: 2014-10-25 Brian J. Burg Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Unreviewed, follow-up fix after r175203. The debugger agent should not assume that the inspector environment's stopwatch has already been started. * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): Check if the stopwatch isActive() before stopping. 2014-10-18 Brian J. Burg Web Inspector: timelines should not count time elapsed while paused in the debugger https://bugs.webkit.org/show_bug.cgi?id=136351 Reviewed by Timothy Hatcher. Now that we have a stopwatch to provide pause-aware timing data, we can remove the profiler's handling of debugger pause/continue callbacks. The debugger agent accounts for suspended execution by pausing and resuming the stopwatch. * API/JSProfilerPrivate.cpp: (JSStartProfiling): Use a fresh stopwatch when profiling from the JSC API. * inspector/InspectorEnvironment.h: * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::executionStopwatch): * inspector/JSGlobalObjectInspectorController.h: * inspector/ScriptDebugServer.cpp: (Inspector::ScriptDebugServer::handlePause): * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::InspectorDebuggerAgent::didPause): (Inspector::InspectorDebuggerAgent::breakpointActionProbe): (Inspector::InspectorDebuggerAgent::didContinue): * inspector/agents/InspectorDebuggerAgent.h: * profiler/LegacyProfiler.cpp: (JSC::LegacyProfiler::profiler): Use nullptr. (JSC::LegacyProfiler::startProfiling): Hand off a stopwatch to the profile generator. (JSC::LegacyProfiler::stopProfiling): Use nullptr. (JSC::LegacyProfiler::didPause): Deleted. (JSC::LegacyProfiler::didContinue): Deleted. * profiler/LegacyProfiler.h: * profiler/Profile.cpp: The root node should always have a start time of 0.0. (JSC::Profile::Profile): * profiler/ProfileGenerator.cpp: Remove debugger pause/continue callbacks and the timestamp member that was used to track time elapsed by the debugger. Just use the stopwatch's elapsed times to generate start/elapsed times for function calls. (JSC::ProfileGenerator::create): (JSC::ProfileGenerator::ProfileGenerator): (JSC::AddParentForConsoleStartFunctor::operator()): The parent node of |console.profile| should have a start time of 0.0, since it represents the starting node of profiling. (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): Deleted. (JSC::ProfileGenerator::didContinue): Deleted. * profiler/ProfileGenerator.h: 2014-10-24 Mark Lam Simplified IndexingType's hasAnyArrayStorage(). Reviewed by Michael Saboff. IndexingType's hasAnyArrayStorage() currently does subtraction of ArrayStorageShape with the purpose of making non-ArrayStorage types underflow (with that subtraction) and have a result that exceeds SlowPutArrayStorageShape. What it is doing is basically checking for a shape value that is greater equal to ArrayStorageShape. We can just simplify the code as such. Also added a comment to describe the structure of the bits in IndexingType. * runtime/IndexingType.h: (JSC::hasAnyArrayStorage): 2014-10-23 Joseph Pecoraro Web Inspector: Provide a way to have alternate inspector agents https://bugs.webkit.org/show_bug.cgi?id=137901 Reviewed by Brian Burg. Provide a way to use alternate inspector agents debugging a JSContext. Expose a very slim private API that a client could use to know when an inspector has connected/disconnected, and a way to register its augmentative agents. * Configurations/FeatureDefines.xcconfig: * JavaScriptCore.xcodeproj/project.pbxproj: New feature guard. New files. * API/JSContextRef.cpp: (JSGlobalContextGetAugmentableInspectorController): * API/JSContextRefInspectorSupport.h: Added. Access to the private interface from a JSContext. * inspector/JSGlobalObjectInspectorController.cpp: (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController): (Inspector::JSGlobalObjectInspectorController::connectFrontend): (Inspector::JSGlobalObjectInspectorController::disconnectFrontend): * inspector/JSGlobalObjectInspectorController.h: * inspector/augmentable/AugmentableInspectorController.h: Added. (Inspector::AugmentableInspectorController::~AugmentableInspectorController): (Inspector::AugmentableInspectorController::connected): * inspector/augmentable/AugmentableInspectorControllerClient.h: Added. (Inspector::AugmentableInspectorControllerClient::~AugmentableInspectorControllerClient): * inspector/augmentable/AlternateDispatchableAgent.h: Added. (Inspector::AlternateDispatchableAgent::AlternateDispatchableAgent): Provide the private APIs a client could use to add alternate agents using alternate backend dispatchers. * inspector/scripts/codegen/__init__.py: * inspector/scripts/generate-inspector-protocol-bindings.py: (generate_from_specification): New includes, and use the new generator. * inspector/scripts/codegen/generate_alternate_backend_dispatcher_header.py: Added. (AlternateBackendDispatcherHeaderGenerator): (AlternateBackendDispatcherHeaderGenerator.__init__): (AlternateBackendDispatcherHeaderGenerator.output_filename): (AlternateBackendDispatcherHeaderGenerator.generate_output): (AlternateBackendDispatcherHeaderGenerator._generate_handler_declarations_for_domain): (AlternateBackendDispatcherHeaderGenerator._generate_handler_declaration_for_command): Generate the abstract AlternateInspectorBackendDispatcher interfaces. * inspector/scripts/codegen/generate_backend_dispatcher_header.py: (BackendDispatcherHeaderGenerator.generate_output): (BackendDispatcherHeaderGenerator._generate_alternate_handler_forward_declarations_for_domains): (BackendDispatcherHeaderGenerator._generate_alternate_handler_forward_declarations_for_domains.AlternateInspector): Forward declare alternate dispatchers, and allow setting an alternate dispatcher on a domain dispatcher. * inspector/scripts/codegen/generate_backend_dispatcher_implementation.py: (BackendDispatcherImplementationGenerator.generate_output): (BackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command): Check for and dispatch on an AlternateInspectorBackendDispatcher if there is one for this domain. * inspector/scripts/codegen/generator_templates.py: (AlternateInspectorBackendDispatcher): (AlternateInspector): Template boilerplate for prelude and postlude. * inspector/scripts/tests/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result: * inspector/scripts/tests/expected/events-with-optional-parameters.json-result: * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result: * inspector/scripts/tests/expected/same-type-id-different-domain.json-result: * inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result: * inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result: * inspector/scripts/tests/expected/type-declaration-array-type.json-result: * inspector/scripts/tests/expected/type-declaration-enum-type.json-result: * inspector/scripts/tests/expected/type-declaration-object-type.json-result: * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result: Rebaseline tests. 2014-10-23 Michael Saboff offsets.rb:183:in `buildOffsetsMap': unhandled exception - is offlineasm dependency tracking broken? (132668) https://bugs.webkit.org/show_bug.cgi?id=138017 Reviewed by Mark Lam. Removed from the nput file $(SRCROOT)/llint/LowLevelAssembler.asm and output file $(BUILT_PRODUCTS_DIR)/LLIntOffsets/LLIntDesiredOffsets.h from the Generate Derived Sources build phase in the LLInt Offset target. There is no need for Xcode to do any dependency checking with these files as the ruby script offlineasm/generate_offset_extractor.rb will do that for us. * JavaScriptCore.xcodeproj/project.pbxproj: 2014-10-23 Michael Saboff Change CallFrame::lexicalGlobalObject() to use Callee instead of JSScope https://bugs.webkit.org/show_bug.cgi?id=136901 Reviewed by Mark Lam. Implement ExecState::lexicalGlobalObject() using Callee. * runtime/JSScope.h: (JSC::ExecState::lexicalGlobalObject): 2014-10-22 Milan Crha Prefix isnan() with std::. . Reviewed by Carlos Garcia Campos. * profiler/ProfileNode.h: (JSC::ProfileNode::Call::setStartTime): (JSC::ProfileNode::Call::setElapsedTime): 2014-10-22 Mark Lam Refactoring to simplify some code in DatePrototype.cpp. Reviewed by Filip Pizlo. A bunch of functions in DatePrototype.cpp have the pattern of loading a constant into a local variable only to pass it to a callee function immediately after. There is no other use for that variable. This adds additional verbosity with no added benefit. This patch refactors those functions to just pass the constant arg directly. * runtime/DatePrototype.cpp: (JSC::dateProtoFuncSetMilliSeconds): (JSC::dateProtoFuncSetUTCMilliseconds): (JSC::dateProtoFuncSetSeconds): (JSC::dateProtoFuncSetUTCSeconds): (JSC::dateProtoFuncSetMinutes): (JSC::dateProtoFuncSetUTCMinutes): (JSC::dateProtoFuncSetHours): (JSC::dateProtoFuncSetUTCHours): (JSC::dateProtoFuncSetDate): (JSC::dateProtoFuncSetUTCDate): (JSC::dateProtoFuncSetMonth): (JSC::dateProtoFuncSetUTCMonth): (JSC::dateProtoFuncSetFullYear): (JSC::dateProtoFuncSetUTCFullYear): 2014-10-22 Byungseon Shin String(new Date(Mar 30 2014 01:00:00)) is wrong in CET https://bugs.webkit.org/show_bug.cgi?id=130967 Reviewed by Mark Lam. By definition of calculateLocalTimeOffset, input time should be UTC time. But there are many cases when input time is based on local time. So, it gives erroneous results while calculating offset of DST boundary time. By adding a argument to distinguish UTC and local time, we can get the correct offset. * JavaScriptCore.order: * runtime/DateConstructor.cpp: (JSC::constructDate): (JSC::callDate): (JSC::dateUTC): * runtime/DateInstance.cpp: (JSC::DateInstance::calculateGregorianDateTime): (JSC::DateInstance::calculateGregorianDateTimeUTC): * runtime/DatePrototype.cpp: (JSC::setNewValueFromTimeArgs): (JSC::setNewValueFromDateArgs): (JSC::dateProtoFuncSetMilliSeconds): (JSC::dateProtoFuncSetUTCMilliseconds): (JSC::dateProtoFuncSetSeconds): (JSC::dateProtoFuncSetUTCSeconds): (JSC::dateProtoFuncSetMinutes): (JSC::dateProtoFuncSetUTCMinutes): (JSC::dateProtoFuncSetHours): (JSC::dateProtoFuncSetUTCHours): (JSC::dateProtoFuncSetDate): (JSC::dateProtoFuncSetUTCDate): (JSC::dateProtoFuncSetMonth): (JSC::dateProtoFuncSetUTCMonth): (JSC::dateProtoFuncSetFullYear): (JSC::dateProtoFuncSetUTCFullYear): (JSC::dateProtoFuncSetYear): * runtime/JSDateMath.cpp: (JSC::localTimeOffset): (JSC::gregorianDateTimeToMS): (JSC::msToGregorianDateTime): (JSC::parseDateFromNullTerminatedCharacters): * runtime/JSDateMath.h: * runtime/VM.h: (JSC::LocalTimeOffsetCache::LocalTimeOffsetCache): (JSC::LocalTimeOffsetCache::reset): Passing TimeType argument to distingush UTC time and local time. 2014-10-22 Joseph Pecoraro Web Inspector: Fix generator importing of protocol type "any", treat as value https://bugs.webkit.org/show_bug.cgi?id=137931 Reviewed by Timothy Hatcher. Treat incoming "any" objects as InspectorValues, which can be any type. Add the necessary boilerplate to import. * inspector/InspectorBackendDispatcher.cpp: (Inspector::AsMethodBridges::asValue): (Inspector::InspectorBackendDispatcher::getValue): * inspector/InspectorBackendDispatcher.h: * inspector/scripts/codegen/generator.py: (Generator.keyed_get_method_for_type): * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: 2014-10-22 Michael Saboff REGRESSION(r174996): Broke C_LOOP https://bugs.webkit.org/show_bug.cgi?id=137971 Reviewed by Mark Lam. Removed incorrect move to cfr (CallFrameRegister) before we make the call to a native function. After r174996, the source register for the move contained garbage causing the crash. The move to cfr before making the call to the native function is wrong and should have been removed some time ago. This brings the ARM64 / C_LOOP code path inline with the other CPU paths. Tested on ARM64 as well as a C_LOOP build. * llint/LowLevelInterpreter64.asm: 2014-10-21 Mark Lam Remove erroneous canUseJIT() in the intrinsics version of JITThunks::hostFunctionStub(). Reviewed by Michael Saboff. This version of JITThunks::hostFunctionStub() can only be called from the intrinsics version of VM::getHostFunction() which asserts canUseJIT(). Hence, we can eliminate the canUseJIT() check in JITThunks::hostFunctionStub(). We don't handle the !canUseJIT() case properly there anyway. * jit/JITThunks.cpp: (JSC::JITThunks::hostFunctionStub): 2014-10-21 Michael Saboff Add operator==(PropertyName, const char*) https://bugs.webkit.org/show_bug.cgi?id=137925 Reviewed by Mark Lam. * runtime/PropertyName.h: (JSC::operator==): Added to simplify comparison with string literals. 2014-10-21 Michael Saboff Change native call frames to use the scope from their Callee instead of their caller's scope https://bugs.webkit.org/show_bug.cgi?id=137907 Reviewed by Mark Lam. Changed setting of scope for native CallFrames to use the scope associated with the Callee instead of the caller's scope. * jit/ThunkGenerators.cpp: (JSC::nativeForGenerator): * llint/LowLevelInterpreter32_64.asm: * llint/LowLevelInterpreter64.asm: 2014-10-21 Tibor Meszaros Add missing ENABLE(FTL_NATIVE_CALL_INLINING) guard to BundlePath.cpp after r174940 https://bugs.webkit.org/show_bug.cgi?id=137924 Reviewed by Csaba Osztrogonác. * runtime/BundlePath.cpp: 2014-10-21 Dániel Bátyai Fix FTL Native Inlining for EFL https://bugs.webkit.org/show_bug.cgi?id=137774 Reviewed by Michael Saboff. Added required functionality for Native Inlining to EFL, and fixed a bug/typo in the original code, which caused incorrect memory allocation. * CMakeLists.txt: * create-llvm-ir-from-source-file.py: Added. * create-symbol-table-index.py: Added. * ftl/FTLLowerDFGToLLVM.cpp: (JSC::FTL::LowerDFGToLLVM::lower): (JSC::FTL::LowerDFGToLLVM::getModuleByPathForSymbol): (JSC::FTL::LowerDFGToLLVM::exitValueForAvailability): (JSC::FTL::LowerDFGToLLVM::exitValueForNode): * runtime/BundlePath.cpp: Added. (JSC::bundlePath): * runtime/JSDataViewPrototype.cpp: (JSC::getData): (JSC::setData): * runtime/MathObject.cpp: 2014-10-21 Milan Crha Move JSC::MacroAssemblerX86Common::s_sse2CheckState definition to MacroAssemblerX86Common.cpp. Reviewed by Csaba Osztrogonác. * assembler/MacroAssemblerX86Common.cpp: * jit/JIT.cpp: 2014-10-20 Joseph Pecoraro Unreviewed add back copyright line that was accidentally removed. * inspector/scripts/codegen/generator_templates.py: (GeneratorTemplates): 2014-10-20 Joseph Pecoraro Web Inspector: InspectorBackendCommands should include when to activate particular domains https://bugs.webkit.org/show_bug.cgi?id=137753 Reviewed by Timothy Hatcher. Add an availability property to domains that only activate for particular debuggable types. If missing, the domain is always activated. Otherwise it must be a debuggable type string. When a frontend is opened for that debuggable type, the domain will be activated. * inspector/scripts/codegen/models.py: (Protocol.parse_domain): (Domain.__init__): (Domains): Parse and validate the Domain's "availability" property. * inspector/scripts/codegen/generate_backend_commands.py: (BackendCommandsGenerator.generate_domain): Emit InspectorBackend.activateDomain with debuggable type filter. * inspector/protocol/ApplicationCache.json: * inspector/protocol/CSS.json: * inspector/protocol/DOM.json: * inspector/protocol/DOMDebugger.json: * inspector/protocol/DOMStorage.json: * inspector/protocol/Database.json: * inspector/protocol/IndexedDB.json: * inspector/protocol/LayerTree.json: * inspector/protocol/Network.json: * inspector/protocol/Page.json: * inspector/protocol/Replay.json: * inspector/protocol/Timeline.json: * inspector/protocol/Worker.json: These domains only activate for Web debuggables. * inspector/scripts/tests/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result: * inspector/scripts/tests/expected/events-with-optional-parameters.json-result: * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result: Update existing tests that now have activate output. * inspector/scripts/tests/expected/fail-on-domain-availability.json-error: Added. * inspector/scripts/tests/fail-on-domain-availability.json: Added. Add a test for "availability" validation. 2014-10-20 Joseph Pecoraro [Win] Build fix for generated inspector files. Rubberstamped by Brent Fulgham. * inspector/scripts/codegen/generate_backend_dispatcher_header.py: (BackendDispatcherHeaderGenerator._generate_async_handler_declaration_for_command): * inspector/scripts/codegen/generator_templates.py: (GeneratorTemplates): 2014-10-20 Brent Fulgham [Win] Unreviewed build fix. We need to (1) pass the 'windows' argument to our script for checking feature definitions, and (2) we must use Cwd::realpath on our path input arguments to avoid Cygwin and Windows getting confused about path separators versus escape characters. * JavaScriptCore.vcxproj/build-generated-files.pl: 2014-10-20 Mark Lam [Follow up] Web Process crash when starting the web inspector after r174025. Reviewed by Geoffrey Garen. Applied Geoff's feedback to clean up some code for better clarity after r174856. * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::insertCheck): * dfg/DFGInsertionSet.h: (JSC::DFG::InsertionSet::insertOutOfOrder): 2014-10-20 Mark Lam Factor out JITCode::typeName() for debugging use. Reviewed by Geoffrey Garen. JITCode's printInternal() currently decodes the JITType into a string and prints it. This change factors out the part that decodes the JITType into JITCode::typeName() so that we can call it from lldb while debugging to quickly decode a JITType value. * jit/JITCode.cpp: (JSC::JITCode::typeName): (WTF::printInternal): * jit/JITCode.h: 2014-10-20 Joseph Pecoraro Unreviewed Windows Build Fix #2 after r174892. * JavaScriptCore.vcxproj/build-generated-files.pl: Define FEATURE_DEFINES for JavaScriptCore's DerivedSources.make. This uses the same technique as WebCore. 2014-10-20 Mark Lam Fix placement of a few items in vcxproj ItemGroups. Reviewed by Geoffrey Garen. https://webkit.org/b/137873 is likely a cut-and-paste error that manifested because we had ClCompile and ClInclude entries mixed up in the wrong ItemGroups. We should fix these so that ClCompile entries are in the ClCompile ItemGroup, and ClInclude entries in the ClInclude ItemGroup. This will help reduce the chance of future cut-and-paste errors of this nature. * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: 2014-10-20 Joseph Pecoraro Unreviewed Windows Build Fix after r174892. * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: Update file name to the new generated file name. 2014-10-20 Joseph Pecoraro Web Inspector: Rename generated Inspector.json to CombinedDomains.json to prevent name collisions https://bugs.webkit.org/show_bug.cgi?id=137825 Reviewed by Timothy Hatcher. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.vcxproj/copy-files.cmd: * JavaScriptCore.xcodeproj/project.pbxproj: * inspector/protocol/Inspector.json: Renamed from Source/JavaScriptCore/inspector/protocol/InspectorDomain.json. 2014-10-20 Joseph Pecoraro Web Inspector: Generate all Inspector domains together in JavaScriptCore https://bugs.webkit.org/show_bug.cgi?id=137748 Reviewed by Brian Burg. * inspector/protocol/ApplicationCache.json: Renamed from Source/WebCore/inspector/protocol/ApplicationCache.json. * inspector/protocol/CSS.json: Renamed from Source/WebCore/inspector/protocol/CSS.json. * inspector/protocol/DOM.json: Renamed from Source/WebCore/inspector/protocol/DOM.json. * inspector/protocol/DOMDebugger.json: Renamed from Source/WebCore/inspector/protocol/DOMDebugger.json. * inspector/protocol/DOMStorage.json: Renamed from Source/WebCore/inspector/protocol/DOMStorage.json. * inspector/protocol/Database.json: Renamed from Source/WebCore/inspector/protocol/Database.json. * inspector/protocol/IndexedDB.json: Renamed from Source/WebCore/inspector/protocol/IndexedDB.json. * inspector/protocol/LayerTree.json: Renamed from Source/WebCore/inspector/protocol/LayerTree.json. * inspector/protocol/Network.json: Renamed from Source/WebCore/inspector/protocol/Network.json. * inspector/protocol/Page.json: Renamed from Source/WebCore/inspector/protocol/Page.json. * inspector/protocol/Replay.json: Renamed from Source/WebCore/inspector/protocol/Replay.json. * inspector/protocol/Timeline.json: Renamed from Source/WebCore/inspector/protocol/Timeline.json. * inspector/protocol/Worker.json: Renamed from Source/WebCore/inspector/protocol/Worker.json. Move all protocol files into this directory. * inspector/InspectorProtocolTypesBase.h: Renamed from Source/JavaScriptCore/inspector/InspectorProtocolTypes.h. Renamed the base types file to not clash with the generated types file. * CMakeLists.txt: * DerivedSources.make: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: * JavaScriptCore.vcxproj/copy-files.cmd: * JavaScriptCore.xcodeproj/project.pbxproj: Update build phases for new JSON files and new filenames. * inspector/scripts/tests/expected/commands-with-async-attribute.json-result: * inspector/scripts/tests/expected/commands-with-optional-call-return-parameters.json-result: * inspector/scripts/tests/expected/domains-with-varying-command-sizes.json-result: * inspector/scripts/tests/expected/events-with-optional-parameters.json-result: * inspector/scripts/tests/expected/generate-domains-with-feature-guards.json-result: * inspector/scripts/tests/expected/same-type-id-different-domain.json-result: * inspector/scripts/tests/expected/shadowed-optional-type-setters.json-result: * inspector/scripts/tests/expected/type-declaration-aliased-primitive-type.json-result: * inspector/scripts/tests/expected/type-declaration-array-type.json-result: * inspector/scripts/tests/expected/type-declaration-enum-type.json-result: * inspector/scripts/tests/expected/type-declaration-object-type.json-result: * inspector/scripts/tests/expected/type-requiring-runtime-casts.json-result: Updated names of things now that prefixes are no longer needed. * inspector/ConsoleMessage.h: * inspector/ContentSearchUtilities.cpp: * inspector/ContentSearchUtilities.h: * inspector/InjectedScript.h: * inspector/InjectedScriptBase.h: * inspector/ScriptCallFrame.h: * inspector/ScriptCallStack.h: * inspector/agents/InspectorAgent.h: * inspector/agents/InspectorConsoleAgent.h: * inspector/agents/InspectorDebuggerAgent.cpp: (Inspector::breakpointActionTypeForString): * inspector/agents/InspectorDebuggerAgent.h: * inspector/agents/InspectorRuntimeAgent.h: * runtime/TypeProfiler.cpp: * runtime/TypeSet.cpp: Update includes and update a few function names that are generated. * inspector/scripts/codegen/generate_protocol_types_header.py: (ProtocolTypesHeaderGenerator.output_filename): (ProtocolTypesHeaderGenerator.generate_output): Include an export macro for type string constants defined in the implementation file. * inspector/scripts/codegen/generate_backend_commands.py: (BackendCommandsGenerator.output_filename): * inspector/scripts/codegen/generate_backend_dispatcher_header.py: (BackendDispatcherHeaderGenerator.output_filename): (BackendDispatcherHeaderGenerator.generate_output): * inspector/scripts/codegen/generate_backend_dispatcher_implementation.py: (BackendDispatcherImplementationGenerator.output_filename): (BackendDispatcherImplementationGenerator.generate_output): (BackendDispatcherImplementationGenerator._generate_async_dispatcher_class_for_domain): (BackendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_command): * inspector/scripts/codegen/generate_frontend_dispatcher_header.py: (FrontendDispatcherHeaderGenerator.output_filename): (FrontendDispatcherHeaderGenerator.generate_output): * inspector/scripts/codegen/generate_frontend_dispatcher_implementation.py: (FrontendDispatcherImplementationGenerator.output_filename): (FrontendDispatcherImplementationGenerator.generate_output): (FrontendDispatcherImplementationGenerator._generate_dispatcher_implementation_for_event): (_generate_class_for_object_declaration): (_generate_builder_setter_for_member): (_generate_unchecked_setter_for_member): * inspector/scripts/codegen/generate_protocol_types_implementation.py: (ProtocolTypesImplementationGenerator.output_filename): (ProtocolTypesImplementationGenerator.generate_output): (ProtocolTypesImplementationGenerator._generate_enum_mapping): * inspector/scripts/codegen/models.py: (Framework.fromString): (Frameworks): * inspector/scripts/generate-inspector-protocol-bindings.py: Simplify generator now that prefixes are no longer needed. This updates filenames, includes, and the list of supported directories. 2014-10-20 Csaba Osztrogonác Remove obsolete comments after r99798 https://bugs.webkit.org/show_bug.cgi?id=137871 Reviewed by Darin Adler. r99798 removed the comment in MacroAssemblerARMv7::supportsFloatingPointTruncate(), so we should remove the stale references to this removed comment. * assembler/MacroAssemblerX86.h: * assembler/MacroAssemblerX86_64.h: 2014-10-20 Csaba Osztrogonác MacroAssemblerX86Common.cpp should be built on Windows too https://bugs.webkit.org/show_bug.cgi?id=137873 Reviewed by Brent Fulgham. * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: 2014-10-20 Csaba Osztrogonác [cmake] Remove duplicated source files https://bugs.webkit.org/show_bug.cgi?id=137875 Reviewed by Gyuyoung Kim. * CMakeLists.txt: 2014-10-18 Brian J. Burg Web Replay: code generator shouldn't complain about enums without a storage type if they are in an enclosing scope https://bugs.webkit.org/show_bug.cgi?id=137084 Reviewed by Joseph Pecoraro. In order to generate encode/decode method declarations without pulling in lots of headers, the generator must forward declare enums (for enum classes or enums with explicit sizes). Change the generator to not require an explicit size if an enum is declared inside a struct or class definition. In that case, it must pull in headers since scoped enums can't be forward declared. This patch also fixes some chained if-statements that should be if-else statements. Test: updated replay/scripts/tests/generate-enum-encoding-helpers.json to cover the new case. * replay/scripts/CodeGeneratorReplayInputs.py: (InputsModel.parse_type_with_framework_name.is): (InputsModel.parse_type_with_framework_name.is.must): (Generator.generate_enum_trait_implementation): (InputsModel.parse_type_with_framework_name): Deleted. * replay/scripts/CodeGeneratorReplayInputsTemplates.py: * replay/scripts/tests/expected/fail-on-c-style-enum-no-storage.json-error: * replay/scripts/tests/expected/generate-enum-encoding-helpers-with-guarded-values.json-TestReplayInputs.cpp: (JSC::EncodingTraits::decodeValue): * replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.cpp: (JSC::EncodingTraits::decodeValue): (JSC::EncodingTraits::encodeValue): (JSC::EncodingTraits::decodeValue): * replay/scripts/tests/expected/generate-enum-encoding-helpers.json-TestReplayInputs.h: * replay/scripts/tests/expected/generate-enums-with-same-base-name.json-TestReplayInputs.cpp: (JSC::EncodingTraits::decodeValue): (JSC::EncodingTraits::decodeValue): * replay/scripts/tests/generate-enum-encoding-helpers.json: Added a new input to cover this case. 2014-10-17 Mark Lam Web Process crash when starting the web inspector after r174025. Reviewed by Filip Pizlo. After r174025, we can generate a bad graph in the DFG fixup phase like so: 102: StoreBarrier(Check:KnownCell:@19, ..., bc#44) 60: PutStructure(Check:KnownCell:@19, ..., bc#44) 103: Check(Check:NotCell:@54, ..., bc#44) // ^-- PutByOffset's StoreBarrier has been elided and replaced // with a speculation check which can OSR exit. 61: PutByOffset(Check:KnownCell:@19, ..., bc#44) As a result, the structure change will get executed even if we end up OSR exiting before the PutByOffset. In the baseline JIT code, the structure now erroneously tells the put operation that there is a value in that property slot when it is actually uninitialized (hence, the crash). The fix is to insert the Check at the earliest point possible: 1. If the checked node is in the same bytecode as the PutByOffset, then the earliest point where we can insert the Check is right after the checked node. 2. If the checked node is from a preceding bytecode (before the PutByOffset), then the earliest point where we can insert the Check is at the start of the current bytecode. Also reverted the workaround from r174749: https://webkit.org/b/137758. Benchmark results appear to be a wash on aggregate. * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::indexOfNode): (JSC::DFG::FixupPhase::indexOfFirstNodeOfExitOrigin): (JSC::DFG::FixupPhase::fixupNode): (JSC::DFG::FixupPhase::insertCheck): * dfg/DFGInsertionSet.h: (JSC::DFG::InsertionSet::insertOutOfOrder): (JSC::DFG::InsertionSet::insertOutOfOrderNode): 2014-10-10 Oliver Hunt Various arguments optimisations in codegen fail to account for arguments being in lexical record https://bugs.webkit.org/show_bug.cgi?id=137617 Reviewed by Michael Saboff. Rework the way we track |arguments| references so that we don't try to use the |arguments| reference on the stack if it's not safe. To do this without nuking performance it was necessary to update the parser to track modification of the |arguments| reference itself. * bytecode/CodeBlock.cpp: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::willResolveToArguments): (JSC::BytecodeGenerator::uncheckedLocalArgumentsRegister): (JSC::BytecodeGenerator::emitCall): (JSC::BytecodeGenerator::emitConstruct): (JSC::BytecodeGenerator::emitEnumeration): (JSC::BytecodeGenerator::uncheckedRegisterForArguments): Deleted. * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::hasSafeLocalArgumentsRegister): * bytecompiler/NodesCodegen.cpp: (JSC::BracketAccessorNode::emitBytecode): (JSC::DotAccessorNode::emitBytecode): (JSC::getArgumentByVal): (JSC::CallFunctionCallDotNode::emitBytecode): (JSC::ApplyFunctionCallDotNode::emitBytecode): (JSC::ArrayPatternNode::emitDirectBinding): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::existingArguments): * parser/Nodes.h: (JSC::ScopeNode::modifiesArguments): * parser/Parser.cpp: (JSC::Parser::parseInner): * parser/Parser.h: (JSC::Scope::getCapturedVariables): * parser/ParserModes.h: 2014-10-17 Gyuyoung Kim Use WTF::move() instead of std::move() to help ensure move semantics in JavaScriptCore https://bugs.webkit.org/show_bug.cgi?id=137809 Reviewed by Csaba Osztrogonác. Substitution of WTF::move() for std::move(). Clean up std::move() in JavaScriptCore. * bytecode/GetByIdStatus.cpp: (JSC::GetByIdStatus::computeForStubInfo): * bytecode/PutByIdStatus.cpp: (JSC::PutByIdStatus::computeForStubInfo): * bytecode/PutByIdVariant.cpp: (JSC::PutByIdVariant::setter): 2014-10-15 Oliver Hunt Use a single allocation for the Arguments object https://bugs.webkit.org/show_bug.cgi?id=137751 Reviewed by Filip Pizlo. This patch removes the secondary allocation for parameters in the Arguments object. This is faily simple, but we needed to make it possible for the JIT to allocate a variable GC object. To do this i've added a new emitAllocateVariableSizedJSObject function to the JIT that does the work to find the correct heap for a variable sized allocation and then bump that allocator. * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::emitAllocateArguments): * dfg/DFGSpeculativeJIT.h: (JSC::DFG::SpeculativeJIT::emitAllocateVariableSizedJSObject): * heap/CopyToken.h: * heap/Heap.h: (JSC::Heap::subspaceForObjectWithoutDestructor): (JSC::Heap::subspaceForObjectNormalDestructor): (JSC::Heap::subspaceForObjectsWithImmortalStructure): * heap/MarkedSpace.h: (JSC::MarkedSpace::subspaceForObjectsWithNormalDestructor): (JSC::MarkedSpace::subspaceForObjectsWithImmortalStructure): (JSC::MarkedSpace::subspaceForObjectsWithoutDestructor): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::createArguments): * runtime/Arguments.cpp: (JSC::Arguments::visitChildren): (JSC::Arguments::copyBackingStore): (JSC::Arguments::tearOff): (JSC::Arguments::allocateRegisterArray): Deleted. * runtime/Arguments.h: (JSC::Arguments::create): (JSC::Arguments::isTornOff): (JSC::Arguments::offsetOfRegisterArray): (JSC::Arguments::registerArraySizeInBytes): (JSC::Arguments::registerArray): (JSC::Arguments::allocationSize): Deleted. 2014-10-15 Filip Pizlo Apparently we've had a hole in arguments capture all along https://bugs.webkit.org/show_bug.cgi?id=137767 Reviewed by Oliver Hunt. * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::getArgument): * tests/stress/arguments-captured.js: Added. (foo): (bar): 2014-10-16 Saam Barati Have the ProfileType node in the DFG convert to a structure check where it can https://bugs.webkit.org/show_bug.cgi?id=137596 Reviewed by Filip Pizlo. TypeSet now keeps track of the live set of Structures it has seen. It no longer nukes everything during GC. It now only removes unmarked structures during GC. This modification allows the ProfileType node to convert into a CheckStructure node safely in the DFG. This change brings up the conversion rate from ProfileType to Check or CheckStructrue from ~45% to ~65%. This change also speeds the type profiler up significantly: consistently between 2x-20x faster. This patch also does some slight refactoring: a few type profiler related fields are moved from VM to TypeProfiler. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::CodeBlock): * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): * dfg/DFGNode.h: (JSC::DFG::Node::convertToCheckStructure): * heap/Heap.cpp: (JSC::Heap::collect): * runtime/SymbolTable.cpp: (JSC::SymbolTable::uniqueIDForVariable): * runtime/SymbolTable.h: * runtime/TypeLocationCache.cpp: (JSC::TypeLocationCache::getTypeLocation): * runtime/TypeProfiler.cpp: (JSC::TypeProfiler::TypeProfiler): (JSC::TypeProfiler::nextTypeLocation): (JSC::TypeProfiler::invalidateTypeSetCache): (JSC::TypeProfiler::dumpTypeProfilerData): * runtime/TypeProfiler.h: (JSC::TypeProfiler::getNextUniqueVariableID): * runtime/TypeProfilerLog.cpp: (JSC::TypeProfilerLog::processLogEntries): * runtime/TypeSet.cpp: (JSC::TypeSet::addTypeInformation): (JSC::TypeSet::invalidateCache): * runtime/TypeSet.h: (JSC::TypeSet::structureSet): * runtime/VM.cpp: (JSC::VM::VM): (JSC::VM::enableTypeProfiler): (JSC::VM::disableTypeProfiler): (JSC::VM::dumpTypeProfilerData): (JSC::VM::nextTypeLocation): Deleted. (JSC::VM::invalidateTypeSetCache): Deleted. * runtime/VM.h: (JSC::VM::typeProfiler): (JSC::VM::getNextUniqueVariableID): Deleted. * tests/typeProfiler/dfg-jit-optimizations.js: 2014-10-16 Adrien Destugues Use isnan from std namespace in ProfileGenerator.cpp https://bugs.webkit.org/show_bug.cgi?id=137653 Reviewed by Darin Adler. The C++ isnan() function is in the std namespace. The unprefixed isnan may be available because of C99 headers leakage in C++, but should not be used. No new tests: no functional change, build fix on platforms which don't export C99 functions in C++. * profiler/ProfileGenerator.cpp: (JSC::ProfileGenerator::beginCallEntry): (JSC::ProfileGenerator::endCallEntry): (JSC::ProfileGenerator::didPause): (JSC::ProfileGenerator::didContinue): 2014-10-15 Michael Saboff REGRESSION(r174025): remote inspector crashes frequently when executing inspector frontend's JavaScript https://bugs.webkit.org/show_bug.cgi?id=137758 Rubber stamped by Filip Pizlo. Reverted r174025 for just PutByOffset Nodes. * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): 2014-10-14 Gyuyoung Kim Clean up unnecessary PassOwnPtr.h inclusion https://bugs.webkit.org/show_bug.cgi?id=137726 Reviewed by Chris Dumez. * API/JSCallbackObject.h: Remove PassOwnPtr.h inclusion. * bytecode/DFGExitProfile.cpp: ditto. 2014-10-14 Brent Fulgham [Win] Unreviewed gardening. Ignore Visual Studio *.sdf files. * JavaScriptCore.vcxproj: Modified properties svn:ignore and svn:ignore. * JavaScriptCore.vcxproj/jsc: Modified property svn:ignore. 2014-10-14 Matthew Mirman Removes references to LLVMJIT which is no longer part of LLVM https://bugs.webkit.org/show_bug.cgi?id=137708 Reviewed by Filip Pizlo. * Configurations/LLVMForJSC.xcconfig: removed -lLLVMJIT * llvm/LLVMAPIFunctions.h: removed LinkInJIT 2014-10-14 peavo@outlook.com [Win32] Thunk is not implemented. https://bugs.webkit.org/show_bug.cgi?id=137691 Reviewed by Mark Lam. Thunks for functions with double operands (floor, etc.) are not implemented on Win32. * jit/ThunkGenerators.cpp: 2014-10-12 Alexey Proskuryakov Adding svn:ignore so that .pyc files don't show up as new. * inspector/scripts/codegen: Added property svn:ignore. 2014-10-10 Commit Queue Unreviewed, rolling out r174606. https://bugs.webkit.org/show_bug.cgi?id=137621 broke a JSC test (Requested by estes on #webkit). Reverted changeset: "Various arguments optimisations in codegen fail to account for arguments being in lexical record" https://bugs.webkit.org/show_bug.cgi?id=137617 http://trac.webkit.org/changeset/174606 2014-10-10 Oliver Hunt Various arguments optimisations in codegen fail to account for arguments being in lexical record https://bugs.webkit.org/show_bug.cgi?id=137617 Reviewed by Michael Saboff. Rework the way we track |arguments| references so that we don't try to use the |arguments| reference on the stack if it's not safe. To do this without nuking performance it was necessary to update the parser to track modification of the |arguments| reference itself. * bytecode/CodeBlock.cpp: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::willResolveToArguments): (JSC::BytecodeGenerator::uncheckedLocalArgumentsRegister): (JSC::BytecodeGenerator::emitCall): (JSC::BytecodeGenerator::emitConstruct): (JSC::BytecodeGenerator::emitEnumeration): (JSC::BytecodeGenerator::uncheckedRegisterForArguments): Deleted. * bytecompiler/BytecodeGenerator.h: (JSC::BytecodeGenerator::hasSafeLocalArgumentsRegister): * bytecompiler/NodesCodegen.cpp: (JSC::BracketAccessorNode::emitBytecode): (JSC::DotAccessorNode::emitBytecode): (JSC::getArgumentByVal): (JSC::CallFunctionCallDotNode::emitBytecode): (JSC::ApplyFunctionCallDotNode::emitBytecode): (JSC::ArrayPatternNode::emitDirectBinding): * interpreter/StackVisitor.cpp: (JSC::StackVisitor::Frame::existingArguments): * parser/Nodes.h: (JSC::ScopeNode::modifiesArguments): * parser/Parser.cpp: (JSC::Parser::parseInner): * parser/Parser.h: (JSC::Scope::getCapturedVariables): * parser/ParserModes.h: 2014-10-09 Joseph Pecoraro Web Inspector: Remove unused generator code https://bugs.webkit.org/show_bug.cgi?id=137564 Reviewed by Brian Burg. * inspector/scripts/codegen/generate_backend_dispatcher_header.py: (BackendDispatcherHeaderGenerator.generate_output): Deleted. * inspector/scripts/codegen/generate_backend_dispatcher_implementation.py: (BackendDispatcherImplementationGenerator.generate_output): * inspector/scripts/codegen/generate_frontend_dispatcher_header.py: (FrontendDispatcherHeaderGenerator.generate_output): * inspector/scripts/codegen/generate_frontend_dispatcher_implementation.py: (FrontendDispatcherImplementationGenerator.generate_output): * inspector/scripts/codegen/generate_protocol_types_header.py: (ProtocolTypesHeaderGenerator.generate_output): * inspector/scripts/codegen/generate_protocol_types_implementation.py: (ProtocolTypesImplementationGenerator.generate_output): inputFilename is now handled by the generic generator base class. * inspector/scripts/codegen/models.py: (Framework.fromString): (Frameworks): * inspector/scripts/generate-inspector-protocol-bindings.py: The WTF framework is unused. Remove unexpected frameworks. 2014-10-09 Dean Jackson Remove ENABLE_CSS3_CONDITIONAL_RULES https://bugs.webkit.org/show_bug.cgi?id=137571 Reviewed by Simon Fraser. * Configurations/FeatureDefines.xcconfig: 2014-10-09 Adrien Destugues Fix compiler warning on noreturn function https://bugs.webkit.org/show_bug.cgi?id=137558 Reviewed by Darin Adler. The function is marked "noreturn", but the stub implementation does return. No new tests: function is never called. Only fixes a warning. * heap/HeapStatistics.cpp: (JSC::HeapStatistics::exitWithFailure): 2014-10-09 Akos Kiss Ensure that inline assembly Thunk functions don't conflict with the section designations of the compiler https://bugs.webkit.org/show_bug.cgi?id=137434 Reviewed by Michael Saboff. The ARM64 version of the defineUnaryDoubleOpWrapper macro in ThunkGenerators.cpp contains inline assembly with .text assembler directive followed by a static variable declaration. This macro gets expanded several times afterwards, however, only during the compilation of the first expansion does gcc insert a .data assembler directive before the assembled version of the static variable. Thus, only the first variable gets allocated in the .data section, all the others remain in .text. If JavaScriptCore is built as a shared library then this causes a segmentation fault during dynamic linking. This patch puts a .previous directive at the end of the inline assembly to ensure that the assumptions of the compiler about the sections are not broken and the following variable goes to the right place. * jit/ThunkGenerators.cpp: 2014-10-08 Oliver Hunt Make sure arguments tearoff is performed through the environment record if necessary https://bugs.webkit.org/show_bug.cgi?id=137538 Reviewed by Michael Saboff. Fairly simple change. If we have a lexical record we need to pull the unmodified arguments object from the record and then use the standard op_tear_off_arguments instruction on the temporary. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitGetOwnScope): (JSC::BytecodeGenerator::emitReturn): * bytecompiler/BytecodeGenerator.h: 2014-10-08 peavo@outlook.com [WinCairo] Enable JIT on 32-bit. https://bugs.webkit.org/show_bug.cgi?id=137521 Reviewed by Mark Lam. Enable JIT on Windows 32-bit, but disable it at runtime if SSE2 is not present. * JavaScriptCore.vcxproj/LLInt/LLIntAssembly/build-LLIntAssembly.pl: * runtime/Options.cpp: (JSC::recomputeDependentOptions): 2014-10-08 Brent Fulgham [Win] Resolve some static analysis warnings in JavaScriptCore https://bugs.webkit.org/show_bug.cgi?id=137508 Reviewed by Geoffrey Garen. * API/tests/testapi.c: (assertEqualsAsCharactersPtr): MSVC insists on using %Iu as its format specifier for size_t. Make the format string conditional on Windows. * bytecode/Watchpoint.h: (JSC::InlineWatchpointSet::encodeState): Silence warning about left-shifting 'state' as a 32-bit value before OR-ing it with a 64-bit value. * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): Silence warning about operator prescedence causing the || operation to take place before the >= test. * dfg/DFGInPlaceAbstractState.cpp: (JSC::DFG::InPlaceAbstractState::endBasicBlock): Ditto (|| before !=) * testRegExp.cpp: (testOneRegExp): Ditto %Iu format specifier. * yarr/YarrInterpreter.cpp: (JSC::Yarr::Interpreter::allocParenthesesDisjunctionContext): Silence warning about using a 32-bit value as part of a 64-bit calculation. 2014-10-07 Simon Fraser Roll-over Changelogs. * ChangeLog-2014-10-07: Copied from Source/JavaScriptCore/ChangeLog. == Rolled over to ChangeLog-2014-10-07 ==