2007-12-11 Geoffrey Garen Reviewed by Sam Weinig. Build fix: Note some variables that are used only for ASSERTs. * API/testapi.c: (Base_finalize): (globalObject_initialize): (testInitializeFinalize): 2007-12-11 Geoffrey Garen Reviewed by Darin Adler. Fixed: All JS tests crash on Windows. NDEBUG wasn't defined when compiling testkjs in release builds, so the HashTable definition in HashTable.h included an extra data member. The solution was to add NDEBUG to the release testkjs configuration on Windows and Mac. For giggles, I also added other missing #defines to testkjs on Windows. * Configurations/Base.xcconfig: * Configurations/JavaScriptCore.xcconfig: * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/testkjs.cpp: (main): 2007-12-11 Geoffrey Garen Reviewed by Darin Adler. Removed bogus ASSERT. ASSERT should only be used when we know that a code path will not be taken. This code path is taken often during the jsFunFuzz test. * pcre/pcre_exec.cpp: (jsRegExpExecute): 2007-12-11 Darin Adler * wtf/unicode/qt4/UnicodeQt4.h: Try to fix Qt build by adding U16_IS_SINGLE. 2007-12-10 Darin Adler Reviewed by Sam Weinig. - fix http://bugs.webkit.org/show_bug.cgi?id=16379 REGRESSION(r28525): Failures in http/tests/xmlhttprequest/response-encoding.html and fast/dom/xmlhttprequest-html-response-encoding.html and REGRESSION (306A4-ToT): Access violation in PCRE function find_firstassertedchar Test: fast/js/regexp-find-first-asserted.html * pcre/pcre_compile.cpp: (compileBracket): Take out unnecessary initialization of out parameters. (branchFindFirstAssertedCharacter): Added. Broke out the half of the function that handles a branch. (bracketFindFirstAssertedCharacter): Renamed from find_firstassertedchar. Also removed the options parameter -- the caller can handle the options. (jsRegExpCompile): Changed call site to call the appropriate bracket or branch version of the find_firstassertedchar function. Also put the REQ_IGNORE_CASE code here instead of passing in the options. 2007-12-10 Geoffrey Garen Reviewed by Sam Weinig. Split this: FunctionBodyNode ^ | ProgramNode into this: ScopeNode ^ ^ ^ | | | FunctionBodyNode ProgramNode EvalNode in preparation for specializing each class more while optimizing global variable access. Also removed some cruft from the FunctionBodyNode interface to simplify things. SunSpider says this patch is a .8% speedup, which seems reasonable, since it eliminates a few branches and adds KJS_FAST_CALL in a few places. Layout tests and JS tests pass. Also, this baby builds on Windows! (Qt mileage may vary...) 2007-12-10 Geoffrey Garen RS by Mark Rowe. Mac build fix: added some exported symbols, now that Parser::parse is defined in the header. * JavaScriptCore.exp: 2007-12-10 Sam Weinig Build fix. Template methods need to be in the header. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * kjs/Parser.cpp: * kjs/Parser.h: (KJS::Parser::parse): 2007-12-10 Geoffrey Garen Reviewed by Sam Weinig. Merged different implementations of Parser::parse into a single, templatized implementation, in preparation for adding yet another implementation for "eval" code. JS and layout tests pass. 2007-12-10 Timothy Hatcher Reviewed by Mark Rowe Bundle versions on Tiger should be 4523.x not 523.x * Configurations/Version.xcconfig: Some Tiger versions of Xcode don't set MAC_OS_X_VERSION_MAJOR, so assume Tiger and use a 4 for the SYSTEM_VERSION_PREFIX. 2007-12-10 Mark Rowe Tiger build fix. * kjs/grammar.y: Use @1 and @0 in place of @$ where Tiger's bison chokes. 2007-12-10 Darin Adler Reviewed by Mark Rowe. - fix http://bugs.webkit.org/show_bug.cgi?id=16375 REGRESSION: Safari crashes on quit Probably a debug-only issue. * kjs/Parser.cpp: (KJS::parser): Create the parser and never destroy it by using a pointer instead of a global object. 2007-12-09 Darin Adler Reviewed by Sam Weinig. - fix http://bugs.webkit.org/show_bug.cgi?id=16369 REGRESSION (r28525): regular expression tests failing due to bad firstByte optimization * pcre/pcre_compile.cpp: Changed some names to use interCaps intead of under_scores. (branchIsAnchored): Broke is_anchored into two separate functions; this one works on a branch and the other on an anchor. The old function would only work on a bracket. Also removed unneeded parameters; the anchored check does not require the bracket map or the options any more because we have a reduced set of features. (bracketIsAnchored): Ditto. (branchNeedsLineStart): Broke canApplyFirstCharOptimization into two functions and gave both a better name. This is the function that was returning the wrong value. The failure was beacuse the old function would only work on a bracket. (bracketNeedsLineStart): Ditto. (jsRegExpCompile): Changed to call the appropriate branch or bracket flavor of the functions based on whether we compiled an outer bracket. Also removed inaccurate comments and unneeded parameters. - other small changes * pcre/pcre.h: Renumbered error codes, in a logical order. First, normal failure, then the recursion limit, then running out of memory, and finally an unexpected internal error. * pcre/pcre_exec.cpp: Fixed indentation. (jsRegExpExecute): Corrected an inaccurate comment. 2007-12-09 Darin Adler Reviewed by Maciej. - fix http://bugs.webkit.org/show_bug.cgi?id=16370 REGRESSION (r28540): source URL and line number no longer set for outer function/programs Test: fast/js/exception-linenums-in-html-1.html Test: fast/js/exception-linenums-in-html-2.html Test: fast/js/exception-linenums.html By the time the ProgramNode was constructed, the source URL was empty. * kjs/Parser.cpp: (KJS::Parser::parseProgram): Added code to set and clear m_sourceURL, which is now handled here instead of in the lexer; it needs to still be set when we create the program node. Call setLoc to set the first and last line number. (KJS::Parser::parseFunctionBody): Ditto, but for the body. (KJS::Parser::parse): Removed the sourceURL argument. * kjs/Parser.h: Added sourceURL(), m_sourceURL, and m_lastLine. Added a lastLine parameter to didFinishParsing, since the bison grammar knows the last line number and we otherwise do not know it. Removed the sourceURL parameter from parse, since that's now handled at a higher level. * kjs/grammar.y: Pass the last line number to didFinishParsing. * kjs/lexer.cpp: (KJS::Lexer::setCode): Removed the sourceURL argument and the code to set m_sourceURL. (KJS::Lexer::clear): Ditto. * kjs/lexer.h: More of the same. * kjs/nodes.cpp: (KJS::FunctionBodyNode::FunctionBodyNode): Get the source URL from the parser rather than from the lexer. Removed unneeded call to setLoc, since the line numbers already both default to -1. 2007-12-08 Oliver Hunt Reviewed by Sam W. Split the ENABLE_SVG_EXPERIMENTAL_FEATURES flag into separate flags. Fixes Must disable SVG animation Disable SVG filters on Mac to match Windows behavior Minor config changes. * Configurations/JavaScriptCore.xcconfig: * JavaScriptCore.xcodeproj/project.pbxproj: 2007-12-07 Sam Weinig Reviewed by Darin. - Rename isSafeScript to allowsAccessFrom. * bindings/NP_jsobject.cpp: (_isSafeScript): * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::allowsAccessFrom): Reverse caller/argument of allowsAccessFrom to match the new call. 2007-12-07 Geoffrey Garen Reviewed by Sam Weinig. Refactored variable access optimization: Removed the assumption that the FunctionBodyNode holds the symbol table. 2007-12-07 Geoffrey Garen Build fix: added #include. * kjs/nodes.cpp: 2007-12-07 Geoffrey Garen Build fix: added #include. * kjs/interpreter.cpp: 2007-12-07 Geoffrey Garen Build fix: added #include. * kjs/grammar.y: 2007-12-07 Geoffrey Garen Build fix: added #include. * kjs/function_object.cpp: 2007-12-07 Geoffrey Garen Reviewed by Sam Weinig. Fixed crash seen running layout tests. Reverted a change I made earlier today. Added a comment to try to discourage myself from making this mistake a third time. * kjs/function.cpp: (KJS::ActivationImp::mark): * kjs/function.h: (KJS::ActivationImp::ActivationImpData::ActivationImpData): 2007-12-07 Geoffrey Garen Reviewed by Sam Weinig. Refactored parsing of global code: Removed the assumption that ProgramNode inherits from FunctionBodyNode from the parser. * kjs/Parser.cpp: (KJS::Parser::parseProgram): (KJS::Parser::parseFunctionBody): (KJS::Parser::parse): * kjs/Parser.h: (KJS::Parser::didFinishParsing): * kjs/function.cpp: * kjs/grammar.y: * kjs/nodes.h: 2007-12-07 Geoffrey Garen Build fix: added JSVariableObject.cpp to the .pri file. * JavaScriptCore.pri: 2007-12-07 Geoffrey Garen Build fix: added #include. * kjs/function.cpp: 2007-12-07 Steve Falkenburg Re-named our B&I flag from BUILDBOT to PRODUCTION. Reviewed by Sam Weinig. * JavaScriptCore.vcproj/JavaScriptCore.make: * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: 2007-12-07 Geoffrey Garen Build fix: removed stray name qualification. * kjs/function.h: (KJS::ActivationImp::ActivationImp): 2007-12-07 Geoffrey Garen Build fix: moved functions with qualified names outside of class declaration. * kjs/JSVariableObject.h: (KJS::JSVariableObject::symbolTableGet): (KJS::JSVariableObject::symbolTablePut): 2007-12-07 Geoffrey Garen Reviewed by Sam Weinig. Next step in refactoring JSGlobalObject: Added JSVariableObject class, and factored symbol-table-related code into it. (JSGlobalObject doesn't use the symbol table code yet, though.) Layout and JS tests, and testapi, pass. SunSpider reports no regression. 2007-12-07 Darin Adler Reviewed by Geoff. - fix http://bugs.webkit.org/show_bug.cgi?id=16185 jsRegExpCompile should not add implicit non-capturing bracket While this does not make SunSpider faster, it will make many regular expressions a bit faster. * pcre/pcre_compile.cpp: Moved CompileData struct in here from the header since it's private to this file. (compile_branch): Updated for function name change. (compile_bracket): Renamed from compile_regex, since, for one thing, this does not compile an entire regular expression. (calculateCompiledPatternLengthAndFlags): Removed unused item_count local variable. Renamed CompileData to cd instead of compile_block to be consistent with other functions. Added code to set the needOuterBracket flag if there's at least one "|" at the outer level. (jsRegExpCompile): Renamed CompileData to cd instead of compile_block to be consistent with other functions. Removed unneeded "size" field from the compiled regular expression. If no outer bracket is needed, then use compile_branch to compile the regular expression. * pcre/pcre_internal.h: Removed the CompileData struct, which is now private to pcre_compile.cpp. Removed the size member from JSRegExp. 2007-12-06 Kevin Ollivier MSVC7 build fix due to a compiler bug with placement new and/or templates and casting. Reviewed by Darin Adler. * wtf/Vector.h: (WTF::::append): 2007-12-06 Darin Adler Reviewed by Eric Seidel. - fix http://bugs.webkit.org/show_bug.cgi?id=16321 new RegExp("[\u0097]{4,6}", "gmy") crashes in DEBUG builds Test: fast/js/regexp-oveflow.html * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): In the case where a single character character class is optimized to not use a character class at all, the preflight code was not setting the lastitemlength variable. 2007-12-05 Mark Rowe Qt Windows build fix. Include the time-related headers in the correct place. * kjs/JSGlobalObject.cpp: * kjs/interpreter.cpp: 2007-12-05 Darin Adler Not reviewed; just undoing a previous commit. - remove earlier incorrect fix for http://bugs.webkit.org/show_bug.cgi?id=16220 Crash opening www.news.com (CNet) The real bug was the backwards ?: in the compile function, which Geoff just fixed. Rolling out the incorrect earlier fix. * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): Take out the unneeded preflight change. The regression test proves this is still working fine, so the bug remains fixed. 2007-12-01 Mark Rowe Build fix. Include headers before trying to use the things that they declare. * kjs/JSImmediate.cpp: * kjs/nodes.cpp: * kjs/object.cpp: * kjs/object_object.cpp: * kjs/regexp_object.cpp: * kjs/string_object.cpp: 2007-12-05 Geoffrey Garen Build fix: added some #includes. * kjs/JSImmediate.cpp: 2007-12-05 Geoffrey Garen Build fix: added some #includes. * kjs/JSGlobalObject.cpp: * kjs/JSImmediate.cpp: 2007-12-05 Geoffrey Garen Build fix: Fixed #include spelling. * kjs/debugger.cpp: 2007-12-05 Geoffrey Garen Build fix: added #include. * kjs/debugger.cpp: 2007-12-05 Geoffrey Garen Build fix: added a forward declaration. * kjs/debugger.h: 2007-12-05 Geoffrey Garen Build fix: added an #include. * kjs/error_object.cpp: 2007-12-05 Geoffrey Garen Build fix: added an #include. * kjs/bool_object.cpp: 2007-12-05 Geoffrey Garen Reviewed by Darin Adler. Third step in refactoring JSGlobalObject: Moved data members and functions accessing data members from Interpreter to JSGlobalObject. Changed Interpreter member functions to static functions. This resolves a bug in global object bootstrapping, where the global ExecState could be used when uninitialized. This is a big change, but it's mostly code motion and renaming. Layout and JS tests, and testjsglue and testapi, pass. SunSpider reports a .7% regression, but Shark sees no difference related to this patch, and SunSpider reported a .7% speedup from an earlier step in this refactoring, so I think it's fair to call that a wash. 2007-12-05 Geoffrey Garen Reviewed by Darin Adler. (Or vice versa.) Fixed ASSERT during run-javascriptcore-tests. (Darin just added the ASSERT, but the bug wasn't new.) * pcre/pcre_compile.cpp: (compile_branch): The ?: operator here was backwards, causing us to execute the loop too many times, adding stray KET opcodes to the compiled regular expression. 2007-12-05 Kevin McCullough Reviewed by Geoff. - Wait until local variable data is fully constructed before notifying the debugger of entering or leaving a call frame. * kjs/function.cpp: (KJS::FunctionImp::callAsFunction): * kjs/nodes.cpp: (KJS::FunctionBodyNode::execute): 2007-12-05 Mark Rowe Reviewed by Oliver. Build fix for GCC 4.2. Cast via a union to avoid strict-aliasing issues. * wtf/FastMalloc.cpp: (WTF::): (WTF::getPageHeap): 2007-12-05 Mark Rowe Reviewed by Darin. Fix testkjs in 64-bit. When built for 64-bit the TCMalloc spin lock uses pthread mutexes rather than a custom spin lock implemented in assembly. If we fail to initialize the pthread mutex, attempts to lock or unlock it will fail and trigger a call to abort. * wtf/FastMalloc.cpp: Initialize the spin lock so that we can later lock and unlock it. * wtf/TCSpinLock.h: Add an Init method to the optimised spin lock. 2007-12-04 Oliver Hunt Reviewed by NOBODY (Build fix). Fix gtk build. * wtf/TCSystemAlloc.cpp: 2007-12-03 Oliver Hunt Reviewed by Mark Rowe and Geoff Garen. Merge TCMalloc r38 It also result in a performance progression between 0.5% and 0.9% depending on the test, however most if not all of this gain will be consumed by the overhead involved in the later change to release memory to the system. * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/FastMalloc.cpp: (WTF::KernelSupportsTLS): (WTF::CheckIfKernelSupportsTLS): (WTF::): (WTF::ClassIndex): (WTF::SLL_Next): (WTF::SLL_SetNext): (WTF::SLL_Push): (WTF::SLL_Pop): (WTF::SLL_PopRange): (WTF::SLL_PushRange): (WTF::SLL_Size): (WTF::SizeClass): (WTF::ByteSizeForClass): (WTF::NumMoveSize): (WTF::InitSizeClasses): (WTF::AllocationSize): (WTF::TCMalloc_PageHeap::GetSizeClassIfCached): (WTF::TCMalloc_PageHeap::CacheSizeClass): (WTF::TCMalloc_PageHeap::init): (WTF::TCMalloc_PageHeap::New): (WTF::TCMalloc_PageHeap::AllocLarge): (WTF::TCMalloc_PageHeap::Carve): (WTF::TCMalloc_PageHeap::Delete): (WTF::TCMalloc_PageHeap::IncrementalScavenge): (WTF::PagesToMB): (WTF::TCMalloc_PageHeap::Dump): (WTF::TCMalloc_PageHeap::GrowHeap): (WTF::TCMalloc_PageHeap::Check): (WTF::ReleaseFreeList): (WTF::TCMalloc_PageHeap::ReleaseFreePages): (WTF::TCMalloc_ThreadCache_FreeList::Push): (WTF::TCMalloc_ThreadCache_FreeList::PushRange): (WTF::TCMalloc_ThreadCache_FreeList::PopRange): (WTF::TCMalloc_ThreadCache_FreeList::Pop): (WTF::TCMalloc_Central_FreeList::length): (WTF::TCMalloc_Central_FreeList::tc_length): (WTF::TCMalloc_Central_FreeList::Init): (WTF::TCMalloc_Central_FreeList::ReleaseListToSpans): (WTF::TCMalloc_Central_FreeList::EvictRandomSizeClass): (WTF::TCMalloc_Central_FreeList::MakeCacheSpace): (WTF::TCMalloc_Central_FreeList::ShrinkCache): (WTF::TCMalloc_Central_FreeList::InsertRange): (WTF::TCMalloc_Central_FreeList::RemoveRange): (WTF::TCMalloc_Central_FreeList::FetchFromSpansSafe): (WTF::TCMalloc_Central_FreeList::Populate): (WTF::TCMalloc_ThreadCache::Init): (WTF::TCMalloc_ThreadCache::Cleanup): (WTF::TCMalloc_ThreadCache::Allocate): (WTF::TCMalloc_ThreadCache::Deallocate): (WTF::TCMalloc_ThreadCache::FetchFromCentralCache): (WTF::TCMalloc_ThreadCache::ReleaseToCentralCache): (WTF::TCMalloc_ThreadCache::Scavenge): (WTF::TCMalloc_ThreadCache::PickNextSample): (WTF::TCMalloc_ThreadCache::NewHeap): (WTF::TCMalloc_ThreadCache::GetThreadHeap): (WTF::TCMalloc_ThreadCache::GetCache): (WTF::TCMalloc_ThreadCache::GetCacheIfPresent): (WTF::TCMalloc_ThreadCache::InitTSD): (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): (WTF::TCMallocStats::ExtractStats): (WTF::TCMallocStats::DumpStats): (WTF::TCMallocStats::DumpStackTraces): (WTF::TCMallocStats::TCMallocImplementation::MarkThreadIdle): (WTF::TCMallocStats::TCMallocImplementation::ReleaseFreeMemory): (WTF::TCMallocStats::TCMallocGuard::TCMallocGuard): (WTF::TCMallocStats::TCMallocGuard::~TCMallocGuard): (WTF::TCMallocStats::DoSampledAllocation): (WTF::TCMallocStats::CheckCachedSizeClass): (WTF::TCMallocStats::CheckedMallocResult): (WTF::TCMallocStats::SpanToMallocResult): (WTF::TCMallocStats::do_malloc): (WTF::TCMallocStats::do_free): (WTF::TCMallocStats::do_memalign): (WTF::TCMallocStats::do_malloc_stats): (WTF::TCMallocStats::do_mallopt): (WTF::TCMallocStats::do_mallinfo): (WTF::TCMallocStats::realloc): (WTF::TCMallocStats::cpp_alloc): (WTF::TCMallocStats::operator new): (WTF::TCMallocStats::): (WTF::TCMallocStats::operator new[]): (WTF::TCMallocStats::malloc_stats): (WTF::TCMallocStats::mallopt): (WTF::TCMallocStats::mallinfo): * wtf/TCPackedCache.h: Added. (PackedCache::PackedCache): (PackedCache::Put): (PackedCache::Has): (PackedCache::GetOrDefault): (PackedCache::Clear): (PackedCache::EntryToValue): (PackedCache::EntryToUpper): (PackedCache::KeyToUpper): (PackedCache::UpperToPartialKey): (PackedCache::Hash): (PackedCache::KeyMatch): * wtf/TCPageMap.h: (TCMalloc_PageMap2::PreallocateMoreMemory): * wtf/TCSystemAlloc.cpp: (TCMalloc_SystemRelease): * wtf/TCSystemAlloc.h: 2007-12-04 Anders Carlsson Reviewed by Sam. Make isSafeScript const. * kjs/JSGlobalObject.h: (KJS::JSGlobalObject::isSafeScript): 2007-12-04 Darin Adler Reviewed by Geoff. - fix first part of http://bugs.webkit.org/show_bug.cgi?id=16220 Crash opening www.news.com (CNet) Test: fast/js/regexp-overflow.html * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): Add room for the additional BRA/KET that was generated in the compile code but not taken into account here. 2007-12-03 Darin Adler Reviewed by Geoff. - fix http://bugs.webkit.org/show_bug.cgi?id=15618 REGRESSION: Stack overflow/crash in KJS::equal (15618) Test: fast/js/recursion-limit-equal.html * kjs/operations.cpp: (KJS::equal): Check the exception from toPrimitive. 2007-12-03 Dan Bernstein - fix a copy-and-paste-o * bindings/npruntime.cpp: (_NPN_GetIntIdentifier): 2007-12-03 Dan Bernstein Reviewed by Darin Adler. - fix an ASSERT when getIntIdentifier is called with 0 or -1 * bindings/npruntime.cpp: (_NPN_GetIntIdentifier): We cannot use the hashmap for 0 and -1 since they are the empty value and the deleted value. Instead, keep the identifiers for those two integers in a static array. 2007-12-02 Darin Adler Reviewed by Mitz. - fix http://bugs.webkit.org/show_bug.cgi?id=15848 REGRESSION: Assertion failure viewing comments page on digg.com Test: fast/js/sparse-array.html * kjs/array_instance.cpp: (KJS::ArrayInstance::inlineGetOwnPropertySlot): Check sparse array cutoff before looking in hash map. Can't avoid the branch because we can't look for 0 in the hash. (KJS::ArrayInstance::deleteProperty): Ditto. 2007-12-02 Geoffrey Garen Build fix: added an #include. * kjs/collector.cpp: 2007-12-02 Geoffrey Garen Reviewed by Eric Seidel. Second step in refactoring JSGlobalObject: moved virtual functions from Interpreter to JSGlobalObject. Layout and JS tests pass. SunSpider reports a .7% speedup -- don't believe his lies. 2007-12-01 Alp Toker Reviewed by Adam Roben. http://bugs.webkit.org/show_bug.cgi?id=16228 kJSClassDefinitionEmpty is not exported with JS_EXPORT Add JS_EXPORT to kJSClassDefinitionEmpty. Make the gcc compiler check take precedence over the WIN32||_WIN32 check to ensure that symbols are exported on Windows when using gcc. Add a TODO referencing the bug about JS_EXPORT in the Win build (http://bugs.webkit.org/show_bug.cgi?id=16227) Don't define JS_EXPORT as 'extern' when the compiler is unknown since it would result in the incorrect expansion: extern extern const JSClassDefinition kJSClassDefinitionEmpty; (This was something we inherited from CFBase.h that doesn't make sense for JSBase.h) * API/JSBase.h: * API/JSObjectRef.h: 2007-11-30 Geoffrey Garen Reviewed by Beth Dakin. Reversed the ownership relationship between Interpreter and JSGlobalObject. Now, the JSGlobalObject owns the Interpreter, and top-level objects that need the two to persist just protect the JSGlobalObject from GC. Global object bootstrapping looks a little odd right now, but it will make much more sense soon, after further rounds of refactoring. * bindings/runtime_root.h: Made this class inherit from RefCounted, to avoid code duplication. * kjs/collector.cpp: (KJS::Collector::collect): No need to give special GC treatment to Interpreters, since we mark their global objects, which mark them. * kjs/interpreter.cpp: (KJS::Interpreter::mark): No need to mark our global object, since it marks us. * kjs/interpreter.h: Don't inherit from RefCounted -- JSGlobalObject owns us directly. * kjs/testkjs.cpp: Modified to follow the new rules. (createGlobalObject): (runWithScripts): 2007-11-30 Brent Fulgham Reviewed by Eric. * ChangeLog: * pcre/pcre_compile.cpp: (compile_branch): 2007-11-30 Eric Seidel No review, build fix only. Fix uninitialized var warnings in release build. * JavaScriptCore.xcodeproj/project.pbxproj: * pcre/pcre_compile.cpp: (compile_regex): 2007-11-30 Darin Adler Reviewed by Adam Roben. - fix http://bugs.webkit.org/show_bug.cgi?id=16207 JavaScript regular expressions should match UTF-16 code units rather than characters SunSpider says this is 5.5% faster on the regexp test, 0.4% faste overall. Test: fast/js/regexp-non-bmp.html Renamed ANY_CHAR to NOT_NEWLINE to more-accurately reflect its meaning. * pcre/pcre_compile.cpp: (compile_branch): Removed calls to the UTF-16 character accessor functions, replacing them with simple pointer dereferences in some cases, and no code at all in others. (calculateCompiledPatternLengthAndFlags): Ditto. * pcre/pcre_exec.cpp: (match): Fixed indentation of some case labels (including all the BEGIN_OPCODE). Removed calls to the UTF-16 character accessor functions, replacing them with simple pointer dereferences in some cases, and no code at all in others. Also removed some explicit UTF-16 support code in a few cases. Removed the unneeded "UTF-8" code path in the ANY_CHAR repeat code, and in another case, eliminated the code to check against end_subject in because it is already done outside the loop. (jsRegExpExecute): * pcre/pcre_internal.h: Removed all the UTF-16 helper functions. 2007-11-30 Eric Seidel Reviewed by darin. PCRE crashes under GuardMalloc http://bugs.webkit.org/show_bug.cgi?id=16127 check against patternEnd to make sure we don't walk off the end of the string * pcre/pcre_compile.cpp: (compile_branch): (calculateCompiledPatternLengthAndFlags): 2007-11-30 Eric Seidel Reviewed by Maciej. Fix layout test regressions caused by r28186 http://bugs.webkit.org/show_bug.cgi?id=16195 change first_byte and req_byte back to shorts instead of chars (I think PCRE stuffs information in the high bits) * pcre/pcre_internal.h: 2007-11-29 Oliver Hunt Reviewed by Maciej and Darin. Make the JS collector work with multiple threads Under heavy contention it was possible the GC to suspend other threads inside the pthread spinlock, which could lead to the GC thread blocking on the pthread spinlock itself. We now determine and store each thread's stack base when it is registered, thus removing the need for any calls to pthread_get_stackaddr_np that needed the pthread spinlock. * kjs/collector.cpp: (KJS::Collector::Thread::Thread): (KJS::Collector::registerThread): (KJS::Collector::markOtherThreadConservatively): 2007-11-29 Adam Roben Windows build fix Removed some unreachable code (ironically, the code was some ASSERT_NOT_REACHED()s). * pcre/pcre_compile.cpp: (compile_branch): * pcre/pcre_exec.cpp: (match): 2007-11-29 Eric Seidel Reviewed by Mark Rowe. Fix for --guard crash of fast/js/regexp-charclass-crash introduced by r28151. * pcre/pcre_compile.cpp: (is_anchored): 2007-11-28 Mark Rowe Gtk build fix. Rubber-stamped by Eric. * pcre/pcre_exec.cpp: (match): Add braces around the body of the case statement to prevent wanings about jumps across the initialization of a variable. 2007-11-29 Eric Seidel Reviewed by Mark Rowe. Attempt to fix non-mac builds after PCRE cleanup. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCoreSources.bkl: * pcre/pcre.pri: 2007-11-28 Eric Seidel Reviewed by Maciej. Centralize code for subjectPtr adjustments using inlines, only ever check for a single trailing surrogate (as UTF16 only allows one), possibly fix PCRE bugs involving char classes and garbled UTF16 strings. * pcre/pcre_exec.cpp: (match): (jsRegExpExecute): * pcre/pcre_internal.h: (getPreviousChar): (movePtrToPreviousChar): (movePtrToNextChar): (movePtrToStartOfCurrentChar): 2007-11-28 Eric Seidel Reviewed by Maciej. change getChar* functions to return result and push 'c' into local scopes for clarity * pcre/pcre_compile.cpp: (compile_branch): (calculateCompiledPatternLengthAndFlags): * pcre/pcre_exec.cpp: (match): * pcre/pcre_internal.h: (getChar): (getCharAndAdvance): (getCharAndLength): (getCharAndAdvanceIfSurrogate): 2007-11-28 Eric Seidel Reviewed by Sam. Comment cleanup * pcre/pcre_exec.cpp: (match): 2007-11-26 Eric Seidel Reviewed by Sam. Further cleanups to calculateCompiledPatternLengthAndFlags * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): * pcre/pcre_internal.h: 2007-11-26 Eric Seidel Reviewed by Sam. Give consistent naming to the RegExp options/compile flags * pcre/pcre_compile.cpp: (compile_branch): (is_anchored): (find_firstassertedchar): (printCompiledRegExp): (jsRegExpCompile): * pcre/pcre_exec.cpp: (jsRegExpExecute): * pcre/pcre_internal.h: 2007-11-26 Eric Seidel Reviewed by Sam. Pull first_byte and req_byte optimizations out into separate static funtions, SunSpider reported this as a win. * pcre/pcre_exec.cpp: (tryFirstByteOptimization): (tryRequiredByteOptimization): (jsRegExpExecute): * pcre/pcre_internal.h: 2007-11-26 Eric Seidel Reviewed by Maciej. give PCRE_MULTILINE a better name: OptionMatchAcrossMultipleLines * pcre/pcre_compile.cpp: (compile_branch): (is_anchored): (printCompiledRegExp): (jsRegExpCompile): * pcre/pcre_exec.cpp: (jsRegExpExecute): * pcre/pcre_internal.h: 2007-11-26 Eric Seidel Reviewed by Oliver. Deprecate jsRegExpExecute's offset-vector fallback code * pcre/pcre_exec.cpp: (jsRegExpExecute): 2007-11-26 Eric Seidel Reviewed by Maciej. Make cur_is_word and prev_is_word locals, and change OP_ANY to OP_ANY_CHAR for clarity * pcre/pcre_compile.cpp: (find_fixedlength): (compile_branch): (canApplyFirstCharOptimization): * pcre/pcre_exec.cpp: (match): * pcre/pcre_internal.h: 2007-11-26 Eric Seidel Reviewed by Mitz & Maciej. Change _NC operators to use _IGNORING_CASE for clarity * pcre/pcre_compile.cpp: (find_fixedlength): (compile_branch): (find_firstassertedchar): * pcre/pcre_exec.cpp: (match): * pcre/pcre_internal.h: 2007-11-26 Eric Seidel Reviewed by Mitz. Remove branch from return * pcre/pcre_compile.cpp: (compile_branch): * pcre/pcre_exec.cpp: (match): 2007-11-26 Eric Seidel Reviewed by Maciej. Add repeatInformationFromInstructionOffset inline * pcre/pcre_exec.cpp: (repeatInformationFromInstructionOffset): (match): 2007-11-26 Eric Seidel Reviewed by Maciej. Remove no longer used error code JSRegExpErrorMatchLimit * kjs/regexp.cpp: (KJS::RegExp::match): * pcre/pcre.h: * pcre/pcre_internal.h: 2007-11-26 Eric Seidel Reviewed by Sam. Make i locally scoped for better code clarity * pcre/pcre_exec.cpp: (match): 2007-11-26 Eric Seidel Reviewed by Maciej. Give subjectPtr and instructionPtr sane names, reduce size of MatchFrame for a 0.2% speedup. * pcre/pcre_compile.cpp: (compile_branch): (calculateCompiledPatternLengthAndFlags): * pcre/pcre_exec.cpp: (match_ref): (MatchStack::pushNewFrame): (getUTF8CharAndIncrementLength): (match): * pcre/pcre_internal.h: (getChar): (getCharAndAdvance): (getCharAndLength): (getCharAndAdvanceIfSurrogate): * pcre/pcre_xclass.cpp: (getUTF8CharAndAdvancePointer): 2007-11-26 Eric Seidel Reviewed by Sam. Small speedup (0.7%) by simplifying canUseStackBufferForNextFrame() check * pcre/pcre_exec.cpp: (MatchStack::MatchStack): (MatchStack::popCurrentFrame): 2007-11-25 Eric Seidel Reviewed by Sam. Lower MATCH_LIMIT_RECURSION to more sane levels to prevent hangs on run-javascriptcore-tests * pcre/pcre_internal.h: 2007-11-25 Eric Seidel Reviewed by Maciej. Remove match_is_group variable for another 5% speedup * pcre/pcre_compile.cpp: * pcre/pcre_exec.cpp: (startNewGroup): (match): 2007-11-28 Eric Seidel Reviewed by Sam. Abstract frame variables into locals and args * pcre/pcre_compile.cpp: (compile_branch): * pcre/pcre_exec.cpp: (match): * pcre/pcre_internal.h: 2007-11-28 Eric Seidel Reviewed by Sam. Section off MatchData arguments into args struct * pcre/pcre_exec.cpp: (MatchStack::pushNewFrame): (match): 2007-11-24 Eric Seidel Reviewed by Sam. Remove redundant eptrblock struct * pcre/pcre_exec.cpp: (MatchStack::pushNewFrame): (match): 2007-11-24 Eric Seidel Reviewed by Maciej. Remove redundant match_call_count and move recursion check out of super-hot code path SunSpider says this is at least an 8% speedup for regexp. * pcre/pcre_exec.cpp: (MatchStack::MatchStack): (MatchStack::pushNewFrame): (MatchStack::popCurrentFrame): (MatchStack::popAllFrames): (match): (jsRegExpExecute): * pcre/pcre_internal.h: 2007-11-24 Eric Seidel Reviewed by Sam. Get rid of GETCHAR* macros, replacing them with better named inlines * pcre/pcre_compile.cpp: (compile_branch): (calculateCompiledPatternLengthAndFlags): * pcre/pcre_exec.cpp: (match): * pcre/pcre_internal.h: (getCharAndAdvance): (getCharAndLength): (getCharAndAdvanceIfSurrogate): 2007-11-24 Eric Seidel Reviewed by Sam. Further cleanup GET/PUT inlines * pcre/pcre_internal.h: (putOpcodeValueAtOffset): (getOpcodeValueAtOffset): (putOpcodeValueAtOffsetAndAdvance): (put2ByteOpcodeValueAtOffset): (get2ByteOpcodeValueAtOffset): (put2ByteOpcodeValueAtOffsetAndAdvance): 2007-11-24 Eric Seidel Reviewed by Sam. Give GET, PUT better names, and add (poor) moveOpcodePtrPastAnyAlternateBranches * pcre/pcre_compile.cpp: (firstSignificantOpCodeSkippingAssertions): (find_fixedlength): (complete_callout): (compile_branch): (compile_regex): (is_anchored): (canApplyFirstCharOptimization): (find_firstassertedchar): * pcre/pcre_exec.cpp: (match): * pcre/pcre_internal.h: (putOpcodeValueAtOffset): (getOpcodeValueAtOffset): (putOpcodeValueAtOffsetAndAdvance): (put2ByteOpcodeValueAtOffset): (get2ByteOpcodeValueAtOffset): (moveOpcodePtrPastAnyAlternateBranches): * pcre/pcre_ucp_searchfuncs.cpp: (_pcre_ucp_othercase): 2007-11-24 Eric Seidel Reviewed by Sam. Add inlines for toLowerCase, isWordChar, isSpaceChar for further regexp speedup * pcre/pcre_compile.cpp: (compile_branch): (jsRegExpCompile): * pcre/pcre_exec.cpp: (match): (jsRegExpExecute): * pcre/pcre_internal.h: (toLowerCase): (flipCase): (classBitmapForChar): (charTypeForChar): (isWordChar): (isSpaceChar): (CompileData::CompileData): * pcre/pcre_xclass.cpp: (_pcre_xclass): 2007-11-24 Eric Seidel Reviewed by Sam. cleanup _pcre_ucp_othercase * pcre/pcre_ucp_searchfuncs.cpp: (_pcre_ucp_othercase): 2007-11-24 Eric Seidel Reviewed by Maciej. Use better variable names for case ignoring options * pcre/pcre_compile.cpp: (compile_branch): (find_firstassertedchar): (printCompiledRegExp): (jsRegExpCompile): * pcre/pcre_exec.cpp: (match_ref): (match): (jsRegExpExecute): * pcre/pcre_internal.h: 2007-11-24 Eric Seidel Reviewed by Sam. split first_significant_code into two simpler functions * pcre/pcre_compile.cpp: (firstSignificantOpCode): (firstSignificantOpCodeSkippingAssertions): (is_anchored): (canApplyFirstCharOptimization): (find_firstassertedchar): 2007-11-24 Eric Seidel Reviewed by Sam. clean up is_counted_repeat * pcre/pcre_compile.cpp: (is_counted_repeat): 2007-11-24 Eric Seidel Reviewed by Sam. clean up check_escape * pcre/pcre_compile.cpp: (check_escape): 2007-11-24 Eric Seidel Reviewed by Sam. Reformat find_fixedlength * pcre/pcre_compile.cpp: (find_fixedlength): 2007-11-24 Eric Seidel Reviewed by Sam. reformat is_anchored * pcre/pcre_compile.cpp: (is_anchored): 2007-11-24 Eric Seidel Reviewed by Maciej. Remove unused function could_be_empty_branch * pcre/pcre_compile.cpp: (first_significant_code): (find_fixedlength): (compile_branch): (canApplyFirstCharOptimization): 2007-11-24 Eric Seidel Reviewed by Sam. Pass around MatchData objects by reference * pcre/pcre_exec.cpp: (pchars): (match_ref): (match): (jsRegExpExecute): 2007-11-24 Eric Seidel Reviewed by Sam. give PCRE_STARTLINE a better name and rename match_data to MatchData * pcre/pcre_compile.cpp: (compile_branch): (canApplyFirstCharOptimization): (find_firstassertedchar): (printCompiledRegExp): (jsRegExpCompile): * pcre/pcre_exec.cpp: (pchars): (jsRegExpExecute): * pcre/pcre_internal.h: 2007-11-24 Eric Seidel Reviewed by Sam. Clean up find_firstassertedchar * pcre/pcre_compile.cpp: (get_othercase_range): (find_firstassertedchar): (calculateCompiledPatternLengthAndFlags): 2007-11-24 Eric Seidel Reviewed by Tim Hatcher. Pass around CompileData& instead of CompileData* * pcre/pcre_compile.cpp: (compile_branch): (jsRegExpCompile): 2007-11-24 Eric Seidel Reviewed by Sam. Clean up compile_branch, move _pcre_ord2utf8, and rename CompileData * JavaScriptCore.xcodeproj/project.pbxproj: * pcre/pcre_compile.cpp: (_pcre_ord2utf8): (calculateCompiledPatternLengthAndFlags): (jsRegExpCompile): * pcre/pcre_internal.h: * pcre/pcre_ord2utf8.cpp: Removed. 2007-11-24 Eric Seidel Reviewed by Sam. removing more macros * pcre/pcre_compile.cpp: (could_be_empty_branch): (compile_branch): (calculateCompiledPatternLengthAndFlags): * pcre/pcre_exec.cpp: (match): (jsRegExpExecute): * pcre/pcre_internal.h: * pcre/pcre_xclass.cpp: 2007-11-24 Eric Seidel Reviewed by Maciej. clean up formating in compile_branch * pcre/pcre_compile.cpp: (compile_branch): 2007-11-24 Eric Seidel Reviewed by Sam. Fix spacing for read_repeat_counts * pcre/pcre_compile.cpp: (read_repeat_counts): 2007-11-24 Eric Seidel Reviewed by Sam. Get rid of PCRE custom char types * pcre/pcre_compile.cpp: (check_escape): (complete_callout): (compile_branch): (compile_regex): (calculateCompiledPatternLengthAndFlags): (jsRegExpCompile): * pcre/pcre_exec.cpp: (match_ref): (match): (jsRegExpExecute): * pcre/pcre_internal.h: 2007-11-24 Eric Seidel Reviewed by Sam. reformat get_othercase_range * pcre/pcre_compile.cpp: (get_othercase_range): 2007-11-24 Eric Seidel Reviewed by Maciej. Remove register keyword and more cleanup * pcre/pcre_compile.cpp: (find_fixedlength): (compile_branch): (is_anchored): (is_startline): (find_firstassertedchar): (calculateCompiledPatternLengthAndFlags): (jsRegExpCompile): * pcre/pcre_exec.cpp: (MatchStack::canUseStackBufferForNextFrame): (MatchStack::allocateNextFrame): (MatchStack::pushNewFrame): (MatchStack::frameIsStackAllocated): (MatchStack::popCurrentFrame): (MatchStack::unrollAnyHeapAllocatedFrames): (getUTF8CharAndIncrementLength): (match): (jsRegExpExecute): * pcre/pcre_internal.h: (PUT2INC): (isLeadingSurrogate): (isTrailingSurrogate): (decodeSurrogatePair): (getChar): * pcre/pcre_ord2utf8.cpp: (_pcre_ord2utf8): * pcre/pcre_xclass.cpp: (getUTF8CharAndAdvancePointer): (_pcre_xclass): 2007-11-24 Eric Seidel Reviewed by Maciej. Clean up jsRegExpExecute * pcre/pcre_compile.cpp: (returnError): (jsRegExpCompile): * pcre/pcre_exec.cpp: (jsRegExpExecute): * pcre/pcre_internal.h: 2007-11-29 Oliver Hunt Reviewed by Geoff. Merging updated system alloc and spinlock code from r38 of TCMalloc. This is needed as a precursor to the merge of TCMalloc proper. * wtf/FastMalloc.cpp: (WTF::TCMalloc_PageHeap::GrowHeap): * wtf/TCSpinLock.h: (TCMalloc_SpinLock::TCMalloc_SpinLock): (TCMalloc_SpinLock::): (TCMalloc_SpinLock::Lock): (TCMalloc_SpinLock::Unlock): (TCMalloc_SpinLock::IsHeld): * wtf/TCSystemAlloc.cpp: (TrySbrk): (TryMmap): (TryVirtualAlloc): (TryDevMem): (TCMalloc_SystemAlloc): * wtf/TCSystemAlloc.h: 2007-11-28 Brady Eidson Reviewed by Geoff Add copyKeysToVector utility, mirroring copyValuesToVector Also change the copyValuesToVector implementation to be a little more attractive * wtf/HashMap.h: (WTF::copyKeysToVector): (WTF::copyValuesToVector): 2007-11-27 Alp Toker Reviewed by Mark Rowe. Add a list of public JavaScriptCore headers for installation. This follows the convention used for the Qt and GTK+ header lists. * headers.pri: Added. 2007-11-27 Alp Toker Prospective MSVC build fix. Roll back dllexport/dllimport support for now. * API/JSBase.h: 2007-11-27 Alp Toker Reviewed by Maciej. http://bugs.webkit.org/show_bug.cgi?id=15569 [gtk] GTK JavaScriptCore needs to export symbols for JSC API and WTF Introduce JS_EXPORT to mark symbols to be exported as public API. Export all public symbols in the JavaScriptCore C API. This matches conventions for exporting symbols set by the CF and CG frameworks. * API/JSBase.h: * API/JSContextRef.h: * API/JSObjectRef.h: * API/JSStringRef.h: * API/JSStringRefBSTR.h: * API/JSStringRefCF.h: * API/JSValueRef.h: 2007-11-27 Anders Carlsson Reviewed by Adam. Make PropertyNameArray and ScopeChain COMEnumVariant friendly. * kjs/PropertyNameArray.cpp: (KJS::PropertyNameArray::swap): Implement PropertyNameArray::swap. * kjs/PropertyNameArray.h: Add ValueType typedef. Replace PropertyNameArrayIterator with PropertyNameArray::const_iterator. * kjs/nodes.cpp: (KJS::ForInNode::execute): * kjs/scope_chain.cpp: (KJS::ScopeChain::print): Update for changes to PropertyNameArray. * kjs/scope_chain.h: Add const_iterator and ValueType typedef. 2007-11-27 Anders Carlsson Reviewed by Darin. Add a ValueType typedef. * wtf/Vector.h: 2007-11-26 Darin Adler Reviewed by Mitz. - fix http://bugs.webkit.org/show_bug.cgi?id=16096 REGRESSION (r26653-r26699): Plaxo.com addressbook does not load in webkit nightlies Test: fast/js/regexp-overflow.html * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): Removed a stray "ptr++" that I added by accident when merging the changes between PCRE 6.4 and 6.5. 2007-11-26 Geoffrey Garen Reviewed by Kevin McCullough. Fixed REGRESSION (r27126): Drosera does not show variables (can't enumerate ActivationImp properties) Implemented a custom ActivationImp::getPropertyNames, since ActivationImp now uses a custom property storage mechanism for local variables. * kjs/function.cpp: (KJS::ActivationImp::getPropertyNames): * kjs/function.h: 2007-11-26 Alp Toker GTK+/Qt/Wx build fix for breakage introduced in r28039. * ForwardingHeaders/JavaScriptCore/JSRetainPtr.h: Added. 2007-11-24 Laszlo Gombos Reviewed by Maciej Stachowiak. Fix minor compiler warning (GCC 4.1.3) * pcre/pcre_internal.h: * pcre/pcre_ucp_searchfuncs.cpp: (_pcre_ucp_othercase): 2007-11-25 Mark Rowe Reviewed by Dan Bernstein. Fix http://bugs.webkit.org/show_bug.cgi?id=16129 Bug 16129: REGRESSION (r27761-r27811): malloc error while visiting http://mysit.es (crashes release build) * pcre/pcre_compile.cpp: Change errorcode to be passed by reference so that any error code is propagated to our caller like they expect. 2007-11-23 Kevin Ollivier MSVC7 build fix. (rand_s doesn't exist there) Reviewed by Adam Roben. * kjs/config.h: * wtf/MathExtras.h: 2007-11-23 Kevin Ollivier wx build fix. Move WX_PYTHON logic into project build settings, add WebKitLibraries dirs on Win, and explicitly include JSCore headers in testkjs rather than getting them from a template. (Include dir order of JSCore/WTF and ICU headers is important due to wtf/unicode/utf8.h.) * jscore.bkl: 2007-11-23 Simon Hausmann Reviewed by George Staikos . Fix make (dist)clean on Windows. OBJECTS_DIR_WTR does not exist anymore, use GENERATED_SOURCES_DIR. * JavaScriptCore.pri: * pcre/pcre.pri: 2007-11-22 Simon Hausmann Reviewed by George. Make the directory of where to put the generated sources configurable through the GENERATED_SOURCE_DIR variable * JavaScriptCore.pri: * pcre/pcre.pri: 2007-11-22 Simon Hausmann Reviewed by George. Centralize the setup for all the extra compilers in a addExtraCompiler function. This allows adding a "generated_files" target that builds all generated files using "make generated_files". For the build inside Qt we do not generate actual rules for the extra compilers but instead do the variable substitution of compiler.output manually and add the generated sources to SOURCES. * JavaScriptCore.pri: * pcre/pcre.pri: 2007-11-20 Mark Rowe Reviewed by Tim Hatcher. Need to resolve new GCC 4.2 warnings Fix all warnings emitted by GCC 4.2 when building JavaScriptCore. This allows builds with -Werror to succeed. At present they will crash when executed due to code that is not safe under strict aliasing (). * Configurations/Base.xcconfig: Remove the -Wno-long-double flag. * kjs/date_object.cpp: (KJS::formatTime): Test whether the stack-allocated string is empty rather than at a non-null address. * kjs/dtoa.cpp: (Bigint::): Tweak formatting to silence warnings. * pcre/pcre_exec.cpp: (match): Tweak formatting to silence warnings * wtf/Assertions.cpp: Add printf format attribute to functions that warrant it. * wtf/Assertions.h: Ditto. 2007-11-19 Kevin Ollivier wx port build fix (wx headers include ctype functions). * kjs/config.h: 2007-11-19 Kevin Ollivier Remove outdated and unused Windows port files. Reviewed by Adam Roben. * Makefile.vc: Removed. * README-Win32.txt: Removed. 2007-11-18 Eric Seidel Reviewed by Oliver. * tests/mozilla/jsDriver.pl: exit non-0 when user aborts test run 2007-11-17 Mark Rowe Reviewed by Darin Adler. Fix: REGRESSION: testapi exits with assertion failure in debug build JSGlobalContextCreate throws away globalObjectClass's prototype http://bugs.webkit.org/show_bug.cgi?id=16033 Split Interpreter's initialization into two distinct steps: the creation of the global prototypes and constructors, and storing them on the global object. This allows JSClassRef's passed to JSGlobalContextCreate to be instantiated with the correct prototype. * API/JSCallbackObject.cpp: Assert at compile-time that the custom global object will fit in a collector cell. * API/JSCallbackObject.h: * API/JSCallbackObjectFunctions.h: (KJS::::JSCallbackObject): (KJS::::init): * API/JSContextRef.cpp: (JSGlobalContextCreate): Construct and set the interpreter's global object separately. When globalObjectClass is passed we need to set the interpreter's global object before doing the JSCallbackObject's initialization to prevent any JSObjectInitializeCallback's being invoked before a global object is set. * API/testapi.c: (globalObject_initialize): Test the object passed in is correct and that it has the expected global properties. (globalObject_get): (globalObject_set): (main): * API/testapi.js: Test that any static properties exposed by the global object's custom class are found. * JavaScriptCore.exp: * bindings/testbindings.cpp: (main): Update for changes in Interpreter method signatures. * bindings/testbindings.mm: (main): Ditto. * kjs/ExecState.cpp: (KJS::ExecState::ExecState): (KJS::ExecState::mark): (KJS::ExecState::setGlobalObject): * kjs/ExecState.h: Rename scope to m_scopeChain. * kjs/interpreter.cpp: (KJS::Interpreter::Interpreter): (KJS::Interpreter::init): (KJS::Interpreter::globalObject): (KJS::Interpreter::setGlobalObject): (KJS::Interpreter::resetGlobalObjectProperties): (KJS::Interpreter::createObjectsForGlobalObjectProperties): (KJS::Interpreter::setGlobalObjectProperties): Switch to using putDirect to ensure that the global object's put method cannot interfere with setting of the global properties. This prevents a user-written JSClassRef from attempting to call back into JavaScript from the initialization of the global object's members. * kjs/interpreter.h: * kjs/testkjs.cpp: (setupInterpreter): Update for changes in Interpreter method signatures. 2007-11-17 Mark Rowe Reviewed by Sam Weinig. Prevent testapi from reporting false leaks. Clear out local variables pointing at JSObjectRefs to allow their values to be collected. * API/testapi.c: (main): 2007-11-17 Mark Rowe Reviewed by Sam Weinig. Prevent testapi from crashing if testapi.js can not be found by nil-checking the result of createStringWithContentsOfFile. * API/testapi.c: (main): 2007-11-17 Alp Toker Reviewed by Eric. http://bugs.webkit.org/show_bug.cgi?id=16032 JS minidom is not portable Use a plain UTF-8 string instead of a CFString. Print to stdout, not stderr like CFShow() would have done, since that behaviour seems unintentional. * API/minidom.c: (main): 2007-11-17 Steve Falkenburg Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2007-11-16 Mark Rowe Windows build fix. * kjs/lexer.cpp: (KJS::Lexer::record8): 2007-11-16 Mark Rowe Reviewed by Eric. Replace strings, identifier, buffer8 and buffer16 members of Lexer with vectors. SunSpider claims this is a 0.7% speedup. * kjs/lexer.cpp: (KJS::Lexer::Lexer): (KJS::Lexer::lex): (KJS::Lexer::record8): (KJS::Lexer::record16): (KJS::Lexer::scanRegExp): (KJS::Lexer::clear): (KJS::Lexer::makeIdentifier): (KJS::Lexer::makeUString): * kjs/lexer.h: * kjs/ustring.cpp: (KJS::UString::UString): Add a convenience constructor that takes a const Vector&. * kjs/ustring.h: 2007-11-16 Adam Roben Windows build fix * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Add a new include path and ignore the int -> bool conversion warning. 2007-11-16 Alexey Proskuryakov Fix Windows debug build. Rubber-stamped by Eric * pcre/pcre_exec.cpp: (match): Removed ASSERT_NOT_REACHED assertions that were making MSVC complain about unreachable code. 2007-11-15 Mark Rowe Gtk build fix. * kjs/Parser.cpp: 2007-11-15 Mark Rowe Mac build and header search path sanity fix. Reviewed by Sam Weinig and Tim Hatcher. Move base setting for HEADER_SEARCH_PATHS into Base.xcconfig, and extend it in JavaScriptCore.xcconfig. This removes the need to override it on a per-target basis inside the .xcodeproj file. * Configurations/Base.xcconfig: * Configurations/JavaScriptCore.xcconfig: * JavaScriptCore.xcodeproj/project.pbxproj: 2007-11-15 Mark Rowe Qt build fix. * kjs/Parser.h: 2007-11-15 Geoffrey Garen Reviewed by Eric Seidel. Another round of grammar / parsing cleanup. 1. Created distinct parser calls for parsing function bodies vs programs. This will help later with optimizing global variable access. 2. Turned Parser into a singleton. Cleaned up Lexer's singleton interface. 3. Modified Lexer to free a little more memory when done lexing. (Added FIXMEs for similar issues that I didn't fix.) 4. Changed Lexer::makeIdentifier and Lexer::makeUString to start respecting the arguments passed to them. (No behavior change, but this problem could have caused serious problems for an unsuspecting user of these functions.) 5. Removed KJS_DEBUG_MEM because it was bit-rotted. 6. Removed Parser::prettyPrint because the same work was simpler to do at the call site. 7. Some renames: "Parser::accept" => "Parser::didFinishParsing" "Parser::sid" => "Parser::m_sourceID" "Lexer::doneParsing" => "Lexer::clear" "sid" => "sourceId" "lineno" => "lineNo" * JavaScriptCore.exp: * kjs/Parser.cpp: (KJS::Parser::Parser): (KJS::Parser::parseProgram): (KJS::Parser::parseFunctionBody): (KJS::Parser::parse): (KJS::Parser::didFinishParsing): (KJS::parser): * kjs/Parser.h: (KJS::Parser::sourceId): * kjs/function.cpp: (KJS::GlobalFuncImp::callAsFunction): * kjs/function_object.cpp: (FunctionObjectImp::construct): * kjs/grammar.y: * kjs/interpreter.cpp: (KJS::Interpreter::checkSyntax): (KJS::Interpreter::evaluate): * kjs/interpreter.h: * kjs/lexer.cpp: (kjsyylex): (KJS::lexer): (KJS::Lexer::Lexer): (KJS::Lexer::~Lexer): (KJS::Lexer::scanRegExp): (KJS::Lexer::doneParsing): (KJS::Lexer::makeIdentifier): (KJS::Lexer::makeUString): * kjs/lexer.h: (KJS::Lexer::pattern): (KJS::Lexer::flags): (KJS::Lexer::sawError): * kjs/nodes.cpp: (KJS::Node::Node): (KJS::FunctionBodyNode::FunctionBodyNode): * kjs/nodes.h: * kjs/testkjs.cpp: (prettyPrintScript): (kjsmain): * kjs/ustring.cpp: * kjs/ustring.h: 2007-11-15 Oliver Hunt Reviewed by Darin. REGRESSION: All SourceElements and their children leak after a syntax error Add a stub node to maintain the Vector of SourceElements until assignment. * kjs/grammar.y: * kjs/nodes.h: (KJS::SourceElementsStub::SourceElementsStub): (KJS::SourceElementsStub::append): (KJS::SourceElementsStub::release): (KJS::SourceElementsStub::): (KJS::SourceElementsStub::precedence): 2007-11-15 Eric Seidel Reviewed by Sam. Abstract most of RMATCH into MatchStack functions. SunSpider claims this, combined with the last 2 patches was a 1% speedup, 10% for dna-regexp. * pcre/pcre_exec.cpp: (MatchStack::canUseStackBufferForNextFrame): (MatchStack::allocateNextFrame): (MatchStack::pushNewFrame): (MatchStack::frameIsStackAllocated): (MatchStack::popCurrentFrame): (MatchStack::unrollAnyHeapAllocatedFrames): (match): 2007-11-15 Eric Seidel Reviewed by Sam. Remove RETURN_ERROR, add MatchStack * pcre/pcre_exec.cpp: (MatchStack::MatchStack): (MatchStack::unrollAnyHeapAllocatedFrames): (matchError): (match): 2007-11-15 Eric Seidel Reviewed by Sam. Clean up match function to match WebKit style * JavaScriptCore.xcodeproj/project.pbxproj: * pcre/pcre_exec.cpp: (match): 2007-11-15 Steve Falkenburg Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore.make: 2007-11-14 Alexey Proskuryakov Reviewed by Darin. http://bugs.webkit.org/show_bug.cgi?id=15982 Improve JSString UTF-8 decoding * API/JSStringRef.cpp: (JSStringCreateWithUTF8CString): Use strict decoding, return 0 on error. * wtf/unicode/UTF8.cpp: (WTF::Unicode::convertUTF16ToUTF8): (WTF::Unicode::convertUTF8ToUTF16): * wtf/unicode/UTF8.h: Made these function names start with a lower case letter. * kjs/ustring.cpp: (KJS::UString::UTF8String): Updated for the above renaming. * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16WithLatin1Fallback): Renamed to highlight the difference from convertUTF8ToUTF16 in wtf/unicode. (KJS::Bindings::convertNPStringToUTF16): Updated for the above renaming. (KJS::Bindings::identifierFromNPIdentifier): Ditto. * bindings/c/c_utility.h: Made convertUTF8ToUTF16WithLatin1Fallback() a file static. 2007-11-14 Sam Weinig Rubber-stamped by Anders. Fix the Xcode project file after it was messed up in r27402. * JavaScriptCore.xcodeproj/project.pbxproj: 2007-11-14 Eric Seidel Reviewed by Oliver. More PCRE style cleanup. * pcre/pcre_compile.cpp: (compile_regex): 2007-11-14 Adam Roben Clean up the bison conflict checking script Reviewed by Geoff. * DerivedSources.make: 2007-11-14 Eric Seidel Reviewed by Geoff. Another round of PCRE cleanups: inlines SunSpider claims that this, combined with my previous PCRE cleanup were a 0.7% speedup, go figure. * pcre/pcre_compile.cpp: (jsRegExpCompile): * pcre/pcre_exec.cpp: (match): (jsRegExpExecute): * pcre/pcre_internal.h: (PUT): (GET): (PUT2): (GET2): (isNewline): 2007-11-14 Eric Seidel Reviewed by Sam. Give PCRE a (small) bath. Fix some formating and break things off into separate functions http://bugs.webkit.org/show_bug.cgi?id=15993 * pcre/pcre_compile.cpp: (calculateCompiledPatternLengthAndFlags): (printCompiledRegExp): (returnError): (jsRegExpCompile): * pcre/pcre_internal.h: (compile_data::compile_data): 2007-11-14 Geoffrey Garen Reviewed by Eric Seidel. Cleaned up the JavaScript grammar a bit. 1. Changed BlockNode to always hold a child vector (which may be empty), eliminating a few NULL-check branches in the common execution case. 2. Changed the Block production to correctly report its starting and ending line numbers to the debugger. (It used to report its ending line as its starting line.) Also, removed duplicate line-reporting code inside the BlockNode constructor. 3. Moved curly braces up from FunctionBody production into parent productions. (I had to move the line number reporting code, too, since it depends on the location of the curly braces.) This matches the ECMA spec more closely, and makes some future changes I plan easier. 4. Fixed statementList* convenience functions to deal appropriately with empty Vectors. SunSpider reports a small and statistically insignificant speedup. * kjs/grammar.y: * kjs/nodes.cpp: (KJS::statementListPushFIFO): (KJS::statementListGetDeclarations): (KJS::statementListInitializeDeclarationStack): (KJS::statementListInitializeVariableAccessStack): (KJS::BlockNode::BlockNode): (KJS::BlockNode::optimizeVariableAccess): (KJS::BlockNode::getDeclarations): (KJS::BlockNode::execute): (KJS::FunctionBodyNode::initializeDeclarationStacks): (KJS::FunctionBodyNode::optimizeVariableAccess): 2007-11-13 Anders Carlsson Add RefCounted.h (And remove Shared.h) * JavaScriptCore.vcproj/WTF/WTF.vcproj: 2007-11-13 Geoffrey Garen Build fix. * kjs/regexp.h: 2007-11-13 Geoffrey Garen Reviewed by Anders Carlsson. Renamed Shared to RefCounted. * API/JSClassRef.h: * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/interpreter.h: * kjs/regexp.h: * wtf/RefCounted.h: Copied from JavaScriptCore/wtf/Shared.h. (WTF::RefCounted::RefCounted): * wtf/Shared.h: Removed. 2007-11-13 Adam Roben Build fix Reviewed by Geoff. * kjs/regexp.h: Added a missing #include. 2007-11-13 Geoffrey Garen Reviewed by Sam Weinig. Moved Shared.h into wtf so it could be used in more places. Deployed Shared in places where JSCore previously had hand-rolled ref-counting classes. * API/JSClassRef.cpp: (OpaqueJSClass::OpaqueJSClass): * API/JSClassRef.h: * API/JSObjectRef.cpp: (JSClassRetain): (JSClassRelease): * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/interpreter.cpp: (KJS::Interpreter::init): * kjs/interpreter.h: * kjs/regexp.cpp: (KJS::RegExp::RegExp): * kjs/regexp.h: * wtf/Shared.h: Copied from WebCore/platform/Shared.h. 2007-11-13 Eric Seidel Reviewed by Maciej. Add an ASSERT to getTruncatedInt32 to enforce proper usage. Best part about this patch? It doesn't break the web! * kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32): (KJS::JSImmediate::toDouble): (KJS::JSImmediate::getUInt32): 2007-11-13 Alexey Proskuryakov Windows build fix. * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): * kjs/ustring.cpp: (KJS::UString::UTF8String): * wtf/unicode/UTF8.cpp: (WTF::Unicode::ConvertUTF8ToUTF16): 2007-11-13 Darin Adler Reviewed by Geoff. - fix http://bugs.webkit.org/show_bug.cgi?id=11231 RegExp bug when handling newline characters and a number of other differences between PCRE behvior and JavaScript regular expressions: + single-digit sequences like \4 should be treated as octal character constants, unless there is a sufficient number of brackets for them to be treated as backreferences + \8 turns into the character "8", not a binary zero character followed by "8" (same for 9) + only the first 3 digits should be considered part of an octal character constant (the old behavior was to decode an arbitrarily long sequence and then mask with 0xFF) + if \x is followed by anything other than two valid hex digits, then it should simply be treated a the letter "x"; that includes not supporting the \x{41} syntax + if \u is followed by anything less than four valid hex digits, then it should simply be treated a the letter "u" + an extra "+" should be a syntax error, rather than being treated as the "possessive quantifier" + if a "]" character appears immediately after a "[" character that starts a character class, then that's an empty character class, rather than being the start of a character class that includes a "]" character + a "$" should not match a terminating newline; we could have gotten PCRE to handle this the way we wanted by passing an appropriate option Test: fast/js/regexp-no-extensions.html * pcre/pcre_compile.cpp: (check_escape): Check backreferences against bracount to catch both overflows and things that should be treated as octal. Rewrite octal loop to not go on indefinitely. Rewrite both hex loops to match and remove \x{} support. (compile_branch): Restructure loops so that we don't special-case a "]" at the beginning of a character class. Remove code that treated "+" as the possessive quantifier. (jsRegExpCompile): Change the "]" handling here too. * pcre/pcre_exec.cpp: (match): Changed CIRC to match the DOLL implementation. Changed DOLL to remove handling of "terminating newline", a Perl concept which we don't need. * tests/mozilla/expected.html: Two tests are fixed now: ecma_3/RegExp/regress-100199.js and ecma_3/RegExp/regress-188206.js. One test fails now: ecma_3/RegExp/perlstress-002.js -- our success before was due to a bug (we treated all 1-character numeric escapes as backreferences). The date tests also now both expect success -- whatever was making them fail before was probably due to the time being close to a DST shift; maybe we need to get rid of those tests. 2007-11-13 Darin Adler * kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32): Remove too-strong assert that was firing constantly and preventing even basic web browsing from working in a debug build. This function is used in many cases where the immediate value is not a number; the assertion could perhaps be added back later with a bit of reorganization. 2007-11-13 Alp Toker Build fix for breakage to non-Mac builds introduced in r27746. * kjs/ustring.cpp: 2007-11-13 Eric Seidel Reviewed by Maciej. Clean up evaluateToBoolean functions to use inlines instead of copy/paste code * kjs/JSImmediate.h: * kjs/nodes.cpp: (KJS::GreaterNode::inlineEvaluateToBoolean): (KJS::GreaterNode::evaluate): (KJS::LessEqNode::inlineEvaluateToBoolean): (KJS::LessEqNode::evaluate): (KJS::GreaterEqNode::inlineEvaluateToBoolean): (KJS::GreaterEqNode::evaluate): (KJS::InNode::evaluateToBoolean): (KJS::EqualNode::inlineEvaluateToBoolean): (KJS::EqualNode::evaluate): (KJS::NotEqualNode::inlineEvaluateToBoolean): (KJS::NotEqualNode::evaluate): (KJS::StrictEqualNode::inlineEvaluateToBoolean): (KJS::StrictEqualNode::evaluate): (KJS::NotStrictEqualNode::inlineEvaluateToBoolean): (KJS::NotStrictEqualNode::evaluate): * kjs/nodes.h: 2007-11-12 Geoffrey Garen Reviewed by Sam Weinig. Fixed http://bugs.webkit.org/show_bug.cgi?id=15958 base64 spends 1.1% of total time checking for special Infinity case Use a fast character test instead of calling strncmp. 1.1% speedup on string-base64. SunSpider reports a .4% speedup overall; Sharks reports only .1%. Who are you going to believe? Huh? * kjs/ustring.cpp: (KJS::UString::toDouble): 2007-11-12 Eric Seidel Reviewed by Oliver. Add evaluateToInt32 and evaluateUInt32 methods and deploy them. Fix a few missing evaluateToBoolean methods Deploy all evaluateTo* functions to more nodes to avoid slowdowns http://bugs.webkit.org/show_bug.cgi?id=15950 SunSpider claims this is at least a 1.4% speedup. * kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32): (KJS::JSImmediate::toDouble): (KJS::JSImmediate::getUInt32): * kjs/nodes.cpp: (KJS::ExpressionNode::evaluateToNumber): (KJS::ExpressionNode::evaluateToInt32): (KJS::ExpressionNode::evaluateToUInt32): (KJS::NumberNode::evaluateToInt32): (KJS::NumberNode::evaluateToUInt32): (KJS::ImmediateNumberNode::evaluateToInt32): (KJS::ImmediateNumberNode::evaluateToUInt32): (KJS::ResolveNode::evaluate): (KJS::ResolveNode::evaluateToNumber): (KJS::ResolveNode::evaluateToBoolean): (KJS::ResolveNode::evaluateToInt32): (KJS::ResolveNode::evaluateToUInt32): (KJS::LocalVarAccessNode::evaluateToInt32): (KJS::LocalVarAccessNode::evaluateToUInt32): (KJS::BracketAccessorNode::evaluateToNumber): (KJS::BracketAccessorNode::evaluateToBoolean): (KJS::BracketAccessorNode::evaluateToInt32): (KJS::BracketAccessorNode::evaluateToUInt32): (KJS::DotAccessorNode::inlineEvaluate): (KJS::DotAccessorNode::evaluate): (KJS::DotAccessorNode::evaluateToNumber): (KJS::DotAccessorNode::evaluateToBoolean): (KJS::DotAccessorNode::evaluateToInt32): (KJS::DotAccessorNode::evaluateToUInt32): (KJS::NewExprNode::inlineEvaluate): (KJS::NewExprNode::evaluate): (KJS::NewExprNode::evaluateToNumber): (KJS::NewExprNode::evaluateToBoolean): (KJS::NewExprNode::evaluateToInt32): (KJS::NewExprNode::evaluateToUInt32): (KJS::FunctionCallResolveNode::inlineEvaluate): (KJS::FunctionCallResolveNode::evaluate): (KJS::FunctionCallResolveNode::evaluateToNumber): (KJS::FunctionCallResolveNode::evaluateToBoolean): (KJS::FunctionCallResolveNode::evaluateToInt32): (KJS::FunctionCallResolveNode::evaluateToUInt32): (KJS::LocalVarFunctionCallNode::evaluate): (KJS::LocalVarFunctionCallNode::evaluateToNumber): (KJS::LocalVarFunctionCallNode::evaluateToBoolean): (KJS::LocalVarFunctionCallNode::evaluateToInt32): (KJS::LocalVarFunctionCallNode::evaluateToUInt32): (KJS::FunctionCallDotNode::evaluate): (KJS::FunctionCallDotNode::evaluateToNumber): (KJS::FunctionCallDotNode::evaluateToBoolean): (KJS::FunctionCallDotNode::evaluateToInt32): (KJS::FunctionCallDotNode::evaluateToUInt32): (KJS::PostDecLocalVarNode::inlineEvaluateToNumber): (KJS::PostDecLocalVarNode::evaluateToNumber): (KJS::PostDecLocalVarNode::evaluateToBoolean): (KJS::PostDecLocalVarNode::evaluateToInt32): (KJS::PostDecLocalVarNode::evaluateToUInt32): (KJS::typeStringForValue): (KJS::UnaryPlusNode::evaluate): (KJS::UnaryPlusNode::evaluateToBoolean): (KJS::UnaryPlusNode::evaluateToNumber): (KJS::UnaryPlusNode::evaluateToInt32): (KJS::BitwiseNotNode::inlineEvaluateToInt32): (KJS::BitwiseNotNode::evaluate): (KJS::BitwiseNotNode::evaluateToNumber): (KJS::BitwiseNotNode::evaluateToBoolean): (KJS::BitwiseNotNode::evaluateToInt32): (KJS::MultNode::evaluateToBoolean): (KJS::MultNode::evaluateToInt32): (KJS::MultNode::evaluateToUInt32): (KJS::DivNode::evaluateToInt32): (KJS::DivNode::evaluateToUInt32): (KJS::ModNode::evaluateToBoolean): (KJS::ModNode::evaluateToInt32): (KJS::ModNode::evaluateToUInt32): (KJS::AddNode::evaluateToNumber): (KJS::AddNode::evaluateToInt32): (KJS::AddNode::evaluateToUInt32): (KJS::AddNumbersNode::evaluateToInt32): (KJS::AddNumbersNode::evaluateToUInt32): (KJS::SubNode::evaluateToInt32): (KJS::SubNode::evaluateToUInt32): (KJS::LeftShiftNode::inlineEvaluateToInt32): (KJS::LeftShiftNode::evaluate): (KJS::LeftShiftNode::evaluateToNumber): (KJS::LeftShiftNode::evaluateToInt32): (KJS::RightShiftNode::inlineEvaluateToInt32): (KJS::RightShiftNode::evaluate): (KJS::RightShiftNode::evaluateToNumber): (KJS::RightShiftNode::evaluateToInt32): (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32): (KJS::UnsignedRightShiftNode::evaluate): (KJS::UnsignedRightShiftNode::evaluateToNumber): (KJS::UnsignedRightShiftNode::evaluateToInt32): (KJS::LessNode::inlineEvaluateToBoolean): (KJS::LessNode::evaluate): (KJS::LessNode::evaluateToBoolean): (KJS::LessNumbersNode::inlineEvaluateToBoolean): (KJS::LessNumbersNode::evaluate): (KJS::LessNumbersNode::evaluateToBoolean): (KJS::LessStringsNode::inlineEvaluateToBoolean): (KJS::LessStringsNode::evaluate): (KJS::BitAndNode::evaluate): (KJS::BitAndNode::inlineEvaluateToInt32): (KJS::BitAndNode::evaluateToNumber): (KJS::BitAndNode::evaluateToBoolean): (KJS::BitAndNode::evaluateToInt32): (KJS::BitXOrNode::inlineEvaluateToInt32): (KJS::BitXOrNode::evaluate): (KJS::BitXOrNode::evaluateToNumber): (KJS::BitXOrNode::evaluateToBoolean): (KJS::BitXOrNode::evaluateToInt32): (KJS::BitOrNode::inlineEvaluateToInt32): (KJS::BitOrNode::evaluate): (KJS::BitOrNode::evaluateToNumber): (KJS::BitOrNode::evaluateToBoolean): (KJS::BitOrNode::evaluateToInt32): (KJS::ConditionalNode::evaluateToNumber): (KJS::ConditionalNode::evaluateToInt32): (KJS::ConditionalNode::evaluateToUInt32): (KJS::valueForReadModifyAssignment): (KJS::AssignExprNode::evaluate): (KJS::AssignExprNode::evaluateToBoolean): (KJS::AssignExprNode::evaluateToNumber): (KJS::AssignExprNode::evaluateToInt32): (KJS::VarDeclNode::handleSlowCase): * kjs/nodes.h: (KJS::FunctionCallResolveNode::precedence): (KJS::AddNode::precedence): (KJS::AddNode::): (KJS::LessNumbersNode::): (KJS::LessStringsNode::): * kjs/value.cpp: (KJS::JSValue::toInt32SlowCase): (KJS::JSValue::toUInt32SlowCase): * kjs/value.h: (KJS::JSValue::asCell): (KJS::JSValue::toInt32): (KJS::JSValue::toUInt32): 2007-11-12 Alexey Proskuryakov Reviewed by Darin. http://bugs.webkit.org/show_bug.cgi?id=15953 Add UTF-8 encoding/decoding to WTF * kjs/ustring.h: Moved UTF8SequenceLength() and decodeUTF8Sequence() to wtf/unicode. * kjs/ustring.cpp: (KJS::UString::UTF8String): Changed this function to take a strict/lenient parameter. Callers are not interested in getting decoding results in strict mode, so this allows for bailing out as soon as an error is seen. * kjs/function.cpp: (KJS::encode): Updated for new UString::UTF8String() signature. * API/JSStringRef.cpp: (JSStringCreateWithCharacters): Disambiguate UChar. (JSStringCreateWithUTF8CString): Actually use UTF-8 when creating the string! * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): Use ConvertUTF8ToUTF16(). * wtf/unicode/UTF8.cpp: Added. (WTF::Unicode::inlineUTF8SequenceLengthNonASCII): (WTF::Unicode::inlineUTF8SequenceLength): (WTF::Unicode::UTF8SequenceLength): (WTF::Unicode::decodeUTF8Sequence): (WTF::Unicode::): (WTF::Unicode::ConvertUTF16ToUTF8): (WTF::Unicode::isLegalUTF8): (WTF::Unicode::ConvertUTF8ToUTF16): * wtf/unicode/UTF8.h: Added. (WTF::Unicode::): Some code moved from ustring.h, some adapted from unicode.org sources. * JavaScriptCore.exp: * JavaScriptCore.pri: * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: Added UTF8.{h,cpp} 2007-11-12 Josh Aas Reviewed by Darin. - http://bugs.webkit.org/show_bug.cgi?id=15946 add NPPValue NPPVpluginDrawingModel (Mozilla bug 403418 compat) * bindings/npapi.h: 2007-11-12 Darin Adler Reviewed by Sam. - http://bugs.webkit.org/show_bug.cgi?id=15951 REGRESSION: assertion failure in regexp match() when running JS tests Test: fast/js/regexp-many-brackets.html * pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for the BRANUMBER opcode. 2007-11-12 Darin Adler Reviewed by Geoff. - fix use of prefix and config.h, got rid of a few unneeded things in the PCRE code; no behavior changes * API/JSBase.cpp: Added include of config.h. * API/JSCallbackConstructor.cpp: Ditto. * API/JSCallbackFunction.cpp: Ditto. * API/JSCallbackObject.cpp: Ditto. * API/JSClassRef.cpp: Ditto. * API/JSContextRef.cpp: Ditto. * API/JSObjectRef.cpp: Ditto. * API/JSStringRef.cpp: Ditto. * API/JSValueRef.cpp: Ditto. * JavaScriptCorePrefix.h: Removed obsolete workaround. Moved new/delete macros after includes, as they are in WebCore's prefix. Removed "config.h". * pcre/dftables.cpp: (main): Changed back to not use a separate maketables function. This is needed for PCRE, but not helpful for our use. Also changed the tables to all be 128 entries long instead of 256, since only the first 128 are ever used. * pcre/pcre_compile.cpp: Added include of config.h. Eliminated digitab, which was only being used to check hex digits. Changed all uses of TRUE and FALSE to use the C++ true and false instead. (check_escape): Just the TRUE/FALSE thing. (is_counted_repeat): Ditto. (could_be_empty_branch): Ditto. (get_othercase_range): Ditto. (compile_branch): Ditto. (compile_regex): Ditto. (is_anchored): Ditto. (is_startline): Ditto. (find_firstassertedchar): Ditto. (jsRegExpCompile): Ditto. * pcre/pcre_exec.cpp: Added include of config.h. Changed all uses of TRUE and FALSE to use the C++ true and false instead. (match_ref): Just the TRUE/FALSE thing. (match): Ditto. Removed some unneeded braces. (jsRegExpExecute): Just the TRUE/FALSE thing. * pcre/pcre_internal.h: Moved the constants needed by dftables.cpp to the top of the file instead of the bottom, so they can be used. Also changed the table sizes to 128 instead of 256. Removed macro definitions of FALSE and TRUE. Set array sizes for all the const arrays. Changed _pcre_utf8_table1_size to be a macro instead of a extern int. * pcre/pcre_maketables.cpp: Removed. It's all in dftables.cpp now. * pcre/pcre_tables.cpp: Made table sizes explicit. * pcre/pcre_xclass.cpp: Just the TRUE/FALSE thing. 2007-11-12 Adam Roben Build fix * wtf/FastMalloc.h: Add missing using statement. 2007-11-11 Oliver Hunt Reviewed by Darin. Add special fastZeroedMalloc function to replace a number of fastCalloc calls where one argument was 1. This results in a 0.4% progression in SunSpider, more than making up for the earlier regression caused by additional overflow checks. * JavaScriptCore.exp: * kjs/array_instance.cpp: * kjs/property_map.cpp: * wtf/FastMalloc.cpp: * wtf/FastMalloc.h: * wtf/HashTable.h: 2007-11-11 Adam Roben Fix ASSERT in HashTable::checkTableConsistencyExceptSize beneath WebNotificationCenter The bug was due to a mismatch between HashMap::remove and HashTable::checkTableConsistency. HashMap::remove can delete the value stored in the HashTable (by derefing it), which is not normally allowed by HashTable. It's OK in this case because the value is about to be removed from the table, but HashTable wasn't aware of this. HashMap::remove now performs the consistency check itself before derefing the value. Darin noticed that the same bug would occur in HashSet, so I've fixed it there as well. Reviewed by Darin. * wtf/HashMap.h: (WTF::HashMap::remove): Perform the HashTable consistency check manually before calling deref. * wtf/HashSet.h: (WTF::HashSet::remove): Ditto. * wtf/HashTable.h: Made checkTableConsistency public so that HashMap and HashSet can call it. (WTF::HashTable::removeAndInvalidateWithoutEntryConsistencyCheck): Added. (WTF::HashTable::removeAndInvalidate): Added. (WTF::HashTable::remove): (WTF::HashTable::removeWithoutEntryConsistencyCheck): Added. 2007-11-11 Mark Rowe Build fix. Use the correct filename case. * kjs/nodes.h: 2007-11-11 Geoffrey Garen Reviewed by Sam Weinig. Fixed http://bugs.webkit.org/show_bug.cgi?id=15902 15% of string-validate-input.js is spent compiling the same regular expression Store a compiled representation of the regular expression in the AST. Only a .2% SunSpider speedup overall, but a 10.6% speedup on string-validate-input.js. * kjs/nodes.cpp: (KJS::RegExpNode::evaluate): * kjs/nodes.h: (KJS::RegExpNode::): * kjs/nodes2string.cpp: (KJS::RegExpNode::streamTo): * kjs/regexp.cpp: (KJS::RegExp::flags): * kjs/regexp.h: (KJS::RegExp::pattern): * kjs/regexp_object.cpp: (KJS::RegExpObjectImp::construct): (KJS::RegExpObjectImp::createRegExpImp): * kjs/regexp_object.h: 2007-11-11 Oliver Hunt Reviewed by Eric. Partial fix for numfuzz: integer overflows opening malformed SVG file in WebCore::ImageBuffer::create Unfortunately this is a very slight regression, but is unavoidable. * wtf/FastMalloc.cpp: 2007-11-10 Eric Seidel Reviewed by darin. Add simple type inferencing to the parser, and create custom AddNode and LessNode subclasses based on inferred types. http://bugs.webkit.org/show_bug.cgi?id=15884 SunSpider claims this is at least a 0.5% speedup. * JavaScriptCore.exp: * kjs/grammar.y: * kjs/internal.cpp: (KJS::NumberImp::getPrimitiveNumber): (KJS::GetterSetterImp::getPrimitiveNumber): * kjs/internal.h: * kjs/lexer.cpp: (KJS::Lexer::lex): * kjs/nodes.cpp: (KJS::Node::Node): (KJS::StringNode::evaluate): (KJS::StringNode::evaluateToNumber): (KJS::StringNode::evaluateToBoolean): (KJS::RegExpNode::evaluate): (KJS::UnaryPlusNode::optimizeVariableAccess): (KJS::AddNode::evaluate): (KJS::AddNode::evaluateToNumber): (KJS::AddNumbersNode::inlineEvaluateToNumber): (KJS::AddNumbersNode::evaluate): (KJS::AddNumbersNode::evaluateToNumber): (KJS::AddStringsNode::evaluate): (KJS::AddStringLeftNode::evaluate): (KJS::AddStringRightNode::evaluate): (KJS::lessThan): (KJS::lessThanEq): (KJS::LessNumbersNode::evaluate): (KJS::LessStringsNode::evaluate): * kjs/nodes.h: (KJS::ExpressionNode::): (KJS::RegExpNode::): (KJS::RegExpNode::precedence): (KJS::TypeOfResolveNode::): (KJS::LocalVarTypeOfNode::): (KJS::UnaryPlusNode::): (KJS::UnaryPlusNode::precedence): (KJS::AddNode::): (KJS::AddNode::precedence): (KJS::AddNumbersNode::): (KJS::AddStringLeftNode::): (KJS::AddStringRightNode::): (KJS::AddStringsNode::): (KJS::LessNode::): (KJS::LessNode::precedence): (KJS::LessNumbersNode::): (KJS::LessStringsNode::): * kjs/nodes2string.cpp: (KJS::StringNode::streamTo): * kjs/object.cpp: * kjs/object.h: * kjs/value.h: (KJS::JSValue::getPrimitiveNumber): 2007-11-11 Darin Adler - try another way of fixing dftables builds -- refactor pcre_internal.h a bit * pcre/pcre_internal.h: Make most of this header do nothing when DFTABLES is set. Later we can break it into two files. * JavaScriptCore.vcproj/dftables/dftables.vcproj: Take out now-unneeded include paths. * pcre/dftables.cpp: Set DFTABLES. Use delete instead of free. * pcre/dftables.pro: Take out now-unneeded include paths. * pcre/pcre_maketables.cpp: Use new instead of malloc. 2007-11-11 Darin Adler * pcre/dftables.pro: Try fixing Qt builds (I looked at qt-win) by adding another include path. 2007-11-11 Darin Adler * JavaScriptCore.xcodeproj/project.pbxproj: Try fixing Mac Tiger builds by adding another include path. 2007-11-11 Darin Adler Reviewed by Sam. - http://bugs.webkit.org/show_bug.cgi?id=15924 next round of changes to JSRegExp (formerly PCRE) This is a combination of converting to C++, tweaking the API, and adding some additional optimizations. Future steps will involve getting rid of the use of UTF-8 completely (we'll use UTF-16 exclusively instead), eliminating more source files, and some more speed-ups. SunSpider says the current round is an 0.9% speed-up overall, and a 5.3% speed-up for regexp. * JavaScriptCore.exp: Updated for new entry points. * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.vcproj/dftables/dftables.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * jscore.bkl: Updated for new source file names and ForwardingHeaders. * kjs/regexp.cpp: (KJS::RegExp::RegExp): Changed to use the error message without calling strdup on it and to pass the new types and options. (KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message. (KJS::RegExp::match): Pass the new types and options. * kjs/regexp.h: Update type of m_constructionError. * pcre/AUTHORS: Update to reflect the status of the project -- we don't include the Google parts, and this isn't the PCRE library, per se. * pcre/COPYING: Ditto. * pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c. (main): Removed unneeded ctype_digit. * pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar. * pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c. Moved a lot of private stuff used only within this file here from pcre_internal.h. Renumbered the error codes. (error_text): Use a single string with embedded nulls for the error text (I got this idea from newer versions of PCRE). (check_escape): Changed return type to be enum instead of int. Replaced ctype_digit uses with isASCIIDigit. (is_counted_repeat): Ditto. (read_repeat_counts): Ditto. (first_significant_code): Ditto. (find_fixedlength): Ditto. (could_be_empty_branch): Ditto. (compile_branch): Ditto. Also removed some code that handles changing options. JavaScript doesn't have any of the features that allow options to change. (compile_regex): Updated for change to options parameter. (is_anchored): Ditto. (find_firstassertedchar): Ditto. (jsRegExpCompile): Changed to take separate flags instead of an options int. Also changed to call new/delete instead of pcre_malloc/free. (jsRegExpFree): Ditto. * pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c. Added a case that uses computed goto for the opcode loop, but did not turn it on. Changed the RMATCH macro to handle returns more efficiently by putting the where pointer in the new frame instead of the old one, allowing us to branch to the return with a single statement. Switched to new/delete from pcre_malloc/free. Changed many RRETURN callers to not set the return value since it's already set correctly. Replaced the rrc variable with an is_match variable. Values other than "match" and "no match" are now handled differently. This allows us to remove the code to check for those cases in various rules. (match): All the case statements use a macro BEGIN_OPCODE instead. And all the continue statements, or break statements that break out of the outer case use a macro NEXT_OPCODE instead. Replaced a few if statements with assertions. (jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused start_match field from the match block. * pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h in here. Removed various unused types. Converted from JSRegExpChar to UChar. Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be used in multiple places. Unfortunately we lose the comments for each opcode; we should find a place to put those back. Removed ctype_digit. * pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c. (pcre_maketables): Got rid of the conditional code that allows this to be compiled in -- it's only used for dftables now (and soon may be obsolete entirely). Changed code for cbit_digit to not use isdigit, and took the "_" case out of the loop. Removed ctype_digit. * pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c. * pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c. Moved _pcre_OP_lengths out of here into pcre_exec.cpp. * pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c. Updated for other file name changes. * pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c. * pcre/ucpinternal.h: Updated header. * pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c. * wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to & for this operation. Also added an overload that takes an int because that's useful for PCRE. Later we could optimize for int and overload other functions in this file; stuck to this simple one for now. * wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper. * wtf/unicode/qt4/UnicodeQt4.h: Ditto. * pcre/LICENCE: Removed. * pcre/pcre-config.h: Removed. * wtf/FastMallocPCRE.cpp: Removed. * pcre/dftables.c: Renamed to cpp. * pcre/pcre_compile.c: Ditto. * pcre/pcre_exec.c: Ditto. * pcre/pcre_maketables.c: Ditto. * pcre/pcre_ord2utf8.c: Ditto. * pcre/pcre_tables.c: Ditto. * pcre/pcre_ucp_searchfuncs.c: Ditto. * pcre/pcre_xclass.c: Ditto. * pcre/ucptable.c: Ditto. 2007-11-11 Eric Seidel Reviewed by Oliver. Add KJS_CHECKEXCEPTIONBOOLEAN to match rest of nodes.cpp * kjs/nodes.cpp: (KJS::ExpressionNode::evaluateToBoolean): (KJS::LessNode::evaluateToBoolean): (KJS::GreaterNode::evaluateToBoolean): (KJS::LessEqNode::evaluateToBoolean): (KJS::GreaterEqNode::evaluateToBoolean): (KJS::InstanceOfNode::evaluateToBoolean): (KJS::InNode::evaluateToBoolean): (KJS::EqualNode::evaluateToBoolean): (KJS::NotEqualNode::evaluateToBoolean): (KJS::StrictEqualNode::evaluateToBoolean): (KJS::NotStrictEqualNode::evaluateToBoolean): (KJS::LogicalAndNode::evaluateToBoolean): (KJS::LogicalOrNode::evaluateToBoolean): (KJS::ConditionalNode::evaluateToBoolean): 2007-11-10 Darin Adler Reviewed by Sam. - fix http://bugs.webkit.org/show_bug.cgi?id=15927 REGRESSION(r27487): delete a.c followed by __defineGetter__("c", ...) incorrectly deletes another property and REGRESSION (r27487): Can't switch out of Edit HTML Source mode on Leopard Wiki Test: fast/js/delete-then-put.html * kjs/property_map.cpp: (KJS::PropertyMap::put): Added a missing "- 1"; code to find an empty slot was not working. (KJS::PropertyMap::checkConsistency): Added a missing range check that would have caught this problem before. - roll out a last-minute change to my evaluateToBoolean patch that was incorrect. * kjs/nodes.h: (KJS::ExprStatementNode::ExprStatementNode): Take out call to optimizeForUnnecessaryResult, since the result is used in some cases. 2007-11-10 Adam Roben Windows build fix Roll out some changes that were (seemingly accidentally) checked in with r27664. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2007-11-10 Darin Adler Reviewed by Sam. - http://bugs.webkit.org/show_bug.cgi?id=15915 add an evaluation path for booleans like the one we have for numbers Gives 1.1% on SunSpider. * kjs/grammar.y: Create TrueNode and FalseNode instead of BooleanNode. * kjs/nodes.h: Changed to use Noncopyable. Moved optimizeForUnnecessaryResult down from Node to ExpressionNode. Changed some classes to not inherit from ExpressionNode where not necessary, and removed unnneeded evaluate functions as well as evaluate functions that need not be virtual. Call the optimizeForUnnecessaryResult function on the start of a for loop too. * kjs/nodes.cpp: (KJS::ExpressionNode::evaluateToBoolean): Added. (KJS::FalseNode::evaluate): Added. (KJS::TrueNode::evaluate): Added. (KJS::NumberNode::evaluateToBoolean): Added. (KJS::StringNode::evaluateToBoolean): Added. (KJS::LocalVarAccessNode::evaluateToBoolean): Added. (KJS::BracketAccessorNode::evaluateToBoolean): Added. (KJS::LogicalNotNode::evaluate): Changed to call evaluateToBoolean. (KJS::LogicalNotNode::evaluateToBoolean): Added. (KJS::lessThan): Changed to return bool. (KJS::lessThanEq): Ditto. (KJS::LessNode::evaluate): Changed since lessThan returns bool. (KJS::LessNode::evaluateToBoolean): Added. (KJS::GreaterNode::evaluate): Changed since lessThanEq returns bool. (KJS::GreaterNode::evaluateToBoolean): Added. (KJS::LessEqNode::evaluate): Changed since lessThanEq returns bool. (KJS::LessEqNode::evaluateToBoolean): Added. (KJS::GreaterEqNode::evaluate): Changed since lessThan returns bool. (KJS::GreaterEqNode::evaluateToBoolean): Added. (KJS::InstanceOfNode::evaluateToBoolean): Added. (KJS::InNode::evaluateToBoolean): Added. (KJS::EqualNode::evaluateToBoolean): Added. (KJS::NotEqualNode::evaluateToBoolean): Added. (KJS::StrictEqualNode::evaluateToBoolean): Added. (KJS::NotStrictEqualNode::evaluateToBoolean): Added. (KJS::ConditionalNode::evaluate): Changed to call evaluateToBoolean. (KJS::IfNode::execute): Ditto. (KJS::DoWhileNode::execute): Ditto. (KJS::WhileNode::execute): Ditto. (KJS::ForNode::execute): Ditto. * kjs/nodes2string.cpp: (KJS::FalseNode::streamTo): Added. (KJS::TrueNode::streamTo): Added. 2007-11-09 Adam Roben Windows build fix Reviewed by Darin. * kjs/value.h: (KJS::jsNumber): Add some explicit casts. 2007-11-08 Darin Adler - fix build * kjs/grammar.y: * kjs/nodes.h: * kjs/property_map.cpp: 2007-11-08 Darin Adler - roll out accidentally-checked in changes * kjs/nodes.cpp: Back to previous version. * kjs/nodes.h: Ditto. * kjs/grammar.y: Ditto. 2007-11-08 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15912 fasta spends a lot of time in qsort * kjs/property_map.cpp: (KJS::PropertyMap::getEnumerablePropertyNames): Use insertion sort instead of qsort for small sets of property names. We can probably do some even-better speedups of for/in, but this nets 0.6% overall and 6.7% on fasta. 2007-11-08 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15906 getting characters by indexing into a string is very slow This fixes one source of the slowness -- the conversion to an unused Identifier as we call the get function from the slot -- but doesn't fix others, such as the fact that we have to allocate a new UString::Rep for every single character. Speeds up string-base64 30%, and at least 0.5% overall. But does slow down access-fannkuch quite a bit. Might be worth revisiting in the future to see what we can do about that (although I did look at a profile for a while). * kjs/property_slot.h: Add a new marker for "numeric" property slots; slots where we don't need to pass the identifier to the get function. (KJS::PropertySlot::getValue): Added code to call the numeric get function. (KJS::PropertySlot::setCustomNumeric): Added. * kjs/string_object.cpp: (KJS::StringInstance::indexGetter): Changed to use substr() instead of constructing a wholly new UString each time. (KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but takes advantage of setCustomNumeric to avoid creating an Identifier. (KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric. 2007-11-08 Darin Adler Reviewed by Oliver. - http://bugs.webkit.org/show_bug.cgi?id=15904 more speed-ups possible by tightening up int version of JSImmediate 1% improvement of SunSpider * kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template. (KJS::JSImmediate::from): Overload for most numeric types; many types can do fewer branches and checks. (KJS::JSImmediate::getUInt32): Removed unneeded check for undefined. (KJS::JSImmediate::getTruncatedInt32): Ditto. (KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later. * kjs/grammar.y: Update since fromDouble is now just from. * kjs/nodes.h: Ditto. * kjs/value.h: (KJS::jsNumber): Overload for most numeric types. 2007-11-08 Kevin Ollivier Bakefiles for building JavaScriptCore, needed by wx port. Reviewed by Mark Rowe. * JavaScriptCoreSources.bkl: Added. * jscore.bkl: Added. 2007-11-08 Oliver Hunt Reviewed by Maciej. Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1. The implementation of JSImmediate::areBothImmediateNumbers relies on (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having a unique result when both immediate values are numbers. The regression was due to UndefinedType & NumberType returning NumberType (3 & 1). By swapping the value of NumberType and UndefinedType this ceases to be a problem. * kjs/JSType.h: (KJS::): 2007-11-08 Darin Adler - fix build * kjs/nodes.h: Add missing parameter name. 2007-11-08 Eric Seidel Reviewed by darin. Add ExpressionNode subclass of Node, use it. * kjs/grammar.y: * kjs/nodes.cpp: (KJS::ForInNode::ForInNode): * kjs/nodes.h: (KJS::ExpressionNode::): (KJS::NullNode::): (KJS::NullNode::precedence): (KJS::BooleanNode::): (KJS::BooleanNode::precedence): (KJS::RegExpNode::): (KJS::RegExpNode::precedence): (KJS::ThisNode::): (KJS::ThisNode::precedence): (KJS::ResolveNode::): (KJS::ElementNode::): (KJS::ArrayNode::): (KJS::PropertyNode::): (KJS::PropertyNode::precedence): (KJS::PropertyNode::name): (KJS::PropertyListNode::): (KJS::ObjectLiteralNode::): (KJS::ObjectLiteralNode::precedence): (KJS::BracketAccessorNode::): (KJS::DotAccessorNode::): (KJS::DotAccessorNode::precedence): (KJS::ArgumentListNode::): (KJS::ArgumentsNode::): (KJS::NewExprNode::): (KJS::NewExprNode::precedence): (KJS::FunctionCallValueNode::): (KJS::FunctionCallValueNode::precedence): (KJS::FunctionCallResolveNode::): (KJS::FunctionCallBracketNode::): (KJS::FunctionCallBracketNode::precedence): (KJS::FunctionCallDotNode::): (KJS::FunctionCallDotNode::precedence): (KJS::PrePostResolveNode::): (KJS::PostfixBracketNode::): (KJS::PostfixBracketNode::precedence): (KJS::PostIncBracketNode::): (KJS::PostIncBracketNode::isIncrement): (KJS::PostDecBracketNode::): (KJS::PostDecBracketNode::isIncrement): (KJS::PostfixDotNode::): (KJS::PostfixDotNode::precedence): (KJS::PostIncDotNode::): (KJS::PostIncDotNode::isIncrement): (KJS::PostDecDotNode::): (KJS::PostDecDotNode::isIncrement): (KJS::PostfixErrorNode::): (KJS::PostfixErrorNode::precedence): (KJS::DeleteResolveNode::): (KJS::DeleteBracketNode::): (KJS::DeleteBracketNode::precedence): (KJS::DeleteDotNode::): (KJS::DeleteDotNode::precedence): (KJS::DeleteValueNode::): (KJS::DeleteValueNode::precedence): (KJS::VoidNode::): (KJS::VoidNode::precedence): (KJS::TypeOfResolveNode::): (KJS::TypeOfValueNode::): (KJS::PrefixBracketNode::): (KJS::PrefixBracketNode::precedence): (KJS::PreIncBracketNode::): (KJS::PreIncBracketNode::isIncrement): (KJS::PreDecBracketNode::): (KJS::PreDecBracketNode::isIncrement): (KJS::PrefixDotNode::): (KJS::PrefixDotNode::precedence): (KJS::PreIncDotNode::): (KJS::PreIncDotNode::isIncrement): (KJS::PreDecDotNode::): (KJS::PreDecDotNode::isIncrement): (KJS::PrefixErrorNode::): (KJS::PrefixErrorNode::precedence): (KJS::UnaryPlusNode::): (KJS::UnaryPlusNode::precedence): (KJS::NegateNode::): (KJS::NegateNode::precedence): (KJS::BitwiseNotNode::): (KJS::BitwiseNotNode::precedence): (KJS::LogicalNotNode::): (KJS::LogicalNotNode::precedence): (KJS::AddNode::): (KJS::AddNode::precedence): (KJS::LeftShiftNode::): (KJS::LeftShiftNode::precedence): (KJS::RightShiftNode::): (KJS::RightShiftNode::precedence): (KJS::UnsignedRightShiftNode::): (KJS::UnsignedRightShiftNode::precedence): (KJS::LessNode::): (KJS::LessNode::precedence): (KJS::GreaterNode::): (KJS::GreaterNode::precedence): (KJS::LessEqNode::): (KJS::LessEqNode::precedence): (KJS::GreaterEqNode::): (KJS::GreaterEqNode::precedence): (KJS::InstanceOfNode::): (KJS::InstanceOfNode::precedence): (KJS::InNode::): (KJS::InNode::precedence): (KJS::EqualNode::): (KJS::EqualNode::precedence): (KJS::NotEqualNode::): (KJS::NotEqualNode::precedence): (KJS::StrictEqualNode::): (KJS::StrictEqualNode::precedence): (KJS::NotStrictEqualNode::): (KJS::NotStrictEqualNode::precedence): (KJS::BitAndNode::): (KJS::BitAndNode::precedence): (KJS::BitOrNode::): (KJS::BitOrNode::precedence): (KJS::BitXOrNode::): (KJS::BitXOrNode::precedence): (KJS::LogicalAndNode::): (KJS::LogicalAndNode::precedence): (KJS::LogicalOrNode::): (KJS::LogicalOrNode::precedence): (KJS::ConditionalNode::): (KJS::ConditionalNode::precedence): (KJS::ReadModifyResolveNode::): (KJS::ReadModifyResolveNode::precedence): (KJS::AssignResolveNode::): (KJS::AssignResolveNode::precedence): (KJS::ReadModifyBracketNode::): (KJS::ReadModifyBracketNode::precedence): (KJS::AssignBracketNode::): (KJS::AssignBracketNode::precedence): (KJS::AssignDotNode::): (KJS::AssignDotNode::precedence): (KJS::ReadModifyDotNode::): (KJS::ReadModifyDotNode::precedence): (KJS::AssignErrorNode::): (KJS::AssignErrorNode::precedence): (KJS::CommaNode::): (KJS::CommaNode::precedence): (KJS::AssignExprNode::): (KJS::AssignExprNode::precedence): (KJS::ExprStatementNode::): (KJS::IfNode::): (KJS::DoWhileNode::): (KJS::WhileNode::): (KJS::ReturnNode::): (KJS::WithNode::): (KJS::ThrowNode::): (KJS::ParameterNode::): (KJS::CaseClauseNode::): (KJS::CaseClauseNode::precedence): (KJS::ClauseListNode::): (KJS::SwitchNode::): 2007-11-08 Oliver Hunt Reviewed by Sam. Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement). This only improves bitwise-and performance, as the additional logic required for similar code paths on or, xor, and shifting requires additional operations and branches that negate (and in certain cases, regress) any advantage we might otherwise receive. This improves performance on all bitop tests, the cryptography tests, as well as the string-base64 and string-unpack-code tests. No significant degradation on any other tests. * kjs/JSImmediate.h: (KJS::JSImmediate::areBothImmediateNumbers): (KJS::JSImmediate::andImmediateNumbers): * kjs/nodes.cpp: (KJS::BitAndNode::evaluate): * kjs/value.h: (KJS::jsNumberFromAnd): 2007-11-08 Adam Roben Stop using KJS inside of MathExtras.h Reviewed by Darin. * wtf/MathExtras.h: Removed an unused header, and a now-unused forward-declaration. (wtf_atan2): Use std::numeric_limits intead of KJS. 2007-11-08 Sam Weinig Windows build fix. * kjs/date_object.cpp: (KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning. (KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto 2007-11-08 Mark Rowe Gtk build fix. * kjs/lookup.h: Add missing include. 2007-11-08 Sam Weinig Reviewed by Darin. Convert JavaScript internal function objects to use one class per function. This avoids a switch statement inside what used to be the shared function classes and will allow Shark to better analyze the code. To make this switch, the value property of the HashEntry was changed to a union of an intptr_t (which is used to continue handle valueGetters) and function pointer which points to a static constructor for the individual new function objects. SunSpider claims this is a 1.0% speedup. * kjs/array_object.cpp: (KJS::ArrayPrototype::getOwnPropertySlot): (KJS::getProperty): (KJS::ArrayProtoFuncToString::callAsFunction): (KJS::ArrayProtoFuncToLocaleString::callAsFunction): (KJS::ArrayProtoFuncJoin::callAsFunction): (KJS::ArrayProtoFuncConcat::callAsFunction): (KJS::ArrayProtoFuncPop::callAsFunction): (KJS::ArrayProtoFuncPush::callAsFunction): (KJS::ArrayProtoFuncReverse::callAsFunction): (KJS::ArrayProtoFuncShift::callAsFunction): (KJS::ArrayProtoFuncSlice::callAsFunction): (KJS::ArrayProtoFuncSort::callAsFunction): (KJS::ArrayProtoFuncSplice::callAsFunction): (KJS::ArrayProtoFuncUnShift::callAsFunction): (KJS::ArrayProtoFuncFilter::callAsFunction): (KJS::ArrayProtoFuncMap::callAsFunction): (KJS::ArrayProtoFuncEvery::callAsFunction): (KJS::ArrayProtoFuncForEach::callAsFunction): (KJS::ArrayProtoFuncSome::callAsFunction): (KJS::ArrayProtoFuncIndexOf::callAsFunction): (KJS::ArrayProtoFuncLastIndexOf::callAsFunction): * kjs/array_object.h: (KJS::ArrayPrototype::classInfo): * kjs/create_hash_table: * kjs/date_object.cpp: (KJS::DatePrototype::getOwnPropertySlot): (KJS::DateProtoFuncToString::callAsFunction): (KJS::DateProtoFuncToUTCString::callAsFunction): (KJS::DateProtoFuncToDateString::callAsFunction): (KJS::DateProtoFuncToTimeString::callAsFunction): (KJS::DateProtoFuncToLocaleString::callAsFunction): (KJS::DateProtoFuncToLocaleDateString::callAsFunction): (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): (KJS::DateProtoFuncValueOf::callAsFunction): (KJS::DateProtoFuncGetTime::callAsFunction): (KJS::DateProtoFuncGetFullYear::callAsFunction): (KJS::DateProtoFuncGetUTCFullYear::callAsFunction): (KJS::DateProtoFuncToGMTString::callAsFunction): (KJS::DateProtoFuncGetMonth::callAsFunction): (KJS::DateProtoFuncGetUTCMonth::callAsFunction): (KJS::DateProtoFuncGetDate::callAsFunction): (KJS::DateProtoFuncGetUTCDate::callAsFunction): (KJS::DateProtoFuncGetDay::callAsFunction): (KJS::DateProtoFuncGetUTCDay::callAsFunction): (KJS::DateProtoFuncGetHours::callAsFunction): (KJS::DateProtoFuncGetUTCHours::callAsFunction): (KJS::DateProtoFuncGetMinutes::callAsFunction): (KJS::DateProtoFuncGetUTCMinutes::callAsFunction): (KJS::DateProtoFuncGetSeconds::callAsFunction): (KJS::DateProtoFuncGetUTCSeconds::callAsFunction): (KJS::DateProtoFuncGetMilliSeconds::callAsFunction): (KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction): (KJS::DateProtoFuncGetTimezoneOffset::callAsFunction): (KJS::DateProtoFuncSetTime::callAsFunction): (KJS::DateProtoFuncSetMilliSeconds::callAsFunction): (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction): (KJS::DateProtoFuncSetSeconds::callAsFunction): (KJS::DateProtoFuncSetUTCSeconds::callAsFunction): (KJS::DateProtoFuncSetMinutes::callAsFunction): (KJS::DateProtoFuncSetUTCMinutes::callAsFunction): (KJS::DateProtoFuncSetHours::callAsFunction): (KJS::DateProtoFuncSetUTCHours::callAsFunction): (KJS::DateProtoFuncSetDate::callAsFunction): (KJS::DateProtoFuncSetUTCDate::callAsFunction): (KJS::DateProtoFuncSetMonth::callAsFunction): (KJS::DateProtoFuncSetUTCMonth::callAsFunction): (KJS::DateProtoFuncSetFullYear::callAsFunction): (KJS::DateProtoFuncSetUTCFullYear::callAsFunction): (KJS::DateProtoFuncSetYear::callAsFunction): (KJS::DateProtoFuncGetYear::callAsFunction): * kjs/date_object.h: * kjs/lookup.cpp: (KJS::Lookup::find): * kjs/lookup.h: (KJS::HashEntry::): (KJS::staticFunctionGetter): (KJS::staticValueGetter): (KJS::getStaticPropertySlot): (KJS::getStaticFunctionSlot): (KJS::lookupPut): * kjs/math_object.cpp: (KJS::MathObjectImp::getOwnPropertySlot): (KJS::MathProtoFuncAbs::callAsFunction): (KJS::MathProtoFuncACos::callAsFunction): (KJS::MathProtoFuncASin::callAsFunction): (KJS::MathProtoFuncATan::callAsFunction): (KJS::MathProtoFuncATan2::callAsFunction): (KJS::MathProtoFuncCeil::callAsFunction): (KJS::MathProtoFuncCos::callAsFunction): (KJS::MathProtoFuncExp::callAsFunction): (KJS::MathProtoFuncFloor::callAsFunction): (KJS::MathProtoFuncLog::callAsFunction): (KJS::MathProtoFuncMax::callAsFunction): (KJS::MathProtoFuncMin::callAsFunction): (KJS::MathProtoFuncPow::callAsFunction): (KJS::MathProtoFuncRandom::callAsFunction): (KJS::MathProtoFuncRound::callAsFunction): (KJS::MathProtoFuncSin::callAsFunction): (KJS::MathProtoFuncSqrt::callAsFunction): (KJS::MathProtoFuncTan::callAsFunction): * kjs/math_object.h: (KJS::MathObjectImp::classInfo): (KJS::MathObjectImp::): * kjs/string_object.cpp: (KJS::StringPrototype::getOwnPropertySlot): (KJS::StringProtoFuncToString::callAsFunction): (KJS::StringProtoFuncValueOf::callAsFunction): (KJS::StringProtoFuncCharAt::callAsFunction): (KJS::StringProtoFuncCharCodeAt::callAsFunction): (KJS::StringProtoFuncConcat::callAsFunction): (KJS::StringProtoFuncIndexOf::callAsFunction): (KJS::StringProtoFuncLastIndexOf::callAsFunction): (KJS::StringProtoFuncMatch::callAsFunction): (KJS::StringProtoFuncSearch::callAsFunction): (KJS::StringProtoFuncReplace::callAsFunction): (KJS::StringProtoFuncSlice::callAsFunction): (KJS::StringProtoFuncSplit::callAsFunction): (KJS::StringProtoFuncSubstr::callAsFunction): (KJS::StringProtoFuncSubstring::callAsFunction): (KJS::StringProtoFuncToLowerCase::callAsFunction): (KJS::StringProtoFuncToUpperCase::callAsFunction): (KJS::StringProtoFuncToLocaleLowerCase::callAsFunction): (KJS::StringProtoFuncToLocaleUpperCase::callAsFunction): (KJS::StringProtoFuncLocaleCompare::callAsFunction): (KJS::StringProtoFuncBig::callAsFunction): (KJS::StringProtoFuncSmall::callAsFunction): (KJS::StringProtoFuncBlink::callAsFunction): (KJS::StringProtoFuncBold::callAsFunction): (KJS::StringProtoFuncFixed::callAsFunction): (KJS::StringProtoFuncItalics::callAsFunction): (KJS::StringProtoFuncStrike::callAsFunction): (KJS::StringProtoFuncSub::callAsFunction): (KJS::StringProtoFuncSup::callAsFunction): (KJS::StringProtoFuncFontcolor::callAsFunction): (KJS::StringProtoFuncFontsize::callAsFunction): (KJS::StringProtoFuncAnchor::callAsFunction): (KJS::StringProtoFuncLink::callAsFunction): * kjs/string_object.h: 2007-11-08 Adam Roben Windows build fix Reviewed by Sam and Ada. * wtf/MathExtras.h: Get rid of a circular #include dependency to fix the build. 2007-11-08 Adam Roben Fix a precedence warning on Windows * kjs/JSImmediate.h: (KJS::JSImmediate::toBoolean): 2007-11-08 Mark Rowe Build fix for JavaScriptGlue. * wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX. 2007-11-08 Darin Adler - Windows build fix * kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit". 2007-11-08 Oliver Hunt Reviewed by Darin. Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider. Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but we should now have faster array access, faster immediate to double conversion, and the potential to further improve bitwise operators in future. This also removes the need for unions to avoid strict aliasing problems when extracting a value from immediates. * kjs/JSImmediate.h: (KJS::): (KJS::JSImmediate::trueImmediate): (KJS::JSImmediate::falseImmediate): (KJS::JSImmediate::undefinedImmediate): (KJS::JSImmediate::nullImmediate): (KJS::JSImmediate::toBoolean): * kjs/value.h: (KJS::jsNaN): 2007-11-07 Eric Seidel Reviewed by Darin and Oliver. Add evaluateToNumber parallel evaluation tree to speed up number operations. Make ImmediateNumberNode a subclass of NumberNode. Share evaluate logic between evaluate and evaluateToNumber using inline functions There is still a lot of improvement to be made here. SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0% Given the huge win that this prepares us for with simple type inferencing I see the small regression in base64 being worth the substantial overall improvement. * kjs/grammar.y: * kjs/nodes.cpp: (KJS::Node::evaluateToNumber): (KJS::NumberNode::evaluate): (KJS::NumberNode::evaluateToNumber): (KJS::StringNode::evaluateToNumber): (KJS::LocalVarAccessNode::inlineEvaluate): (KJS::LocalVarAccessNode::evaluate): (KJS::LocalVarAccessNode::evaluateToNumber): (KJS::BracketAccessorNode::inlineEvaluate): (KJS::BracketAccessorNode::evaluate): (KJS::BracketAccessorNode::evaluateToNumber): (KJS::NegateNode::evaluate): (KJS::NegateNode::evaluateToNumber): (KJS::MultNode::inlineEvaluateToNumber): (KJS::MultNode::evaluate): (KJS::MultNode::evaluateToNumber): (KJS::DivNode::inlineEvaluateToNumber): (KJS::DivNode::evaluate): (KJS::DivNode::evaluateToNumber): (KJS::ModNode::inlineEvaluateToNumber): (KJS::ModNode::evaluate): (KJS::ModNode::evaluateToNumber): (KJS::throwOutOfMemoryErrorToNumber): (KJS::addSlowCaseToNumber): (KJS::add): (KJS::addToNumber): (KJS::AddNode::evaluateToNumber): (KJS::SubNode::inlineEvaluateToNumber): (KJS::SubNode::evaluate): (KJS::SubNode::evaluateToNumber): (KJS::valueForReadModifyAssignment): (KJS::ReadModifyLocalVarNode::evaluate): (KJS::ReadModifyResolveNode::evaluate): (KJS::ReadModifyDotNode::evaluate): (KJS::ReadModifyBracketNode::evaluate): * kjs/nodes.h: (KJS::Node::): (KJS::NumberNode::): (KJS::ImmediateNumberNode::): (KJS::AddNode::precedence): * kjs/nodes2string.cpp: (KJS::NumberNode::streamTo): 2007-11-07 Mark Rowe Reviewed by Eric. Fix up initialization after being mangled in r27572, and remove the ternary expression as extraCost will always be zero for the numeric heap. * kjs/collector.cpp: (KJS::Collector::heapAllocate): 2007-11-07 Mark Rowe Gtk build fix. * kjs/regexp_object.cpp: 2007-11-07 Geoffrey Garen Reviewed by Beth Dakin. Eliminated a bogus (though compiled-out) branch in the collector. * kjs/collector.cpp: (KJS::Collector::heapAllocate): 2007-11-06 Geoffrey Garen Reviewed by Darin Adler. Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861 5.8% of string-validate-input.js is spent creating RegExpImps Put RegExpImp properties into a static hashtable to avoid a slew of PropertyMap churn when creating a RegExpImp. Factored important bits of regular expression implementation out of RegExpImp (the JS object) and into RegExp (the PCRE wrapper class), making RegExp a ref-counted class. (This will help later.) Removed PCRE_POSIX support because I didn't quite know how to test it and keep it working with these changes. 1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js. * kjs/regexp.h: A few interface changes: 1. Renamed "subpatterns()" => "numSubpatterns()" 2. Made flag enumeration private and replaced it with public getters for specific flags. 3. Made RegExp ref-counted so RegExps can be shared by RegExpImps. 4. Made RegExp take a string of flags instead of an int, eliminating duplicated flag parsing code elsewhere. * kjs/regexp_object.cpp: (KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile: - Fixed a bug where compile(undefined) would throw an exception. - Removed some now-redundant code. - Used RegExp sharing to eliminate an allocation and a bunch of PropertyMap thrash. (Not a big win since compile is a deprecated function. I mainly did this to test the plubming.) 2007-11-07 Simon Hausmann Reviewed by nobody, Qt/Windows build fix. JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in testkjs.pro, too, where it's included from. * kjs/testkjs.pro: 2007-11-07 Simon Hausmann Reviewed by Lars. Fix "nmake clean" for the Qt/Windows build by replacing tmp/ with a variable that ends with the correct type of slash/backslash depending on the choice of compiler/make tool. * JavaScriptCore.pri: * pcre/pcre.pri: 2007-11-07 Lars Knoll Reviewed by Simon. fix umemcasecmp Pretty embarrassing bug. Has the potential to fix quite a few test failures. * wtf/unicode/qt4/UnicodeQt4.h: (WTF::Unicode::umemcasecmp): 2007-11-06 Maciej Stachowiak Reviewed by Eric. - only collect when the heap is full, unless we have lots of extra cost garbage 1.1% SunSpider speedup. This shouldn't hit memory use much since the extra space in those blocks hangs around either way. * kjs/collector.cpp: (KJS::Collector::heapAllocate): (KJS::Collector::collect): Fix logic error that reversed the sense of collect's return value. 2007-11-06 Oliver Hunt Reviewed by Maciej. Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider We now convert the common 'for (...; ...; ++) ...' to the semantically identical 'for (...; ...; ++) ...'. * kjs/nodes.cpp: (KJS::PostIncResolveNode::optimizeForUnnecessaryResult): (KJS::PostIncLocalVarNode::evaluate): (KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult): (KJS::PostDecResolveNode::optimizeForUnnecessaryResult): (KJS::PostDecLocalVarNode::evaluate): (KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult): * kjs/nodes.h: (KJS::PrePostResolveNode::): (KJS::PostIncResolveNode::): (KJS::PostIncLocalVarNode::): (KJS::PostDecResolveNode::): (KJS::PostDecLocalVarNode::): (KJS::PreIncResolveNode::): (KJS::PreDecResolveNode::): (KJS::ForNode::ForNode): 2007-11-06 Eric Seidel Reviewed by darin. This fixes a regressed layout test for string + object SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower. * kjs/nodes.cpp: (KJS::add): remove erroneous "fast path" for string + * 2007-11-06 Geoffrey Garen Reviewed by Eric Seidel. Added toJSNumber, a fast path for converting a JSValue to a JS number, and deployed it in postfix expressions. In the fast case this eliminates a call to jsNumber. 0.4% speedup on SunSpider. * ChangeLog: * kjs/nodes.cpp: (KJS::PostIncResolveNode::evaluate): (KJS::PostIncLocalVarNode::evaluate): (KJS::PostDecResolveNode::evaluate): (KJS::PostDecLocalVarNode::evaluate): (KJS::PostIncBracketNode::evaluate): (KJS::PostDecBracketNode::evaluate): (KJS::PostIncDotNode::evaluate): (KJS::PostDecDotNode::evaluate): (KJS::UnaryPlusNode::evaluate): * kjs/value.h: (KJS::JSValue::toJSNumber): 2007-11-06 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15846 REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html There was a mistake in the algorithm used to find an empty slot in the property map entries vector; when we were putting in a new property value and not overwriting an existing deleted sentinel, we would enlarge the entries vector, but would not overwrite the stale data that's in the new part. It was easy to pin this down by turning on property map consistency checks -- I never would have landed with this bug if I had run the regression tests once with consistency checks on! * kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where foundDeletedElement is false to always use the item at the end of the entries vector. Also allowed me to merge with the logic for the "no deleted sentinels at all" case. 2007-11-06 Oliver Hunt RS=Darin. Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider. * kjs/nodes.cpp: (KJS::add): 2007-11-06 Oliver Hunt Reviewed by Darin. Replace boolean comparisons in AddNode with mask comparisons for a 0.2% improvement in sunspider. * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/nodes.cpp: (KJS::add): 2007-11-06 Eric Seidel Reviewed by darin. SunSpider claims this is a 1.1% speedup. * kjs/nodes.cpp: (KJS::throwOutOfMemoryError): Added, non inline. (KJS::addSlowCase): renamed from add(), non inline. (KJS::add): add fast path for String + String, Number + Number and String + * 2007-11-06 Eric Seidel Reviewed by mjs. Avoid more UString creation. SunSpider claims this is a 0.4% speedup. * kjs/regexp_object.cpp: (KJS::RegExpObjectImp::construct): use UString::find(UChar) 2007-11-05 Mark Rowe Mac build fix. * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): 2007-11-05 Adam Roben Windows build fix * kjs/list.h: 2007-11-05 Mark Rowe Build fix. Add missing #include. * kjs/operations.cpp: 2007-11-05 Eric Seidel Reviewed by mjs. Remove another call to toString(exec) SunSpider claims this is a 0.5% speedup. * kjs/operations.cpp: (KJS::equal): remove another toString 2007-11-05 Eric Seidel * kjs/operations.cpp: (KJS::equal): correct broken change. 2007-11-05 Eric Seidel Reviewed by mjs. Remove one more call to toString(exec). SunSpider claims this is a 0.7% speedup. * kjs/operations.cpp: (KJS::equal): remove a call to toString() 2007-11-05 Mark Rowe Gtk build fix. * pcre/pcre.pri: 2007-11-05 Mark Rowe Gtk build fix. * kjs/list.cpp: 2007-11-05 Geoffrey Garen Touched a file to test my new HTTP access. * kjs/scope_chain.cpp: 2007-11-05 Alp Toker Unreviewed build fix for qmake-based ports. Someone with a better understanding of qmake still needs to sort out the INCLUDEPATH/DEPENDPATH mess. * JavaScriptCore.pri: 2007-11-05 Geoffrey Garen Reviewed by Darin Adler. http://bugs.webkit.org/show_bug.cgi?id=15835 Switched List implementation from a custom heap allocator to an inline Vector, for a disappointing .5% SunSpider speedup. Also renamed List::slice to List::getSlice because "get" is the conventional prefix for functions returning a value through an out parameter. * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function calls and memory accesses. * kjs/bool_object.cpp: (BooleanObjectImp::construct): Removed questionable use of iterator. * kjs/list.cpp: * kjs/list.h: New List class, implemented in terms of Vector. Two interesting differences: 1. The inline capacity is 8, not 5. Many of the Lists constructed during a SunSpider run are larger than 5; almost none are larger than 8. 2. The growth factor is 4, not 2. Since we can guarantee that Lists aren't long-lived, we can grow them more aggressively, to avoid excessive copying. * kjs/regexp_object.cpp: (RegExpObjectImp::construct): Removed redundant function calls. * kjs/string_object.cpp: (KJS::StringObjectImp::construct): Removed questionable use of iterator. * wtf/Vector.h: (WTF::::uncheckedAppend): Added a fast, unchecked version of append. 2007-11-05 Mark Rowe Reviewed by Alp Toker. Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies. * JavaScriptCore.pri: * pcre/pcre.pri: 2007-11-04 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15826 optimize opcode loop and case insensitive ASCII compares for a 30% speedup SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests. * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC. * pcre/pcre_compile.c: (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also added OP_NOT since there was no reason it should not be in here. (could_be_empty_branch): Ditto. (compile_branch): Streamlined all the single-character cases; there was a bit of duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed. But in particular, compile to those opcodes when the single character match is ASCII. (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from the matchframe, after I discovered that none of them needed to be saved and restored across recursive match calls. Also eliminated the ignored result field from the matchframe, since I discovered that rrc ("recursive result code") was already the exact same thing. Moved the handling of opcodes higher than OP_BRA into the default statement of the switch instead of doing them before the switch. This removes a branch from each iteration of the opcode interpreter, just as removal of "op" removed at least one store from each iteration. Last, but not least, add the OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a surrogate pair and the letter case can be handled efficiently. 2007-11-04 Darin Adler * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code. 2007-11-03 Darin Adler - fix non-Mac builds; remove some more unused PCRE stuff * pcre/pcre_compile.c: (compile_branch): Removed branch chain and some unused ESC values. (compile_regex): Ditto. (jsRegExpCompile): Ditto. * pcre/pcre_exec.c: (match): Removed unused branch targets. Don't use macros any more. (jsRegExpExecute): More of the same. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files. * JavaScriptCore.xcodeproj/project.pbxproj: Ditto. * pcre/pcre.pri: Ditto. * pcre/MERGING: Removed. * pcre/pcre_fullinfo.c: Removed. * pcre/pcre_get.c: Removed. * pcre/pcre_internal.h: * pcre/ucp.h: Removed. 2007-11-03 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15821 remove unused PCRE features for speed A first step toward removing the PCRE features we don't use. This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on the SunSpider regular expression test. Replaced the public interface with one that doesn't use the name PCRE. Removed code we don't need for JavaScript and various configurations we don't use. This is in preparation for still more changes in the future. We'll probably switch to C++ and make some even more significant changes to the regexp engine to get some additional speed. There's probably additional unused stuff that I haven't deleted yet. This does mean that our PCRE is now a fork, but I think that's not really a big deal. * JavaScriptCore.exp: Remove the 5 old entry points and add the 3 new entry points for WebCore's direct use of the regular expression engine. * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip its sense and now there's a USE(POSIX_REGEX) instead, which should probably not be set by anyone. Maybe later we'll just get rid of it altogether. * kjs/regexp.h: * kjs/regexp.cpp: (KJS::RegExp::RegExp): Switch to new jsRegExp function names and defines. Cut down on the number of functions used. (KJS::RegExp::~RegExp): Ditto. (KJS::RegExp::match): Ditto. * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta, which are unused. * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const, size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE, POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8, and JAVASCRIPT. These are all no longer configurable in our copy of the library. * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE, the include of , and most of the constants and functions defined in this header. Changed the naming scheme to use a JSRegExp prefix rather than a pcre prefix. In the future, we'll probably change this to be a C++ header. * pcre/pcre_compile.c: Removed all unused code branches, including many whole functions and various byte codes. Kept changes outside of removal to a minimum. (check_escape): (first_significant_code): (find_fixedlength): (find_recurse): (could_be_empty_branch): (compile_branch): (compile_regex): (is_anchored): (is_startline): (find_firstassertedchar): (jsRegExpCompile): Renamed from pcre_compile2 and changed the parameters around a bit. (jsRegExpFree): Added. * pcre/pcre_exec.c: Removed many unused opcodes and variables. Also started tearing down the NO_RECURSE mechanism since it's now the default. In some cases there were things in the explicit frame that could be turned into plain old local variables and other small like optimizations. (pchars): (match_ref): (match): Changed parameters quite a bit since it's now not used recursively. (jsRegExpExecute): Renamed from pcre_exec. * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR, PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED, PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS, PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes, _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop, and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here. * pcre/pcre_maketables.c: Changed to only compile in dftables. Also got rid of many of the tables that we don't use. * pcre/pcre_tables.c: Removed the unused Unicode property tables. * pcre/pcre_ucp_searchfuncs.c: Removed everything except for _pcre_ucp_othercase. * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support for classes based on Unicode properties. * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good to eliminate this completely, but we need the regular expression code to be C++ first. * pcre/pcre_fullinfo.c: * pcre/pcre_get.c: * pcre/ucp.h: Files that are no longer needed. I didn't remove them with this check-in, because I didn't want to modify all the project files. 2007-11-03 Maciej Stachowiak Reviewed by Sam. - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup It turns out that doing this check costs more than it saves. * kjs/JSImmediate.h: (KJS::JSImmediate::fromDouble): 2007-11-03 Sam Weinig Reviewed by Oliver. Remove dummy variable from ClassInfo reducing the size of the struct by 1 word. The variable had been kept around for binary compatibility, but since nothing else is there is no point in continuing to keep it around. * API/JSCallbackConstructor.cpp: (KJS::): * API/JSCallbackFunction.cpp: (KJS::): * API/JSCallbackObject.cpp: (KJS::): * bindings/objc/objc_runtime.mm: * bindings/runtime_array.cpp: * bindings/runtime_object.cpp: * kjs/array_instance.cpp: (KJS::): * kjs/array_object.cpp: (KJS::): * kjs/bool_object.cpp: * kjs/date_object.cpp: (KJS::): * kjs/error_object.cpp: * kjs/function.cpp: (KJS::): * kjs/internal.cpp: (KJS::): * kjs/lookup.h: * kjs/math_object.cpp: * kjs/number_object.cpp: * kjs/object.h: * kjs/regexp_object.cpp: * kjs/string_object.cpp: (KJS::): 2007-11-03 Kevin McCullough - Updated testkjs results to make the build bots green until we can fix the tests that are failing. The new failures are in DST. * tests/mozilla/expected.html: 2007-11-03 Maciej Stachowiak Reviewed by Adam. - don't print the var twice for ForInNodes with a var declaration * kjs/nodes2string.cpp: (KJS::ForInNode::streamTo): 2007-11-03 Darin Adler * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of C-incompatible declaration. 2007-11-03 Mark Rowe Gtk build fix. * kjs/nodes.cpp: Add missing include. 2007-11-03 Darin Adler Reviewed by Maciej. - fix http://bugs.webkit.org/show_bug.cgi?id=15814 fast/js/kde/encode_decode_uri.html fails These changes cause us to match the JavaScript specification and pass the fast/js/kde/encode_decode_uri.html test. * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its new strict mode, throwing an exception if there are malformed UTF-16 surrogate pairs in the text. * kjs/ustring.h: Added a strict version of the UTF-8 string conversion. * kjs/ustring.cpp: (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while those might be illegal in some sense, they aren't supposed to get any special handling in the place where this function is currently used. (KJS::UString::UTF8String): Added the strictness. 2007-11-03 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15812 some JavaScript tests (from the Mozilla test suite) are failing Two or three fixes get 7 more of the Mozilla tests passing. This gets us down from 61 failing tests to 54. * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp): Made this inline and gave it a more specific type. Some day we should probably do that for all of these -- might even get a bit of a speed boost from it. * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's inline in the header. * kjs/regexp_object.h: * kjs/regexp_object.cpp: (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the switch statement into the RegExpImp object, so they can be shared with RegExpImp::callAsFunction. (KJS::RegExpImp::match): Added. Common code used by both test and exec. (KJS::RegExpImp::test): Added. (KJS::RegExpImp::exec): Added. (KJS::RegExpImp::implementsCall): Added. (KJS::RegExpImp::callAsFunction): Added. (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize lastInput to null rather than empty string -- we take advantage of the difference in RegExpImp::match. (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables just to get at a field like this. * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match the JavaScript specification. If there are not 4 hex digits after the \u, then it's processed as if it wasn't an escape sequence at all. * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition for JavaScript (4 specific Unicode values). * pcre/pcre_exec.c: (match): Changed all call sites to use IS_NEWLINE. (pcre_exec): Ditto. * tests/mozilla/expected.html: Updated to expect 7 more successful tests. 2007-11-03 David D. Kilzer Sort files(...); sections of Xcode project files. Rubber-stamped by Darin. * JavaScriptCore.xcodeproj/project.pbxproj: 2007-11-03 Maciej Stachowiak Reviewed by Oliver. - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup * kjs/grammar.y: * kjs/nodes.cpp: (KJS::VarDeclNode::optimizeVariableAccess): (KJS::VarDeclNode::getDeclarations): (KJS::VarDeclNode::handleSlowCase): (KJS::VarDeclNode::evaluateSingle): (KJS::VarDeclNode::evaluate): (KJS::VarStatementNode::execute): * kjs/nodes.h: (KJS::VarDeclNode::): (KJS::VarStatementNode::): * kjs/nodes2string.cpp: (KJS::VarDeclNode::streamTo): 2007-11-03 Alexey Proskuryakov Reviewed by Darin. http://bugs.webkit.org/show_bug.cgi?id=15800 REGRESSION (r27303): RegExp leaks * kjs/regexp_object.h: (KJS::RegExpImp::setRegExp): (KJS::RegExpImp::regExp): (KJS::RegExpImp::classInfo): * kjs/regexp_object.cpp: (RegExpImp::RegExpImp): (RegExpImp::~RegExpImp): Renamed reg member variable to m_regExp, changed it to use OwnPtr. 2007-11-02 Maciej Stachowiak Reviewed by Oliver. - add SourceElements as a typedef for Vector >. * kjs/grammar.y: * kjs/nodes.cpp: (KJS::statementListPushFIFO): (KJS::statementListGetDeclarations): (KJS::statementListInitializeDeclarationStacks): (KJS::statementListInitializeVariableAccessStack): (KJS::statementListExecute): (KJS::BlockNode::BlockNode): (KJS::FunctionBodyNode::FunctionBodyNode): (KJS::ProgramNode::ProgramNode): * kjs/nodes.h: (KJS::CaseClauseNode::): 2007-11-02 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15791 change property map data structure for less memory use, better speed The property map now has an array of indices and a separate array of property map entries. This slightly slows down lookup because of a second memory acess, but makes property maps smaller and faster to iterate in functions like mark(). SunSpider says this is 1.2% faster, although it makes the bitwise-end test more than 10% slower. To fix that we'll need to optimize global variable lookup. * kjs/property_map.cpp: (KJS::PropertyMapEntry::PropertyMapEntry): (KJS::PropertyMapHashTable::entries): (KJS::PropertyMapHashTable::allocationSize): (KJS::SavedProperties::SavedProperties): (KJS::SavedProperties::~SavedProperties): (KJS::PropertyMap::checkConsistency): (KJS::PropertyMap::~PropertyMap): (KJS::PropertyMap::clear): (KJS::PropertyMap::get): (KJS::PropertyMap::getLocation): (KJS::PropertyMap::put): (KJS::PropertyMap::insert): (KJS::PropertyMap::createTable): (KJS::PropertyMap::rehash): (KJS::PropertyMap::remove): (KJS::PropertyMap::mark): (KJS::comparePropertyMapEntryIndices): (KJS::PropertyMap::containsGettersOrSetters): (KJS::PropertyMap::getEnumerablePropertyNames): (KJS::PropertyMap::save): (KJS::PropertyMap::restore): * kjs/property_map.h: 2007-11-02 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15807 HashMap needs a take() function that combines get and remove * wtf/HashMap.h: Added take function. Simplistic implementation for now, but still does only one hash table lookup. * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than a find followed by a remove. 2007-11-02 David Carson Reviewed by Darin. Fix compiler warning "warning: suggest parentheses around && within ||" http://bugs.webkit.org/show_bug.cgi?id=15764 * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses. 2007-11-01 Geoffrey Garen Reviewed by Maciej Stachowiak. In preparation for making List a simple stack-allocated Vector: Removed all instances of List copying and/or assignment, and made List inherit from Noncopyable. Functions that used to return a List by copy now take List& out parameters. Layout tests and JS tests pass. * kjs/list.cpp: (KJS::List::slice): Replaced copyTail with a more generic slice alternative. (JavaScriptCore only calls slice(1), but WebCore calls slice(2)). 2007-11-01 Geoffrey Garen Reviewed by Maciej Stachowiak. Fixed http://bugs.webkit.org/show_bug.cgi?id=15785 REGRESSION(r27344): Crash on load at finance.yahoo.com Reverted a small portion of my last check-in. (The speedup and the List removal are still there, though.) ActivationImp needs to hold a pointer to its function, and mark that pointer (rather than accessing its function through its ExecState, and counting on the active scope to mark its function) because a closure can cause an ActivationImp to outlive its ExecState along with any active scope. * kjs/ExecState.cpp: (KJS::ExecState::ExecState): * kjs/function.cpp: (KJS::FunctionImp::~FunctionImp): (KJS::ActivationImp::ActivationImp): * kjs/function.h: (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate): Also made HashTable a little more crash-happy in debug builds, so problems like this will show up earlier: * wtf/HashTable.h: (WTF::HashTable::~HashTable): 2007-11-01 Geoffrey Garen Reviewed by Adam Roben. Addressed some of Darin's review comments. Used perl -p, which is the shorthand while(<>) {}. Made sure not to suppress bison's output. Added line to removed bison_out.txt, since this script removes other intermediate files, too. * DerivedSources.make: 2007-11-01 Geoffrey Garen Reviewed by Oliver Hunt. Removed List from ActivationImp, in preparation for making all lists stack-allocated. Tests pass. 1.0% speedup on SunSpider, presumably due to reduced List refcount thrash. * kjs/ExecState.cpp: (KJS::ExecState::ExecState): (KJS::ExecState::~ExecState): * kjs/function.cpp: (KJS::ActivationImp::ActivationImp): (KJS::ActivationImp::createArgumentsObject): * kjs/function.h: (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate): 2007-11-01 Adam Roben Use jsNumberCell instead of jsNumber when converting double constants to JSValues This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC. It also gets rid of an MSVC warning that we previously had to silence. Reviewed by Geoff. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn back on the "overflow in constant arithmetic" warning. * kjs/number_object.cpp: (NumberObjectImp::getValueProperty): Use jsNumberCell instead of jsNumber. 2007-10-31 Adam Roben Windows build fix * kjs/ExecState.h: 2007-10-31 Maciej Stachowiak Reviewed by Oliver. - shave some cycles off of local storage access for a 1% SunSpider speedup Keep the LocalStorage pointer in the ExecState, instead of getting it from the ActivationImp all the time. * kjs/ExecState.cpp: (KJS::ExecState::updateLocalStorage): * kjs/ExecState.h: (KJS::ExecState::localStorage): * kjs/nodes.cpp: (KJS::LocalVarAccessNode::evaluate): (KJS::LocalVarFunctionCallNode::evaluate): (KJS::PostIncLocalVarNode::evaluate): (KJS::PostDecLocalVarNode::evaluate): (KJS::LocalVarTypeOfNode::evaluate): (KJS::PreIncLocalVarNode::evaluate): (KJS::PreDecLocalVarNode::evaluate): (KJS::ReadModifyLocalVarNode::evaluate): (KJS::AssignLocalVarNode::evaluate): (KJS::FunctionBodyNode::processDeclarationsForFunctionCode): 2007-10-31 Adam Roben Fix a crash on launch due to a static initializer race We now use fast inline assembler spinlocks which can be statically initialized at compile time. As a side benefit, this speeds up SunSpider by 0.4%. Reviewed by Oliver. * wtf/FastMalloc.cpp: * wtf/TCSpinLock.h: (TCMalloc_SpinLock::Lock): (TCMalloc_SpinLock::Unlock): (TCMalloc_SlowLock): * wtf/TCSystemAlloc.cpp: 2007-10-31 Kevin McCullough Reviewed by Sam. - Corrected spelling. * wtf/HashTraits.h: 2007-10-31 Mark Rowe Further Gtk build fixage. * kjs/regexp_object.cpp: 2007-10-31 Mark Rowe Gtk build fix. * kjs/regexp.h: 2007-10-31 Darin Adler Reviewed by Maciej. - fix http://bugs.webkit.org/show_bug.cgi?id=15749 RegExp/RegExpObjectImp cause needless UString creation Speeds things up 0.4% according to SunSpider. * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX), because this library doesn't use the real PCRE -- it uses its own PCRE that works on UTF-16. * kjs/regexp.h: Removed a few unused functions. Changed the ifdef. Use Noncopyable. Change the return value of match. * kjs/regexp.cpp: (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost. (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX. (KJS::RegExp::match): Change to return the position as an int and the ovector as a OwnArrayPtr for efficiency and clearer storage management. * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer require a result string. * kjs/regexp_object.cpp: (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch. (RegExpObjectImp::performMatch): Change so it doesn't return a string. (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of the main result with the backreferences; now it doesn't need to take a result parameter. (RegExpObjectImp::getBackref): Minor tweaks. (RegExpObjectImp::getLastParen): Ditto. (RegExpObjectImp::getLeftContext): Ditto. (RegExpObjectImp::getRightContext): Ditto. (RegExpObjectImp::getValueProperty): Change LastMatch case to call getBackref(0) so we don't need a separate getLastMatch function. * kjs/string_object.cpp: (KJS::replace): Update to use new performMatch, including merging the matched string section with the other substrings. (KJS::StringProtoFunc::callAsFunction): Update functions to use the new performMatch and match. Also change to use OwnArrayPtr. 2007-10-31 Oliver Hunt * kjs/nodes.h: include OwnPtr.h 2007-10-31 Oliver Hunt Reviewed by Maciej. Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider * kjs/grammar.y: * kjs/nodes.cpp: (KJS::statementListPushFIFO): (KJS::statementListGetDeclarations): (KJS::statementListInitializeDeclarationStacks): (KJS::statementListInitializeVariableAccessStack): (KJS::statementListExecute): (KJS::BlockNode::optimizeVariableAccess): (KJS::BlockNode::BlockNode): (KJS::BlockNode::getDeclarations): (KJS::BlockNode::execute): (KJS::CaseClauseNode::optimizeVariableAccess): (KJS::CaseClauseNode::getDeclarations): (KJS::CaseClauseNode::evalStatements): (KJS::FunctionBodyNode::initializeDeclarationStacks): (KJS::FunctionBodyNode::optimizeVariableAccess): * kjs/nodes.h: * kjs/nodes2string.cpp: (KJS::statementListStreamTo): (KJS::BlockNode::streamTo): (KJS::CaseClauseNode::streamTo): 2007-10-30 Mark Rowe * kjs/property_map.cpp: Added a missing using directive to fix the build for non-Mac ports. Mac worked only because it does the AllInOneFile compile. 2007-10-31 Maciej Stachowiak * kjs/property_map.cpp: Include HashTable.h the right way to fix the build for non-Mac ports. 2007-10-31 Alexey Proskuryakov Reviewed by Darin. http://bugs.webkit.org/show_bug.cgi?id=11001 WebKit doesn't support RegExp.compile method Test: fast/js/regexp-compile.html * kjs/regexp_object.cpp: (RegExpPrototype::RegExpPrototype): (RegExpProtoFunc::callAsFunction): * kjs/regexp_object.h: (KJS::RegExpProtoFunc::): Added RegExp.compile. * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes. 2007-10-31 Maciej Stachowiak Reviewed by Oliver. - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup Integer divide sucks. Fortunately, a bunch of shifts and XORs biased towards the high bits is sufficient to provide a good double hash. Besides the SunSpider win, I used the dump statistics mode for both to verify that collisions did not increase and that the longest collision chain is not any longer. * kjs/property_map.cpp: (KJS::doubleHash): (KJS::PropertyMap::get): (KJS::PropertyMap::getLocation): (KJS::PropertyMap::put): (KJS::PropertyMap::insert): (KJS::PropertyMap::remove): (KJS::PropertyMap::checkConsistency): * wtf/HashTable.h: (WTF::doubleHash): (WTF::::lookup): (WTF::::lookupForWriting): (WTF::::fullLookupForWriting): (WTF::::add): 2007-10-30 Adam Roben * kjs/collector.h: Make HeapType public so it can be used for non-member things like the HeapConstants struct template. Fixes the build on Windows. 2007-10-30 Adam Roben Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows Speeds up SunSpider by 0.4%. Reviewed by Steve and Maciej. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable a warning during LTCG in release builds about double -> float conversion. * wtf/AlwaysInline.h: * wtf/FastMalloc.h: 2007-10-30 Adam Roben Use GetCurrentThreadId instead of pthread_self in FastMalloc Speeds up SunSpider by 0.3%. Reviewed by Steve. * wtf/FastMalloc.cpp: (WTF::TCMalloc_ThreadCache::InitTSD): (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary): 2007-10-30 Adam Roben Switch to a Win32 critical section implementation of spinlocks Speeds up SunSpider by 0.4%. Reviewed by Steve. * wtf/FastMalloc.cpp: * wtf/TCSpinLock.h: (TCMalloc_SpinLock::TCMalloc_SpinLock): (TCMalloc_SpinLock::Init): (TCMalloc_SpinLock::Finalize): (TCMalloc_SpinLock::Lock): (TCMalloc_SpinLock::Unlock): * wtf/TCSystemAlloc.cpp: 2007-10-30 Adam Roben Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta http://bugs.webkit.org/show_bug.cgi?id=15586 Also fixes: Cannot use regsvr32.exe to register WebKit.dll Use Win32 TLS functions instead of __declspec(thread), which breaks delay-loading. Reviewed by Steve. * wtf/FastMalloc.cpp: (WTF::getThreadHeap): (WTF::TCMalloc_ThreadCache::InitModule): 2007-10-30 Maciej Stachowiak Reviewed by Oliver. - allocate numbers in half-size cells, for an 0.5% SunSpider speedup http://bugs.webkit.org/show_bug.cgi?id=15772 We do this by using a single mark bit per two number cells, and tweaking marking. Besides being an 0.5% win overall, this is a 7.1% win on morph. * kjs/collector.cpp: (KJS::): (KJS::Collector::heapAllocate): (KJS::Collector::markStackObjectsConservatively): (KJS::Collector::sweep): * kjs/collector.h: (KJS::SmallCollectorCell::): 2007-10-30 Geoffrey Garen Reviewed by Adam Roben, Sam Weinig. Made conflicts in grammar.y a persistent build failure. * DerivedSources.make: 2007-10-30 Kevin McCullough Reviewed by Adam and Geoff. - Added a new cast so all the casts are in the same place. * API/APICast.h: (toGlobalRef): 2007-10-30 Geoffrey Garen Reviewed by Darin Adler. Fixed shift/reduce conflict introduced in r24457 JS tests, including ecma_2/Statements/dowhile-001.js ecma_2/Statements/dowhile-002.js ecma_2/Statements/dowhile-003.js ecma_2/Statements/dowhile-004.js ecma_2/Statements/dowhile-005.js ecma_2/Statements/dowhile-006.js ecma_2/Statements/dowhile-007.js js1_2/statements/do_while.js and layout tests, including do-while-expression-value.html do-while-semicolon.html do-while-without-semicolon.html pass. * kjs/grammar.y: Use the explicit "error" production, as we do with other automatic semicolon insertions, to disambiguate "do { } while();" from "do { } while()" followed by ";" (the empty statement). 2007-10-29 Oliver Hunt Reviewed by Maciej. Debranching remaining assignment nodes, and miscellaneous cleanup Split read-modify code paths out of AssignBracketNode and AssignDotNode Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode and ReadModifyResolveNode evaluate methods Leads to a 1% gain in SunSpider. * kjs/grammar.y: * kjs/nodes.cpp: (KJS::ReadModifyLocalVarNode::evaluate): (KJS::ReadModifyResolveNode::evaluate): (KJS::AssignDotNode::evaluate): (KJS::ReadModifyDotNode::optimizeVariableAccess): (KJS::ReadModifyDotNode::evaluate): (KJS::AssignBracketNode::evaluate): (KJS::ReadModifyBracketNode::optimizeVariableAccess): (KJS::ReadModifyBracketNode::evaluate): * kjs/nodes.h: (KJS::AssignBracketNode::): (KJS::AssignBracketNode::precedence): (KJS::AssignDotNode::): (KJS::AssignDotNode::precedence): * kjs/nodes2string.cpp: (KJS::ReadModifyBracketNode::streamTo): (KJS::AssignBracketNode::streamTo): (KJS::ReadModifyDotNode::streamTo): (KJS::AssignDotNode::streamTo): 2007-10-29 Oliver Hunt Debranching various Node::evaluate implementations Reviewed by Maciej. Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode Gains 1.6% on SunSpider * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/grammar.y: * kjs/nodes.cpp: (KJS::PostIncResolveNode::optimizeVariableAccess): (KJS::PostIncResolveNode::evaluate): (KJS::PostIncLocalVarNode::evaluate): (KJS::PostDecResolveNode::optimizeVariableAccess): (KJS::PostDecResolveNode::evaluate): (KJS::PostDecLocalVarNode::evaluate): (KJS::PostIncBracketNode::evaluate): (KJS::PostDecBracketNode::evaluate): (KJS::PostIncDotNode::evaluate): (KJS::PostDecDotNode::evaluate): (KJS::PreIncResolveNode::optimizeVariableAccess): (KJS::PreIncLocalVarNode::evaluate): (KJS::PreIncResolveNode::evaluate): (KJS::PreDecResolveNode::optimizeVariableAccess): (KJS::PreDecLocalVarNode::evaluate): (KJS::PreDecResolveNode::evaluate): (KJS::PreIncBracketNode::evaluate): (KJS::PreDecBracketNode::evaluate): (KJS::PreIncDotNode::evaluate): (KJS::PreDecDotNode::evaluate): (KJS::ReadModifyResolveNode::optimizeVariableAccess): (KJS::AssignResolveNode::optimizeVariableAccess): (KJS::AssignLocalVarNode::evaluate): (KJS::AssignResolveNode::evaluate): * kjs/nodes.h: (KJS::PostDecResolveNode::): (KJS::PostDecResolveNode::precedence): (KJS::PostDecLocalVarNode::): (KJS::PostfixBracketNode::): (KJS::PostfixBracketNode::precedence): (KJS::PostIncBracketNode::): (KJS::PostIncBracketNode::isIncrement): (KJS::PostDecBracketNode::): (KJS::PostDecBracketNode::isIncrement): (KJS::PostfixDotNode::): (KJS::PostfixDotNode::precedence): (KJS::PostIncDotNode::): (KJS::PostIncDotNode::isIncrement): (KJS::PostDecDotNode::): (KJS::PreIncResolveNode::): (KJS::PreDecResolveNode::): (KJS::PreDecResolveNode::precedence): (KJS::PreDecLocalVarNode::): (KJS::PrefixBracketNode::): (KJS::PrefixBracketNode::precedence): (KJS::PreIncBracketNode::): (KJS::PreIncBracketNode::isIncrement): (KJS::PreDecBracketNode::): (KJS::PreDecBracketNode::isIncrement): (KJS::PrefixDotNode::): (KJS::PrefixDotNode::precedence): (KJS::PreIncDotNode::): (KJS::PreIncDotNode::isIncrement): (KJS::PreDecDotNode::): (KJS::ReadModifyResolveNode::): (KJS::ReadModifyLocalVarNode::): (KJS::AssignResolveNode::): (KJS::AssignResolveNode::precedence): * kjs/nodes2string.cpp: (KJS::PostIncResolveNode::streamTo): (KJS::PostDecResolveNode::streamTo): (KJS::PostfixBracketNode::streamTo): (KJS::PostfixDotNode::streamTo): (KJS::PreIncResolveNode::streamTo): (KJS::PreDecResolveNode::streamTo): (KJS::ReadModifyResolveNode::streamTo): (KJS::AssignResolveNode::streamTo): 2007-10-29 Maciej Stachowiak Not reviewed, build fix. - Include Vector.h in a way that actually works. * kjs/LocalStorage.h: 2007-10-29 Maciej Stachowiak Not reviewed, build fix. - Install LocalStorage.h as a private header. * JavaScriptCore.xcodeproj/project.pbxproj: 2007-10-29 Maciej Stachowiak Reviewed by Darin. - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/LocalStorage.h: Added. (KJS::LocalStorageEntry::LocalStorageEntry): (WTF::): * kjs/function.h: * kjs/nodes.cpp: (KJS::FunctionBodyNode::processDeclarationsForFunctionCode): 2007-10-29 Geoffrey Garen Reviewed by Oliver Hunt. Some small tweaks that I notice while reviewing Oliver's last patch. Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE. No change in SunSpider because SunSpider doesn't take the code path that would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much. * kjs/nodes.cpp: (KJS::LocalVarPostfixNode::evaluate): (KJS::TypeOfResolveNode::optimizeVariableAccess): (KJS::LocalVarTypeOfNode::evaluate): (KJS::PrefixResolveNode::optimizeVariableAccess): (KJS::LocalVarPrefixNode::evaluate): (KJS::AssignResolveNode::optimizeVariableAccess): (KJS::LocalVarAssignNode::evaluate): * kjs/nodes.h: (KJS::LocalVarTypeOfNode::): (KJS::PrefixResolveNode::): (KJS::LocalVarPrefixNode::): (KJS::AssignResolveNode::): (KJS::LocalVarAssignNode::): 2007-10-29 Eric Seidel Reviewed by Maciej. SunSpider claims this was a 0.7% speedup. * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case 2007-10-29 Maciej Stachowiak Reviewed by Mark. - re-enable asserts for access to empty or deleted keys * wtf/HashTable.h: (WTF::::lookup): (WTF::::lookupForWriting): (WTF::::fullLookupForWriting): (WTF::::add): 2007-10-29 Eric Seidel Build fix only, no review. * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot 2007-10-29 Mark Rowe Gtk build fix. Move struct declarations into nodes.h. * kjs/grammar.y: * kjs/nodes.h: 2007-10-29 Eric Seidel Reviewed by darin. Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays. Make it a compile time error to use toString(ExecState) on a StringInstance SunSpider claims this was a 6.6% speedup overall (22% on string-base64) * kjs/internal.h: (KJS::StringImp::getLength): * kjs/string_object.cpp: (KJS::StringInstance::lengthGetter): (KJS::StringInstance::inlineGetOwnPropertySlot): (KJS::StringInstance::getOwnPropertySlot): * kjs/string_object.h: 2007-10-28 Oliver Hunt Reviewed by Darin. Add nodes to allow Assignment, TypeOf, and prefix operators to make use of the new optimised local variable look up. 5% gain on sunspider * kjs/nodes.cpp: (KJS::TypeOfResolveNode::optimizeVariableAccess): (KJS::LocalTypeOfAccessNode::evaluate): (KJS::PrefixResolveNode::optimizeVariableAccess): (KJS::PrefixLocalAccessNode::evaluate): (KJS::AssignResolveNode::optimizeVariableAccess): (KJS::AssignLocalAccessNode::evaluate): * kjs/nodes.h: (KJS::TypeOfResolveNode::): (KJS::TypeOfResolveNode::precedence): (KJS::LocalTypeOfAccessNode::): (KJS::PrefixResolveNode::): (KJS::PrefixResolveNode::precedence): (KJS::PrefixLocalAccessNode::): (KJS::AssignResolveNode::): (KJS::AssignLocalAccessNode::): 2007-10-28 Maciej Stachowiak Reviewed by Darin. - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time http://bugs.webkit.org/show_bug.cgi?id=15748 Not a significant speedup or slowdown on SunSpider. * kjs/Parser.cpp: (KJS::clearNewNodes): * kjs/Parser.h: * kjs/grammar.y: * kjs/nodes.cpp: (KJS::BlockNode::BlockNode): (KJS::CaseBlockNode::CaseBlockNode): (KJS::FunctionBodyNode::FunctionBodyNode): (KJS::SourceElementsNode::SourceElementsNode): (KJS::ProgramNode::ProgramNode): * kjs/nodes.h: (KJS::ElementNode::): (KJS::ArrayNode::): (KJS::PropertyListNode::): (KJS::ObjectLiteralNode::): (KJS::ArgumentListNode::): (KJS::ArgumentsNode::): (KJS::VarDeclListNode::): (KJS::VarStatementNode::): (KJS::ForNode::): (KJS::ParameterNode::): (KJS::FuncExprNode::): (KJS::FuncDeclNode::): (KJS::SourceElementsNode::): (KJS::CaseClauseNode::): (KJS::ClauseListNode::): 2007-10-28 Mark Rowe Disable assertions in a manner that doesn't break the Qt Windows build. * wtf/HashTable.h: (WTF::::lookup): (WTF::::lookupForWriting): (WTF::::fullLookupForWriting): 2007-10-28 Geoffrey Garen Temporarily disabling some ASSERTs I introduced in my last check-in because of http://bugs.webkit.org/show_bug.cgi?id=15747 Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT * wtf/HashTable.h: (WTF::::lookup): (WTF::::lookupForWriting): (WTF::::fullLookupForWriting): (WTF::::add): 2007-10-28 Geoffrey Garen Reviewed by Darin Adler. Fixed http://bugs.webkit.org/show_bug.cgi?id=15746 #ifndef ASSERT_DISABLED is no good! Replaced with #if !ASSERT_DISABLED. * wtf/HashTable.h: (WTF::::lookup): (WTF::::lookupForWriting): (WTF::::fullLookupForWriting): (WTF::::add): 2007-10-28 Geoffrey Garen Reviewed by Darin Adler. Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode to the AST transfom that replaces slow resolve nodes with fast local variable alternatives. 2.5% speedup on SunSpider. Also added some missing copyright notices. * kjs/nodes.cpp: (KJS::FunctionCallResolveNode::optimizeVariableAccess): (KJS::FunctionCallResolveNode::evaluate): (KJS::LocalVarFunctionCallNode::evaluate): (KJS::PostfixResolveNode::optimizeVariableAccess): (KJS::PostfixResolveNode::evaluate): (KJS::LocalVarPostfixNode::evaluate): (KJS::DeleteResolveNode::optimizeVariableAccess): (KJS::DeleteResolveNode::evaluate): (KJS::LocalVarDeleteNode::evaluate): * kjs/nodes.h: (KJS::FunctionCallResolveNode::): (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode): (KJS::PostfixResolveNode::): (KJS::LocalVarPostfixNode::LocalVarPostfixNode): (KJS::DeleteResolveNode::): (KJS::LocalVarDeleteNode::LocalVarDeleteNode): 2007-10-28 Eric Seidel Reviewed by darin. Inline UString::Rep::deref() for a 0.8% improvement in SunSpider Add virtual keyword to a few virtual functions previously unmarked. * kjs/internal.h: (KJS::StringImp::type): (KJS::NumberImp::type): * kjs/ustring.h: (KJS::UString::Rep::deref): 2007-10-28 Darin Adler - fix "broken everything" from the storage leak fix * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor. * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr. 2007-10-28 Darin Adler Reviewed by Adam. - turn on unused parameter waring on Mac OS X because it's already on elsewhere * Configurations/Base.xcconfig: Took out -wno-unused-parameter. * API/JSNode.c: * API/JSNodeList.c: * API/minidom.c: * API/testapi.c: Fixed unused variables by using them or marked them with UNUSED_PARAM. * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc): Removed parameter names to indicate they are unused. 2007-10-28 Darin Adler Reviewed by Maciej. - fix a storage leak where we ref the UString every time we replace a ResolveNode with a LocalVarAccessNode * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor that takes PlacementNewAdopt. * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident with PlacementNewAdopt instead of the old value of ident. * kjs/ustring.h: (KJS::UString::UString): Added a constructor that takes PlacementNewAdopt. 2007-10-28 Darin Adler - Windows build fix; get rid of unused parameter * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it. * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it. The assertions weren't all that helpful. 2007-10-28 Mark Rowe Gtk build fix. Add include of MathExtras.h. * kjs/string_object.cpp: 2007-10-28 Mark Rowe Reviewed by Maciej and Tim. Replace uses of isNaN and isInf with isnan and isinf, and remove isNaN and isInf. * kjs/config.h: Remove unused HAVE_'s. * kjs/date_object.cpp: (KJS::DateInstance::getTime): (KJS::DateInstance::getUTCTime): (KJS::DateProtoFunc::callAsFunction): (KJS::DateObjectImp::construct): (KJS::DateObjectFuncImp::callAsFunction): * kjs/function.cpp: (KJS::GlobalFuncImp::callAsFunction): * kjs/math_object.cpp: (MathFuncImp::callAsFunction): * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber): * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): * kjs/operations.cpp: * kjs/operations.h: * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction): * kjs/ustring.cpp: (KJS::UString::from): * kjs/value.cpp: (KJS::JSValue::toInteger): (KJS::JSValue::toInt32SlowCase): (KJS::JSValue::toUInt32SlowCase): 2007-10-28 Geoffrey Garen Build fix: use the new-fangled missingSymbolMarker(). * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): 2007-10-28 Geoffrey Garen Reviewed by Maciej Stachowiak, Darin Adler. Much supporting work done by Maciej Stachowiak, Maks Orlovich, and Cameron Zwarich. AST transfom to replace slow resolve nodes with fast local variable alternatives that do direct memory access. Currently, only ResolveNode provides a fast local variable alternative. 6 others are soon to come. 16.7% speedup on SunSpider. Most of this patch is just scaffolding to support iterating all the resolve nodes in the AST through optimizeResolveNodes(). In optimizeResolveNodes(), most classes just push their child nodes onto the processing stack, while ResolveNodes actually replace themselves in the tree with more optimized alternatives, if possible. Here are the interesting bits: * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations in Node and ResolveNode. This tag allows you to use placement new to swap out a base class Node in favor of a subclass copy that holds the same data. (Without this tag, default initialization would NULL out RefPtrs, change line numbers, etc.) * kjs/nodes.cpp: (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT that the fast path is impossible, to make sure we didn't leave anything on the table. (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST transformation happens. (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode optimization happens. * kjs/function.h: Added symbolTable() accessor for, for the sake of an ASSERT. 2007-10-28 Mark Rowe Reviewed by Maciej. Fix "AllInOneFile.o has a global initializer in it". Some versions of gcc generate a global initializer for std::numeric_limits::max(). We can avoid this by moving it inside an inline function. * kjs/SymbolTable.h: (KJS::missingSymbolMarker): * kjs/function.cpp: (KJS::ActivationImp::getOwnPropertySlot): (KJS::ActivationImp::put): 2007-10-28 Maciej Stachowiak Reviewed by Mark. - Added assertions to protect against adding empty or deleted keys to a HashTable * wtf/HashTable.h: (WTF::HashTable::lookup): (WTF::HashTable::lookupForWriting): (WTF::HashTable::fullLookupForWriting): (WTF::HashTable::add): 2007-10-28 Darin Adler - fix GTK build * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber): Use isNaN and isInf instead of isnan and isinf. 2007-10-28 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15735 remove GroupNode to simplify AST and possibly get a modest speedup This patch removes 4 node types: GroupNode, PropertyNameNode, FunctionCallParenBracketNode, and FunctionCallParenDotNode. To remove GroupNode, we add knowledge of precedence to the tree nodes, and use that when serializing to determine where parentheses are needed. This means we no longer have to represent parentheses in the tree. The precedence values are named after productions in the grammar from the JavaScript standard. SunSpider says this is an 0.4% speedup. * kjs/function.h: * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of serialization, so I moved it to the file that takes care of that. * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to indicate failure instead of a separate boolean. Got rid of PropertyNameNode by merging the PropertyName rule into the Property rule (which was easier than figuring out how to pass the Identifier from one node to another). Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode, and FunctionCallParenDotNode. * kjs/nodes.h: Removed unused forward declarations and Operator values. Added Precedence enum, and precedence function to all nodes. Removed nodeInsideAllParens. Added streamBinaryOperator function for serialization. Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier. Removed FunctionCallParenBracketNode and FunctionCallParenDotNode. * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode. (KJS::PropertyListNode::evaluate): Changed code to get name directly instead of converting it from an Identifier to a jsString then back to a UString then into an Identifier again! * kjs/nodes2string.cpp: Changed special-token implementation to use a separate function for each of Endl, Indent, Unindent, and DotExpr instead of using a single function with a switch. Added a precedence that you can stream in, to cause the next node serialized to add parentheses based on that precedence value. (KJS::operatorString): Moved to the top of the file. (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old workaround for snprintf, since StringExtras.h takes care of that. (KJS::operator<<): Made the char and char* versions faster by using UString's character append functions instead of constructing a UString. Added the logic to the Node* version to add parentheses if needed. (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function. (KJS::ElementNode::streamTo): Use PrecAssignment for the elements. (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before the bracket. (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot. (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments. (KJS::NewExprNode::streamTo): Use PrecMember for the expression. (KJS::FunctionCallValueNode::streamTo): Use PrecCall. (KJS::FunctionCallBracketNode::streamTo): Ditto. (KJS::FunctionCallDotNode::streamTo): Ditto. (KJS::PostfixBracketNode::streamTo): Ditto. (KJS::PostfixDotNode::streamTo): Ditto. (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide. (KJS::DeleteBracketNode::streamTo): Use PrecCall. (KJS::DeleteDotNode::streamTo): Ditto. (KJS::DeleteValueNode::streamTo): Use PrecUnary. (KJS::VoidNode::streamTo): Ditto. (KJS::TypeOfValueNode::streamTo): Ditto. (KJS::PrefixBracketNode::streamTo): Use PrecCall. (KJS::PrefixDotNode::streamTo): Ditto. (KJS::PrefixErrorNode::streamTo): Use PrecUnary. (KJS::UnaryPlusNode::streamTo): Ditto. (KJS::NegateNode::streamTo): Ditto. (KJS::BitwiseNotNode::streamTo): Ditto. (KJS::LogicalNotNode::streamTo): Ditto. (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator. (KJS::DivNode::streamTo): Ditto. (KJS::ModNode::streamTo): Ditto. (KJS::AddNode::streamTo): Ditto. (KJS::SubNode::streamTo): Ditto. (KJS::LeftShiftNode::streamTo): Ditto. (KJS::RightShiftNode::streamTo): Ditto. (KJS::UnsignedRightShiftNode::streamTo): Ditto. (KJS::LessNode::streamTo): Ditto. (KJS::GreaterNode::streamTo): Ditto. (KJS::LessEqNode::streamTo): Ditto. (KJS::GreaterEqNode::streamTo): Ditto. (KJS::InstanceOfNode::streamTo): Ditto. (KJS::InNode::streamTo): Ditto. (KJS::EqualNode::streamTo): Ditto. (KJS::NotEqualNode::streamTo): Ditto. (KJS::StrictEqualNode::streamTo): Ditto. (KJS::NotStrictEqualNode::streamTo): Ditto. (KJS::BitAndNode::streamTo): Ditto. (KJS::BitXOrNode::streamTo): Ditto. (KJS::BitOrNode::streamTo): Ditto. (KJS::LogicalAndNode::streamTo): Ditto. (KJS::LogicalOrNode::streamTo): Ditto. (KJS::ConditionalNode::streamTo): Ditto. (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side. (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before the bracket and PrecAssignment for the right side. (KJS::AssignDotNode::streamTo): Ditto. (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side and PrecAssignment for the right side. (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions. (KJS::AssignExprNode::streamTo): Use PrecAssignment. 2007-10-28 Kevin Ollivier Define wx port and set wx port USE options. Reviewed by Adam Roben. * wtf/Platform.h: 2007-10-28 Mark Rowe We don't include "config.h" in headers. * bindings/jni/jni_instance.h: * kjs/regexp.h: * wtf/TCPageMap.h: * wtf/TCSpinLock.h: 2007-10-28 Maciej Stachowiak Rubber stamped by Mark. - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits * kjs/SymbolTable.h: (KJS::SymbolTableIndexHashTraits::emptyValue): * kjs/function.cpp: (KJS::ActivationImp::getOwnPropertySlot): (KJS::ActivationImp::put): 2007-10-28 Maciej Stachowiak Reviewed by Eric. - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup * kjs/SymbolTable.h: (KJS::IdentifierRepHash::hash): Special hash function for identifier reps. (KJS::IdentifierRepHash::equal): ditto (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value. (KJS::SymbolTable): change to a typedef for a HashMap. * kjs/function.cpp: (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API. (KJS::ActivationImp::deleteProperty): ditto (KJS::ActivationImp::put): ditto * kjs/nodes.cpp: (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since you now have to store a UString::rep, not an identifier. 2007-10-27 Maciej Stachowiak Reviewed by Oliver. - numerous HashTable performance improvements This does not quite add up to a measurable win on SunSpider, but it allows a follow-on > 3% improvement and probably helps WebCore too. I made the following improvements, among others: - Made HashFunctions note whether it is ok to compare a real value with the equal() function to the empty or deleted value, and used this to optimize the comparisons done in hash lookup. - Specialized lookup so it doesn't have to do so many extra branches and build so many extra std::pairs for cases that don't need them. There are now four versions, one for read-only access, two for writing, and one folded directly into add() (these all were improvments). - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators. - Made a special constructor for iterators that knows it points to a valid filled cell and so skips updating itself. - Reordered memory accesses in the various lookup functions for better code generation - Made simple translators avoid passing a hash code around - Other minor tweaks * wtf/HashTable.h: (WTF::): (WTF::HashTableConstIterator::HashTableConstIterator): (WTF::HashTableIterator::HashTableIterator): (WTF::IdentityHashTranslator::translate): (WTF::HashTable::end): (WTF::HashTable::lookup): (WTF::HashTable::lookupForWriting): (WTF::HashTable::makeKnownGoodIterator): (WTF::HashTable::makeKnownGoodConstIterator): (WTF::::lookup): (WTF::::lookupForWriting): (WTF::::fullLookupForWriting): (WTF::::add): (WTF::::addPassingHashCode): (WTF::::reinsert): (WTF::::find): (WTF::::contains): * kjs/identifier.cpp: (WTF::): * wtf/HashFunctions.h: (WTF::): * wtf/HashMap.h: (WTF::): (WTF::::get): * wtf/HashSet.h: (WTF::): (WTF::::add): * wtf/ListHashSet.h: (WTF::ListHashSetTranslator::translate): 2007-10-27 Darin Adler Reviewed by Eric. - fix ASCIICType.h for some Windows compiles * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the compiler/library that has the wchar_t that is just a typedef. 2007-10-27 Kevin McCullough - BuildFix - Forgot to change the build step when I changed the filename. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2007-10-27 Geoffrey Garen Reviewed by Darin Adler. Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep:: computedHash()" http://bugs.webkit.org/show_bug.cgi?id=15718 * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a hash value. Also changed O(n) strlen to O(1) check for empty string. (KJS::Identifier::add): * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string. (KJS::UString::UString): (KJS::UString::operator=): 2007-10-27 Darin Adler Reviewed by Eric. - fix pow on Windows * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has a "pow" function that does not properly handle the case where arg1 is NaN and arg2 is 0. * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity specify "::pow" -- just "pow" is fine. 2007-10-27 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15711 force JSImmediate to be inlined for roughly 1.2% SunSpider speedup * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything. * kjs/object.h: Removed redundant includes. * kjs/value.h: Ditto. 2007-10-27 Maciej Stachowiak Reviewed by Mark. - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()" http://bugs.webkit.org/show_bug.cgi?id=15718 * kjs/identifier.cpp: (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed, now that we count on all Identifiers already having one. 2007-10-27 Mark Rowe Silence a warning. * kjs/SymbolTable.h: 2007-10-27 Mark Rowe Gtk build fix. * kjs/function.h: 2007-10-26 Kevin McCullough Rubber stamp by Adam. - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the files contain are functions that operate on BSTRs. * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp. * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h. * API/JSStringRefCOM.cpp: Removed. * API/JSStringRefCOM.h: Removed. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2007-10-26 Kevin McCullough Reviewed by Adam. - Made JSStringCreateWithBSTR capable of handling null BSTRs. * API/JSStringRefCOM.cpp: (JSStringCreateWithBSTR): 2007-10-26 Sam Weinig Windows build fix. * kjs/SymbolTable.h: Add header gaurd. * kjs/nodes.h: #include "SymbolTable.h" 2007-10-26 Geoffrey Garen Suggested by Anders Carlsson. Fixed tyop. * kjs/function.cpp: (KJS::ActivationImp::getOwnPropertySlot): 2007-10-26 Geoffrey Garen Suggested by Darin Adler. Use computedHash(), which is safer than just directly accessing _hash. * kjs/lookup.cpp: (KJS::Lookup::findEntry): (KJS::Lookup::find): 2007-10-26 Geoffrey Garen Build fix: svn add SymbolTable.h * kjs/SymbolTable.h: Added. (KJS::SymbolTable::set): (KJS::SymbolTable::get): 2007-10-26 Geoffrey Garen Build fix: export SymbolTable.h to WebCore. * JavaScriptCore.xcodeproj/project.pbxproj: 2007-10-26 Geoffrey Garen Comment tweak suggested by Maciej. * kjs/function.cpp: (KJS::ActivationImp::getOwnPropertySlot): 2007-10-26 Geoffrey Garen Reviewed by Maciej Stachowiak. Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider. * kjs/property_map.cpp: Use a special no branch accessor to the UString's hash value. Also, return immediately instead of branching to the end of the loop if the value is not found. (KJS::PropertyMap::get): (KJS::PropertyMap::getLocation): (KJS::PropertyMap::put): (KJS::PropertyMap::insert): (KJS::PropertyMap::remove): (KJS::PropertyMap::checkConsistency): * kjs/ustring.h: (KJS::UString::Rep::computedHash): Special no branch accessor to the UString's hash value. Used when the caller knows that the hash value has already been computed. (For example, if the caller got the UString from an Identifier.) 2007-10-26 Geoffrey Garen Reviewed by Maciej Stachowiak. Switched ActivationImp to using a symbol table. For now, though, all clients take the slow path. Net .6% speedup on SunSpider. Slowdowns: - ActivationImp now mallocs in its constructor - Local variable hits use an extra level of indirection to retrieve data - Local variable misses do two lookups Speedups: - Fast initialization of local variables upon function entry * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h * kjs/function.cpp: (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold data that won't fit in a JSCell. (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for lookup. (KJS::ActivationImp::getOwnPropertySlot): ditto (KJS::ActivationImp::deleteProperty): ditto (KJS::ActivationImp::put): ditto (KJS::ActivationImp::createArgumentsObject): ditto (KJS::ActivationImp::mark): Call JSObject::mark first so that one of our properties doesn't try to recursively mark us. (This caused a crash in earlier testing. Not sure why we haven't run into it before.) * kjs/nodes.cpp: Functions now build a symbol table the first time they're called. (KJS::VarDeclNode::evaluate): (KJS::FunctionBodyNode::FunctionBodyNode): (KJS::FunctionBodyNode::initializeSymbolTable): (KJS::FunctionBodyNode::processDeclarations): (KJS::FunctionBodyNode::processDeclarationsForFunctionCode): (KJS::FunctionBodyNode::processDeclarationsForProgramCode): * kjs/nodes.h: (KJS::FunctionBodyNode::symbolTable): * wtf/Forward.h: Added Vector. 2007-10-26 Kevin McCullough - Corrected function name mistake in this changelog. 2007-10-26 Kevin McCullough Reviewed by Sam and Steve. - Added convenience methods for converting between BSTR and JSStringRefs * API/JSStringRefCOM.cpp: Added. (JSStringCreateWithBSTR): (JSStringCopyBSTR): * API/JSStringRefCOM.h: Added. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2007-10-26 Mark Rowe Windows build fix. * kjs/collector.cpp: (KJS::Collector::collect): 2007-10-26 Oliver Hunt Reviewed by Maciej. Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider. * kjs/CollectorHeapIntrospector.cpp: (KJS::CollectorHeapIntrospector::init): (KJS::CollectorHeapIntrospector::enumerate): * kjs/CollectorHeapIntrospector.h: * kjs/collector.cpp: (KJS::Collector::recordExtraCost): (KJS::Collector::heapAllocate): (KJS::Collector::allocate): (KJS::Collector::allocateNumber): (KJS::Collector::registerThread): (KJS::Collector::markStackObjectsConservatively): (KJS::Collector::markMainThreadOnlyObjects): (KJS::Collector::sweep): (KJS::Collector::collect): * kjs/collector.h: * kjs/internal.h: (KJS::NumberImp::operator new): Force numbers to be allocated in the secondary heap. 2007-10-26 Maciej Stachowiak Reviewed by Oliver. - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider. * kjs/value.h: (KJS::JSValue::getUInt32): (KJS::JSValue::getTruncatedInt32): (KJS::JSValue::toNumber): * wtf/PassRefPtr.h: (WTF::PassRefPtr::~PassRefPtr): * wtf/RefPtr.h: (WTF::RefPtr::operator->): 2007-10-26 Mark Rowe Gtk build fix. * kjs/ExecState.h: 2007-10-26 Maciej Stachowiak Reviewed by Mark. - Merge Context class fully into ExecState, since they are always created and used together. No measurable performance impact but this is a useful cleanup. * JavaScriptCore.pri: * kjs/ExecState.cpp: (KJS::ExecState::ExecState): (KJS::ExecState::~ExecState): (KJS::ExecState::mark): (KJS::ExecState::lexicalInterpreter): * kjs/ExecState.h: (KJS::ExecState::dynamicInterpreter): (KJS::ExecState::setException): (KJS::ExecState::clearException): (KJS::ExecState::exception): (KJS::ExecState::exceptionSlot): (KJS::ExecState::hadException): (KJS::ExecState::scopeChain): (KJS::ExecState::callingExecState): (KJS::ExecState::propertyNames): * kjs/collector.cpp: (KJS::Collector::reportOutOfMemoryToAllInterpreters): * kjs/function.cpp: (KJS::FunctionImp::callAsFunction): (KJS::FunctionImp::argumentsGetter): (KJS::FunctionImp::callerGetter): (KJS::GlobalFuncImp::callAsFunction): * kjs/interpreter.cpp: (KJS::Interpreter::Interpreter): (KJS::Interpreter::init): (KJS::Interpreter::evaluate): (KJS::Interpreter::mark): * kjs/interpreter.h: (KJS::Interpreter::setCurrentExec): (KJS::Interpreter::currentExec): * kjs/nodes.cpp: (KJS::currentSourceId): (KJS::currentSourceURL): (KJS::ThisNode::evaluate): (KJS::ResolveNode::evaluate): (KJS::FunctionCallResolveNode::evaluate): (KJS::PostfixResolveNode::evaluate): (KJS::DeleteResolveNode::evaluate): (KJS::TypeOfResolveNode::evaluate): (KJS::PrefixResolveNode::evaluate): (KJS::AssignResolveNode::evaluate): (KJS::VarDeclNode::evaluate): (KJS::DoWhileNode::execute): (KJS::WhileNode::execute): (KJS::ForNode::execute): (KJS::ForInNode::execute): (KJS::ContinueNode::execute): (KJS::BreakNode::execute): (KJS::ReturnNode::execute): (KJS::WithNode::execute): (KJS::SwitchNode::execute): (KJS::LabelNode::execute): (KJS::TryNode::execute): (KJS::FunctionBodyNode::processDeclarationsFunctionCode): (KJS::FunctionBodyNode::processDeclarationsProgramCode): (KJS::FunctionBodyNode::processDeclarations): (KJS::FuncDeclNode::makeFunction): (KJS::FuncExprNode::evaluate): 2007-10-26 Mark Rowe Windows build fix. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2007-10-26 Mark Rowe Gtk build fix. * JavaScriptCore.pri: * kjs/ExecState.cpp: 2007-10-26 Maciej Stachowiak Reviewed by Oliver. - moved Context class into ExecState.{h,cpp} in preparation for merging ExecState and Context classes. * kjs/ExecState.h: Moved CodeType enum and Context class here in preparation for merging ExecState and Context. * kjs/ExecState.cpp: Moved Context class here from Context.cpp. (KJS::Context::Context): (KJS::Context::~Context): (KJS::Context::mark): * kjs/context.h: Removed. * kjs/Context.cpp: Removed. * kjs/function.h: Removed CodeType enum. * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h. * kjs/internal.h: Removed LabelStack. * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone. * kjs/collector.cpp: Fixed includes. * kjs/function.cpp: ditto * kjs/internal.cpp: ditto * kjs/interpreter.cpp: ditto * kjs/lookup.h: ditto * kjs/nodes.cpp: ditto 2007-10-26 Mark Rowe Windows build fix. * kjs/string_object.cpp: (KJS::StringObjectFuncImp::callAsFunction): 2007-10-25 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15703 fix numeric functions -- improve correctness and speed Gives about 1% gain on SunSpider. * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16. (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works with both immediate and number values. (KJS::JSValue::toUInt32): Ditto. * kjs/value.cpp: (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple differences. One is that it now correctly returns 0 for NaN, and another is that there's no special case for 0 or infinity, since the general case already handles those correctly. (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the check for NaN. (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The truncation done by the typecast already does the necessary truncation that roundValue was doing. (KJS::JSValue::toUInt32SlowCase): Ditto. (KJS::JSValue::toUInt16): Removed. * kjs/internal.h: Removed roundValue. * kjs/internal.cpp: Ditto. * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded code to handle NaN in Array.slice; toInteger now never returns NaN as specified. * kjs/date_object.cpp: (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to toNumber as specified. (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue with a call to toNumber and timeClip as specified. (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases where the default behavior of toInt32 (returning 0) was already correct. Replaced call to roundValue with a call to toNumber as specified. (KJS::DateObjectFuncImp::callAsFunction): Ditto. * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special cases for the pow function that the library already handles correctly. * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to call toIntegerPreserveNaN, so we can continue to handle the NaN case differently. The real toInteger now returns 0 for NaN. Took out unneeded special case in ToFixed for undefined; was only needed because our toInteger was wrong. Same thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN. * kjs/string_object.cpp: (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special cases for undefined that were only needed because toInteger was wrong. Same in IndexOf, and was able to remove some special cases. In LastIndexOf, used toIntegerPreserveNaN, but was able to remove some special cases there too. Changed Substr implementation to preserve correct behavior with the change to toInteger and match the specification. Also made sure we weren't converting an out of range double to an int. (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's no reason to have toUInt16 as a second, less-optimized function that's only called at this one call site. * wtf/MathExtras.h: Added trunc function for Windows. 2007-10-25 Geoffrey Garen Reviewed by Maciej Stachowiak. Tweaked the inner hashtable lookup loop to remove a branch in the "not found" case. .5% speedup on SunSpider. * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/HashTable.h: (WTF::::lookup): 2007-10-25 Maciej Stachowiak Reviewed by Oliver. - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider * kjs/nodes.cpp: (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not adding any value over toNumber() here. (KJS::valueForReadModifyAssignment): Ditto. (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls and branches. (KJS::lessThanEq): Ditto. * JavaScriptCore.exp: Export new functions as needed. * kjs/value.h: (KJS::JSValue::toPrimitive): Fixed formatting. (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts to number and tells you whether a toPrimitive() conversion with a Number hint would have given a string. * kjs/internal.cpp: (KJS::StringImp::getPrimitiveNumber): Implemented. (KJS::NumberImp::getPrimitiveNumber): ditto (KJS::GetterSetterImp::getPrimitiveNumber): ditto (KJS::StringImp::toPrimitive): Fixed formatting. (KJS::NumberImp::toPrimitive): ditto (KJS::GetterSetterImp::toPrimitive): ditto * kjs/internal.h: * kjs/object.cpp: (KJS::JSObject::getPrimitiveNumber): Implemented. * kjs/object.h: 2007-10-25 Sam Weinig Reviewed by Adam Roben. Remove JSStringRefCFHack from windows as it is no longer needed. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: 2007-10-25 Geoffrey Garen Reviewed by Oliver Hunt. Rolled out my last patch. It turns out that I needed 2 words, not 1, so it didn't help. 2007-10-25 Geoffrey Garen Reviewed by Oliver Hunt. Fixed http://bugs.webkit.org/show_bug.cgi?id=15694 Shrink the size of an activation object by 1 word This is in preparation for adding a symbol table to the activation object. The basic strategy here is to rely on the mutual exclusion between the arguments object pointer and the function pointer (you only need the latter in order to create the former), and store them in the same place. The LazyArgumentsObject class encapsulates this strategy. Also inlined the ArgumentsImp constructor, for good measure. SunSpider reports no regression. Regression tests pass. * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/Context.cpp: (KJS::Context::~Context): * kjs/function.cpp: (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject): (KJS::ActivationImp::LazyArgumentsObject::mark): (KJS::): (KJS::ActivationImp::argumentsGetter): (KJS::ActivationImp::mark): * kjs/function.h: (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject): (KJS::ActivationImp::LazyArgumentsObject::getOrCreate): (KJS::ActivationImp::LazyArgumentsObject::resetArguments): (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject): (KJS::ActivationImp::LazyArgumentsObject::argumentsObject): (KJS::ActivationImp::LazyArgumentsObject::setFunction): (KJS::ActivationImp::LazyArgumentsObject::function): (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject): (KJS::ActivationImp::LazyArgumentsObject::): (KJS::ActivationImp::ActivationImp::ActivationImp): (KJS::ActivationImp::resetArguments): 2007-10-25 Adam Roben Change JavaScriptCore.vcproj to use DerivedSources.make We were trying to emulate the logic of make in build-generated-files.sh, but we got it wrong. We now use a build-generated-files very much like the one that WebCore uses to invoke make. We also now only have a Debug configuration of dftables which we build even when doing a Release build of JavaScriptCore. dftables also no longer has the "_debug" name suffix. Changes mostly made by Darin, reviewed by me. * DerivedSources.make: Add a variable to set the extension used for the dftables executable. * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug dftables in Release configurations. * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: - Updated include path to point to the new location of the derived sources. - Modified pre-build event to pass the right arguments to build-generated-files.sh and not call dftables directly. - Added the derived source files to the project. - Removed grammarWrapper.cpp, which isn't needed now that we're compiling grammar.cpp directly. * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh: Slightly modified from the WebCore version. * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed. * JavaScriptCore.vcproj/dftables/dftables.vcproj: - Changed the output location to match Mac. - Removed the Release configuration. - Removed the _debug suffix. 2007-10-25 Geoffrey Garen Reviewed by Eric Seidel. Slightly elaborated the differences between declaration procesing in Function Code and Program Code. .3% speedup on SunSpider. * kjs/nodes.cpp: (KJS::FunctionBodyNode::processDeclarationsFunctionCode): (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a minimum set of attributes instead of recomputing all the time. Also, ignore m_parameters, since programs don't have arguments. 2007-10-25 Eric Seidel Reviewed by Maciej. More preparation work before adding long-running mode to testkjs. * kjs/testkjs.cpp: (TestFunctionImp::callAsFunction): (prettyPrintScript): (runWithScripts): (parseArguments): (kjsmain): (fillBufferWithContentsOfFile): 2007-10-25 Eric Seidel Reviewed by Maciej. Bring testkjs code out of the dark ages in preparation for more radical improvements (like long-running testing support!) * kjs/testkjs.cpp: (TestFunctionImp::callAsFunction): (setupInterpreter): (doIt): (fillBufferWithContentsOfFile): 2007-10-25 Geoffrey Garen Reviewed by Maciej Stachowiak. Make a fast path for declaration processing inside Function Code. Lifted declaration processing code up from individual declaration nodes and into processDeclarations. Broke out processDeclarations into two cases, depending on the type of code. This eliminates 2 branches, and facilitates more radical divergeance in the future. 2.5% SunSpider speedup. * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/nodes.cpp: (KJS::FunctionBodyNode::initializeDeclarationStacks): (KJS::FunctionBodyNode::processDeclarationsFunctionCode): (KJS::FunctionBodyNode::processDeclarationsProgramCode): (KJS::FunctionBodyNode::execute): (KJS::FuncDeclNode::makeFunction): * kjs/nodes.h: (KJS::): 2007-10-25 Maciej Stachowiak Reviewed by Adam. - add header includes needed on platforms that don't use AllInOneFile.cpp * API/JSCallbackObject.cpp: * kjs/Context.cpp: * kjs/ExecState.cpp: * kjs/array_instance.cpp: * kjs/function_object.cpp: * kjs/interpreter.cpp: * kjs/nodes.cpp: 2007-10-25 Eric Seidel Reviewed by Geoff. * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private 2007-10-25 Geoffrey Garen Reviewed by Maciej Stachowiak. Fixed http://bugs.webkit.org/show_bug.cgi?id=15683 Re-order declaration initialization to avoid calling hasProperty inside VarDeclNode::processDeclaration .7% speedup on SunSpider. * kjs/function.h: * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's other processing of declared symbols, so the order of execution could change. * kjs/nodes.cpp: (KJS::VarDeclNode::getDeclarations): Added special case for the "arguments" property name, explained in the comment. (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty in the case of function code, since we know the declared symbol management will resolve conflicts between symbols. Yay! (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's implementation of getDeclarations is non-trivial, we can't take a short-cut here any longer -- we need to put the VarDecl node on the stack so it gets processed normally. (KJS::FunctionBodyNode::processDeclarations): Changed the order of processing to enforce mutual exclusion rules. * kjs/nodes.h: (KJS::DeclarationStacks::DeclarationStacks): Structure includes an ExecState now, for fast access to the "arguments" property name. 2007-10-24 Eric Seidel Reviewed by Maciej. Add a JSGlobalObject class and remove the InterpreterMap http://bugs.webkit.org/show_bug.cgi?id=15681 This required making JSCallbackObject a template class to allow for JSGlobalObjects with JSCallbackObject functionality. SunSpider claims this was a 0.5% speedup. * API/JSCallbackObject.cpp: (KJS::): * API/JSCallbackObject.h: * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp. (KJS::::JSCallbackObject): (KJS::::init): (KJS::::~JSCallbackObject): (KJS::::initializeIfNeeded): (KJS::::className): (KJS::::getOwnPropertySlot): (KJS::::put): (KJS::::deleteProperty): (KJS::::implementsConstruct): (KJS::::construct): (KJS::::implementsHasInstance): (KJS::::hasInstance): (KJS::::implementsCall): (KJS::::callAsFunction): (KJS::::getPropertyNames): (KJS::::toNumber): (KJS::::toString): (KJS::::setPrivate): (KJS::::getPrivate): (KJS::::inherits): (KJS::::cachedValueGetter): (KJS::::staticValueGetter): (KJS::::staticFunctionGetter): (KJS::::callbackGetter): * API/JSClassRef.cpp: (OpaqueJSClass::prototype): * API/JSContextRef.cpp: (JSGlobalContextCreate): * API/JSObjectRef.cpp: (JSObjectMake): (JSObjectGetPrivate): (JSObjectSetPrivate): * API/JSValueRef.cpp: (JSValueIsObjectOfClass): * JavaScriptCore.exp: * JavaScriptCore.xcodeproj/project.pbxproj: * bindings/c/c_utility.cpp: (KJS::Bindings::convertValueToNPVariant): * bindings/jni/jni_jsobject.cpp: * bindings/objc/objc_utility.mm: (KJS::Bindings::convertValueToObjcValue): * kjs/Context.cpp: (KJS::Context::Context): * kjs/ExecState.cpp: (KJS::ExecState::lexicalInterpreter): * kjs/JSGlobalObject.h: Added. (KJS::JSGlobalObject::JSGlobalObject): (KJS::JSGlobalObject::isGlobalObject): (KJS::JSGlobalObject::interpreter): (KJS::JSGlobalObject::setInterpreter): * kjs/array_instance.cpp: * kjs/context.h: * kjs/function.cpp: (KJS::FunctionImp::callAsFunction): (KJS::GlobalFuncImp::callAsFunction): * kjs/interpreter.cpp: (KJS::Interpreter::Interpreter): (KJS::Interpreter::init): (KJS::Interpreter::~Interpreter): (KJS::Interpreter::globalObject): (KJS::Interpreter::initGlobalObject): (KJS::Interpreter::evaluate): * kjs/interpreter.h: * kjs/lookup.h: (KJS::cacheGlobalObject): * kjs/object.h: (KJS::JSObject::isGlobalObject): * kjs/testkjs.cpp: 2007-10-24 Eric Seidel Build fix for Gtk, no review. * kjs/collector.cpp: #include "context.h" 2007-10-24 Eric Seidel Reviewed by Maciej. Stop checking isOutOfMemory after every allocation, instead let the collector notify all ExecStates if we ever hit this rare condition. SunSpider claims this was a 2.2% speedup. * kjs/collector.cpp: (KJS::Collector::collect): (KJS::Collector::reportOutOfMemoryToAllInterpreters): * kjs/collector.h: * kjs/nodes.cpp: (KJS::TryNode::execute): 2007-10-24 Mark Rowe Gtk build fix. * kjs/identifier.h: Remove extra qualification. 2007-10-24 Geoffrey Garen Reviewed by Sam Weinig. Disable ALWAYS_INLINE in debug builds, since it drives the debugger crazy. * wtf/AlwaysInline.h: 2007-10-24 Geoffrey Garen Reviewed by Sam Weinig. Inlined the fast path for creating an Identifier from an Identifier. This is a .4% speedup on SunSpider overall, but as big as a 2.5% speedup on certain individual tests. 65% of the Identifiers creating by SunSpider are already Identifiers. (The main reason I'm making this change is that it resolves a large regression in a patch I haven't checked in yet.) * JavaScriptCore.exp: * kjs/identifier.cpp: (KJS::Identifier::addSlowCase): * kjs/identifier.h: (KJS::Identifier::Identifier::add): 2007-10-24 Lars Knoll Reviewed by Simon. some changes to the way JS values are converted to Qt values in the script bindings. Added support for converting JS arrays into QStringList's. * bindings/qt/qt_instance.cpp: (KJS::Bindings::QtInstance::invokeMethod): * bindings/qt/qt_runtime.cpp: (KJS::Bindings::convertValueToQVariant): (KJS::Bindings::QtField::setValueToInstance): 2007-10-24 Oliver Hunt Reviewed by Darin. Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider * kjs/nodes.cpp: (KJS::lessThan): (KJS::lessThanEq): (KJS::LessNode::evaluate): (KJS::GreaterNode::evaluate): (KJS::LessEqNode::evaluate): (KJS::GreaterEqNode::evaluate): * kjs/operations.cpp: * kjs/operations.h: 2007-10-24 Eric Seidel Reviewed by darin. * kjs/nodes.h: (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!) 2007-10-24 Darin Adler Reviewed by Eric. * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little Identifier ref/deref for what SunSpider claims is a 0.4% speedup. 2007-10-24 Darin Adler Reviewed by Maciej. - separate out the code to create a hash table the first time from the code to rehash SunSpider claims this was a 0.7% speedup. * kjs/property_map.cpp: (KJS::PropertyMap::expand): Changed to call either createTable or rehash. (KJS::PropertyMap::createTable): Added. For the case where we had no table. (KJS::PropertyMap::rehash): Removed code needed only in the case where we had no table. * kjs/property_map.h: Added createTable. 2007-10-24 Eric Seidel Reviewed by darin. Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers which can be represented by JSImmediate. SunSpider claims this was a 0.6% speedup. * kjs/grammar.y: * kjs/nodes.cpp: (KJS::NumberNode::evaluate): (KJS::ImmediateNumberNode::evaluate): * kjs/nodes.h: (KJS::Node::): (KJS::ImmediateNumberNode::): * kjs/nodes2string.cpp: (ImmediateNumberNode::streamTo): 2007-10-24 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15657 change static hash tables to use powers of two for speed Seems to give 0.7% SunSpider speedup. * kjs/create_hash_table: Updated to generate new format. * kjs/lookup.cpp: (KJS::keysMatch): Took out unneeded typecast. (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert. Replaced the modulus with a bit mask. (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed their hash -- saves a branch. (KJS::Lookup::find): Ditto. * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask. 2007-10-24 Maciej Stachowiak Reviewed by Darin. - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup * kjs/nodes.cpp: (KJS::DoWhileNode::execute): (KJS::WhileNode::execute): (KJS::ForNode::execute): (KJS::ForInNode::execute): (KJS::SourceElementsNode::execute): 2007-10-23 Darin Adler Reviewed by Maciej. * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32): Changed an && to an & for a 1% gain in SunSpider. 2007-10-23 Oliver Hunt Reviewed by Maciej. Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider. * kjs/nodes.cpp: (KJS::MultNode::evaluate): (KJS::DivNode::evaluate): (KJS::ModNode::evaluate): (KJS::add): (KJS::sub): (KJS::AddNode::evaluate): (KJS::SubNode::evaluate): (KJS::valueForReadModifyAssignment): * kjs/operations.cpp: * kjs/operations.h: 2007-10-23 Oliver Hunt Reviewed by Maciej. Separating all of the simple (eg. non-read-modify-write) binary operators into separate classes in preparation for further JS optimisations. Happily this produces a 0.8% to 1.0% performance increase in SunSpider with no further work. * JavaScriptCore.xcodeproj/project.pbxproj: * kjs/grammar.y: * kjs/nodes.cpp: (KJS::MultNode::evaluate): (KJS::DivNode::evaluate): (KJS::ModNode::evaluate): (KJS::AddNode::evaluate): (KJS::SubNode::evaluate): (KJS::LeftShiftNode::evaluate): (KJS::RightShiftNode::evaluate): (KJS::UnsignedRightShiftNode::evaluate): (KJS::LessNode::evaluate): (KJS::GreaterNode::evaluate): (KJS::LessEqNode::evaluate): (KJS::GreaterEqNode::evaluate): (KJS::InstanceOfNode::evaluate): (KJS::InNode::evaluate): (KJS::EqualNode::evaluate): (KJS::NotEqualNode::evaluate): (KJS::StrictEqualNode::evaluate): (KJS::NotStrictEqualNode::evaluate): (KJS::BitAndNode::evaluate): (KJS::BitXOrNode::evaluate): (KJS::BitOrNode::evaluate): (KJS::LogicalAndNode::evaluate): (KJS::LogicalOrNode::evaluate): * kjs/nodes.h: (KJS::MultNode::): (KJS::DivNode::): (KJS::ModNode::): (KJS::AddNode::): (KJS::SubNode::): (KJS::LeftShiftNode::): (KJS::RightShiftNode::): (KJS::UnsignedRightShiftNode::): (KJS::LessNode::): (KJS::GreaterNode::): (KJS::LessEqNode::): (KJS::GreaterEqNode::): (KJS::InstanceOfNode::): (KJS::InNode::): (KJS::EqualNode::): (KJS::NotEqualNode::): (KJS::StrictEqualNode::): (KJS::NotStrictEqualNode::): (KJS::BitAndNode::): (KJS::BitOrNode::): (KJS::BitXOrNode::): (KJS::LogicalAndNode::): (KJS::LogicalOrNode::): * kjs/nodes2string.cpp: (MultNode::streamTo): (DivNode::streamTo): (ModNode::streamTo): (AddNode::streamTo): (SubNode::streamTo): (LeftShiftNode::streamTo): (RightShiftNode::streamTo): (UnsignedRightShiftNode::streamTo): (LessNode::streamTo): (GreaterNode::streamTo): (LessEqNode::streamTo): (GreaterEqNode::streamTo): (InstanceOfNode::streamTo): (InNode::streamTo): (EqualNode::streamTo): (NotEqualNode::streamTo): (StrictEqualNode::streamTo): (NotStrictEqualNode::streamTo): (BitAndNode::streamTo): (BitXOrNode::streamTo): (BitOrNode::streamTo): (LogicalAndNode::streamTo): 2007-10-23 Darin Adler Reviewed by Maciej. - fix http://bugs.webkit.org/show_bug.cgi?id=15639 fix Math.abs(0), Math.ceil(-0), and Math.floor(-0) Test: fast/js/math.html * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Fix abs to look at the sign bit. Add a special case for values in the range between -0 and -1 and a special case for ceil and for -0 for floor. 2007-10-23 Darin Adler Reviewed by Eric. - streamline exception handling code for a >1% speed-up of SunSpider * kjs/nodes.cpp: Changed macros to use functions for everything that's not part of normal execution. We'll take function call overhead when propagating an exception or out of memory. (KJS::createOutOfMemoryCompletion): Added. (KJS::substitute): Use append instead of the relatively inefficient + operator. (KJS::Node::rethrowException): Added. * kjs/nodes.h: Added rethrowException. 2007-10-22 Darin Adler Reviewed by Maciej. - fix http://bugs.webkit.org/show_bug.cgi?id=15636 some JavaScriptCore regression tests are failing due to numeric conversion This should restore correctness and make speed better too, restoring some of the optimization we lost in my last check-in. * kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom I used in my patch yesterday. (KJS::JSImmediate::getTruncatedUInt32): Ditto. * kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32. * kjs/internal.cpp: (KJS::NumberImp::getUInt32): Changed to always use double, since I can't find a way to write this more efficiently for float. (KJS::NumberImp::getTruncatedInt32): Added. (KJS::NumberImp::getTruncatedUInt32): Added. * kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32. (KJS::JSValue::getUInt32): (KJS::JSValue::getTruncatedInt32): Added. (KJS::JSValue::getTruncatedUInt32): Added. (KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32. (KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32. * kjs/value.cpp: (KJS::JSCell::getTruncatedInt32): Added. (KJS::JSCell::getTruncatedUInt32): Added. (KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32. (KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally had left in here. (KJS::JSValue::toUInt32SlowCase): Ditto. (KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32. * JavaScriptCore.exp: Updated. 2007-10-22 Darin Adler Reviewed by Geoff. - fix http://bugs.webkit.org/show_bug.cgi?id=15632 js1_5/Array/array-001.js test failing One of the JavaScriptCore tests was failing; it failed because of my change to NumberImp::getUInt32. The incorrect code I copied was from JSImmediate::getUInt32, and was a pre-existing bug. This patch fixes correctness, but will surely slow down SunSpider. We may be able to code this tighter and get the speed back. * kjs/JSImmediate.h: (KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately reflect the fact that this function only returns true if the value is accurate (no fractional part, etc.). Changed code so that it returns false when the value has a fraction. (KJS::JSImmediate::getUInt32): Ditto. * kjs/internal.cpp: (KJS::NumberImp::getInt32): Changed code so that it returns false when the value has a fraction. Restores the old behavior. (KJS::NumberImp::getUInt32): Ditto. * kjs/value.h: (KJS::JSValue::getInt32): Updated for name change. (KJS::JSValue::getUInt32): Ditto. (KJS::JSValue::toInt32): Ditto. (KJS::JSValue::toUInt32): Ditto. 2007-10-22 Darin Adler Reviewed by Brady. - fix crash seen when running JavaScriptCore tests * kjs/array_instance.cpp: (KJS::ArrayInstance::mark): Copy and paste error: I accidentally had code here that was making a copy of the HashMap -- that's illegal inside a mark function and was unnecessary. The other callsite was modifying the map as it iterated it, but this function is not. 2007-10-22 Maciej Stachowiak Reviewed by Oliver. - Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider http://bugs.webkit.org/show_bug.cgi?id=15627 * kjs/JSImmediate.h: (KJS::JSImmediate::fromDouble): Avoid moving floats to integer registers since this is very slow. 2007-10-22 Darin Adler Reviewed by Eric Seidel. - http://bugs.webkit.org/show_bug.cgi?id=15617 improve speed of integer conversions Makes SunSpider 6% faster. * kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for 32-bit and 64-bit. * kjs/value.h: (KJS::JSValue::getUInt32): Call JSImmediate::toUInt32. * kjs/internal.h: Added getInt32. * kjs/internal.cpp: (KJS::NumberImp::getInt32): Added. (KJS::NumberImp::getUInt32): Replaced with more-optimal implementation stolen from JSValue. * kjs/value.h: (KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting inlined. (KJS::JSValue::getInt32): Added. (KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32 to avoid converting from float to double. (KJS::JSValue::toInt32): Made inline, separated out the slow case. (KJS::JSValue::toUInt32): Ditto. * kjs/value.cpp: (KJS::JSCell::getInt32): Added. (KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the new getInt32. Added a faster case for in-range numbers. (KJS::JSValue::toUInt32SlowCase): Ditto. (KJS::JSValue::toUInt16): Added a faster case for in-range numbers. * JavaScriptCore.exp: Updated for changes. 2007-10-22 Adam Roben Windows build fix * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off warning about implicit conversion to bool. 2007-10-22 Mark Rowe Gtk build fix. * kjs/array_instance.cpp: 2007-10-22 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15606 make cut-off for sparse vs. dense arrays smarter for speed with large arrays Makes the morph test in SunSpider 26% faster, and the overall benchmark 3% faster. This also fixes some small problems we had with the distinction between nonexistent and undefined values in arrays. * kjs/array_instance.h: Tweaked formatting and naming. * kjs/array_instance.cpp: Copied from kjs/array_object.cpp. (KJS::storageSize): Added. Computes the size of the storage given a vector length. (KJS::increasedVectorLength): Added. Implements the rule for resizing the vector. (KJS::isDenseEnoughForVector): Added. (KJS::ArrayInstance::ArrayInstance): Initialize the new fields. (KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it. (KJS::ArrayInstance::getItem): Updated for name changes. (KJS::ArrayInstance::lengthGetter): Ditto. (KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of getOwnPropertySlot to share more code. (KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change. (KJS::ArrayInstance::put): Added logic for extending the vector as long as the array is dense enough. Also keep m_numValuesInVector up to date. (KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector up to date. (KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names for array indices with undefined values. (KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also simplified to only handle getting larger. (KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to zero out the unused part of the vector and to delete the map if it's no longer needed. (KJS::ArrayInstance::mark): Tweaked formatting. (KJS::compareByStringForQSort): Ditto. (KJS::ArrayInstance::sort): Ditto. (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments): Ditto. (KJS::compareWithCompareFunctionForQSort): Ditto. (KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn undefined values into nonexistent values in some cases. * kjs/array_object.h: Removed MAX_ARRAY_INDEX. * kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file. * JavaScriptCore.pri: Added array_instance.cpp. * JavaScriptCore.xcodeproj/project.pbxproj: Ditto. * kjs/AllInOneFile.cpp: Ditto. 2007-10-22 Andrew Wellington Reviewed by Mark Rowe. Fix for local database support after r26879 Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set * Configurations/JavaScriptCore.xcconfig: 2007-10-22 Simon Hausmann Reviewed by Alp. Build fix for the non-qmake builds. * wtf/Platform.h: Default to enabling the database features unless otherwise specified. (similar to ENABLE_ICONDATABASE) 2007-10-22 Holger Freyther Reviewed by Simon Hausmann . * Do not build testkjs as an application bundle. This is needed for run-javascriptcore-tests on OSX. * Also, based on r26633, allow to test the WebKit/Qt port on OSX. * Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set as we do not have -rpath on OSX. * kjs/testkjs.pro: 2007-10-21 Mark Rowe Reviewed by Alp. http://bugs.webkit.org/show_bug.cgi?id=15575 Bug 15575: [GTK] Implement threading using GThread * wtf/Platform.h: Do not enable pthreads for Gtk. 2007-10-21 Mark Rowe Reviewed by Mitz. Fix http://bugs.webkit.org/show_bug.cgi?id=15603 Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript * kjs/array_object.cpp: (KJS::freeStorage): Reinstate null-check that was removed in r26847. 2007-10-21 Darin Adler - fix Windows build * kjs/array_instance.h: Removed unused ExecState parameter. * kjs/array_object.cpp: (KJS::ArrayInstance::put): Ditto. (KJS::ArrayInstance::setLength): Ditto. 2007-10-21 Darin Adler * kjs/array_object.cpp: (KJS::ArrayInstance::put): Add missing assignment that was causing regression test crash. 2007-10-21 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15585 speed up sparse arrays by using a custom map Speeds up SunSpider by 10%. * kjs/array_object.cpp: (allocateStorage): Leave room for an additional pointer. (reallocateStorage): Ditto. (freeStorage): Ditto. (ArrayInstance::~ArrayInstance): Delete the overflow map if present. (ArrayInstance::getItem): Read values from the overflow map if present. Removed the check of length, since it slows down the common case. (ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback to the property map. (ArrayInstance::put): Write values into the overflow map as needed. Also create overflow map when needed. (ArrayInstance::deleteProperty): Remove values from the overflow map as appropriate. (ArrayInstance::getPropertyNames): Add a name for each identifier in the property map. This is extremely inefficient. (ArrayInstance::setLength): Remove any values in the overflow map that are past the new length, as we formerly did with the property map. (ArrayInstance::mark): Mark any values in the overflow map. (compareByStringForQSort): Removed unneeded undefined case, since compactForSorting guarantees we will have no undefined values. (compareWithCompareFunctionForQSort): Ditto. (ArrayInstance::compactForSorting): Copy all the values out of the overflow map and destroy it. * kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames. * kjs/property_map.cpp: Ditto. 2007-10-20 Darin Adler Reviewed by Maciej. - http://bugs.webkit.org/show_bug.cgi?id=15579 stop churning identifier reference counts copying Completion objects * kjs/completion.h: Replace the Identifier with an Identifier*. * kjs/nodes.cpp: (ForInNode::execute): Update for change to Completion constructor. (ContinueNode::execute): Ditto. (BreakNode::execute): Ditto. 2007-10-20 Mark Rowe Reviewed by Alp. Gtk changes needed to enable HTML 5 client-side database storage. * wtf/Platform.h: Have Gtk use pthreads for now. 2007-10-20 Geoffrey Garen Reviewed by Maciej Stachowiak. Fixed http://bugs.webkit.org/show_bug.cgi?id=15570 Store gathered declaration nodes in the function body node. This means that you only have to gather the declaration nodes the first time the function executes. Performance gain of 2.10% on SunSpider, 0.90% on command-line JS iBench. * kjs/nodes.cpp: Split declaration stack initialization code off into initializeDeclarationStacks(). (FunctionBodyNode::FunctionBodyNode): (FunctionBodyNode::initializeDeclarationStacks): (FunctionBodyNode::processDeclarations): * kjs/nodes.h: Changed DeclarationStacks structure to hold references, since the actual Vectors are now stored either on the stack or in the function body node. 2007-10-19 Geoffrey Garen Reviewed by Darin Adler. http://bugs.webkit.org/show_bug.cgi?id=15559 Moved processDeclarations call into FunctionBodyNode::execute To improve encapsulation, moved processDeclarations call into FunctionBodyNode::execute. Also marked processDeclarations ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup on command-line JS iBench. * kjs/function.cpp: (KJS::FunctionImp::callAsFunction): (KJS::GlobalFuncImp::callAsFunction): * kjs/function.h: * kjs/interpreter.cpp: (KJS::Interpreter::evaluate): * kjs/nodes.cpp: (FunctionBodyNode::execute): * kjs/nodes.h: 2007-10-19 Brady Eidson Reviewed by Sam Queue -> Deque! and small style tweaks * JavaScriptCore.vcproj/WTF/WTF.vcproj: * JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj * wtf/Deque.h: Added. (WTF::DequeNode::DequeNode): (WTF::Deque::Deque): (WTF::Deque::~Deque): (WTF::Deque::size): (WTF::Deque::isEmpty): (WTF::Deque::append): (WTF::Deque::prepend): (WTF::Deque::first): (WTF::Deque::last): (WTF::Deque::removeFirst): (WTF::Deque::clear): * wtf/Queue.h: Removed. 2007-10-19 Brady Eidson Reviewed by Oliver Added a simple LinkedList based Queue to wtf We can make a better, more sophisticated an efficient one later, but have needed one for some time, now! * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/Queue.h: Added. (WTF::QueueNode::QueueNode): (WTF::Queue::Queue): (WTF::Queue::~Queue): (WTF::Queue::size): (WTF::Queue::isEmpty): (WTF::Queue::append): (WTF::Queue::prepend): (WTF::Queue::first): (WTF::Queue::last): (WTF::Queue::removeFirst): (WTF::Queue::clear): 2007-10-19 Nikolas Zimmermann Reviewed by Anders. Try to fix Qt/Win build slave, by including windows.h also on Qt/Win. * kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS) 2007-10-19 Simon Hausmann Reviewed by Lars. Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-). Don't provide the wchar_t overloads then as they conflict with the unsigned short ones. * wtf/ASCIICType.h: (WTF::isASCIIAlpha): (WTF::isASCIIAlphanumeric): (WTF::isASCIIDigit): (WTF::isASCIIHexDigit): (WTF::isASCIILower): (WTF::isASCIISpace): (WTF::toASCIILower): (WTF::toASCIIUpper): 2007-10-19 Simon Hausmann Reviewed by Lars. Another build fix for the windows/qt build: Apply the same fix as in revision 26686 also to kjs/config.h to disable the disallowctype feature. * kjs/config.h: 2007-10-18 Maciej Stachowiak Reviewed by Adam. - use __declspec(thread) for fast thread-local storage on Windows - 2.2% speedup on sunspider (on Windows) - 7% speedup on the string section - 6% speedup on JS iBench - fixed PLT on Windows got 2.5% slower between r25406 and r25422 - fixed at least some of Reviewed by Mark Rowe. - fix http://bugs.webkit.org/show_bug.cgi?id=15543 REGRESSION (r26697): GoogleDocs: Can't create new documents or open existing ones Test: fast/js/regexp-non-character.html * pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters in the \u sequences -- not needed and actively harmful. 2007-10-17 Anders Carlsson Reviewed by Oliver. * wtf/Platform.h: #define USE_PTHREADS on Mac. 2007-10-17 Geoffrey Garen Reviewed by Darin Adler. Merged DeclaredFunctionImp into FunctionImp (the base class) because the distinction between the two was unused. Removed codeType() from FunctionImp because FunctionImp and its subclasses all returned FunctionCode, so it was unused, practically speaking. Removed a different codeType() from GlobalFuncImp because it was unused. (Perhaps it was vestigial from a time when GlobalFuncImp used to inherit from FunctionImp.) * bindings/runtime_method.cpp: * bindings/runtime_method.h: * kjs/function.cpp: (KJS::): (KJS::FunctionImp::FunctionImp): (KJS::FunctionImp::callAsFunction): (KJS::FunctionImp::construct): (KJS::FunctionImp::execute): (KJS::FunctionImp::processVarDecls): * kjs/function.h: (KJS::FunctionImp::implementsConstruct): (KJS::FunctionImp::scope): * kjs/function_object.cpp: (FunctionProtoFunc::callAsFunction): (FunctionObjectImp::construct): * kjs/nodes.cpp: (FuncDeclNode::processFuncDecl): (FuncExprNode::evaluate): 2007-10-17 Adam Roben Windows build fix part 2. Fix was by Darin, reviewed by Anders and Adam. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add FastMallocPCRE.cpp to the project, and let Visual Studio have its way with the post-build step. * pcre/pcre.h: Don't DLL export the entry points just because this is Win32 -- this is an internal copy of PCRE and should be private. * pcre/pcre_compile.c: Fix an uninitialized variable warning -- there's no real problem but it's better to quiet the compiler by tweaking the code slightly than turn off the warning entirely. 2007-10-17 Adam Roben Windows build fix. Reviewed by Anders. * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable some mismatched signed/unsigned comparison warnings. * pcre/pcre_exec.c: (match): #if-out some labels that don't seem to exist. 2007-10-17 Mark Rowe Gtk build fix. * JavaScriptCore.pri: Add FastMallocPCRE.cpp. * pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which is currently unavailable for UTF-16. 2007-10-16 Darin Adler Reviewed by Geoff. - merged PCRE changes between 6.4 and 6.5 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c, pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c, pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c. * pcre/AUTHORS: * pcre/LICENCE: * pcre/MERGING: * pcre/dftables.c: * pcre/pcre-config.h: * pcre/pcre.h: * pcre/pcre.pri: * pcre/pcre_compile.c: * pcre/pcre_exec.c: * pcre/pcre_fullinfo.c: * pcre/pcre_get.c: * pcre/pcre_internal.h: * pcre/pcre_maketables.c: * pcre/pcre_ord2utf8.c: * pcre/pcre_tables.c: * pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c. * pcre/pcre_xclass.c: * pcre/ucp.h: * pcre/ucpinternal.h: * pcre/ucptable.c: Updated with new versions from the PCRE 6.5 release, merged with changes. * pcre/pcre_config.c: Removed. * pcre/pcre_globals.c: Removed. * pcre/pcre_info.c: Removed. * pcre/pcre_printint.src: Removed. * pcre/pcre_refcount.c: Removed. * pcre/pcre_study.c: Removed. * pcre/pcre_try_flipped.c: Removed. * pcre/pcre_ucp_findchar.c: Removed. * pcre/pcre_version.c: Removed. 2007-10-16 Geoffrey Garen Reviewed by Darin Adler. Removed KJS_VERBOSE because it was getting in the way of readability, and the messages didn't seem very helpful. * kjs/function.cpp: (KJS::FunctionImp::callAsFunction): (KJS::FunctionImp::passInParameters): * kjs/lookup.h: (KJS::lookupPut): * kjs/object.cpp: (KJS::JSObject::put): * kjs/value.h: 2007-10-16 Geoffrey Garen Reviewed by Darin Adler. Removed the Parameter class because it was a redundant wrapper around Identifier. * kjs/function.cpp: (KJS::FunctionImp::passInParameters): (KJS::FunctionImp::getParameterName): * kjs/nodes.cpp: (FunctionBodyNode::addParam): * kjs/nodes.h: (KJS::FunctionBodyNode::): 2007-10-16 Geoffrey Garen Reviewed by Darin Adler. Global replace of assert with ASSERT. 2007-10-16 Adam Roben Make testkjs not delay-load WebKit Soon, delay-loading WebKit will be impossible (because we will be using __declspec(thread) for thread-local storage). This change prepares testkjs for the future. Reviewed by Sam. * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer, added FindSafari. * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against WebKitInitializer, don't delay-load WebKit. * kjs/testkjs.cpp: Don't use WebKitInitializer. 2007-10-16 Adam Roben Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration Reviewed by Kevin McCullough. * JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix. * JavaScriptCore.vcproj/debug_internal.vsprops: Ditto. * JavaScriptCore.vcproj/release.vsprops: Ditto. * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo in the name of icuuc36[_debug].dll. 2007-10-16 Geoffrey Garen Reviewed by Maciej Stachowiak. Re-structured variable and function declaration code. Command-line JS iBench shows no regression. Here are the changes: 1. Function declarations are now processed at the same time as var declarations -- namely, immediately upon entry to an execution context. This does not match Firefox, which waits to process a function declaration until the declaration's containing block executes, but it does match IE and the ECMA spec. (10.1.3 states that var and function declarations should be processed at the same time -- namely, "On entering an execution context." 12.2 states that "A Block does not define a new execution scope.") 2. Declaration processing proceeds iteratively now, rather than recursively, storing the nodes is finds in stacks. This will later facilitate an optimization to hold on to the gathered declaration nodes, rather than re-fetching them in every function call. [ http://bugs.webkit.org/show_bug.cgi?id=14868 ] Modified these tests because they expected the incorrect Mozilla behavior described above: * tests/mozilla/ecma_3/Function/scope-001.js: * tests/mozilla/js1_5/Scope/regress-184107.js: 2007-10-16 Darin Adler - try to fix the GTK build * kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h. 2007-10-16 Darin Adler - try to fix the Windows build * kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace. 2007-10-16 Darin Adler - try to fix the GTK build * kjs/ustring.cpp: Include ASCIICType.h. 2007-10-16 Darin Adler Reviewed by Maciej and Geoff (and looked over by Eric). - http://bugs.webkit.org/show_bug.cgi?id=15519 eliminate use of for processing ASCII * wtf/ASCIICType.h: Added. * wtf/DisallowCType.h: Added. * kjs/config.h: Include DisallowCType.h. * kjs/date_object.cpp: (KJS::skipSpacesAndComments): (KJS::findMonth): (KJS::parseDate): * kjs/function.cpp: (KJS::decode): * kjs/ustring.cpp: (KJS::UString::toDouble): Use ASCIICType.h functions instead of ctype.h ones. 2007-10-14 Maciej Stachowiak Reviewed by Darin. - fixes for "New JavaScript benchmark" http://bugs.webkit.org/show_bug.cgi?id=15515 * kjs/testkjs.cpp: (TestFunctionImp::callAsFunction): Implement "load" for compatibility with SpiderMonkey. (TestFunctionImp::): ditto (doIt): ditto (kjsmain): Drop useless --> from output. 2007-10-15 Geoffrey Garen Removed unnecessary #include. * API/JSObjectRef.cpp: 2007-10-15 Geoffrey Garen Double-reverse build fix. My tree was out of date. * kjs/nodes.cpp: (NumberNode::evaluate): 2007-10-15 Geoffrey Garen Build fix. * kjs/nodes.cpp: (NumberNode::evaluate): 2007-10-15 Geoffrey Garen Reviewed by Darin Adler. Removed surprising self-named "hack" that made nested functions available as named properties of their containing functions, and placed containing function objects in the scope chains of nested functions. There were a few reasons to remove this "hack:" 1. It contradicted FF, IE, and the ECMA spec. 2. It incurred a performance penalty, since merely parsing a function required parsing its body for nested functions (and so on). 3. SVN history contains no explanation for why it was added. It was just legacy code in a large merge a long, long time ago. [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ] * kjs/nodes.cpp: (FuncDeclNode::processFuncDecl): 2007-10-15 Geoffrey Garen Reviewed by Darin Adler. Removed the concept of AnonymousCode. It was unused, and it doesn't exist in the ECMA spec. [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ] * kjs/Context.cpp: (KJS::Context::Context): * kjs/function.h: (KJS::): * kjs/nodes.cpp: (ReturnNode::execute): 2007-10-15 Geoffrey Garen Reviewed by Darin Adler. Made function parameters DontDelete. This matches FF and the vague description in ECMA 10.1.3. It's also required in order to make symbol table based lookup of function parameters valid. (If the parameters aren't DontDelete, you can't guarantee that you'll find them later in the symbol table.) [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ] * kjs/function.cpp: (KJS::FunctionImp::passInParameters): 2007-10-15 Geoffrey Garen Reviewed by Maciej Stachowiak. Some Vector optimizations. These are especially important when using Vector as a stack for implementing recursive algorithms iteratively. [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ] 1. Added shrink(), which is a version of resize() that you can call to save a branch / improve code generation and inlining when you know that the vector is not getting bigger. 2. Changed subclassing relationship in VectorBuffer to remove a call to fastFree() in the destructor for the inlineCapacity != 0 template specialization. This brings inline Vectors one step closer to true stack-allocated arrays. Also changed abort() to CRASH(), since the latter works better. * wtf/Vector.h: (WTF::VectorBufferBase::allocateBuffer): (WTF::VectorBufferBase::deallocateBuffer): (WTF::VectorBufferBase::VectorBufferBase): (WTF::VectorBufferBase::~VectorBufferBase): (WTF::): (WTF::VectorBuffer::VectorBuffer): (WTF::VectorBuffer::~VectorBuffer): (WTF::VectorBuffer::deallocateBuffer): (WTF::VectorBuffer::releaseBuffer): (WTF::Vector::clear): (WTF::Vector::removeLast): (WTF::::operator): (WTF::::fill): (WTF::::shrink): 2007-10-12 Geoffrey Garen Reviewed by Maciej Stachowiak. Fixed http://bugs.webkit.org/show_bug.cgi?id=15490 Iteration statements sometimes incorrectly evaluate to the empty value (KDE r670547). [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ] This patch is a merge of KDE r670547, with substantial modification for performance. It fixes do-while statements to evaluate to a value. (They used to evaluate to the empty value in all cases.) It also fixes SourceElementsNode to maintain the value of abnormal completions like "break" and "continue." It also re-works the main execution loop in SourceElementsNode so that it (1) makes a little more sense and (2) avoids unnecessary work. This is a .28% speedup on command-line JS iBench. * kjs/nodes.cpp: (DoWhileNode::execute): (SourceElementsNode::execute): 2007-10-15 Simon Hausmann Reviewed by Lars. Fix compilation with gcc 4.3 by including 'limits' due to the use of std::numeric_limits. * wtf/HashTraits.h: 2007-10-5 Kevin Ollivier Reviewed by Adam. Add support for MSVC7, and fix cases where PLATFORM(WIN) should be PLATFORM(WIN_OS) for other ports building on Windows. * kjs/DateMath.cpp: (KJS::getDSTOffsetSimple): * kjs/JSImmediate.h: * wtf/Assertions.cpp: * wtf/Assertions.h: * wtf/Platform.h: * wtf/StringExtras.h: (snprintf): (vsnprintf): 2007-10-14 Cameron Zwarich Reviewed by Darin. Adds NegateNode optimization from KJS. The relevant revision in KDE is 666736. * kjs/grammar.y: * kjs/nodes.cpp: (NumberNode::evaluate): * kjs/nodes.h: (KJS::Node::): (KJS::NumberNode::): * kjs/nodes2string.cpp: (NumberNode::streamTo): 2007-10-14 Jason Foreman Reviewed by Maciej. Fix http://bugs.webkit.org/show_bug.cgi?id=15145 Ensure that if adjusting n to minimize the difference of n*intPow10(e-p+1) to x, that the property n < intPow10(p) is maintained. * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): == Rolled over to ChangeLog-2007-10-14 ==