See More

2009-06-15 Gavin Barraclough Rubber Stamped by Sam Weinig. Rename PatchBuffer to LinkBuffer. Previously our terminology has been a little mixed up, but we have decided to fix on refering to the process that takes place at the end of code generation as 'linking', and on any modifications that take place later (and once the code has potentially already been executed) as 'patching'. However, the term 'PatchBuffer' is already in use, and needs to be repurposed. To try to minimize confusion, we're going to switch the terminology over in stages, so for now we'll refer to later modifications as 'repatching'. This means that the new 'PatchBuffer' has been introduced with the name 'RepatchBuffer' instead. This patch renames the old 'PatchBuffer' to 'LinkBuffer'. We'll leave ToT in this state for a week or so to try to avoid to much overlap of the meaning of the term 'PatchBuffer', then will come back and rename 'RepatchBuffer'. * assembler/ARMv7Assembler.h: * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::LinkBuffer::LinkBuffer): (JSC::AbstractMacroAssembler::LinkBuffer::~LinkBuffer): * jit/JIT.cpp: (JSC::JIT::privateCompile): * jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): * yarr/RegexJIT.cpp: (JSC::Yarr::RegexGenerator::compile): 2009-06-15 Gavin Barraclough Reviewed by Sam Weinig. Having moved most of their functionality into the RepatchBuffer class, we can simplify the CodeLocation* classes. The CodeLocation* classes are currently a tangle of templatey and friendly badness, burried in the middle of AbstractMacroAssembler. Having moved the ability to repatch out into RepatchBufer they are now do-nothing wrappers on CodePtr (MacroAssemblerCodePtr), that only exist to provide type-safety. Simplify the code, and move them off into their own header. * JavaScriptCore.xcodeproj/project.pbxproj: * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::PatchBuffer::patch): * assembler/CodeLocation.h: Copied from assembler/AbstractMacroAssembler.h. (JSC::CodeLocationCommon::CodeLocationCommon): (JSC::CodeLocationInstruction::CodeLocationInstruction): (JSC::CodeLocationLabel::CodeLocationLabel): (JSC::CodeLocationJump::CodeLocationJump): (JSC::CodeLocationCall::CodeLocationCall): (JSC::CodeLocationNearCall::CodeLocationNearCall): (JSC::CodeLocationDataLabel32::CodeLocationDataLabel32): (JSC::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr): (JSC::CodeLocationCommon::instructionAtOffset): (JSC::CodeLocationCommon::labelAtOffset): (JSC::CodeLocationCommon::jumpAtOffset): (JSC::CodeLocationCommon::callAtOffset): (JSC::CodeLocationCommon::nearCallAtOffset): (JSC::CodeLocationCommon::dataLabelPtrAtOffset): (JSC::CodeLocationCommon::dataLabel32AtOffset): * assembler/MacroAssemblerCodeRef.h: (JSC::MacroAssemblerCodePtr::operator!): * bytecode/CodeBlock.h: (JSC::getStructureStubInfoReturnLocation): (JSC::getCallLinkInfoReturnLocation): (JSC::getMethodCallLinkInfoReturnLocation): * bytecode/Instruction.h: * bytecode/JumpTable.h: (JSC::StringJumpTable::ctiForValue): (JSC::SimpleJumpTable::ctiForValue): * bytecode/StructureStubInfo.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitCatch): * jit/JIT.cpp: (JSC::JIT::privateCompile): * jit/JITStubs.cpp: (JSC::JITStubs::DEFINE_STUB_FUNCTION): (JSC::JITStubs::getPolymorphicAccessStructureListSlot): 2009-06-15 Gavin Barraclough Reviewed by Sam Weinig. Having introduced the RepatchBuffer, ProcessorReturnAddress is now a do-nothing wrapper around ReturnAddressPtr. Remove it. In tugging on this piece of string it made sense to roll out the use of ReturnAddressPtr a little further into JITStubs (which had always been the intention). No performance impact. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToTrampoline): (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToFunction): (JSC::AbstractMacroAssembler::RepatchBuffer::relinkNearCallerToTrampoline): * assembler/MacroAssemblerCodeRef.h: (JSC::ReturnAddressPtr::ReturnAddressPtr): * bytecode/CodeBlock.h: (JSC::CodeBlock::getStubInfo): (JSC::CodeBlock::getCallLinkInfo): (JSC::CodeBlock::getMethodCallLinkInfo): (JSC::CodeBlock::getBytecodeIndex): * interpreter/Interpreter.cpp: (JSC::bytecodeOffsetForPC): * jit/JIT.cpp: (JSC::ctiPatchNearCallByReturnAddress): (JSC::ctiPatchCallByReturnAddress): * jit/JIT.h: (JSC::JIT::compileGetByIdProto): (JSC::JIT::compileGetByIdChain): (JSC::JIT::compilePutByIdTransition): (JSC::JIT::compilePatchGetArrayLength): * jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchPutByIdReplace): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdChain): * jit/JITStubs.cpp: (JSC::JITThunks::tryCachePutByID): (JSC::JITThunks::tryCacheGetByID): (JSC::StackHack::StackHack): (JSC::returnToThrowTrampoline): (JSC::throwStackOverflowError): (JSC::JITStubs::DEFINE_STUB_FUNCTION): * jit/JITStubs.h: (JSC::): (JSC::JITStackFrame::returnAddressSlot): * runtime/JSGlobalData.h: 2009-06-15 Simon Fraser Reviewed by Mark Rowe. Define ENABLE_3D_RENDERING when building on 10.6, and move ENABLE_3D_RENDERING switch from config.h to wtf/Platform.h. * Configurations/FeatureDefines.xcconfig: * wtf/Platform.h: 2009-06-15 Gavin Barraclough Reviewed by Oliver Hunt. Move repatching methods into a set of methods on a class. This will allow us to coallesce memory reprotection calls. Really, we want this class to be called PatchBuffer, we want the class PatchBuffer to be called LinkBuffer, we want both to be memblers of MacroAssembler rather then AbstractMacroAssembler, we don't want the CodeLocationFoo types anymore (they are now only really there to provide type safety, and that is completely undermined by the way we use offsets). Then the link & patch buffers should delegate the actual patching calls to the architecture-specific layer of the MacroAssembler. Landing all these changes as a sequence of patches. No performance impact. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall): (JSC::AbstractMacroAssembler::CodeLocationNearCall::CodeLocationNearCall): (JSC::AbstractMacroAssembler::CodeLocationNearCall::calleeReturnAddressValue): (JSC::AbstractMacroAssembler::RepatchBuffer::RepatchBuffer): (JSC::AbstractMacroAssembler::RepatchBuffer::relink): (JSC::AbstractMacroAssembler::RepatchBuffer::repatch): (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToTrampoline): (JSC::AbstractMacroAssembler::RepatchBuffer::relinkCallerToFunction): (JSC::AbstractMacroAssembler::RepatchBuffer::relinkNearCallerToTrampoline): (JSC::AbstractMacroAssembler::RepatchBuffer::repatchLoadPtrToLEA): * jit/JIT.cpp: (JSC::ctiPatchNearCallByReturnAddress): (JSC::ctiPatchCallByReturnAddress): (JSC::JIT::unlinkCall): (JSC::JIT::linkCall): * jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchMethodCallProto): (JSC::JIT::patchPutByIdReplace): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): 2009-06-15 Gavin Barraclough Reviewed by Geoff Hunt & Oliver Garen. We are currently generating two copies of the slow path for op_call for no reason. Stop that. Originally op_call used two slow paths since the first set up the pointer to the CallLinkInfo for use when linking. However this is now looked up using the return address (as we do for property accesses) so the two paths are now identical. No performance impact, reduces memory footprint. * bytecode/CodeBlock.h: * jit/JIT.cpp: (JSC::JIT::privateCompile): (JSC::JIT::linkCall): * jit/JIT.h: * jit/JITCall.cpp: (JSC::JIT::compileOpCallSlowCase): * jit/JITStubs.cpp: (JSC::JITStubs::DEFINE_STUB_FUNCTION): 2009-06-12 Dave Hyatt Reviewed by Anders Carlsson. https://bugs.webkit.org/show_bug.cgi?id=26373 Add a new class to Threading in wtf called ReadWriteLock that handles single writer/multiple reader locking. Provide a pthreads-only implementation of the lock for now, as this class is only going to be used on Snow Leopard at first. * wtf/Threading.h: (WTF::ReadWriteLock::impl): * wtf/ThreadingPthreads.cpp: (WTF::ReadWriteLock::ReadWriteLock): (WTF::ReadWriteLock::~ReadWriteLock): (WTF::ReadWriteLock::readLock): (WTF::ReadWriteLock::tryReadLock): (WTF::ReadWriteLock::writeLock): (WTF::ReadWriteLock::tryWriteLock): (WTF::ReadWriteLock::unlock): 2009-06-12 Oliver Hunt Reviewed by Geoff Garen. Make LiteralParser non-recursive Convert LiteralParser from using a simple recursive descent parser to a hand rolled PDA. Relatively simple conversion, but required modifications to MarkedArgumentBuffer to make it more suitable as a generic marked vector. I'll refactor and rename MarkedArgumentBuffer in future as there are many other cases where it will be useful to have such a class. * runtime/ArgList.h: (JSC::MarkedArgumentBuffer::MarkedArgumentBuffer): (JSC::MarkedArgumentBuffer::append): (JSC::MarkedArgumentBuffer::removeLast): (JSC::MarkedArgumentBuffer::last): * runtime/LiteralParser.cpp: (JSC::LiteralParser::parse): * runtime/LiteralParser.h: (JSC::LiteralParser::LiteralParser): (JSC::LiteralParser::tryLiteralParse): (JSC::LiteralParser::): 2009-06-12 David Levin Reviewed by NOBODY (build fix for windows). Adjust the exports for JSC on Windows like what was done for OSX in the previous commit. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: 2009-06-12 David Levin Reviewed by Darin Adler. UString shouldn't create sharedBuffer for SmallStrings. https://bugs.webkit.org/show_bug.cgi?id=26360 The methods changed are not used by JSC, so there is no JS perf impact. However, there is a potential DOM perf impact, so I re-ran several of the tests that I ran previously and ensured that the perf stay the same which caused me to adjust the minLengthToShare. * JavaScriptCore.exp: * runtime/UString.cpp: (JSC::UString::Rep::sharedBuffer): Determines if the buffer being shared is big enough before doing so. Previously, BaseString::sharedBuffer was called but it would only know the length of the base string (BaseString::len) which may not be the same as the string being shared (Rep::len). (JSC::UString::BaseString::sharedBuffer): This is now only be used by Rep::sharedBuffer. which does the length check. * runtime/UString.h: 2009-06-12 Dimitri Glazkov Reviewed by Eric Seidel. https://bugs.webkit.org/show_bug.cgi?id=26191 Remove xmath include in MathExtras.h, because it is not needed and also breaks VS2008 builds with TR1 turned on. * wtf/MathExtras.h: Removed xmath include. 2009-06-12 Peter Kasting Reviewed by Eric Seidel. * ChangeLog-2007-10-14: Change pseudonym "Don Gibson" to me (was used while Google Chrome was not public); update my email address. 2009-06-12 Kevin Ollivier wx build fix. Adding JSONObject.cpp to the build. * JavaScriptCoreSources.bkl: 2009-06-12 Laszlo Gombos Reviewed by Jan Michael Alonzo. [Qt] Fix build break https://bugs.webkit.org/show_bug.cgi?id=26340 * JavaScriptCore.pri: Add JSONObject.cpp to LUT files. 2009-06-11 Oliver Hunt Reviewed by NOBODY (build fix). Lower stringify recursion limit to deal with small windows stack. * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/JSONObject.cpp: (JSC::Stringifier::): 2009-06-11 Laszlo Gombos Reviewed by Holger Freyther. Fix compilation warnings * wtf/ThreadingNone.cpp: (WTF::ThreadCondition::wait): Fix compilation warning. (WTF::ThreadCondition::timedWait): Ditto. 2009-06-10 Brent Fulgham Build fix for Windows target. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Correct missing tag after @r44550 that prevents the project from being loaded in the Visual Studio IDE. 2009-06-09 Gavin Barraclough Rubber Stamped by Mark Rowe. Tidy up a couple of comments. * assembler/ARMv7Assembler.h: Fix date in copyright, neaten up a couple of comments. * assembler/MacroAssemblerARMv7.h: Fix date in copyright. 2009-06-07 Oliver Hunt Reviewed by Sam Weinig. Bug 26249: Support JSON.stringify Implement JSON.stringify. This patch handles all the semantics of the ES5 JSON.stringify function, including replacer functions and arrays and both string and numeric gap arguments. Currently uses a clamped recursive algorithm basically identical to the spec description but with a few minor tweaks for performance and corrected semantics discussed in the es-discuss mailing list. * DerivedSources.make: * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * interpreter/CallFrame.h: (JSC::ExecState::jsonTable): * runtime/CommonIdentifiers.h: add toJSON to the list of common identifiers * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData): (JSC::JSGlobalData::~JSGlobalData): * runtime/JSGlobalData.h: * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::reset): Add support for the JSON object lookup table * runtime/JSONObject.cpp: Added. (JSC::): (JSC::JSONObject::getOwnPropertySlot): (JSC::Stringifier::): (JSC::Stringifier::Stringifier): (JSC::Stringifier::stringify): (JSC::Stringifier::appendString): (JSC::Stringifier::StringKeyGenerator::StringKeyGenerator): (JSC::Stringifier::StringKeyGenerator::getKey): (JSC::Stringifier::IntKeyGenerator::IntKeyGenerator): (JSC::Stringifier::IntKeyGenerator::getKey): These KeyGenerator classes are used to abstract away the lazy evaluation of keys for toJSON and replacer functions. (JSC::Stringifier::toJSONValue): (JSC::Stringifier::stringifyArray): (JSC::Stringifier::stringifyObject): (JSC::JSONProtoFuncStringify): * runtime/JSONObject.h: Added. (JSC::JSONObject:::JSObject): (JSC::JSONObject::classInfo): (JSC::JSONObject::createStructure): 2009-06-09 Gavin Barraclough Reviewed by Geoff Garen. Enable JIT_OPTIMIZE_CALL & JIT_OPTIMIZE_METHOD_CALLS on ARMv7 platforms. These optimizations function correctly with no further changes. * wtf/Platform.h: Change to enable JIT_OPTIMIZE_CALL & JIT_OPTIMIZE_METHOD_CALLS. 2009-06-09 Gavin Barraclough Not Reviewed, build fix. * assembler/MacroAssemblerARMv7.h: 2009-06-09 Gavin Barraclough Reviewed by Geoff Garen. Enable JIT_OPTIMIZE_ARITHMETIC on ARMv7 platforms. Temporarily split support for 'branchTruncateDoubleToInt32' onto its own switch ('supportsFloatingPointTruncate'). See comment in MacroAssemblerARMv7, we need to work out wherther we are going to be able to support the current interface on all platforms, or whether this should be refactored. * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::supportsFloatingPoint): Add implementation of supportsFloatingPointTruncate (returns true). (JSC::MacroAssemblerARMv7::supportsFloatingPointTruncate): Add implementation of supportsFloatingPointTruncate (returns false). (JSC::MacroAssemblerARMv7::loadDouble): (JSC::MacroAssemblerARMv7::storeDouble): (JSC::MacroAssemblerARMv7::addDouble): (JSC::MacroAssemblerARMv7::subDouble): (JSC::MacroAssemblerARMv7::mulDouble): (JSC::MacroAssemblerARMv7::convertInt32ToDouble): (JSC::MacroAssemblerARMv7::branchDouble): Implement FP code genertion operations. * assembler/MacroAssemblerX86.h: (JSC::MacroAssemblerX86::supportsFloatingPointTruncate): Add implementation of supportsFloatingPointTruncate (returns true). * assembler/MacroAssemblerX86_64.h: (JSC::MacroAssemblerX86_64::supportsFloatingPointTruncate): Add implementation of supportsFloatingPointTruncate (returns true). * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_rshift): Changed to call supportsFloatingPointTruncate(). (JSC::JIT::emitSlow_op_rshift): Changed to call supportsFloatingPointTruncate(). * wtf/Platform.h: Change to enable JIT_OPTIMIZE_ARITHMETIC. 2009-06-09 Gavin Barraclough Reviewed by Mark Rowe & Geoff Garen. Enable JIT_OPTIMIZE_PROPERTY_ACCESS on ARMv7 platforms. Firm up interface for planting load intructions that will be repatched by repatchLoadPtrToLEA(). This method should now no longer be applied to just any loadPtr instruction. * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::loadPtrWithPatchToLEA): Implement loadPtrWithPatchToLEA interface (plants a load with a fixed width address). (JSC::MacroAssemblerARMv7::move): (JSC::MacroAssemblerARMv7::nearCall): (JSC::MacroAssemblerARMv7::call): (JSC::MacroAssemblerARMv7::moveWithPatch): (JSC::MacroAssemblerARMv7::tailRecursiveCall): Switch to use common method 'moveFixedWidthEncoding()' to perform fixed width (often patchable) loads. (JSC::MacroAssemblerARMv7::moveFixedWidthEncoding): Move an immediate to a register, always plants movT3/movt instruction pair. * assembler/MacroAssemblerX86.h: (JSC::MacroAssemblerX86::loadPtrWithPatchToLEA): Implement loadPtrWithPatchToLEA interface (just a regular 32-bit load on x86). * assembler/MacroAssemblerX86_64.h: (JSC::MacroAssemblerX86_64::loadPtrWithPatchToLEA): Implement loadPtrWithPatchToLEA interface (just a regular 64-bit load on x86_64). * jit/JITPropertyAccess.cpp: (JSC::JIT::compileGetByIdHotPath): (JSC::JIT::emit_op_put_by_id): * wtf/Platform.h: Change to enable JIT_OPTIMIZE_PROPERTY_ACCESS. 2009-06-08 Gavin Barraclough Reviewed by Geoff Garen. Enable JS language JIT for ARM thumb2 platforms. Add ARMv7 specific asm & constants, add appropriate configuration switches to Platform.h. Landing this disabled until jump linking is completed (see YARR jit patch). * assembler/MacroAssemblerARMv7.h: (JSC::MacroAssemblerARMv7::load32): Fix: should load pointer with ImmPtr not Imm32. (JSC::MacroAssemblerARMv7::store32): Fix: should load pointer with ImmPtr not Imm32. (JSC::MacroAssemblerARMv7::move): Fix: When moving an Imm32 that is actually a pointer, should call movT3() not mov(), to ensure code generation is repeatable (for exception handling). * jit/JIT.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): Disable JIT_OPTIMIZE_NATIVE_CALL specific code generation if the optimization is not enabled. * jit/JIT.h: Add ARMv7 specific values of constants & register names. * jit/JITInlineMethods.h: (JSC::JIT::preverveReturnAddressAfterCall): (JSC::JIT::restoreReturnAddressBeforeReturn): (JSC::JIT::restoreArgumentReferenceForTrampoline): Implement for ARMv7 (move value to/from lr). * jit/JITStubs.cpp: Add JIT entry/thow trampolines, add macro to add thunk wrapper around stub routines. * jit/JITStubs.h: (JSC::JITStackFrame::returnAddressSlot): Add ARMv7 stack frame object. * wtf/Platform.h: Add changes necessary to allow JIT to build on this platform, disabled. 2009-06-08 Mark Rowe Speculative GTK build fix. * wtf/DateMath.cpp: 2009-06-08 Gavin Barraclough Reviewed by Mark Rowe. Previous patch caused a regression. Restructure so no new (empty, inline) function calls are added on x86. * jit/ExecutableAllocator.h: (JSC::ExecutableAllocator::makeWritable): (JSC::ExecutableAllocator::makeExecutable): (JSC::ExecutableAllocator::reprotectRegion): (JSC::ExecutableAllocator::cacheFlush): 2009-06-08 Dimitri Glazkov Unreviewed, GTK build fix (thanks, bdash). * GNUmakefile.am: Moved DateMath with all other wtf kin. 2009-06-08 Gavin Barraclough Reviewed by Geoff Garen. Add (incomplete) support to YARR for running with the jit enabled on Arm thumb2 platforms. Adds new Assembler/MacroAssembler classes, along with cache flushing support, tweaks to MacroAssemblerCodePtr to support decorated thumb code pointers, and new enter/exit code to YARR jit for the platform. Support for this platform is still under development - the assembler currrently only supports planting and linking jumps with a 16Mb range. As such, initially commiting in a disabled state. * JavaScriptCore.xcodeproj/project.pbxproj: Add new assembler files. * assembler/ARMv7Assembler.h: Added. Add new Assembler. * assembler/AbstractMacroAssembler.h: Tweaks to ensure sizes of pointer values planted in JIT code do not change. * assembler/MacroAssembler.h: On ARMv7 platforms use MacroAssemblerARMv7. * assembler/MacroAssemblerARMv7.h: Added. Add new MacroAssembler. * assembler/MacroAssemblerCodeRef.h: (JSC::FunctionPtr::FunctionPtr): Add better ASSERT. (JSC::ReturnAddressPtr::ReturnAddressPtr): Add better ASSERT. (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): On ARMv7, MacroAssemblerCodePtr's mush be 'decorated' with a low bit set, to indicate to the processor that the code is thumb code, not traditional 32-bit ARM. (JSC::MacroAssemblerCodePtr::dataLocation): On ARMv7, decoration must be removed. * jit/ExecutableAllocator.h: (JSC::ExecutableAllocator::makeWritable): Reformatted, no change. (JSC::ExecutableAllocator::makeExecutable): When marking code executable also cache flush it, where necessary. (JSC::ExecutableAllocator::MakeWritable::MakeWritable): Only use the null implementation of this class if both !ASSEMBLER_WX_EXCLUSIVE and running on x86(_64) - on other platforms we may also need ensure that makeExecutable is called at the end to flush caches. (JSC::ExecutableAllocator::reprotectRegion): Reformatted, no change. (JSC::ExecutableAllocator::cacheFlush): Cache flush a region of memory, or platforms where this is necessary. * wtf/Platform.h: Add changes necessary to allow YARR jit to build on this platform, disabled. * yarr/RegexJIT.cpp: (JSC::Yarr::RegexGenerator::generateEnter): (JSC::Yarr::RegexGenerator::generateReturn): Add support to these methods for ARMv7. 2009-06-08 Dimitri Glazkov Unreviewed, fix my previous fix. * runtime/DateInstance.cpp: (JSC::DateInstance::msToGregorianDateTime): Use WTF namespace qualifier to disambiguate func signatures. 2009-06-08 Mark Rowe Attempt to fix the Tiger build. * wtf/Platform.h: Only test the value of the macro once we know it is defined. 2009-06-08 Dimitri Glazkov Unreviewed, another Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: 2009-06-08 Dimitri Glazkov Unreviewed, projectile-fixing Windows build. * runtime/DateConversion.cpp: Added StringExtras include. * wtf/DateMath.cpp: Replaced math with algorithm include (looking for std::min def for Windows). 2009-06-08 Dimitri Glazkov Unreviewed, Windows build fix. * runtime/DateConstructor.cpp: Changed to use WTF namespace. * runtime/DateConversion.cpp: Added UString include. * runtime/DateInstance.cpp: Changed to use WTF namespace. * wtf/DateMath.cpp: Added math include. 2009-06-08 Dimitri Glazkov Reviewed by Eric Seidel. https://bugs.webkit.org/show_bug.cgi?id=26238 Move most of runtime/DateMath functions to wtf/DateMath, and split off conversion-related helpers to DateConversion. * AllInOneFile.cpp: Changed DateMath->DateConversion. * GNUmakefile.am: Ditto and added DateMath. * JavaScriptCore.exp: Ditto. * JavaScriptCore.pri: Ditto. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Ditto. * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added DateMath. * JavaScriptCore.xcodeproj/project.pbxproj: Ditto. * JavaScriptCoreSources.bkl: Ditto. * pcre/pcre_exec.cpp: Changed to use DateMath. * profiler/ProfileNode.cpp: (JSC::getCount): Changed to use DateConversion. * runtime/DateConstructor.cpp: Ditto. * runtime/DateConversion.cpp: Copied from JavaScriptCore/runtime/DateMath.cpp. (JSC::parseDate): Refactored to use null-terminated characters as input. * runtime/DateConversion.h: Copied from JavaScriptCore/runtime/DateMath.h. * runtime/DateInstance.cpp: Changed to use wtf/DateMath. * runtime/DateInstance.h: Ditto. * runtime/DateMath.cpp: Removed. * runtime/DateMath.h: Removed. * runtime/DatePrototype.cpp: Ditto. * runtime/InitializeThreading.cpp: Ditto. * wtf/DateMath.cpp: Copied from JavaScriptCore/runtime/DateMath.cpp. * wtf/DateMath.h: Copied from JavaScriptCore/runtime/DateMath.h. 2009-06-08 Steve Falkenburg Windows build fix. * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: 2009-06-07 David Kilzer Make JavaScriptCore compile for iPhone and iPhone Simulator Reviewed by Gavin Barraclough. * Configurations/Base.xcconfig: Split GCC_ENABLE_OBJC_GC on $(REAL_PLATFORM_NAME). Added $(ARCHS_UNIVERSAL_IPHONE_OS) to VALID_ARCHS. Added REAL_PLATFORM_NAME_iphoneos, REAL_PLATFORM_NAME_iphonesimulator, HAVE_DTRACE_iphoneos and HAVE_DTRACE_iphonesimulator variables. * Configurations/DebugRelase.xcconfig: Split ARCHS definition on $(REAL_PLATFORM_NAME). * Configurations/JavaScriptCore.xcconfig: Added EXPORTED_SYMBOLS_FILE_armv6 and EXPORTED_SYMBOLS_FILE_armv7 variables. Split OTHER_LDFLAGS into OTHER_LDFLAGS_BASE and OTHER_LDFLAGS_$(REAL_PLATFORM_NAME) since CoreServices.framework is only linked to on Mac OS X. * JavaScriptCore.xcodeproj/project.pbxproj: Removed references to CoreServices.framework since it's linked using OTHER_LDFLAGS in JavaScriptCore.xcconfig. * profiler/ProfilerServer.mm: Added #import for iPhone Simulator. (-[ProfilerServer init]): Conditionalize use of NSDistributedNotificationCenter to non-iPhone or iPhone Simulator. * wtf/FastMalloc.cpp: (WTF::TCMallocStats::): Build fix for iPhone and iPhone Simulator. * wtf/Platform.h: Defined PLATFORM(IPHONE) and PLATFORM(IPHONE_SIMULATOR). * wtf/ThreadingPthreads.cpp: (WTF::setThreadNameInternal): Build fix for iPhone and iPhone Simulator. 2009-06-08 Tor Arne Vestbø Reviewed by Simon Hausmann. [Qt] Use $QMAKE_PATH_SEP instead of hardcoded / to fix Windows build * JavaScriptCore.pri: * JavaScriptCore.pro: * jsc.pro: 2009-06-07 Gavin Barraclough RS by Sam Weinig. Remove bonus bogus \n from last commit. * jit/JITStubs.cpp: (JSC::): 2009-06-07 Gavin Barraclough Reviewed by Sam Weinig. Change the implementation of op_throw so the stub function always modifies its return address - if it doesn't find a 'catch' it will switch to a trampoline to force a return from JIT execution. This saves memory, by avoiding the need for a unique return for every op_throw. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_throw): JITStubs::cti_op_throw now always changes its return address, remove return code generated after the stub call (this is now handled by ctiOpThrowNotCaught). * jit/JITStubs.cpp: (JSC::): Add ctiOpThrowNotCaught definitions. (JSC::JITStubs::DEFINE_STUB_FUNCTION): Change cti_op_throw to always change its return address. * jit/JITStubs.h: Add ctiOpThrowNotCaught declaration. 2009-06-05 Gavin Barraclough Rudder stamped by Sam Weinig. Add missing ASSERT. * assembler/X86Assembler.h: (JSC::X86Assembler::getRelocatedAddress): 2009-06-05 Gavin Barraclough Reviewed by Sam Weinig. Switch storePtrWithPatch to take the initial immediate value as an argument. * assembler/MacroAssemblerX86.h: (JSC::MacroAssemblerX86::storePtrWithPatch): * assembler/MacroAssemblerX86_64.h: (JSC::MacroAssemblerX86_64::storePtrWithPatch): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_jsr): 2009-06-05 Gavin Barraclough Reviewed by Sam Weinig. Remove patchLength..tByIdExternalLoadPrefix magic numbers from JIT.h. These aren't really suitable values to be tracking within common code of the JIT, since they are not (and realistically cannot) be checked by ASSERTs, as the other repatch offsets are. Move this functionality (skipping the REX prefix when patching load instructions to LEAs on x86-64) into the X86Assembler. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::CodeLocationInstruction::repatchLoadPtrToLEA): * assembler/X86Assembler.h: (JSC::X86Assembler::repatchLoadPtrToLEA): * jit/JIT.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchPutByIdReplace): 2009-06-05 Shinichiro Hamaji Bug 26160: Compile fails in MacOSX when GNU fileutils are installed Reviewed by Alexey Proskuryakov. Use /bin/ln instead of ln for cases where this command is used with -h option. As this option is not supported by GNU fileutils, this change helps users who have GNU fileutils in their PATH. * JavaScriptCore.xcodeproj/project.pbxproj: 2009-06-05 Gavin Barraclough Reviewed by Oliver Hunt. Remove DoubleNotEqual floating point comparison condition for now - it is not used, and it is unclear the semantics are correct (I think this comparison would actually give you not-equal-or-unordered, which might be what is wanted... we can revisit this interface & get it right when required). Also, fix asserts in branchArith32 ops. All adds & subs can check for Signed, multiply only sets OF so can only check for overflow. * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::): (JSC::MacroAssemblerX86Common::branchAdd32): (JSC::MacroAssemblerX86Common::branchMul32): (JSC::MacroAssemblerX86Common::branchSub32): 2009-06-05 Gavin Barraclough Reviewed by Oliver Hunt. Minor tidy up in JITStubs. * jit/JITStubs.cpp: (JSC::StackHack::StackHack): * jit/JITStubs.h: 2009-06-05 Koen Kooi Reviewed by Xan Lopez. Build fix for glib unicode backend. * wtf/unicode/glib/UnicodeMacrosFromICU.h: 2009-06-05 Gavin Barraclough Reviewed by Oliver Hunt. 3 tiny cleanups: * assembler/MacroAssemblerX86.h: * assembler/MacroAssemblerX86_64.h: (JSC::MacroAssemblerX86_64::storePtrWithPatch): store*() methods should take an ImplicitAddress, rather than an Address. * assembler/X86Assembler.h: Make patchPointer private. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_ret): Remove empty line at end of function. 2009-06-05 Gavin Barraclough Reviewed by Oliver Hunt. Encapsulate many uses of void* in the assembler & jit with types that provide more semantic information. The new types are: * MacroAssemblerCodePtr - this wraps a pointer into JIT generated code. * FunctionPtr - this wraps a pointer to a C/C++ function in JSC. * ReturnAddressPtr - this wraps a return address resulting from a 'call' instruction. Wrapping these types allows for stronger type-checking than is possible with everything represented a void*. For example, it is now enforced by the type system that near calls can only be linked to JIT code and not to C functions in JSC (this was previously required, but could not be enforced on the interface). * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::CodeLocationCommon::CodeLocationCommon): (JSC::AbstractMacroAssembler::CodeLocationCommon::dataLocation): (JSC::AbstractMacroAssembler::CodeLocationCommon::executableAddress): (JSC::AbstractMacroAssembler::CodeLocationCommon::reset): (JSC::AbstractMacroAssembler::CodeLocationInstruction::repatchLoadToLEA): (JSC::AbstractMacroAssembler::CodeLocationInstruction::CodeLocationInstruction): (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForSwitch): (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForExceptionHandler): (JSC::AbstractMacroAssembler::CodeLocationLabel::addressForJSR): (JSC::AbstractMacroAssembler::CodeLocationLabel::operator!): (JSC::AbstractMacroAssembler::CodeLocationLabel::reset): (JSC::AbstractMacroAssembler::CodeLocationLabel::CodeLocationLabel): (JSC::AbstractMacroAssembler::CodeLocationLabel::getJumpDestination): (JSC::AbstractMacroAssembler::CodeLocationJump::relink): (JSC::AbstractMacroAssembler::CodeLocationJump::CodeLocationJump): (JSC::AbstractMacroAssembler::CodeLocationCall::relink): (JSC::AbstractMacroAssembler::CodeLocationCall::calleeReturnAddressValue): (JSC::AbstractMacroAssembler::CodeLocationCall::CodeLocationCall): (JSC::AbstractMacroAssembler::CodeLocationNearCall::relink): (JSC::AbstractMacroAssembler::CodeLocationNearCall::calleeReturnAddressValue): (JSC::AbstractMacroAssembler::CodeLocationNearCall::CodeLocationNearCall): (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::repatch): (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::CodeLocationDataLabel32): (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::repatch): (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::CodeLocationDataLabelPtr): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToTrampoline): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkNearCallerToTrampoline): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::addressForLookup): (JSC::AbstractMacroAssembler::trampolineAt): (JSC::AbstractMacroAssembler::PatchBuffer::link): (JSC::AbstractMacroAssembler::PatchBuffer::performFinalization): (JSC::::CodeLocationCommon::instructionAtOffset): (JSC::::CodeLocationCommon::labelAtOffset): (JSC::::CodeLocationCommon::jumpAtOffset): (JSC::::CodeLocationCommon::callAtOffset): (JSC::::CodeLocationCommon::nearCallAtOffset): (JSC::::CodeLocationCommon::dataLabelPtrAtOffset): (JSC::::CodeLocationCommon::dataLabel32AtOffset): * assembler/MacroAssemblerCodeRef.h: (JSC::FunctionPtr::FunctionPtr): (JSC::FunctionPtr::value): (JSC::FunctionPtr::executableAddress): (JSC::ReturnAddressPtr::ReturnAddressPtr): (JSC::ReturnAddressPtr::value): (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): (JSC::MacroAssemblerCodePtr::executableAddress): (JSC::MacroAssemblerCodePtr::dataLocation): (JSC::MacroAssemblerCodeRef::MacroAssemblerCodeRef): * assembler/X86Assembler.h: (JSC::X86Assembler::patchPointerForCall): * jit/JIT.cpp: (JSC::ctiPatchNearCallByReturnAddress): (JSC::ctiPatchCallByReturnAddress): (JSC::JIT::privateCompile): (JSC::JIT::privateCompileCTIMachineTrampolines): * jit/JIT.h: (JSC::JIT::compileCTIMachineTrampolines): * jit/JITCall.cpp: (JSC::JIT::compileOpCall): * jit/JITCode.h: (JSC::JITCode::operator !): (JSC::JITCode::addressForCall): (JSC::JITCode::offsetOf): (JSC::JITCode::execute): (JSC::JITCode::size): (JSC::JITCode::HostFunction): * jit/JITInlineMethods.h: (JSC::JIT::emitNakedCall): * jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchPutByIdReplace): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdChain): * jit/JITStubs.cpp: (JSC::JITThunks::JITThunks): (JSC::JITThunks::tryCachePutByID): (JSC::JITThunks::tryCacheGetByID): (JSC::JITStubs::DEFINE_STUB_FUNCTION): * jit/JITStubs.h: (JSC::JITThunks::ctiArrayLengthTrampoline): (JSC::JITThunks::ctiStringLengthTrampoline): (JSC::JITThunks::ctiVirtualCallPreLink): (JSC::JITThunks::ctiVirtualCallLink): (JSC::JITThunks::ctiVirtualCall): (JSC::JITThunks::ctiNativeCallThunk): * yarr/RegexJIT.h: (JSC::Yarr::RegexCodeBlock::operator!): (JSC::Yarr::RegexCodeBlock::execute): 2009-06-05 Antti Koivisto Try to unbreak Windows build. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: 2009-06-03 Antti Koivisto Reviewed by Dave Kilzer. https://bugs.webkit.org/show_bug.cgi?id=13128 Safari not obeying cache header Export JSC::parseDate() * JavaScriptCore.exp: * JavaScriptCore.xcodeproj/project.pbxproj: 2009-06-04 Oliver Hunt Reviewed by Gavin Barraclough. Bug in property caching of getters and setters. Make sure that the transition logic accounts for getters and setters. If we don't we end up screwing up the transition tables so that some transitions will start incorrectly believing that they need to check for getters and setters. * runtime/JSObject.cpp: (JSC::JSObject::defineGetter): (JSC::JSObject::defineSetter): * runtime/JSObject.h: (JSC::): * runtime/Structure.h: 2009-06-04 Gavin Barraclough Reviewed by Sam Weinig. Minor tweak to PatchBuffer, change it so it no longer holds a CodeRef, and instead holds a separate code pointer and executable pool. Since it now always holds its own copy of the code size, and to simplify the construction sequence, it's neater this way. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::PatchBuffer::PatchBuffer): (JSC::AbstractMacroAssembler::PatchBuffer::finalizeCode): (JSC::AbstractMacroAssembler::PatchBuffer::code): (JSC::AbstractMacroAssembler::PatchBuffer::performFinalization): 2009-06-04 Gavin Barraclough Reviewed by Oliver Hunt. Remove 'JIT_STUB_ARGUMENT_STACK' this is unused and untested. This just leaves JIT_STUB_ARGUMENT_REGISTER and JIT_STUB_ARGUMENT_VA_LIST. Since JIT_STUB_ARGUMENT_REGISTER is the sensible configuration on most platforms, remove this define and make this the default behaviour. Platforms must now define JIT_STUB_ARGUMENT_VA_LIST to get crazy va_list voodoo, if they so desire. (Refactoring of #ifdefs only, no functional change, no performance impact.) * jit/JIT.h: * jit/JITInlineMethods.h: (JSC::JIT::restoreArgumentReference): (JSC::JIT::restoreArgumentReferenceForTrampoline): * jit/JITStubs.cpp: (JSC::): * jit/JITStubs.h: * wtf/Platform.h: 2009-06-04 Gavin Barraclough Rubber stamped by Sam Weinig. * jit/JITArithmetic.cpp: Remove some redundant typedefs, unused since arithmetic was added to the MacroAssembler interface. 2009-06-04 Brent Fulgham Build fix due to header include problem. * interpreter/Interpreter.h: Remove wtf from includes so that compile can find the headers in expected places. 2009-06-04 Zoltan Horvath Reviewed by Darin Adler. HashTable class (JavaScriptCore/wtf/HashTable.h) doesn't instantiated by 'new', so inheritance was removed. HashTable struct has been instantiated by operator new in JSGlobalData.cpp:106. HashTable couldn't inherited from FastAllocBase since struct with inheritance is no longer POD, so HashTable struct has been instantiated by fastNew, destroyed by fastDelete. * interpreter/Interpreter.h: * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData): (JSC::JSGlobalData::~JSGlobalData): * wtf/HashTable.h: 2009-06-04 Gavin Barraclough Reviewed by Oliver Hunt. Wrap the code that plants pushes/pops planted by JIT in explanatorily named methods; move property storage reallocation into a standard stub function. ~No performance impact (possible <1% progression on x86-64, likely just noise). * jit/JIT.cpp: (JSC::JIT::privateCompile): (JSC::JIT::privateCompileCTIMachineTrampolines): Wrap calls to push/pop. * jit/JIT.h: Declare the new wrapper methods. * jit/JITInlineMethods.h: (JSC::JIT::preverveReturnAddressAfterCall): (JSC::JIT::restoreReturnAddressBeforeReturn): Define the new wrapper methods. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_end): (JSC::JIT::emit_op_ret): Wrap calls to push/pop. * jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePutByIdTransition): Move property storage reallocation into a standard stub function. * jit/JITStubs.cpp: (JSC::JITStubs::DEFINE_STUB_FUNCTION): * jit/JITStubs.h: (JSC::JITStubs::): 2009-06-04 Laszlo Gombos Reviewed by Ariya Hidayat. [Qt] Single-threaded QtWebKit configuration * JavaScriptCore.pri: Use ThreadingNone.cpp instead of ThreadingQt.cpp and make sure ENABLE_JSC_MULTIPLE_THREADS is turned off when ENABLE_SINGLE_THREADED is tuned on * wtf/ThreadingNone.cpp: (WTF::ThreadCondition::wait): Fix compilation warning. (WTF::ThreadCondition::timedWait): Ditto. 2009-06-02 Mark Rowe Reviewed by Anders Carlsson. Remove workaround that was added to address as it no longer affects our Tiger builds. * Configurations/Base.xcconfig: 2009-06-02 Xan Lopez Reviewed by Sam Weinig. Use C-style comments in Platform.h so it can be included from C files. * wtf/Platform.h: 2009-06-02 Tor Arne Vestbø Rubber-stamped by Simon Hausmann. Use File::Spec->tmpdir instead of hardcoded paths for tempfile() dir This fixes the Windows-build if the user does not have a /tmp directory. * pcre/dftables: 2009-06-02 Gavin Barraclough Reviewed by Oliver ">>" Hunt. emitSlow_op_rshift is linking the wrong number of slow cases, if !supportsFloatingPoint(). Fixerate, and refactor/comment the code a little to make it clearer what is going on. * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_rshift): (JSC::JIT::emitSlow_op_rshift): 2009-06-01 Gavin Barraclough Reviewed by NOBODY - speculative windows build fix (errm, for the other patch!). * jit/JITStubs.cpp: (JSC::): 2009-06-01 Gavin Barraclough Reviewed by NOBODY - speculative windows build fix. * assembler/AbstractMacroAssembler.h: (JSC::::CodeLocationCall::CodeLocationCall): (JSC::::CodeLocationNearCall::CodeLocationNearCall): 2009-06-01 Gavin Barraclough Reviewed by Olliej Hunt. Change JITStub functions from being static members on the JITStub class to be global extern "C" functions, and switch their the function signature declaration in the definition of the functions to be C-macro generated. This makes it easier to work with the stub functions from assembler code (since the names no longer require mangling), and by delaring the functions with a macro we can look at also auto-generating asm thunks to wrap the JITStub functions to perform the work currently in 'restoreArgumentReference' (as a memory saving). Making this change also forces us to be a bit more realistic about what is private on the Register and CallFrame objects. Presently most everything on these classes is private, and the classes have plenty of friends. We could befriend all the global functions to perpetuate the delusion of encapsulation, but using friends is a bit of a sledgehammer solution here - since friends can poke around with all of the class's privates, and since all the major classes taht operate on Regsiters are currently friends, right there is currently in practice very little protection at all. Better to start removing friend delclarations, and exposing just the parts that need to be exposed. * interpreter/CallFrame.h: (JSC::ExecState::returnPC): (JSC::ExecState::setCallerFrame): (JSC::ExecState::returnValueRegister): (JSC::ExecState::setArgumentCount): (JSC::ExecState::setCallee): (JSC::ExecState::setCodeBlock): * interpreter/Interpreter.h: * interpreter/Register.h: (JSC::Register::Register): (JSC::Register::i): * jit/JITStubs.cpp: (JSC::): (JSC::JITThunks::JITThunks): (JSC::JITThunks::tryCachePutByID): (JSC::JITThunks::tryCacheGetByID): (JSC::JITStubs::DEFINE_STUB_FUNCTION): * jit/JITStubs.h: (JSC::JITStubs::): * runtime/JSFunction.h: (JSC::JSFunction::nativeFunction): (JSC::JSFunction::classInfo): * runtime/JSGlobalData.h: 2009-06-01 Oliver Hunt Reviewed by Gavin Barraclough. Tidy up the literal parser. Make the number lexing in the LiteralParser exactly match the JSON spec, which makes us cover more cases, but also more strict. Also made string lexing only allow double-quoted strings. * runtime/LiteralParser.cpp: (JSC::LiteralParser::Lexer::lex): (JSC::LiteralParser::Lexer::lexString): (JSC::LiteralParser::Lexer::lexNumber): 2009-06-01 Gavin Barraclough Reviewed by Sam "WX" Weinig. Allow the JIT to operate without relying on use of RWX memory, on platforms where this is supported. This patch adds a switch to Platform.h (ENABLE_ASSEMBLER_WX_EXCLUSIVE) which enables this mode of operation. When this flag is set, all executable memory will be allocated RX, and switched to RW only whilst being modified. Upon completion of code generation the protection is switched back to RX to allow execution. Further optimization will be required before it is desirable to enable this mode of operation by default; enabling this presently incurs a 5%-10% regression. (Submitting disabled - no performance impact). * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::CodeLocationInstruction::repatchLoadToLEA): (JSC::AbstractMacroAssembler::CodeLocationLabel::fromFunctionPointer): (JSC::AbstractMacroAssembler::CodeLocationJump::relink): (JSC::AbstractMacroAssembler::CodeLocationCall::relink): (JSC::AbstractMacroAssembler::CodeLocationNearCall::relink): (JSC::AbstractMacroAssembler::CodeLocationDataLabel32::repatch): (JSC::AbstractMacroAssembler::CodeLocationDataLabelPtr::repatch): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToTrampoline): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToFunction): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkNearCallerToTrampoline): (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkNearCallerToFunction): (JSC::AbstractMacroAssembler::PatchBuffer::PatchBuffer): (JSC::AbstractMacroAssembler::PatchBuffer::~PatchBuffer): (JSC::AbstractMacroAssembler::PatchBuffer::link): (JSC::AbstractMacroAssembler::PatchBuffer::patch): (JSC::AbstractMacroAssembler::PatchBuffer::performFinalization): (JSC::::CodeLocationCommon::nearCallAtOffset): (JSC::::CodeLocationCall::CodeLocationCall): (JSC::::CodeLocationNearCall::CodeLocationNearCall): * assembler/AssemblerBuffer.h: (JSC::AssemblerBuffer::executableCopy): * assembler/X86Assembler.h: (JSC::CAN_SIGN_EXTEND_U32_64): (JSC::X86Assembler::linkJump): (JSC::X86Assembler::linkCall): (JSC::X86Assembler::patchPointer): (JSC::X86Assembler::relinkJump): (JSC::X86Assembler::relinkCall): (JSC::X86Assembler::repatchInt32): (JSC::X86Assembler::repatchPointer): (JSC::X86Assembler::repatchLoadToLEA): (JSC::X86Assembler::patchInt32): (JSC::X86Assembler::patchRel32): * jit/ExecutableAllocator.h: (JSC::ExecutableAllocator::): (JSC::ExecutableAllocator::makeWritable): (JSC::ExecutableAllocator::makeExecutable): * jit/ExecutableAllocatorFixedVMPool.cpp: (JSC::FixedVMPoolAllocator::FixedVMPoolAllocator): * jit/ExecutableAllocatorPosix.cpp: (JSC::ExecutablePool::systemAlloc): (JSC::ExecutablePool::systemRelease): (JSC::ExecutableAllocator::reprotectRegion): * jit/ExecutableAllocatorWin.cpp: * jit/JITPropertyAccess.cpp: (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchPutByIdReplace): * wtf/Platform.h: 2009-05-29 Zoltan Horvath Reviewed by Darin Adler. Inherits Interpreter class from FastAllocBase because it has been instantiated by 'new' in JavaScriptCore/runtime/JSGlobalData.cpp. * interpreter/Interpreter.h: 2009-06-01 David Levin Reviewed by NOBODY (windows build fix). Add exports for windows (corresponding to the JavaScriptCore.exp modification in the previous change). * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: 2009-06-01 David Levin Reviewed by Darin Alder and Maciej Stachowiak. Bug 26057: StringImpl should share buffers with UString. https://bugs.webkit.org/show_bug.cgi?id=26057 * JavaScriptCore.exp: * runtime/UString.cpp: (JSC::UString::Rep::create): (JSC::UString::BaseString::sharedBuffer): Only do the sharing when the buffer exceeds a certain size. The size was tuned by running various dom benchmarks with numbers ranging from 20 to 800 and finding a place that seemed to do the best overall. * runtime/UString.h: 2009-05-31 Gavin Barraclough Reviewed by Olliej "you just need to change NativeFunctionWrapper.h" Hunt. Add ENABLE_JIT_OPTIMIZE_NATIVE_CALL switch to allow JIT to operate without native call optimizations. * runtime/NativeFunctionWrapper.h: * wtf/Platform.h: 2009-05-30 Darin Adler Reviewed by Sam Weinig. REGRESSION (r42734): Celtic Kane JavaScript benchmark does not run: "Maximum call stack size exceeded" * runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncToString): Use the same recursion limit as the other recursion checks. We need a limit of at least 100 to run the benchmark above. (JSC::arrayProtoFuncToLocaleString): Ditto. (JSC::arrayProtoFuncJoin): Ditto. 2009-05-28 Dirk Schulze Reviewed by Nikolas Zimmermann. Added new build flag --filters for Mac. More details in WebCore/ChangeLog. * Configurations/FeatureDefines.xcconfig: 2009-05-27 Oliver Hunt Reviewed by Mark Rowe. Stack overflow in JSC::stringProtoFuncReplace() running jsFunFuzz We should always check for exceptions after creating a CachedCall, this wasn't being done in the string replace logic. * runtime/StringPrototype.cpp: (JSC::stringProtoFuncReplace): 2009-05-27 Gustavo Noronha Silva Unreviewed (make distcheck) build fix; adding missing headers. * GNUmakefile.am: 2009-05-27 Jessie Berlin Reviewed by Adam Roben Fix the Windows build. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: 2009-05-27 Fridrich Strba Reviewed by Gustavo Noronha. When building on Windows, consider Windows specific files. * GNUmakefile.am: 2009-05-27 Fridrich Strba Reviewed by Maciej Stachowiak. When building with MinGW, don't use the __declspec(dl{import,export}) decorations and rely on the linker to use its nifty auto-import feature. It is extremely hard to get the decorations right with MinGW in general and impossible in WebKit, where the resulting shared library is linking together some static libraries. * config.h: 2009-05-26 Holger Hans Peter Freyther Reviewed by Xan Lopez. https://bugs.webkit.org/show_bug.cgi?id=25613 Be able to use GOwnPtr for GHashTable as well. The assumption is that the hash table has been created with g_hash_table_new_full and has proper destruction functions. * wtf/GOwnPtr.cpp: (WTF::GHashTable): * wtf/GOwnPtr.h: 2009-05-26 Oliver Hunt Reviewed by Gavin Barraclough. REGRESSION: Assertion failure due to forward references Add a pattern type for forward references to ensure that we don't confuse the quantifier alternatives assertion. * yarr/RegexCompiler.cpp: (JSC::Yarr::RegexPatternConstructor::atomBackReference): (JSC::Yarr::RegexPatternConstructor::setupAlternativeOffsets): * yarr/RegexInterpreter.cpp: (JSC::Yarr::ByteCompiler::emitDisjunction): * yarr/RegexJIT.cpp: (JSC::Yarr::RegexGenerator::generateTerm): * yarr/RegexPattern.h: (JSC::Yarr::PatternTerm::): (JSC::Yarr::PatternTerm::PatternTerm): (JSC::Yarr::PatternTerm::ForwardReference): 2009-05-26 Gavin Barraclough Reviewed by Oliver Hunt. Fix for: REGRESSION: jQuery load() issue (25981), and also an ASSERT failure on http://ihasahotdog.com/. When overwriting a property on a dictionary with a cached specific value, clear the cache if new value being written is different. * JavaScriptCore.exp: Export the new symbols. * jit/JITStubs.cpp: (JSC::JITStubs::cti_op_get_by_id_method_check_second): Close dictionary prototypes upon caching a method access, as would happen when caching a regular get_by_id. * runtime/JSObject.h: (JSC::JSObject::propertyStorage): (JSC::JSObject::locationForOffset): Make these methods private. (JSC::JSObject::putDirectInternal): When overwriting a property on a dictionary with a cached specific value, clear the cache if new value being written is different. * runtime/Structure.cpp: (JSC::Structure::despecifyDictionaryFunction): Reset the specific value field for a given property in a dictionary. (JSC::Structure::despecifyFunctionTransition): Rename of 'changeFunctionTransition' (this was already internally refered to as a despecification). * runtime/Structure.h: Declare new method. 2009-05-26 Gavin Barraclough Reviewed by Oliver "pieces of eight" Hunt. When reseting RegexPattern class, should fully reset the class, not just bits of it. In particular, we delete the cached character classes (for wordchars, etc), but do not reset the set of pointers to the cached classes. In the case of a repeated parse due to an illegal back-reference we will continue to use the deleted character class. * yarr/RegexPattern.h: (JSC::Yarr::RegexPattern::reset): 2009-05-26 Brent Fulgham Build fix to correct r44161. * wtf/FastAllocBase.h: 2009-05-26 Zoltan Horvath Reviewed by Maciej Stachowiak. Inherite HashTable from FastAllocBase, because it has been instantiated by 'new' in JavaScriptCore/runtime/JSGlobalData.cpp. * wtf/HashTable.h: * wtf/FastAllocBase.h: Remove 'wtf' path from TypeTraits.h to allow use outside of wtf. 2009-05-25 David Levin Reviewed by Maciej Stachowiak and Oliver Hunt. https://bugs.webkit.org/show_bug.cgi?id=25126 Allow the buffer underlying UString to be shared. In order to not grow the underlying size of any structure, there is a union in the Rep string which holds + m_sharedBuffer -- a pointer to the shared ref counted buffer if the class is BaseString and the buffer is being shared OR + m_baseString -- the BaseString if the class is only UString::Rep but not a UString::BaseString Ideally, m_sharedBuffer would be a RefPtr, but it cannot be because it is in a union. No change in sunspider perf. * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/UString.cpp: (JSC::UString::Rep::share): (JSC::UString::Rep::destroy): (JSC::UString::BaseString::sharedBuffer): (JSC::UString::BaseString::setSharedBuffer): (JSC::UString::BaseString::slowIsBufferReadOnly): (JSC::expandCapacity): (JSC::UString::Rep::reserveCapacity): (JSC::UString::expandPreCapacity): (JSC::concatenate): (JSC::UString::append): * runtime/UString.h: (JSC::UString::Rep::Rep): (JSC::UString::Rep::): (JSC::UString::BaseString::isShared): (JSC::UString::BaseString::isBufferReadOnly): (JSC::UString::Rep::baseString): * wtf/CrossThreadRefCounted.h: (WTF::CrossThreadRefCounted::isShared): * wtf/OwnFastMallocPtr.h: Added. (WTF::OwnFastMallocPtr::OwnFastMallocPtr): (WTF::OwnFastMallocPtr::~OwnFastMallocPtr): (WTF::OwnFastMallocPtr::get): (WTF::OwnFastMallocPtr::release): 2009-05-25 Oliver Hunt Reviewed by Maciej Stachowiak. Re-add interpreter logic to jit-enabled builds as GCC mysteriously regresses without it * wtf/Platform.h: 2009-05-25 Fridrich Strba Reviewed by Maciej Stachowiak. The functions written in assembly need to have a leading underscore on Windows too. * jit/JITStubs.cpp: 2009-05-24 Steve Falkenburg Build fix for experimental PGO Windows target. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2009-05-23 David Kilzer Part 1 of 2: Bug 25495: Implement PassOwnPtr and replace uses of std::auto_ptr Reviewed by Oliver Hunt. * GNUmakefile.am: Added OwnPtrCommon.h and PassOwnPtr.h. * JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto. * JavaScriptCore.xcodeproj/project.pbxproj: Ditto. * wtf/OwnPtr.h: (WTF::OwnPtr::OwnPtr): Added constructors that take a PassOwnPtr. Also added a copy constructor declaration that's required when assigning a PassOwnPtr to a stack-based OwnPtr. (WTF::operator=): Added assignment operator methods that take a PassOwnPtr. (WTF::swap): Reformatted. (WTF::operator==): Whitespace changes. (WTF::operator!=): Ditto. * wtf/OwnPtrCommon.h: Added. (WTF::deleteOwnedPtr): * wtf/PassOwnPtr.h: Added. (WTF::PassOwnPtr::PassOwnPtr): (WTF::PassOwnPtr::~PassOwnPtr): (WTF::PassOwnPtr::get): (WTF::PassOwnPtr::clear): (WTF::PassOwnPtr::release): (WTF::PassOwnPtr::operator*): (WTF::PassOwnPtr::operator->): (WTF::PassOwnPtr::operator!): (WTF::PassOwnPtr::operator UnspecifiedBoolType): (WTF::::operator): (WTF::operator==): (WTF::operator!=): (WTF::static_pointer_cast): (WTF::const_pointer_cast): (WTF::getPtr): 2009-05-23 Oliver Hunt Reviewed by Maciej Stachowiak. Remove interpreter specific logic from the JIT builds. This saves ~100k in JSC release builds. * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): * interpreter/Interpreter.h: * wtf/Platform.h: 2009-05-22 Mark Rowe Part two of an attempted Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: 2009-05-22 Mark Rowe Part one of an attempted Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: 2009-05-21 Gavin Barraclough Reviewed by Geoff Garen. op_method_check Optimize method calls, by caching specific function values within the Structure. The new opcode is used almost like an x86 opcode prefix byte to optimize op_get_by_id, where the property access is being used to read a function to be passed to op-call (i.e. 'foo.bar();'). This patch modifies the Structure class such that when a property is put to an object for the first time we will check if the value is a function. If it is, we will cache the function value on the Structure. A Structure in such a state guarantees that not only does a property with the given identifier exist on the object, but also that its value is unchanged. Upon any further attempt to put a property with the same identifier (but a different value) to the object, it will transition back to a normal Structure (where it will guarantee the presence but not the value of the property). op_method_check makes use of the new information made available by the Structure, by augmenting the functionality of op_get_by_id. Upon generating a FunctionCallDotNode a check will be emitted prior to the property access reading the function value, and the JIT will generate an extra (initially unlinked but patchable) set of checks prior to the regular JIT code for get_by_id. The new code will do inline structure and prototype structure check (unlike a regular get_by_id, which can only handle 'self' accesses inline), and then performs an immediate load of the function value, rather than using memory accesses to load the value from the obejct's property storage array. If the method check fails it will revert, or if the access is polymorphic, the op_get_by_id will continue to operate - and optimize itself - just as any other regular op_get_by_id would. ~2.5% on v8-tests, due to a ~9% progression on richards. * API/JSCallbackObjectFunctions.h: (JSC::::put): (JSC::::staticFunctionGetter): * API/JSObjectRef.cpp: (JSObjectMakeConstructor): * JavaScriptCore.exp: * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::differenceBetween): * assembler/MacroAssemblerX86.h: (JSC::MacroAssemblerX86::moveWithPatch): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): * bytecode/CodeBlock.h: (JSC::getMethodCallLinkInfoReturnLocation): (JSC::CodeBlock::getMethodCallLinkInfo): (JSC::CodeBlock::addMethodCallLinkInfos): (JSC::CodeBlock::methodCallLinkInfo): * bytecode/Opcode.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitMethodCheck): * bytecompiler/BytecodeGenerator.h: * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JIT.h: (JSC::MethodCallCompilationInfo::MethodCallCompilationInfo): * jit/JITOpcodes.cpp: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_method_check): (JSC::JIT::emitSlow_op_method_check): (JSC::JIT::emit_op_get_by_id): (JSC::JIT::emitSlow_op_get_by_id): (JSC::JIT::emit_op_put_by_id): (JSC::JIT::emitSlow_op_put_by_id): (JSC::JIT::compileGetByIdHotPath): (JSC::JIT::compileGetByIdSlowCase): (JSC::JIT::patchMethodCallProto): * jit/JITStubs.cpp: (JSC::JITStubs::cti_op_get_by_id_method_check): (JSC::JITStubs::cti_op_get_by_id_method_check_second): * jit/JITStubs.h: * jsc.cpp: (GlobalObject::GlobalObject): * parser/Nodes.cpp: (JSC::FunctionCallDotNode::emitBytecode): * runtime/Arguments.cpp: (JSC::Arguments::put): * runtime/ArrayConstructor.cpp: (JSC::ArrayConstructor::ArrayConstructor): * runtime/BooleanConstructor.cpp: (JSC::BooleanConstructor::BooleanConstructor): * runtime/DateConstructor.cpp: (JSC::DateConstructor::DateConstructor): * runtime/ErrorConstructor.cpp: (JSC::ErrorConstructor::ErrorConstructor): (JSC::constructError): * runtime/ErrorPrototype.cpp: (JSC::ErrorPrototype::ErrorPrototype): * runtime/FunctionConstructor.cpp: (JSC::FunctionConstructor::FunctionConstructor): * runtime/FunctionPrototype.cpp: (JSC::FunctionPrototype::FunctionPrototype): * runtime/InternalFunction.cpp: (JSC::InternalFunction::InternalFunction): * runtime/JSActivation.cpp: (JSC::JSActivation::put): (JSC::JSActivation::putWithAttributes): * runtime/JSByteArray.cpp: (JSC::JSByteArray::JSByteArray): * runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): (JSC::JSFunction::getOwnPropertySlot): * runtime/JSGlobalObject.cpp: (JSC::JSGlobalObject::putWithAttributes): (JSC::JSGlobalObject::reset): (JSC::JSGlobalObject::mark): * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): (JSC::JSGlobalObject::methodCallDummy): * runtime/JSObject.cpp: (JSC::JSObject::put): (JSC::JSObject::putWithAttributes): (JSC::JSObject::deleteProperty): (JSC::JSObject::defineGetter): (JSC::JSObject::defineSetter): (JSC::JSObject::getPropertyAttributes): (JSC::JSObject::getPropertySpecificFunction): (JSC::JSObject::putDirectFunction): (JSC::JSObject::putDirectFunctionWithoutTransition): * runtime/JSObject.h: (JSC::getJSFunction): (JSC::JSObject::getDirectLocation): (JSC::JSObject::putDirect): (JSC::JSObject::putDirectWithoutTransition): * runtime/LiteralParser.cpp: (JSC::LiteralParser::parseObject): * runtime/Lookup.cpp: (JSC::setUpStaticFunctionSlot): * runtime/Lookup.h: (JSC::lookupPut): * runtime/MathObject.cpp: (JSC::MathObject::MathObject): * runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor::NativeErrorConstructor): (JSC::NativeErrorConstructor::construct): * runtime/NativeErrorPrototype.cpp: (JSC::NativeErrorPrototype::NativeErrorPrototype): * runtime/NumberConstructor.cpp: (JSC::NumberConstructor::NumberConstructor): * runtime/ObjectConstructor.cpp: (JSC::ObjectConstructor::ObjectConstructor): * runtime/PropertyMapHashTable.h: (JSC::PropertyMapEntry::PropertyMapEntry): * runtime/PrototypeFunction.cpp: (JSC::PrototypeFunction::PrototypeFunction): * runtime/PutPropertySlot.h: (JSC::PutPropertySlot::): (JSC::PutPropertySlot::PutPropertySlot): (JSC::PutPropertySlot::setNewProperty): (JSC::PutPropertySlot::setDespecifyFunctionProperty): (JSC::PutPropertySlot::isCacheable): (JSC::PutPropertySlot::cachedOffset): * runtime/RegExpConstructor.cpp: (JSC::RegExpConstructor::RegExpConstructor): * runtime/StringConstructor.cpp: (JSC::StringConstructor::StringConstructor): * runtime/StringPrototype.cpp: (JSC::StringPrototype::StringPrototype): * runtime/Structure.cpp: (JSC::Structure::Structure): (JSC::Structure::~Structure): (JSC::Structure::materializePropertyMap): (JSC::Structure::addPropertyTransitionToExistingStructure): (JSC::Structure::addPropertyTransition): (JSC::Structure::changeFunctionTransition): (JSC::Structure::addPropertyWithoutTransition): (JSC::Structure::get): (JSC::Structure::despecifyFunction): (JSC::Structure::put): (JSC::Structure::remove): * runtime/Structure.h: (JSC::Structure::get): (JSC::Structure::specificFunction): * runtime/StructureTransitionTable.h: (JSC::StructureTransitionTableHashTraits::emptyValue): * wtf/Platform.h: 2009-05-22 Brent Fulgham Reviewed by Steve Falkenburg. https://bugs.webkit.org/show_bug.cgi?id=25950 JavaScriptCore Fails to build on Windows (Cairo) due to CoreFoundation link requirement. Modify project to add new Debug_CFLite and Release_CFLite targets. These use the new JavaScriptCoreCFLite.vsprops to link against CFLite.dll. Existing projects are changed to use the new JavaScriptCoreCF.vsprops to link against CoreFoundation.dll. The JavaScriptCoreCommon.vsprops is modified to remove the link against CoreFoundation.dll. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCF.vsprops: Added. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCFLite.vsprops: Added. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops: 2009-05-22 Dominik Röttsches Reviewed by Gustavo Noronha. https://bugs.webkit.org/show_bug.cgi?id=15914 [GTK] Implement Unicode functionality using GLib Original patch by Jürg Billeter and Naiem Shaik. Implementing WTF Unicode functionality based on GLib. * GNUmakefile.am: * wtf/unicode/Unicode.h: * wtf/unicode/glib: Added. * wtf/unicode/glib/UnicodeGLib.cpp: Added. (WTF::Unicode::foldCase): (WTF::Unicode::toLower): (WTF::Unicode::toUpper): (WTF::Unicode::direction): (WTF::Unicode::umemcasecmp): * wtf/unicode/glib/UnicodeGLib.h: Added. (WTF::Unicode::): (WTF::Unicode::toLower): (WTF::Unicode::toUpper): (WTF::Unicode::toTitleCase): (WTF::Unicode::isArabicChar): (WTF::Unicode::isFormatChar): (WTF::Unicode::isSeparatorSpace): (WTF::Unicode::isPrintableChar): (WTF::Unicode::isDigit): (WTF::Unicode::isPunct): (WTF::Unicode::mirroredChar): (WTF::Unicode::category): (WTF::Unicode::isLower): (WTF::Unicode::digitValue): (WTF::Unicode::combiningClass): (WTF::Unicode::decompositionType): * wtf/unicode/glib/UnicodeMacrosFromICU.h: Added. 2009-05-21 Xan Lopez Unreviewed build fix. Add MacroAssemblerCodeRef.h to file list. * GNUmakefile.am: 2009-05-21 Gavin Barraclough Reviewed by Darin Adler. Addition of MacroAssemblerCodeRef.h rubber stamped by Geoff Garen. Refactor JIT code-handle objects. The representation of generated code is currently a bit of a mess. We have a class JITCode which wraps the pointer to a block of generated code, but this object does not reference the executable pool meaning that external events (the pool being derefed) could make the pointer become invalid. To overcome this both the JIT and Yarr implement further (and similar) objects to wrap the code pointer with a RefPtr to the pool. To add to the mire, as well as the CodeBlock containing a handle onto the code the FunctionBodyNode also contains a copy of the code pointer which is used almost (but not entirely) uniquely to access the JIT code for a function. Rationalization of all this: * Add a new type 'MacroAssembler::CodeRef' as a handle for a block of JIT generated code. * Change the JIT & Yarr to internally handle code using CodeRefs. * Move the CodeRef (formerly anow defunct JITCodeRef) from CodeBlock to its owner node. * Remove the (now) redundant code pointer from FunctionBodyNode. While tidying this up I've made the PatchBuffer return code in new allocations using a CodeRef, and have enforced an interface that the PatchBuffer will always be used, and 'finalizeCode()' or 'finalizeCodeAddendum()' will always be called exactly once on the PatchBuffer to complete code generation. This gives us a potentially useful hook ('PatchBuffer::performFinalization()') at the end of generation, which may have a number of uses. It may be helpful should we wish to switch our generation model to allow RW/RX exclusive memory, and it may be useful on non-cache-coherent platforms to give us an oportunity to cache flush as necessary. No performance impact. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::ProcessorReturnAddress::relinkCallerToTrampoline): (JSC::AbstractMacroAssembler::CodeRef::CodeRef): (JSC::AbstractMacroAssembler::CodeRef::trampolineAt): (JSC::AbstractMacroAssembler::PatchBuffer::PatchBuffer): (JSC::AbstractMacroAssembler::PatchBuffer::~PatchBuffer): (JSC::AbstractMacroAssembler::PatchBuffer::link): (JSC::AbstractMacroAssembler::PatchBuffer::linkTailRecursive): (JSC::AbstractMacroAssembler::PatchBuffer::patch): (JSC::AbstractMacroAssembler::PatchBuffer::complete): (JSC::AbstractMacroAssembler::PatchBuffer::finalize): (JSC::AbstractMacroAssembler::PatchBuffer::entry): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::CodeBlock): (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): (JSC::CodeBlock::setJITCode): * bytecode/CodeBlock.h: (JSC::CodeBlock::getBytecodeIndex): (JSC::CodeBlock::executablePool): * interpreter/CallFrameClosure.h: * interpreter/Interpreter.cpp: (JSC::Interpreter::execute): (JSC::Interpreter::prepareForRepeatCall): * jit/JIT.cpp: (JSC::JIT::privateCompile): (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC::JIT::linkCall): * jit/JIT.h: * jit/JITCode.h: (JSC::JITCode::JITCode): (JSC::JITCode::operator bool): (JSC::JITCode::addressForCall): (JSC::JITCode::offsetOf): (JSC::JITCode::execute): (JSC::JITCode::size): (JSC::JITCode::executablePool): (JSC::JITCode::HostFunction): * jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::privateCompilePatchGetArrayLength): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): * jit/JITStubs.cpp: (JSC::JITStubs::cti_vm_dontLazyLinkCall): (JSC::JITStubs::cti_vm_lazyLinkCall): * parser/Nodes.cpp: (JSC::ProgramNode::generateJITCode): (JSC::EvalNode::generateJITCode): (JSC::FunctionBodyNode::FunctionBodyNode): (JSC::FunctionBodyNode::createNativeThunk): (JSC::FunctionBodyNode::generateJITCode): * parser/Nodes.h: (JSC::ScopeNode::generatedJITCode): (JSC::ScopeNode::getExecutablePool): (JSC::ScopeNode::setJITCode): (JSC::ProgramNode::jitCode): (JSC::EvalNode::jitCode): (JSC::FunctionBodyNode::jitCode): * runtime/RegExp.cpp: (JSC::RegExp::match): * yarr/RegexJIT.cpp: (JSC::Yarr::RegexGenerator::compile): (JSC::Yarr::jitCompileRegex): (JSC::Yarr::executeRegex): * yarr/RegexJIT.h: (JSC::Yarr::RegexCodeBlock::RegexCodeBlock): (JSC::Yarr::RegexCodeBlock::pcreFallback): (JSC::Yarr::RegexCodeBlock::setFallback): (JSC::Yarr::RegexCodeBlock::operator bool): (JSC::Yarr::RegexCodeBlock::set): (JSC::Yarr::RegexCodeBlock::execute): 2009-05-21 Oliver Hunt Reviewed by Maciej Stachowiak. REGRESSION: Cached DOM global object property access fails in browser (25921) When caching properties on the global object we need to ensure that we're not attempting to cache through a shell object. * interpreter/Interpreter.cpp: (JSC::Interpreter::resolveGlobal): * jit/JITStubs.cpp: (JSC::JITStubs::cti_op_resolve_global): 2009-05-21 Steve Falkenburg Windows build fix. * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: 2009-05-21 Cameron Zwarich Reviewed by Mark Rowe. Bug 25945: Add support for MADV_FREE to TCMalloc Add support for MADV_FREE to TCMalloc_SystemRelease for platforms that don't also support MADV_FREE_REUSE. The code is identical to the MADV_DONTNEED case except for the advice passed to madvise(), so combining the two cases makes the most sense. * wtf/Platform.h: Only define HAVE_MADV_FREE when not building on Tiger or Leopard, because while it is defined on these platforms it actually does nothing. * wtf/TCSystemAlloc.cpp: (TCMalloc_SystemRelease): use MADV_FREE if it is available; otherwise use MADV_DONTNEED. 2009-05-21 Mark Rowe Reviewed by Oliver Hunt. Fix / . Bug 25917: REGRESSION (r43559?): Javascript debugger crashes when pausing page The debugger currently retrieves the arguments object from an activation rather than pulling it from a call frame. This is unreliable to due to the recent optimization to lazily create the arguments object. In the long-term it should stop doing that (), but for now we force eager creation of the arguments object when debugging. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): 2009-05-21 Cameron Zwarich Reviewed by Maciej Stachowiak. Bug 25912: Harden NumberPrototype.cpp by removing use of strcpy() This causes no change on SunSpider. * runtime/NumberPrototype.cpp: (JSC::integerPartNoExp): replace strcpy() with memcpy(), ASSERT that the temporary buffer has sufficient space to store the result, and move the explicit null-termination closer to the memcpy() for easier visual inspection of the code. (JSC::fractionalPartToString): replace strcpy() with memcpy(), and ASSERT that the temporary buffer has sufficient space to store the result. There is no explicit null-termination because this is done by the caller. The same is already true for exponentialPartToString(). (JSC::numberProtoFuncToExponential): replace strcpy() with memcpy(), explicitly null-terminate the result, and ASSERT that the temporary buffer has sufficient space to store the result. 2009-05-20 Sam Weinig Reviewed by Cameron Zwarich. Cleanup the JSGlobalData when exiting early with the usage statement in jsc. * jsc.cpp: (printUsageStatement): (parseArguments): (jscmain): 2009-05-20 Stephanie Lewis Update the order files. Generate new order files. * JavaScriptCore.order: 2009-05-19 Kenneth Rohde Christiansen Reviewed by Simon Hausmann. Replace WREC with YARR + YARR_JIT for the Qt port. This is only used when compiled with JIT support for now, so it is a drop-in replacement for the WREC usage. Still including the wrec headers as they are being referred from RegExp.h, though the contents of that header it protected by "#if ENABLE(WREC)". * JavaScriptCore.pri: 2009-05-20 Xan Lopez Reviewed by Eric Seidel. Fix GTK debug build. The function dumpDisjunction, compiled with debug enabled, uses printf, which needs stdio.h to be included. * yarr/RegexInterpreter.cpp: 2009-05-20 Laszlo Gombos Reviewed by George Staikos. BUG 25843: [Qt] Remove qt-port build flag * JavaScriptCore.pro: 2009-05-19 Geoffrey Garen Windows build fix. * interpreter/RegisterFile.cpp: (JSC::RegisterFile::releaseExcessCapacity): Copy-paste typo. 2009-05-19 Geoffrey Garen Reviewed by Sam Weinig. Fixed CrashTracer: [USER] 1 crash in Install Mac OS X at • 0x9274241c (Original patch by Joe Sokol and Ronnie Misra.) SunSpider says 1.004x faster. * interpreter/RegisterFile.cpp: (JSC::RegisterFile::releaseExcessCapacity): Instead of doing complicated math that sometimes used to overflow, just release the full range of the register file. * interpreter/RegisterFile.h: (JSC::isPageAligned): (JSC::RegisterFile::RegisterFile): Added ASSERTs to verify that it's safe to release the full range of the register file. (JSC::RegisterFile::shrink): No need to releaseExcessCapacity() if the new end is not smaller than the old end. (Also, doing so used to cause numeric overflow, unmapping basically the whole process from memory.) 2009-05-19 Oliver Hunt RS=Mark Rowe. REGRESSION: Start Debugging JavaScript crashes browser (nightly builds only?) Remove JSC_FAST_CALL as it wasn't gaining us anything, and was resulting in weird bugs in the nightly builds. * parser/Nodes.cpp: * parser/Nodes.h: (JSC::ExpressionNode::isNumber): (JSC::ExpressionNode::isString): (JSC::ExpressionNode::isNull): (JSC::ExpressionNode::isPure): (JSC::ExpressionNode::isLocation): (JSC::ExpressionNode::isResolveNode): (JSC::ExpressionNode::isBracketAccessorNode): (JSC::ExpressionNode::isDotAccessorNode): (JSC::ExpressionNode::isFuncExprNode): (JSC::ExpressionNode::isSimpleArray): (JSC::ExpressionNode::isAdd): (JSC::ExpressionNode::resultDescriptor): (JSC::StatementNode::firstLine): (JSC::StatementNode::lastLine): (JSC::StatementNode::isEmptyStatement): (JSC::StatementNode::isReturnNode): (JSC::StatementNode::isExprStatement): (JSC::StatementNode::isBlock): (JSC::NullNode::isNull): (JSC::BooleanNode::isPure): (JSC::NumberNode::value): (JSC::NumberNode::setValue): (JSC::NumberNode::isNumber): (JSC::NumberNode::isPure): (JSC::StringNode::isPure): (JSC::StringNode::isString): (JSC::ResolveNode::identifier): (JSC::ResolveNode::isLocation): (JSC::ResolveNode::isResolveNode): (JSC::BracketAccessorNode::isLocation): (JSC::BracketAccessorNode::isBracketAccessorNode): (JSC::DotAccessorNode::base): (JSC::DotAccessorNode::identifier): (JSC::DotAccessorNode::isLocation): (JSC::DotAccessorNode::isDotAccessorNode): (JSC::TypeOfResolveNode::identifier): (JSC::AddNode::isAdd): (JSC::BlockNode::isBlock): (JSC::EmptyStatementNode::isEmptyStatement): (JSC::ExprStatementNode::isExprStatement): (JSC::ReturnNode::isReturnNode): (JSC::ScopeNode::sourceURL): (JSC::ProgramNode::bytecode): (JSC::EvalNode::bytecode): (JSC::FunctionBodyNode::parameters): (JSC::FunctionBodyNode::toSourceString): (JSC::FunctionBodyNode::bytecode): (JSC::FuncExprNode::isFuncExprNode): 2009-05-19 Maciej Stachowiak Reviewed by Gavin Barraclough. - speed up string comparison, especially for short strings ~1% on SunSpider * JavaScriptCore.exp: * runtime/UString.cpp: * runtime/UString.h: (JSC::operator==): Inline UString's operator==, since it is called from hot places in the runtime. Also, specialize 2-char strings in a similar way to 1-char, since we're taking the hit of a switch anyway. 2009-05-18 Maciej Stachowiak Reviewed by Gavin Barraclough. - for polymorphic prototype lookups, increase the number of slots from 4 to 8 ~4% faster on v8 raytrace benchmark * bytecode/Instruction.h: 2009-05-18 Maciej Stachowiak Reviewed by Oliver Hunt. - tighten up the code for the load_varargs stub ~1-2% on v8-raytrace * jit/JITStubs.cpp: (JSC::JITStubs::cti_op_load_varargs): Hoist some loop invariants that the compiler didn't feel like hoisting for us. Remove unneeded exception check. 2009-05-18 Maciej Stachowiak Reviewed by Geoff Garen. - Improve code generation for access to prototype properties ~0.4% speedup on SunSpider. Based on a suggestion from Geoff Garen. * jit/JIT.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::compileGetDirectOffset): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): 2009-05-18 Gustavo Noronha Silva Reviewed by Gavin Barraclough. Enable YARR, and disable WREC for GTK+. * GNUmakefile.am: * yarr/RegexParser.h: 2009-05-18 Jan Michael Alonzo Reviewed by Xan Lopez. [Gtk] Various autotools build refactoring and fixes https://bugs.webkit.org/show_bug.cgi?id=25286 Add -no-install and -no-fast-install to programs and tests that we don't install. Also remove -O2 since this is already handled at configure time. * GNUmakefile.am: 2009-05-17 Jan Michael Alonzo Reviewed by Xan Lopez. [Gtk] Various autotools build refactoring and fixes https://bugs.webkit.org/show_bug.cgi?id=25286 Add JavaScriptCore/ to JSC include path only since it's not required when building WebCore. * GNUmakefile.am: 2009-05-17 Steve Falkenburg Windows build fix * JavaScriptCore.vcproj/JavaScriptCore.make: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2009-05-15 Gavin Barraclough Reviewed by Oliver Hunt. Looking like MSVC doesn't like static variables in inline methods? Make the state of the SSE2 check a static variable on the class MacroAssemblerX86Common as a speculative build fix for Windows. * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::convertInt32ToDouble): (JSC::MacroAssemblerX86Common::branchDouble): (JSC::MacroAssemblerX86Common::branchTruncateDoubleToInt32): (JSC::MacroAssemblerX86Common::isSSE2Present): (JSC::MacroAssemblerX86Common::): * jit/JIT.cpp: 2009-05-15 Adam Roben Add some assembler headers to JavaScriptCore.vcproj This is just a convenience for Windows developers. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2009-05-15 Gavin Barraclough Reviewed by Oliver Hunt. Add FP support to the MacroAssembler, port JITArithmetic over to make use of this. Also add API to determine whether FP support is available 'MacroAssembler::supportsFloatingPoint()', FP is presently only supported on SSE2 platforms, not x87. On platforms where a suitable hardware FPU is not available 'supportsFloatingPoint()' may simply return false, and all other methods ASSERT_NOT_REACHED(). * assembler/AbstractMacroAssembler.h: * assembler/MacroAssemblerX86.h: (JSC::MacroAssemblerX86::MacroAssemblerX86): (JSC::MacroAssemblerX86::branch32): (JSC::MacroAssemblerX86::branchPtrWithPatch): (JSC::MacroAssemblerX86::supportsFloatingPoint): * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::): (JSC::MacroAssemblerX86Common::loadDouble): (JSC::MacroAssemblerX86Common::storeDouble): (JSC::MacroAssemblerX86Common::addDouble): (JSC::MacroAssemblerX86Common::subDouble): (JSC::MacroAssemblerX86Common::mulDouble): (JSC::MacroAssemblerX86Common::convertInt32ToDouble): (JSC::MacroAssemblerX86Common::branchDouble): (JSC::MacroAssemblerX86Common::branchTruncateDoubleToInt32): (JSC::MacroAssemblerX86Common::branch32): (JSC::MacroAssemblerX86Common::branch16): (JSC::MacroAssemblerX86Common::branchTest32): (JSC::MacroAssemblerX86Common::branchAdd32): (JSC::MacroAssemblerX86Common::branchMul32): (JSC::MacroAssemblerX86Common::branchSub32): (JSC::MacroAssemblerX86Common::set32): (JSC::MacroAssemblerX86Common::setTest32): (JSC::MacroAssemblerX86Common::x86Condition): (JSC::MacroAssemblerX86Common::isSSE2Present): * assembler/MacroAssemblerX86_64.h: (JSC::MacroAssemblerX86_64::movePtrToDouble): (JSC::MacroAssemblerX86_64::moveDoubleToPtr): (JSC::MacroAssemblerX86_64::setPtr): (JSC::MacroAssemblerX86_64::branchPtr): (JSC::MacroAssemblerX86_64::branchTestPtr): (JSC::MacroAssemblerX86_64::branchAddPtr): (JSC::MacroAssemblerX86_64::branchSubPtr): (JSC::MacroAssemblerX86_64::supportsFloatingPoint): * assembler/X86Assembler.h: * jit/JIT.cpp: (JSC::JIT::JIT): * jit/JIT.h: * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_rshift): (JSC::JIT::emitSlow_op_rshift): (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emitSlow_op_jnlesseq): (JSC::JIT::compileBinaryArithOp): (JSC::JIT::compileBinaryArithOpSlowCase): (JSC::JIT::emit_op_add): (JSC::JIT::emitSlow_op_add): (JSC::JIT::emit_op_mul): (JSC::JIT::emitSlow_op_mul): * jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompilePutByIdTransition): 2009-05-15 Francisco Tolmasky BUG 25467: JavaScript debugger should use function.displayName as the function's name in the call stack Reviewed by Adam Roben. * JavaScriptCore.exp: Added calculatedFunctionName * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Added calculatedFunctionName * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: Added calculatedFunctionName * debugger/DebuggerCallFrame.cpp: Added calculatedFunctionName to match existing one in ProfileNode. (JSC::DebuggerCallFrame::calculatedFunctionName): * debugger/DebuggerCallFrame.h: Added calculatedFunctionName to match existing one in ProfileNode. 2009-05-14 Gavin Barraclough Build fix, not reviewed. Quick fixes for JIT builds with OPTIMIZE flags disabled. * jit/JITCall.cpp: (JSC::JIT::compileOpCall): (JSC::JIT::compileOpCallSlowCase): * jit/JITPropertyAccess.cpp: (JSC::JIT::compilePutByIdHotPath): 2009-05-14 Steve Falkenburg Back out incorrect Windows build fix * JavaScriptCore.vcproj/JavaScriptCore.make: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2009-05-14 Steve Falkenburg Windows build fix * JavaScriptCore.vcproj/JavaScriptCore.make: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2009-05-14 Adam Roben Windows jsc build fix r43648 modified jsc.vcproj's post-build event not to try to copy files that aren't present. Then r43661 mistakenly un-did that modification. This patch restores the modification from r43648, but puts the code in jscCommon.vsprops (where it should have been added in r43648). * JavaScriptCore.vcproj/jsc/jsc.vcproj: Restored empty VCPostBuildEventTool tags. * JavaScriptCore.vcproj/jsc/jscCommon.vsprops: Modified the post-build event command line to match the one in jsc.vcproj from r43648. 2009-05-14 Laszlo Gombos Reviewed by Darin Adler. https://bugs.webkit.org/show_bug.cgi?id=25325 Make sure pthread_self() is declared before it gets called in Collector.cpp * runtime/Collector.cpp: Include pthread.h in most Unix-like platforms (not just for OPENBSD) 2009-05-14 Mark Rowe Reviewed by Oliver Hunt. Fix . Bug 25785: Segfault in mark when using JSObjectMakeConstructor * API/JSObjectRef.cpp: (JSObjectMakeConstructor): OpaqueJSClass::prototype can return 0. We need to use the default object prototype when it does. * API/tests/testapi.c: (main): Add a test case. * runtime/JSObject.h: (JSC::JSObject::putDirect): Add a clearer assertion for a null value. The assertion on the next line does catch this, but the cause of the failure is not clear from the assertion itself. 2009-05-14 Mark Rowe Rubber-stamped by Darin Adler. When building with Xcode 3.1.3 should be using gcc 4.2 The meaning of XCODE_VERSION_ACTUAL is more sensible in newer versions of Xcode. Update our logic to select the compiler version to use the more appropriate XCODE_VERSION_MINOR if the version of Xcode supports it, and fall back to XCODE_VERSION_ACTUAL if not. * Configurations/Base.xcconfig: 2009-05-14 Gavin Barraclough Reviewed by Geoff Garen. Checking register file bounds should be a ptr comparison (m_end is a Register*). Also, the compare should be unsigned, pointers don'ts go negative. * jit/JIT.cpp: (JSC::JIT::privateCompile): 2009-05-13 Gavin Barraclough Reviewed by Oliver Hunt. Fix REGRESSION: page at Metroauto site crashes in cti_op_loop_if_less (25730) op_loop_if_less (imm < op) was loading op into regT1, but in the slow path spills regT0. This leads to bad happen. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_loop_if_less): (JSC::JIT::emitSlow_op_loop_if_less): 2009-05-13 Dmitry Titov Rubber-stamped by Mark Rowe. https://bugs.webkit.org/show_bug.cgi?id=25746 Revert http://trac.webkit.org/changeset/43507 which caused crash in PPC nightlies with Safari 4. * JavaScriptCore.exp: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: * bytecode/SamplingTool.cpp: (JSC::SamplingThread::start): (JSC::SamplingThread::stop): * bytecode/SamplingTool.h: * wtf/CrossThreadRefCounted.h: (WTF::CrossThreadRefCounted::CrossThreadRefCounted): (WTF::::ref): (WTF::::deref): * wtf/Threading.h: * wtf/ThreadingNone.cpp: * wtf/ThreadingPthreads.cpp: (WTF::threadMapMutex): (WTF::initializeThreading): (WTF::threadMap): (WTF::identifierByPthreadHandle): (WTF::establishIdentifierForPthreadHandle): (WTF::pthreadHandleForIdentifier): (WTF::clearPthreadHandleForIdentifier): (WTF::createThreadInternal): (WTF::waitForThreadCompletion): (WTF::detachThread): (WTF::currentThread): * wtf/ThreadingWin.cpp: (WTF::threadMapMutex): (WTF::initializeThreading): (WTF::threadMap): (WTF::storeThreadHandleByIdentifier): (WTF::threadHandleForIdentifier): (WTF::clearThreadHandleForIdentifier): (WTF::createThreadInternal): (WTF::waitForThreadCompletion): (WTF::detachThread): (WTF::currentThread): * wtf/gtk/ThreadingGtk.cpp: (WTF::threadMapMutex): (WTF::initializeThreading): (WTF::threadMap): (WTF::identifierByGthreadHandle): (WTF::establishIdentifierForThread): (WTF::threadForIdentifier): (WTF::clearThreadForIdentifier): (WTF::createThreadInternal): (WTF::waitForThreadCompletion): (WTF::currentThread): * wtf/qt/ThreadingQt.cpp: (WTF::threadMapMutex): (WTF::threadMap): (WTF::identifierByQthreadHandle): (WTF::establishIdentifierForThread): (WTF::clearThreadForIdentifier): (WTF::threadForIdentifier): (WTF::initializeThreading): (WTF::createThreadInternal): (WTF::waitForThreadCompletion): (WTF::currentThread): 2009-05-13 Darin Adler Revert the parser arena change. It was a slowdown, not a speedup. Better luck next time (I'll break it up into pieces). 2009-05-13 Darin Adler Tiger build fix. * parser/Grammar.y: Add back empty code blocks, needed by older versions of bison on certain rules. 2009-05-13 Steve Falkenburg Windows build fix. * JavaScriptCore.vcproj/jsc/jsc.vcproj: 2009-05-13 Adam Roben Windows build fixes after r43642 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Updated. * debugger/Debugger.cpp: * runtime/ArrayConstructor.cpp: * runtime/JSArray.cpp: * runtime/RegExp.cpp: * runtime/RegExpConstructor.cpp: * runtime/RegExpPrototype.cpp: * runtime/StringPrototype.cpp: Added missing #includes. 2009-05-13 Darin Adler Reviewed by Cameron Zwarich. Bug 25674: syntax tree nodes should use arena allocation https://bugs.webkit.org/show_bug.cgi?id=25674 Step 3: Add some actual arena allocation. About 1% SunSpider speedup. * JavaScriptCore.exp: Updated. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): Updated since VarStack contains const Identifier* now. (JSC::BytecodeGenerator::emitPushNewScope): Updated to take a const Identifier&. * bytecompiler/BytecodeGenerator.h: Ditto * bytecompiler/SegmentedVector.h: Added isEmpty. * debugger/Debugger.cpp: (JSC::Debugger::recompileAllJSFunctions): Moved this function here from WebCore so WebCore doesn't need the details of FunctionBodyNode. * debugger/Debugger.h: Ditto. * interpreter/Interpreter.cpp: (JSC::Interpreter::execute): Updated since VarStack contains const Identifier* now. * jit/JITStubs.cpp: (JSC::JITStubs::cti_vm_lazyLinkCall): Call isHostFunction on the body rather than on the function object, since we can't easily have inlined access to the FunctionBodyNode in JSFunction.h since WebCore needs access to that header. (JSC::JITStubs::cti_op_construct_JSConstruct): Ditto. * profiler/Profiler.cpp: (JSC::Profiler::createCallIdentifier): Ditto. * parser/Grammar.y: Use JSGlobalData* to pass the global data pointer around whenever possible instead of using void*. Changed SET_EXCEPTION_LOCATION from a macro to an inline function. Marked the structure-creating functions inline. Changed the VarStack to use identifier pointers instead of actual identifiers. This takes advantage of the fact that all identifier pointers come from the arena and avoids reference count churn. Changed Identifier* to const Identifier* to make sure we don't modify any by accident. Used identifiers for regular expression strings too, using the new scanRegExp that has out parameters instead of the old one that relied on side effects in the Lexer. Move the creation of numeric identifiers out of this file and into the PropertyNode constructor. * parser/Lexer.cpp: (JSC::Lexer::setCode): Pass in ParserArena, used for identifiers. (JSC::Lexer::makeIdentifier): Changed return type to const Identifier* and changed to call ParserArena. (JSC::Lexer::scanRegExp): Added out arguments that are const Identifier* as well as a prefix character argument so we can handle the /= case without a string append. (JSC::Lexer::skipRegExp): Added. Skips a regular expression without allocating Identifier objects. (JSC::Lexer::clear): Removed the code to manage m_identifiers, m_pattern, and m_flags, and added code to set m_arena to 0. * parser/Lexer.h: Updated for changes above. * parser/NodeConstructors.h: (JSC::ParserArenaFreeable::operator new): Added. Calls allocateFreeable on the arena. (JSC::ParserArenaDeletable::operator new): Changed to call the allocateDeletable function on the arena instead of deleteWithArena. (JSC::RegExpNode::RegExpNode): Changed arguments to Identifier instead of UString since these come from the parser which makes identifiers. (JSC::PropertyNode::PropertyNode): Added new constructor that makes numeric identifiers. Some day we might want to optimize this for integers so it doesn't create a string for each one. (JSC::ContinueNode::ContinueNode): Initialize m_ident to nullIdentifier since it's now a const Identifier& so it can't be left uninitialized. (JSC::BreakNode::BreakNode): Ditto. (JSC::CaseClauseNode::CaseClauseNode): Updated to use SourceElements* to keep track of the statements rather than a separate statement vector. (JSC::BlockNode::BlockNode): Ditto. (JSC::ForInNode::ForInNode): Initialize m_ident to nullIdentifier. * parser/Nodes.cpp: Moved the comment explaining emitBytecode in here. It seemed strangely out of place in the header. (JSC::ThrowableExpressionData::emitThrowError): Added an overload for UString as well as Identifier. (JSC::SourceElements::singleStatement): Added. (JSC::SourceElements::lastStatement): Added. (JSC::RegExpNode::emitBytecode): Updated since the pattern and flags are now Identifier instead of UString. Also changed the throwError code to use the substitution mechanism instead of doing a string append. (JSC::SourceElements::emitBytecode): Added. Replaces the old statementListEmitCode function, since we now keep the SourceElements objects around. (JSC::BlockNode::lastStatement): Added. (JSC::BlockNode::emitBytecode): Changed to use emitBytecode instead of statementListEmitCode. (JSC::CaseClauseNode::emitBytecode): Added. (JSC::CaseBlockNode::emitBytecodeForBlock): Changed to use emitBytecode instead of statementListEmitCode. (JSC::ScopeNodeData::ScopeNodeData): Changed to store the SourceElements* instead of using releaseContentsIntoVector. (JSC::ScopeNode::emitStatementsBytecode): Added. (JSC::ScopeNode::singleStatement): Added. (JSC::ProgramNode::emitBytecode): Call emitStatementsBytecode instead of statementListEmitCode. (JSC::EvalNode::emitBytecode): Ditto. (JSC::EvalNode::generateBytecode): Removed code to clear the children vector. This optimization is no longer possible since everything is in a single arena. (JSC::FunctionBodyNode::emitBytecode): Call emitStatementsBytecode insetad of statementListEmitCode and check for the return node using the new functions. * parser/Nodes.h: Changed VarStack to store const Identifier* instead of Identifier and rely on the arena to control lifetime. Added a new ParserArenaFreeable class. Made ParserArenaDeletable inherit from FastAllocBase instead of having its own operator new. Base the Node class on ParserArenaFreeable. Changed the various Node classes to use const Identifier& instead of Identifier to avoid the need to call their destructors and allow them to function as "freeable" in the arena. Removed extraneous JSC_FAST_CALL on definitions of inline functions. Changed ElementNode, PropertyNode, ArgumentsNode, ParameterNode, CaseClauseNode, ClauseListNode, and CaseBlockNode to use ParserArenaFreeable as a base class since they do not descend from Node. Eliminated the StatementVector type and instead have various classes use SourceElements* instead of StatementVector. This prevents those classes from having th use ParserArenaDeletable to make sure the vector destructor is called. * parser/Parser.cpp: (JSC::Parser::parse): Pass the arena to the lexer. * parser/Parser.h: Added an include of ParserArena.h, which is no longer included by Nodes.h. * parser/ParserArena.cpp: (JSC::ParserArena::ParserArena): Added. Initializes the new members, m_freeableMemory, m_freeablePoolEnd, and m_identifiers. (JSC::ParserArena::freeablePool): Added. Computes the pool pointer, since we store only the current pointer and the end of pool pointer. (JSC::ParserArena::deallocateObjects): Added. Contains the common memory-deallocation logic used by both the destructor and the reset function. (JSC::ParserArena::~ParserArena): Changed to call deallocateObjects. (JSC::ParserArena::reset): Ditto. Also added code to zero out the new structures, and switched to use clear() instead of shrink(0) since we don't really reuse arenas. (JSC::ParserArena::makeNumericIdentifier): Added. (JSC::ParserArena::allocateFreeablePool): Added. Used when the pool is empty. (JSC::ParserArena::isEmpty): Added. No longer inline, which is fine since this is used only for assertions at the moment. * parser/ParserArena.h: Added an actual arena of "freeable" objects, ones that don't need destructors to be called. Also added the segmented vector of identifiers that used to be in the Lexer. * runtime/FunctionConstructor.cpp: (JSC::extractFunctionBody): Use singleStatement function rather than getting at a StatementVector. * runtime/FunctionPrototype.cpp: (JSC::functionProtoFuncToString): Call isHostFunction on the body rather than the function object. * runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): Moved the structure version of this in here from the header. It's not hot enough that it needs to be inlined. (JSC::JSFunction::isHostFunction): Moved this in here from the header. It's now a helper to be used only within the class. (JSC::JSFunction::setBody): Moved this in here. It's not hot enough that it needs to be inlined, and we want to be able to compile the header without the definition of FunctionBodyNode. * runtime/JSFunction.h: Eliminated the include of "Nodes.h". This was exposing too much JavaScriptCore dependency to WebCore. Because of this change and some changes made to WebCore, we could now export a lot fewer headers from JavaScriptCore, but I have not done that yet in this check-in. Made a couple functions non-inline. Removes some isHostFunction() assertions. * wtf/FastAllocBase.h: Added the conventional using statements we use in WTF so we can use identifiers from the WTF namespace without explicit namespace qualification or namespace directive. This is the usual WTF style, although it's unconventional in the C++ world. We use the namespace primarily for link-time disambiguation, not compile-time. * wtf/FastMalloc.cpp: Fixed an incorrect comment. 2009-05-13 Xan Lopez Unreviewed build fix: add JITStubCall.h to files list. * GNUmakefile.am: 2009-05-13 Ariya Hidayat Unreviewed build fix, as suggested by Yael Aharon . * wtf/qt/ThreadingQt.cpp: (WTF::waitForThreadCompletion): renamed IsValid to isValid. 2009-05-13 Jan Michael Alonzo Revert r43562 - [Gtk] WTF_USE_JSC is already defined in WebCore/config.h. * wtf/Platform.h: 2009-05-12 Gavin Barraclough Reviewed by Oliver Hunt. Add SamplingCounter tool to provide a simple mechanism for counting events in JSC (enabled using ENABLE(SAMPLING_COUNTERS)). To count events within a single function use the class 'SamplingCounter', where the counter may be incremented from multiple functions 'GlobalSamplingCounter' may be convenient; all other counters (stack or heap allocated, rather than statically declared) should use the DeletableSamplingCounter. Further description of these classes is provided alongside their definition in SamplingTool.h. Counters may be incremented from c++ by calling the 'count()' method on the counter, or may be incremented by JIT code by using the 'emitCount()' method within the JIT. This patch also fixes CODEBLOCK_SAMPLING, which was missing a null pointer check. * JavaScriptCore.exp: * assembler/MacroAssemblerX86.h: (JSC::MacroAssemblerX86::addWithCarry32): (JSC::MacroAssemblerX86::and32): (JSC::MacroAssemblerX86::or32): * assembler/MacroAssemblerX86Common.h: (JSC::MacroAssemblerX86Common::and32): (JSC::MacroAssemblerX86Common::or32): * assembler/MacroAssemblerX86_64.h: (JSC::MacroAssemblerX86_64::and32): (JSC::MacroAssemblerX86_64::or32): (JSC::MacroAssemblerX86_64::addPtr): * assembler/X86Assembler.h: (JSC::X86Assembler::): (JSC::X86Assembler::adcl_im): (JSC::X86Assembler::addq_im): (JSC::X86Assembler::andl_im): (JSC::X86Assembler::orl_im): * bytecode/SamplingTool.cpp: (JSC::AbstractSamplingCounter::dump): * bytecode/SamplingTool.h: (JSC::AbstractSamplingCounter::count): (JSC::GlobalSamplingCounter::name): (JSC::SamplingCounter::SamplingCounter): * jit/JIT.h: * jit/JITCall.cpp: (JSC::): * jit/JITInlineMethods.h: (JSC::JIT::setSamplingFlag): (JSC::JIT::clearSamplingFlag): (JSC::JIT::emitCount): * jsc.cpp: (runWithScripts): * parser/Nodes.cpp: (JSC::ScopeNode::ScopeNode): * wtf/Platform.h: 2009-05-13 Steve Falkenburg Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore.make: 2009-05-12 Steve Falkenburg Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore.make: 2009-05-12 Oliver Hunt Reviewed by Gavin Barraclough. Crash occurs at JSC::Interpreter::execute() when loading http://www.sears.com We created the arguments objects before an op_push_scope but not before op_push_new_scope, this meant a null arguments object could be resolved inside catch blocks. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitPushNewScope): 2009-05-12 Oliver Hunt Reviewed by Gavin Barraclough. Crash occurs at JSC::JSActivation::mark() when loading http://www.monster.com; http://www.cnet.com Crash loading www.google.dk/ig (and other igoogle's as well) Following on from the lazy arguments creation patch, it's now possible for an activation to to have a null register in the callframe so we can't just blindly mark the local registers in an activation, and must null check first instead. * API/tests/testapi.c: (functionGC): * API/tests/testapi.js: (bludgeonArguments.return.g): (bludgeonArguments): * runtime/JSActivation.cpp: (JSC::JSActivation::mark): 2009-05-12 Gavin Barraclough Rubber stamped by Geoff Garen. WTF_USE_CTI_REPATCH_PIC is no longer used, remove. * jit/JIT.h: * jit/JITStubCall.h: 2009-05-12 Gavin Barraclough Reviewed by Maciej Stachowiak. We've run into some problems where changing the size of the class JIT leads to performance fluctuations. Try forcing alignment in an attempt to stabalize this. * jit/JIT.h: 2009-05-12 Kevin Ollivier wx build fix. Add ParserArena.cpp to the build. * JavaScriptCoreSources.bkl: 2009-05-12 Oliver Hunt Reviewed by Geoff Garen. Unsigned underflow on 64bit cannot be treated as a negative number This code included some placeswhere we deliberately create negative offsets from unsigned values, on 32bit this is "safe", but in 64bit builds much badness occurs. Solution is to use signed types as nature intended. * jit/JITStubs.cpp: (JSC::JITStubs::cti_op_load_varargs): 2009-05-12 Jan Michael Alonzo Reviewed by Holger Freyther. [Gtk] Various autotools build refactoring and fixes https://bugs.webkit.org/show_bug.cgi?id=25286 Define WTF_USE_JSC for the Gtk port. * wtf/Platform.h: 2009-05-12 Maciej Stachowiak Reviewed by Oliver Hunt. - allow all of strictEqual to be inlined into cti_op_stricteq once again We had this optimization once but accidentally lost it at some point. * runtime/Operations.h: (JSC::JSValue::strictEqualSlowCaseInline): (JSC::JSValue::strictEqual): 2009-05-12 Gavin Barraclough Reviewed by Oliver Hunt. instanceof should throw if the constructor being tested does not implement 'HasInstance" (i.e. is a function). Instead we were returning false. * interpreter/Interpreter.cpp: (JSC::isInvalidParamForIn): (JSC::isInvalidParamForInstanceOf): (JSC::Interpreter::privateExecute): * jit/JITStubs.cpp: (JSC::JITStubs::cti_op_instanceof): * tests/mozilla/ecma_2/instanceof/instanceof-003.js: Fix broken test case. * tests/mozilla/ecma_2/instanceof/regress-7635.js: Remove broken test case (was an exact duplicate of a test in instanceof-003.js). 2009-05-12 Oliver Hunt Reviewed by Gavin Barraclough. Improve function call forwarding performance Make creation of the Arguments object occur lazily, so it is not necessarily created for every function that references it. Then add logic to Function.apply to allow it to avoid allocating the Arguments object at all. Helps a lot with the function forwarding/binding logic in jQuery, Prototype, and numerous other JS libraries. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): * bytecode/Opcode.h: * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): (JSC::BytecodeGenerator::registerFor): (JSC::BytecodeGenerator::willResolveToArguments): (JSC::BytecodeGenerator::uncheckedRegisterForArguments): (JSC::BytecodeGenerator::createArgumentsIfNecessary): (JSC::BytecodeGenerator::emitCallEval): (JSC::BytecodeGenerator::emitPushScope): * bytecompiler/BytecodeGenerator.h: * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): (JSC::Interpreter::retrieveArguments): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_create_arguments): (JSC::JIT::emit_op_init_arguments): * jit/JITStubs.cpp: (JSC::JITStubs::cti_op_tear_off_arguments): (JSC::JITStubs::cti_op_load_varargs): * parser/Nodes.cpp: (JSC::ApplyFunctionCallDotNode::emitBytecode): 2009-05-11 Gavin Barraclough Reviewed by Oliver Hunt. Enable use of SamplingFlags directly from JIT code. * bytecode/SamplingTool.h: * jit/JIT.h: (JSC::JIT::sampleCodeBlock): (JSC::JIT::sampleInstruction): * jit/JITInlineMethods.h: (JSC::JIT::setSamplingFlag): (JSC::JIT::clearSamplingFlag): 2009-05-11 Gavin Barraclough Reviewed by Cameron Zwarich. Implement JIT generation for instanceof for non-objects (always returns false). Also fixes the sequencing of the prototype and value isObject checks, to no match the spec. 0.5% progression on v8 tests overall, due to 3.5% on early-boyer. * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): * runtime/JSObject.cpp: (JSC::JSObject::hasInstance): * runtime/TypeInfo.h: (JSC::TypeInfo::TypeInfo): 2009-05-11 Geoffrey Garen Reviewed by Sam Weinig. A little more JIT refactoring. Rearranged code to more clearly indicate what's conditionally compiled and why. Now, all shared code is at the top of our JIT files, and all #if'd code is at the bottom. #if'd code is delineated by large comments. Moved functions that relate to the JIT but don't explicitly do codegen into JIT.cpp. Refactored SSE2 check to store its result as a data member in the JIT. * jit/JIT.cpp: (JSC::isSSE2Present): (JSC::JIT::JIT): (JSC::JIT::unlinkCall): (JSC::JIT::linkCall): * jit/JIT.h: (JSC::JIT::isSSE2Present): * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_mod): (JSC::JIT::emitSlow_op_mod): * jit/JITCall.cpp: (JSC::JIT::compileOpCallVarargs): (JSC::JIT::compileOpCallVarargsSlowCase): 2009-05-11 Holger Hans Peter Freyther Build fix. * JavaScriptCore.pri: Build the new JITOpcodes.cpp 2009-05-11 Sam Weinig Reviewed by Geoffrey Garen. More re-factoring of JIT code generation. Use a macro to forward the main switch-statement cases to the helper functions. * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): 2009-05-11 Sam Weinig Reviewed by Geoffrey Garen. More re-factoring of JIT code generation to move opcode generation to helper functions outside the main switch-statement and gave those helper functions standardized names. This patch covers the remaining slow cases. * jit/JIT.cpp: * jit/JIT.h: * jit/JITOpcodes.cpp: 2009-05-11 Geoffrey Garen Build fix. * GNUmakefile.am: Added JITOpcodes.cpp and JITStubCall.h to the project. 2009-05-11 Geoffrey Garen Build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added JITOpcodes.cpp and JITStubCall.h to the project. 2009-05-11 Geoffrey Garen Reviewed by Sam Weinig. Some JIT refactoring. Moved JITStubCall* into its own header. Modified JITStubCall to ASSERT that its return value is handled correctly. Also, replaced function template with explicit instantiations to resolve some confusion. Replaced all uses of emit{Get,Put}CTIArgument with explicit peeks, pokes, and calls to killLastResultRegister(). * JavaScriptCore.xcodeproj/project.pbxproj: * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompile): * jit/JIT.h: * jit/JITArithmetic.cpp: * jit/JITCall.cpp: * jit/JITInlineMethods.h: (JSC::JIT::restoreArgumentReference): * jit/JITPropertyAccess.cpp: * jit/JITStubCall.h: Copied from jit/JIT.h. (JSC::JITStubCall::JITStubCall): (JSC::JITStubCall::addArgument): (JSC::JITStubCall::call): (JSC::JITStubCall::): 2009-05-11 Sam Weinig Reviewed by Geoffrey Garen. Start re-factoring JIT code generation to move opcode generation to helper functions outside the main switch-statement and gave those helper functions standardized names. This patch only covers the main pass and all the arithmetic opcodes in the slow path. * JavaScriptCore.xcodeproj/project.pbxproj: * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): * jit/JIT.h: * jit/JITArithmetic.cpp: * jit/JITOpcodes.cpp: Copied from jit/JIT.cpp. * jit/JITPropertyAccess.cpp: 2009-05-11 Steve Falkenburg Re-add experimental PGO configs. Reviewed by Adam Roben. * JavaScriptCore.vcproj/JavaScriptCore.make: * JavaScriptCore.vcproj/JavaScriptCore.sln: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: * JavaScriptCore.vcproj/jsc/jsc.vcproj: 2009-05-11 Sam Weinig Reviewed by Geoffrey "1" Garen. Rip out the !USE(CTI_REPATCH_PIC) code. It was untested and unused. * jit/JIT.h: (JSC::JIT::compileGetByIdChainList): (JSC::JIT::compileGetByIdChain): (JSC::JIT::compileCTIMachineTrampolines): * jit/JITPropertyAccess.cpp: (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): * jit/JITStubs.cpp: (JSC::JITStubs::tryCachePutByID): (JSC::JITStubs::tryCacheGetByID): 2009-05-11 Dmitry Titov GTK build fix - the deprecated waitForThreadCompletion is not needed on GTK. * wtf/ThreadingPthreads.cpp: used #ifdef PLATFORM(DARWIN) around waitForThreadCompletion(). 2009-05-11 Adam Roben Build fix for newer versions of GCC * wtf/ThreadingPthreads.cpp: Added a declaration of waitForThreadCompletion before its definition to silence a warning. 2009-05-11 Dmitry Titov Reviewed by Alexey Proskuryakov and Adam Roben. https://bugs.webkit.org/show_bug.cgi?id=25348 Change WTF::ThreadIdentifier to be an actual (but wrapped) thread id, remove ThreadMap. * wtf/Threading.h: (WTF::ThreadIdentifier::ThreadIdentifier): (WTF::ThreadIdentifier::isValid): (WTF::ThreadIdentifier::invalidate): (WTF::ThreadIdentifier::platformId): ThreadIdentifier is now a class, containing a PlatformThreadIdentifier and methods that are used across the code on thread ids: construction, comparisons, check for 'valid' state etc. '0' is used as invalid id, which happens to just work with all platform-specific thread id implementations. All the following files repeatedly reflect the new ThreadIdentifier for each platform. We remove ThreadMap and threadMapMutex from all of them, remove the functions that populated/searched/cleared the map and add platform-specific comparison operators for ThreadIdentifier. There are specific temporary workarounds for Safari 4 beta on OSX and Win32 since the public build uses WTF threading functions with old type of ThreadingIdentifier. The next time Safari 4 is rebuilt, it will 'automatically' pick up the new type and new functions so the deprecated ones can be removed. * wtf/gtk/ThreadingGtk.cpp: (WTF::ThreadIdentifier::operator==): (WTF::ThreadIdentifier::operator!=): (WTF::initializeThreading): (WTF::createThreadInternal): (WTF::waitForThreadCompletion): (WTF::currentThread): * wtf/ThreadingNone.cpp: (WTF::ThreadIdentifier::operator==): (WTF::ThreadIdentifier::operator!=): * wtf/ThreadingPthreads.cpp: (WTF::ThreadIdentifier::operator==): (WTF::ThreadIdentifier::operator!=): (WTF::initializeThreading): (WTF::createThreadInternal): (WTF::waitForThreadCompletion): (WTF::detachThread): (WTF::currentThread): (WTF::waitForThreadCompletion): This is a workaround for Safari 4 beta on Mac. Safari 4 is linked against old definition of ThreadIdentifier so it treats it as uint32_t. This 'old' variant of waitForThreadCompletion takes uint32_t and has the old decorated name, so Safari can load it from JavaScriptCore library. The other functions (CurrentThread() etc) happen to match their previous decorated names and, while they return pthread_t now, it is a pointer which round-trips through a uint32_t. This function will be removed as soon as Safari 4 will release next public build. * wtf/qt/ThreadingQt.cpp: (WTF::ThreadIdentifier::operator==): (WTF::ThreadIdentifier::operator!=): (WTF::initializeThreading): (WTF::createThreadInternal): (WTF::waitForThreadCompletion): (WTF::currentThread): * wtf/ThreadingWin.cpp: (WTF::ThreadIdentifier::operator==): (WTF::ThreadIdentifier::operator!=): (WTF::initializeThreading): (WTF::createThreadInternal): All the platforms (except Windows) used a sequential counter as a thread ID and mapped it into platform ID. Windows was using native thread id and mapped it into thread handle. Since we can always obtain a thread handle by thread id, createThread now closes the handle. (WTF::waitForThreadCompletion): obtains another one using OpenThread(id) API. If can not obtain a handle, it means the thread already exited. (WTF::detachThread): (WTF::currentThread): (WTF::detachThreadDeprecated): old function, renamed (for Win Safari 4 beta which uses it for now). (WTF::waitForThreadCompletionDeprecated): same. (WTF::currentThreadDeprecated): same. (WTF::createThreadDeprecated): same. * bytecode/SamplingTool.h: * bytecode/SamplingTool.cpp: Use DEFINE_STATIC_LOCAL for a static ThreadIdentifier variable, to avoid static constructor. * JavaScriptCore.exp: export lists - updated decorated names of the WTF threading functions since they now take a different type as a parameter. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: ditto for Windows, plus added "deprecated" functions that take old parameter type - turns out public beta of Safari 4 uses those, so they need to be kept along for a while. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: ditto. 2009-05-11 Darin Adler Reviewed by Oliver Hunt. Bug 25560: REGRESSION (r34821): "string value".__proto__ gets the wrong object. https://bugs.webkit.org/show_bug.cgi?id=25560 rdar://problem/6861069 I missed this case back a year ago when I sped up handling of JavaScript wrappers. Easy to fix. * runtime/JSObject.h: (JSC::JSValue::get): Return the prototype itself if the property name is __proto__. * runtime/JSString.cpp: (JSC::JSString::getOwnPropertySlot): Ditto. 2009-05-09 Oliver Hunt Reviewed by Maciej Stachowiak. Rename emitGetFromCallFrameHeader to emitGetFromCallFrameHeaderPtr * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileCTIMachineTrampolines): * jit/JIT.h: * jit/JITInlineMethods.h: (JSC::JIT::emitGetFromCallFrameHeaderPtr): (JSC::JIT::emitGetFromCallFrameHeader32): 2009-05-11 Holger Hans Peter Freyther Unreviewed build fix. Build ParserAreana.cpp for Qt * JavaScriptCore.pri: 2009-05-11 Norbert Leser Reviewed by Darin Adler. https://bugs.webkit.org/show_bug.cgi?id=24536 Symbian compilers cannot resolve WTF::PassRefPtr<:profile> unless Profile.h is included. * profiler/ProfileGenerator.h: 2009-05-11 Csaba Osztrogonac Reviewed by Holger Freyther. https://bugs.webkit.org/show_bug.cgi?id=24284 * JavaScriptCore.pri: coding style modified * jsc.pro: duplicated values removed from INCLUDEPATH, DEFINES 2009-05-11 Gustavo Noronha Silva Reviewed by NOBODY (build fix). Also add ParserArena, in addition to AllInOne, for release builds, since adding it to AllInOne breaks Mac. * GNUmakefile.am: 2009-05-11 Gustavo Noronha Silva Unreviewed build fix. Adding ParserArena to the autotools build. * GNUmakefile.am: 2009-05-11 Adam Roben More Windows build fixes after r43479 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: Export ParserArena::reset. 2009-05-11 Adam Roben Windows build fixes after r43479 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added ParserArena to the project. * parser/NodeConstructors.h: Added a missing include. (JSC::ParserArenaDeletable::operator new): Marked these as inline. 2009-05-10 Maciej Stachowiak Reviewed by Geoff Garen. - fixed REGRESSION(r43432): Many JavaScriptCore tests crash in 64-bit https://bugs.webkit.org/show_bug.cgi?id=25680 Accound for the 64-bit instruction prefix when rewriting mov to lea on 64-bit. * jit/JIT.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchPutByIdReplace): 2009-05-10 Darin Adler Reviewed by Cameron Zwarich. Bug 25674: syntax tree nodes should use arena allocation https://bugs.webkit.org/show_bug.cgi?id=25674 Part two: Remove reference counting from most nodes. * JavaScriptCore.exp: Updated. * JavaScriptCore.xcodeproj/project.pbxproj: Added ParserArena.h and .cpp. * parser/Grammar.y: Replaced uses of ParserRefCountedData with uses of ParserArenaData. Took out now-nonfunctional code that tries to manually release declaration list. Changed the new calls that create FuncDeclNode and FuncExprNode so that they use the proper version of operator new for the reference-counted idiom, not the deletion idiom. * parser/NodeConstructors.h: (JSC::ParserArenaDeletable::operator new): Added. (JSC::ParserArenaRefCounted::ParserArenaRefCounted): Added. (JSC::Node::Node): Removed ParserRefCounted initializer. (JSC::ElementNode::ElementNode): Ditto. (JSC::PropertyNode::PropertyNode): Ditto. (JSC::ArgumentsNode::ArgumentsNode): Ditto. (JSC::SourceElements::SourceElements): Ditto. (JSC::ParameterNode::ParameterNode): Ditto. (JSC::FuncExprNode::FuncExprNode): Added ParserArenaRefCounted initializer. (JSC::FuncDeclNode::FuncDeclNode): Ditto. (JSC::CaseClauseNode::CaseClauseNode): Removed ParserRefCounted initializer. (JSC::ClauseListNode::ClauseListNode): Ditto. (JSC::CaseBlockNode::CaseBlockNode): Ditto. * parser/NodeInfo.h: Replaced uses of ParserRefCountedData with uses of ParserArenaData. * parser/Nodes.cpp: (JSC::ScopeNode::ScopeNode): Added ParserArenaRefCounted initializer. (JSC::ProgramNode::create): Use the proper version of operator new for the reference-counted idiom, not the deletion idiom. Use the arena contains function instead of the vecctor find function. (JSC::EvalNode::create): Use the proper version of operator new for the reference-counted idiom, not the deletion idiom. Use the arena reset function instead of the vector shrink function. (JSC::FunctionBodyNode::createNativeThunk): Use the proper version of operator new for the reference-counted idiom, not the deletion idiom. (JSC::FunctionBodyNode::create): More of the same. * parser/Nodes.h: Added ParserArenaDeletable and ParserArenaRefCounted to replace ParserRefCounted. Fixed inheritance so only the classes that need reference counting inherit from ParserArenaRefCounted. * parser/Parser.cpp: (JSC::Parser::parse): Set m_sourceElements to 0 since it now starts uninitialized. Just set it to 0 again in the failure case, since it's now just a raw pointer, not an owning one. (JSC::Parser::reparseInPlace): Removed now-unneeded get() function. (JSC::Parser::didFinishParsing): Replaced uses of ParserRefCountedData with uses of ParserArenaData. * parser/Parser.h: Less RefPtr, more arena. * parser/ParserArena.cpp: Added. * parser/ParserArena.h: Added. * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::~JSGlobalData): Removed arena-related code, since it's now in the Parser. (JSC::JSGlobalData::createLeaked): Removed unneeded #ifndef. (JSC::JSGlobalData::createNativeThunk): Tweaked #if a bit. * runtime/JSGlobalData.h: Removed parserArena, which is now in Parser. * wtf/RefCounted.h: Added deletionHasBegun function, for use in assertions to catch deletion not done by the deref function. 2009-05-10 David Kilzer Part 2: Try to fix the Windows build by adding a symbol which is really just a re-mangling of a changed method signature * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: 2009-05-10 David Kilzer Try to fix the Windows build by removing an unknown symbol * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: 2009-05-10 David Kilzer Touch Nodes.cpp to try to fix Windows build * parser/Nodes.cpp: Removed whitespace. 2009-05-10 Darin Adler Reviewed by Maciej Stachowiak. Quick fix for failures seen on buildbot. Maciej plans a better fix later. * wtf/dtoa.cpp: Change the hardcoded number of 32-bit words in a BigInt from 32 to 64. Parsing "1e500", for example, requires more than 32 words. 2009-05-10 Darin Adler Reviewed by Sam Weinig. Bug 25674: syntax tree nodes should use arena allocation Part one: Change lifetimes so we won't have to use reference counting so much, but don't eliminate the reference counts entirely yet. * JavaScriptCore.exp: Updated. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): Update for use of raw pointers instead of RefPtr. (JSC::BytecodeGenerator::emitCall): Ditto. (JSC::BytecodeGenerator::emitConstruct): Ditto. * parser/Grammar.y: Update node creating code to use new (JSGlobalData*) instead of the plain new. At the moment this is just a hook for future arena allocation; it's inline and JSGlobalData* is not used. * parser/NodeConstructors.h: Updated for name change of parserObjects to parserArena. Also added explicit initialization for raw pointers that used to be RefPtr. Also removed some uses of get() that aren't needed now that the pointers are raw pointers. Also eliminated m_parameter from FuncExprNode and FuncDeclNode. Also changed node-creating code to use new (JSGlobalData*) as above. * parser/Nodes.cpp: Eliminated NodeReleaser and all use of it. (JSC::ParserRefCounted::ParserRefCounted): Updated for name change of parserObjects to parserArena. (JSC::SourceElements::append): Use raw pointers. (JSC::ArrayNode::emitBytecode): Ditto. (JSC::ArrayNode::isSimpleArray): Ditto. (JSC::ArrayNode::toArgumentList): Ditto. (JSC::ObjectLiteralNode::emitBytecode): Ditto. (JSC::PropertyListNode::emitBytecode): Ditto. (JSC::BracketAccessorNode::emitBytecode): Ditto. (JSC::DotAccessorNode::emitBytecode): Ditto. (JSC::ArgumentListNode::emitBytecode): Ditto. (JSC::NewExprNode::emitBytecode): Ditto. (JSC::EvalFunctionCallNode::emitBytecode): Ditto. (JSC::FunctionCallValueNode::emitBytecode): Ditto. (JSC::FunctionCallResolveNode::emitBytecode): Ditto. (JSC::FunctionCallBracketNode::emitBytecode): Ditto. (JSC::FunctionCallDotNode::emitBytecode): Ditto. (JSC::CallFunctionCallDotNode::emitBytecode): Ditto. (JSC::ApplyFunctionCallDotNode::emitBytecode): Ditto. (JSC::PostfixBracketNode::emitBytecode): Ditto. (JSC::PostfixDotNode::emitBytecode): Ditto. (JSC::DeleteBracketNode::emitBytecode): Ditto. (JSC::DeleteDotNode::emitBytecode): Ditto. (JSC::DeleteValueNode::emitBytecode): Ditto. (JSC::VoidNode::emitBytecode): Ditto. (JSC::TypeOfValueNode::emitBytecode): Ditto. (JSC::PrefixBracketNode::emitBytecode): Ditto. (JSC::PrefixDotNode::emitBytecode): Ditto. (JSC::UnaryOpNode::emitBytecode): Ditto. (JSC::BinaryOpNode::emitStrcat): Ditto. (JSC::BinaryOpNode::emitBytecode): Ditto. (JSC::EqualNode::emitBytecode): Ditto. (JSC::StrictEqualNode::emitBytecode): Ditto. (JSC::ReverseBinaryOpNode::emitBytecode): Ditto. (JSC::ThrowableBinaryOpNode::emitBytecode): Ditto. (JSC::InstanceOfNode::emitBytecode): Ditto. (JSC::LogicalOpNode::emitBytecode): Ditto. (JSC::ConditionalNode::emitBytecode): Ditto. (JSC::ReadModifyResolveNode::emitBytecode): Ditto. (JSC::AssignResolveNode::emitBytecode): Ditto. (JSC::AssignDotNode::emitBytecode): Ditto. (JSC::ReadModifyDotNode::emitBytecode): Ditto. (JSC::AssignBracketNode::emitBytecode): Ditto. (JSC::ReadModifyBracketNode::emitBytecode): Ditto. (JSC::CommaNode::emitBytecode): Ditto. (JSC::ConstDeclNode::emitCodeSingle): Ditto. (JSC::ConstDeclNode::emitBytecode): Ditto. (JSC::ConstStatementNode::emitBytecode): Ditto. (JSC::statementListEmitCode): Ditto. (JSC::BlockNode::emitBytecode): Ditto. (JSC::ExprStatementNode::emitBytecode): Ditto. (JSC::VarStatementNode::emitBytecode): Ditto. (JSC::IfNode::emitBytecode): Ditto. (JSC::IfElseNode::emitBytecode): Ditto. (JSC::DoWhileNode::emitBytecode): Ditto. (JSC::WhileNode::emitBytecode): Ditto. (JSC::ForNode::emitBytecode): Ditto. (JSC::ForInNode::emitBytecode): Ditto. (JSC::ReturnNode::emitBytecode): Ditto. (JSC::WithNode::emitBytecode): Ditto. (JSC::CaseBlockNode::tryOptimizedSwitch): Ditto. (JSC::CaseBlockNode::emitBytecodeForBlock): Ditto. (JSC::SwitchNode::emitBytecode): Ditto. (JSC::LabelNode::emitBytecode): Ditto. (JSC::ThrowNode::emitBytecode): Ditto. (JSC::TryNode::emitBytecode): Ditto. (JSC::ScopeNodeData::ScopeNodeData): Use swap to transfer ownership of the arena, varStack and functionStack. (JSC::ScopeNode::ScopeNode): Pass in the arena when creating the ScopeNodeData. (JSC::ProgramNode::ProgramNode): Made this inline since it's used in only one place. (JSC::ProgramNode::create): Changed this to return a PassRefPtr since we plan to have the scope nodes be outside the arena, so they will need some kind of ownership transfer (maybe auto_ptr instead of PassRefPtr in the future, though). Remove the node from the newly-created arena to avoid a circular reference. Later we'll keep the node out of the arena by using a different operator new, but for now it's the ParserRefCounted constructor that puts the node into the arena, and there's no way to bypass that. (JSC::EvalNode::EvalNode): Ditto. (JSC::EvalNode::create): Ditto. (JSC::FunctionBodyNode::FunctionBodyNode): Ditto. (JSC::FunctionBodyNode::createNativeThunk): Moved the code that reseets the arena here instead of the caller. (JSC::FunctionBodyNode::create): Same change as the other create functions above. (JSC::FunctionBodyNode::emitBytecode): Use raw pointers. * parser/Nodes.h: Removed NodeReleaser. Changed FunctionStack to use raw pointers. Removed the releaseNodes function. Added an override of operator new that takes a JSGlobalData* to prepare for future arena use. Use raw pointers instead of RefPtr everywhere possible. * parser/Parser.cpp: (JSC::Parser::reparseInPlace): Pass the arena in. * parser/Parser.h: (JSC::Parser::parse): Updated for name change of parserObjects to parserArena. (JSC::Parser::reparse): Ditto. * runtime/FunctionConstructor.cpp: (JSC::extractFunctionBody): Ditto. * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::~JSGlobalData): Ditto. (JSC::JSGlobalData::createNativeThunk): Moved arena manipulation into the FunctionBodyNode::createNativeThunk function. * runtime/JSGlobalData.h: Tweaked formatting and renamed parserObjects to parserArena. * wtf/NotFound.h: Added the usual "using WTF" to this header to match the rest of WTF. 2009-05-10 Dimitri Glazkov Reviewed by Geoffrey Garen. https://bugs.webkit.org/show_bug.cgi?id=25670 Remove no longer valid chunk of code from dtoa. * wtf/dtoa.cpp: (WTF::dtoa): Removed invalid code. 2009-05-10 Alexey Proskuryakov Reviewed by Geoff Garen. "Class const *" is the same as "const Class*", use the latter syntax consistently. See . * pcre/pcre_compile.cpp: (calculateCompiledPatternLength): * runtime/JSObject.h: (JSC::JSObject::offsetForLocation): (JSC::JSObject::locationForOffset): 2009-05-10 Maciej Stachowiak Reviewed by Alexey Proskuryakov. - speedup dtoa/strtod Added a bunch of inlining, and replaced malloc with stack allocation. 0.5% SunSpider speedup (7% on string-tagcloud). * runtime/NumberPrototype.cpp: (JSC::integerPartNoExp): (JSC::numberProtoFuncToExponential): * runtime/UString.cpp: (JSC::concatenate): (JSC::UString::from): * wtf/dtoa.cpp: (WTF::BigInt::BigInt): (WTF::BigInt::operator=): (WTF::Balloc): (WTF::Bfree): (WTF::multadd): (WTF::s2b): (WTF::i2b): (WTF::mult): (WTF::pow5mult): (WTF::lshift): (WTF::cmp): (WTF::diff): (WTF::b2d): (WTF::d2b): (WTF::ratio): (WTF::strtod): (WTF::quorem): (WTF::freedtoa): (WTF::dtoa): * wtf/dtoa.h: 2009-05-09 Mike Hommey Reviewed by Geoffrey Garen. Landed by Jan Alonzo. Enable JIT on x86-64 gtk+ https://bugs.webkit.org/show_bug.cgi?id=24724 * GNUmakefile.am: 2009-05-09 Geoffrey Garen Reviewed by Cameron Zwarich. Removed the last non-call-related manually managed JIT stub call. * jit/JITArithmetic.cpp: (JSC::JIT::compileFastArithSlow_op_rshift): Fully use the JITStubCall abstraction, instead of emitPutJITStubArg. 2009-05-09 Sebastian Andrzej Siewior Reviewed by Gustavo Noronha. https://bugs.webkit.org/show_bug.cgi?id=25653 PLATFORM(X86_64) inherits ia64 __ia64__ is defined by gcc in an IA64 arch and has completely nothing in common with X86-64 exept both are from Intel and have an 64bit address space. That's it. Since code seems to expect x86 here, ia64 has to go. * wtf/Platform.h: 2009-05-09 Gustavo Noronha Silva Suggested by Geoffrey Garen. Assume SSE2 is present on X86-64 and on MAC X86-32. This fixes a build breakage on non-Mac X86-64 when JIT is enabled. * jit/JITArithmetic.cpp: 2009-05-09 Gustavo Noronha Silva Build fix, adding missing files to make dist. * GNUmakefile.am: 2009-05-09 Geoffrey Garen Windows build fix. * assembler/X86Assembler.h: (JSC::X86Assembler::patchLoadToLEA): 2009-05-09 Geoffrey Garen Windows build fix. * assembler/X86Assembler.h: (JSC::X86Assembler::patchLoadToLEA): 2009-05-09 Maciej Stachowiak Reviewed by Gavin Barraclough. Original patch by John McCall. Updated by Cameron Zwarich. Further refined by me. - Assorted speedups to property access ~.3%-1% speedup on SunSpider 1) When we know from the structure ID that an object is using inline storage, plant direct loads and stores against it; no need to indirect through storage pointer. 2) Also because of the above, union the property storage pointer with the first inline property slot and add an extra inline property slot. * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::CodeLocationInstruction::CodeLocationInstruction): (JSC::AbstractMacroAssembler::CodeLocationInstruction::patchLoadToLEA): (JSC::::CodeLocationCommon::instructionAtOffset): * assembler/MacroAssembler.h: (JSC::MacroAssembler::storePtr): * assembler/MacroAssemblerX86.h: (JSC::MacroAssemblerX86::store32): * assembler/MacroAssemblerX86_64.h: (JSC::MacroAssemblerX86_64::storePtr): * assembler/X86Assembler.h: (JSC::X86Assembler::movq_EAXm): (JSC::X86Assembler::movl_rm): (JSC::X86Assembler::patchLoadToLEA): * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::compileGetByIdHotPath): (JSC::JIT::compilePutByIdHotPath): (JSC::JIT::compilePutDirectOffset): (JSC::JIT::compileGetDirectOffset): (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::patchGetByIdSelf): (JSC::JIT::patchPutByIdReplace): (JSC::JIT::privateCompileGetByIdSelf): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdSelfList): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): (JSC::JIT::privateCompilePutByIdReplace): * runtime/JSObject.cpp: (JSC::JSObject::mark): (JSC::JSObject::removeDirect): * runtime/JSObject.h: (JSC::JSObject::propertyStorage): (JSC::JSObject::getDirect): (JSC::JSObject::getOffset): (JSC::JSObject::offsetForLocation): (JSC::JSObject::locationForOffset): (JSC::JSObject::getDirectOffset): (JSC::JSObject::putDirectOffset): (JSC::JSObject::isUsingInlineStorage): (JSC::JSObject::): (JSC::JSObject::JSObject): (JSC::JSObject::~JSObject): (JSC::Structure::isUsingInlineStorage): (JSC::JSObject::putDirect): (JSC::JSObject::putDirectWithoutTransition): (JSC::JSObject::allocatePropertyStorageInline): * runtime/Structure.h: 2009-05-09 Geoffrey Garen Reviewed by Gavin Barraclough. Changed all our JIT stubs so that they return a maximum of 1 JS value or two non-JS pointers, and do all other value returning through out parameters, in preparation for 64bit JS values on a 32bit system. Stubs that used to return two JSValues now return one JSValue and take and out parameter specifying where in the register array the second value should go. SunSpider reports no change. * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JITArithmetic.cpp: (JSC::JIT::compileFastArithSlow_op_post_inc): (JSC::JIT::compileFastArithSlow_op_post_dec): * jit/JITStubs.cpp: (JSC::JITStubs::cti_op_call_arityCheck): (JSC::JITStubs::cti_op_resolve_func): (JSC::JITStubs::cti_op_post_inc): (JSC::JITStubs::cti_op_resolve_with_base): (JSC::JITStubs::cti_op_post_dec): * jit/JITStubs.h: (JSC::): 2009-05-08 Geoffrey Garen Reviewed by Cameron Zwarich. Fixed CrashTracer: [REGRESSION] >400 crashes in Safari at com.apple.JavaScriptCore • JSC::BytecodeGenerator::emitComplexJumpScopes + 468 https://bugs.webkit.org/show_bug.cgi?id=25658 * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitComplexJumpScopes): Guard the whole loop with a bounds check. The old loop logic would decrement and read topScope without a bounds check, which could cause crashes on page boundaries. 2009-05-08 Jan Michael Alonzo Reviewed by NOBODY (BuildFix). Gtk fix: add LiteralParser to the build script per r43424. Add LiteralParser to the Qt and Wx build scripts too. * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCoreSources.bkl: 2009-05-08 Oliver Hunt Reviewed by Gavin Barraclough and Darin Adler. Add a limited literal parser for eval to handle object and array literals fired at eval This is a simplified parser and lexer that we can throw at strings passed to eval in case a site is using eval to parse JSON (eg. json2.js). The lexer is intentionally limited (in effect it's whitelisting a limited "common" subset of the JSON grammar) as this decreases the likelihood of us wating time attempting to parse any significant amount of non-JSON content. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * interpreter/Interpreter.cpp: (JSC::Interpreter::callEval): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncEval): * runtime/LiteralParser.cpp: Added. (JSC::isStringCharacter): (JSC::LiteralParser::Lexer::lex): (JSC::LiteralParser::Lexer::lexString): (JSC::LiteralParser::Lexer::lexNumber): (JSC::LiteralParser::parseStatement): (JSC::LiteralParser::parseExpression): (JSC::LiteralParser::parseArray): (JSC::LiteralParser::parseObject): (JSC::LiteralParser::StackGuard::StackGuard): (JSC::LiteralParser::StackGuard::~StackGuard): (JSC::LiteralParser::StackGuard::isSafe): * runtime/LiteralParser.h: Added. (JSC::LiteralParser::LiteralParser): (JSC::LiteralParser::attemptJSONParse): (JSC::LiteralParser::): (JSC::LiteralParser::Lexer::Lexer): (JSC::LiteralParser::Lexer::next): (JSC::LiteralParser::Lexer::currentToken): (JSC::LiteralParser::abortParse): 2009-05-08 Geoffrey Garen Not reviewed. Restored a Mozilla JS test I accidentally gutted. * tests/mozilla/ecma/Array/15.4.4.2.js: (getTestCases): (test): 2009-05-08 Geoffrey Garen Reviewed by Gavin Barraclough. More abstraction for JITStub calls from JITed code. Added a JITStubCall class that automatically handles things like assigning arguments to different stack slots and storing return values. Deployed the class in about a billion places. A bunch more places remain to be fixed up, but this is a good stopping point for now. * jit/JIT.cpp: (JSC::JIT::emitTimeoutCheck): (JSC::JIT::privateCompileMainPass): (JSC::JIT::privateCompileSlowCases): (JSC::JIT::privateCompile): * jit/JIT.h: (JSC::JIT::JSRInfo::JSRInfo): (JSC::JITStubCall::JITStubCall): (JSC::JITStubCall::addArgument): (JSC::JITStubCall::call): (JSC::JITStubCall::): (JSC::CallEvalJITStub::CallEvalJITStub): * jit/JITArithmetic.cpp: (JSC::JIT::compileFastArithSlow_op_lshift): (JSC::JIT::compileFastArithSlow_op_rshift): (JSC::JIT::compileFastArithSlow_op_jnless): (JSC::JIT::compileFastArithSlow_op_bitand): (JSC::JIT::compileFastArithSlow_op_mod): (JSC::JIT::compileFastArith_op_mod): (JSC::JIT::compileFastArithSlow_op_post_inc): (JSC::JIT::compileFastArithSlow_op_post_dec): (JSC::JIT::compileFastArithSlow_op_pre_inc): (JSC::JIT::compileFastArithSlow_op_pre_dec): (JSC::JIT::compileFastArith_op_add): (JSC::JIT::compileFastArith_op_mul): (JSC::JIT::compileFastArith_op_sub): (JSC::JIT::compileBinaryArithOpSlowCase): (JSC::JIT::compileFastArithSlow_op_add): (JSC::JIT::compileFastArithSlow_op_mul): * jit/JITCall.cpp: (JSC::JIT::compileOpCall): (JSC::): * jit/JITPropertyAccess.cpp: (JSC::JIT::compileGetByIdHotPath): (JSC::JIT::compilePutByIdHotPath): (JSC::JIT::compileGetByIdSlowCase): (JSC::JIT::compilePutByIdSlowCase): * jit/JITStubs.cpp: (JSC::JITStubs::cti_op_resolve_func): (JSC::JITStubs::cti_op_resolve_with_base): 2009-05-08 Cameron Zwarich Reviewed by Maciej Stachowiak. Add a new opcode jnlesseq, and optimize its compilation in the JIT using techniques similar to what were used to optimize jnless in r43363. This gives a 0.7% speedup on SunSpider, particularly on the tests 3d-cube, control-flow-recursive, date-format-xparb, and string-base64. * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dump): Add support for dumping op_jnlesseq. * bytecode/Opcode.h: Add op_jnlesseq to the list of opcodes. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitJumpIfFalse): Add a peephole optimization for op_jnlesseq when emitting lesseq followed by a jump. * interpreter/Interpreter.cpp: (JSC::Interpreter::privateExecute): Add case for op_jnlesseq. * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): Add case for op_jnlesseq. (JSC::JIT::privateCompileSlowCases): Add case for op_jnlesseq. * jit/JIT.h: * jit/JITArithmetic.cpp: (JSC::JIT::compileFastArith_op_jnlesseq): Added. (JSC::JIT::compileFastArithSlow_op_jnlesseq): Added. * jit/JITStubs.cpp: (JSC::JITStubs::cti_op_jlesseq): Added. * jit/JITStubs.h: 2009-05-08 Maciej Stachowiak Reviewed by Cameron Zwarich. - fix test failures on 64-bit * jit/JITArithmetic.cpp: (JSC::JIT::compileFastArithSlow_op_jnless): Avoid accidentaly treating an immediate int as an immediate float in the 64-bit value representation. 2009-05-08 Gavin Barraclough Rubber stamped by Oliver Hunt. Removing an empty constructor and an uncalled, empty function seems to be a pretty solid 1% regeression on my machine, so I'm going to put them back. Um. Yeah, this this pretty pointles and makes no sense at all. I officially lose the will to live in 3... 2... * bytecode/SamplingTool.cpp: (JSC::SamplingTool::notifyOfScope): * bytecode/SamplingTool.h: (JSC::SamplingTool::~SamplingTool): 2009-05-08 Gavin Barraclough Reviewed by Oliver "I see lots of ifdefs" Hunt. Fix (kinda) for sampling tool breakage. The codeblock sampling tool has become b0rked due to recent changes in native function calling. The initialization of a ScopeNode appears to now occur before the sampling tool (or possibly the interpreter has been brought into existence, wihich leads to crashyness). This patch doesn't fix the problem. The crash occurs when tracking a Scope, but we shouldn't need to track scopes when we're just sampling opcodes, not codeblocks. Not retaining Scopes when just opcode sampling will reduce sampling overhead reducing any instrumentation skew, which is a good thing. As a side benefit this patch also gets the opcode sampling going again, albeit in a bit of a lame way. Will come back later with a proper fix from codeblock sampling. * JavaScriptCore.exp: * bytecode/SamplingTool.cpp: (JSC::compareLineCountInfoSampling): (JSC::SamplingTool::dump): * bytecode/SamplingTool.h: (JSC::SamplingTool::SamplingTool): * parser/Nodes.cpp: (JSC::ScopeNode::ScopeNode): 2009-05-07 Mark Rowe Rubber-stamped by Oliver Hunt. Fix . Bug 25640: Crash on quit in r43384 nightly build on Leopard w/ Safari 4 beta installed Roll out r43366 as it removed symbols that Safari 4 Beta uses. * JavaScriptCore.exp: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: * bytecode/SamplingTool.cpp: (JSC::SamplingThread::start): (JSC::SamplingThread::stop): * bytecode/SamplingTool.h: * wtf/CrossThreadRefCounted.h: (WTF::CrossThreadRefCounted::CrossThreadRefCounted): (WTF::::ref): (WTF::::deref): * wtf/Threading.h: * wtf/ThreadingNone.cpp: * wtf/ThreadingPthreads.cpp: (WTF::threadMapMutex): (WTF::initializeThreading): (WTF::threadMap): (WTF::identifierByPthreadHandle): (WTF::establishIdentifierForPthreadHandle): (WTF::pthreadHandleForIdentifier): (WTF::clearPthreadHandleForIdentifier): (WTF::createThreadInternal): (WTF::waitForThreadCompletion): (WTF::detachThread): (WTF::currentThread): * wtf/ThreadingWin.cpp: (WTF::threadMapMutex): (WTF::initializeThreading): (WTF::threadMap): (WTF::storeThreadHandleByIdentifier): (WTF::threadHandleForIdentifier): (WTF::clearThreadHandleForIdentifier): (WTF::createThreadInternal): (WTF::waitForThreadCompletion): (WTF::detachThread): (WTF::currentThread): * wtf/gtk/ThreadingGtk.cpp: (WTF::threadMapMutex): (WTF::initializeThreading): (WTF::threadMap): (WTF::identifierByGthreadHandle): (WTF::establishIdentifierForThread): (WTF::threadForIdentifier): (WTF::clearThreadForIdentifier): (WTF::createThreadInternal): (WTF::waitForThreadCompletion): (WTF::currentThread): * wtf/qt/ThreadingQt.cpp: (WTF::threadMapMutex): (WTF::threadMap): (WTF::identifierByQthreadHandle): (WTF::establishIdentifierForThread): (WTF::clearThreadForIdentifier): (WTF::threadForIdentifier): (WTF::initializeThreading): (WTF::createThreadInternal): (WTF::waitForThreadCompletion): (WTF::currentThread): 2009-05-07 Gustavo Noronha Silva Suggested by Oliver Hunt. Also check for Linux for the special-cased calling convention. * jit/JIT.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): * wtf/Platform.h: 2009-05-07 Gavin Barraclough Reviewed by Maciej Stachowiak. Previously, when appending to an existing string and growing the underlying buffer, we would actually allocate 110% of the required size in order to give us some space to expand into. Now we treat strings differently based on their size: Small Strings (up to 4 pages): Expand the allocation size to 112.5% of the amount requested. This is largely sicking to our previous policy, however 112.5% is cheaper to calculate. Medium Strings (up to 128 pages): For pages covering multiple pages over-allocation is less of a concern - any unused space will not be paged in if it is not used, so this is purely a VM overhead. For these strings allocate 2x the requested size. Large Strings (to infinity and beyond!): Revert to our 112.5% policy - probably best to limit the amount of unused VM we allow any individual string be responsible for. Additionally, round small allocations up to a multiple of 16 bytes, and medium and large allocations up to a multiple of page size. ~1.5% progression on Sunspider, due to 5% improvement on tagcloud & 15% on validate. * runtime/UString.cpp: (JSC::expandedSize): 2009-05-07 Geoffrey Garen Reviewed by Cameron Zwarich. Fixed a minor sequencing error introduced by recent Parser speedups. * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::createNativeThunk): Missed a spot in my last patch. 2009-05-07 Geoffrey Garen Not reviewed. * wtf/Platform.h: Reverted an accidental (and performance-catastrophic) change. 2009-05-07 Geoffrey Garen Reviewed by Cameron Zwarich. Fixed a minor sequencing error introduced by recent Parser speedups. * parser/Parser.cpp: (JSC::Parser::reparseInPlace): Missed a spot in my last patch. 2009-05-07 Geoffrey Garen Reviewed by Cameron Zwarich. Fixed a minor sequencing error introduced by recent Parser speedups. * parser/Parser.cpp: (JSC::Parser::parse): * parser/Parser.h: (JSC::Parser::parse): (JSC::Parser::reparse): Shrink the parsedObjects vector after allocating the root node, to avoid leaving a stray node in the vector, since that's a slight memory leak, and it causes problems during JSGlobalData teardown. * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::~JSGlobalData): ASSERT that we're not being torn down while we think we're still parsing, since that would cause lots of bad memory references during our destruction. 2009-05-07 Geoffrey Garen Reviewed by Cameron Zwarich. Replaced two more macros with references to the JITStackFrame structure. * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JITInlineMethods.h: (JSC::JIT::restoreArgumentReference): * jit/JITStubs.cpp: (JSC::): * jit/JITStubs.h: 2009-05-07 Oliver Hunt Reviewed by Gavin Barraclough. Improve native call performance Fix the windows build by adding calling convention declarations everywhere, chose fastcall as that seemed most sensible given we were having to declare the convention explicitly. In addition switched to fastcall on mac in the deluded belief that documented fastcall behavior on windows would match actual its actual behavior. * API/JSCallbackFunction.h: * API/JSCallbackObject.h: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: * interpreter/CallFrame.h: (JSC::ExecState::argumentCount): * jit/JIT.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): * jsc.cpp: (functionPrint): (functionDebug): (functionGC): (functionVersion): (functionRun): (functionLoad): (functionSetSamplingFlags): (functionClearSamplingFlags): (functionReadline): (functionQuit): * runtime/ArrayConstructor.cpp: (JSC::callArrayConstructor): * runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncToString): (JSC::arrayProtoFuncToLocaleString): (JSC::arrayProtoFuncJoin): (JSC::arrayProtoFuncConcat): (JSC::arrayProtoFuncPop): (JSC::arrayProtoFuncPush): (JSC::arrayProtoFuncReverse): (JSC::arrayProtoFuncShift): (JSC::arrayProtoFuncSlice): (JSC::arrayProtoFuncSort): (JSC::arrayProtoFuncSplice): (JSC::arrayProtoFuncUnShift): (JSC::arrayProtoFuncFilter): (JSC::arrayProtoFuncMap): (JSC::arrayProtoFuncEvery): (JSC::arrayProtoFuncForEach): (JSC::arrayProtoFuncSome): (JSC::arrayProtoFuncReduce): (JSC::arrayProtoFuncReduceRight): (JSC::arrayProtoFuncIndexOf): (JSC::arrayProtoFuncLastIndexOf): * runtime/BooleanConstructor.cpp: (JSC::callBooleanConstructor): * runtime/BooleanPrototype.cpp: (JSC::booleanProtoFuncToString): (JSC::booleanProtoFuncValueOf): * runtime/CallData.h: * runtime/DateConstructor.cpp: (JSC::callDate): (JSC::dateParse): (JSC::dateNow): (JSC::dateUTC): * runtime/DatePrototype.cpp: (JSC::dateProtoFuncToString): (JSC::dateProtoFuncToUTCString): (JSC::dateProtoFuncToDateString): (JSC::dateProtoFuncToTimeString): (JSC::dateProtoFuncToLocaleString): (JSC::dateProtoFuncToLocaleDateString): (JSC::dateProtoFuncToLocaleTimeString): (JSC::dateProtoFuncGetTime): (JSC::dateProtoFuncGetFullYear): (JSC::dateProtoFuncGetUTCFullYear): (JSC::dateProtoFuncToGMTString): (JSC::dateProtoFuncGetMonth): (JSC::dateProtoFuncGetUTCMonth): (JSC::dateProtoFuncGetDate): (JSC::dateProtoFuncGetUTCDate): (JSC::dateProtoFuncGetDay): (JSC::dateProtoFuncGetUTCDay): (JSC::dateProtoFuncGetHours): (JSC::dateProtoFuncGetUTCHours): (JSC::dateProtoFuncGetMinutes): (JSC::dateProtoFuncGetUTCMinutes): (JSC::dateProtoFuncGetSeconds): (JSC::dateProtoFuncGetUTCSeconds): (JSC::dateProtoFuncGetMilliSeconds): (JSC::dateProtoFuncGetUTCMilliseconds): (JSC::dateProtoFuncGetTimezoneOffset): (JSC::dateProtoFuncSetTime): (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): (JSC::dateProtoFuncGetYear): * runtime/ErrorConstructor.cpp: (JSC::callErrorConstructor): * runtime/ErrorPrototype.cpp: (JSC::errorProtoFuncToString): * runtime/FunctionConstructor.cpp: (JSC::callFunctionConstructor): * runtime/FunctionPrototype.cpp: (JSC::callFunctionPrototype): (JSC::functionProtoFuncToString): (JSC::functionProtoFuncApply): (JSC::functionProtoFuncCall): * runtime/JSFunction.h: (JSC::JSFunction::nativeFunction): (JSC::JSFunction::setScopeChain): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncEval): (JSC::globalFuncParseInt): (JSC::globalFuncParseFloat): (JSC::globalFuncIsNaN): (JSC::globalFuncIsFinite): (JSC::globalFuncDecodeURI): (JSC::globalFuncDecodeURIComponent): (JSC::globalFuncEncodeURI): (JSC::globalFuncEncodeURIComponent): (JSC::globalFuncEscape): (JSC::globalFuncUnescape): (JSC::globalFuncJSCPrint): * runtime/JSGlobalObjectFunctions.h: * runtime/MathObject.cpp: (JSC::mathProtoFuncAbs): (JSC::mathProtoFuncACos): (JSC::mathProtoFuncASin): (JSC::mathProtoFuncATan): (JSC::mathProtoFuncATan2): (JSC::mathProtoFuncCeil): (JSC::mathProtoFuncCos): (JSC::mathProtoFuncExp): (JSC::mathProtoFuncFloor): (JSC::mathProtoFuncLog): (JSC::mathProtoFuncMax): (JSC::mathProtoFuncMin): (JSC::mathProtoFuncPow): (JSC::mathProtoFuncRandom): (JSC::mathProtoFuncRound): (JSC::mathProtoFuncSin): (JSC::mathProtoFuncSqrt): (JSC::mathProtoFuncTan): * runtime/NativeErrorConstructor.cpp: (JSC::callNativeErrorConstructor): * runtime/NativeFunctionWrapper.h: * runtime/NumberConstructor.cpp: (JSC::callNumberConstructor): * runtime/NumberPrototype.cpp: (JSC::numberProtoFuncToString): (JSC::numberProtoFuncToLocaleString): (JSC::numberProtoFuncValueOf): (JSC::numberProtoFuncToFixed): (JSC::numberProtoFuncToExponential): (JSC::numberProtoFuncToPrecision): * runtime/ObjectConstructor.cpp: (JSC::callObjectConstructor): * runtime/ObjectPrototype.cpp: (JSC::objectProtoFuncValueOf): (JSC::objectProtoFuncHasOwnProperty): (JSC::objectProtoFuncIsPrototypeOf): (JSC::objectProtoFuncDefineGetter): (JSC::objectProtoFuncDefineSetter): (JSC::objectProtoFuncLookupGetter): (JSC::objectProtoFuncLookupSetter): (JSC::objectProtoFuncPropertyIsEnumerable): (JSC::objectProtoFuncToLocaleString): (JSC::objectProtoFuncToString): * runtime/ObjectPrototype.h: * runtime/RegExpConstructor.cpp: (JSC::callRegExpConstructor): * runtime/RegExpObject.cpp: (JSC::callRegExpObject): * runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncTest): (JSC::regExpProtoFuncExec): (JSC::regExpProtoFuncCompile): (JSC::regExpProtoFuncToString): * runtime/StringConstructor.cpp: (JSC::stringFromCharCode): (JSC::callStringConstructor): * runtime/StringPrototype.cpp: (JSC::stringProtoFuncReplace): (JSC::stringProtoFuncToString): (JSC::stringProtoFuncCharAt): (JSC::stringProtoFuncCharCodeAt): (JSC::stringProtoFuncConcat): (JSC::stringProtoFuncIndexOf): (JSC::stringProtoFuncLastIndexOf): (JSC::stringProtoFuncMatch): (JSC::stringProtoFuncSearch): (JSC::stringProtoFuncSlice): (JSC::stringProtoFuncSplit): (JSC::stringProtoFuncSubstr): (JSC::stringProtoFuncSubstring): (JSC::stringProtoFuncToLowerCase): (JSC::stringProtoFuncToUpperCase): (JSC::stringProtoFuncLocaleCompare): (JSC::stringProtoFuncBig): (JSC::stringProtoFuncSmall): (JSC::stringProtoFuncBlink): (JSC::stringProtoFuncBold): (JSC::stringProtoFuncFixed): (JSC::stringProtoFuncItalics): (JSC::stringProtoFuncStrike): (JSC::stringProtoFuncSub): (JSC::stringProtoFuncSup): (JSC::stringProtoFuncFontcolor): (JSC::stringProtoFuncFontsize): (JSC::stringProtoFuncAnchor): (JSC::stringProtoFuncLink): * wtf/Platform.h: 2009-05-07 Geoffrey Garen Not reviewed. Rolled out a portion of r43352 because it broke 64bit. * jit/JITStubs.h: 2009-05-07 Kevin Ollivier Build fix for functions reaturning ThreadIdentifier. * wtf/ThreadingNone.cpp: (WTF::createThreadInternal): (WTF::currentThread): 2009-05-07 Maciej Stachowiak Reviewed by John Honeycutt. - enable optimization case im the last patch that I accidentally had disabled. * jit/JITArithmetic.cpp: (JSC::JIT::compileFastArithSlow_op_jnless): 2009-05-07 Dmitry Titov