2009-06-21 Oliver Hunt Reviewed by Sam Weinig. Bug 26594: JSC needs to support Date.toISOString Add support for Date.toISOString. * runtime/DatePrototype.cpp: (JSC::dateProtoFuncToISOString): 2009-06-21 Oliver Hunt Reviewed by NOBODY (Build fix). Remove dead code. * runtime/LiteralParser.cpp: (JSC::LiteralParser::parse): 2009-06-21 Oliver Hunt Reviewed by Darin Adler and Cameron Zwarich. Bug 26587: Support JSON.parse Extend the LiteralParser to support the full strict JSON grammar, fix a few places where the grammar was incorrectly lenient. Doesn't yet support the JSON.parse reviver function but that does not block the JSON.parse functionality itself. * interpreter/Interpreter.cpp: (JSC::Interpreter::callEval): * runtime/JSGlobalObjectFunctions.cpp: (JSC::globalFuncEval): * runtime/JSONObject.cpp: (JSC::JSONProtoFuncParse): * runtime/LiteralParser.cpp: (JSC::LiteralParser::Lexer::lex): (JSC::isSafeStringCharacter): (JSC::LiteralParser::Lexer::lexString): (JSC::LiteralParser::parse): * runtime/LiteralParser.h: (JSC::LiteralParser::LiteralParser): (JSC::LiteralParser::tryJSONParse): (JSC::LiteralParser::): (JSC::LiteralParser::Lexer::Lexer): 2009-06-21 David Levin Reviewed by NOBODY (speculative build fix for windows). Simply removed some whitespace form this file to make windows build wtf and hopefully copy the new MessageQueque.h so that WebCore picks it up. * wtf/Assertions.cpp: 2009-06-21 Drew Wilson Reviewed by David Levin. Added support for multi-threaded MessagePorts. * wtf/MessageQueue.h: (WTF::::appendAndCheckEmpty): Added API to test whether the queue was empty before adding an element. 2009-06-20 David D. Kilzer Fix namespace comment in SegmentedVector.h * wtf/SegmentedVector.h: Updated namespace comment to reflect new namespace after r44897. 2009-06-20 Zoltan Herczeg Bug 24986: ARM JIT port Reviewed by Oliver Hunt. An Iterator added for SegmentedVector. Currently only the pre ++ operator is supported. * wtf/SegmentedVector.h: (WTF::SegmentedVectorIterator::~SegmentedVectorIterator): (WTF::SegmentedVectorIterator::operator*): (WTF::SegmentedVectorIterator::operator->): (WTF::SegmentedVectorIterator::operator++): (WTF::SegmentedVectorIterator::operator==): (WTF::SegmentedVectorIterator::operator!=): (WTF::SegmentedVectorIterator::operator=): (WTF::SegmentedVectorIterator::SegmentedVectorIterator): (WTF::SegmentedVector::alloc): (WTF::SegmentedVector::begin): (WTF::SegmentedVector::end): 2009-06-20 Zoltan Herczeg Bug 24986: ARM JIT port Reviewed by Oliver Hunt. Move SegmentedVector to /wtf subdirectory and change "namespace JSC" to "namespace WTF" Additional build file updates by David Kilzer. * GNUmakefile.am: Updated path to SegmentedVector.h. * JavaScriptCore.order: Updated SegmentedVector namespace from JSC to WTF in mangled C++ method name. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Removed reference to bytecompiler\SegmentedVector.h. * JavaScriptCore.vcproj/WTF/WTF.vcproj: Added reference to wtf\SegmentedVector.h. * JavaScriptCore.xcodeproj/project.pbxproj: Moved SegmentedVector.h definition from bytecompiler subdirectory to wtf subdirectory. * bytecompiler/BytecodeGenerator.h: Updated #include path to SegmentedVector.h and prepended WTF:: namespace to its use. * parser/Lexer.h: Ditto. * wtf/SegmentedVector.h: Renamed from JavaScriptCore/bytecompiler/SegmentedVector.h. (WTF::SegmentedVector::SegmentedVector): (WTF::SegmentedVector::~SegmentedVector): (WTF::SegmentedVector::size): (WTF::SegmentedVector::at): (WTF::SegmentedVector::operator[]): (WTF::SegmentedVector::last): (WTF::SegmentedVector::append): (WTF::SegmentedVector::removeLast): (WTF::SegmentedVector::grow): (WTF::SegmentedVector::clear): (WTF::SegmentedVector::deleteAllSegments): (WTF::SegmentedVector::segmentExistsFor): (WTF::SegmentedVector::segmentFor): (WTF::SegmentedVector::subscriptFor): (WTF::SegmentedVector::ensureSegmentsFor): (WTF::SegmentedVector::ensureSegment): 2009-06-19 Gavin Barraclough Reviewed by NOBODY (build fix take 2 - rename FIELD_OFFSET to something that doesn't conflict with winnt.h). * jit/JIT.cpp: (JSC::JIT::privateCompile): (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC::JIT::emitGetVariableObjectRegister): (JSC::JIT::emitPutVariableObjectRegister): * jit/JIT.h: * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_rshift): (JSC::JIT::emitSlow_op_jnless): (JSC::JIT::emitSlow_op_jnlesseq): (JSC::JIT::compileBinaryArithOp): * jit/JITCall.cpp: (JSC::JIT::compileOpCallInitializeCallFrame): (JSC::JIT::compileOpCall): * jit/JITInlineMethods.h: (JSC::JIT::restoreArgumentReference): (JSC::JIT::checkStructure): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_instanceof): (JSC::JIT::emit_op_get_scoped_var): (JSC::JIT::emit_op_put_scoped_var): (JSC::JIT::emit_op_construct_verify): (JSC::JIT::emit_op_resolve_global): (JSC::JIT::emit_op_jeq_null): (JSC::JIT::emit_op_jneq_null): (JSC::JIT::emit_op_to_jsnumber): (JSC::JIT::emit_op_catch): (JSC::JIT::emit_op_eq_null): (JSC::JIT::emit_op_neq_null): (JSC::JIT::emit_op_convert_this): (JSC::JIT::emit_op_profile_will_call): (JSC::JIT::emit_op_profile_did_call): (JSC::JIT::emitSlow_op_get_by_val): * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_get_by_val): (JSC::JIT::emit_op_put_by_val): (JSC::JIT::emit_op_method_check): (JSC::JIT::compileGetByIdHotPath): (JSC::JIT::emit_op_put_by_id): (JSC::JIT::compilePutDirectOffset): (JSC::JIT::compileGetDirectOffset): (JSC::JIT::privateCompilePutByIdTransition): (JSC::JIT::privateCompilePatchGetArrayLength): * jit/JITStubs.cpp: (JSC::JITThunks::JITThunks): 2009-06-19 Gavin Barraclough Reviewed by NOBODY (Windows build fix). * jit/JIT.h: * jit/JITInlineMethods.h: 2009-06-19 Gabor Loki Reviewed by Gavin Barraclough. Reorganize ARM architecture specific macros. Use PLATFORM_ARM_ARCH(7) instead of PLATFORM(ARM_V7). Bug 24986: ARM JIT port * assembler/ARMv7Assembler.h: * assembler/AbstractMacroAssembler.h: (JSC::AbstractMacroAssembler::Imm32::Imm32): * assembler/MacroAssembler.h: * assembler/MacroAssemblerCodeRef.h: (JSC::MacroAssemblerCodePtr::MacroAssemblerCodePtr): * jit/ExecutableAllocator.h: (JSC::ExecutableAllocator::cacheFlush): * jit/JIT.h: * jit/JITInlineMethods.h: (JSC::JIT::restoreArgumentReferenceForTrampoline): * jit/JITStubs.cpp: * jit/JITStubs.h: * wtf/Platform.h: * yarr/RegexJIT.cpp: (JSC::Yarr::RegexGenerator::generateEnter): (JSC::Yarr::RegexGenerator::generateReturn): 2009-06-19 Gavin Barraclough Reviewed by Oliver Hunt. Fix armv7 JIT build issues. Unfortunate the arm compiler does not like the use of offsetof on JITStackFrame (since it now contains non POD types), and the FIELD_OFFSET macro does not appear constantish enough for it to be happy with its use in COMPILE_ASSERT macros. * Replace offsetofs with FIELD_OFFSETs (safe on C++ objects). * Move COMPILE_ASSERTs defending layout of JITStackFrame structure on armv7 into JITThunks constructor. * jit/JIT.cpp: * jit/JIT.h: * jit/JITInlineMethods.h: (JSC::JIT::restoreArgumentReference): * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_catch): * jit/JITStubs.cpp: (JSC::JITThunks::JITThunks): 2009-06-19 Adam Treat Blind attempt at build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: 2009-06-19 Zoltan Horvath Reviewed by Oliver Hunt. Inherits CallIdentifier struct from FastAllocBase because it has been instantiated by 'new' in JavaScriptCore/profiler/CallIdentifier.h:86. * wtf/HashCountedSet.h: 2009-06-19 Adam Treat Reviewed by Oliver Hunt. https://bugs.webkit.org/show_bug.cgi?id=26540 Modify the test shell to add a new function 'checkSyntax' that will only parse the source instead of executing it. In this way we can test pure parsing performance against some of the larger scripts in the wild. * jsc.cpp: (GlobalObject::GlobalObject): (functionCheckSyntax): 2009-06-19 Zoltan Horvath Reviewed by Darin Adler. Inherits HashCountedSet class from FastAllocBase because it has been instantiated by 'new' in JavaScriptCore/runtime/Collector.cpp:1095. * wtf/HashCountedSet.h: 2009-06-19 Yong Li Reviewed by George Staikos. https://bugs.webkit.org/show_bug.cgi?id=26558 Declare these symbols extern for WINCE as they are provided by libce. * runtime/DateConstructor.cpp: * runtime/DatePrototype.cpp: (JSC::formatLocaleDate): 2009-06-19 Oliver Hunt Reviewed by Maciej Stachowiak. ScopeChain leak in interpreter builds Move the Scopechain destruction code in JSFunction outside of the ENABLE(JIT) path. * runtime/JSFunction.cpp: (JSC::JSFunction::~JSFunction): * wtf/Platform.h: 2009-06-19 Yong Li Reviewed by George Staikos. https://bugs.webkit.org/show_bug.cgi?id=26543 Windows CE uses 'GetLastError' instead of 'errno.' * interpreter/RegisterFile.h: (JSC::RegisterFile::RegisterFile): (JSC::RegisterFile::grow): 2009-06-19 David Levin Reviewed by NOBODY (Windows build fix). Add export for Windows corresponding to OSX export done in r44844. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore_debug.def: 2009-06-18 Oliver Hunt Reviewed by Gavin "Viceroy of Venezuela" Barraclough. Bug 26532: Native functions do not correctly unlink from optimised callsites when they're collected We need to make sure that each native function instance correctly unlinks any references to it when it is collected. Allowing this to happen required a few changes: * Every native function needs a codeblock to track the link information * To have this codeblock, every function now also needs its own functionbodynode so we no longer get to have a single shared instance. * Identifying a host function is now done by looking for CodeBlock::codeType() == NativeCode * JavaScriptCore.exp: * bytecode/CodeBlock.cpp: (JSC::CodeBlock::CodeBlock): Constructor for NativeCode CodeBlock (JSC::CodeBlock::derefStructures): (JSC::CodeBlock::refStructures): (JSC::CodeBlock::reparseForExceptionInfoIfNecessary): (JSC::CodeBlock::handlerForBytecodeOffset): (JSC::CodeBlock::lineNumberForBytecodeOffset): (JSC::CodeBlock::expressionRangeForBytecodeOffset): (JSC::CodeBlock::getByIdExceptionInfoForBytecodeOffset): (JSC::CodeBlock::functionRegisterForBytecodeOffset): (JSC::CodeBlock::hasGlobalResolveInstructionAtBytecodeOffset): (JSC::CodeBlock::hasGlobalResolveInfoAtBytecodeOffset): (JSC::CodeBlock::setJITCode): Add assertions to ensure we don't try and use NativeCode CodeBlocks as a normal codeblock. * bytecode/CodeBlock.h: (JSC::): (JSC::CodeBlock::source): (JSC::CodeBlock::sourceOffset): (JSC::CodeBlock::evalCodeCache): (JSC::CodeBlock::createRareDataIfNecessary): More assertions. * jit/JIT.cpp: (JSC::JIT::privateCompileCTIMachineTrampolines): (JSC::JIT::linkCall): Update logic to allow native function caching * jit/JITStubs.cpp: * parser/Nodes.cpp: (JSC::FunctionBodyNode::createNativeThunk): (JSC::FunctionBodyNode::isHostFunction): * parser/Nodes.h: * runtime/JSFunction.cpp: (JSC::JSFunction::JSFunction): (JSC::JSFunction::~JSFunction): (JSC::JSFunction::mark): * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::~JSGlobalData): * runtime/JSGlobalData.h: 2009-06-18 Gavin Barraclough Reviewed by NOBODY (Windows build fix). * wtf/DateMath.cpp: (WTF::calculateUTCOffset): 2009-06-18 Gavin Barraclough Reviewed by Geoff Garen. Timezone calculation incorrect in Venezuela. https://bugs.webkit.org/show_bug.cgi?id=26531 Time is incorrectly reported to JavaScript in both Safari 3 and Firefox 3 The problem is that we're calculating the timezone relative to 01/01/2000, but the VET timezone changed from -4 hours to -4:30 hours on 12/09/2007. According to the spec, section 15.9.1.9 states "the time since the beginning of the year", presumably meaning the *current* year. Change the calculation to be based on whatever the current year is, rather than a canned date. No performance impact. * wtf/DateMath.cpp: (WTF::calculateUTCOffset): 2009-06-18 Gavin Barraclough Rubber Stamped by Mark Rowe (originally reviewed by Sam Weinig). (Reintroducing patch added in r44492, and reverted in r44796.) 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-18 Kevin McCullough Reviewed by Oliver Hunt. REGRESSION: Breakpoints don't break in 64-bit - Exposed functions now needed by WebCore. * JavaScriptCore.exp: 2009-06-17 Darin Adler Reviewed by Oliver Hunt. Bug 26429: Make JSON.stringify non-recursive so it can handle objects of arbitrary complexity https://bugs.webkit.org/show_bug.cgi?id=26429 For marking I decided not to use gcProtect, because this is inside the engine so it's easy enough to just do marking. And that darned gcProtect does locking! Oliver tried to convince me to used MarkedArgumentBuffer, but the constructor for that class says "FIXME: Remove all clients of this API, then remove this API." * runtime/Collector.cpp: (JSC::Heap::collect): Add a call to JSONObject::markStringifiers. * runtime/CommonIdentifiers.cpp: (JSC::CommonIdentifiers::CommonIdentifiers): Added emptyIdentifier. * runtime/CommonIdentifiers.h: Ditto. * runtime/JSGlobalData.cpp: (JSC::JSGlobalData::JSGlobalData): Initialize firstStringifierToMark to 0. * runtime/JSGlobalData.h: Added firstStringifierToMark. * runtime/JSONObject.cpp: Cut down the includes to the needed ones only. (JSC::unwrapNumberOrString): Added. Helper for unwrapping number and string objects to get their number and string values. (JSC::ReplacerPropertyName::ReplacerPropertyName): Added. The class is used to wrap an identifier or integer so we don't have to do any work unless we actually call a replacer. (JSC::ReplacerPropertyName::value): Added. (JSC::gap): Added. Helper function for the Stringifier constructor. (JSC::PropertyNameForFunctionCall::PropertyNameForFunctionCall): Added. The class is used to wrap an identifier or integer so we don't have to allocate a number or string until we actually call toJSON or a replacer. (JSC::PropertyNameForFunctionCall::asJSValue): Added. (JSC::Stringifier::Stringifier): Updated and moved out of the class definition. Added code to hook this into a singly linked list for marking. (JSC::Stringifier::~Stringifier): Remove from the singly linked list. (JSC::Stringifier::mark): Mark all the objects in the holder stacks. (JSC::Stringifier::stringify): Updated. (JSC::Stringifier::appendQuotedString): Tweaked and streamlined a bit. (JSC::Stringifier::toJSON): Renamed from toJSONValue. (JSC::Stringifier::appendStringifiedValue): Renamed from stringify. Added code to use the m_holderStack to do non-recursive stringify of objects and arrays. This code also uses the timeout checker since in pathological cases it could be slow even without calling into the JavaScript virtual machine. (JSC::Stringifier::willIndent): Added. (JSC::Stringifier::indent): Added. (JSC::Stringifier::unindent): Added. (JSC::Stringifier::startNewLine): Added. (JSC::Stringifier::Holder::Holder): Added. (JSC::Stringifier::Holder::appendNextProperty): Added. This is the function that handles the format of arrays and objects. (JSC::JSONObject::getOwnPropertySlot): Moved this down to the bottom of the file so the JSONObject class is not interleaved with the Stringifier class. (JSC::JSONObject::markStringifiers): Added. Calls mark. (JSC::JSONProtoFuncStringify): Streamlined the code here. The code to compute the gap string is now a separate function. * runtime/JSONObject.h: Made everything private. Added markStringifiers. 2009-06-17 Oliver Hunt Reviewed by Gavin Barraclough. REGRESSION(r43849): Crash in cti_op_call_NotJSFunction when getting directions on maps.google.com Roll out r43849 as it appears that we cannot rely on the address of an objects property storage being constant even if the structure is unchanged. * jit/JIT.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::compileGetDirectOffset): (JSC::JIT::privateCompileGetByIdProto): (JSC::JIT::privateCompileGetByIdProtoList): (JSC::JIT::privateCompileGetByIdChainList): (JSC::JIT::privateCompileGetByIdChain): 2009-06-17 Gavin Barraclough Rubber Stamped by Mark Rowe. Fully revert r44492 & r44748 while we fix a bug they cause on internal builds . * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_throw): * jit/JITStubs.cpp: (JSC::): (JSC::JITStubs::DEFINE_STUB_FUNCTION): * jit/JITStubs.h: 2009-06-17 Gavin Barraclough Reviewed by Mark Rowe. sunspider math-cordic.js exhibits different intermediate results running 32-bit vs. 64-bit On 64-bit, NaN-encoded values must be detagged before they can be used in rshift. No performance impact. * jit/JITArithmetic.cpp: (JSC::JIT::emit_op_rshift): 2009-06-17 Adam Treat Reviewed by George Staikos. https://bugs.webkit.org/show_bug.cgi?id=23155 Move WIN_CE -> WINCE as previously discussed with Qt WINCE folks. * jsc.cpp: (main): 2009-06-17 George Staikos Reviewed by Adam Treat. https://bugs.webkit.org/show_bug.cgi?id=23155 Move WIN_CE -> WINCE as previously discussed with Qt WINCE folks. * config.h: * jsc.cpp: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/CurrentTime.cpp: (WTF::lowResUTCTime): * wtf/DateMath.cpp: (WTF::getLocalTime): * wtf/MathExtras.h: * wtf/Platform.h: * wtf/StringExtras.h: * wtf/Threading.h: * wtf/win/MainThreadWin.cpp: 2009-06-17 Gavin Barraclough Reviewed by Oliver Hunt. ASSERT in JITStubs.cpp at appsaccess.apple.com Remove PropertySlot::putValue - PropertySlots should only be used for getting, not putting. Rename JSGlobalObject::getOwnPropertySlot to hasOwnPropertyForWrite, which is what it really was being used to ask, and remove some other getOwnPropertySlot & getOwnPropertySlotForWrite methods, which were unused and likely to lead to confusion. * runtime/JSGlobalObject.h: (JSC::JSGlobalObject::hasOwnPropertyForWrite): * runtime/JSObject.h: * runtime/JSStaticScopeObject.cpp: * runtime/JSStaticScopeObject.h: * runtime/PropertySlot.h: 2009-06-16 Gavin Barraclough Reviewed by Oliver hunt. Temporarily partially disable r44492, since this is causing some problems on internal builds. * jit/JITOpcodes.cpp: (JSC::JIT::emit_op_throw): * jit/JITStubs.cpp: (JSC::JITStubs::DEFINE_STUB_FUNCTION): 2009-06-16 Sam Weinig Fix windows build. * jit/JIT.cpp: (JSC::JIT::JIT): 2009-06-16 Sam Weinig Reviewed by Oliver Hunt. Initialize m_bytecodeIndex to -1 in JIT, and correctly initialize it for each type of stub using the return address to find the correct offset. * jit/JIT.cpp: (JSC::JIT::JIT): * jit/JIT.h: (JSC::JIT::compileGetByIdProto): (JSC::JIT::compileGetByIdSelfList): (JSC::JIT::compileGetByIdProtoList): (JSC::JIT::compileGetByIdChainList): (JSC::JIT::compileGetByIdChain): (JSC::JIT::compilePutByIdTransition): (JSC::JIT::compileCTIMachineTrampolines): (JSC::JIT::compilePatchGetArrayLength): * jit/JITStubCall.h: (JSC::JITStubCall::call): == Rolled over to ChangeLog-2009-06-16 ==