See More

2008-08-10 Jan Michael Alonzo Reviewed (and updated) by Alp Toker. https://bugs.webkit.org/show_bug.cgi?id=16620 [GTK] Autotools make dist and make check support Get make dist working. Note that not all possible configurations have been tested yet. * GNUmakefile.am: 2008-08-09 Alexey Proskuryakov Reviewed by Sam Weinig. Added same heap debug checks to more code paths. * kjs/JSActivation.cpp: (KJS::JSActivation::put): (KJS::JSActivation::putWithAttributes): * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::putWithAttributes): * kjs/JSObject.h: (KJS::JSObject::putDirect): * kjs/JSVariableObject.h: (KJS::JSVariableObject::symbolTablePut): (KJS::JSVariableObject::symbolTablePutWithAttributes): 2008-08-09 Cameron Zwarich Reviewed by Maciej. Fix some style issues in the sampling tool. * VM/SamplingTool.cpp: (KJS::sleepForMicroseconds): (KJS::SamplingTool::dump): 2008-08-09 Cameron Zwarich Reviewed by Oliver. Revision 35651, despite being a rather trivial change, introduced a large regression on the regexp-dna SunSpider test. This regression stemmed from an increase in the size of CodeBlock::dump(). There is no reason for this method (and several related methods) to be compiled in non-debug builds with the sampling tool disabled. This patch conditionally compiles them, reversing the regression on SunSpider. * JavaScriptCore.exp: * VM/CodeBlock.cpp: * VM/CodeBlock.h: * VM/Machine.cpp: 2008-08-08 Cameron Zwarich Reviewed by Oliver. Bug 20330: JSCore crash loading any filehurricane media page Fix a typo in the constant loading patch. Also, add a case for op_unexpected_load to CodeBlock::dump(). * VM/CodeBlock.cpp: (KJS::CodeBlock::dump): * VM/CodeGenerator.cpp: (KJS::CodeGenerator::addUnexpectedConstant): 2008-08-08 Matt Lilek Not reviewed, build fix. * JavaScriptCore.exp: 2008-08-08 Oliver Hunt Reviewed by Cameron Zwarich. Improve performance of arithmetic operators Added a fast (non-virtual) mechanism to determine if a non-immediate JSValue* is a JSNumberCell. We then use this to allow improved specialisation in many arithmetic operators. SunSpider reports a 2.5% progression overall, with greater than 10% progressions on a number of arithmetic heavy tests. * VM/Machine.cpp: (KJS::fastIsNumber): (KJS::fastToInt32): (KJS::fastToUInt32): (KJS::jsLess): (KJS::jsLessEq): (KJS::jsAdd): (KJS::Machine::privateExecute): * kjs/JSNumberCell.h: (KJS::JSNumberCell::fastToInt32): (KJS::JSNumberCell::fastToUInt32): * kjs/collector.cpp: (KJS::allocateBlock): (KJS::Heap::heapAllocate): * kjs/collector.h: (KJS::Heap::fastIsNumber): 2008-08-06 Adam Roben Try to fix the Windows build bots * API/JSBase.cpp: Touch this to force JSC to rebuild and re-copy the WTF headers. 2008-08-06 Tor Arne Vestbø Revert change 35595. * wtf/RetainPtr.h: 2008-08-06 Ariya Hidayat Fix non-Mac build. * wtf/RetainPtr.h: CoreFoundation only for PLATFORM(MAC) 2008-08-06 Ariya Hidayat Fix non-Mac build. * wtf/RetainPtr.h: CoreFoundation only for PLATFORM(MAC) 2008-08-06 Csaba Osztrogonac Reviewed by Darin. Landed by Cameron. Bug 20272: typo in JavaScriptCore Correct the documentation for op_not. (typo) Fix #undef. (typo) * VM/Machine.cpp: (KJS::Machine::privateExecute): 2008-08-06 Cameron Zwarich Reviewed by Maciej. Bug 20286: Load constants all at once instead of using op_load Load constants all at once into temporary registers instead of using individual instances of op_load. This is a 2.6% speedup on SunSpider. * JavaScriptCore.exp: * VM/CodeBlock.cpp: (KJS::CodeBlock::dump): (KJS::CodeBlock::mark): * VM/CodeBlock.h: * VM/CodeGenerator.cpp: (KJS::CodeGenerator::CodeGenerator): (KJS::CodeGenerator::newTemporary): (KJS::CodeGenerator::addConstant): (KJS::CodeGenerator::addUnexpectedConstant): (KJS::CodeGenerator::emitLoad): (KJS::CodeGenerator::emitUnexpectedLoad): (KJS::CodeGenerator::emitNewError): * VM/CodeGenerator.h: * VM/Machine.cpp: (KJS::slideRegisterWindowForCall): (KJS::Machine::unwindCallFrame): (KJS::Machine::throwException): (KJS::Machine::execute): (KJS::Machine::privateExecute): * VM/Machine.h: * VM/Opcode.h: * VM/RegisterID.h: (KJS::RegisterID::RegisterID): (KJS::RegisterID::makeConstant): (KJS::RegisterID::isTemporary): * kjs/NodeInfo.h: * kjs/Parser.cpp: (KJS::Parser::didFinishParsing): * kjs/Parser.h: (KJS::Parser::parse): * kjs/grammar.y: * kjs/nodes.cpp: (KJS::NullNode::emitCode): (KJS::BooleanNode::emitCode): (KJS::NumberNode::emitCode): (KJS::StringNode::emitCode): (KJS::ArrayNode::emitCode): (KJS::DeleteResolveNode::emitCode): (KJS::DeleteValueNode::emitCode): (KJS::VoidNode::emitCode): (KJS::ConstDeclNode::emitCodeSingle): (KJS::ReturnNode::emitCode): (KJS::ScopeNode::ScopeNode): (KJS::ProgramNode::ProgramNode): (KJS::ProgramNode::create): (KJS::EvalNode::EvalNode): (KJS::EvalNode::create): (KJS::FunctionBodyNode::FunctionBodyNode): (KJS::FunctionBodyNode::create): (KJS::FunctionBodyNode::emitCode): * kjs/nodes.h: (KJS::ScopeNode::neededConstants): 2008-08-05 Maciej Stachowiak Reviewed by Cameron. - add fast path for immediates to % operator, as we have for many other math ops This fixes handling for a 0 divisor relative to the last patch. Only an 0.2% speedup on SunSpider but still a 1.4x win on Oliver's prime test. * VM/Machine.cpp: (KJS::Machine::privateExecute): 2008-08-05 Cameron Zwarich Reviewed by Darin. Bug 20293: Crash in JavaScript codegen for eval("const a;") Correctly handle constant declarations in eval code with no initializer. * kjs/nodes.cpp: (KJS::ConstDeclNode::emitCodeSingle): 2008-08-05 Cameron Zwarich Reviewed by Oliver. Roll out r35555 because of correctness issues. * VM/Machine.cpp: (KJS::Machine::privateExecute): 2008-08-05 Maciej Stachowiak Reviewed by Geoff. - add fast path for immediates to % operator, as we have for many other math ops 0.6% speedup on SunSpider. 1.4x speedup on a prime testing torture test that Oliver whipped up. * VM/Machine.cpp: (KJS::Machine::privateExecute): 2008-07-31 Oliver Hunt Reviewed by Cameron Zwarich. Bug 19359: JavaScriptCore behaves differently from FF2/3 and IE when handling context in catch statement Make our catch behave like Firefox and IE, we do this by using a StaticScopeObject instead of a generic JSObject for the scope node. We still don't make use of the fact that we have a static scope inside the catch block, so the internal performance of the catch block is not improved, even though technically it would be possible to do so. * VM/CodeBlock.cpp: (KJS::CodeBlock::dump): * VM/CodeGenerator.cpp: (KJS::CodeGenerator::emitPushNewScope): * VM/CodeGenerator.h: * VM/Machine.cpp: (KJS::createExceptionScope): (KJS::Machine::privateExecute): * VM/Machine.h: * VM/Opcode.h: * kjs/JSStaticScopeObject.cpp: (KJS::JSStaticScopeObject::toThisObject): (KJS::JSStaticScopeObject::put): * kjs/JSStaticScopeObject.h: * kjs/nodes.cpp: (KJS::TryNode::emitCode): 2008-08-02 Rob Gowin Reviewed by Eric Seidel. Added JavaScriptCore/API/WebKitAvailability to list of files in javascriptcore_h_api. * GNUmakefile.am: 2008-08-01 Alexey Proskuryakov Rubber-stamped by Maciej. Remove JSGlobalData::DataInstance. It was only needed when we had per-thread JSGlobalData instances. * kjs/JSGlobalData.h: 2008-07-31 Kevin Ollivier Second attempt at Windows/wx build fix. Instead of avoiding inclusion of windows.h, use defines, etc. to avoid conflicts in each affected file. Also, change PLATFORM(WIN) to PLATFORM(WIN_OS) so that other ports using Windows headers get the right impls. * VM/SamplingTool.cpp: * wtf/Threading.h: 2008-07-31 Anders Carlsson Reviewed by Adam. Fix Windows build. * kjs/collector.h: * wtf/FastMalloc.cpp: 2008-07-31 Csaba Osztrogonac Reviewed by Simon. Bug 20170: [Qt] missing namespace defines in JavaScriptCore.pro * JavaScriptCore.pro: Added missing define. 2008-07-31 Alexey Proskuryakov Rubber-stamped by Maciej. Eliminate JSLock (it was already disabled, removing the stub implementaion and all call sites now). * API/JSBase.cpp: (JSEvaluateScript): (JSCheckScriptSyntax): (JSGarbageCollect): * API/JSCallbackConstructor.cpp: (KJS::constructJSCallback): * API/JSCallbackFunction.cpp: (KJS::JSCallbackFunction::call): * API/JSCallbackObjectFunctions.h: (KJS::::init): (KJS::::getOwnPropertySlot): (KJS::::put): (KJS::::deleteProperty): (KJS::::construct): (KJS::::hasInstance): (KJS::::call): (KJS::::getPropertyNames): (KJS::::toNumber): (KJS::::toString): (KJS::::staticValueGetter): (KJS::::callbackGetter): * API/JSContextRef.cpp: (JSGlobalContextCreateInGroup): (JSGlobalContextRetain): (JSGlobalContextRelease): * API/JSObjectRef.cpp: (JSObjectMake): (JSObjectMakeFunctionWithCallback): (JSObjectMakeConstructor): (JSObjectMakeFunction): (JSObjectHasProperty): (JSObjectGetProperty): (JSObjectSetProperty): (JSObjectGetPropertyAtIndex): (JSObjectSetPropertyAtIndex): (JSObjectDeleteProperty): (JSObjectCallAsFunction): (JSObjectCallAsConstructor): (JSObjectCopyPropertyNames): (JSPropertyNameArrayRelease): (JSPropertyNameAccumulatorAddName): * API/JSStringRef.cpp: (JSStringRelease): * API/JSValueRef.cpp: (JSValueIsEqual): (JSValueIsInstanceOfConstructor): (JSValueMakeNumber): (JSValueMakeString): (JSValueToNumber): (JSValueToStringCopy): (JSValueToObject): (JSValueProtect): (JSValueUnprotect): * ForwardingHeaders/JavaScriptCore/JSLock.h: Removed. * GNUmakefile.am: * JavaScriptCore.exp: * JavaScriptCore.order: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * kjs/AllInOneFile.cpp: * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::JSGlobalData): * kjs/JSGlobalData.h: * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::~JSGlobalObject): (KJS::JSGlobalObject::init): * kjs/JSLock.cpp: Removed. * kjs/JSLock.h: Removed. * kjs/Shell.cpp: (functionGC): (jscmain): * kjs/collector.cpp: (KJS::Heap::~Heap): (KJS::Heap::heapAllocate): (KJS::Heap::setGCProtectNeedsLocking): (KJS::Heap::protect): (KJS::Heap::unprotect): (KJS::Heap::collect): * kjs/identifier.cpp: * kjs/interpreter.cpp: (KJS::Interpreter::checkSyntax): (KJS::Interpreter::evaluate): 2008-07-31 Alexey Proskuryakov Rubber-stamped by Oliver Hunt. Fix the Mac project to not display "test/" as part of file name for tests. * JavaScriptCore.xcodeproj/project.pbxproj: 2008-07-31 Eric Seidel Reviewed by Alexey Proskuryakov. Rename USE(MULTIPLE_THREADS) to ENABLE(JSC_MULTIPLE_THREADS) to better match the use/enable pattern (and better describe the usage of the feature in question.) I also fixed a couple other ENABLE_ macros to be pre-processor definition override-able to match the rest of the ENABLE_ macros since it seems to be our convention that build systems can set ENABLE_ macros in Makefiles. * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::JSGlobalData): (KJS::JSGlobalData::~JSGlobalData): * kjs/MathObject.cpp: * kjs/collector.cpp: (KJS::Heap::Heap): (KJS::Heap::~Heap): (KJS::allocateBlock): (KJS::Heap::markStackObjectsConservatively): * kjs/collector.h: * kjs/dtoa.cpp: (KJS::pow5mult): (KJS::rv_alloc): (KJS::freedtoa): (KJS::dtoa): * wtf/FastMalloc.cpp: * wtf/Platform.h: * wtf/RefCountedLeakCounter.cpp: 2008-07-30 Eric Seidel Reviewed by Mark Rowe. Try to clean up our usage of USE(MULTIPLE_THREADS) vs. USE(PTHREADS) a little. It looks like JSC assumes that if MULTIPLE_THREADS is defined, then pthreads will always be available I'm not sure that's always the case for gtk, certainly not for Windows. We should eventually go back and fix wtf/Threading.h to cover all these cases some day. * kjs/JSLock.cpp: * kjs/collector.h: * wtf/Platform.h: 2008-07-30 Eric Seidel Reviewed by Oliver. MSVC warns when structs are called classes or vice versa. Make all the source refer to JSGlobalData as a class. * kjs/CommonIdentifiers.h: * kjs/JSGlobalData.h: * kjs/Parser.h: * kjs/lexer.h: 2008-07-30 Alexey Proskuryakov Reviewed by Geoff Garen. Add consistency checks to UString to document and enforce its design. * kjs/ustring.cpp: (KJS::UString::Rep::create): (KJS::UString::Rep::destroy): (KJS::UString::Rep::checkConsistency): (KJS::UString::expandCapacity): (KJS::UString::expandPreCapacity): (KJS::UString::UString): (KJS::UString::spliceSubstringsWithSeparators): (KJS::UString::append): * kjs/ustring.h: (KJS::UString::Rep::checkConsistency): 2008-07-30 Gavin Barraclough Reviewed by Geoff Garen. Fixes for Windows and non-AllInOne file build with SamplingTool, plus review fixes. * GNUmakefile.am: Adding SamplingTool.cpp to build. * JavaScriptCore.exp: Export hooks to init & control SamplingTool. * JavaScriptCore.pri: Adding SamplingTool.cpp to build. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Adding SamplingTool.cpp to build. * JavaScriptCore.xcodeproj/project.pbxproj: Adding SamplingTool.cpp to build. * JavaScriptCoreSources.bkl: Adding SamplingTool.cpp to build. * VM/Machine.cpp: MACHINE_SAMPLING_callingNativeFunction renamed MACHINE_SAMPLING_callingHostFunction * VM/Machine.h: * VM/Opcode.cpp: SamplingTool moved to SamplingTool.cpp/.h, opcodeNames generated from FOR_EACH_OPCODE_ID. * VM/Opcode.h: * VM/SamplingTool.cpp: Added .cpp/.h for SamplingTool. * VM/SamplingTool.h: * kjs/Shell.cpp: Switched SAMPLING_TOOL_ENABLED to ENABLE_SAMPLING_TOOL. * wtf/Platform.h: Added ENABLE_SAMPLING_TOOL config option. * kjs/nodes.cpp: Header include to fix non-AllInOne builds. 2008-07-30 Ariya Hidayat Reviewed by Alexey Proskuryakov. Fix compilation without multi-threading support. * kjs/collector.cpp: (KJS::Heap::Heap): 2008-07-30 Anders Carlsson Add WebKitAvailability.h forwarding header. * ForwardingHeaders/JavaScriptCore/WebKitAvailability.h: Added. 2008-07-30 Anders Carlsson Fix the else. * API/WebKitAvailability.h: 2008-07-30 Anders Carlsson * API/WebKitAvailability.h: Fix Windows (and other non-Mac builds). * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add WebKitAvailability.h to the project. 2008-07-30 Anders Carlsson One step closer towards fixing the Windows build. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreGenerated.make: Make sure to copy WebKitAvailability.h 2008-07-29 Gavin Barraclough Reviewed by Geoff Garen. Bug 20209: Atomize constant strings Prevents significant performance degradation seen when a script contains multiple identical strings that are used as keys to identify properties on objects. No performance change on SunSpider. * kjs/nodes.cpp: Atomize constant strings. 2008-07-30 Oliver Hunt Reviewed by Alexey Proskuryakov. JavaScript exceptions fail if the scope chain includes the global object In an attempt to remove the branch I just added to KJS::depth I used the existence of a Variable Object at a point in the scope chain as an indicator of function or global scope activation. However this assumption results in incorrect behaviour if the global object is injected into the scope chain with 'with'. * VM/Machine.cpp: (KJS::depth): 2008-07-30 Alexey Proskuryakov Reviewed by Geoff Garen. Don't call JSGarbageCollect() on a released context. * API/testapi.c: (main): 2008-07-29 Alexey Proskuryakov Reviewed by Geoff Garen. Implement JSContextGroup APIs to make concurrent execution possible for JavaScriptCore clients. This changes the behavior of JSGlobalContextCreate(), so that it now uses a private context group for each context, making JSlock implicit locking unnecessary. * API/JSContextRef.h: * API/JSContextRef.cpp: (JSContextGroupCreate): (JSContextGroupRetain): (JSContextGroupRelease): (JSGlobalContextCreate): (JSGlobalContextCreateInGroup): (JSGlobalContextRelease): (JSContextGetGroup): Added new methods. JSGlobalContextCreate() calls JSGlobalContextCreateInGroup() now. * API/APICast.h: (toJS): (toRef): Added converters for JSContextGroupRef. * API/JSBase.cpp: (JSGarbageCollect): JSGarbageCollect(0) is now a no-op, and the passed in context is actually used. * API/JSBase.h: Aded a typedef for JSContextGroupRef. Updated documentation for JSGarbageCollect(). * JavaScriptCore.exp: Removed JSGlobalData::sharedInstance(). * kjs/JSGlobalData.cpp: * kjs/JSGlobalData.h: Removed support for JSGlobalData shared instance. JSGlobalData::isSharedInstance member variable still remains, to be deleted in a followup patch. * kjs/JSLock.cpp: (KJS::JSLock::JSLock): Disabled JSLock, to be deleted in a follow-up patch. * kjs/collector.cpp: (KJS::Heap::markOtherThreadConservatively): Removed an assertion that referenced JSGlobalData::sharedInstance. * kjs/collector.h: Made Heap destructor public, so that JSContextRelease can use it. 2008-07-29 Alexey Proskuryakov Reviewed by Geoff Garen. Fix a leak of ThreadRegistrar objects. As the heap is usually deleted when registered threads still exist, ThreadSpecific doesn't have a chance to clean up per-thread object. Switched to native pthread calls, storing a plain pointer that doesn't require cleanup. * kjs/collector.cpp: (KJS::PlatformThread::PlatformThread): (KJS::Heap::Thread::Thread): (KJS::Heap::Heap): (KJS::Heap::~Heap): (KJS::Heap::registerThread): (KJS::Heap::unregisterThread): * kjs/collector.h: 2008-07-29 Alexey Proskuryakov Reviewed by Sam Weinig. https://bugs.webkit.org/show_bug.cgi?id=20169 Memory allocated with fastMalloc is freed with delete * VM/JSPropertyNameIterator.cpp: (KJS::JSPropertyNameIterator::invalidate): Free the array properly. (KJS::JSPropertyNameIterator::~JSPropertyNameIterator): Delete the array by calling invalidate(). 2008-07-29 Mark Rowe Attempt to fix the Qt build. * wtf/ThreadingQt.cpp: Add the extra argument to createThread. 2008-07-29 Adam Roben Change Vector::find to return an index instead of an iterator Indices are more natural than iterators when working with Vector. Reviewed by John Sullivan. * wtf/Vector.h: (WTF::Vector::find): Changed to iterate the Vector manually and return the index of the found item, rather than an iterator. When the item could not be found, we return WTF::notFound. 2008-07-29 Adam Roben Windows build fix * wtf/ThreadingWin.cpp: (WTF::setThreadName): Move a misplaced assertion to here... (WTF::createThread): ...from here. 2008-07-29 Adam Roben Add support for setting thread names on Windows These thread names make it much easier to identify particular threads in Visual Studio's Threads panel. WTF::createThread now takes a const char* representing the thread's name. On Windows, we throw a special exception to set this string as the thread's name. Other platforms do nothing with this name for now. Reviewed by Anders Carlsson. * JavaScriptCore.exp: Export the new version of createThread that takes 3 arguments (the old one continues to be exported for backward compatibility). * wtf/Threading.h: Add a threadName argument to createThread. * wtf/ThreadingGtk.cpp: (WTF::createThread): * wtf/ThreadingNone.cpp: (WTF::createThread): Updated for function signature change. * wtf/ThreadingPthreads.cpp: (WTF::createThread): Updated for function signature change. We keep around the old 2-argument version of createThread for backward compatibility. * wtf/ThreadingWin.cpp: (WTF::setThreadName): Added. This function's implementation came from MSDN. (WTF::initializeThreading): Set the name of the main thread. (WTF::createThread): Call setThreadName. We keep around the old 2-argument version of createThread for backward compatibility. 2008-07-29 Alexey Proskuryakov Reviewed by Oliver Hunt. Store UString::Rep::isStatic bit in identifierTable pointer instead of reportedCost for slightly nicer code and a 0.5% SunSpider improvement. * API/JSClassRef.cpp: (OpaqueJSClass::~OpaqueJSClass): (OpaqueJSClassContextData::OpaqueJSClassContextData): * API/JSStringRef.cpp: (JSStringRelease): * kjs/PropertyNameArray.cpp: (KJS::PropertyNameArray::add): * kjs/identifier.cpp: (KJS::IdentifierTable::~IdentifierTable): (KJS::IdentifierTable::add): (KJS::Identifier::addSlowCase): (KJS::Identifier::remove): * kjs/identifier.h: (KJS::Identifier::add): * kjs/ustring.cpp: (KJS::): (KJS::UString::Rep::create): (KJS::UString::Rep::destroy): * kjs/ustring.h: (KJS::UString::Rep::identifierTable): (KJS::UString::Rep::setIdentifierTable): (KJS::UString::Rep::isStatic): (KJS::UString::Rep::setStatic): (KJS::UString::cost): 2008-07-28 Geoffrey Garen Reviewed by Sam Weinig. Renamed "ConstructTypeNative" => "ConstructTypeHost". 2008-07-26 Mark Rowe Speculative fix for the wx build. * JavaScriptCoreSources.bkl: Add JSStaticScopeObject.cpp to the list of source files. 2008-07-25 Oliver Hunt RS=Cameron Zwarich. Whoops, forgot to save style correction. * kjs/JSStaticScopeObject.h: 2008-07-25 Oliver Hunt Reviewed by Cameron Zwarich. Bug 19718: Named anonymous functions are slow accessing global variables To fix this we switch over to an activation-like scope object for on which we attach the function name property, and add logic to prevent cross scope assignment to read only properties. * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * VM/CodeGenerator.cpp: (KJS::CodeGenerator::findScopedProperty): (KJS::CodeGenerator::emitResolve): * VM/CodeGenerator.h: * kjs/AllInOneFile.cpp: * kjs/JSStaticScopeObject.cpp: Added. (KJS::JSStaticScopeObject::putWithAttributes): (KJS::JSStaticScopeObject::isDynamicScope): (KJS::JSStaticScopeObject::~JSStaticScopeObject): (KJS::JSStaticScopeObject::getOwnPropertySlot): * kjs/JSStaticScopeObject.h: Added. (KJS::JSStaticScopeObject::JSStaticScopeObjectData::JSStaticScopeObjectData): (KJS::JSStaticScopeObject::JSStaticScopeObject): * kjs/nodes.cpp: (KJS::FunctionCallResolveNode::emitCode): (KJS::PostfixResolveNode::emitCode): (KJS::PrefixResolveNode::emitCode): (KJS::ReadModifyResolveNode::emitCode): (KJS::AssignResolveNode::emitCode): (KJS::FuncExprNode::makeFunction): 2008-07-25 kevino wx build fix for Win. On wx/Win, including windows.h in Threading.h causes multiply-defined symbol errors for libjpeg and wx, and also wx needs to include windows.h itself first for wx includes to work right. So until we can find a better solution to this problem, on wx, we work around the need to include windows.h here. * wtf/Threading.h: 2008-07-25 Adam Roben Windows build fix * JavaScriptCore.vcproj/testapi/testapi.vcproj: Add API/ to the include path. 2008-07-25 Simon Hausmann Fix the build of jsc on Qt/Windows, make sure os-win32 is in the include search path (added by WebKit.pri). * kjs/jsc.pro: 2008-07-25 Alexey Proskuryakov Reviewed by Simon Hausmann. Move JavaScriptCore API tests into a subdirectory of their own to avoid header name conflicts and developer confusion. * API/JSNode.c: Removed. * API/JSNode.h: Removed. * API/JSNodeList.c: Removed. * API/JSNodeList.h: Removed. * API/Node.c: Removed. * API/Node.h: Removed. * API/NodeList.c: Removed. * API/NodeList.h: Removed. * API/minidom.c: Removed. * API/minidom.html: Removed. * API/minidom.js: Removed. * API/testapi.c: Removed. * API/testapi.js: Removed. * API/tests: Added. * API/tests/JSNode.c: Copied from JavaScriptCore/API/JSNode.c. * API/tests/JSNode.h: Copied from JavaScriptCore/API/JSNode.h. * API/tests/JSNodeList.c: Copied from JavaScriptCore/API/JSNodeList.c. * API/tests/JSNodeList.h: Copied from JavaScriptCore/API/JSNodeList.h. * API/tests/Node.c: Copied from JavaScriptCore/API/Node.c. * API/tests/Node.h: Copied from JavaScriptCore/API/Node.h. * API/tests/NodeList.c: Copied from JavaScriptCore/API/NodeList.c. * API/tests/NodeList.h: Copied from JavaScriptCore/API/NodeList.h. * API/tests/minidom.c: Copied from JavaScriptCore/API/minidom.c. * API/tests/minidom.html: Copied from JavaScriptCore/API/minidom.html. * API/tests/minidom.js: Copied from JavaScriptCore/API/minidom.js. * API/tests/testapi.c: Copied from JavaScriptCore/API/testapi.c. * API/tests/testapi.js: Copied from JavaScriptCore/API/testapi.js. * GNUmakefile.am: * JavaScriptCore.vcproj/testapi/testapi.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: 2008-07-25 Simon Hausmann Prospective WX build fix, add JavaScriptCore/API to the include search path. * jscore.bkl: 2008-07-25 Simon Hausmann Rubber-stamped by Lars. Fix the build on Windows. operator new for ArgList is implemented using fastMalloc() but operator delete was not implemented. Unfortunately MSVC decides to call/reference the function, so a simple implementation using fastFree() fixes the build. * kjs/ArgList.h: (KJS::ArgList::operator delete): 2008-07-25 Simon Hausmann Discussed with and rubber-stamped by Lars. Fix the build system for the Qt port. Recent JavaScriptCore changes require the addition of JavaScriptCore/API to the include search path. With a build process that combines JavaScriptCore and WebCore in one build process/Makefile the existance of JavaScriptCore/API/Node.h and WebCore/dom/Node.h causes include conflicts. This commit solves this by introducing a separate build of JavaScriptCore into a static library. As a result of the split-up a race-condition due to broken dependencies of regular source files to header files of generated sources showed up very frequently when doing parallel builds (which the buildbot does). This commit at the same time tries to address the dependency problem by making the addExtraCompiler() function also generate a pseudo extra compiler that represents the header file output, so that qmake is aware of the creation of the header file for dependency calculation. At the same time I removed a lot of cruft from the pro files to ease maintenance. * JavaScriptCore.pri: * JavaScriptCore.pro: Added. * kjs/jsc.pro: 2008-07-24 Geoffrey Garen Reviewed by Maciej Stachowiak. Fixed a strict aliasing violation, which caused hash tables with floating point keys not to find items that were indeed in the tables (intermittently, and only in release builds, of course). SunSpider reports no change. This bug doesn't seem to affect any existing code, but it causes obvious crashes in some new code I'm working on. * wtf/HashFunctions.h: (WTF::FloatHash::hash): Use a union when punning between a float / double and an unsigned (bucket of bits). With strict aliasing enabled, unions are the only safe way to do this kind of type punning. * wtf/HashTable.h: When rehashing, ASSERT that the item we just added to the table is indeed in the table. In the buggy case described above, this ASSERT fires. 2008-07-24 Oliver Hunt Reviewed by Alexey Proskuryakov. Bug 20142: REGRESSION(r35245): /=/ weirdness When adding all the meta data needed for exception error messages I accidentally clobbered the handling of regex beginning with /=. * kjs/grammar.y: 2008-07-23 Alp Toker Build fix after r35293: Add API/ to the include path. * GNUmakefile.am: 2008-07-23 Adam Roben Windows build fixes Build fix after r35293: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add API/ to the include path. Build fix after r35305: * VM/Machine.cpp: * VM/Machine.h: * VM/Opcode.cpp: * VM/Opcode.h: Completely compile out all sampler-related code when SAMPLING_TOOL_ENABLED is 0. The sampler code can't be compiled 1) on non-AllInOne configurations due to circular header dependencies, and 2) on platforms that don't have a usleep() function, such as Windows. 2008-07-23 Oliver Hunt Reviewed by Geoff Garen and Sam Weinig. Improve switch performance. Improve switch performance by converting to a hashmap based jump table to avoid the sequence of dispatches that would otherwise be needed. This results in a 9-19x performance win for string switches based on ad hoc testing, and a 6x improvement for integer switch statements. SunSpider reports a 1.2% progression. * VM/CodeBlock.cpp: (KJS::CodeBlock::dump): (KJS::SimpleJumpTable::offsetForValue): * VM/CodeBlock.h: * VM/CodeGenerator.cpp: (KJS::CodeGenerator::beginSwitch): (KJS::prepareJumpTableForImmediateSwitch): (KJS::prepareJumpTableForCharacterSwitch): (KJS::prepareJumpTableForStringSwitch): (KJS::CodeGenerator::endSwitch): * VM/CodeGenerator.h: * VM/Machine.cpp: (KJS::offsetForStringSwitch): (KJS::Machine::privateExecute): * VM/Opcode.cpp: (KJS::): * VM/Opcode.h: * kjs/JSImmediate.h: * kjs/nodes.cpp: (KJS::): (KJS::processClauseList): (KJS::CaseBlockNode::tryOptimisedSwitch): (KJS::CaseBlockNode::emitCodeForBlock): * kjs/nodes.h: (KJS::SwitchInfo::): 2008-07-23 Gavin Barraclough Reviewed by Geoff Garen. Sampling tool to analyze cost of instruction execution and identify hot regions of JS code. Enable Switches by setting SAMPLING_TOOL_ENABLED in Opcode.h. * JavaScriptCore.exp: Export symbols for Shell.cpp. * VM/Machine.cpp: Added sampling hooks. * VM/Machine.h: Machine contains a pointer to a sampler, when sampling. * VM/Opcode.cpp: Tool implementation. * VM/Opcode.h: Tool declaration. * kjs/Shell.cpp: Initialize the sampler, if enabled. * kjs/nodes.cpp: Added sampling hooks. 2008-07-23 Gabor Loki Bug 20097: [Qt] 20% Sunspider slow-down Reviewed by Simon Hausmann. * kjs/jsc.pro: Added missing NDEBUG define for release builds. 2008-07-23 Alexey Proskuryakov Reviewed by Geoff Garen. JSClassRef is created context-free, but gets infatuated with the first context it sees. The implicit API contract is that JSClassRef can be used with any context on any thread. This no longer worked, because UStrings in the class were turned into per-context identifiers, and the cached JSObject prototype was tied to JSGlobalData, too. * API/JSClassRef.h: Made a separate struct for context-dependent parts of OpaqueJSClass. * API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): Updated for renames and changed member variable order. (OpaqueJSClass::~OpaqueJSClass): Assert that string members are not identifiers. (clearReferenceToPrototype): Update for the new reference location. (OpaqueJSClassContextData::OpaqueJSClassContextData): Make a deep copy of all strings. (OpaqueJSClass::contextData): Added a function that finds the per-context part of OpaqueJSClass in JSGlobalData, or creates it if not found. (OpaqueJSClass::className): Always make a deep copy. Callers of this function do not have a way to access JSGlobalData, so a per-context copy could not be made. (OpaqueJSClass::staticValues): Updated for new data location. (OpaqueJSClass::staticFunctions): Ditto. (OpaqueJSClass::prototype): Changed to take an internal type for consistency. * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::JSGlobalData): (KJS::JSGlobalData::~JSGlobalData): * kjs/JSGlobalData.h: Keep a HashMap to access per-context JSClass data given a pointr to the shared part. * API/JSCallbackObjectFunctions.h: (KJS::::className): (KJS::::getOwnPropertySlot): (KJS::::put): (KJS::::deleteProperty): (KJS::::getPropertyNames): (KJS::::staticValueGetter): (KJS::::staticFunctionGetter):j Use function accessors instead of accessing OpaqueJSClass members directly. * API/JSContextRef.cpp: (JSGlobalContextCreate): Updated for the change in OpaqueJSClass::prototype() argument type. * API/JSObjectRef.cpp: (JSObjectMake): Updated for the change in OpaqueJSClass::prototype() argument type. (JSObjectMakeConstructor): Ditto. 2008-07-23 Alexey Proskuryakov Build fix. * kjs/ArgList.h: (KJS::ArgList::operator new): removed an extraneous "ArgList::" inside the class definition. 2008-07-22 Geoffrey Garen Reviewed by Oliver Hunt and Sam Weinig. Next step toward putting doubles in registers: Prepare the Register class and its clients for registers that don't contain JSValue*s. This means a few things: 1. Register::jsValue() clients, including ArgList clients, must now supply an ExecState* when accessing an entry in an ArgList, in case the entry will need to create a JSValue* on the fly. 2. Register clients that definitely don't want to create a JSValue* on the fly now use different APIs: getJSValue() for clients that know the register contains a JSValue*, and v() for clients who just want a void*. 3. I had to change some headers around in order to resolve dependency problems created by using a Register in the ArgList header. SunSpider reports no change. 2008-07-22 Gavin Barraclough Reviewed by Alexey Proskuryakov. Prevent integer overflow when reallocating storage vector for arrays. Sunspider reports 1.005x as fast (no change expected). * kjs/JSArray.cpp: 2008-07-21 Mark Rowe Reviewed by Sam Weinig. Revamp the handling of CFBundleShortVersionString to be fixed at the major component of the version number. * Configurations/Version.xcconfig: * Info.plist: 2008-07-21 Adam Roben Add Vector::find This is a convenience wrapper around std::find. Reviewed by Anders Carlsson. * wtf/Vector.h: 2008-07-19 Oliver Hunt Reviewed by Cameron Zwarich. Bug 20104: Exception in tables/mozilla_expected_failures/bugs/bug92868_1.html includes the equals operator in the quoted expression To make this correct we make the dot and bracket assign nodes emit the information to indicate the failure range is the dot/bracket accessor. * kjs/grammar.y: 2008-07-18 Steve Falkenburg Windows build fix. * kjs/JSGlobalObjectFunctions.cpp: (KJS::isStrWhiteSpace): 2008-07-18 Steve Falkenburg Windows build fix. * kjs/nodes.h: (KJS::ThrowableExpressionData::ThrowableExpressionData): 2008-07-18 Oliver Hunt Reviewed by Cameron Zwarich. Bug 18774: SQUIRRELFISH: print meaningful error messages SQUIRRELFISH: JavaScript error messages are missing informative text Add support for decent error messages in JavaScript. This patch achieves this by providing ensuring the common errors and exceptions have messages that provide the text of expression that trigger the exception. In addition it attaches a number of properties to the exception object detailing where in the source the expression came from. * JavaScriptCore.exp: * VM/CodeBlock.cpp: (KJS::CodeBlock::lineNumberForVPC): (KJS::CodeBlock::expressionRangeForVPC): Function to recover the expression range for an instruction that triggered an exception. * VM/CodeBlock.h: (KJS::ExpressionRangeInfo::): (KJS::CodeBlock::CodeBlock): * VM/CodeGenerator.cpp: (KJS::CodeGenerator::emitCall): (KJS::CodeGenerator::emitCallEval): Emit call needed to be modified so to place the expression range info internally, as the CodeGenerator emits the arguments nodes itself, rather than the various call nodes. * VM/CodeGenerator.h: (KJS::CodeGenerator::emitExpressionInfo): Record the expression range info. * VM/ExceptionHelpers.cpp: (KJS::createErrorMessage): (KJS::createInvalidParamError): (KJS::createUndefinedVariableError): (KJS::createNotAConstructorError): (KJS::createNotAFunctionError): (KJS::createNotAnObjectErrorStub): (KJS::createNotAnObjectError): Rewrite all the code for the error messages so that they make use of the newly available information. * VM/ExceptionHelpers.h: * VM/Machine.cpp: (KJS::isNotObject): Now needs vPC and codeBlock (KJS::Machine::throwException): New logic to handle the NotAnObjectErrorStub and to handle the absurd "no default value" edge case (KJS::Machine::privateExecute): * VM/Machine.h: * kjs/DebuggerCallFrame.cpp: (KJS::DebuggerCallFrame::evaluate): * kjs/Error.cpp: (KJS::Error::create): * kjs/Error.h: * kjs/JSGlobalObjectFunctions.cpp: * kjs/JSImmediate.cpp: (KJS::JSImmediate::toObject): (KJS::JSImmediate::prototype): My changes to the JSNotAnObject constructor needed to be handled here. * kjs/JSNotAnObject.h: (KJS::JSNotAnObjectErrorStub::JSNotAnObjectErrorStub): (KJS::JSNotAnObjectErrorStub::isNull): (KJS::JSNotAnObjectErrorStub::isNotAnObjectErrorStub): Added a JSNotAnObjectErrorStub class to ease the handling of toObject failure exceptions, and potentially allow even more detailed error messages in future. * kjs/JSObject.h: * kjs/Parser.h: (KJS::Parser::parse): * kjs/SourceRange.h: * kjs/grammar.y: Large amounts of position propagation. * kjs/lexer.cpp: (KJS::Lexer::Lexer): (KJS::Lexer::shift): (KJS::Lexer::lex): The lexer needed a few changes to be able to correctly track token character positions. * kjs/lexer.h: * kjs/nodes.cpp: (KJS::ThrowableExpressionData::emitThrowError): (KJS::StatementNode::StatementNode): (KJS::ResolveNode::emitCode): (KJS::BracketAccessorNode::emitCode): (KJS::DotAccessorNode::emitCode): (KJS::NewExprNode::emitCode): (KJS::EvalFunctionCallNode::emitCode): (KJS::FunctionCallValueNode::emitCode): (KJS::FunctionCallResolveNode::emitCode): (KJS::FunctionCallBracketNode::emitCode): (KJS::FunctionCallDotNode::emitCode): (KJS::PostfixResolveNode::emitCode): (KJS::PostfixBracketNode::emitCode): (KJS::PostfixDotNode::emitCode): (KJS::DeleteResolveNode::emitCode): (KJS::DeleteBracketNode::emitCode): (KJS::DeleteDotNode::emitCode): (KJS::PrefixResolveNode::emitCode): (KJS::PrefixBracketNode::emitCode): (KJS::PrefixDotNode::emitCode): (KJS::ThrowableBinaryOpNode::emitCode): (KJS::ReadModifyResolveNode::emitCode): (KJS::AssignResolveNode::emitCode): (KJS::AssignDotNode::emitCode): (KJS::ReadModifyDotNode::emitCode): (KJS::AssignBracketNode::emitCode): (KJS::ReadModifyBracketNode::emitCode): (KJS::ForInNode::ForInNode): (KJS::ForInNode::emitCode): (KJS::WithNode::emitCode): (KJS::LabelNode::emitCode): (KJS::ThrowNode::emitCode): (KJS::ProgramNode::ProgramNode): (KJS::ProgramNode::create): (KJS::EvalNode::generateCode): (KJS::FunctionBodyNode::create): (KJS::FunctionBodyNode::generateCode): (KJS::ProgramNode::generateCode): All of these methods were handling the position information. Constructors and create methods were modified to store the information. All the emitCall implementations listed needed to be updated to actually record the position information we have so carefully collected. * kjs/nodes.h: (KJS::ThrowableExpressionData::ThrowableExpressionData): (KJS::ThrowableExpressionData::setExceptionSourceRange): (KJS::ThrowableExpressionData::divot): (KJS::ThrowableExpressionData::startOffset): (KJS::ThrowableExpressionData::endOffset): (KJS::ThrowableSubExpressionData::ThrowableSubExpressionData): (KJS::ThrowableSubExpressionData::setSubexpressionInfo): (KJS::ThrowablePrefixedSubExpressionData::ThrowablePrefixedSubExpressionData): (KJS::ThrowablePrefixedSubExpressionData::setSubexpressionInfo): ThrowableExpressionData is just a uniform mechanism for storing the position information. (KJS::ResolveNode::): (KJS::PrePostResolveNode::): (KJS::ThrowableBinaryOpNode::): (KJS::WithNode::): 2008-07-18 Geoffrey Garen Reviewed by Cameron Zwarich. Three renames: "CallTypeNative" => "CallTypeHost" "code" => "byteCode" "generatedCode" => "generatedByteCode" 2008-07-18 Geoffrey Garen Reviewed by Oliver Hunt. Optimized <= for immediate number cases. SunSpider reports no overall change, but a 10% speedup on access-nsieve. 2008-07-18 Mark Rowe Rubber-stamped by Sam Weinig. Fix some casts added in a previous build fix to match the style used throughout WebKit. * VM/Machine.cpp: (KJS::Machine::initializeCallFrame): * VM/Register.h: (KJS::Register::Register): 2008-07-18 Landry Breuil Bug 19975: [OpenBSD] Patches to enable build of WebKit Reviewed by David Kilzer. Support for OpenBSD, mostly threading and libm tweaks. * kjs/collector.cpp: #include (KJS::currentThreadStackBase): use pthread_stackseg_np() to get stack base * kjs/config.h: OpenBSD also provides * wtf/MathExtras.h: #include and (isfinite), (signbit): as long as we don't have those functions provide fallback implementations * wtf/Platform.h: Add support for PLATFORM(OPENBSD) and PLATFORM(SPARC64) macro 2008-07-17 Geoffrey Garen Reviewed by Oliver Hunt. Next step toward putting doubles in registers: Store constant pool entries as registers, not JSValue*s. SunSpider reports no change. 2008-07-17 Geoffrey Garen Reviewed by John Sullivan and Oliver Hunt. A tiny bit of tidying in function call register allocation. This patch saves one register when invoking a function expression and/or a new expression that is stored in a temporary. Since it's just one register, I can't make a testcase for it. * VM/CodeGenerator.cpp: (KJS::CodeGenerator::emitCall): No need to ref the function we're calling or its base. We'd like the call frame to overlap with them, if possible. op_call will read the function and its base before writing the call frame, so this is safe. * kjs/nodes.cpp: (KJS::NewExprNode::emitCode): No need to ref the function we're new-ing, for the same reasons stated above. (KJS::FunctionCallValueNode::emitCode): ditto 2008-07-17 Steve Falkenburg Build fix. * kjs/InternalFunction.cpp: 2008-07-17 Sam Weinig Roll out r35199 as it is causing failures on the PPC build. 2008-07-17 Geoffrey Garen Reviewed by David Kilzer. Fixed https://bugs.webkit.org/show_bug.cgi?id=20067 Support function.name (Firefox extension) Pretty straight-forward. 2008-07-17 Geoffrey Garen Reviewed by Oliver Hunt. Fixed Functions calls use more temporary registers than necessary Holding a reference to the last statement result register caused each successive statement to output its result to an even higher register. Happily, statements don't actually need to return a result register at all. I hope to make this clearer in a future cleanup patch, but this change will fix the major bug for now. * kjs/nodes.cpp: (KJS::statementListEmitCode): 2008-07-17 Gavin Barraclough Reviewed by Sam Weinig. Merge pre&post dot nodes to simplify the parse tree. Sunspider results show 0.6% progression (no performance change expected). * kjs/grammar.y: * kjs/nodes.cpp: * kjs/nodes.h: * kjs/nodes2string.cpp: 2008-07-17 Gavin Barraclough Reviewed by Cameron Zwarich. Merge pre&post resolve nodes to simplify the parse tree. Sunspider results show no performance change. * kjs/grammar.y: * kjs/nodes.cpp: * kjs/nodes.h: * kjs/nodes2string.cpp: 2008-07-17 Gavin Barraclough Reviewed by Cameron Zwarich. Merge logical nodes to simplify the parse tree. Sunspider results show 0.6% progression (no performance change expected). * kjs/grammar.y: * kjs/nodes.cpp: * kjs/nodes.h: * kjs/nodes2string.cpp: 2008-07-17 Ariya Hidayat Reviewed by Simon. Fix MinGW build (broken in r35198) and simplify getLocalTime(). * kjs/DateMath.cpp: (KJS::getLocalTime): 2008-07-17 Gavin Barraclough Reviewed by Sam Weinig. Merge pre&post bracket nodes to simplify the parse tree. Sunspider results show no performance change. * kjs/grammar.y: * kjs/nodes.cpp: * kjs/nodes.h: * kjs/nodes2string.cpp: 2008-07-17 Ariya Hidayat Reviewed by Simon. Fix the 32-bit gcc builds, conversion from "long int" to Register is ambiguous. Explicitly choose the intptr_t constructor. * VM/Machine.cpp: (KJS::Machine::initializeCallFrame): * VM/Register.h: (KJS::Register::Register): 2008-07-16 Mark Rowe Rubber-stamped by Geoff Garen. Fix JavaScript in 64-bit by using a pointer-sized integer type in the Register union. Also includes a rename of the intType constant to IntType. * VM/Machine.cpp: (KJS::Machine::initializeCallFrame): * VM/Register.h: (KJS::Register::): (KJS::Register::Register): 2008-07-17 Geoffrey Garen Reviewed by Oliver Hunt. First step toward putting doubles in registers: Turned Register into a proper abstraction layer. It is no longer possible to cast a Register to a JSValue*, or a Register& to a JSValue*&, or to access the union inside a Register directly. SunSpider reports no change. In support of this change, I had to make the following mechanical changes in a lot of places: 1. Clients now use explicit accessors to read data out of Registers, and implicit copy constructors to write data into registers. So, assignment that used to look like x.u.jsValue = y; now looks like x = y; And access that used to look like x = y.u.jsValue; now looks like x = y.jsValue(); 2. I made generic flow control specific in opcodes that made their flow control generic by treating a Register& as a JSValue*&. This had the added benefit of removing some exception checking branches from immediate number code. 3. I beefed up PropertySlot to support storing a Register* in a property slot. For now, only JSVariableObject's symbolTableGet and symbolTablePut use this functionality, but I expect more clients to use it in the future. 4. I changed ArgList to be a buffer of Registers, not JSValue*'s, and I changed ArgList iterator clients to iterate Registers, not JSValue*'s. 2008-07-16 Ada Chan Fixed build. * kjs/JSGlobalObject.cpp: 2008-07-16 Kevin McCullough Reviewed by Sam and Geoff. Navigating to another page while profiler is attached results in slow JavaScript for all time. - The UNLIKELY keeps this from being a sunspider performance regression. * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::~JSGlobalObject): Stop the profiler associated with this exec state. 2008-07-16 Sam Weinig Reviewed by Steve Falkenburg. Replace adopting UString constructor in favor of explicit static adopt method. * API/JSStringRefCF.cpp: (JSStringCreateWithCFString): * kjs/StringConstructor.cpp: (KJS::stringFromCharCode): * kjs/StringPrototype.cpp: (KJS::stringProtoFuncToLowerCase): (KJS::stringProtoFuncToUpperCase): (KJS::stringProtoFuncToLocaleLowerCase): (KJS::stringProtoFuncToLocaleUpperCase): * kjs/ustring.cpp: (KJS::UString::adopt): * kjs/ustring.h: (KJS::UString::UString): (KJS::UString::~UString): 2008-07-16 Ariya Hidayat Reviewed by Simon. http://trolltech.com/developer/task-tracker/index_html?method=entry&id=216179 Fix potential crash (on Qt for Windows port) when performing JavaScript date conversion. * kjs/DateMath.cpp: (KJS::getLocalTime): For the Qt port, prefer to use Windows code, i.e. localtime_s() instead of localtime() since the latter might crash (on Windows) given a non-sensible, e.g. NaN, argument. 2008-07-16 Alexey Proskuryakov Reviewed by Anders and Geoff. https://bugs.webkit.org/show_bug.cgi?id=20023 Failed assertion in PropertyNameArray.cpp This is already tested by testapi. * API/JSObjectRef.cpp: (JSPropertyNameAccumulatorAddName): Add the string to identifier table to appease PropertyNameArray. 2008-07-16 Alexey Proskuryakov Reviewed by Geoff. Dereference identifiers when deleting a hash table (fixes leaks with private JSGlobalData objects). * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::~JSGlobalData): * kjs/lookup.cpp: (KJS::HashTable::deleteTable): * kjs/lookup.h: * kjs/lexer.cpp: (KJS::Lexer::~Lexer) HashTable cannot have a destructor, because check-for-global-initializers complains about having a global constructor then. 2008-07-16 Alexey Proskuryakov Reviewed by Geoff. Check pthread_key_create return value. This check was helpful when debugging a crash in run-webkit-tests --threaded that happened because JSGlobalData objects were not deleted, and we were running out of pthread keys soon. It also looks useful for production builds. * wtf/ThreadSpecific.h: (WTF::::ThreadSpecific): 2008-07-15 Kevin McCullough Reviewed by Geoff. Rename pageGroupIdentifier to profileGroup to keep mention of a pageGroup out of JavaScriptCore. * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::setProfileGroup): (KJS::JSGlobalObject::profileGroup): * profiler/ProfileGenerator.cpp: (KJS::ProfileGenerator::create): (KJS::ProfileGenerator::ProfileGenerator): * profiler/ProfileGenerator.h: (KJS::ProfileGenerator::profileGroup): * profiler/Profiler.cpp: (KJS::Profiler::startProfiling): (KJS::dispatchFunctionToProfiles): (KJS::Profiler::willExecute): (KJS::Profiler::didExecute): 2008-07-14 Mark Rowe Reviewed by Sam Weinig. Fix https://bugs.webkit.org/show_bug.cgi?id=20037 Bug 20037: GCC 4.2 build broken due to strict aliasing violation. * kjs/ustring.cpp: (KJS::UString::Rep::computeHash): Add a version of computeHash that takes a char* and explicit length. * kjs/ustring.h: * profiler/CallIdentifier.h: (WTF::): Use new version of computeHash that takes a char* and explicit length to avoid unsafe aliasing. 2008-07-14 David Hyatt Fix a crashing bug in ListHashSet's -- operator. Make sure that end() can be -- by special-casing the null position. Reviewed by Maciej * wtf/ListHashSet.h: (WTF::ListHashSetConstIterator::operator--): 2008-07-14 David Hyatt Buidl fix. Make sure the second insertBefore method returns a value. * wtf/ListHashSet.h: (WTF::::insertBefore): 2008-07-14 Adam Roben Windows build fix * JavaScriptCore.vcproj/jsc/jsc.vcproj: Added include/pthreads to the include path. 2008-07-14 Alexey Proskuryakov Reviewed by Kevin McCullough. Make JSGlobalData refcounted in preparation to adding a way to create contexts that share global data. * JavaScriptCore.exp: * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::create): * kjs/JSGlobalData.h: Made contructor private, and added a static create() method. Made the class inherit from RefCounted. * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::globalData): JSGlobalData is now owned by JSGlobalObject (except for the shared one, and the common WebCore one, which are never deleted). * kjs/Shell.cpp: (main): Create JSGlobalData with create() method. 2008-07-14 Simon Hausmann Fix the single-threaded build. * kjs/JSLock.cpp: Removed undeclared registerThread() function. * kjs/collector.cpp: (KJS::Heap::registerThread): Added dummy implementation. 2008-07-14 Alexey Proskuryakov Reviewed by Geoff Garen. Eliminate per-thread JavaScript global data instance support and make arbitrary global data/global object combinations possible. * kjs/collector.cpp: (KJS::Heap::Heap): Store a JSGlobalData pointer instead of multiple pointers to its members. This allows for going from any JS object to its associated global data, currently used in JSGlobalObject constructor to initialize its JSGlobalData pointer. (KJS::Heap::registerThread): Changed thread registration data to be per-heap. Previously, only the shared heap could be used from multiple threads, so it was the only one that needed thread registration, but now this can happen to any heap. (KJS::Heap::unregisterThread): Ditto. (KJS::Heap::markStackObjectsConservatively): Adapt for the above changes. (KJS::Heap::setGCProtectNeedsLocking): Ditto. (KJS::Heap::protect): Ditto. (KJS::Heap::unprotect): Ditto. (KJS::Heap::collect): Ditto. (KJS::Heap::globalObjectCount): Use global object list associated with the current heap, not the late per-thread one. (KJS::Heap::protectedGlobalObjectCount): Ditto. * kjs/collector.h: (KJS::Heap::ThreadRegistrar): Added a helper object that unregisters a thread when it is destroyed. * kjs/JSLock.cpp: (KJS::JSLock::JSLock): * kjs/JSLock.h: (KJS::JSLock::JSLock): Don't use JSLock to implicitly register threads. I've added registerThread() calls to most places that use JSLock - we cannot guarantee absolute safety unless we always mark all threads in the process, but these implicit registration calls should cover reasonable usage scenarios, I hope. * API/JSBase.cpp: (JSEvaluateScript): Explicitly register the current thread. (JSCheckScriptSyntax): Explicitly register the current thread. (JSGarbageCollect): Changed to use the passed in context. Unfortunately, this creates a race condition for clients that pass an already released context to JSGarbageCollect - but it is unlikely to create real life problems. To maintain compatibility, the shared heap is collected if NULL is passed. * API/JSContextRef.cpp: (JSGlobalContextCreate): Use a new syntax for JSGlobalObject allocation. (JSGlobalContextRetain): Register the thread. (JSContextGetGlobalObject): Register the thread. * API/JSObjectRef.cpp: (JSObjectMake): (JSObjectMakeFunctionWithCallback): (JSObjectMakeConstructor): (JSObjectMakeFunction): (JSObjectHasProperty): (JSObjectGetProperty): (JSObjectSetProperty): (JSObjectGetPropertyAtIndex): (JSObjectSetPropertyAtIndex): (JSObjectDeleteProperty): (JSObjectCallAsFunction): (JSObjectCallAsConstructor): (JSObjectCopyPropertyNames): (JSPropertyNameAccumulatorAddName): * API/JSValueRef.cpp: (JSValueIsEqual): (JSValueIsInstanceOfConstructor): (JSValueMakeNumber): (JSValueMakeString): (JSValueToNumber): (JSValueToStringCopy): (JSValueToObject): (JSValueProtect): (JSValueUnprotect): Register the thread. * API/JSStringRef.cpp: (JSStringRelease): Changed a comment to not mention per-thread contexts. * API/JSStringRefCF.cpp: Removed an unnecessary include of JSLock.h. * JavaScriptCore.exp: Export JSGlobalData constructor/destructor, now that anyone can have their own instances. Adapt to other changes, too. * JavaScriptCore.xcodeproj/project.pbxproj: Made ThreadSpecific.h private, as it is now included by collector.h and is thus needed in other projects. * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Don't initialize per-thread global data, as it no longer exists. * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::JSGlobalData): (KJS::JSGlobalData::~JSGlobalData): * kjs/JSGlobalData.h: Removed support for per-thread instance. Made constructor and destructor public. * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): Get to now arbitrary JSGlobalData via the heap. (KJS::JSGlobalObject::operator new): Changed ot take JSGlobalDatra pointer. * kjs/JSGlobalObject.h: * kjs/Shell.cpp: (main): (jscmain): Changed to maintain a custom JSGlobalData pointer instead of a per-thread one. 2008-07-13 Ada Chan Windows build fix: Add wtf/RefCountedLeakCounter to the project. * JavaScriptCore.vcproj/WTF/WTF.vcproj: 2008-07-12 Jan Michael Alonzo Gtk, Qt and Wx build fix: Add wtf/RefCountedLeakCounter in the build scripts * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCoreSources.bkl: 2008-07-11 Stephanie Lewis Reviewed by Darin Adler and Oliver Hunt. Refactor RefCounting Leak counting code into a common class. In order to export the symbols I needed to put the debug defines inside the function names Before we had a separate channel for each Logging each Leak type. Since the leak channels were only used in one location, and only at quit for simplicity I combined them all into one leak channel. * JavaScriptCore.exp: * JavaScriptCore.xcodeproj/project.pbxproj: add new class * kjs/nodes.cpp: remove old leak counting code * wtf/RefCountedLeakCounter.cpp: Added. create a common leak counting class * wtf/RefCountedLeakCounter.h: Added. 2008-07-11 David Hyatt Add an insertBefore method to ListHashSet to allow for insertions in the middle of the list (rather than just at the end). Reviewed by Anders * wtf/ListHashSet.h: (WTF::::insertBefore): (WTF::::insertNodeBefore): 2008-07-11 Sam Weinig Rubber-stamped by Darin Adler. Move call function to CallData.cpp and construct to ConstructData.cpp. * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * kjs/AllInOneFile.cpp: * kjs/CallData.cpp: Copied from kjs/JSValue.cpp. * kjs/ConstructData.cpp: Copied from kjs/JSValue.cpp. * kjs/JSValue.cpp: 2008-07-10 Mark Rowe Reviewed by Sam Weinig. Define WEBKIT_VERSION_MIN_REQUIRED=WEBKIT_VERSION_LATEST when building WebKit to ensure that no symbols end up with the weak_import attribute. * Configurations/Base.xcconfig: 2008-07-10 Mark Rowe Reviewed by Sam Weinig. Fix the Tiger build by omitting annotations from methods declared in categories when using old versions of GCC. * API/WebKitAvailability.h: 2008-07-10 Kevin McCullough Reviewed by Darin. -Minor cleanup. Renamed callTree() to head() and no longer use m_head directly but instead keep it private and access via a method(). * profiler/HeavyProfile.cpp: (KJS::HeavyProfile::HeavyProfile): (KJS::HeavyProfile::generateHeavyStructure): (KJS::HeavyProfile::addNode): * profiler/Profile.h: (KJS::Profile::head): * profiler/ProfileGenerator.cpp: (KJS::ProfileGenerator::ProfileGenerator): 2008-07-10 Alexey Proskuryakov Reviewed by Mark Rowe. Eliminate CollectorHeapIntrospector. CollectorHeapIntrospector was added primarily in the hopes to improve leaks tool output, a result that it didn't deliver. Also, it helped by labeling JSC heap regions as reported by vmmap tool, but at the same time, it made them mislabeled as malloc'd ones - the correct way to label mapped regions is to use a VM tag. So, it makes more sense to remove it completely than to make it work with multiple heaps. * JavaScriptCore.exp: * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/AllInOneFile.cpp: * kjs/InitializeThreading.cpp: (KJS::initializeThreading): * kjs/collector.cpp: * kjs/collector.h: * kjs/CollectorHeapIntrospector.cpp: Removed. * kjs/CollectorHeapIntrospector.h: Removed. 2008-07-09 Kevin McCullough Reviewed by Darin. JSProfiler: Implement heavy (or bottom-up) view (19228) - Implemented the time and call count portionof heavy. Now all that we need is some UI. * profiler/CallIdentifier.h: Removed an unused constructor. * profiler/HeavyProfile.cpp: (KJS::HeavyProfile::HeavyProfile): Set the initial time of the head node so that percentages work correctly. (KJS::HeavyProfile::mergeProfiles): Sum the times and call count of nodes being merged. * profiler/ProfileNode.cpp: Set the intital values of time and call count when copying ProfileNodes. (KJS::ProfileNode::ProfileNode): 2008-07-10 Jan Michael Alonzo Gtk build fix. * GNUmakefile.am: Add HeavyProfile.cpp 2008-07-09 Mark Rowe Reviewed by Geoff Garen. Don't warn about deprecated functions in production builds. * Configurations/Base.xcconfig: * Configurations/DebugRelease.xcconfig: 2008-07-09 Darin Adler * JavaScriptCore.pri: Fix Qt build by adding HeavyProfile.cpp. 2008-07-09 Kevin Ollivier wx biuld fix. Add HeavyProfile.cpp to build files. * JavaScriptCoreSources.bkl: 2008-07-09 Kevin McCullough - Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2008-07-09 Kevin McCullough - Build fix. * profiler/HeavyProfile.cpp: (KJS::HeavyProfile::mergeProfiles): 2008-07-09 Kevin McCullough Reviewed by Geoff and Adam. JSProfiler: Implement Bottom-Up view (19228) - This is the plumbing for bottom-up, but does not include calculating time, mostly because I'm still undclear about what the end result should look like. - This, obviously, does not include the UI to expose this in the inspector yet. * JavaScriptCore.xcodeproj/project.pbxproj: * profiler/CallIdentifier.h: (KJS::CallIdentifier::CallIdentifier): (WTF::): Added HashTraits for CallIdentifiers to be used by a HashMap. * profiler/HeavyProfile.cpp: Added. (KJS::HeavyProfile::HeavyProfile): (KJS::HeavyProfile::generateHeavyStructure): (KJS::HeavyProfile::addNode): (KJS::HeavyProfile::mergeProfiles): (KJS::HeavyProfile::addAncestorsAsChildren): * profiler/HeavyProfile.h: Added. (KJS::HeavyProfile::create): (KJS::HeavyProfile::heavyProfile): (KJS::HeavyProfile::treeProfile): * profiler/Profile.cpp: Removed old commented out includes. * profiler/Profile.h: The m_head is needed by the HeavyProfile so it is now protected as opposed to private. * profiler/ProfileNode.cpp: (KJS::ProfileNode::ProfileNode): Created a constructor to copy ProfileNodes. (KJS::ProfileNode::findChild): Added a null check to make HeavyProfile children finding easier and avoid a potential crasher. * profiler/ProfileNode.h: Mostly moved things around but also added some functionality needed by HeavyProfile. (KJS::ProfileNode::create): (KJS::ProfileNode::functionName): (KJS::ProfileNode::url): (KJS::ProfileNode::lineNumber): (KJS::ProfileNode::head): (KJS::ProfileNode::setHead): (KJS::ProfileNode::setNextSibling): (KJS::ProfileNode::actualTotalTime): (KJS::ProfileNode::actualSelfTime): * profiler/TreeProfile.cpp: Implemented the ability to get a HeavyProfile. (KJS::TreeProfile::heavyProfile): * profiler/TreeProfile.h: 2008-07-08 Geoffrey Garen Reviewed by Oliver Hunt. Added support for checking if an object has custom properties in its property map. WebCore uses this to optimize marking DOM wrappers. 2008-07-08 Simon Hausmann Prospective Gtk/Wx build fixes, add ProfileGenerator.cpp to the build. * GNUmakefile.am: * JavaScriptCoreSources.bkl: 2008-07-08 Simon Hausmann Fix the Qt build, add ProfileGenerator.cpp to the build. * JavaScriptCore.pri: 2008-07-07 David Kilzer releaseFastMallocFreeMemory() should always be defined Reviewed by Darin. * JavaScriptCore.exp: Changed to export C++ binding for WTF::releaseFastMallocFreeMemory() instead of C binding for releaseFastMallocFreeMemory(). * wtf/FastMalloc.cpp: Moved definitions of releaseFastMallocFreeMemory() to be in the WTF namespace regardless whether FORCE_SYSTEM_MALLOC is defined. * wtf/FastMalloc.h: Moved releaseFastMallocFreeMemory() from extern "C" binding to WTF::releaseFastMallocFreeMemory(). 2008-07-07 Cameron Zwarich Reviewed by Geoff. Bug 19926: URL causes crash within a minute Add a check that lastGlobalObject is non-null in Machine::execute() before copying its globals to the current register file. In theory, it is possible to make a test case for this, but it will take a while to get it right. * VM/Machine.cpp: (KJS::Machine::execute): 2008-07-07 Darin Adler Rubber stamped by Adele. * VM/Machine.cpp: (KJS::Machine::privateExecute): Fix a typo in a comment. 2008-07-07 Steve Falkenburg Build fixes. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.vcproj/testapi/testapi.vcproj: 2008-07-07 Kevin McCullough Reviewed by Darin. When the profiler is running it gathers information and creates a Profile. After it finishes the Profile can be sorted and have other data refinements run over it. Both of these were done in the same class before. Now I split the gathering operations into a new class called ProfileGenerator. * JavaScriptCore.xcodeproj/project.pbxproj: * profiler/Profile.cpp: Removed code related to the gather stage of a Profile's creation. (KJS::Profile::create): (KJS::Profile::Profile): * profiler/Profile.h: Ditto. (KJS::Profile::title): (KJS::Profile::callTree): (KJS::Profile::setHead): * profiler/ProfileGenerator.cpp: Added. This is the class that will handle the stage of creating a Profile. Once the Profile is finished being created, this class goes away. (KJS::ProfileGenerator::create): (KJS::ProfileGenerator::ProfileGenerator): (KJS::ProfileGenerator::title): (KJS::ProfileGenerator::willExecute): (KJS::ProfileGenerator::didExecute): (KJS::ProfileGenerator::stopProfiling): (KJS::ProfileGenerator::didFinishAllExecution): (KJS::ProfileGenerator::removeProfileStart): (KJS::ProfileGenerator::removeProfileEnd): * profiler/ProfileGenerator.h: Added. (KJS::ProfileGenerator::profile): (KJS::ProfileGenerator::originatingGlobalExec): (KJS::ProfileGenerator::pageGroupIdentifier): (KJS::ProfileGenerator::client): (KJS::ProfileGenerator::stoppedProfiling): * profiler/Profiler.cpp: Now operates with the ProfileGenerator instead of the Profile. (KJS::Profiler::startProfiling): (KJS::Profiler::stopProfiling): (KJS::Profiler::didFinishAllExecution): It is here that the Profile is handed off to its client and the Profile Generator is no longer needed. (KJS::dispatchFunctionToProfiles): (KJS::Profiler::willExecute): (KJS::Profiler::didExecute): * profiler/Profiler.h: Cleaned up the includes and subsequently the forward declarations. Also use the new ProfileGenerator. (KJS::ProfilerClient::~ProfilerClient): (KJS::Profiler::currentProfiles): * profiler/TreeProfile.cpp: Use Profile's new interface. (KJS::TreeProfile::create): (KJS::TreeProfile::TreeProfile): * profiler/TreeProfile.h: 2008-07-07 Sam Weinig Reviewed by Cameron Zwarich. Third step in broad cleanup effort. [ File list elided ] 2008-07-06 Sam Weinig Reviewed by Cameron Zwarich. Second step in broad cleanup effort. [ File list elided ] 2008-07-05 Sam Weinig Reviewed by Cameron Zwarich. First step in broad cleanup effort. [ File list elided ] 2008-07-05 Sam Weinig Rubber-stamped by Cameron Zwarich. Rename list.h/cpp to ArgList.h/cpp. * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * VM/Machine.h: * kjs/AllInOneFile.cpp: * kjs/ArgList.cpp: Copied from JavaScriptCore/kjs/list.cpp. * kjs/ArgList.h: Copied from JavaScriptCore/kjs/list.h. * kjs/IndexToNameMap.cpp: * kjs/JSGlobalData.cpp: * kjs/JSGlobalData.h: * kjs/JSObject.h: * kjs/collector.cpp: * kjs/list.cpp: Removed. * kjs/list.h: Removed. 2008-07-05 Sam Weinig Fix non-AllInOne builds again. * kjs/BooleanPrototype.cpp: * kjs/ErrorPrototype.cpp: * kjs/FunctionPrototype.cpp: * kjs/NumberPrototype.cpp: * kjs/ObjectPrototype.cpp: 2008-07-05 Sam Weinig Fix build on case-sensitive build systems. * kjs/IndexToNameMap.cpp: 2008-07-05 Sam Weinig Fix build. * kjs/Arguments.cpp: * kjs/BooleanPrototype.cpp: * kjs/DateConstructor.cpp: * kjs/ErrorPrototype.cpp: * kjs/FunctionPrototype.cpp: * kjs/NumberPrototype.cpp: * kjs/ObjectPrototype.cpp: * kjs/RegExpPrototype.cpp: * kjs/StringConstructor.cpp: * kjs/lookup.cpp: 2008-07-05 Sam Weinig Fix non-AllInOne build. * kjs/JSGlobalObject.cpp: 2008-07-05 Sam Weinig Rubber-stamped by Cameron Zwarich. Split Arguments, IndexToNameMap, PrototypeFunction, GlobalEvalFunction and the functions on the global object out of JSFunction.h/cpp. * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * VM/Machine.cpp: * kjs/AllInOneFile.cpp: * kjs/Arguments.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp. * kjs/Arguments.h: Copied from JavaScriptCore/kjs/JSFunction.h. * kjs/GlobalEvalFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp. * kjs/GlobalEvalFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h. * kjs/IndexToNameMap.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp. * kjs/IndexToNameMap.h: Copied from JavaScriptCore/kjs/JSFunction.h. * kjs/JSActivation.cpp: * kjs/JSFunction.cpp: * kjs/JSFunction.h: * kjs/JSGlobalObject.cpp: * kjs/JSGlobalObjectFunctions.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp. * kjs/JSGlobalObjectFunctions.h: Copied from JavaScriptCore/kjs/JSFunction.h. The functions on the global object should be in JSGlobalObject.cpp, but putting them there was a 0.5% regression. * kjs/PrototypeFunction.cpp: Copied from JavaScriptCore/kjs/JSFunction.cpp. * kjs/PrototypeFunction.h: Copied from JavaScriptCore/kjs/JSFunction.h. * kjs/Shell.cpp: * kjs/lexer.cpp: * kjs/ustring.cpp: 2008-07-04 Sam Weinig Really fix the mac build. * JavaScriptCore.xcodeproj/project.pbxproj: 2008-07-04 Sam Weinig Fix mac build. * JavaScriptCore.xcodeproj/project.pbxproj: 2008-07-04 Sam Weinig Fix non-AllInOne builds. * kjs/Error.cpp: * kjs/GetterSetter.cpp: * kjs/JSImmediate.cpp: * kjs/operations.cpp: 2008-07-04 Sam Weinig Rubber-stamped by Dan Bernstein. Split Error and GetterSetter out of JSObject.h. * API/JSCallbackObjectFunctions.h: * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * kjs/AllInOneFile.cpp: * kjs/ClassInfo.h: Copied from JavaScriptCore/kjs/JSObject.h. * kjs/Error.cpp: Copied from JavaScriptCore/kjs/JSObject.cpp. * kjs/Error.h: Copied from JavaScriptCore/kjs/JSObject.h. * kjs/GetterSetter.cpp: * kjs/GetterSetter.h: Copied from JavaScriptCore/kjs/JSObject.h. * kjs/JSObject.cpp: * kjs/JSObject.h: * kjs/nodes.h: 2008-07-04 Simon Hausmann Fix the Wx build, added TreeProfile.cpp to the build. * JavaScriptCoreSources.bkl: 2008-07-03 Mark Rowe Reviewed by Oliver Hunt. Fix output path of recently-added script phase to reference the correct file. This prevents Xcode from running the script phase unnecessarily, which caused the generated header to be recreated and lead to AllInOneFile.cpp rebuilding. * JavaScriptCore.xcodeproj/project.pbxproj: 2008-07-03 Mark Rowe Follow-up to the 64-bit build fix. Use intptr_t rather than ssize_t as the latter is non-standard and does not exist on Windows. * kjs/JSLock.cpp: (KJS::JSLock::lockCount): (KJS::JSLock::lock): (KJS::JSLock::unlock): (KJS::JSLock::DropAllLocks::DropAllLocks): * kjs/JSLock.h: 2008-07-02 Mark Rowe Fix the 64-bit build. pthread_getspecific works with pointer-sized values, so use ssize_t rather than int to track the lock count to avoid warnings about truncating the result of pthread_getspecific. * kjs/JSLock.cpp: (KJS::JSLock::lockCount): (KJS::JSLock::lock): (KJS::JSLock::unlock): (KJS::JSLock::DropAllLocks::DropAllLocks): * kjs/JSLock.h: 2008-07-03 Geoffrey Garen Reviewed by Sam Weinig. Removed checking for the array get/put fast case from the array code. Callers who want the fast case should call getIndex and/or setIndex instead. (get_by_val and put_by_val already do this.) SunSpider reports no change overall, but a 1.4% speedup on fannkuch and a 3.6% speedup on nsieve. 2008-07-03 Dan Bernstein - Windows build fix * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Added TreeProfile.{h,cpp}. 2008-07-03 Dan Bernstein Reviewed by Anders Carlsson. - Windows build fix * VM/Machine.cpp: (KJS::Machine::Machine): 2008-07-03 Simon Hausmann Reviewed by Alexey Proskuryakov. Fix the non-threaded build. * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::threadInstanceInternal): 2008-07-03 Simon Hausmann Fix the Qt build, added TreeProfile to the build. * JavaScriptCore.pri: 2008-07-02 Alexey Proskuryakov Reviewed by Geoff. Don't create unnecessary JSGlobalData instances. * kjs/JSGlobalData.h: * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::threadInstanceExists): (KJS::JSGlobalData::sharedInstanceExists): (KJS::JSGlobalData::threadInstance): (KJS::JSGlobalData::sharedInstance): (KJS::JSGlobalData::threadInstanceInternal): (KJS::JSGlobalData::sharedInstanceInternal): Added methods to query instance existence. * kjs/InitializeThreading.cpp: (KJS::initializeThreadingOnce): Initialize thread instance static in a new way. * API/JSBase.cpp: (JSGarbageCollect): * kjs/collector.cpp: (KJS::Heap::collect): Check for instance existence before accessing it. 2008-07-02 Geoffrey Garen Reviewed by Cameron Zwarich. Fixed https://bugs.webkit.org/show_bug.cgi?id=19862 REGRESSION (r34907): Gmail crashes in JavaScriptCore code while editing drafts I was never able to reproduce this issue, but Cameron could, and he says that this patch fixes it. The crash seems tied to a timer or event handler callback. In such a case, the sole reference to the global object may be in the current call frame, so we can't depend on the global object to mark the call frame area in the register file. The new GC marking rule is: the global object is not responsible for marking the whole register file -- it's just responsible for the globals section it's tied to. The heap is responsible for marking the call frame area. 2008-07-02 Mark Rowe Reviewed by Sam Weinig. Add the ability to trace JavaScriptCore garabge collections using dtrace. * JavaScriptCore.xcodeproj/project.pbxproj: Generate the dtrace probe header file when building on a new enough version of Mac OS X. * JavaScriptCorePrefix.h: Add our standard Mac OS X version detection macros. * kjs/Tracing.d: Declare three dtrace probes. * kjs/Tracing.h: Include the generated dtrace macros if dtrace is available, otherwise provide versions that do nothing. * kjs/collector.cpp: (KJS::Heap::collect): Fire dtrace probes when starting a collection, after the mark phase has completed, and when the collection is complete. * wtf/Platform.h: Define HAVE_DTRACE when building on a new enough version of Mac OS X. 2008-07-02 Geoffrey Garen Rubber stamped by Oliver Hunt. Reduced the max register file size from 8MB to 2MB. We still allow about 20,000 levels of recursion. 2008-07-02 Alp Toker Build fix for r34960. Add TreeProfile.cpp to build. * GNUmakefile.am: 2008-07-02 Geoffrey Garen Reviewed by Oliver Hunt. Optimized a[n] get for cases when a is an array or a string. When a is an array, we optimize both get and put. When a is a string, we only optimize get, since you can't put to a string. SunSpider says 3.4% faster. 2008-07-02 Kevin McCullough Reviewed by Darin. -Small cleanup in preparation for implementing Bottom-up. * profiler/CallIdentifier.h: Rename debug function to make it clear of its output and intention to be debug only. (KJS::CallIdentifier::operator const char* ): Implement in terms of c_str. (KJS::CallIdentifier::c_str): * profiler/ProfileNode.cpp: Impelment findChild() which will be needed by the bottom-up implementation. (KJS::ProfileNode::findChild): * profiler/ProfileNode.h: Added comments to make the collections of functions more clear. (KJS::ProfileNode::operator==): (KJS::ProfileNode::c_str): 2008-07-02 Cameron Zwarich Reviewed by Darin. Bug 19776: Number.toExponential() is incorrect for numbers between 0.1 and 1 Perform the sign check for the exponent on the actual exponent value, which is 1 less than the value of decimalPoint, instead of on the value of decimalPoint itself. * kjs/NumberPrototype.cpp: (KJS::exponentialPartToString): 2008-07-02 Kevin McCullough Reviewed by Darin. JSProfiler: Implement Bottom-Up view (19228) - Subclass TreeProfile as I prepare for a HeavyProfile to be comming later. * JavaScriptCore.xcodeproj/project.pbxproj: * profiler/Profile.cpp: By default we create a TreeProfile. (KJS::Profile::create): * profiler/Profile.h: Changes to the Profile class to make it amenable to be inherited from. (KJS::Profile::~Profile): * profiler/TreeProfile.cpp: Added. (KJS::TreeProfile::create): (KJS::TreeProfile::TreeProfile): (KJS::TreeProfile::heavyProfile): * profiler/TreeProfile.h: Added. (KJS::TreeProfile::treeProfile): 2008-07-02 Kevin McCullough Reviewed by Dan. Broke CallIdentifier out into its own file. I did this because it's going to grow a lot soon and I wanted this to be a separate patch. * JavaScriptCore.xcodeproj/project.pbxproj: * profiler/CallIdentifier.h: Added. (KJS::CallIdentifier::CallIdentifier): (KJS::CallIdentifier::operator==): (KJS::CallIdentifier::operator!=): (KJS::CallIdentifier::operator const char* ): (KJS::CallIdentifier::toString): * profiler/ProfileNode.h: 2008-07-02 Simon Hausmann Build fix. Implemented missing functions for single-threaded build. * kjs/JSLock.cpp: (KJS::JSLock::JSLock): (KJS::JSLock::lock): (KJS::JSLock::unlock): (KJS::JSLock::DropAllLocks::DropAllLocks): 2008-07-02 Alexey Proskuryakov Another non-AllInOne build fix. * kjs/JSGlobalObject.cpp: Include JSLock.h here, too. 2008-07-02 Alexey Proskuryakov Non-AllInOne build fix. * kjs/interpreter.cpp: Include JSLock.h. 2008-06-30 Alexey Proskuryakov Reviewed by Darin. Disable JSLock for per-thread contexts. No change on SunSpider. * kjs/JSGlobalData.h: * kjs/JSGlobalData.cpp: (KJS::JSGlobalData::JSGlobalData): (KJS::JSGlobalData::sharedInstance): Added isSharedInstance as a better way to tell whether the instance is shared (legacy). * kjs/JSLock.cpp: (KJS::createJSLockCount): (KJS::JSLock::lockCount): (KJS::setLockCount): (KJS::JSLock::JSLock): (KJS::JSLock::lock): (KJS::JSLock::unlock): (KJS::JSLock::currentThreadIsHoldingLock): (KJS::JSLock::DropAllLocks::DropAllLocks): (KJS::JSLock::DropAllLocks::~DropAllLocks): * kjs/JSLock.h: (KJS::JSLock::JSLock): (KJS::JSLock::~JSLock): Made JSLock and JSLock::DropAllLocks constructors take a parameter to decide whether to actually lock a mutex, or only to increment recursion count. We cannot turn it into no-op if we want to keep existing assertions working. Made recursion count per-thread, now that locks may not lock. * API/JSBase.cpp: (JSEvaluateScript): Take JSLock after casting JSContextRef to ExecState* (which doesn't need locking in any case), so that a decision whether to actually lock can be made. (JSCheckScriptSyntax): Ditto. (JSGarbageCollect): Only lock while collecting the shared heap, not the per-thread one. * API/JSObjectRef.cpp: (JSClassCreate): Don't lock, as there is no reason to. (JSClassRetain): Ditto. (JSClassRelease): Ditto. (JSPropertyNameArrayRetain): Ditto. (JSPropertyNameArrayRelease): Only lock while deleting the array, as that may touch identifier table. (JSPropertyNameAccumulatorAddName): Adding a string also involves an identifier table lookup, and possibly modification. * API/JSStringRef.cpp: (JSStringCreateWithCharacters): (JSStringCreateWithUTF8CString): (JSStringRetain): (JSStringRelease): (JSStringGetUTF8CString): (JSStringIsEqual): * API/JSStringRefCF.cpp: (JSStringCreateWithCFString): JSStringRef operations other than releasing do not need locking. * VM/Machine.cpp: Don't include unused JSLock.h. * kjs/CollectorHeapIntrospector.cpp: (KJS::CollectorHeapIntrospector::statistics): Don't take the lock for real, as heap introspection pauses the process anyway. It seems that the existing code could cause deadlocks. * kjs/Shell.cpp: (functionGC): (main): (jscmain): The test tool uses a per-thread context, so no real locking is required. * kjs/collector.h: (KJS::Heap::setGCProtectNeedsLocking): Optionally protect m_protectedValues access with a per-heap mutex. This is only needed for WebCore Database code, which violates the "no data migration between threads" by using ProtectedPtr on a background thread. (KJS::Heap::isShared): Keep a shared flag here, as well. * kjs/protect.h: (KJS::::ProtectedPtr): (KJS::::~ProtectedPtr): (KJS::::operator): (KJS::operator==): (KJS::operator!=): ProtectedPtr is ony used from WebCore, so it doesn't need to take JSLock. An assertion in Heap::protect/unprotect guards agains possible future unlocked uses of ProtectedPtr in JSC. * kjs/collector.cpp: (KJS::Heap::Heap): Initialize m_isShared. (KJS::Heap::~Heap): No need to lock for real during destruction, but must keep assertions in sweep() working. (KJS::destroyRegisteredThread): Registered thread list is only accessed for shared heap, so locking is always needed here. (KJS::Heap::registerThread): Ditto. (KJS::Heap::markStackObjectsConservatively): Use m_isShared instead of comparing to a shared instance for a small speedup. (KJS::Heap::setGCProtectNeedsLocking): Create m_protectedValuesMutex. There is currently no way to undo this - and ideally, Database code will be fixed to lo longer require this quirk. (KJS::Heap::protect): Take m_protectedValuesMutex (if it exists) while accessing m_protectedValues. (KJS::Heap::unprotect): Ditto. (KJS::Heap::markProtectedObjects): Ditto. (KJS::Heap::protectedGlobalObjectCount): Ditto. (KJS::Heap::protectedObjectCount): Ditto. (KJS::Heap::protectedObjectTypeCounts): Ditto. * kjs/ustring.cpp: * kjs/ustring.h: Don't include JSLock.h, which is no longer used here. As a result, an explicit include had to be added to many files in JavaScriptGlue, WebCore and WebKit. * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): * API/JSCallbackConstructor.cpp: (KJS::constructJSCallback): * API/JSCallbackFunction.cpp: (KJS::JSCallbackFunction::call): * API/JSCallbackObjectFunctions.h: (KJS::::init): (KJS::::getOwnPropertySlot): (KJS::::put): (KJS::::deleteProperty): (KJS::::construct): (KJS::::hasInstance): (KJS::::call): (KJS::::getPropertyNames): (KJS::::toNumber): (KJS::::toString): (KJS::::staticValueGetter): (KJS::::callbackGetter): * API/JSContextRef.cpp: (JSGlobalContextCreate): (JSGlobalContextRetain): (JSGlobalContextRelease): * API/JSValueRef.cpp: (JSValueIsEqual): (JSValueIsStrictEqual): (JSValueIsInstanceOfConstructor): (JSValueMakeNumber): (JSValueMakeString): (JSValueToNumber): (JSValueToStringCopy): (JSValueToObject): (JSValueProtect): (JSValueUnprotect): * JavaScriptCore.exp: * kjs/PropertyNameArray.h: (KJS::PropertyNameArray::globalData): * kjs/interpreter.cpp: (KJS::Interpreter::checkSyntax): (KJS::Interpreter::evaluate): Pass a parameter to JSLock/JSLock::DropAllLocks to decide whether the lock needs to be taken. 2008-07-01 Alexey Proskuryakov Reviewed by Darin. https://bugs.webkit.org/show_bug.cgi?id=19834 Failed assertion in JavaScriptCore/VM/SegmentedVector.h:82 Creating a global object with a custom prototype resets it twice (wasteful!). So, addStaticGlobals() was called twice, but JSGlobalObject::reset() didn't reset the register array. * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::reset): Call setRegisterArray(0, 0). * kjs/JSVariableObject.h: Changed registerArray to OwnArrayPtr. Also, added private copy constructor and operator= to ensure that no one attempts to copy this object (for whatever reason, I couldn't make Noncopyable work). * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): Allocate registerArray with new[]. * kjs/JSVariableObject.cpp: (KJS::JSVariableObject::copyRegisterArray): Allocate registerArray with new[]. (KJS::JSVariableObject::setRegisterArray): Avoid hitting an assertion in OwnArrayPtr when "changing" the value from 0 to 0. 2008-07-01 Geoffrey Garen Reviewed by Oliver Hunt. Removed and/or reordered exception checks in array-style a[n] access. SunSpider says 1.4% faster. * VM/Machine.cpp: (KJS::Machine::privateExecute): No need to check for exceptions before calling toString, toNumber and/or get. If the call ends up being observable through toString, valueOf, or a getter, we short-circuit it there, instead. In the op_del_by_val case, I removed the incorrect comment without actually removing the code, since I didn't want to tempt the GCC fates! * kjs/JSObject.cpp: (KJS::callDefaultValueFunction): Added exception check to prevent toString and valueOf functions from observing execution after an exception has been thrown. This removes some of the burden of exception checking from the machine. (KJS::JSObject::defaultValue): Removed redundant exception check here. * kjs/PropertySlot.cpp: (KJS::PropertySlot::functionGetter): Added exception check to prevent getter functions from observing execution after an exception has been thrown. This removes some of the burden of exception checking from the machine. 2008-07-01 Geoffrey Garen Reviewed by Oliver Hunt. Optimized a[n] get and put for cases where n is an immediate unsigned value. SunSpider says 3.5% faster. 2008-07-01 Cameron Zwarich Reviewed by Darin. Bug 19844: JavaScript Switch statement modifies "this" Use a temporary when generating code for switch clauses to avoid overwriting 'this' or a local variable. * kjs/nodes.cpp: (KJS::CaseBlockNode::emitCodeForBlock): 2008-07-01 Christian Dywan Gtk+ build fix. * kjs/list.cpp: Include "JSCell.h" 2008-07-01 Kevin McCullough Build fix. * JavaScriptCore.xcodeproj/project.pbxproj: 2008-07-01 Dan Bernstein Reviewed by Anders Carlsson. - Mac release build fix * JavaScriptCore.exp: 2008-07-01 Sam Weinig Try and fix mac builds. * JavaScriptCore.exp: 2008-07-01 Sam Weinig Fix non-AllInOne builds. * kjs/DateMath.cpp: 2008-07-01 Sam Weinig Reviewed by Darin Adler. Split JSCell and JSNumberCell class declarations out of JSValue.h * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * VM/JSPropertyNameIterator.h: * kjs/AllInOneFile.cpp: * kjs/JSCell.cpp: Copied from JavaScriptCore/kjs/JSValue.cpp. * kjs/JSCell.h: Copied from JavaScriptCore/kjs/JSValue.h. (KJS::JSValue::getJSNumber): * kjs/JSNumberCell.cpp: * kjs/JSNumberCell.h: Copied from JavaScriptCore/kjs/JSValue.h. * kjs/JSObject.h: * kjs/JSString.cpp: (KJS::jsString): (KJS::jsOwnedString): * kjs/JSString.h: (KJS::JSValue::toThisJSString): * kjs/JSValue.cpp: * kjs/JSValue.h: 2008-07-01 Anders Carlsson Build fixes. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::addStaticGlobals): 2008-07-01 Simon Hausmann Build fix, include OwnPtr.h. * kjs/RegExpConstructor.h: 2008-06-30 Geoffrey Garen Reviewed by Oliver Hunt. Fixed a global object leak caused by the switch to one register file. Don't unconditionally mark the register file, since that logically makes all global variables GC roots, even when their global object is no longer reachable. Instead, make the global object associated with the register file responsible for marking the register file. 2008-06-30 Geoffrey Garen Reviewed by Oliver Hunt. Removed the "registerBase" abstraction. Since the register file never reallocates, we can keep direct pointers into it, instead of tuples. SunSpider says 0.8% faster. 2008-06-30 Oliver Hunt Reviewed by NOBODY (build fix). Fix build by adding all (hopefully) the missing includes. * kjs/BooleanPrototype.cpp: * kjs/DateConstructor.cpp: * kjs/ErrorPrototype.cpp: * kjs/FunctionPrototype.cpp: * kjs/NativeErrorConstructor.cpp: * kjs/NumberPrototype.cpp: * kjs/ObjectPrototype.cpp: * kjs/RegExpConstructor.cpp: * kjs/StringConstructor.cpp: * kjs/StringPrototype.cpp: 2008-06-30 Cameron Zwarich Reviewed by Oliver. Bug 19830: REGRESSION (r34883): Google Reader doesn't show up feed list on sidebar Ensure that we do not eliminate a write to a local register when doing peephole optimizations. * VM/CodeGenerator.cpp: (KJS::CodeGenerator::emitJumpIfTrue): (KJS::CodeGenerator::emitJumpIfFalse): 2008-06-30 Sam Weinig Rubber-stamped by Darin Alder. Split InternalFunction into its own header file. * API/JSCallbackFunction.h: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/ArrayConstructor.h: * kjs/BooleanConstructor.h: * kjs/DateConstructor.h: * kjs/ErrorConstructor.h: * kjs/FunctionConstructor.h: * kjs/FunctionPrototype.h: * kjs/InternalFunction.h: Copied from kjs/JSFunction.h. * kjs/JSFunction.h: * kjs/NativeErrorConstructor.h: * kjs/NumberConstructor.h: * kjs/ObjectConstructor.h: * kjs/RegExpConstructor.h: * kjs/StringConstructor.h: * profiler/Profiler.cpp: 2008-06-30 Sam Weinig Reviewed by Kevin McCullough. Remove empty files Instruction.cpp, LabelID.cpp, Register.cpp and RegisterID.cpp. * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * VM/Instruction.cpp: Removed. * VM/LabelID.cpp: Removed. * VM/Register.cpp: Removed. * VM/RegisterID.cpp: Removed. 2008-06-30 Sam Weinig Rubber-stamped (reluctantly) by Kevin McCullough. Rename date_object.h/cpp to DateInstance.h/cpp * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * kjs/AllInOneFile.cpp: * kjs/DateConstructor.cpp: * kjs/DateInstance.cpp: Copied from kjs/date_object.cpp. * kjs/DateInstance.h: Copied from kjs/date_object.h. * kjs/DatePrototype.cpp: * kjs/DatePrototype.h: * kjs/date_object.cpp: Removed. * kjs/date_object.h: Removed. 2008-06-30 Sam Weinig Rubber-stamped by Darin Adler. Remove internal.cpp and move its contents to there own .cpp files. * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * kjs/AllInOneFile.cpp: * kjs/GetterSetter.cpp: Copied from kjs/internal.cpp. * kjs/InternalFunction.cpp: Copied from kjs/internal.cpp. * kjs/JSNumberCell.cpp: Copied from kjs/internal.cpp. * kjs/JSString.cpp: Copied from kjs/internal.cpp. * kjs/JSString.h: * kjs/LabelStack.cpp: Copied from kjs/internal.cpp. * kjs/NumberConstructor.cpp: * kjs/NumberObject.cpp: (KJS::constructNumber): (KJS::constructNumberFromImmediateNumber): * kjs/internal.cpp: Removed. 2008-06-30 Adam Roben Fix Assertion failure due to HashTable's use of operator& HashTable was passing &value to constructDeletedValue, which in classes like WebCore::COMPtr would cause an assertion. We now pass value by reference instead of by address so that the HashTraits implementations have more flexibility in constructing the deleted value. Reviewed by Ada Chan. * VM/CodeGenerator.h: Updated for changes to HashTraits. * wtf/HashTable.h: (WTF::::deleteBucket): Changed to pass bucket by reference instead of by address. (WTF::::checkKey): Ditto. * wtf/HashTraits.h: (WTF::): Updated HashTraits for HashTable change. 2008-07-01 Alexey Proskuryakov Reviewed by Cameron Zwarich. Make RegisterFile really unmap memory on destruction. This fixes run-webkit-tests --threaded, which ran out of address space in a few seconds. * VM/RegisterFile.cpp: (KJS::RegisterFile::~RegisterFile): Unmap all the memory, not just 1/4 of it. * kjs/JSGlobalObject.h: Don't include RegisterFile.h, so that changes to it don't make half of WebCore rebuild. * VM/Machine.h: Don't forward declare RegisterFile, as RegisterFile.h is included already. * VM/RegisterFile.h: (KJS::RegisterFile::RegisterFile): Assert that the allocation succeeded. 2008-06-30 Cameron Zwarich Rubber-stamped by Oliver. Correct the documentation for op_put_by_index. * VM/Machine.cpp: (KJS::Machine::privateExecute): 2008-06-29 Cameron Zwarich Reviewed by Oliver. Bug 19821: Merge the instruction pair (less, jfalse) This is a 2.4% win on SunSpider. I needed to add an ALWAYS_INLINE intrinisc to CodeGenerator::rewindBinaryOp() to avoid a massive regression in regexp-dna. * VM/CodeBlock.cpp: (KJS::CodeBlock::dump): * VM/CodeGenerator.cpp: (KJS::CodeGenerator::rewindBinaryOp): (KJS::CodeGenerator::emitJumpIfFalse): * VM/Machine.cpp: (KJS::Machine::privateExecute): * VM/Opcode.cpp: (KJS::): * VM/Opcode.h: 2008-06-29 Sam Weinig Fix non-AllInOne builds. * kjs/JSObject.cpp: * kjs/JSValue.cpp: 2008-06-29 Sam Weinig Build fix for Qt. * kjs/DateMath.cpp: * kjs/DatePrototype.cpp: 2008-06-29 Sam Weinig Rubber-stamped by Cameron Zwarich. Splits ErrorConstructor, ErrorPrototype, NativeErrorConstructor and NativeErrorPrototype out of error_object.h/cpp and renames it ErrorInstance. * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * kjs/AllInOneFile.cpp: * kjs/ArrayConstructor.cpp: * kjs/ArrayPrototype.cpp: * kjs/BooleanPrototype.cpp: * kjs/DatePrototype.cpp: * kjs/ErrorConstructor.cpp: Copied from kjs/error_object.cpp. * kjs/ErrorConstructor.h: Copied from kjs/error_object.h. * kjs/ErrorInstance.cpp: Copied from kjs/error_object.cpp. * kjs/ErrorInstance.h: Copied from kjs/error_object.h. * kjs/ErrorPrototype.cpp: Copied from kjs/error_object.cpp. * kjs/ErrorPrototype.h: Copied from kjs/error_object.h. * kjs/JSGlobalObject.cpp: * kjs/JSObject.cpp: * kjs/JSValue.cpp: * kjs/NativeErrorConstructor.cpp: Copied from kjs/error_object.cpp. * kjs/NativeErrorConstructor.h: Copied from kjs/error_object.h. * kjs/NativeErrorPrototype.cpp: Copied from kjs/error_object.cpp. * kjs/NativeErrorPrototype.h: Copied from kjs/error_object.h. * kjs/NumberPrototype.cpp: * kjs/RegExpConstructor.cpp: * kjs/RegExpObject.cpp: * kjs/RegExpPrototype.cpp: * kjs/StringPrototype.cpp: * kjs/error_object.cpp: Removed. * kjs/error_object.h: Removed. * kjs/internal.cpp: 2008-06-29 Sam Weinig Fix non-AllInOne build. * kjs/DateConstructor.cpp: * kjs/DateMath.cpp: * kjs/JSObject.cpp: 2008-06-29 Sam Weinig Rubber-stamped by Oliver Hunt. Splits DateConstructor and DatePrototype out of date_object.h/cpp Moves shared Date code into DateMath. * DerivedSources.make: * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * kjs/AllInOneFile.cpp: * kjs/DateConstructor.cpp: Copied from kjs/date_object.cpp. * kjs/DateConstructor.h: Copied from kjs/date_object.h. * kjs/DateMath.cpp: (KJS::ymdhmsToSeconds): (KJS::): (KJS::skipSpacesAndComments): (KJS::findMonth): (KJS::parseDate): (KJS::timeClip): (KJS::formatDate): (KJS::formatDateUTCVariant): (KJS::formatTime): * kjs/DateMath.h: (KJS::gmtoffset): * kjs/DatePrototype.cpp: Copied from kjs/date_object.cpp. * kjs/DatePrototype.h: Copied from kjs/date_object.h. * kjs/JSGlobalObject.cpp: * kjs/JSObject.cpp: * kjs/date_object.cpp: * kjs/date_object.h: * kjs/internal.cpp: 2008-06-29 Jan Michael Alonzo Rubber-stamped by Cameron Zwarich Fix Gtk non-AllInOne build * GNUmakefile.am: include JSVariableObject.cpp * kjs/RegExpConstructor.cpp: include RegExpObject.h * kjs/RegExpObject.h: forward declare RegExpPrototype 2008-06-28 Darin Adler Reviewed by Sam and Cameron. - fix https://bugs.webkit.org/show_bug.cgi?id=19805 Array.concat turns missing array elements into "undefined" Test: fast/js/array-holes.html * JavaScriptCore.exp: No longer export JSArray::getItem. * kjs/ArrayPrototype.cpp: (KJS::arrayProtoFuncConcat): Changed to use getProperty instead of JSArray::getItem -- need to handle properties from the prototype chain instead of ignoring them. * kjs/JSArray.cpp: Removed getItem. * kjs/JSArray.h: Ditto. 2008-06-28 Darin Adler Reviewed by Cameron. - https://bugs.webkit.org/show_bug.cgi?id=19804 optimize access to arrays without "holes" SunSpider says 1.8% faster. * kjs/JSArray.cpp: (KJS::JSArray::JSArray): Initialize m_fastAccessCutoff when creating arrays. Also updated for new location of m_vectorLength. (KJS::JSArray::getItem): Updated for new location of m_vectorLength. (KJS::JSArray::getSlowCase): Added. Broke out the non-hot parts of getOwnPropertySlot to make the hot part faster. (KJS::JSArray::getOwnPropertySlot): Added a new faster case for indices lower than m_fastAccessCutoff. We can do theese with no additional checks or branches. (KJS::JSArray::put): Added a new faster case for indices lower than m_fastAccessCutoff. We can do theese with no additional checks or branches. Moved the maxArrayIndex handling out of this function. Added code to set m_fastAccessCutoff when the very last hole in an array is filled; this is how the cutoff gets set for most arrays. (KJS::JSArray::putSlowCase): Moved the rest of the put function logic in here, to make the hot part of the put function faster. (KJS::JSArray::deleteProperty): Added code to lower m_fastAccessCutoff when a delete makes a new hole in the array. (KJS::JSArray::getPropertyNames): Updated for new location of m_vectorLength. (KJS::JSArray::increaseVectorLength): Ditto. (KJS::JSArray::setLength): Added code to lower m_fastAccessCutoff when setLength makes the array smaller. (KJS::JSArray::mark): Updated for new location of m_vectorLength. (KJS::JSArray::sort): Ditto. Set m_fastAccessCutoff after moving all the holes to the end of the array. (KJS::JSArray::compactForSorting): Ditto. (KJS::JSArray::checkConsistency): Added consistency checks fro m_fastAccessCutoff and updated for the new location of m_vectorLength. * kjs/JSArray.h: Added declarations for slow case functions. Replaced m_vectorLength with m_fastAccessCutoff. 2008-06-28 Cameron Zwarich Reviewed by Sam. When executing a native call, check for an exception before writing the return value. * VM/Machine.cpp: (KJS::Machine::privateExecute): 2008-06-28 Mark Rowe Build fix. Flag headers as private or public as is appropriate. These settings were accidentally removed during some project file cleanup. * JavaScriptCore.xcodeproj/project.pbxproj: 2008-06-28 Sam Weinig Rubber-stamped by Darin Adler. Splits RegExpConstructor and RegExpPrototype out of RegExpObject.h/cpp * DerivedSources.make: * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * VM/Machine.cpp: * kjs/AllInOneFile.cpp: * kjs/JSGlobalObject.cpp: * kjs/RegExpConstructor.cpp: Copied from kjs/RegExpObject.cpp. * kjs/RegExpConstructor.h: Copied from kjs/RegExpObject.h. * kjs/RegExpObject.cpp: * kjs/RegExpObject.h: * kjs/RegExpPrototype.cpp: Copied from kjs/RegExpObject.cpp. * kjs/RegExpPrototype.h: Copied from kjs/RegExpObject.h. * kjs/StringPrototype.cpp: * kjs/internal.cpp: 2008-06-28 Sam Weinig Fix non-AllInOne builds. * kjs/StringConstructor.cpp: 2008-06-28 Sam Weinig Rubber-stamped by Darin Adler. Rename string_object.h/cpp to StringObject.h/cpp and split out StringObjectThatMasqueradesAsUndefined, StringConstructor and StringPrototype. * DerivedSources.make: * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * kjs/AllInOneFile.cpp: * kjs/JSGlobalObject.cpp: * kjs/StringConstructor.cpp: Copied from JavaScriptCore/kjs/string_object.cpp. * kjs/StringConstructor.h: Copied from JavaScriptCore/kjs/string_object.h. * kjs/StringObject.cpp: Copied from JavaScriptCore/kjs/string_object.cpp. * kjs/StringObject.h: Copied from JavaScriptCore/kjs/string_object.h. * kjs/StringObjectThatMasqueradesAsUndefined.h: Copied from JavaScriptCore/kjs/string_object.h. * kjs/StringPrototype.cpp: Copied from JavaScriptCore/kjs/string_object.cpp. * kjs/StringPrototype.h: Copied from JavaScriptCore/kjs/string_object.h. * kjs/internal.cpp: * kjs/string_object.cpp: Removed. * kjs/string_object.h: Removed. 2008-06-28 Jan Michael Alonzo Gtk build fix: JSVariableObject is now part of AllInOne * GNUmakefile.am: 2008-06-28 Darin Adler Reviewed by Oliver. - https://bugs.webkit.org/show_bug.cgi?id=19801 add a feature so we can tell what regular expressions are taking time * pcre/pcre_compile.cpp: (jsRegExpCompile): Compile in the string if REGEXP_HISTOGRAM is on. * pcre/pcre_exec.cpp: (jsRegExpExecute): Add hook to time execution. (Histogram::~Histogram): Print a sorted list of what took time. (Histogram::add): Accumulate records of what took time. (HistogramTimeLogger::~HistogramTimeLogger): Hook that calls Histogram::add at the right moment and creates the global histogram object. * pcre/pcre_internal.h: Define REGEXP_HISTOGRAM. * pcre/pcre_tables.cpp: Added missing include of "config.h". Not needed any more, but an omissions an earlier version of this patch detected. * pcre/pcre_ucp_searchfuncs.cpp: Ditto. * pcre/pcre_xclass.cpp: Ditto. 2008-06-28 Sam Weinig Try and fix the Windows build again. * kjs/RegExpObject.cpp: * kjs/date_object.cpp: * kjs/error_object.cpp: 2008-06-28 Sam Weinig Rubber-stamped by Darin Adler. Remove unused StringConstructorFunction class. * kjs/string_object.h: 2008-06-28 Sam Weinig Fix windows build. * kjs/ArrayPrototype.cpp: * kjs/BooleanPrototype.cpp: * kjs/BooleanPrototype.h: * kjs/FunctionPrototype.cpp: * kjs/JSImmediate.cpp: * kjs/JSObject.cpp: * kjs/MathObject.cpp: * kjs/NumberPrototype.cpp: * kjs/NumberPrototype.h: * kjs/ObjectConstructor.cpp: * kjs/RegExpObject.h: * kjs/error_object.h: * kjs/string_object.cpp: 2008-06-28 Sam Weinig Rubber-stamped by Oliver Hunt. Splits FunctionConstructor out of FunctionPrototype.h/cpp Splits NumberConstructor and NumberPrototype out of NumberObject.h/cpp Rename object_object.h/cpp to ObjectPrototype.h/cpp and split out ObjectConstructor. * API/JSCallbackConstructor.cpp: * API/JSClassRef.cpp: * API/JSObjectRef.cpp: * DerivedSources.make: * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * VM/Machine.cpp: * kjs/AllInOneFile.cpp: * kjs/ArrayConstructor.cpp: * kjs/ArrayConstructor.h: * kjs/FunctionConstructor.cpp: Copied from JavaScriptCore/kjs/FunctionPrototype.cpp. * kjs/FunctionConstructor.h: Copied from JavaScriptCore/kjs/FunctionPrototype.h. * kjs/FunctionPrototype.cpp: * kjs/FunctionPrototype.h: * kjs/JSFunction.cpp: * kjs/JSGlobalObject.cpp: * kjs/JSImmediate.cpp: * kjs/MathObject.h: * kjs/NumberConstructor.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp. * kjs/NumberConstructor.h: Copied from JavaScriptCore/kjs/NumberObject.h. * kjs/NumberObject.cpp: * kjs/NumberObject.h: * kjs/NumberPrototype.cpp: Copied from JavaScriptCore/kjs/NumberObject.cpp. * kjs/NumberPrototype.h: Copied from JavaScriptCore/kjs/NumberObject.h. * kjs/ObjectConstructor.cpp: Copied from JavaScriptCore/kjs/object_object.cpp. * kjs/ObjectConstructor.h: Copied from JavaScriptCore/kjs/object_object.h. * kjs/ObjectPrototype.cpp: Copied from JavaScriptCore/kjs/object_object.cpp. * kjs/ObjectPrototype.h: Copied from JavaScriptCore/kjs/object_object.h. * kjs/RegExpObject.h: * kjs/Shell.cpp: * kjs/error_object.h: * kjs/internal.cpp: * kjs/nodes.cpp: * kjs/object_object.cpp: Removed. * kjs/object_object.h: Removed. * kjs/string_object.h: 2008-06-28 Darin Adler Reviewed by Oliver. - fix https://bugs.webkit.org/show_bug.cgi?id=19796 optimize expressions with ignored results (especially post-increment) SunSpider says 0.9% faster. * VM/CodeGenerator.h: (KJS::CodeGenerator::tempDestination): Create a new temporary for ignoredResult() too, just as we would for 0. (KJS::CodeGenerator::finalDestination): Use the temporary if the register passed in is ignoredResult() too, just as we would for 0. (KJS::CodeGenerator::destinationForAssignResult): Return 0 if the passed in register is ignoredResult(), just as we would for 0. (KJS::CodeGenerator::moveToDestinationIfNeeded): Return 0 if the register passed in is ignoredResult(). What matters is that we don't want to emit a move. The return value won't be looked at. (KJS::CodeGenerator::emitNode): Allow ignoredResult() and pass it through to the node's emitCode function. * VM/RegisterID.h: (KJS::ignoredResult): Added. Special value to indicate the result of a node will be ignored and need not be put in any register. * kjs/nodes.cpp: (KJS::NullNode::emitCode): Do nothing if dst == ignoredResult(). (KJS::BooleanNode::emitCode): Ditto. (KJS::NumberNode::emitCode): Ditto. (KJS::StringNode::emitCode): Ditto. (KJS::RegExpNode::emitCode): Ditto. (KJS::ThisNode::emitCode): Ditto. (KJS::ResolveNode::emitCode): Do nothing if dst == ignoredResult() and the identifier resolves to a local variable. (KJS::ObjectLiteralNode::emitCode): Do nothing if dst == ignoredResult() and the object is empty. (KJS::PostIncResolveNode::emitCode): If dst == ignoredResult(), then do nothing for the local constant case, and do a pre-increment in all the other cases. (KJS::PostDecResolveNode::emitCode): Ditto. (KJS::PostIncBracketNode::emitCode): Ditto. (KJS::PostDecBracketNode::emitCode): Ditto. (KJS::PostIncDotNode::emitCode): Ditto. (KJS::PostDecDotNode::emitCode): Ditto. (KJS::DeleteValueNode::emitCode): Pass ignoredResult() when evaluating the expression. (KJS::VoidNode::emitCode): Ditto. (KJS::TypeOfResolveNode::emitCode): If dst == ignoredResult(), do nothing if the identifier resolves to a local variable, and don't bother generating a typeof opcode in the other case. (KJS::TypeOfValueNode::emitCode): Ditto. (KJS::PreIncResolveNode::emitCode): Do nothing if dst == ignoredResult() and the identifier resolves to a local constant. (KJS::PreDecResolveNode::emitCode): Ditto. (KJS::AssignResolveNode::emitCode): Turn ignoredResult() into 0 in a couple places, because we need to put the result into a register so we can assign it. At other sites this is taken care of by functions like finalDestination. (KJS::CommaNode::emitCode): Pass ignoredResult() when evaluating the first expression. (KJS::ForNode::emitCode): Pass ignoredResult() when evaluating the first and third expressions. (KJS::ForInNode::emitCode): Pass ignoredResult() when evaluating the first expression. 2008-06-28 Darin Adler Reviewed by Oliver. - https://bugs.webkit.org/show_bug.cgi?id=19787 create most arrays from values in registers rather than with multiple put operations SunSpider says 0.8% faster. * VM/CodeBlock.cpp: (KJS::CodeBlock::dump): Added argv and argc parameters to new_array. * VM/Machine.cpp: (KJS::Machine::privateExecute): Ditto. * VM/CodeGenerator.cpp: (KJS::CodeGenerator::emitNewArray): Added. * VM/CodeGenerator.h: Added ElementNode* argument to emitNewArray. * kjs/nodes.cpp: (KJS::ArrayNode::emitCode): Pass the ElementNode to emitNewArray so it can be initialized with as many elements as possible. If the array doesn't have any holes in it, that's all that's needed. If there are holes, then emit some separate put operations for the other values in the array and for the length as needed. * kjs/nodes.h: Added some accessors to ElementNode so the code generator can iterate through elements and generate code to evaluate them. Now ArrayNode does not need to be a friend. Also took out some unused PlacementNewAdoptType constructors. 2008-06-28 Darin Adler Reviewed by Oliver. * kjs/nodes.h: Remove obsolete PlacementNewAdopt constructors. We no longer mutate the AST in place. 2008-06-28 Jan Michael Alonzo Reviewed by Oliver Hunt. Build fix * VM/Machine.cpp: include stdio.h for printf 2008-06-27 Sam Weinig Reviewed by Oliver Hunt. Fix platforms that don't use AllInOne.cpp * kjs/BooleanConstructor.h: * kjs/BooleanPrototype.h: * kjs/FunctionPrototype.cpp: 2008-06-27 Sam Weinig Rubber-stamped by Oliver Hunt. Splits ArrayConstructor out of ArrayPrototype.h/cpp Splits BooleanConstructor and BooleanPrototype out of BooleanObject.h/cpp * GNUmakefile.am: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * VM/Machine.cpp: * kjs/AllInOneFile.cpp: * kjs/ArrayConstructor.cpp: Copied from kjs/ArrayPrototype.cpp. * kjs/ArrayConstructor.h: Copied from kjs/ArrayPrototype.h. * kjs/ArrayPrototype.cpp: * kjs/ArrayPrototype.h: * kjs/BooleanConstructor.cpp: Copied from kjs/BooleanObject.cpp. * kjs/BooleanConstructor.h: Copied from kjs/BooleanObject.h. * kjs/BooleanObject.cpp: * kjs/BooleanObject.h: * kjs/BooleanPrototype.cpp: Copied from kjs/BooleanObject.cpp. * kjs/BooleanPrototype.h: Copied from kjs/BooleanObject.h. * kjs/CommonIdentifiers.h: * kjs/FunctionPrototype.cpp: * kjs/JSArray.cpp: * kjs/JSGlobalObject.cpp: * kjs/JSImmediate.cpp: * kjs/Shell.cpp: * kjs/internal.cpp: * kjs/nodes.cpp: * kjs/string_object.cpp: 2008-06-27 Oliver Hunt Reviewed by Sam. Bug 18626: SQUIRRELFISH: support the "slow script" dialog Slow script dialog needs to be reimplemented for squirrelfish Adds support for the slow script dialog in squirrelfish. This requires the addition of three new op codes, op_loop, op_loop_if_true, and op_loop_if_less which have the same behaviour as their simple jump equivalents but have an additional time out check. Additional assertions were added to other jump instructions to prevent accidentally creating loops with jump types that do not support time out checks. Sunspider does not report a regression, however this appears very sensitive to code layout and hardware, so i would expect up to a 1% regression on other systems. Part of this required moving the old timeout logic from JSGlobalObject and into Machine which is the cause of a number of the larger diff blocks. * JavaScriptCore.exp: * VM/CodeBlock.cpp: (KJS::CodeBlock::dump): * VM/CodeGenerator.cpp: (KJS::CodeGenerator::emitJumpIfTrue): (KJS::CodeGenerator::emitJumpScopes): * VM/ExceptionHelpers.cpp: (KJS::InterruptedExecutionError::isWatchdogException): (KJS::createInterruptedExecutionException): * VM/ExceptionHelpers.h: * VM/LabelID.h: * VM/Machine.cpp: (KJS::Machine::Machine): (KJS::Machine::throwException): (KJS::Machine::resetTimeoutCheck): (KJS::getCurrentTime): (KJS::Machine::checkTimeout): (KJS::Machine::privateExecute): * VM/Machine.h: (KJS::Machine::setTimeoutTime): (KJS::Machine::startTimeoutCheck): (KJS::Machine::stopTimeoutCheck): (KJS::Machine::initTimeout): * VM/Opcode.cpp: (KJS::): * VM/Opcode.h: * kjs/JSGlobalObject.cpp: (KJS::JSGlobalObject::init): (KJS::JSGlobalObject::setTimeoutTime): (KJS::JSGlobalObject::startTimeoutCheck): * kjs/JSGlobalObject.h: * kjs/JSObject.h: * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): 2008-06-27 Jan Michael Alonzo Gtk and Qt build fix: Remove RegisterFileStack from the build scripts. * GNUmakefile.am: * JavaScriptCore.pri: 2008-06-27 Adele Peterson Reviewed by Geoff. Build fixes. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * VM/RegisterFile.h: (KJS::RegisterFile::RegisterFile): * kjs/JSGlobalObject.cpp: * kjs/collector.cpp: 2008-06-27 Geoffrey Garen