1 2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
3 Sort files(...); sections of Xcode project files.
5 Rubber-stamped by Darin.
7 * JavaScriptCore.xcodeproj/project.pbxproj:
9 2007-11-03 Maciej Stachowiak <mjs@apple.com>
13 - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
17 (KJS::VarDeclNode::optimizeVariableAccess):
18 (KJS::VarDeclNode::getDeclarations):
19 (KJS::VarDeclNode::handleSlowCase):
20 (KJS::VarDeclNode::evaluateSingle):
21 (KJS::VarDeclNode::evaluate):
22 (KJS::VarStatementNode::execute):
25 (KJS::VarStatementNode::):
26 * kjs/nodes2string.cpp:
27 (KJS::VarDeclNode::streamTo):
29 2007-11-03 Alexey Proskuryakov <ap@webkit.org>
33 http://bugs.webkit.org/show_bug.cgi?id=15800
34 REGRESSION (r27303): RegExp leaks
36 * kjs/regexp_object.h:
37 (KJS::RegExpImp::setRegExp):
38 (KJS::RegExpImp::regExp):
39 (KJS::RegExpImp::classInfo):
40 * kjs/regexp_object.cpp:
41 (RegExpImp::RegExpImp):
42 (RegExpImp::~RegExpImp):
43 Renamed reg member variable to m_regExp, changed it to use OwnPtr.
45 2007-11-02 Maciej Stachowiak <mjs@apple.com>
49 - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
53 (KJS::statementListPushFIFO):
54 (KJS::statementListGetDeclarations):
55 (KJS::statementListInitializeDeclarationStacks):
56 (KJS::statementListInitializeVariableAccessStack):
57 (KJS::statementListExecute):
58 (KJS::BlockNode::BlockNode):
59 (KJS::FunctionBodyNode::FunctionBodyNode):
60 (KJS::ProgramNode::ProgramNode):
62 (KJS::CaseClauseNode::):
64 2007-11-02 Darin Adler <darin@apple.com>
68 - http://bugs.webkit.org/show_bug.cgi?id=15791
69 change property map data structure for less memory use, better speed
71 The property map now has an array of indices and a separate array of
72 property map entries. This slightly slows down lookup because of a second
73 memory acess, but makes property maps smaller and faster to iterate in
74 functions like mark().
76 SunSpider says this is 1.2% faster, although it makes the bitwise-end test
77 more than 10% slower. To fix that we'll need to optimize global variable lookup.
79 * kjs/property_map.cpp:
80 (KJS::PropertyMapEntry::PropertyMapEntry):
81 (KJS::PropertyMapHashTable::entries):
82 (KJS::PropertyMapHashTable::allocationSize):
83 (KJS::SavedProperties::SavedProperties):
84 (KJS::SavedProperties::~SavedProperties):
85 (KJS::PropertyMap::checkConsistency):
86 (KJS::PropertyMap::~PropertyMap):
87 (KJS::PropertyMap::clear):
88 (KJS::PropertyMap::get):
89 (KJS::PropertyMap::getLocation):
90 (KJS::PropertyMap::put):
91 (KJS::PropertyMap::insert):
92 (KJS::PropertyMap::createTable):
93 (KJS::PropertyMap::rehash):
94 (KJS::PropertyMap::remove):
95 (KJS::PropertyMap::mark):
96 (KJS::comparePropertyMapEntryIndices):
97 (KJS::PropertyMap::containsGettersOrSetters):
98 (KJS::PropertyMap::getEnumerablePropertyNames):
99 (KJS::PropertyMap::save):
100 (KJS::PropertyMap::restore):
101 * kjs/property_map.h:
103 2007-11-02 Darin Adler <darin@apple.com>
107 - http://bugs.webkit.org/show_bug.cgi?id=15807
108 HashMap needs a take() function that combines get and remove
110 * wtf/HashMap.h: Added take function. Simplistic implementation for now,
111 but still does only one hash table lookup.
113 * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
114 a find followed by a remove.
116 2007-11-02 David Carson <dacarson@gmail.com>
120 Fix compiler warning "warning: suggest parentheses around && within ||"
121 http://bugs.webkit.org/show_bug.cgi?id=15764
123 * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
125 2007-11-01 Geoffrey Garen <ggaren@apple.com>
127 Reviewed by Maciej Stachowiak.
129 In preparation for making List a simple stack-allocated Vector:
131 Removed all instances of List copying and/or assignment, and made List
132 inherit from Noncopyable.
134 Functions that used to return a List by copy now take List& out
137 Layout tests and JS tests pass.
140 (KJS::List::slice): Replaced copyTail with a more generic slice
141 alternative. (JavaScriptCore only calls slice(1), but WebCore calls
144 2007-11-01 Geoffrey Garen <ggaren@apple.com>
146 Reviewed by Maciej Stachowiak.
148 Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
149 REGRESSION(r27344): Crash on load at finance.yahoo.com
151 Reverted a small portion of my last check-in. (The speedup and the List
152 removal are still there, though.)
154 ActivationImp needs to hold a pointer to its function, and mark that
155 pointer (rather than accessing its function through its ExecState, and
156 counting on the active scope to mark its function) because a closure
157 can cause an ActivationImp to outlive its ExecState along with any
161 (KJS::ExecState::ExecState):
163 (KJS::FunctionImp::~FunctionImp):
164 (KJS::ActivationImp::ActivationImp):
166 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
168 Also made HashTable a little more crash-happy in debug builds, so
169 problems like this will show up earlier:
172 (WTF::HashTable::~HashTable):
174 2007-11-01 Geoffrey Garen <ggaren@apple.com>
176 Reviewed by Adam Roben.
178 Addressed some of Darin's review comments.
180 Used perl -p, which is the shorthand while(<>) {}.
182 Made sure not to suppress bison's output.
184 Added line to removed bison_out.txt, since this script removes other
185 intermediate files, too.
187 * DerivedSources.make:
189 2007-11-01 Geoffrey Garen <ggaren@apple.com>
191 Reviewed by Oliver Hunt.
193 Removed List from ActivationImp, in preparation for making all lists
198 1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
201 (KJS::ExecState::ExecState):
202 (KJS::ExecState::~ExecState):
204 (KJS::ActivationImp::ActivationImp):
205 (KJS::ActivationImp::createArgumentsObject):
207 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
209 2007-11-01 Adam Roben <aroben@apple.com>
211 Use jsNumberCell instead of jsNumber when converting double constants to JSValues
213 This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
214 ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
216 It also gets rid of an MSVC warning that we previously had to silence.
220 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
221 back on the "overflow in constant arithmetic" warning.
222 * kjs/number_object.cpp:
223 (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
226 2007-10-31 Adam Roben <aroben@apple.com>
232 2007-10-31 Maciej Stachowiak <mjs@apple.com>
236 - shave some cycles off of local storage access for a 1% SunSpider speedup
238 Keep the LocalStorage pointer in the ExecState, instead of getting
239 it from the ActivationImp all the time.
242 (KJS::ExecState::updateLocalStorage):
244 (KJS::ExecState::localStorage):
246 (KJS::LocalVarAccessNode::evaluate):
247 (KJS::LocalVarFunctionCallNode::evaluate):
248 (KJS::PostIncLocalVarNode::evaluate):
249 (KJS::PostDecLocalVarNode::evaluate):
250 (KJS::LocalVarTypeOfNode::evaluate):
251 (KJS::PreIncLocalVarNode::evaluate):
252 (KJS::PreDecLocalVarNode::evaluate):
253 (KJS::ReadModifyLocalVarNode::evaluate):
254 (KJS::AssignLocalVarNode::evaluate):
255 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
257 2007-10-31 Adam Roben <aroben@apple.com>
259 Fix a crash on launch due to a static initializer race
261 We now use fast inline assembler spinlocks which can be statically
262 initialized at compile time.
264 As a side benefit, this speeds up SunSpider by 0.4%.
268 * wtf/FastMalloc.cpp:
270 (TCMalloc_SpinLock::Lock):
271 (TCMalloc_SpinLock::Unlock):
273 * wtf/TCSystemAlloc.cpp:
275 2007-10-31 Kevin McCullough <kmccullough@apple.com>
279 - Corrected spelling.
283 2007-10-31 Mark Rowe <mrowe@apple.com>
285 Further Gtk build fixage.
287 * kjs/regexp_object.cpp:
289 2007-10-31 Mark Rowe <mrowe@apple.com>
295 2007-10-31 Darin Adler <darin@apple.com>
299 - fix http://bugs.webkit.org/show_bug.cgi?id=15749
300 RegExp/RegExpObjectImp cause needless UString creation
302 Speeds things up 0.4% according to SunSpider.
304 * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
305 because this library doesn't use the real PCRE -- it uses its
306 own PCRE that works on UTF-16.
308 * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
309 Use Noncopyable. Change the return value of match.
311 (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
312 (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
313 (KJS::RegExp::match): Change to return the position as an int and the
314 ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
316 * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
317 require a result string.
318 * kjs/regexp_object.cpp:
319 (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
320 (RegExpObjectImp::performMatch): Change so it doesn't return a string.
321 (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
322 the main result with the backreferences; now it doesn't need to take
324 (RegExpObjectImp::getBackref): Minor tweaks.
325 (RegExpObjectImp::getLastParen): Ditto.
326 (RegExpObjectImp::getLeftContext): Ditto.
327 (RegExpObjectImp::getRightContext): Ditto.
328 (RegExpObjectImp::getValueProperty): Change LastMatch case to call
329 getBackref(0) so we don't need a separate getLastMatch function.
331 * kjs/string_object.cpp:
332 (KJS::replace): Update to use new performMatch, including merging the
333 matched string section with the other substrings.
334 (KJS::StringProtoFunc::callAsFunction): Update functions to use the
335 new performMatch and match. Also change to use OwnArrayPtr.
337 2007-10-31 Oliver Hunt <oliver@apple.com>
339 * kjs/nodes.h: include OwnPtr.h
341 2007-10-31 Oliver Hunt <oliver@apple.com>
345 Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
349 (KJS::statementListPushFIFO):
350 (KJS::statementListGetDeclarations):
351 (KJS::statementListInitializeDeclarationStacks):
352 (KJS::statementListInitializeVariableAccessStack):
353 (KJS::statementListExecute):
354 (KJS::BlockNode::optimizeVariableAccess):
355 (KJS::BlockNode::BlockNode):
356 (KJS::BlockNode::getDeclarations):
357 (KJS::BlockNode::execute):
358 (KJS::CaseClauseNode::optimizeVariableAccess):
359 (KJS::CaseClauseNode::getDeclarations):
360 (KJS::CaseClauseNode::evalStatements):
361 (KJS::FunctionBodyNode::initializeDeclarationStacks):
362 (KJS::FunctionBodyNode::optimizeVariableAccess):
364 * kjs/nodes2string.cpp:
365 (KJS::statementListStreamTo):
366 (KJS::BlockNode::streamTo):
367 (KJS::CaseClauseNode::streamTo):
369 2007-10-30 Mark Rowe <mrowe@apple.com>
371 * kjs/property_map.cpp: Added a missing using directive to fix the build
372 for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
374 2007-10-31 Maciej Stachowiak <mjs@apple.com>
376 * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
379 2007-10-31 Alexey Proskuryakov <ap@webkit.org>
383 http://bugs.webkit.org/show_bug.cgi?id=11001
384 WebKit doesn't support RegExp.compile method
386 Test: fast/js/regexp-compile.html
388 * kjs/regexp_object.cpp:
389 (RegExpPrototype::RegExpPrototype):
390 (RegExpProtoFunc::callAsFunction):
391 * kjs/regexp_object.h:
392 (KJS::RegExpProtoFunc::):
393 Added RegExp.compile.
395 * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
397 2007-10-31 Maciej Stachowiak <mjs@apple.com>
401 - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
403 Integer divide sucks. Fortunately, a bunch of shifts and XORs
404 biased towards the high bits is sufficient to provide a good
405 double hash. Besides the SunSpider win, I used the dump statistics
406 mode for both to verify that collisions did not increase and that
407 the longest collision chain is not any longer.
409 * kjs/property_map.cpp:
411 (KJS::PropertyMap::get):
412 (KJS::PropertyMap::getLocation):
413 (KJS::PropertyMap::put):
414 (KJS::PropertyMap::insert):
415 (KJS::PropertyMap::remove):
416 (KJS::PropertyMap::checkConsistency):
420 (WTF::::lookupForWriting):
421 (WTF::::fullLookupForWriting):
424 2007-10-30 Adam Roben <aroben@apple.com>
426 * kjs/collector.h: Make HeapType public so it can be used for non-member
427 things like the HeapConstants struct template. Fixes the build on Windows.
429 2007-10-30 Adam Roben <aroben@apple.com>
431 Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
433 Speeds up SunSpider by 0.4%.
435 Reviewed by Steve and Maciej.
437 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
438 a warning during LTCG in release builds about double -> float
440 * wtf/AlwaysInline.h:
443 2007-10-30 Adam Roben <aroben@apple.com>
445 Use GetCurrentThreadId instead of pthread_self in FastMalloc
447 Speeds up SunSpider by 0.3%.
451 * wtf/FastMalloc.cpp:
452 (WTF::TCMalloc_ThreadCache::InitTSD):
453 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
455 2007-10-30 Adam Roben <aroben@apple.com>
457 Switch to a Win32 critical section implementation of spinlocks
459 Speeds up SunSpider by 0.4%.
463 * wtf/FastMalloc.cpp:
465 (TCMalloc_SpinLock::TCMalloc_SpinLock):
466 (TCMalloc_SpinLock::Init):
467 (TCMalloc_SpinLock::Finalize):
468 (TCMalloc_SpinLock::Lock):
469 (TCMalloc_SpinLock::Unlock):
470 * wtf/TCSystemAlloc.cpp:
472 2007-10-30 Adam Roben <aroben@apple.com>
474 Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
476 http://bugs.webkit.org/show_bug.cgi?id=15586
478 Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
480 Use Win32 TLS functions instead of __declspec(thread), which breaks
485 * wtf/FastMalloc.cpp:
486 (WTF::getThreadHeap):
487 (WTF::TCMalloc_ThreadCache::InitModule):
489 2007-10-30 Maciej Stachowiak <mjs@apple.com>
493 - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
494 http://bugs.webkit.org/show_bug.cgi?id=15772
496 We do this by using a single mark bit per two number cells, and
499 Besides being an 0.5% win overall, this is a 7.1% win on morph.
503 (KJS::Collector::heapAllocate):
504 (KJS::Collector::markStackObjectsConservatively):
505 (KJS::Collector::sweep):
507 (KJS::SmallCollectorCell::):
509 2007-10-30 Geoffrey Garen <ggaren@apple.com>
511 Reviewed by Adam Roben, Sam Weinig.
513 Made conflicts in grammar.y a persistent build failure.
515 * DerivedSources.make:
517 2007-10-30 Kevin McCullough <kmccullough@apple.com>
519 Reviewed by Adam and Geoff.
521 - Added a new cast so all the casts are in the same place.
526 2007-10-30 Geoffrey Garen <ggaren@apple.com>
528 Reviewed by Darin Adler.
530 Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
534 ecma_2/Statements/dowhile-001.js
535 ecma_2/Statements/dowhile-002.js
536 ecma_2/Statements/dowhile-003.js
537 ecma_2/Statements/dowhile-004.js
538 ecma_2/Statements/dowhile-005.js
539 ecma_2/Statements/dowhile-006.js
540 ecma_2/Statements/dowhile-007.js
541 js1_2/statements/do_while.js
543 and layout tests, including
545 do-while-expression-value.html
546 do-while-semicolon.html
547 do-while-without-semicolon.html
551 * kjs/grammar.y: Use the explicit "error" production, as we do with other
552 automatic semicolon insertions, to disambiguate "do { } while();" from
553 "do { } while()" followed by ";" (the empty statement).
555 2007-10-29 Oliver Hunt <oliver@apple.com>
559 Debranching remaining assignment nodes, and miscellaneous cleanup
561 Split read-modify code paths out of AssignBracketNode and AssignDotNode
562 Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
563 and ReadModifyResolveNode evaluate methods
565 Leads to a 1% gain in SunSpider.
569 (KJS::ReadModifyLocalVarNode::evaluate):
570 (KJS::ReadModifyResolveNode::evaluate):
571 (KJS::AssignDotNode::evaluate):
572 (KJS::ReadModifyDotNode::optimizeVariableAccess):
573 (KJS::ReadModifyDotNode::evaluate):
574 (KJS::AssignBracketNode::evaluate):
575 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
576 (KJS::ReadModifyBracketNode::evaluate):
578 (KJS::AssignBracketNode::):
579 (KJS::AssignBracketNode::precedence):
580 (KJS::AssignDotNode::):
581 (KJS::AssignDotNode::precedence):
582 * kjs/nodes2string.cpp:
583 (KJS::ReadModifyBracketNode::streamTo):
584 (KJS::AssignBracketNode::streamTo):
585 (KJS::ReadModifyDotNode::streamTo):
586 (KJS::AssignDotNode::streamTo):
588 2007-10-29 Oliver Hunt <oliver@apple.com>
590 Debranching various Node::evaluate implementations
594 Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
595 Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
597 Gains 1.6% on SunSpider
599 * JavaScriptCore.xcodeproj/project.pbxproj:
602 (KJS::PostIncResolveNode::optimizeVariableAccess):
603 (KJS::PostIncResolveNode::evaluate):
604 (KJS::PostIncLocalVarNode::evaluate):
605 (KJS::PostDecResolveNode::optimizeVariableAccess):
606 (KJS::PostDecResolveNode::evaluate):
607 (KJS::PostDecLocalVarNode::evaluate):
608 (KJS::PostIncBracketNode::evaluate):
609 (KJS::PostDecBracketNode::evaluate):
610 (KJS::PostIncDotNode::evaluate):
611 (KJS::PostDecDotNode::evaluate):
612 (KJS::PreIncResolveNode::optimizeVariableAccess):
613 (KJS::PreIncLocalVarNode::evaluate):
614 (KJS::PreIncResolveNode::evaluate):
615 (KJS::PreDecResolveNode::optimizeVariableAccess):
616 (KJS::PreDecLocalVarNode::evaluate):
617 (KJS::PreDecResolveNode::evaluate):
618 (KJS::PreIncBracketNode::evaluate):
619 (KJS::PreDecBracketNode::evaluate):
620 (KJS::PreIncDotNode::evaluate):
621 (KJS::PreDecDotNode::evaluate):
622 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
623 (KJS::AssignResolveNode::optimizeVariableAccess):
624 (KJS::AssignLocalVarNode::evaluate):
625 (KJS::AssignResolveNode::evaluate):
627 (KJS::PostDecResolveNode::):
628 (KJS::PostDecResolveNode::precedence):
629 (KJS::PostDecLocalVarNode::):
630 (KJS::PostfixBracketNode::):
631 (KJS::PostfixBracketNode::precedence):
632 (KJS::PostIncBracketNode::):
633 (KJS::PostIncBracketNode::isIncrement):
634 (KJS::PostDecBracketNode::):
635 (KJS::PostDecBracketNode::isIncrement):
636 (KJS::PostfixDotNode::):
637 (KJS::PostfixDotNode::precedence):
638 (KJS::PostIncDotNode::):
639 (KJS::PostIncDotNode::isIncrement):
640 (KJS::PostDecDotNode::):
641 (KJS::PreIncResolveNode::):
642 (KJS::PreDecResolveNode::):
643 (KJS::PreDecResolveNode::precedence):
644 (KJS::PreDecLocalVarNode::):
645 (KJS::PrefixBracketNode::):
646 (KJS::PrefixBracketNode::precedence):
647 (KJS::PreIncBracketNode::):
648 (KJS::PreIncBracketNode::isIncrement):
649 (KJS::PreDecBracketNode::):
650 (KJS::PreDecBracketNode::isIncrement):
651 (KJS::PrefixDotNode::):
652 (KJS::PrefixDotNode::precedence):
653 (KJS::PreIncDotNode::):
654 (KJS::PreIncDotNode::isIncrement):
655 (KJS::PreDecDotNode::):
656 (KJS::ReadModifyResolveNode::):
657 (KJS::ReadModifyLocalVarNode::):
658 (KJS::AssignResolveNode::):
659 (KJS::AssignResolveNode::precedence):
660 * kjs/nodes2string.cpp:
661 (KJS::PostIncResolveNode::streamTo):
662 (KJS::PostDecResolveNode::streamTo):
663 (KJS::PostfixBracketNode::streamTo):
664 (KJS::PostfixDotNode::streamTo):
665 (KJS::PreIncResolveNode::streamTo):
666 (KJS::PreDecResolveNode::streamTo):
667 (KJS::ReadModifyResolveNode::streamTo):
668 (KJS::AssignResolveNode::streamTo):
670 2007-10-29 Maciej Stachowiak <mjs@apple.com>
672 Not reviewed, build fix.
674 - Include Vector.h in a way that actually works.
676 * kjs/LocalStorage.h:
678 2007-10-29 Maciej Stachowiak <mjs@apple.com>
680 Not reviewed, build fix.
682 - Install LocalStorage.h as a private header.
684 * JavaScriptCore.xcodeproj/project.pbxproj:
686 2007-10-29 Maciej Stachowiak <mjs@apple.com>
690 - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
692 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
693 * JavaScriptCore.xcodeproj/project.pbxproj:
694 * kjs/LocalStorage.h: Added.
695 (KJS::LocalStorageEntry::LocalStorageEntry):
699 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
701 2007-10-29 Geoffrey Garen <ggaren@apple.com>
703 Reviewed by Oliver Hunt.
705 Some small tweaks that I notice while reviewing Oliver's last patch.
707 Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
709 No change in SunSpider because SunSpider doesn't take the code path that
710 would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
713 (KJS::LocalVarPostfixNode::evaluate):
714 (KJS::TypeOfResolveNode::optimizeVariableAccess):
715 (KJS::LocalVarTypeOfNode::evaluate):
716 (KJS::PrefixResolveNode::optimizeVariableAccess):
717 (KJS::LocalVarPrefixNode::evaluate):
718 (KJS::AssignResolveNode::optimizeVariableAccess):
719 (KJS::LocalVarAssignNode::evaluate):
721 (KJS::LocalVarTypeOfNode::):
722 (KJS::PrefixResolveNode::):
723 (KJS::LocalVarPrefixNode::):
724 (KJS::AssignResolveNode::):
725 (KJS::LocalVarAssignNode::):
727 2007-10-29 Eric Seidel <eric@webkit.org>
731 SunSpider claims this was a 0.7% speedup.
733 * kjs/string_object.cpp:
734 (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
736 2007-10-29 Maciej Stachowiak <mjs@apple.com>
740 - re-enable asserts for access to empty or deleted keys
744 (WTF::::lookupForWriting):
745 (WTF::::fullLookupForWriting):
748 2007-10-29 Eric Seidel <eric@webkit.org>
750 Build fix only, no review.
752 * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
754 2007-10-29 Mark Rowe <mrowe@apple.com>
756 Gtk build fix. Move struct declarations into nodes.h.
761 2007-10-29 Eric Seidel <eric@webkit.org>
765 Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
766 Make it a compile time error to use toString(ExecState) on a StringInstance
768 SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
771 (KJS::StringImp::getLength):
772 * kjs/string_object.cpp:
773 (KJS::StringInstance::lengthGetter):
774 (KJS::StringInstance::inlineGetOwnPropertySlot):
775 (KJS::StringInstance::getOwnPropertySlot):
776 * kjs/string_object.h:
778 2007-10-28 Oliver Hunt <oliver@apple.com>
782 Add nodes to allow Assignment, TypeOf, and prefix operators to
783 make use of the new optimised local variable look up.
788 (KJS::TypeOfResolveNode::optimizeVariableAccess):
789 (KJS::LocalTypeOfAccessNode::evaluate):
790 (KJS::PrefixResolveNode::optimizeVariableAccess):
791 (KJS::PrefixLocalAccessNode::evaluate):
792 (KJS::AssignResolveNode::optimizeVariableAccess):
793 (KJS::AssignLocalAccessNode::evaluate):
795 (KJS::TypeOfResolveNode::):
796 (KJS::TypeOfResolveNode::precedence):
797 (KJS::LocalTypeOfAccessNode::):
798 (KJS::PrefixResolveNode::):
799 (KJS::PrefixResolveNode::precedence):
800 (KJS::PrefixLocalAccessNode::):
801 (KJS::AssignResolveNode::):
802 (KJS::AssignLocalAccessNode::):
804 2007-10-28 Maciej Stachowiak <mjs@apple.com>
808 - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
809 http://bugs.webkit.org/show_bug.cgi?id=15748
811 Not a significant speedup or slowdown on SunSpider.
814 (KJS::clearNewNodes):
818 (KJS::BlockNode::BlockNode):
819 (KJS::CaseBlockNode::CaseBlockNode):
820 (KJS::FunctionBodyNode::FunctionBodyNode):
821 (KJS::SourceElementsNode::SourceElementsNode):
822 (KJS::ProgramNode::ProgramNode):
824 (KJS::ElementNode::):
826 (KJS::PropertyListNode::):
827 (KJS::ObjectLiteralNode::):
828 (KJS::ArgumentListNode::):
829 (KJS::ArgumentsNode::):
830 (KJS::VarDeclListNode::):
831 (KJS::VarStatementNode::):
833 (KJS::ParameterNode::):
834 (KJS::FuncExprNode::):
835 (KJS::FuncDeclNode::):
836 (KJS::SourceElementsNode::):
837 (KJS::CaseClauseNode::):
838 (KJS::ClauseListNode::):
840 2007-10-28 Mark Rowe <mrowe@apple.com>
842 Disable assertions in a manner that doesn't break the Qt Windows build.
846 (WTF::::lookupForWriting):
847 (WTF::::fullLookupForWriting):
849 2007-10-28 Geoffrey Garen <ggaren@apple.com>
851 Temporarily disabling some ASSERTs I introduced in my last check-in
852 because of http://bugs.webkit.org/show_bug.cgi?id=15747
853 Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
857 (WTF::::lookupForWriting):
858 (WTF::::fullLookupForWriting):
861 2007-10-28 Geoffrey Garen <ggaren@apple.com>
863 Reviewed by Darin Adler.
865 Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
866 #ifndef ASSERT_DISABLED is no good!
868 Replaced with #if !ASSERT_DISABLED.
872 (WTF::::lookupForWriting):
873 (WTF::::fullLookupForWriting):
876 2007-10-28 Geoffrey Garen <ggaren@apple.com>
878 Reviewed by Darin Adler.
880 Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
881 to the AST transfom that replaces slow resolve nodes with fast local
882 variable alternatives.
884 2.5% speedup on SunSpider.
886 Also added some missing copyright notices.
889 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
890 (KJS::FunctionCallResolveNode::evaluate):
891 (KJS::LocalVarFunctionCallNode::evaluate):
892 (KJS::PostfixResolveNode::optimizeVariableAccess):
893 (KJS::PostfixResolveNode::evaluate):
894 (KJS::LocalVarPostfixNode::evaluate):
895 (KJS::DeleteResolveNode::optimizeVariableAccess):
896 (KJS::DeleteResolveNode::evaluate):
897 (KJS::LocalVarDeleteNode::evaluate):
899 (KJS::FunctionCallResolveNode::):
900 (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
901 (KJS::PostfixResolveNode::):
902 (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
903 (KJS::DeleteResolveNode::):
904 (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
906 2007-10-28 Eric Seidel <eric@webkit.org>
910 Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
911 Add virtual keyword to a few virtual functions previously unmarked.
914 (KJS::StringImp::type):
915 (KJS::NumberImp::type):
917 (KJS::UString::Rep::deref):
919 2007-10-28 Darin Adler <darin@apple.com>
921 - fix "broken everything" from the storage leak fix
923 * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
924 * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
926 2007-10-28 Darin Adler <darin@apple.com>
930 - turn on unused parameter waring on Mac OS X because it's already on elsewhere
932 * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
938 Fixed unused variables by using them or marked them with UNUSED_PARAM.
940 * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
941 Removed parameter names to indicate they are unused.
943 2007-10-28 Darin Adler <darin@apple.com>
947 - fix a storage leak where we ref the UString every time we replace
948 a ResolveNode with a LocalVarAccessNode
950 * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
951 that takes PlacementNewAdopt.
953 * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
954 with PlacementNewAdopt instead of the old value of ident.
956 * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
957 takes PlacementNewAdopt.
959 2007-10-28 Darin Adler <darin@apple.com>
961 - Windows build fix; get rid of unused parameter
963 * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
964 * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
965 The assertions weren't all that helpful.
967 2007-10-28 Mark Rowe <mrowe@apple.com>
969 Gtk build fix. Add include of MathExtras.h.
971 * kjs/string_object.cpp:
973 2007-10-28 Mark Rowe <mrowe@apple.com>
975 Reviewed by Maciej and Tim.
977 Replace uses of isNaN and isInf with isnan and isinf, and
978 remove isNaN and isInf.
980 * kjs/config.h: Remove unused HAVE_'s.
981 * kjs/date_object.cpp:
982 (KJS::DateInstance::getTime):
983 (KJS::DateInstance::getUTCTime):
984 (KJS::DateProtoFunc::callAsFunction):
985 (KJS::DateObjectImp::construct):
986 (KJS::DateObjectFuncImp::callAsFunction):
988 (KJS::GlobalFuncImp::callAsFunction):
989 * kjs/math_object.cpp:
990 (MathFuncImp::callAsFunction):
991 * kjs/nodes2string.cpp:
992 (KJS::isParserRoundTripNumber):
993 * kjs/number_object.cpp:
994 (NumberProtoFunc::callAsFunction):
995 * kjs/operations.cpp:
997 * kjs/string_object.cpp:
998 (KJS::StringProtoFunc::callAsFunction):
1000 (KJS::UString::from):
1002 (KJS::JSValue::toInteger):
1003 (KJS::JSValue::toInt32SlowCase):
1004 (KJS::JSValue::toUInt32SlowCase):
1006 2007-10-28 Geoffrey Garen <ggaren@apple.com>
1008 Build fix: use the new-fangled missingSymbolMarker().
1011 (KJS::ResolveNode::optimizeVariableAccess):
1013 (KJS::LocalVarAccessNode::LocalVarAccessNode):
1015 2007-10-28 Geoffrey Garen <ggaren@apple.com>
1017 Reviewed by Maciej Stachowiak, Darin Adler.
1019 Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
1022 AST transfom to replace slow resolve nodes with fast local variable
1023 alternatives that do direct memory access. Currently, only ResolveNode
1024 provides a fast local variable alternative. 6 others are soon to come.
1026 16.7% speedup on SunSpider.
1028 Most of this patch is just scaffolding to support iterating all the
1029 resolve nodes in the AST through optimizeResolveNodes(). In
1030 optimizeResolveNodes(), most classes just push their child nodes onto
1031 the processing stack, while ResolveNodes actually replace themselves in
1032 the tree with more optimized alternatives, if possible.
1034 Here are the interesting bits:
1036 * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
1037 in Node and ResolveNode. This tag allows you to use placement new to
1038 swap out a base class Node in favor of a subclass copy that holds the
1039 same data. (Without this tag, default initialization would NULL out
1040 RefPtrs, change line numbers, etc.)
1043 (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
1044 that the fast path is impossible, to make sure we didn't leave anything
1047 (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
1048 transformation happens.
1050 (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
1051 optimization happens.
1053 * kjs/function.h: Added symbolTable() accessor for, for the sake of
1056 2007-10-28 Mark Rowe <mrowe@apple.com>
1060 Fix "AllInOneFile.o has a global initializer in it".
1062 Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
1063 We can avoid this by moving it inside an inline function.
1065 * kjs/SymbolTable.h:
1066 (KJS::missingSymbolMarker):
1068 (KJS::ActivationImp::getOwnPropertySlot):
1069 (KJS::ActivationImp::put):
1071 2007-10-28 Maciej Stachowiak <mjs@apple.com>
1075 - Added assertions to protect against adding empty or deleted keys to a HashTable
1078 (WTF::HashTable::lookup):
1079 (WTF::HashTable::lookupForWriting):
1080 (WTF::HashTable::fullLookupForWriting):
1081 (WTF::HashTable::add):
1083 2007-10-28 Darin Adler <darin@apple.com>
1087 * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
1088 Use isNaN and isInf instead of isnan and isinf.
1090 2007-10-28 Darin Adler <darin@apple.com>
1094 - http://bugs.webkit.org/show_bug.cgi?id=15735
1095 remove GroupNode to simplify AST and possibly get a modest speedup
1097 This patch removes 4 node types: GroupNode, PropertyNameNode,
1098 FunctionCallParenBracketNode, and FunctionCallParenDotNode.
1100 To remove GroupNode, we add knowledge of precedence to the tree nodes,
1101 and use that when serializing to determine where parentheses are needed.
1102 This means we no longer have to represent parentheses in the tree.
1104 The precedence values are named after productions in the grammar from the
1105 JavaScript standard.
1107 SunSpider says this is an 0.4% speedup.
1110 * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
1111 serialization, so I moved it to the file that takes care of that.
1113 * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
1114 indicate failure instead of a separate boolean. Got rid of PropertyNameNode
1115 by merging the PropertyName rule into the Property rule (which was easier
1116 than figuring out how to pass the Identifier from one node to another).
1117 Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
1118 and FunctionCallParenDotNode.
1120 * kjs/nodes.h: Removed unused forward declarations and Operator values.
1121 Added Precedence enum, and precedence function to all nodes. Removed
1122 nodeInsideAllParens. Added streamBinaryOperator function for serialization.
1123 Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
1124 Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
1126 * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
1127 (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
1128 of converting it from an Identifier to a jsString then back to a UString
1129 then into an Identifier again!
1131 * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
1132 function for each of Endl, Indent, Unindent, and DotExpr instead of using a
1133 single function with a switch. Added a precedence that you can stream in, to
1134 cause the next node serialized to add parentheses based on that precedence value.
1135 (KJS::operatorString): Moved to the top of the file.
1136 (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
1137 workaround for snprintf, since StringExtras.h takes care of that.
1138 (KJS::operator<<): Made the char and char* versions faster by using UString's
1139 character append functions instead of constructing a UString. Added the logic
1140 to the Node* version to add parentheses if needed.
1141 (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
1142 (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
1143 (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
1145 (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
1146 (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
1147 (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
1148 (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
1149 (KJS::FunctionCallBracketNode::streamTo): Ditto.
1150 (KJS::FunctionCallDotNode::streamTo): Ditto.
1151 (KJS::PostfixBracketNode::streamTo): Ditto.
1152 (KJS::PostfixDotNode::streamTo): Ditto.
1153 (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
1154 (KJS::DeleteBracketNode::streamTo): Use PrecCall.
1155 (KJS::DeleteDotNode::streamTo): Ditto.
1156 (KJS::DeleteValueNode::streamTo): Use PrecUnary.
1157 (KJS::VoidNode::streamTo): Ditto.
1158 (KJS::TypeOfValueNode::streamTo): Ditto.
1159 (KJS::PrefixBracketNode::streamTo): Use PrecCall.
1160 (KJS::PrefixDotNode::streamTo): Ditto.
1161 (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
1162 (KJS::UnaryPlusNode::streamTo): Ditto.
1163 (KJS::NegateNode::streamTo): Ditto.
1164 (KJS::BitwiseNotNode::streamTo): Ditto.
1165 (KJS::LogicalNotNode::streamTo): Ditto.
1166 (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
1167 (KJS::DivNode::streamTo): Ditto.
1168 (KJS::ModNode::streamTo): Ditto.
1169 (KJS::AddNode::streamTo): Ditto.
1170 (KJS::SubNode::streamTo): Ditto.
1171 (KJS::LeftShiftNode::streamTo): Ditto.
1172 (KJS::RightShiftNode::streamTo): Ditto.
1173 (KJS::UnsignedRightShiftNode::streamTo): Ditto.
1174 (KJS::LessNode::streamTo): Ditto.
1175 (KJS::GreaterNode::streamTo): Ditto.
1176 (KJS::LessEqNode::streamTo): Ditto.
1177 (KJS::GreaterEqNode::streamTo): Ditto.
1178 (KJS::InstanceOfNode::streamTo): Ditto.
1179 (KJS::InNode::streamTo): Ditto.
1180 (KJS::EqualNode::streamTo): Ditto.
1181 (KJS::NotEqualNode::streamTo): Ditto.
1182 (KJS::StrictEqualNode::streamTo): Ditto.
1183 (KJS::NotStrictEqualNode::streamTo): Ditto.
1184 (KJS::BitAndNode::streamTo): Ditto.
1185 (KJS::BitXOrNode::streamTo): Ditto.
1186 (KJS::BitOrNode::streamTo): Ditto.
1187 (KJS::LogicalAndNode::streamTo): Ditto.
1188 (KJS::LogicalOrNode::streamTo): Ditto.
1189 (KJS::ConditionalNode::streamTo): Ditto.
1190 (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
1191 (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
1192 the bracket and PrecAssignment for the right side.
1193 (KJS::AssignDotNode::streamTo): Ditto.
1194 (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
1195 and PrecAssignment for the right side.
1196 (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
1197 (KJS::AssignExprNode::streamTo): Use PrecAssignment.
1199 2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
1201 Define wx port and set wx port USE options.
1203 Reviewed by Adam Roben.
1207 2007-10-28 Mark Rowe <mrowe@apple.com>
1209 We don't include "config.h" in headers.
1211 * bindings/jni/jni_instance.h:
1216 2007-10-28 Maciej Stachowiak <mjs@apple.com>
1218 Rubber stamped by Mark.
1220 - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
1222 * kjs/SymbolTable.h:
1223 (KJS::SymbolTableIndexHashTraits::emptyValue):
1225 (KJS::ActivationImp::getOwnPropertySlot):
1226 (KJS::ActivationImp::put):
1228 2007-10-28 Maciej Stachowiak <mjs@apple.com>
1232 - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
1234 * kjs/SymbolTable.h:
1235 (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
1236 (KJS::IdentifierRepHash::equal): ditto
1237 (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
1238 (KJS::SymbolTable): change to a typedef for a HashMap.
1240 (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
1241 (KJS::ActivationImp::deleteProperty): ditto
1242 (KJS::ActivationImp::put): ditto
1245 (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
1246 you now have to store a UString::rep, not an identifier.
1248 2007-10-27 Maciej Stachowiak <mjs@apple.com>
1252 - numerous HashTable performance improvements
1254 This does not quite add up to a measurable win on SunSpider, but it allows a
1255 follow-on > 3% improvement and probably helps WebCore too.
1257 I made the following improvements, among others:
1259 - Made HashFunctions note whether it is ok to compare a real value with the equal() function
1260 to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
1262 - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
1263 std::pairs for cases that don't need them. There are now four versions, one for read-only access,
1264 two for writing, and one folded directly into add() (these all were improvments).
1266 - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
1268 - Made a special constructor for iterators that knows it points to
1269 a valid filled cell and so skips updating itself.
1271 - Reordered memory accesses in the various lookup functions for better code generation
1273 - Made simple translators avoid passing a hash code around
1275 - Other minor tweaks
1279 (WTF::HashTableConstIterator::HashTableConstIterator):
1280 (WTF::HashTableIterator::HashTableIterator):
1281 (WTF::IdentityHashTranslator::translate):
1282 (WTF::HashTable::end):
1283 (WTF::HashTable::lookup):
1284 (WTF::HashTable::lookupForWriting):
1285 (WTF::HashTable::makeKnownGoodIterator):
1286 (WTF::HashTable::makeKnownGoodConstIterator):
1288 (WTF::::lookupForWriting):
1289 (WTF::::fullLookupForWriting):
1291 (WTF::::addPassingHashCode):
1295 * kjs/identifier.cpp:
1297 * wtf/HashFunctions.h:
1305 * wtf/ListHashSet.h:
1306 (WTF::ListHashSetTranslator::translate):
1308 2007-10-27 Darin Adler <darin@apple.com>
1312 - fix ASCIICType.h for some Windows compiles
1314 * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
1315 compiler/library that has the wchar_t that is just a typedef.
1317 2007-10-27 Kevin McCullough <kmccullough@apple.com>
1320 - Forgot to change the build step when I changed the filename.
1322 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1324 2007-10-27 Geoffrey Garen <ggaren@apple.com>
1326 Reviewed by Darin Adler.
1328 Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
1330 http://bugs.webkit.org/show_bug.cgi?id=15718
1332 * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
1333 hash value. Also changed O(n) strlen to O(1) check for empty string.
1334 (KJS::Identifier::add):
1336 * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
1337 (KJS::UString::UString):
1338 (KJS::UString::operator=):
1340 2007-10-27 Darin Adler <darin@apple.com>
1344 - fix pow on Windows
1346 * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
1347 a "pow" function that does not properly handle the case where arg1 is
1350 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
1351 specify "::pow" -- just "pow" is fine.
1353 2007-10-27 Darin Adler <darin@apple.com>
1357 - http://bugs.webkit.org/show_bug.cgi?id=15711
1358 force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
1360 * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
1362 * kjs/object.h: Removed redundant includes.
1363 * kjs/value.h: Ditto.
1365 2007-10-27 Maciej Stachowiak <mjs@apple.com>
1369 - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
1370 http://bugs.webkit.org/show_bug.cgi?id=15718
1372 * kjs/identifier.cpp:
1373 (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
1374 now that we count on all Identifiers already having one.
1376 2007-10-27 Mark Rowe <mrowe@apple.com>
1380 * kjs/SymbolTable.h:
1382 2007-10-27 Mark Rowe <mrowe@apple.com>
1388 2007-10-26 Kevin McCullough <kmccullough@apple.com>
1390 Rubber stamp by Adam.
1392 - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
1393 files contain are functions that operate on BSTRs.
1395 * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
1396 * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
1397 * API/JSStringRefCOM.cpp: Removed.
1398 * API/JSStringRefCOM.h: Removed.
1399 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1401 2007-10-26 Kevin McCullough <kmccullough@apple.com>
1405 - Made JSStringCreateWithBSTR capable of handling null BSTRs.
1407 * API/JSStringRefCOM.cpp:
1408 (JSStringCreateWithBSTR):
1410 2007-10-26 Sam Weinig <sam@webkit.org>
1414 * kjs/SymbolTable.h: Add header gaurd.
1415 * kjs/nodes.h: #include "SymbolTable.h"
1417 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1419 Suggested by Anders Carlsson.
1424 (KJS::ActivationImp::getOwnPropertySlot):
1426 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1428 Suggested by Darin Adler.
1430 Use computedHash(), which is safer than just directly accessing _hash.
1433 (KJS::Lookup::findEntry):
1434 (KJS::Lookup::find):
1436 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1438 Build fix: svn add SymbolTable.h
1440 * kjs/SymbolTable.h: Added.
1441 (KJS::SymbolTable::set):
1442 (KJS::SymbolTable::get):
1444 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1446 Build fix: export SymbolTable.h to WebCore.
1448 * JavaScriptCore.xcodeproj/project.pbxproj:
1450 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1452 Comment tweak suggested by Maciej.
1455 (KJS::ActivationImp::getOwnPropertySlot):
1457 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1459 Reviewed by Maciej Stachowiak.
1461 Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
1463 * kjs/property_map.cpp: Use a special no branch accessor to the UString's
1464 hash value. Also, return immediately instead of branching to the end
1465 of the loop if the value is not found.
1466 (KJS::PropertyMap::get):
1467 (KJS::PropertyMap::getLocation):
1468 (KJS::PropertyMap::put):
1469 (KJS::PropertyMap::insert):
1470 (KJS::PropertyMap::remove):
1471 (KJS::PropertyMap::checkConsistency):
1474 (KJS::UString::Rep::computedHash): Special no branch accessor to the
1475 UString's hash value. Used when the caller knows that the hash value
1476 has already been computed. (For example, if the caller got the UString
1477 from an Identifier.)
1479 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1481 Reviewed by Maciej Stachowiak.
1483 Switched ActivationImp to using a symbol table. For now, though, all
1484 clients take the slow path.
1486 Net .6% speedup on SunSpider.
1489 - ActivationImp now mallocs in its constructor
1490 - Local variable hits use an extra level of indirection to retrieve
1492 - Local variable misses do two lookups
1495 - Fast initialization of local variables upon function entry
1497 * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
1500 (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
1501 data that won't fit in a JSCell.
1502 (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
1504 (KJS::ActivationImp::getOwnPropertySlot): ditto
1505 (KJS::ActivationImp::deleteProperty): ditto
1506 (KJS::ActivationImp::put): ditto
1507 (KJS::ActivationImp::createArgumentsObject): ditto
1509 (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
1510 our properties doesn't try to recursively mark us. (This caused a crash
1511 in earlier testing. Not sure why we haven't run into it before.)
1513 * kjs/nodes.cpp: Functions now build a symbol table the first time
1515 (KJS::VarDeclNode::evaluate):
1516 (KJS::FunctionBodyNode::FunctionBodyNode):
1517 (KJS::FunctionBodyNode::initializeSymbolTable):
1518 (KJS::FunctionBodyNode::processDeclarations):
1519 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
1520 (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
1523 (KJS::FunctionBodyNode::symbolTable):
1525 * wtf/Forward.h: Added Vector.
1527 2007-10-26 Kevin McCullough <kmccullough@apple.com>
1529 - Corrected function name mistake in this changelog.
1531 2007-10-26 Kevin McCullough <kmccullough@apple.com>
1532 Reviewed by Sam and Steve.
1534 - Added convenience methods for converting between BSTR and JSStringRefs
1536 * API/JSStringRefCOM.cpp: Added.
1537 (JSStringCreateWithBSTR):
1539 * API/JSStringRefCOM.h: Added.
1540 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1542 2007-10-26 Mark Rowe <mrowe@apple.com>
1546 * kjs/collector.cpp:
1547 (KJS::Collector::collect):
1549 2007-10-26 Oliver Hunt <oliver@apple.com>
1553 Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
1555 * kjs/CollectorHeapIntrospector.cpp:
1556 (KJS::CollectorHeapIntrospector::init):
1557 (KJS::CollectorHeapIntrospector::enumerate):
1558 * kjs/CollectorHeapIntrospector.h:
1559 * kjs/collector.cpp:
1560 (KJS::Collector::recordExtraCost):
1561 (KJS::Collector::heapAllocate):
1562 (KJS::Collector::allocate):
1563 (KJS::Collector::allocateNumber):
1564 (KJS::Collector::registerThread):
1565 (KJS::Collector::markStackObjectsConservatively):
1566 (KJS::Collector::markMainThreadOnlyObjects):
1567 (KJS::Collector::sweep):
1568 (KJS::Collector::collect):
1571 (KJS::NumberImp::operator new):
1572 Force numbers to be allocated in the secondary heap.
1574 2007-10-26 Maciej Stachowiak <mjs@apple.com>
1578 - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
1581 (KJS::JSValue::getUInt32):
1582 (KJS::JSValue::getTruncatedInt32):
1583 (KJS::JSValue::toNumber):
1585 (WTF::PassRefPtr::~PassRefPtr):
1587 (WTF::RefPtr::operator->):
1589 2007-10-26 Mark Rowe <mrowe@apple.com>
1595 2007-10-26 Maciej Stachowiak <mjs@apple.com>
1599 - Merge Context class fully into ExecState, since they are always created and used together.
1601 No measurable performance impact but this is a useful cleanup.
1603 * JavaScriptCore.pri:
1604 * kjs/ExecState.cpp:
1605 (KJS::ExecState::ExecState):
1606 (KJS::ExecState::~ExecState):
1607 (KJS::ExecState::mark):
1608 (KJS::ExecState::lexicalInterpreter):
1610 (KJS::ExecState::dynamicInterpreter):
1611 (KJS::ExecState::setException):
1612 (KJS::ExecState::clearException):
1613 (KJS::ExecState::exception):
1614 (KJS::ExecState::exceptionSlot):
1615 (KJS::ExecState::hadException):
1616 (KJS::ExecState::scopeChain):
1617 (KJS::ExecState::callingExecState):
1618 (KJS::ExecState::propertyNames):
1619 * kjs/collector.cpp:
1620 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
1622 (KJS::FunctionImp::callAsFunction):
1623 (KJS::FunctionImp::argumentsGetter):
1624 (KJS::FunctionImp::callerGetter):
1625 (KJS::GlobalFuncImp::callAsFunction):
1626 * kjs/interpreter.cpp:
1627 (KJS::Interpreter::Interpreter):
1628 (KJS::Interpreter::init):
1629 (KJS::Interpreter::evaluate):
1630 (KJS::Interpreter::mark):
1631 * kjs/interpreter.h:
1632 (KJS::Interpreter::setCurrentExec):
1633 (KJS::Interpreter::currentExec):
1635 (KJS::currentSourceId):
1636 (KJS::currentSourceURL):
1637 (KJS::ThisNode::evaluate):
1638 (KJS::ResolveNode::evaluate):
1639 (KJS::FunctionCallResolveNode::evaluate):
1640 (KJS::PostfixResolveNode::evaluate):
1641 (KJS::DeleteResolveNode::evaluate):
1642 (KJS::TypeOfResolveNode::evaluate):
1643 (KJS::PrefixResolveNode::evaluate):
1644 (KJS::AssignResolveNode::evaluate):
1645 (KJS::VarDeclNode::evaluate):
1646 (KJS::DoWhileNode::execute):
1647 (KJS::WhileNode::execute):
1648 (KJS::ForNode::execute):
1649 (KJS::ForInNode::execute):
1650 (KJS::ContinueNode::execute):
1651 (KJS::BreakNode::execute):
1652 (KJS::ReturnNode::execute):
1653 (KJS::WithNode::execute):
1654 (KJS::SwitchNode::execute):
1655 (KJS::LabelNode::execute):
1656 (KJS::TryNode::execute):
1657 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
1658 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
1659 (KJS::FunctionBodyNode::processDeclarations):
1660 (KJS::FuncDeclNode::makeFunction):
1661 (KJS::FuncExprNode::evaluate):
1663 2007-10-26 Mark Rowe <mrowe@apple.com>
1667 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1669 2007-10-26 Mark Rowe <mrowe@apple.com>
1673 * JavaScriptCore.pri:
1674 * kjs/ExecState.cpp:
1676 2007-10-26 Maciej Stachowiak <mjs@apple.com>
1680 - moved Context class into ExecState.{h,cpp} in preparation for merging
1681 ExecState and Context classes.
1683 * kjs/ExecState.h: Moved CodeType enum and Context class here in
1684 preparation for merging ExecState and Context.
1685 * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
1686 (KJS::Context::Context):
1687 (KJS::Context::~Context):
1688 (KJS::Context::mark):
1689 * kjs/context.h: Removed.
1690 * kjs/Context.cpp: Removed.
1691 * kjs/function.h: Removed CodeType enum.
1692 * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
1693 * kjs/internal.h: Removed LabelStack.
1694 * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
1695 * kjs/collector.cpp: Fixed includes.
1696 * kjs/function.cpp: ditto
1697 * kjs/internal.cpp: ditto
1698 * kjs/interpreter.cpp: ditto
1699 * kjs/lookup.h: ditto
1700 * kjs/nodes.cpp: ditto
1702 2007-10-26 Mark Rowe <mrowe@apple.com>
1706 * kjs/string_object.cpp:
1707 (KJS::StringObjectFuncImp::callAsFunction):
1709 2007-10-25 Darin Adler <darin@apple.com>
1713 - http://bugs.webkit.org/show_bug.cgi?id=15703
1714 fix numeric functions -- improve correctness and speed
1716 Gives about 1% gain on SunSpider.
1718 * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
1719 (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
1720 with both immediate and number values.
1721 (KJS::JSValue::toUInt32): Ditto.
1723 (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
1724 differences. One is that it now correctly returns 0 for NaN, and another is that
1725 there's no special case for 0 or infinity, since the general case already handles
1727 (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
1729 (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
1730 truncation done by the typecast already does the necessary truncation that
1731 roundValue was doing.
1732 (KJS::JSValue::toUInt32SlowCase): Ditto.
1733 (KJS::JSValue::toUInt16): Removed.
1735 * kjs/internal.h: Removed roundValue.
1736 * kjs/internal.cpp: Ditto.
1738 * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
1739 code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
1741 * kjs/date_object.cpp:
1742 (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
1743 toNumber as specified.
1744 (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
1745 with a call to toNumber and timeClip as specified.
1746 (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
1747 where the default behavior of toInt32 (returning 0) was already correct. Replaced
1748 call to roundValue with a call to toNumber as specified.
1749 (KJS::DateObjectFuncImp::callAsFunction): Ditto.
1751 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
1752 cases for the pow function that the library already handles correctly.
1754 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
1755 call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
1756 The real toInteger now returns 0 for NaN. Took out unneeded special case in
1757 ToFixed for undefined; was only needed because our toInteger was wrong. Same
1758 thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
1760 * kjs/string_object.cpp:
1761 (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
1762 cases for undefined that were only needed because toInteger was wrong. Same in
1763 IndexOf, and was able to remove some special cases. In LastIndexOf, used
1764 toIntegerPreserveNaN, but was able to remove some special cases there too.
1765 Changed Substr implementation to preserve correct behavior with the change
1766 to toInteger and match the specification. Also made sure we weren't converting
1767 an out of range double to an int.
1768 (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
1769 toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
1770 no reason to have toUInt16 as a second, less-optimized function that's only
1771 called at this one call site.
1773 * wtf/MathExtras.h: Added trunc function for Windows.
1775 2007-10-25 Geoffrey Garen <ggaren@apple.com>
1777 Reviewed by Maciej Stachowiak.
1779 Tweaked the inner hashtable lookup loop to remove a branch in the "not
1780 found" case. .5% speedup on SunSpider.
1782 * JavaScriptCore.xcodeproj/project.pbxproj:
1786 2007-10-25 Maciej Stachowiak <mjs@apple.com>
1790 - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
1793 (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
1794 adding any value over toNumber() here.
1795 (KJS::valueForReadModifyAssignment): Ditto.
1796 (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
1798 (KJS::lessThanEq): Ditto.
1799 * JavaScriptCore.exp: Export new functions as needed.
1801 (KJS::JSValue::toPrimitive): Fixed formatting.
1802 (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
1803 to number and tells you whether a toPrimitive() conversion with a Number hint
1804 would have given a string.
1806 (KJS::StringImp::getPrimitiveNumber): Implemented.
1807 (KJS::NumberImp::getPrimitiveNumber): ditto
1808 (KJS::GetterSetterImp::getPrimitiveNumber): ditto
1809 (KJS::StringImp::toPrimitive): Fixed formatting.
1810 (KJS::NumberImp::toPrimitive): ditto
1811 (KJS::GetterSetterImp::toPrimitive): ditto
1814 (KJS::JSObject::getPrimitiveNumber): Implemented.
1817 2007-10-25 Sam Weinig <sam@webkit.org>
1819 Reviewed by Adam Roben.
1821 Remove JSStringRefCFHack from windows as it is no longer needed.
1823 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1825 2007-10-25 Geoffrey Garen <ggaren@apple.com>
1827 Reviewed by Oliver Hunt.
1829 Rolled out my last patch. It turns out that I needed 2 words, not 1,
1832 2007-10-25 Geoffrey Garen <ggaren@apple.com>
1834 Reviewed by Oliver Hunt.
1836 Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
1837 Shrink the size of an activation object by 1 word
1839 This is in preparation for adding a symbol table to the activation
1842 The basic strategy here is to rely on the mutual exclusion between
1843 the arguments object pointer and the function pointer (you only need
1844 the latter in order to create the former), and store them in the same
1845 place. The LazyArgumentsObject class encapsulates this strategy.
1847 Also inlined the ArgumentsImp constructor, for good measure.
1849 SunSpider reports no regression. Regression tests pass.
1851 * JavaScriptCore.xcodeproj/project.pbxproj:
1853 (KJS::Context::~Context):
1855 (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
1856 (KJS::ActivationImp::LazyArgumentsObject::mark):
1858 (KJS::ActivationImp::argumentsGetter):
1859 (KJS::ActivationImp::mark):
1861 (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
1862 (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
1863 (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
1864 (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
1865 (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
1866 (KJS::ActivationImp::LazyArgumentsObject::setFunction):
1867 (KJS::ActivationImp::LazyArgumentsObject::function):
1868 (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
1869 (KJS::ActivationImp::LazyArgumentsObject::):
1870 (KJS::ActivationImp::ActivationImp::ActivationImp):
1871 (KJS::ActivationImp::resetArguments):
1873 2007-10-25 Adam Roben <aroben@apple.com>
1875 Change JavaScriptCore.vcproj to use DerivedSources.make
1877 We were trying to emulate the logic of make in
1878 build-generated-files.sh, but we got it wrong. We now use a
1879 build-generated-files very much like the one that WebCore uses to
1882 We also now only have a Debug configuration of dftables which we build
1883 even when doing a Release build of JavaScriptCore. dftables also no
1884 longer has the "_debug" name suffix.
1886 Changes mostly made by Darin, reviewed by me.
1888 * DerivedSources.make: Add a variable to set the extension used for
1889 the dftables executable.
1890 * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
1891 dftables in Release configurations.
1892 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
1893 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1894 - Updated include path to point to the new location of the derived
1896 - Modified pre-build event to pass the right arguments to
1897 build-generated-files.sh and not call dftables directly.
1898 - Added the derived source files to the project.
1899 - Removed grammarWrapper.cpp, which isn't needed now that we're
1900 compiling grammar.cpp directly.
1901 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
1902 Slightly modified from the WebCore version.
1903 * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
1904 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
1905 - Changed the output location to match Mac.
1906 - Removed the Release configuration.
1907 - Removed the _debug suffix.
1909 2007-10-25 Geoffrey Garen <ggaren@apple.com>
1911 Reviewed by Eric Seidel.
1913 Slightly elaborated the differences between declaration procesing in
1914 Function Code and Program Code.
1916 .3% speedup on SunSpider.
1919 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
1920 (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
1921 minimum set of attributes instead of recomputing all the time. Also,
1922 ignore m_parameters, since programs don't have arguments.
1924 2007-10-25 Eric Seidel <eric@webkit.org>
1928 More preparation work before adding long-running mode to testkjs.
1931 (TestFunctionImp::callAsFunction):
1932 (prettyPrintScript):
1936 (fillBufferWithContentsOfFile):
1938 2007-10-25 Eric Seidel <eric@webkit.org>
1942 Bring testkjs code out of the dark ages in preparation for more
1943 radical improvements (like long-running testing support!)
1946 (TestFunctionImp::callAsFunction):
1949 (fillBufferWithContentsOfFile):
1951 2007-10-25 Geoffrey Garen <ggaren@apple.com>
1953 Reviewed by Maciej Stachowiak.
1955 Make a fast path for declaration processing inside Function Code.
1957 Lifted declaration processing code up from individual declaration nodes
1958 and into processDeclarations.
1960 Broke out processDeclarations into two cases, depending on the type of
1961 code. This eliminates 2 branches, and facilitates more radical
1962 divergeance in the future.
1964 2.5% SunSpider speedup.
1966 * JavaScriptCore.xcodeproj/project.pbxproj:
1968 (KJS::FunctionBodyNode::initializeDeclarationStacks):
1969 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
1970 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
1971 (KJS::FunctionBodyNode::execute):
1972 (KJS::FuncDeclNode::makeFunction):
1976 2007-10-25 Maciej Stachowiak <mjs@apple.com>
1980 - add header includes needed on platforms that don't use AllInOneFile.cpp
1982 * API/JSCallbackObject.cpp:
1984 * kjs/ExecState.cpp:
1985 * kjs/array_instance.cpp:
1986 * kjs/function_object.cpp:
1987 * kjs/interpreter.cpp:
1990 2007-10-25 Eric Seidel <eric@webkit.org>
1994 * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
1996 2007-10-25 Geoffrey Garen <ggaren@apple.com>
1998 Reviewed by Maciej Stachowiak.
2000 Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
2001 Re-order declaration initialization to avoid calling hasProperty inside
2002 VarDeclNode::processDeclaration
2004 .7% speedup on SunSpider.
2007 * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
2008 other processing of declared symbols, so the order of execution could
2012 (KJS::VarDeclNode::getDeclarations): Added special case for the
2013 "arguments" property name, explained in the comment.
2015 (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
2016 in the case of function code, since we know the declared symbol
2017 management will resolve conflicts between symbols. Yay!
2019 (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
2020 implementation of getDeclarations is non-trivial, we can't take a
2021 short-cut here any longer -- we need to put the VarDecl node on the
2022 stack so it gets processed normally.
2024 (KJS::FunctionBodyNode::processDeclarations): Changed the order of
2025 processing to enforce mutual exclusion rules.
2028 (KJS::DeclarationStacks::DeclarationStacks): Structure includes an
2029 ExecState now, for fast access to the "arguments" property name.
2031 2007-10-24 Eric Seidel <eric@webkit.org>
2035 Add a JSGlobalObject class and remove the InterpreterMap
2036 http://bugs.webkit.org/show_bug.cgi?id=15681
2038 This required making JSCallbackObject a template class to allow for
2039 JSGlobalObjects with JSCallbackObject functionality.
2041 SunSpider claims this was a 0.5% speedup.
2043 * API/JSCallbackObject.cpp:
2045 * API/JSCallbackObject.h:
2046 * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
2047 (KJS::::JSCallbackObject):
2049 (KJS::::~JSCallbackObject):
2050 (KJS::::initializeIfNeeded):
2052 (KJS::::getOwnPropertySlot):
2054 (KJS::::deleteProperty):
2055 (KJS::::implementsConstruct):
2057 (KJS::::implementsHasInstance):
2058 (KJS::::hasInstance):
2059 (KJS::::implementsCall):
2060 (KJS::::callAsFunction):
2061 (KJS::::getPropertyNames):
2064 (KJS::::setPrivate):
2065 (KJS::::getPrivate):
2067 (KJS::::cachedValueGetter):
2068 (KJS::::staticValueGetter):
2069 (KJS::::staticFunctionGetter):
2070 (KJS::::callbackGetter):
2071 * API/JSClassRef.cpp:
2072 (OpaqueJSClass::prototype):
2073 * API/JSContextRef.cpp:
2074 (JSGlobalContextCreate):
2075 * API/JSObjectRef.cpp:
2077 (JSObjectGetPrivate):
2078 (JSObjectSetPrivate):
2079 * API/JSValueRef.cpp:
2080 (JSValueIsObjectOfClass):
2081 * JavaScriptCore.exp:
2082 * JavaScriptCore.xcodeproj/project.pbxproj:
2083 * bindings/c/c_utility.cpp:
2084 (KJS::Bindings::convertValueToNPVariant):
2085 * bindings/jni/jni_jsobject.cpp:
2086 * bindings/objc/objc_utility.mm:
2087 (KJS::Bindings::convertValueToObjcValue):
2089 (KJS::Context::Context):
2090 * kjs/ExecState.cpp:
2091 (KJS::ExecState::lexicalInterpreter):
2092 * kjs/JSGlobalObject.h: Added.
2093 (KJS::JSGlobalObject::JSGlobalObject):
2094 (KJS::JSGlobalObject::isGlobalObject):
2095 (KJS::JSGlobalObject::interpreter):
2096 (KJS::JSGlobalObject::setInterpreter):
2097 * kjs/array_instance.cpp:
2100 (KJS::FunctionImp::callAsFunction):
2101 (KJS::GlobalFuncImp::callAsFunction):
2102 * kjs/interpreter.cpp:
2103 (KJS::Interpreter::Interpreter):
2104 (KJS::Interpreter::init):
2105 (KJS::Interpreter::~Interpreter):
2106 (KJS::Interpreter::globalObject):
2107 (KJS::Interpreter::initGlobalObject):
2108 (KJS::Interpreter::evaluate):
2109 * kjs/interpreter.h:
2111 (KJS::cacheGlobalObject):
2113 (KJS::JSObject::isGlobalObject):
2116 2007-10-24 Eric Seidel <eric@webkit.org>
2118 Build fix for Gtk, no review.
2120 * kjs/collector.cpp: #include "context.h"
2122 2007-10-24 Eric Seidel <eric@webkit.org>
2126 Stop checking isOutOfMemory after every allocation, instead let the collector
2127 notify all ExecStates if we ever hit this rare condition.
2129 SunSpider claims this was a 2.2% speedup.
2131 * kjs/collector.cpp:
2132 (KJS::Collector::collect):
2133 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
2136 (KJS::TryNode::execute):
2138 2007-10-24 Mark Rowe <mrowe@apple.com>
2142 * kjs/identifier.h: Remove extra qualification.
2144 2007-10-24 Geoffrey Garen <ggaren@apple.com>
2146 Reviewed by Sam Weinig.
2148 Disable ALWAYS_INLINE in debug builds, since it drives the debugger
2151 * wtf/AlwaysInline.h:
2153 2007-10-24 Geoffrey Garen <ggaren@apple.com>
2155 Reviewed by Sam Weinig.
2157 Inlined the fast path for creating an Identifier from an Identifier.
2159 This is a .4% speedup on SunSpider overall, but as big as a 2.5%
2160 speedup on certain individual tests. 65% of the Identifiers creating
2161 by SunSpider are already Identifiers.
2163 (The main reason I'm making this change is that it resolves a large
2164 regression in a patch I haven't checked in yet.)
2166 * JavaScriptCore.exp:
2167 * kjs/identifier.cpp:
2168 (KJS::Identifier::addSlowCase):
2170 (KJS::Identifier::Identifier::add):
2172 2007-10-24 Lars Knoll <lars@trolltech.com>
2176 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.
2178 * bindings/qt/qt_instance.cpp:
2179 (KJS::Bindings::QtInstance::invokeMethod):
2180 * bindings/qt/qt_runtime.cpp:
2181 (KJS::Bindings::convertValueToQVariant):
2182 (KJS::Bindings::QtField::setValueToInstance):
2184 2007-10-24 Oliver Hunt <oliver@apple.com>
2188 Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
2193 (KJS::LessNode::evaluate):
2194 (KJS::GreaterNode::evaluate):
2195 (KJS::LessEqNode::evaluate):
2196 (KJS::GreaterEqNode::evaluate):
2197 * kjs/operations.cpp:
2200 2007-10-24 Eric Seidel <eric@webkit.org>
2205 (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
2207 2007-10-24 Darin Adler <darin@apple.com>
2211 * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
2212 Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
2214 2007-10-24 Darin Adler <darin@apple.com>
2218 - separate out the code to create a hash table the first time from the code
2221 SunSpider claims this was a 0.7% speedup.
2223 * kjs/property_map.cpp:
2224 (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
2225 (KJS::PropertyMap::createTable): Added. For the case where we had no table.
2226 (KJS::PropertyMap::rehash): Removed code needed only in the case where we
2228 * kjs/property_map.h: Added createTable.
2230 2007-10-24 Eric Seidel <eric@webkit.org>
2234 Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
2235 which can be represented by JSImmediate.
2237 SunSpider claims this was a 0.6% speedup.
2241 (KJS::NumberNode::evaluate):
2242 (KJS::ImmediateNumberNode::evaluate):
2245 (KJS::ImmediateNumberNode::):
2246 * kjs/nodes2string.cpp:
2247 (ImmediateNumberNode::streamTo):
2249 2007-10-24 Darin Adler <darin@apple.com>
2253 - http://bugs.webkit.org/show_bug.cgi?id=15657
2254 change static hash tables to use powers of two for speed
2256 Seems to give 0.7% SunSpider speedup.
2258 * kjs/create_hash_table: Updated to generate new format.
2260 (KJS::keysMatch): Took out unneeded typecast.
2261 (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
2262 Replaced the modulus with a bit mask.
2263 (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
2264 their hash -- saves a branch.
2265 (KJS::Lookup::find): Ditto.
2266 * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
2268 2007-10-24 Maciej Stachowiak <mjs@apple.com>
2272 - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
2275 (KJS::DoWhileNode::execute):
2276 (KJS::WhileNode::execute):
2277 (KJS::ForNode::execute):
2278 (KJS::ForInNode::execute):
2279 (KJS::SourceElementsNode::execute):
2281 2007-10-23 Darin Adler <darin@apple.com>
2285 * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
2286 Changed an && to an & for a 1% gain in SunSpider.
2288 2007-10-23 Oliver Hunt <oliver@apple.com>
2292 Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
2295 (KJS::MultNode::evaluate):
2296 (KJS::DivNode::evaluate):
2297 (KJS::ModNode::evaluate):
2300 (KJS::AddNode::evaluate):
2301 (KJS::SubNode::evaluate):
2302 (KJS::valueForReadModifyAssignment):
2303 * kjs/operations.cpp:
2306 2007-10-23 Oliver Hunt <oliver@apple.com>
2310 Separating all of the simple (eg. non-read-modify-write) binary operators
2311 into separate classes in preparation for further JS optimisations.
2313 Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
2316 * JavaScriptCore.xcodeproj/project.pbxproj:
2319 (KJS::MultNode::evaluate):
2320 (KJS::DivNode::evaluate):
2321 (KJS::ModNode::evaluate):
2322 (KJS::AddNode::evaluate):
2323 (KJS::SubNode::evaluate):
2324 (KJS::LeftShiftNode::evaluate):
2325 (KJS::RightShiftNode::evaluate):
2326 (KJS::UnsignedRightShiftNode::evaluate):
2327 (KJS::LessNode::evaluate):
2328 (KJS::GreaterNode::evaluate):
2329 (KJS::LessEqNode::evaluate):
2330 (KJS::GreaterEqNode::evaluate):
2331 (KJS::InstanceOfNode::evaluate):
2332 (KJS::InNode::evaluate):
2333 (KJS::EqualNode::evaluate):
2334 (KJS::NotEqualNode::evaluate):
2335 (KJS::StrictEqualNode::evaluate):
2336 (KJS::NotStrictEqualNode::evaluate):
2337 (KJS::BitAndNode::evaluate):
2338 (KJS::BitXOrNode::evaluate):
2339 (KJS::BitOrNode::evaluate):
2340 (KJS::LogicalAndNode::evaluate):
2341 (KJS::LogicalOrNode::evaluate):
2348 (KJS::LeftShiftNode::):
2349 (KJS::RightShiftNode::):
2350 (KJS::UnsignedRightShiftNode::):
2352 (KJS::GreaterNode::):
2353 (KJS::LessEqNode::):
2354 (KJS::GreaterEqNode::):
2355 (KJS::InstanceOfNode::):
2358 (KJS::NotEqualNode::):
2359 (KJS::StrictEqualNode::):
2360 (KJS::NotStrictEqualNode::):
2361 (KJS::BitAndNode::):
2363 (KJS::BitXOrNode::):
2364 (KJS::LogicalAndNode::):
2365 (KJS::LogicalOrNode::):
2366 * kjs/nodes2string.cpp:
2367 (MultNode::streamTo):
2368 (DivNode::streamTo):
2369 (ModNode::streamTo):
2370 (AddNode::streamTo):
2371 (SubNode::streamTo):
2372 (LeftShiftNode::streamTo):
2373 (RightShiftNode::streamTo):
2374 (UnsignedRightShiftNode::streamTo):
2375 (LessNode::streamTo):
2376 (GreaterNode::streamTo):
2377 (LessEqNode::streamTo):
2378 (GreaterEqNode::streamTo):
2379 (InstanceOfNode::streamTo):
2381 (EqualNode::streamTo):
2382 (NotEqualNode::streamTo):
2383 (StrictEqualNode::streamTo):
2384 (NotStrictEqualNode::streamTo):
2385 (BitAndNode::streamTo):
2386 (BitXOrNode::streamTo):
2387 (BitOrNode::streamTo):
2388 (LogicalAndNode::streamTo):
2390 2007-10-23 Darin Adler <darin@apple.com>
2394 - fix http://bugs.webkit.org/show_bug.cgi?id=15639
2395 fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
2397 Test: fast/js/math.html
2399 * kjs/math_object.cpp: (MathFuncImp::callAsFunction):
2400 Fix abs to look at the sign bit. Add a special case for values in the range
2401 between -0 and -1 and a special case for ceil and for -0 for floor.
2403 2007-10-23 Darin Adler <darin@apple.com>
2407 - streamline exception handling code for a >1% speed-up of SunSpider
2409 * kjs/nodes.cpp: Changed macros to use functions for everything that's not
2410 part of normal execution. We'll take function call overhead when propagating
2411 an exception or out of memory.
2412 (KJS::createOutOfMemoryCompletion): Added.
2413 (KJS::substitute): Use append instead of the relatively inefficient + operator.
2414 (KJS::Node::rethrowException): Added.
2415 * kjs/nodes.h: Added rethrowException.
2417 2007-10-22 Darin Adler <darin@apple.com>
2421 - fix http://bugs.webkit.org/show_bug.cgi?id=15636
2422 some JavaScriptCore regression tests are failing due to numeric conversion
2424 This should restore correctness and make speed better too, restoring some
2425 of the optimization we lost in my last check-in.
2427 * kjs/JSImmediate.h:
2428 (KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
2429 I used in my patch yesterday.
2430 (KJS::JSImmediate::getTruncatedUInt32): Ditto.
2432 * kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
2434 (KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
2435 a way to write this more efficiently for float.
2436 (KJS::NumberImp::getTruncatedInt32): Added.
2437 (KJS::NumberImp::getTruncatedUInt32): Added.
2439 * kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
2440 (KJS::JSValue::getUInt32):
2441 (KJS::JSValue::getTruncatedInt32): Added.
2442 (KJS::JSValue::getTruncatedUInt32): Added.
2443 (KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
2444 (KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
2446 (KJS::JSCell::getTruncatedInt32): Added.
2447 (KJS::JSCell::getTruncatedUInt32): Added.
2448 (KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
2449 (KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
2451 (KJS::JSValue::toUInt32SlowCase): Ditto.
2452 (KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
2454 * JavaScriptCore.exp: Updated.
2456 2007-10-22 Darin Adler <darin@apple.com>
2460 - fix http://bugs.webkit.org/show_bug.cgi?id=15632
2461 js1_5/Array/array-001.js test failing
2463 One of the JavaScriptCore tests was failing; it failed because of
2464 my change to NumberImp::getUInt32. The incorrect code I copied was
2465 from JSImmediate::getUInt32, and was a pre-existing bug.
2467 This patch fixes correctness, but will surely slow down SunSpider.
2468 We may be able to code this tighter and get the speed back.
2470 * kjs/JSImmediate.h:
2471 (KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
2472 reflect the fact that this function only returns true if the value is
2473 accurate (no fractional part, etc.). Changed code so that it returns
2474 false when the value has a fraction.
2475 (KJS::JSImmediate::getUInt32): Ditto.
2478 (KJS::NumberImp::getInt32): Changed code so that it returns false when
2479 the value has a fraction. Restores the old behavior.
2480 (KJS::NumberImp::getUInt32): Ditto.
2483 (KJS::JSValue::getInt32): Updated for name change.
2484 (KJS::JSValue::getUInt32): Ditto.
2485 (KJS::JSValue::toInt32): Ditto.
2486 (KJS::JSValue::toUInt32): Ditto.
2488 2007-10-22 Darin Adler <darin@apple.com>
2492 - fix crash seen when running JavaScriptCore tests
2494 * kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
2495 Copy and paste error: I accidentally had code here that was
2496 making a copy of the HashMap -- that's illegal inside a mark
2497 function and was unnecessary. The other callsite was modifying
2498 the map as it iterated it, but this function is not.
2500 2007-10-22 Maciej Stachowiak <mjs@apple.com>
2504 - Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
2505 http://bugs.webkit.org/show_bug.cgi?id=15627
2507 * kjs/JSImmediate.h:
2508 (KJS::JSImmediate::fromDouble): Avoid moving floats to integer
2509 registers since this is very slow.
2511 2007-10-22 Darin Adler <darin@apple.com>
2513 Reviewed by Eric Seidel.
2515 - http://bugs.webkit.org/show_bug.cgi?id=15617
2516 improve speed of integer conversions
2518 Makes SunSpider 6% faster.
2520 * kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
2523 (KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
2525 * kjs/internal.h: Added getInt32.
2527 (KJS::NumberImp::getInt32): Added.
2528 (KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
2529 stolen from JSValue.
2532 (KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
2534 (KJS::JSValue::getInt32): Added.
2535 (KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
2536 to avoid converting from float to double.
2537 (KJS::JSValue::toInt32): Made inline, separated out the slow case.
2538 (KJS::JSValue::toUInt32): Ditto.
2540 (KJS::JSCell::getInt32): Added.
2541 (KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
2542 new getInt32. Added a faster case for in-range numbers.
2543 (KJS::JSValue::toUInt32SlowCase): Ditto.
2544 (KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
2546 * JavaScriptCore.exp: Updated for changes.
2548 2007-10-22 Adam Roben <aroben@apple.com>
2552 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
2553 warning about implicit conversion to bool.
2555 2007-10-22 Mark Rowe <mrowe@apple.com>
2559 * kjs/array_instance.cpp:
2561 2007-10-22 Darin Adler <darin@apple.com>
2565 - http://bugs.webkit.org/show_bug.cgi?id=15606
2566 make cut-off for sparse vs. dense arrays smarter for speed with large arrays
2568 Makes the morph test in SunSpider 26% faster, and the overall
2569 benchmark 3% faster.
2571 This also fixes some small problems we had with the distinction
2572 between nonexistent and undefined values in arrays.
2574 * kjs/array_instance.h: Tweaked formatting and naming.
2575 * kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
2576 (KJS::storageSize): Added. Computes the size of the storage given a vector length.
2577 (KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
2578 (KJS::isDenseEnoughForVector): Added.
2579 (KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
2580 (KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
2581 (KJS::ArrayInstance::getItem): Updated for name changes.
2582 (KJS::ArrayInstance::lengthGetter): Ditto.
2583 (KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
2584 getOwnPropertySlot to share more code.
2585 (KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
2586 (KJS::ArrayInstance::put): Added logic for extending the vector as long as the
2587 array is dense enough. Also keep m_numValuesInVector up to date.
2588 (KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
2590 (KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
2591 for array indices with undefined values.
2592 (KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
2593 simplified to only handle getting larger.
2594 (KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
2595 zero out the unused part of the vector and to delete the map if it's no longer
2597 (KJS::ArrayInstance::mark): Tweaked formatting.
2598 (KJS::compareByStringForQSort): Ditto.
2599 (KJS::ArrayInstance::sort): Ditto.
2600 (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
2602 (KJS::compareWithCompareFunctionForQSort): Ditto.
2603 (KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
2604 undefined values into nonexistent values in some cases.
2606 * kjs/array_object.h: Removed MAX_ARRAY_INDEX.
2607 * kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
2609 * JavaScriptCore.pri: Added array_instance.cpp.
2610 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
2611 * kjs/AllInOneFile.cpp: Ditto.
2613 2007-10-22 Andrew Wellington <proton@wiretapped.net>
2615 Reviewed by Mark Rowe.
2617 Fix for local database support after r26879
2618 Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
2620 * Configurations/JavaScriptCore.xcconfig:
2622 2007-10-22 Simon Hausmann <hausmann@kde.org>
2626 Build fix for the non-qmake builds.
2628 * wtf/Platform.h: Default to enabling the database features unless
2629 otherwise specified. (similar to ENABLE_ICONDATABASE)
2631 2007-10-22 Holger Freyther <zecke@selfish.org>
2633 Reviewed by Simon Hausmann <hausmann@kde.org>.
2635 * Do not build testkjs as an application bundle. This is
2636 needed for run-javascriptcore-tests on OSX.
2637 * Also, based on r26633, allow to test the WebKit/Qt port on OSX.
2638 * Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
2639 as we do not have -rpath on OSX.
2643 2007-10-21 Mark Rowe <mrowe@apple.com>
2647 http://bugs.webkit.org/show_bug.cgi?id=15575
2648 Bug 15575: [GTK] Implement threading using GThread
2650 * wtf/Platform.h: Do not enable pthreads for Gtk.
2652 2007-10-21 Mark Rowe <mrowe@apple.com>
2656 Fix http://bugs.webkit.org/show_bug.cgi?id=15603
2657 Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
2659 * kjs/array_object.cpp:
2660 (KJS::freeStorage): Reinstate null-check that was removed in r26847.
2662 2007-10-21 Darin Adler <darin@apple.com>
2666 * kjs/array_instance.h: Removed unused ExecState parameter.
2667 * kjs/array_object.cpp:
2668 (KJS::ArrayInstance::put): Ditto.
2669 (KJS::ArrayInstance::setLength): Ditto.
2671 2007-10-21 Darin Adler <darin@apple.com>
2673 * kjs/array_object.cpp: (KJS::ArrayInstance::put):
2674 Add missing assignment that was causing regression test crash.
2676 2007-10-21 Darin Adler <darin@apple.com>
2680 - http://bugs.webkit.org/show_bug.cgi?id=15585
2681 speed up sparse arrays by using a custom map
2683 Speeds up SunSpider by 10%.
2685 * kjs/array_object.cpp:
2686 (allocateStorage): Leave room for an additional pointer.
2687 (reallocateStorage): Ditto.
2688 (freeStorage): Ditto.
2689 (ArrayInstance::~ArrayInstance): Delete the overflow map if present.
2690 (ArrayInstance::getItem): Read values from the overflow map if present.
2691 Removed the check of length, since it slows down the common case.
2692 (ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
2693 to the property map.
2694 (ArrayInstance::put): Write values into the overflow map as needed.
2695 Also create overflow map when needed.
2696 (ArrayInstance::deleteProperty): Remove values from the overflow map
2698 (ArrayInstance::getPropertyNames): Add a name for each identifier in
2699 the property map. This is extremely inefficient.
2700 (ArrayInstance::setLength): Remove any values in the overflow map
2701 that are past the new length, as we formerly did with the property map.
2702 (ArrayInstance::mark): Mark any values in the overflow map.
2703 (compareByStringForQSort): Removed unneeded undefined case, since
2704 compactForSorting guarantees we will have no undefined values.
2705 (compareWithCompareFunctionForQSort): Ditto.
2706 (ArrayInstance::compactForSorting): Copy all the values out of the
2707 overflow map and destroy it.
2709 * kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
2710 * kjs/property_map.cpp: Ditto.
2712 2007-10-20 Darin Adler <darin@apple.com>
2716 - http://bugs.webkit.org/show_bug.cgi?id=15579
2717 stop churning identifier reference counts copying Completion objects
2719 * kjs/completion.h: Replace the Identifier with an Identifier*.
2721 (ForInNode::execute): Update for change to Completion constructor.
2722 (ContinueNode::execute): Ditto.
2723 (BreakNode::execute): Ditto.
2725 2007-10-20 Mark Rowe <mrowe@apple.com>
2729 Gtk changes needed to enable HTML 5 client-side database storage.
2731 * wtf/Platform.h: Have Gtk use pthreads for now.
2733 2007-10-20 Geoffrey Garen <ggaren@apple.com>
2735 Reviewed by Maciej Stachowiak.
2737 Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
2738 Store gathered declaration nodes in the function body node.
2740 This means that you only have to gather the declaration nodes the first
2741 time the function executes. Performance gain of 2.10% on SunSpider,
2742 0.90% on command-line JS iBench.
2744 * kjs/nodes.cpp: Split declaration stack initialization code off into
2745 initializeDeclarationStacks().
2746 (FunctionBodyNode::FunctionBodyNode):
2747 (FunctionBodyNode::initializeDeclarationStacks):
2748 (FunctionBodyNode::processDeclarations):
2750 * kjs/nodes.h: Changed DeclarationStacks structure to hold references,
2751 since the actual Vectors are now stored either on the stack or in the
2754 2007-10-19 Geoffrey Garen <ggaren@apple.com>
2756 Reviewed by Darin Adler.
2758 http://bugs.webkit.org/show_bug.cgi?id=15559
2759 Moved processDeclarations call into FunctionBodyNode::execute
2761 To improve encapsulation, moved processDeclarations call into
2762 FunctionBodyNode::execute. Also marked processDeclarations
2763 ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup
2764 on command-line JS iBench.
2767 (KJS::FunctionImp::callAsFunction):
2768 (KJS::GlobalFuncImp::callAsFunction):
2770 * kjs/interpreter.cpp:
2771 (KJS::Interpreter::evaluate):
2773 (FunctionBodyNode::execute):
2776 2007-10-19 Brady Eidson <beidson@apple.com>
2780 Queue -> Deque! and small style tweaks
2782 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
2783 * JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
2784 * wtf/Deque.h: Added.
2785 (WTF::DequeNode::DequeNode):
2786 (WTF::Deque::Deque):
2787 (WTF::Deque::~Deque):
2789 (WTF::Deque::isEmpty):
2790 (WTF::Deque::append):
2791 (WTF::Deque::prepend):
2792 (WTF::Deque::first):
2794 (WTF::Deque::removeFirst):
2795 (WTF::Deque::clear):
2796 * wtf/Queue.h: Removed.
2799 2007-10-19 Brady Eidson <beidson@apple.com>
2803 Added a simple LinkedList based Queue to wtf
2804 We can make a better, more sophisticated an efficient one later, but have
2805 needed one for some time, now!
2807 * JavaScriptCore.xcodeproj/project.pbxproj:
2808 * wtf/Queue.h: Added.
2809 (WTF::QueueNode::QueueNode):
2810 (WTF::Queue::Queue):
2811 (WTF::Queue::~Queue):
2813 (WTF::Queue::isEmpty):
2814 (WTF::Queue::append):
2815 (WTF::Queue::prepend):
2816 (WTF::Queue::first):
2818 (WTF::Queue::removeFirst):
2819 (WTF::Queue::clear):
2821 2007-10-19 Nikolas Zimmermann <zimmermann@kde.org>
2825 Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
2827 * kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
2829 2007-10-19 Simon Hausmann <hausmann@kde.org>
2833 Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
2834 Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
2837 (WTF::isASCIIAlpha):
2838 (WTF::isASCIIAlphanumeric):
2839 (WTF::isASCIIDigit):
2840 (WTF::isASCIIHexDigit):
2841 (WTF::isASCIILower):
2842 (WTF::isASCIISpace):
2843 (WTF::toASCIILower):
2844 (WTF::toASCIIUpper):
2846 2007-10-19 Simon Hausmann <hausmann@kde.org>
2850 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.
2854 2007-10-18 Maciej Stachowiak <mjs@apple.com>
2858 - use __declspec(thread) for fast thread-local storage on Windows
2860 - 2.2% speedup on sunspider (on Windows)
2861 - 7% speedup on the string section
2862 - 6% speedup on JS iBench
2864 - fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
2865 - fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
2868 * wtf/FastMalloc.cpp:
2869 (WTF::getThreadHeap):
2870 (WTF::setThreadHeap):
2871 (WTF::TCMalloc_ThreadCache::GetCache):
2872 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
2873 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2875 2007-10-17 Darin Adler <darin@apple.com>
2877 Reviewed by Mark Rowe.
2879 - fix http://bugs.webkit.org/show_bug.cgi?id=15543
2880 <rdar://problem/5545639> REGRESSION (r26697):
2881 GoogleDocs: Can't create new documents or open existing ones
2883 Test: fast/js/regexp-non-character.html
2885 * pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
2886 in the \u sequences -- not needed and actively harmful.
2888 2007-10-17 Anders Carlsson <andersca@apple.com>
2893 #define USE_PTHREADS on Mac.
2895 2007-10-17 Geoffrey Garen <ggaren@apple.com>
2897 Reviewed by Darin Adler.
2899 Merged DeclaredFunctionImp into FunctionImp (the base class) because
2900 the distinction between the two was unused.
2902 Removed codeType() from FunctionImp because FunctionImp and its
2903 subclasses all returned FunctionCode, so it was unused, practically
2906 Removed a different codeType() from GlobalFuncImp because it was unused.
2907 (Perhaps it was vestigial from a time when GlobalFuncImp used to
2908 inherit from FunctionImp.)
2910 * bindings/runtime_method.cpp:
2911 * bindings/runtime_method.h:
2914 (KJS::FunctionImp::FunctionImp):
2915 (KJS::FunctionImp::callAsFunction):
2916 (KJS::FunctionImp::construct):
2917 (KJS::FunctionImp::execute):
2918 (KJS::FunctionImp::processVarDecls):
2920 (KJS::FunctionImp::implementsConstruct):
2921 (KJS::FunctionImp::scope):
2922 * kjs/function_object.cpp:
2923 (FunctionProtoFunc::callAsFunction):
2924 (FunctionObjectImp::construct):
2926 (FuncDeclNode::processFuncDecl):
2927 (FuncExprNode::evaluate):
2929 2007-10-17 Adam Roben <aroben@apple.com>
2931 Windows build fix part 2.
2933 Fix was by Darin, reviewed by Anders and Adam.
2935 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
2936 FastMallocPCRE.cpp to the project, and let Visual Studio have its way
2937 with the post-build step.
2938 * pcre/pcre.h: Don't DLL export the entry points just because this
2939 is Win32 -- this is an internal copy of PCRE and should be private.
2940 * pcre/pcre_compile.c: Fix an uninitialized variable warning --
2941 there's no real problem but it's better to quiet the compiler by
2942 tweaking the code slightly than turn off the warning entirely.
2944 2007-10-17 Adam Roben <aroben@apple.com>
2950 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
2951 some mismatched signed/unsigned comparison warnings.
2953 (match): #if-out some labels that don't seem to exist.
2955 2007-10-17 Mark Rowe <mrowe@apple.com>
2959 * JavaScriptCore.pri: Add FastMallocPCRE.cpp.
2960 * pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which
2961 is currently unavailable for UTF-16.
2963 2007-10-16 Darin Adler <darin@apple.com>
2967 - merged PCRE changes between 6.4 and 6.5
2969 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2970 * JavaScriptCore.xcodeproj/project.pbxproj:
2971 Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c,
2972 pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c,
2973 pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c.
2979 * pcre/pcre-config.h:
2982 * pcre/pcre_compile.c:
2984 * pcre/pcre_fullinfo.c:
2986 * pcre/pcre_internal.h:
2987 * pcre/pcre_maketables.c:
2988 * pcre/pcre_ord2utf8.c:
2989 * pcre/pcre_tables.c:
2990 * pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c.
2991 * pcre/pcre_xclass.c:
2993 * pcre/ucpinternal.h:
2995 Updated with new versions from the PCRE 6.5 release, merged with changes.
2997 * pcre/pcre_config.c: Removed.
2998 * pcre/pcre_globals.c: Removed.
2999 * pcre/pcre_info.c: Removed.
3000 * pcre/pcre_printint.src: Removed.
3001 * pcre/pcre_refcount.c: Removed.
3002 * pcre/pcre_study.c: Removed.
3003 * pcre/pcre_try_flipped.c: Removed.
3004 * pcre/pcre_ucp_findchar.c: Removed.
3005 * pcre/pcre_version.c: Removed.
3007 2007-10-16 Geoffrey Garen <ggaren@apple.com>
3009 Reviewed by Darin Adler.
3011 Removed KJS_VERBOSE because it was getting in the way of readability,
3012 and the messages didn't seem very helpful.
3015 (KJS::FunctionImp::callAsFunction):
3016 (KJS::FunctionImp::passInParameters):
3020 (KJS::JSObject::put):
3023 2007-10-16 Geoffrey Garen <ggaren@apple.com>
3025 Reviewed by Darin Adler.
3027 Removed the Parameter class because it was a redundant wrapper around
3031 (KJS::FunctionImp::passInParameters):
3032 (KJS::FunctionImp::getParameterName):
3034 (FunctionBodyNode::addParam):
3036 (KJS::FunctionBodyNode::):
3038 2007-10-16 Geoffrey Garen <ggaren@apple.com>
3040 Reviewed by Darin Adler.
3042 Global replace of assert with ASSERT.
3044 2007-10-16 Adam Roben <aroben@apple.com>
3046 Make testkjs not delay-load WebKit
3048 Soon, delay-loading WebKit will be impossible (because we will be
3049 using __declspec(thread) for thread-local storage). This change
3050 prepares testkjs for the future.
3054 * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer,
3056 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against
3057 WebKitInitializer, don't delay-load WebKit.
3058 * kjs/testkjs.cpp: Don't use WebKitInitializer.
3060 2007-10-16 Adam Roben <aroben@apple.com>
3062 Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration
3064 Reviewed by Kevin McCullough.
3066 * JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix.
3067 * JavaScriptCore.vcproj/debug_internal.vsprops: Ditto.
3068 * JavaScriptCore.vcproj/release.vsprops: Ditto.
3069 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use
3070 WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo
3071 in the name of icuuc36[_debug].dll.
3073 2007-10-16 Geoffrey Garen <ggaren@apple.com>
3075 Reviewed by Maciej Stachowiak.
3077 Re-structured variable and function declaration code.
3079 Command-line JS iBench shows no regression.
3081 Here are the changes:
3083 1. Function declarations are now processed at the same time as var
3084 declarations -- namely, immediately upon entry to an execution context.
3085 This does not match Firefox, which waits to process a function
3086 declaration until the declaration's containing block executes, but it
3087 does match IE and the ECMA spec. (10.1.3 states that var and function
3088 declarations should be processed at the same time -- namely, "On
3089 entering an execution context." 12.2 states that "A Block does not
3090 define a new execution scope.")
3092 2. Declaration processing proceeds iteratively now, rather than
3093 recursively, storing the nodes is finds in stacks. This will later
3094 facilitate an optimization to hold on to the gathered declaration nodes,
3095 rather than re-fetching them in every function call.
3096 [ http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3098 Modified these tests because they expected the incorrect Mozilla
3099 behavior described above:
3101 * tests/mozilla/ecma_3/Function/scope-001.js:
3102 * tests/mozilla/js1_5/Scope/regress-184107.js:
3104 2007-10-16 Darin Adler <darin@apple.com>
3106 - try to fix the GTK build
3108 * kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h.
3110 2007-10-16 Darin Adler <darin@apple.com>
3112 - try to fix the Windows build
3114 * kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were
3115 in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace.
3117 2007-10-16 Darin Adler <darin@apple.com>
3119 - try to fix the GTK build
3121 * kjs/ustring.cpp: Include ASCIICType.h.
3123 2007-10-16 Darin Adler <darin@apple.com>
3125 Reviewed by Maciej and Geoff (and looked over by Eric).
3127 - http://bugs.webkit.org/show_bug.cgi?id=15519
3128 eliminate use of <ctype.h> for processing ASCII
3130 * wtf/ASCIICType.h: Added.
3131 * wtf/DisallowCType.h: Added.
3133 * kjs/config.h: Include DisallowCType.h.
3135 * kjs/date_object.cpp:
3136 (KJS::skipSpacesAndComments):
3142 (KJS::UString::toDouble):
3143 Use ASCIICType.h functions instead of ctype.h ones.
3145 2007-10-14 Maciej Stachowiak <mjs@apple.com>
3149 - fixes for "New JavaScript benchmark"
3150 http://bugs.webkit.org/show_bug.cgi?id=15515
3153 (TestFunctionImp::callAsFunction): Implement "load" for compatibility
3155 (TestFunctionImp::): ditto
3157 (kjsmain): Drop useless --> from output.
3159 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3161 Removed unnecessary #include.
3163 * API/JSObjectRef.cpp:
3165 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3167 Double-reverse build fix. My tree was out of date.
3170 (NumberNode::evaluate):
3172 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3177 (NumberNode::evaluate):
3179 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3181 Reviewed by Darin Adler.
3183 Removed surprising self-named "hack" that made nested functions
3184 available as named properties of their containing functions, and placed
3185 containing function objects in the scope chains of nested functions.
3187 There were a few reasons to remove this "hack:"
3189 1. It contradicted FF, IE, and the ECMA spec.
3191 2. It incurred a performance penalty, since merely parsing a function
3192 required parsing its body for nested functions (and so on).
3194 3. SVN history contains no explanation for why it was added. It was just
3195 legacy code in a large merge a long, long time ago.
3197 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3200 (FuncDeclNode::processFuncDecl):
3202 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3204 Reviewed by Darin Adler.
3206 Removed the concept of AnonymousCode. It was unused, and it doesn't
3207 exist in the ECMA spec.
3209 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3212 (KJS::Context::Context):
3216 (ReturnNode::execute):
3218 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3220 Reviewed by Darin Adler.
3222 Made function parameters DontDelete. This matches FF and the vague
3223 description in ECMA 10.1.3. It's also required in order to make
3224 symbol table based lookup of function parameters valid. (If the
3225 parameters aren't DontDelete, you can't guarantee that you'll find
3226 them later in the symbol table.)
3228 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3231 (KJS::FunctionImp::passInParameters):
3233 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3235 Reviewed by Maciej Stachowiak.
3237 Some Vector optimizations. These are especially important when using
3238 Vector as a stack for implementing recursive algorithms iteratively.
3240 [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3242 1. Added shrink(), which is a version of resize() that you can call
3243 to save a branch / improve code generation and inlining when you know
3244 that the vector is not getting bigger.
3246 2. Changed subclassing relationship in VectorBuffer to remove a call to
3247 fastFree() in the destructor for the inlineCapacity != 0 template
3248 specialization. This brings inline Vectors one step closer to true
3249 stack-allocated arrays.
3251 Also changed abort() to CRASH(), since the latter works better.
3254 (WTF::VectorBufferBase::allocateBuffer):
3255 (WTF::VectorBufferBase::deallocateBuffer):
3256 (WTF::VectorBufferBase::VectorBufferBase):
3257 (WTF::VectorBufferBase::~VectorBufferBase):
3259 (WTF::VectorBuffer::VectorBuffer):
3260 (WTF::VectorBuffer::~VectorBuffer):
3261 (WTF::VectorBuffer::deallocateBuffer):
3262 (WTF::VectorBuffer::releaseBuffer):
3263 (WTF::Vector::clear):
3264 (WTF::Vector::removeLast):
3269 2007-10-12 Geoffrey Garen <ggaren@apple.com>
3271 Reviewed by Maciej Stachowiak.
3273 Fixed http://bugs.webkit.org/show_bug.cgi?id=15490
3274 Iteration statements sometimes incorrectly evaluate to the empty value
3277 [ Broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3279 This patch is a merge of KDE r670547, with substantial modification
3282 It fixes do-while statements to evaluate to a value. (They used
3283 to evaluate to the empty value in all cases.)
3285 It also fixes SourceElementsNode to maintain the value of abnormal
3286 completions like "break" and "continue."
3288 It also re-works the main execution loop in SourceElementsNode so that
3289 it (1) makes a little more sense and (2) avoids unnecessary work. This
3290 is a .28% speedup on command-line JS iBench.
3293 (DoWhileNode::execute):
3294 (SourceElementsNode::execute):
3296 2007-10-15 Simon Hausmann <hausmann@kde.org>
3300 Fix compilation with gcc 4.3 by including 'limits' due to the use of std::numeric_limits.
3304 2007-10-5 Kevin Ollivier <kevino@theolliviers.com>
3308 Add support for MSVC7, and fix cases where PLATFORM(WIN) should
3309 be PLATFORM(WIN_OS) for other ports building on Windows.
3312 (KJS::getDSTOffsetSimple):
3313 * kjs/JSImmediate.h:
3314 * wtf/Assertions.cpp:
3317 * wtf/StringExtras.h:
3321 2007-10-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3325 Adds NegateNode optimization from KJS. The relevant revision in KDE
3330 (NumberNode::evaluate):
3333 (KJS::NumberNode::):
3334 * kjs/nodes2string.cpp:
3335 (NumberNode::streamTo):
3337 2007-10-14 Jason Foreman <jason@threeve.org>
3341 Fix http://bugs.webkit.org/show_bug.cgi?id=15145
3343 Ensure that if adjusting n to minimize the difference of n*intPow10(e-p+1) to x,
3344 that the property n < intPow10(p) is maintained.
3346 * kjs/number_object.cpp:
3347 (NumberProtoFunc::callAsFunction):
3349 == Rolled over to ChangeLog-2007-10-14 ==