1 2007-11-04 Darin Adler <darin@apple.com>
5 - http://bugs.webkit.org/show_bug.cgi?id=15826
6 optimize opcode loop and case insensitive ASCII compares for a 30% speedup
8 SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
10 * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
12 * pcre/pcre_compile.c:
13 (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
14 added OP_NOT since there was no reason it should not be in here.
15 (could_be_empty_branch): Ditto.
16 (compile_branch): Streamlined all the single-character cases; there was a bit of
17 duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
18 But in particular, compile to those opcodes when the single character match is
20 (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
22 * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
23 the matchframe, after I discovered that none of them needed to be saved and restored
24 across recursive match calls. Also eliminated the ignored result field from the
25 matchframe, since I discovered that rrc ("recursive result code") was already the
26 exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
27 statement of the switch instead of doing them before the switch. This removes a
28 branch from each iteration of the opcode interpreter, just as removal of "op"
29 removed at least one store from each iteration. Last, but not least, add the
30 OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
31 surrogate pair and the letter case can be handled efficiently.
33 2007-11-04 Darin Adler <darin@apple.com>
35 * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
37 2007-11-03 Darin Adler <darin@apple.com>
39 - fix non-Mac builds; remove some more unused PCRE stuff
41 * pcre/pcre_compile.c:
42 (compile_branch): Removed branch chain and some unused ESC values.
43 (compile_regex): Ditto.
44 (jsRegExpCompile): Ditto.
46 (match): Removed unused branch targets. Don't use macros any more.
47 (jsRegExpExecute): More of the same.
49 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
50 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
51 * pcre/pcre.pri: Ditto.
53 * pcre/MERGING: Removed.
54 * pcre/pcre_fullinfo.c: Removed.
55 * pcre/pcre_get.c: Removed.
56 * pcre/pcre_internal.h:
57 * pcre/ucp.h: Removed.
59 2007-11-03 Darin Adler <darin@apple.com>
63 - http://bugs.webkit.org/show_bug.cgi?id=15821
64 remove unused PCRE features for speed
66 A first step toward removing the PCRE features we don't use.
67 This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
68 the SunSpider regular expression test.
70 Replaced the public interface with one that doesn't use the
71 name PCRE. Removed code we don't need for JavaScript and various
72 configurations we don't use. This is in preparation for still
73 more changes in the future. We'll probably switch to C++ and
74 make some even more significant changes to the regexp engine
75 to get some additional speed.
77 There's probably additional unused stuff that I haven't
80 This does mean that our PCRE is now a fork, but I think that's
81 not really a big deal.
83 * JavaScriptCore.exp: Remove the 5 old entry points and add
84 the 3 new entry points for WebCore's direct use of the regular
87 * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
88 its sense and now there's a USE(POSIX_REGEX) instead, which should
89 probably not be set by anyone. Maybe later we'll just get rid of it
94 (KJS::RegExp::RegExp): Switch to new jsRegExp function names and
95 defines. Cut down on the number of functions used.
96 (KJS::RegExp::~RegExp): Ditto.
97 (KJS::RegExp::match): Ditto.
99 * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
102 * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
103 size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
104 POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
105 and JAVASCRIPT. These are all no longer configurable in our copy
108 * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
109 version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
110 the include of <stdlib.h>, and most of the constants and
111 functions defined in this header. Changed the naming scheme to
112 use a JSRegExp prefix rather than a pcre prefix. In the future,
113 we'll probably change this to be a C++ header.
115 * pcre/pcre_compile.c: Removed all unused code branches,
116 including many whole functions and various byte codes.
117 Kept changes outside of removal to a minimum.
119 (first_significant_code):
122 (could_be_empty_branch):
127 (find_firstassertedchar):
128 (jsRegExpCompile): Renamed from pcre_compile2 and changed the
129 parameters around a bit.
130 (jsRegExpFree): Added.
132 * pcre/pcre_exec.c: Removed many unused opcodes and variables.
133 Also started tearing down the NO_RECURSE mechanism since it's
134 now the default. In some cases there were things in the explicit
135 frame that could be turned into plain old local variables and
136 other small like optimizations.
139 (match): Changed parameters quite a bit since it's now not used
141 (jsRegExpExecute): Renamed from pcre_exec.
143 * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
144 PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
145 PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
146 PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
147 _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
148 and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
150 * pcre/pcre_maketables.c: Changed to only compile in dftables.
151 Also got rid of many of the tables that we don't use.
153 * pcre/pcre_tables.c: Removed the unused Unicode property tables.
155 * pcre/pcre_ucp_searchfuncs.c: Removed everything except for
158 * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
159 for classes based on Unicode properties.
161 * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
162 to eliminate this completely, but we need the regular expression
163 code to be C++ first.
165 * pcre/pcre_fullinfo.c:
168 Files that are no longer needed. I didn't remove them with this
169 check-in, because I didn't want to modify all the project files.
171 2007-11-03 Maciej Stachowiak <mjs@apple.com>
175 - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
177 It turns out that doing this check costs more than it saves.
180 (KJS::JSImmediate::fromDouble):
182 2007-11-03 Sam Weinig <sam@webkit.org>
186 Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
187 The variable had been kept around for binary compatibility, but since nothing
188 else is there is no point in continuing to keep it around.
190 * API/JSCallbackConstructor.cpp:
192 * API/JSCallbackFunction.cpp:
194 * API/JSCallbackObject.cpp:
196 * bindings/objc/objc_runtime.mm:
197 * bindings/runtime_array.cpp:
198 * bindings/runtime_object.cpp:
199 * kjs/array_instance.cpp:
201 * kjs/array_object.cpp:
203 * kjs/bool_object.cpp:
204 * kjs/date_object.cpp:
206 * kjs/error_object.cpp:
212 * kjs/math_object.cpp:
213 * kjs/number_object.cpp:
215 * kjs/regexp_object.cpp:
216 * kjs/string_object.cpp:
219 2007-11-03 Kevin McCullough <kmccullough@apple.com>
221 - Updated testkjs results to make the build bots green until we
222 can fix the tests that are failing. The new failures are in DST.
224 * tests/mozilla/expected.html:
226 2007-11-03 Maciej Stachowiak <mjs@apple.com>
230 - don't print the var twice for ForInNodes with a var declaration
232 * kjs/nodes2string.cpp:
233 (KJS::ForInNode::streamTo):
235 2007-11-03 Darin Adler <darin@apple.com>
237 * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
238 C-incompatible declaration.
240 2007-11-03 Mark Rowe <mrowe@apple.com>
244 * kjs/nodes.cpp: Add missing include.
246 2007-11-03 Darin Adler <darin@apple.com>
250 - fix http://bugs.webkit.org/show_bug.cgi?id=15814
251 <rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
253 These changes cause us to match the JavaScript specification and pass the
254 fast/js/kde/encode_decode_uri.html test.
256 * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
257 new strict mode, throwing an exception if there are malformed UTF-16 surrogate
260 * kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
262 (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
263 those might be illegal in some sense, they aren't supposed to get any special
264 handling in the place where this function is currently used.
265 (KJS::UString::UTF8String): Added the strictness.
267 2007-11-03 Darin Adler <darin@apple.com>
271 - http://bugs.webkit.org/show_bug.cgi?id=15812
272 some JavaScript tests (from the Mozilla test suite) are failing
274 Two or three fixes get 7 more of the Mozilla tests passing.
275 This gets us down from 61 failing tests to 54.
277 * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
278 Made this inline and gave it a more specific type. Some day we should
279 probably do that for all of these -- might even get a bit of a speed
281 * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
282 inline in the header.
284 * kjs/regexp_object.h:
285 * kjs/regexp_object.cpp:
286 (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
287 switch statement into the RegExpImp object, so they can be shared with
288 RegExpImp::callAsFunction.
289 (KJS::RegExpImp::match): Added. Common code used by both test and exec.
290 (KJS::RegExpImp::test): Added.
291 (KJS::RegExpImp::exec): Added.
292 (KJS::RegExpImp::implementsCall): Added.
293 (KJS::RegExpImp::callAsFunction): Added.
294 (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
295 lastInput to null rather than empty string -- we take advantage of the
296 difference in RegExpImp::match.
297 (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
298 just to get at a field like this.
300 * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
301 the JavaScript specification. If there are not 4 hex digits after the \u,
302 then it's processed as if it wasn't an escape sequence at all.
304 * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
305 for JavaScript (4 specific Unicode values).
307 (match): Changed all call sites to use IS_NEWLINE.
310 * tests/mozilla/expected.html: Updated to expect 7 more successful tests.
312 2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
314 Sort files(...); sections of Xcode project files.
316 Rubber-stamped by Darin.
318 * JavaScriptCore.xcodeproj/project.pbxproj:
320 2007-11-03 Maciej Stachowiak <mjs@apple.com>
324 - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
328 (KJS::VarDeclNode::optimizeVariableAccess):
329 (KJS::VarDeclNode::getDeclarations):
330 (KJS::VarDeclNode::handleSlowCase):
331 (KJS::VarDeclNode::evaluateSingle):
332 (KJS::VarDeclNode::evaluate):
333 (KJS::VarStatementNode::execute):
335 (KJS::VarDeclNode::):
336 (KJS::VarStatementNode::):
337 * kjs/nodes2string.cpp:
338 (KJS::VarDeclNode::streamTo):
340 2007-11-03 Alexey Proskuryakov <ap@webkit.org>
344 http://bugs.webkit.org/show_bug.cgi?id=15800
345 REGRESSION (r27303): RegExp leaks
347 * kjs/regexp_object.h:
348 (KJS::RegExpImp::setRegExp):
349 (KJS::RegExpImp::regExp):
350 (KJS::RegExpImp::classInfo):
351 * kjs/regexp_object.cpp:
352 (RegExpImp::RegExpImp):
353 (RegExpImp::~RegExpImp):
354 Renamed reg member variable to m_regExp, changed it to use OwnPtr.
356 2007-11-02 Maciej Stachowiak <mjs@apple.com>
360 - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
364 (KJS::statementListPushFIFO):
365 (KJS::statementListGetDeclarations):
366 (KJS::statementListInitializeDeclarationStacks):
367 (KJS::statementListInitializeVariableAccessStack):
368 (KJS::statementListExecute):
369 (KJS::BlockNode::BlockNode):
370 (KJS::FunctionBodyNode::FunctionBodyNode):
371 (KJS::ProgramNode::ProgramNode):
373 (KJS::CaseClauseNode::):
375 2007-11-02 Darin Adler <darin@apple.com>
379 - http://bugs.webkit.org/show_bug.cgi?id=15791
380 change property map data structure for less memory use, better speed
382 The property map now has an array of indices and a separate array of
383 property map entries. This slightly slows down lookup because of a second
384 memory acess, but makes property maps smaller and faster to iterate in
385 functions like mark().
387 SunSpider says this is 1.2% faster, although it makes the bitwise-end test
388 more than 10% slower. To fix that we'll need to optimize global variable lookup.
390 * kjs/property_map.cpp:
391 (KJS::PropertyMapEntry::PropertyMapEntry):
392 (KJS::PropertyMapHashTable::entries):
393 (KJS::PropertyMapHashTable::allocationSize):
394 (KJS::SavedProperties::SavedProperties):
395 (KJS::SavedProperties::~SavedProperties):
396 (KJS::PropertyMap::checkConsistency):
397 (KJS::PropertyMap::~PropertyMap):
398 (KJS::PropertyMap::clear):
399 (KJS::PropertyMap::get):
400 (KJS::PropertyMap::getLocation):
401 (KJS::PropertyMap::put):
402 (KJS::PropertyMap::insert):
403 (KJS::PropertyMap::createTable):
404 (KJS::PropertyMap::rehash):
405 (KJS::PropertyMap::remove):
406 (KJS::PropertyMap::mark):
407 (KJS::comparePropertyMapEntryIndices):
408 (KJS::PropertyMap::containsGettersOrSetters):
409 (KJS::PropertyMap::getEnumerablePropertyNames):
410 (KJS::PropertyMap::save):
411 (KJS::PropertyMap::restore):
412 * kjs/property_map.h:
414 2007-11-02 Darin Adler <darin@apple.com>
418 - http://bugs.webkit.org/show_bug.cgi?id=15807
419 HashMap needs a take() function that combines get and remove
421 * wtf/HashMap.h: Added take function. Simplistic implementation for now,
422 but still does only one hash table lookup.
424 * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
425 a find followed by a remove.
427 2007-11-02 David Carson <dacarson@gmail.com>
431 Fix compiler warning "warning: suggest parentheses around && within ||"
432 http://bugs.webkit.org/show_bug.cgi?id=15764
434 * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
436 2007-11-01 Geoffrey Garen <ggaren@apple.com>
438 Reviewed by Maciej Stachowiak.
440 In preparation for making List a simple stack-allocated Vector:
442 Removed all instances of List copying and/or assignment, and made List
443 inherit from Noncopyable.
445 Functions that used to return a List by copy now take List& out
448 Layout tests and JS tests pass.
451 (KJS::List::slice): Replaced copyTail with a more generic slice
452 alternative. (JavaScriptCore only calls slice(1), but WebCore calls
455 2007-11-01 Geoffrey Garen <ggaren@apple.com>
457 Reviewed by Maciej Stachowiak.
459 Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
460 REGRESSION(r27344): Crash on load at finance.yahoo.com
462 Reverted a small portion of my last check-in. (The speedup and the List
463 removal are still there, though.)
465 ActivationImp needs to hold a pointer to its function, and mark that
466 pointer (rather than accessing its function through its ExecState, and
467 counting on the active scope to mark its function) because a closure
468 can cause an ActivationImp to outlive its ExecState along with any
472 (KJS::ExecState::ExecState):
474 (KJS::FunctionImp::~FunctionImp):
475 (KJS::ActivationImp::ActivationImp):
477 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
479 Also made HashTable a little more crash-happy in debug builds, so
480 problems like this will show up earlier:
483 (WTF::HashTable::~HashTable):
485 2007-11-01 Geoffrey Garen <ggaren@apple.com>
487 Reviewed by Adam Roben.
489 Addressed some of Darin's review comments.
491 Used perl -p, which is the shorthand while(<>) {}.
493 Made sure not to suppress bison's output.
495 Added line to removed bison_out.txt, since this script removes other
496 intermediate files, too.
498 * DerivedSources.make:
500 2007-11-01 Geoffrey Garen <ggaren@apple.com>
502 Reviewed by Oliver Hunt.
504 Removed List from ActivationImp, in preparation for making all lists
509 1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
512 (KJS::ExecState::ExecState):
513 (KJS::ExecState::~ExecState):
515 (KJS::ActivationImp::ActivationImp):
516 (KJS::ActivationImp::createArgumentsObject):
518 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
520 2007-11-01 Adam Roben <aroben@apple.com>
522 Use jsNumberCell instead of jsNumber when converting double constants to JSValues
524 This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
525 ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
527 It also gets rid of an MSVC warning that we previously had to silence.
531 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
532 back on the "overflow in constant arithmetic" warning.
533 * kjs/number_object.cpp:
534 (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
537 2007-10-31 Adam Roben <aroben@apple.com>
543 2007-10-31 Maciej Stachowiak <mjs@apple.com>
547 - shave some cycles off of local storage access for a 1% SunSpider speedup
549 Keep the LocalStorage pointer in the ExecState, instead of getting
550 it from the ActivationImp all the time.
553 (KJS::ExecState::updateLocalStorage):
555 (KJS::ExecState::localStorage):
557 (KJS::LocalVarAccessNode::evaluate):
558 (KJS::LocalVarFunctionCallNode::evaluate):
559 (KJS::PostIncLocalVarNode::evaluate):
560 (KJS::PostDecLocalVarNode::evaluate):
561 (KJS::LocalVarTypeOfNode::evaluate):
562 (KJS::PreIncLocalVarNode::evaluate):
563 (KJS::PreDecLocalVarNode::evaluate):
564 (KJS::ReadModifyLocalVarNode::evaluate):
565 (KJS::AssignLocalVarNode::evaluate):
566 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
568 2007-10-31 Adam Roben <aroben@apple.com>
570 Fix a crash on launch due to a static initializer race
572 We now use fast inline assembler spinlocks which can be statically
573 initialized at compile time.
575 As a side benefit, this speeds up SunSpider by 0.4%.
579 * wtf/FastMalloc.cpp:
581 (TCMalloc_SpinLock::Lock):
582 (TCMalloc_SpinLock::Unlock):
584 * wtf/TCSystemAlloc.cpp:
586 2007-10-31 Kevin McCullough <kmccullough@apple.com>
590 - Corrected spelling.
594 2007-10-31 Mark Rowe <mrowe@apple.com>
596 Further Gtk build fixage.
598 * kjs/regexp_object.cpp:
600 2007-10-31 Mark Rowe <mrowe@apple.com>
606 2007-10-31 Darin Adler <darin@apple.com>
610 - fix http://bugs.webkit.org/show_bug.cgi?id=15749
611 RegExp/RegExpObjectImp cause needless UString creation
613 Speeds things up 0.4% according to SunSpider.
615 * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
616 because this library doesn't use the real PCRE -- it uses its
617 own PCRE that works on UTF-16.
619 * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
620 Use Noncopyable. Change the return value of match.
622 (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
623 (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
624 (KJS::RegExp::match): Change to return the position as an int and the
625 ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
627 * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
628 require a result string.
629 * kjs/regexp_object.cpp:
630 (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
631 (RegExpObjectImp::performMatch): Change so it doesn't return a string.
632 (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
633 the main result with the backreferences; now it doesn't need to take
635 (RegExpObjectImp::getBackref): Minor tweaks.
636 (RegExpObjectImp::getLastParen): Ditto.
637 (RegExpObjectImp::getLeftContext): Ditto.
638 (RegExpObjectImp::getRightContext): Ditto.
639 (RegExpObjectImp::getValueProperty): Change LastMatch case to call
640 getBackref(0) so we don't need a separate getLastMatch function.
642 * kjs/string_object.cpp:
643 (KJS::replace): Update to use new performMatch, including merging the
644 matched string section with the other substrings.
645 (KJS::StringProtoFunc::callAsFunction): Update functions to use the
646 new performMatch and match. Also change to use OwnArrayPtr.
648 2007-10-31 Oliver Hunt <oliver@apple.com>
650 * kjs/nodes.h: include OwnPtr.h
652 2007-10-31 Oliver Hunt <oliver@apple.com>
656 Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
660 (KJS::statementListPushFIFO):
661 (KJS::statementListGetDeclarations):
662 (KJS::statementListInitializeDeclarationStacks):
663 (KJS::statementListInitializeVariableAccessStack):
664 (KJS::statementListExecute):
665 (KJS::BlockNode::optimizeVariableAccess):
666 (KJS::BlockNode::BlockNode):
667 (KJS::BlockNode::getDeclarations):
668 (KJS::BlockNode::execute):
669 (KJS::CaseClauseNode::optimizeVariableAccess):
670 (KJS::CaseClauseNode::getDeclarations):
671 (KJS::CaseClauseNode::evalStatements):
672 (KJS::FunctionBodyNode::initializeDeclarationStacks):
673 (KJS::FunctionBodyNode::optimizeVariableAccess):
675 * kjs/nodes2string.cpp:
676 (KJS::statementListStreamTo):
677 (KJS::BlockNode::streamTo):
678 (KJS::CaseClauseNode::streamTo):
680 2007-10-30 Mark Rowe <mrowe@apple.com>
682 * kjs/property_map.cpp: Added a missing using directive to fix the build
683 for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
685 2007-10-31 Maciej Stachowiak <mjs@apple.com>
687 * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
690 2007-10-31 Alexey Proskuryakov <ap@webkit.org>
694 http://bugs.webkit.org/show_bug.cgi?id=11001
695 WebKit doesn't support RegExp.compile method
697 Test: fast/js/regexp-compile.html
699 * kjs/regexp_object.cpp:
700 (RegExpPrototype::RegExpPrototype):
701 (RegExpProtoFunc::callAsFunction):
702 * kjs/regexp_object.h:
703 (KJS::RegExpProtoFunc::):
704 Added RegExp.compile.
706 * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
708 2007-10-31 Maciej Stachowiak <mjs@apple.com>
712 - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
714 Integer divide sucks. Fortunately, a bunch of shifts and XORs
715 biased towards the high bits is sufficient to provide a good
716 double hash. Besides the SunSpider win, I used the dump statistics
717 mode for both to verify that collisions did not increase and that
718 the longest collision chain is not any longer.
720 * kjs/property_map.cpp:
722 (KJS::PropertyMap::get):
723 (KJS::PropertyMap::getLocation):
724 (KJS::PropertyMap::put):
725 (KJS::PropertyMap::insert):
726 (KJS::PropertyMap::remove):
727 (KJS::PropertyMap::checkConsistency):
731 (WTF::::lookupForWriting):
732 (WTF::::fullLookupForWriting):
735 2007-10-30 Adam Roben <aroben@apple.com>
737 * kjs/collector.h: Make HeapType public so it can be used for non-member
738 things like the HeapConstants struct template. Fixes the build on Windows.
740 2007-10-30 Adam Roben <aroben@apple.com>
742 Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
744 Speeds up SunSpider by 0.4%.
746 Reviewed by Steve and Maciej.
748 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
749 a warning during LTCG in release builds about double -> float
751 * wtf/AlwaysInline.h:
754 2007-10-30 Adam Roben <aroben@apple.com>
756 Use GetCurrentThreadId instead of pthread_self in FastMalloc
758 Speeds up SunSpider by 0.3%.
762 * wtf/FastMalloc.cpp:
763 (WTF::TCMalloc_ThreadCache::InitTSD):
764 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
766 2007-10-30 Adam Roben <aroben@apple.com>
768 Switch to a Win32 critical section implementation of spinlocks
770 Speeds up SunSpider by 0.4%.
774 * wtf/FastMalloc.cpp:
776 (TCMalloc_SpinLock::TCMalloc_SpinLock):
777 (TCMalloc_SpinLock::Init):
778 (TCMalloc_SpinLock::Finalize):
779 (TCMalloc_SpinLock::Lock):
780 (TCMalloc_SpinLock::Unlock):
781 * wtf/TCSystemAlloc.cpp:
783 2007-10-30 Adam Roben <aroben@apple.com>
785 Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
787 http://bugs.webkit.org/show_bug.cgi?id=15586
789 Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
791 Use Win32 TLS functions instead of __declspec(thread), which breaks
796 * wtf/FastMalloc.cpp:
797 (WTF::getThreadHeap):
798 (WTF::TCMalloc_ThreadCache::InitModule):
800 2007-10-30 Maciej Stachowiak <mjs@apple.com>
804 - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
805 http://bugs.webkit.org/show_bug.cgi?id=15772
807 We do this by using a single mark bit per two number cells, and
810 Besides being an 0.5% win overall, this is a 7.1% win on morph.
814 (KJS::Collector::heapAllocate):
815 (KJS::Collector::markStackObjectsConservatively):
816 (KJS::Collector::sweep):
818 (KJS::SmallCollectorCell::):
820 2007-10-30 Geoffrey Garen <ggaren@apple.com>
822 Reviewed by Adam Roben, Sam Weinig.
824 Made conflicts in grammar.y a persistent build failure.
826 * DerivedSources.make:
828 2007-10-30 Kevin McCullough <kmccullough@apple.com>
830 Reviewed by Adam and Geoff.
832 - Added a new cast so all the casts are in the same place.
837 2007-10-30 Geoffrey Garen <ggaren@apple.com>
839 Reviewed by Darin Adler.
841 Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
845 ecma_2/Statements/dowhile-001.js
846 ecma_2/Statements/dowhile-002.js
847 ecma_2/Statements/dowhile-003.js
848 ecma_2/Statements/dowhile-004.js
849 ecma_2/Statements/dowhile-005.js
850 ecma_2/Statements/dowhile-006.js
851 ecma_2/Statements/dowhile-007.js
852 js1_2/statements/do_while.js
854 and layout tests, including
856 do-while-expression-value.html
857 do-while-semicolon.html
858 do-while-without-semicolon.html
862 * kjs/grammar.y: Use the explicit "error" production, as we do with other
863 automatic semicolon insertions, to disambiguate "do { } while();" from
864 "do { } while()" followed by ";" (the empty statement).
866 2007-10-29 Oliver Hunt <oliver@apple.com>
870 Debranching remaining assignment nodes, and miscellaneous cleanup
872 Split read-modify code paths out of AssignBracketNode and AssignDotNode
873 Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
874 and ReadModifyResolveNode evaluate methods
876 Leads to a 1% gain in SunSpider.
880 (KJS::ReadModifyLocalVarNode::evaluate):
881 (KJS::ReadModifyResolveNode::evaluate):
882 (KJS::AssignDotNode::evaluate):
883 (KJS::ReadModifyDotNode::optimizeVariableAccess):
884 (KJS::ReadModifyDotNode::evaluate):
885 (KJS::AssignBracketNode::evaluate):
886 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
887 (KJS::ReadModifyBracketNode::evaluate):
889 (KJS::AssignBracketNode::):
890 (KJS::AssignBracketNode::precedence):
891 (KJS::AssignDotNode::):
892 (KJS::AssignDotNode::precedence):
893 * kjs/nodes2string.cpp:
894 (KJS::ReadModifyBracketNode::streamTo):
895 (KJS::AssignBracketNode::streamTo):
896 (KJS::ReadModifyDotNode::streamTo):
897 (KJS::AssignDotNode::streamTo):
899 2007-10-29 Oliver Hunt <oliver@apple.com>
901 Debranching various Node::evaluate implementations
905 Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
906 Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
908 Gains 1.6% on SunSpider
910 * JavaScriptCore.xcodeproj/project.pbxproj:
913 (KJS::PostIncResolveNode::optimizeVariableAccess):
914 (KJS::PostIncResolveNode::evaluate):
915 (KJS::PostIncLocalVarNode::evaluate):
916 (KJS::PostDecResolveNode::optimizeVariableAccess):
917 (KJS::PostDecResolveNode::evaluate):
918 (KJS::PostDecLocalVarNode::evaluate):
919 (KJS::PostIncBracketNode::evaluate):
920 (KJS::PostDecBracketNode::evaluate):
921 (KJS::PostIncDotNode::evaluate):
922 (KJS::PostDecDotNode::evaluate):
923 (KJS::PreIncResolveNode::optimizeVariableAccess):
924 (KJS::PreIncLocalVarNode::evaluate):
925 (KJS::PreIncResolveNode::evaluate):
926 (KJS::PreDecResolveNode::optimizeVariableAccess):
927 (KJS::PreDecLocalVarNode::evaluate):
928 (KJS::PreDecResolveNode::evaluate):
929 (KJS::PreIncBracketNode::evaluate):
930 (KJS::PreDecBracketNode::evaluate):
931 (KJS::PreIncDotNode::evaluate):
932 (KJS::PreDecDotNode::evaluate):
933 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
934 (KJS::AssignResolveNode::optimizeVariableAccess):
935 (KJS::AssignLocalVarNode::evaluate):
936 (KJS::AssignResolveNode::evaluate):
938 (KJS::PostDecResolveNode::):
939 (KJS::PostDecResolveNode::precedence):
940 (KJS::PostDecLocalVarNode::):
941 (KJS::PostfixBracketNode::):
942 (KJS::PostfixBracketNode::precedence):
943 (KJS::PostIncBracketNode::):
944 (KJS::PostIncBracketNode::isIncrement):
945 (KJS::PostDecBracketNode::):
946 (KJS::PostDecBracketNode::isIncrement):
947 (KJS::PostfixDotNode::):
948 (KJS::PostfixDotNode::precedence):
949 (KJS::PostIncDotNode::):
950 (KJS::PostIncDotNode::isIncrement):
951 (KJS::PostDecDotNode::):
952 (KJS::PreIncResolveNode::):
953 (KJS::PreDecResolveNode::):
954 (KJS::PreDecResolveNode::precedence):
955 (KJS::PreDecLocalVarNode::):
956 (KJS::PrefixBracketNode::):
957 (KJS::PrefixBracketNode::precedence):
958 (KJS::PreIncBracketNode::):
959 (KJS::PreIncBracketNode::isIncrement):
960 (KJS::PreDecBracketNode::):
961 (KJS::PreDecBracketNode::isIncrement):
962 (KJS::PrefixDotNode::):
963 (KJS::PrefixDotNode::precedence):
964 (KJS::PreIncDotNode::):
965 (KJS::PreIncDotNode::isIncrement):
966 (KJS::PreDecDotNode::):
967 (KJS::ReadModifyResolveNode::):
968 (KJS::ReadModifyLocalVarNode::):
969 (KJS::AssignResolveNode::):
970 (KJS::AssignResolveNode::precedence):
971 * kjs/nodes2string.cpp:
972 (KJS::PostIncResolveNode::streamTo):
973 (KJS::PostDecResolveNode::streamTo):
974 (KJS::PostfixBracketNode::streamTo):
975 (KJS::PostfixDotNode::streamTo):
976 (KJS::PreIncResolveNode::streamTo):
977 (KJS::PreDecResolveNode::streamTo):
978 (KJS::ReadModifyResolveNode::streamTo):
979 (KJS::AssignResolveNode::streamTo):
981 2007-10-29 Maciej Stachowiak <mjs@apple.com>
983 Not reviewed, build fix.
985 - Include Vector.h in a way that actually works.
987 * kjs/LocalStorage.h:
989 2007-10-29 Maciej Stachowiak <mjs@apple.com>
991 Not reviewed, build fix.
993 - Install LocalStorage.h as a private header.
995 * JavaScriptCore.xcodeproj/project.pbxproj:
997 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1001 - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
1003 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1004 * JavaScriptCore.xcodeproj/project.pbxproj:
1005 * kjs/LocalStorage.h: Added.
1006 (KJS::LocalStorageEntry::LocalStorageEntry):
1010 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
1012 2007-10-29 Geoffrey Garen <ggaren@apple.com>
1014 Reviewed by Oliver Hunt.
1016 Some small tweaks that I notice while reviewing Oliver's last patch.
1018 Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
1020 No change in SunSpider because SunSpider doesn't take the code path that
1021 would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
1024 (KJS::LocalVarPostfixNode::evaluate):
1025 (KJS::TypeOfResolveNode::optimizeVariableAccess):
1026 (KJS::LocalVarTypeOfNode::evaluate):
1027 (KJS::PrefixResolveNode::optimizeVariableAccess):
1028 (KJS::LocalVarPrefixNode::evaluate):
1029 (KJS::AssignResolveNode::optimizeVariableAccess):
1030 (KJS::LocalVarAssignNode::evaluate):
1032 (KJS::LocalVarTypeOfNode::):
1033 (KJS::PrefixResolveNode::):
1034 (KJS::LocalVarPrefixNode::):
1035 (KJS::AssignResolveNode::):
1036 (KJS::LocalVarAssignNode::):
1038 2007-10-29 Eric Seidel <eric@webkit.org>
1042 SunSpider claims this was a 0.7% speedup.
1044 * kjs/string_object.cpp:
1045 (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
1047 2007-10-29 Maciej Stachowiak <mjs@apple.com>
1051 - re-enable asserts for access to empty or deleted keys
1055 (WTF::::lookupForWriting):
1056 (WTF::::fullLookupForWriting):
1059 2007-10-29 Eric Seidel <eric@webkit.org>
1061 Build fix only, no review.
1063 * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
1065 2007-10-29 Mark Rowe <mrowe@apple.com>
1067 Gtk build fix. Move struct declarations into nodes.h.
1072 2007-10-29 Eric Seidel <eric@webkit.org>
1076 Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
1077 Make it a compile time error to use toString(ExecState) on a StringInstance
1079 SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
1082 (KJS::StringImp::getLength):
1083 * kjs/string_object.cpp:
1084 (KJS::StringInstance::lengthGetter):
1085 (KJS::StringInstance::inlineGetOwnPropertySlot):
1086 (KJS::StringInstance::getOwnPropertySlot):
1087 * kjs/string_object.h:
1089 2007-10-28 Oliver Hunt <oliver@apple.com>
1093 Add nodes to allow Assignment, TypeOf, and prefix operators to
1094 make use of the new optimised local variable look up.
1096 5% gain on sunspider
1099 (KJS::TypeOfResolveNode::optimizeVariableAccess):
1100 (KJS::LocalTypeOfAccessNode::evaluate):
1101 (KJS::PrefixResolveNode::optimizeVariableAccess):
1102 (KJS::PrefixLocalAccessNode::evaluate):
1103 (KJS::AssignResolveNode::optimizeVariableAccess):
1104 (KJS::AssignLocalAccessNode::evaluate):
1106 (KJS::TypeOfResolveNode::):
1107 (KJS::TypeOfResolveNode::precedence):
1108 (KJS::LocalTypeOfAccessNode::):
1109 (KJS::PrefixResolveNode::):
1110 (KJS::PrefixResolveNode::precedence):
1111 (KJS::PrefixLocalAccessNode::):
1112 (KJS::AssignResolveNode::):
1113 (KJS::AssignLocalAccessNode::):
1115 2007-10-28 Maciej Stachowiak <mjs@apple.com>
1119 - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
1120 http://bugs.webkit.org/show_bug.cgi?id=15748
1122 Not a significant speedup or slowdown on SunSpider.
1125 (KJS::clearNewNodes):
1129 (KJS::BlockNode::BlockNode):
1130 (KJS::CaseBlockNode::CaseBlockNode):
1131 (KJS::FunctionBodyNode::FunctionBodyNode):
1132 (KJS::SourceElementsNode::SourceElementsNode):
1133 (KJS::ProgramNode::ProgramNode):
1135 (KJS::ElementNode::):
1137 (KJS::PropertyListNode::):
1138 (KJS::ObjectLiteralNode::):
1139 (KJS::ArgumentListNode::):
1140 (KJS::ArgumentsNode::):
1141 (KJS::VarDeclListNode::):
1142 (KJS::VarStatementNode::):
1144 (KJS::ParameterNode::):
1145 (KJS::FuncExprNode::):
1146 (KJS::FuncDeclNode::):
1147 (KJS::SourceElementsNode::):
1148 (KJS::CaseClauseNode::):
1149 (KJS::ClauseListNode::):
1151 2007-10-28 Mark Rowe <mrowe@apple.com>
1153 Disable assertions in a manner that doesn't break the Qt Windows build.
1157 (WTF::::lookupForWriting):
1158 (WTF::::fullLookupForWriting):
1160 2007-10-28 Geoffrey Garen <ggaren@apple.com>
1162 Temporarily disabling some ASSERTs I introduced in my last check-in
1163 because of http://bugs.webkit.org/show_bug.cgi?id=15747
1164 Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
1168 (WTF::::lookupForWriting):
1169 (WTF::::fullLookupForWriting):
1172 2007-10-28 Geoffrey Garen <ggaren@apple.com>
1174 Reviewed by Darin Adler.
1176 Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
1177 #ifndef ASSERT_DISABLED is no good!
1179 Replaced with #if !ASSERT_DISABLED.
1183 (WTF::::lookupForWriting):
1184 (WTF::::fullLookupForWriting):
1187 2007-10-28 Geoffrey Garen <ggaren@apple.com>
1189 Reviewed by Darin Adler.
1191 Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
1192 to the AST transfom that replaces slow resolve nodes with fast local
1193 variable alternatives.
1195 2.5% speedup on SunSpider.
1197 Also added some missing copyright notices.
1200 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
1201 (KJS::FunctionCallResolveNode::evaluate):
1202 (KJS::LocalVarFunctionCallNode::evaluate):
1203 (KJS::PostfixResolveNode::optimizeVariableAccess):
1204 (KJS::PostfixResolveNode::evaluate):
1205 (KJS::LocalVarPostfixNode::evaluate):
1206 (KJS::DeleteResolveNode::optimizeVariableAccess):
1207 (KJS::DeleteResolveNode::evaluate):
1208 (KJS::LocalVarDeleteNode::evaluate):
1210 (KJS::FunctionCallResolveNode::):
1211 (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
1212 (KJS::PostfixResolveNode::):
1213 (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
1214 (KJS::DeleteResolveNode::):
1215 (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
1217 2007-10-28 Eric Seidel <eric@webkit.org>
1221 Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
1222 Add virtual keyword to a few virtual functions previously unmarked.
1225 (KJS::StringImp::type):
1226 (KJS::NumberImp::type):
1228 (KJS::UString::Rep::deref):
1230 2007-10-28 Darin Adler <darin@apple.com>
1232 - fix "broken everything" from the storage leak fix
1234 * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
1235 * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
1237 2007-10-28 Darin Adler <darin@apple.com>
1241 - turn on unused parameter waring on Mac OS X because it's already on elsewhere
1243 * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
1249 Fixed unused variables by using them or marked them with UNUSED_PARAM.
1251 * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
1252 Removed parameter names to indicate they are unused.
1254 2007-10-28 Darin Adler <darin@apple.com>
1258 - fix a storage leak where we ref the UString every time we replace
1259 a ResolveNode with a LocalVarAccessNode
1261 * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
1262 that takes PlacementNewAdopt.
1264 * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
1265 with PlacementNewAdopt instead of the old value of ident.
1267 * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
1268 takes PlacementNewAdopt.
1270 2007-10-28 Darin Adler <darin@apple.com>
1272 - Windows build fix; get rid of unused parameter
1274 * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
1275 * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
1276 The assertions weren't all that helpful.
1278 2007-10-28 Mark Rowe <mrowe@apple.com>
1280 Gtk build fix. Add include of MathExtras.h.
1282 * kjs/string_object.cpp:
1284 2007-10-28 Mark Rowe <mrowe@apple.com>
1286 Reviewed by Maciej and Tim.
1288 Replace uses of isNaN and isInf with isnan and isinf, and
1289 remove isNaN and isInf.
1291 * kjs/config.h: Remove unused HAVE_'s.
1292 * kjs/date_object.cpp:
1293 (KJS::DateInstance::getTime):
1294 (KJS::DateInstance::getUTCTime):
1295 (KJS::DateProtoFunc::callAsFunction):
1296 (KJS::DateObjectImp::construct):
1297 (KJS::DateObjectFuncImp::callAsFunction):
1299 (KJS::GlobalFuncImp::callAsFunction):
1300 * kjs/math_object.cpp:
1301 (MathFuncImp::callAsFunction):
1302 * kjs/nodes2string.cpp:
1303 (KJS::isParserRoundTripNumber):
1304 * kjs/number_object.cpp:
1305 (NumberProtoFunc::callAsFunction):
1306 * kjs/operations.cpp:
1308 * kjs/string_object.cpp:
1309 (KJS::StringProtoFunc::callAsFunction):
1311 (KJS::UString::from):
1313 (KJS::JSValue::toInteger):
1314 (KJS::JSValue::toInt32SlowCase):
1315 (KJS::JSValue::toUInt32SlowCase):
1317 2007-10-28 Geoffrey Garen <ggaren@apple.com>
1319 Build fix: use the new-fangled missingSymbolMarker().
1322 (KJS::ResolveNode::optimizeVariableAccess):
1324 (KJS::LocalVarAccessNode::LocalVarAccessNode):
1326 2007-10-28 Geoffrey Garen <ggaren@apple.com>
1328 Reviewed by Maciej Stachowiak, Darin Adler.
1330 Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
1333 AST transfom to replace slow resolve nodes with fast local variable
1334 alternatives that do direct memory access. Currently, only ResolveNode
1335 provides a fast local variable alternative. 6 others are soon to come.
1337 16.7% speedup on SunSpider.
1339 Most of this patch is just scaffolding to support iterating all the
1340 resolve nodes in the AST through optimizeResolveNodes(). In
1341 optimizeResolveNodes(), most classes just push their child nodes onto
1342 the processing stack, while ResolveNodes actually replace themselves in
1343 the tree with more optimized alternatives, if possible.
1345 Here are the interesting bits:
1347 * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
1348 in Node and ResolveNode. This tag allows you to use placement new to
1349 swap out a base class Node in favor of a subclass copy that holds the
1350 same data. (Without this tag, default initialization would NULL out
1351 RefPtrs, change line numbers, etc.)
1354 (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
1355 that the fast path is impossible, to make sure we didn't leave anything
1358 (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
1359 transformation happens.
1361 (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
1362 optimization happens.
1364 * kjs/function.h: Added symbolTable() accessor for, for the sake of
1367 2007-10-28 Mark Rowe <mrowe@apple.com>
1371 Fix "AllInOneFile.o has a global initializer in it".
1373 Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
1374 We can avoid this by moving it inside an inline function.
1376 * kjs/SymbolTable.h:
1377 (KJS::missingSymbolMarker):
1379 (KJS::ActivationImp::getOwnPropertySlot):
1380 (KJS::ActivationImp::put):
1382 2007-10-28 Maciej Stachowiak <mjs@apple.com>
1386 - Added assertions to protect against adding empty or deleted keys to a HashTable
1389 (WTF::HashTable::lookup):
1390 (WTF::HashTable::lookupForWriting):
1391 (WTF::HashTable::fullLookupForWriting):
1392 (WTF::HashTable::add):
1394 2007-10-28 Darin Adler <darin@apple.com>
1398 * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
1399 Use isNaN and isInf instead of isnan and isinf.
1401 2007-10-28 Darin Adler <darin@apple.com>
1405 - http://bugs.webkit.org/show_bug.cgi?id=15735
1406 remove GroupNode to simplify AST and possibly get a modest speedup
1408 This patch removes 4 node types: GroupNode, PropertyNameNode,
1409 FunctionCallParenBracketNode, and FunctionCallParenDotNode.
1411 To remove GroupNode, we add knowledge of precedence to the tree nodes,
1412 and use that when serializing to determine where parentheses are needed.
1413 This means we no longer have to represent parentheses in the tree.
1415 The precedence values are named after productions in the grammar from the
1416 JavaScript standard.
1418 SunSpider says this is an 0.4% speedup.
1421 * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
1422 serialization, so I moved it to the file that takes care of that.
1424 * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
1425 indicate failure instead of a separate boolean. Got rid of PropertyNameNode
1426 by merging the PropertyName rule into the Property rule (which was easier
1427 than figuring out how to pass the Identifier from one node to another).
1428 Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
1429 and FunctionCallParenDotNode.
1431 * kjs/nodes.h: Removed unused forward declarations and Operator values.
1432 Added Precedence enum, and precedence function to all nodes. Removed
1433 nodeInsideAllParens. Added streamBinaryOperator function for serialization.
1434 Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
1435 Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
1437 * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
1438 (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
1439 of converting it from an Identifier to a jsString then back to a UString
1440 then into an Identifier again!
1442 * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
1443 function for each of Endl, Indent, Unindent, and DotExpr instead of using a
1444 single function with a switch. Added a precedence that you can stream in, to
1445 cause the next node serialized to add parentheses based on that precedence value.
1446 (KJS::operatorString): Moved to the top of the file.
1447 (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
1448 workaround for snprintf, since StringExtras.h takes care of that.
1449 (KJS::operator<<): Made the char and char* versions faster by using UString's
1450 character append functions instead of constructing a UString. Added the logic
1451 to the Node* version to add parentheses if needed.
1452 (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
1453 (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
1454 (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
1456 (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
1457 (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
1458 (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
1459 (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
1460 (KJS::FunctionCallBracketNode::streamTo): Ditto.
1461 (KJS::FunctionCallDotNode::streamTo): Ditto.
1462 (KJS::PostfixBracketNode::streamTo): Ditto.
1463 (KJS::PostfixDotNode::streamTo): Ditto.
1464 (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
1465 (KJS::DeleteBracketNode::streamTo): Use PrecCall.
1466 (KJS::DeleteDotNode::streamTo): Ditto.
1467 (KJS::DeleteValueNode::streamTo): Use PrecUnary.
1468 (KJS::VoidNode::streamTo): Ditto.
1469 (KJS::TypeOfValueNode::streamTo): Ditto.
1470 (KJS::PrefixBracketNode::streamTo): Use PrecCall.
1471 (KJS::PrefixDotNode::streamTo): Ditto.
1472 (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
1473 (KJS::UnaryPlusNode::streamTo): Ditto.
1474 (KJS::NegateNode::streamTo): Ditto.
1475 (KJS::BitwiseNotNode::streamTo): Ditto.
1476 (KJS::LogicalNotNode::streamTo): Ditto.
1477 (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
1478 (KJS::DivNode::streamTo): Ditto.
1479 (KJS::ModNode::streamTo): Ditto.
1480 (KJS::AddNode::streamTo): Ditto.
1481 (KJS::SubNode::streamTo): Ditto.
1482 (KJS::LeftShiftNode::streamTo): Ditto.
1483 (KJS::RightShiftNode::streamTo): Ditto.
1484 (KJS::UnsignedRightShiftNode::streamTo): Ditto.
1485 (KJS::LessNode::streamTo): Ditto.
1486 (KJS::GreaterNode::streamTo): Ditto.
1487 (KJS::LessEqNode::streamTo): Ditto.
1488 (KJS::GreaterEqNode::streamTo): Ditto.
1489 (KJS::InstanceOfNode::streamTo): Ditto.
1490 (KJS::InNode::streamTo): Ditto.
1491 (KJS::EqualNode::streamTo): Ditto.
1492 (KJS::NotEqualNode::streamTo): Ditto.
1493 (KJS::StrictEqualNode::streamTo): Ditto.
1494 (KJS::NotStrictEqualNode::streamTo): Ditto.
1495 (KJS::BitAndNode::streamTo): Ditto.
1496 (KJS::BitXOrNode::streamTo): Ditto.
1497 (KJS::BitOrNode::streamTo): Ditto.
1498 (KJS::LogicalAndNode::streamTo): Ditto.
1499 (KJS::LogicalOrNode::streamTo): Ditto.
1500 (KJS::ConditionalNode::streamTo): Ditto.
1501 (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
1502 (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
1503 the bracket and PrecAssignment for the right side.
1504 (KJS::AssignDotNode::streamTo): Ditto.
1505 (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
1506 and PrecAssignment for the right side.
1507 (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
1508 (KJS::AssignExprNode::streamTo): Use PrecAssignment.
1510 2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
1512 Define wx port and set wx port USE options.
1514 Reviewed by Adam Roben.
1518 2007-10-28 Mark Rowe <mrowe@apple.com>
1520 We don't include "config.h" in headers.
1522 * bindings/jni/jni_instance.h:
1527 2007-10-28 Maciej Stachowiak <mjs@apple.com>
1529 Rubber stamped by Mark.
1531 - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
1533 * kjs/SymbolTable.h:
1534 (KJS::SymbolTableIndexHashTraits::emptyValue):
1536 (KJS::ActivationImp::getOwnPropertySlot):
1537 (KJS::ActivationImp::put):
1539 2007-10-28 Maciej Stachowiak <mjs@apple.com>
1543 - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
1545 * kjs/SymbolTable.h:
1546 (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
1547 (KJS::IdentifierRepHash::equal): ditto
1548 (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
1549 (KJS::SymbolTable): change to a typedef for a HashMap.
1551 (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
1552 (KJS::ActivationImp::deleteProperty): ditto
1553 (KJS::ActivationImp::put): ditto
1556 (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
1557 you now have to store a UString::rep, not an identifier.
1559 2007-10-27 Maciej Stachowiak <mjs@apple.com>
1563 - numerous HashTable performance improvements
1565 This does not quite add up to a measurable win on SunSpider, but it allows a
1566 follow-on > 3% improvement and probably helps WebCore too.
1568 I made the following improvements, among others:
1570 - Made HashFunctions note whether it is ok to compare a real value with the equal() function
1571 to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
1573 - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
1574 std::pairs for cases that don't need them. There are now four versions, one for read-only access,
1575 two for writing, and one folded directly into add() (these all were improvments).
1577 - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
1579 - Made a special constructor for iterators that knows it points to
1580 a valid filled cell and so skips updating itself.
1582 - Reordered memory accesses in the various lookup functions for better code generation
1584 - Made simple translators avoid passing a hash code around
1586 - Other minor tweaks
1590 (WTF::HashTableConstIterator::HashTableConstIterator):
1591 (WTF::HashTableIterator::HashTableIterator):
1592 (WTF::IdentityHashTranslator::translate):
1593 (WTF::HashTable::end):
1594 (WTF::HashTable::lookup):
1595 (WTF::HashTable::lookupForWriting):
1596 (WTF::HashTable::makeKnownGoodIterator):
1597 (WTF::HashTable::makeKnownGoodConstIterator):
1599 (WTF::::lookupForWriting):
1600 (WTF::::fullLookupForWriting):
1602 (WTF::::addPassingHashCode):
1606 * kjs/identifier.cpp:
1608 * wtf/HashFunctions.h:
1616 * wtf/ListHashSet.h:
1617 (WTF::ListHashSetTranslator::translate):
1619 2007-10-27 Darin Adler <darin@apple.com>
1623 - fix ASCIICType.h for some Windows compiles
1625 * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
1626 compiler/library that has the wchar_t that is just a typedef.
1628 2007-10-27 Kevin McCullough <kmccullough@apple.com>
1631 - Forgot to change the build step when I changed the filename.
1633 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1635 2007-10-27 Geoffrey Garen <ggaren@apple.com>
1637 Reviewed by Darin Adler.
1639 Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
1641 http://bugs.webkit.org/show_bug.cgi?id=15718
1643 * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
1644 hash value. Also changed O(n) strlen to O(1) check for empty string.
1645 (KJS::Identifier::add):
1647 * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
1648 (KJS::UString::UString):
1649 (KJS::UString::operator=):
1651 2007-10-27 Darin Adler <darin@apple.com>
1655 - fix pow on Windows
1657 * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
1658 a "pow" function that does not properly handle the case where arg1 is
1661 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
1662 specify "::pow" -- just "pow" is fine.
1664 2007-10-27 Darin Adler <darin@apple.com>
1668 - http://bugs.webkit.org/show_bug.cgi?id=15711
1669 force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
1671 * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
1673 * kjs/object.h: Removed redundant includes.
1674 * kjs/value.h: Ditto.
1676 2007-10-27 Maciej Stachowiak <mjs@apple.com>
1680 - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
1681 http://bugs.webkit.org/show_bug.cgi?id=15718
1683 * kjs/identifier.cpp:
1684 (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
1685 now that we count on all Identifiers already having one.
1687 2007-10-27 Mark Rowe <mrowe@apple.com>
1691 * kjs/SymbolTable.h:
1693 2007-10-27 Mark Rowe <mrowe@apple.com>
1699 2007-10-26 Kevin McCullough <kmccullough@apple.com>
1701 Rubber stamp by Adam.
1703 - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
1704 files contain are functions that operate on BSTRs.
1706 * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
1707 * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
1708 * API/JSStringRefCOM.cpp: Removed.
1709 * API/JSStringRefCOM.h: Removed.
1710 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1712 2007-10-26 Kevin McCullough <kmccullough@apple.com>
1716 - Made JSStringCreateWithBSTR capable of handling null BSTRs.
1718 * API/JSStringRefCOM.cpp:
1719 (JSStringCreateWithBSTR):
1721 2007-10-26 Sam Weinig <sam@webkit.org>
1725 * kjs/SymbolTable.h: Add header gaurd.
1726 * kjs/nodes.h: #include "SymbolTable.h"
1728 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1730 Suggested by Anders Carlsson.
1735 (KJS::ActivationImp::getOwnPropertySlot):
1737 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1739 Suggested by Darin Adler.
1741 Use computedHash(), which is safer than just directly accessing _hash.
1744 (KJS::Lookup::findEntry):
1745 (KJS::Lookup::find):
1747 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1749 Build fix: svn add SymbolTable.h
1751 * kjs/SymbolTable.h: Added.
1752 (KJS::SymbolTable::set):
1753 (KJS::SymbolTable::get):
1755 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1757 Build fix: export SymbolTable.h to WebCore.
1759 * JavaScriptCore.xcodeproj/project.pbxproj:
1761 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1763 Comment tweak suggested by Maciej.
1766 (KJS::ActivationImp::getOwnPropertySlot):
1768 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1770 Reviewed by Maciej Stachowiak.
1772 Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
1774 * kjs/property_map.cpp: Use a special no branch accessor to the UString's
1775 hash value. Also, return immediately instead of branching to the end
1776 of the loop if the value is not found.
1777 (KJS::PropertyMap::get):
1778 (KJS::PropertyMap::getLocation):
1779 (KJS::PropertyMap::put):
1780 (KJS::PropertyMap::insert):
1781 (KJS::PropertyMap::remove):
1782 (KJS::PropertyMap::checkConsistency):
1785 (KJS::UString::Rep::computedHash): Special no branch accessor to the
1786 UString's hash value. Used when the caller knows that the hash value
1787 has already been computed. (For example, if the caller got the UString
1788 from an Identifier.)
1790 2007-10-26 Geoffrey Garen <ggaren@apple.com>
1792 Reviewed by Maciej Stachowiak.
1794 Switched ActivationImp to using a symbol table. For now, though, all
1795 clients take the slow path.
1797 Net .6% speedup on SunSpider.
1800 - ActivationImp now mallocs in its constructor
1801 - Local variable hits use an extra level of indirection to retrieve
1803 - Local variable misses do two lookups
1806 - Fast initialization of local variables upon function entry
1808 * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
1811 (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
1812 data that won't fit in a JSCell.
1813 (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
1815 (KJS::ActivationImp::getOwnPropertySlot): ditto
1816 (KJS::ActivationImp::deleteProperty): ditto
1817 (KJS::ActivationImp::put): ditto
1818 (KJS::ActivationImp::createArgumentsObject): ditto
1820 (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
1821 our properties doesn't try to recursively mark us. (This caused a crash
1822 in earlier testing. Not sure why we haven't run into it before.)
1824 * kjs/nodes.cpp: Functions now build a symbol table the first time
1826 (KJS::VarDeclNode::evaluate):
1827 (KJS::FunctionBodyNode::FunctionBodyNode):
1828 (KJS::FunctionBodyNode::initializeSymbolTable):
1829 (KJS::FunctionBodyNode::processDeclarations):
1830 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
1831 (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
1834 (KJS::FunctionBodyNode::symbolTable):
1836 * wtf/Forward.h: Added Vector.
1838 2007-10-26 Kevin McCullough <kmccullough@apple.com>
1840 - Corrected function name mistake in this changelog.
1842 2007-10-26 Kevin McCullough <kmccullough@apple.com>
1843 Reviewed by Sam and Steve.
1845 - Added convenience methods for converting between BSTR and JSStringRefs
1847 * API/JSStringRefCOM.cpp: Added.
1848 (JSStringCreateWithBSTR):
1850 * API/JSStringRefCOM.h: Added.
1851 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1853 2007-10-26 Mark Rowe <mrowe@apple.com>
1857 * kjs/collector.cpp:
1858 (KJS::Collector::collect):
1860 2007-10-26 Oliver Hunt <oliver@apple.com>
1864 Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
1866 * kjs/CollectorHeapIntrospector.cpp:
1867 (KJS::CollectorHeapIntrospector::init):
1868 (KJS::CollectorHeapIntrospector::enumerate):
1869 * kjs/CollectorHeapIntrospector.h:
1870 * kjs/collector.cpp:
1871 (KJS::Collector::recordExtraCost):
1872 (KJS::Collector::heapAllocate):
1873 (KJS::Collector::allocate):
1874 (KJS::Collector::allocateNumber):
1875 (KJS::Collector::registerThread):
1876 (KJS::Collector::markStackObjectsConservatively):
1877 (KJS::Collector::markMainThreadOnlyObjects):
1878 (KJS::Collector::sweep):
1879 (KJS::Collector::collect):
1882 (KJS::NumberImp::operator new):
1883 Force numbers to be allocated in the secondary heap.
1885 2007-10-26 Maciej Stachowiak <mjs@apple.com>
1889 - encourage GCC a little harder to inline a few hot functions for 1.5% improvement on SunSpider.
1892 (KJS::JSValue::getUInt32):
1893 (KJS::JSValue::getTruncatedInt32):
1894 (KJS::JSValue::toNumber):
1896 (WTF::PassRefPtr::~PassRefPtr):
1898 (WTF::RefPtr::operator->):
1900 2007-10-26 Mark Rowe <mrowe@apple.com>
1906 2007-10-26 Maciej Stachowiak <mjs@apple.com>
1910 - Merge Context class fully into ExecState, since they are always created and used together.
1912 No measurable performance impact but this is a useful cleanup.
1914 * JavaScriptCore.pri:
1915 * kjs/ExecState.cpp:
1916 (KJS::ExecState::ExecState):
1917 (KJS::ExecState::~ExecState):
1918 (KJS::ExecState::mark):
1919 (KJS::ExecState::lexicalInterpreter):
1921 (KJS::ExecState::dynamicInterpreter):
1922 (KJS::ExecState::setException):
1923 (KJS::ExecState::clearException):
1924 (KJS::ExecState::exception):
1925 (KJS::ExecState::exceptionSlot):
1926 (KJS::ExecState::hadException):
1927 (KJS::ExecState::scopeChain):
1928 (KJS::ExecState::callingExecState):
1929 (KJS::ExecState::propertyNames):
1930 * kjs/collector.cpp:
1931 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
1933 (KJS::FunctionImp::callAsFunction):
1934 (KJS::FunctionImp::argumentsGetter):
1935 (KJS::FunctionImp::callerGetter):
1936 (KJS::GlobalFuncImp::callAsFunction):
1937 * kjs/interpreter.cpp:
1938 (KJS::Interpreter::Interpreter):
1939 (KJS::Interpreter::init):
1940 (KJS::Interpreter::evaluate):
1941 (KJS::Interpreter::mark):
1942 * kjs/interpreter.h:
1943 (KJS::Interpreter::setCurrentExec):
1944 (KJS::Interpreter::currentExec):
1946 (KJS::currentSourceId):
1947 (KJS::currentSourceURL):
1948 (KJS::ThisNode::evaluate):
1949 (KJS::ResolveNode::evaluate):
1950 (KJS::FunctionCallResolveNode::evaluate):
1951 (KJS::PostfixResolveNode::evaluate):
1952 (KJS::DeleteResolveNode::evaluate):
1953 (KJS::TypeOfResolveNode::evaluate):
1954 (KJS::PrefixResolveNode::evaluate):
1955 (KJS::AssignResolveNode::evaluate):
1956 (KJS::VarDeclNode::evaluate):
1957 (KJS::DoWhileNode::execute):
1958 (KJS::WhileNode::execute):
1959 (KJS::ForNode::execute):
1960 (KJS::ForInNode::execute):
1961 (KJS::ContinueNode::execute):
1962 (KJS::BreakNode::execute):
1963 (KJS::ReturnNode::execute):
1964 (KJS::WithNode::execute):
1965 (KJS::SwitchNode::execute):
1966 (KJS::LabelNode::execute):
1967 (KJS::TryNode::execute):
1968 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
1969 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
1970 (KJS::FunctionBodyNode::processDeclarations):
1971 (KJS::FuncDeclNode::makeFunction):
1972 (KJS::FuncExprNode::evaluate):
1974 2007-10-26 Mark Rowe <mrowe@apple.com>
1978 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1980 2007-10-26 Mark Rowe <mrowe@apple.com>
1984 * JavaScriptCore.pri:
1985 * kjs/ExecState.cpp:
1987 2007-10-26 Maciej Stachowiak <mjs@apple.com>
1991 - moved Context class into ExecState.{h,cpp} in preparation for merging
1992 ExecState and Context classes.
1994 * kjs/ExecState.h: Moved CodeType enum and Context class here in
1995 preparation for merging ExecState and Context.
1996 * kjs/ExecState.cpp: Moved Context class here from Context.cpp.
1997 (KJS::Context::Context):
1998 (KJS::Context::~Context):
1999 (KJS::Context::mark):
2000 * kjs/context.h: Removed.
2001 * kjs/Context.cpp: Removed.
2002 * kjs/function.h: Removed CodeType enum.
2003 * kjs/LabelStack.h: Added. Pulled LabelStack class out of internal.h.
2004 * kjs/internal.h: Removed LabelStack.
2005 * JavaScriptCore.xcodeproj/project.pbxproj: Added new file, removed ones that are gone.
2006 * kjs/collector.cpp: Fixed includes.
2007 * kjs/function.cpp: ditto
2008 * kjs/internal.cpp: ditto
2009 * kjs/interpreter.cpp: ditto
2010 * kjs/lookup.h: ditto
2011 * kjs/nodes.cpp: ditto
2013 2007-10-26 Mark Rowe <mrowe@apple.com>
2017 * kjs/string_object.cpp:
2018 (KJS::StringObjectFuncImp::callAsFunction):
2020 2007-10-25 Darin Adler <darin@apple.com>
2024 - http://bugs.webkit.org/show_bug.cgi?id=15703
2025 fix numeric functions -- improve correctness and speed
2027 Gives about 1% gain on SunSpider.
2029 * kjs/value.h: Added toIntegerPreserveNan, removed toUInt16.
2030 (KJS::JSValue::toInt32): Changed to call getTruncatedInt32 in a way that works
2031 with both immediate and number values.
2032 (KJS::JSValue::toUInt32): Ditto.
2034 (KJS::JSValue::toInteger): Moved the logic from roundValue here, with a couple
2035 differences. One is that it now correctly returns 0 for NaN, and another is that
2036 there's no special case for 0 or infinity, since the general case already handles
2038 (KJS::JSValue::toIntegerPreserveNaN): Added. Like toInteger, but without the
2040 (KJS::JSValue::toInt32SlowCase): Call toNumber instead of roundValue. The
2041 truncation done by the typecast already does the necessary truncation that
2042 roundValue was doing.
2043 (KJS::JSValue::toUInt32SlowCase): Ditto.
2044 (KJS::JSValue::toUInt16): Removed.
2046 * kjs/internal.h: Removed roundValue.
2047 * kjs/internal.cpp: Ditto.
2049 * kjs/array_object.cpp: (KJS::ArrayProtoFunc::callAsFunction): Remove unneeded
2050 code to handle NaN in Array.slice; toInteger now never returns NaN as specified.
2052 * kjs/date_object.cpp:
2053 (KJS::fillStructuresUsingTimeArgs): Replaced call to roundValue with a call to
2054 toNumber as specified.
2055 (KJS::DateProtoFunc::callAsFunction): In SetTime case, replaced call to roundValue
2056 with a call to toNumber and timeClip as specified.
2057 (KJS::DateObjectImp::construct): Removed unnecessary checks of numArgs in cases
2058 where the default behavior of toInt32 (returning 0) was already correct. Replaced
2059 call to roundValue with a call to toNumber as specified.
2060 (KJS::DateObjectFuncImp::callAsFunction): Ditto.
2062 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Removed unnecessary special
2063 cases for the pow function that the library already handles correctly.
2065 * kjs/number_object.cpp: (NumberProtoFunc::callAsFunction): Changed ToString to
2066 call toIntegerPreserveNaN, so we can continue to handle the NaN case differently.
2067 The real toInteger now returns 0 for NaN. Took out unneeded special case in
2068 ToFixed for undefined; was only needed because our toInteger was wrong. Same
2069 thing in ToExponential. Changed ToPrecision to call toIntegerPreserveNaN.
2071 * kjs/string_object.cpp:
2072 (KJS::StringProtoFunc::callAsFunction): Took out CharAt and CharCodeAt special
2073 cases for undefined that were only needed because toInteger was wrong. Same in
2074 IndexOf, and was able to remove some special cases. In LastIndexOf, used
2075 toIntegerPreserveNaN, but was able to remove some special cases there too.
2076 Changed Substr implementation to preserve correct behavior with the change
2077 to toInteger and match the specification. Also made sure we weren't converting
2078 an out of range double to an int.
2079 (KJS::StringObjectFuncImp::callAsFunction): Changed constructor to just use
2080 toUInt32, because truncating toUInt32 to 16 bits is the same thing and there's
2081 no reason to have toUInt16 as a second, less-optimized function that's only
2082 called at this one call site.
2084 * wtf/MathExtras.h: Added trunc function for Windows.
2086 2007-10-25 Geoffrey Garen <ggaren@apple.com>
2088 Reviewed by Maciej Stachowiak.
2090 Tweaked the inner hashtable lookup loop to remove a branch in the "not
2091 found" case. .5% speedup on SunSpider.
2093 * JavaScriptCore.xcodeproj/project.pbxproj:
2097 2007-10-25 Maciej Stachowiak <mjs@apple.com>
2101 - fold together toPrimitive() and toNumber() conversions for 0.5% gain on SunSpider
2104 (KJS::SubNode::evaluate): Subtract directly, since toPrimitive() is not
2105 adding any value over toNumber() here.
2106 (KJS::valueForReadModifyAssignment): Ditto.
2107 (KJS::lessThan): Use new getPrimitiveNumber() method to avoid some virtual calls
2109 (KJS::lessThanEq): Ditto.
2110 * JavaScriptCore.exp: Export new functions as needed.
2112 (KJS::JSValue::toPrimitive): Fixed formatting.
2113 (KJS::JSValue::getPrimitiveNumber): New method - this simultaneously converts
2114 to number and tells you whether a toPrimitive() conversion with a Number hint
2115 would have given a string.
2117 (KJS::StringImp::getPrimitiveNumber): Implemented.
2118 (KJS::NumberImp::getPrimitiveNumber): ditto
2119 (KJS::GetterSetterImp::getPrimitiveNumber): ditto
2120 (KJS::StringImp::toPrimitive): Fixed formatting.
2121 (KJS::NumberImp::toPrimitive): ditto
2122 (KJS::GetterSetterImp::toPrimitive): ditto
2125 (KJS::JSObject::getPrimitiveNumber): Implemented.
2128 2007-10-25 Sam Weinig <sam@webkit.org>
2130 Reviewed by Adam Roben.
2132 Remove JSStringRefCFHack from windows as it is no longer needed.
2134 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2136 2007-10-25 Geoffrey Garen <ggaren@apple.com>
2138 Reviewed by Oliver Hunt.
2140 Rolled out my last patch. It turns out that I needed 2 words, not 1,
2143 2007-10-25 Geoffrey Garen <ggaren@apple.com>
2145 Reviewed by Oliver Hunt.
2147 Fixed http://bugs.webkit.org/show_bug.cgi?id=15694
2148 Shrink the size of an activation object by 1 word
2150 This is in preparation for adding a symbol table to the activation
2153 The basic strategy here is to rely on the mutual exclusion between
2154 the arguments object pointer and the function pointer (you only need
2155 the latter in order to create the former), and store them in the same
2156 place. The LazyArgumentsObject class encapsulates this strategy.
2158 Also inlined the ArgumentsImp constructor, for good measure.
2160 SunSpider reports no regression. Regression tests pass.
2162 * JavaScriptCore.xcodeproj/project.pbxproj:
2164 (KJS::Context::~Context):
2166 (KJS::ActivationImp::LazyArgumentsObject::createArgumentsObject):
2167 (KJS::ActivationImp::LazyArgumentsObject::mark):
2169 (KJS::ActivationImp::argumentsGetter):
2170 (KJS::ActivationImp::mark):
2172 (KJS::ActivationImp::LazyArgumentsObject::LazyArgumentsObject):
2173 (KJS::ActivationImp::LazyArgumentsObject::getOrCreate):
2174 (KJS::ActivationImp::LazyArgumentsObject::resetArguments):
2175 (KJS::ActivationImp::LazyArgumentsObject::setArgumentsObject):
2176 (KJS::ActivationImp::LazyArgumentsObject::argumentsObject):
2177 (KJS::ActivationImp::LazyArgumentsObject::setFunction):
2178 (KJS::ActivationImp::LazyArgumentsObject::function):
2179 (KJS::ActivationImp::LazyArgumentsObject::createdArgumentsObject):
2180 (KJS::ActivationImp::LazyArgumentsObject::):
2181 (KJS::ActivationImp::ActivationImp::ActivationImp):
2182 (KJS::ActivationImp::resetArguments):
2184 2007-10-25 Adam Roben <aroben@apple.com>
2186 Change JavaScriptCore.vcproj to use DerivedSources.make
2188 We were trying to emulate the logic of make in
2189 build-generated-files.sh, but we got it wrong. We now use a
2190 build-generated-files very much like the one that WebCore uses to
2193 We also now only have a Debug configuration of dftables which we build
2194 even when doing a Release build of JavaScriptCore. dftables also no
2195 longer has the "_debug" name suffix.
2197 Changes mostly made by Darin, reviewed by me.
2199 * DerivedSources.make: Add a variable to set the extension used for
2200 the dftables executable.
2201 * JavaScriptCore.vcproj/JavaScriptCore.sln: Updated to use Debug
2202 dftables in Release configurations.
2203 * JavaScriptCore.vcproj/JavaScriptCoreSubmit.sln: Ditto.
2204 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2205 - Updated include path to point to the new location of the derived
2207 - Modified pre-build event to pass the right arguments to
2208 build-generated-files.sh and not call dftables directly.
2209 - Added the derived source files to the project.
2210 - Removed grammarWrapper.cpp, which isn't needed now that we're
2211 compiling grammar.cpp directly.
2212 * JavaScriptCore.vcproj/JavaScriptCore/build-generated-files.sh:
2213 Slightly modified from the WebCore version.
2214 * JavaScriptCore.vcproj/JavaScriptCore/grammarWrapper.cpp: Removed.
2215 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
2216 - Changed the output location to match Mac.
2217 - Removed the Release configuration.
2218 - Removed the _debug suffix.
2220 2007-10-25 Geoffrey Garen <ggaren@apple.com>
2222 Reviewed by Eric Seidel.
2224 Slightly elaborated the differences between declaration procesing in
2225 Function Code and Program Code.
2227 .3% speedup on SunSpider.
2230 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
2231 (KJS::FunctionBodyNode::processDeclarationsProgramCode): Store a
2232 minimum set of attributes instead of recomputing all the time. Also,
2233 ignore m_parameters, since programs don't have arguments.
2235 2007-10-25 Eric Seidel <eric@webkit.org>
2239 More preparation work before adding long-running mode to testkjs.
2242 (TestFunctionImp::callAsFunction):
2243 (prettyPrintScript):
2247 (fillBufferWithContentsOfFile):
2249 2007-10-25 Eric Seidel <eric@webkit.org>
2253 Bring testkjs code out of the dark ages in preparation for more
2254 radical improvements (like long-running testing support!)
2257 (TestFunctionImp::callAsFunction):
2260 (fillBufferWithContentsOfFile):
2262 2007-10-25 Geoffrey Garen <ggaren@apple.com>
2264 Reviewed by Maciej Stachowiak.
2266 Make a fast path for declaration processing inside Function Code.
2268 Lifted declaration processing code up from individual declaration nodes
2269 and into processDeclarations.
2271 Broke out processDeclarations into two cases, depending on the type of
2272 code. This eliminates 2 branches, and facilitates more radical
2273 divergeance in the future.
2275 2.5% SunSpider speedup.
2277 * JavaScriptCore.xcodeproj/project.pbxproj:
2279 (KJS::FunctionBodyNode::initializeDeclarationStacks):
2280 (KJS::FunctionBodyNode::processDeclarationsFunctionCode):
2281 (KJS::FunctionBodyNode::processDeclarationsProgramCode):
2282 (KJS::FunctionBodyNode::execute):
2283 (KJS::FuncDeclNode::makeFunction):
2287 2007-10-25 Maciej Stachowiak <mjs@apple.com>
2291 - add header includes needed on platforms that don't use AllInOneFile.cpp
2293 * API/JSCallbackObject.cpp:
2295 * kjs/ExecState.cpp:
2296 * kjs/array_instance.cpp:
2297 * kjs/function_object.cpp:
2298 * kjs/interpreter.cpp:
2301 2007-10-25 Eric Seidel <eric@webkit.org>
2305 * JavaScriptCore.xcodeproj/project.pbxproj: re-mark JSGlobalObject.h as private
2307 2007-10-25 Geoffrey Garen <ggaren@apple.com>
2309 Reviewed by Maciej Stachowiak.
2311 Fixed http://bugs.webkit.org/show_bug.cgi?id=15683
2312 Re-order declaration initialization to avoid calling hasProperty inside
2313 VarDeclNode::processDeclaration
2315 .7% speedup on SunSpider.
2318 * kjs/function.cpp: Merged parameter processing into FunctionBodyNode's
2319 other processing of declared symbols, so the order of execution could
2323 (KJS::VarDeclNode::getDeclarations): Added special case for the
2324 "arguments" property name, explained in the comment.
2326 (KJS::VarDeclNode::processDeclaration): Removed call to hasProperty
2327 in the case of function code, since we know the declared symbol
2328 management will resolve conflicts between symbols. Yay!
2330 (KJS::VarDeclListNode::getDeclarations): Now that VarDeclNode's
2331 implementation of getDeclarations is non-trivial, we can't take a
2332 short-cut here any longer -- we need to put the VarDecl node on the
2333 stack so it gets processed normally.
2335 (KJS::FunctionBodyNode::processDeclarations): Changed the order of
2336 processing to enforce mutual exclusion rules.
2339 (KJS::DeclarationStacks::DeclarationStacks): Structure includes an
2340 ExecState now, for fast access to the "arguments" property name.
2342 2007-10-24 Eric Seidel <eric@webkit.org>
2346 Add a JSGlobalObject class and remove the InterpreterMap
2347 http://bugs.webkit.org/show_bug.cgi?id=15681
2349 This required making JSCallbackObject a template class to allow for
2350 JSGlobalObjects with JSCallbackObject functionality.
2352 SunSpider claims this was a 0.5% speedup.
2354 * API/JSCallbackObject.cpp:
2356 * API/JSCallbackObject.h:
2357 * API/JSCallbackObjectFunctions.h: Copied from API/JSCallbackObject.cpp.
2358 (KJS::::JSCallbackObject):
2360 (KJS::::~JSCallbackObject):
2361 (KJS::::initializeIfNeeded):
2363 (KJS::::getOwnPropertySlot):
2365 (KJS::::deleteProperty):
2366 (KJS::::implementsConstruct):
2368 (KJS::::implementsHasInstance):
2369 (KJS::::hasInstance):
2370 (KJS::::implementsCall):
2371 (KJS::::callAsFunction):
2372 (KJS::::getPropertyNames):
2375 (KJS::::setPrivate):
2376 (KJS::::getPrivate):
2378 (KJS::::cachedValueGetter):
2379 (KJS::::staticValueGetter):
2380 (KJS::::staticFunctionGetter):
2381 (KJS::::callbackGetter):
2382 * API/JSClassRef.cpp:
2383 (OpaqueJSClass::prototype):
2384 * API/JSContextRef.cpp:
2385 (JSGlobalContextCreate):
2386 * API/JSObjectRef.cpp:
2388 (JSObjectGetPrivate):
2389 (JSObjectSetPrivate):
2390 * API/JSValueRef.cpp:
2391 (JSValueIsObjectOfClass):
2392 * JavaScriptCore.exp:
2393 * JavaScriptCore.xcodeproj/project.pbxproj:
2394 * bindings/c/c_utility.cpp:
2395 (KJS::Bindings::convertValueToNPVariant):
2396 * bindings/jni/jni_jsobject.cpp:
2397 * bindings/objc/objc_utility.mm:
2398 (KJS::Bindings::convertValueToObjcValue):
2400 (KJS::Context::Context):
2401 * kjs/ExecState.cpp:
2402 (KJS::ExecState::lexicalInterpreter):
2403 * kjs/JSGlobalObject.h: Added.
2404 (KJS::JSGlobalObject::JSGlobalObject):
2405 (KJS::JSGlobalObject::isGlobalObject):
2406 (KJS::JSGlobalObject::interpreter):
2407 (KJS::JSGlobalObject::setInterpreter):
2408 * kjs/array_instance.cpp:
2411 (KJS::FunctionImp::callAsFunction):
2412 (KJS::GlobalFuncImp::callAsFunction):
2413 * kjs/interpreter.cpp:
2414 (KJS::Interpreter::Interpreter):
2415 (KJS::Interpreter::init):
2416 (KJS::Interpreter::~Interpreter):
2417 (KJS::Interpreter::globalObject):
2418 (KJS::Interpreter::initGlobalObject):
2419 (KJS::Interpreter::evaluate):
2420 * kjs/interpreter.h:
2422 (KJS::cacheGlobalObject):
2424 (KJS::JSObject::isGlobalObject):
2427 2007-10-24 Eric Seidel <eric@webkit.org>
2429 Build fix for Gtk, no review.
2431 * kjs/collector.cpp: #include "context.h"
2433 2007-10-24 Eric Seidel <eric@webkit.org>
2437 Stop checking isOutOfMemory after every allocation, instead let the collector
2438 notify all ExecStates if we ever hit this rare condition.
2440 SunSpider claims this was a 2.2% speedup.
2442 * kjs/collector.cpp:
2443 (KJS::Collector::collect):
2444 (KJS::Collector::reportOutOfMemoryToAllInterpreters):
2447 (KJS::TryNode::execute):
2449 2007-10-24 Mark Rowe <mrowe@apple.com>
2453 * kjs/identifier.h: Remove extra qualification.
2455 2007-10-24 Geoffrey Garen <ggaren@apple.com>
2457 Reviewed by Sam Weinig.
2459 Disable ALWAYS_INLINE in debug builds, since it drives the debugger
2462 * wtf/AlwaysInline.h:
2464 2007-10-24 Geoffrey Garen <ggaren@apple.com>
2466 Reviewed by Sam Weinig.
2468 Inlined the fast path for creating an Identifier from an Identifier.
2470 This is a .4% speedup on SunSpider overall, but as big as a 2.5%
2471 speedup on certain individual tests. 65% of the Identifiers creating
2472 by SunSpider are already Identifiers.
2474 (The main reason I'm making this change is that it resolves a large
2475 regression in a patch I haven't checked in yet.)
2477 * JavaScriptCore.exp:
2478 * kjs/identifier.cpp:
2479 (KJS::Identifier::addSlowCase):
2481 (KJS::Identifier::Identifier::add):
2483 2007-10-24 Lars Knoll <lars@trolltech.com>
2487 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.
2489 * bindings/qt/qt_instance.cpp:
2490 (KJS::Bindings::QtInstance::invokeMethod):
2491 * bindings/qt/qt_runtime.cpp:
2492 (KJS::Bindings::convertValueToQVariant):
2493 (KJS::Bindings::QtField::setValueToInstance):
2495 2007-10-24 Oliver Hunt <oliver@apple.com>
2499 Remove old relation method, replace with specialised LessThan and lessThenEq functions for a 0.5-0.6% improvement in SunSpider
2504 (KJS::LessNode::evaluate):
2505 (KJS::GreaterNode::evaluate):
2506 (KJS::LessEqNode::evaluate):
2507 (KJS::GreaterEqNode::evaluate):
2508 * kjs/operations.cpp:
2511 2007-10-24 Eric Seidel <eric@webkit.org>
2516 (KJS::ImmediateNumberNode::): Fix ASSERT correctness (and debug build!)
2518 2007-10-24 Darin Adler <darin@apple.com>
2522 * kjs/object.cpp: (KJS::JSObject::defaultValue): Get rid of a little
2523 Identifier ref/deref for what SunSpider claims is a 0.4% speedup.
2525 2007-10-24 Darin Adler <darin@apple.com>
2529 - separate out the code to create a hash table the first time from the code
2532 SunSpider claims this was a 0.7% speedup.
2534 * kjs/property_map.cpp:
2535 (KJS::PropertyMap::expand): Changed to call either createTable or rehash.
2536 (KJS::PropertyMap::createTable): Added. For the case where we had no table.
2537 (KJS::PropertyMap::rehash): Removed code needed only in the case where we
2539 * kjs/property_map.h: Added createTable.
2541 2007-10-24 Eric Seidel <eric@webkit.org>
2545 Add ImmediateNumberNode to hold a JSValue* instead of a double for numbers
2546 which can be represented by JSImmediate.
2548 SunSpider claims this was a 0.6% speedup.
2552 (KJS::NumberNode::evaluate):
2553 (KJS::ImmediateNumberNode::evaluate):
2556 (KJS::ImmediateNumberNode::):
2557 * kjs/nodes2string.cpp:
2558 (ImmediateNumberNode::streamTo):
2560 2007-10-24 Darin Adler <darin@apple.com>
2564 - http://bugs.webkit.org/show_bug.cgi?id=15657
2565 change static hash tables to use powers of two for speed
2567 Seems to give 0.7% SunSpider speedup.
2569 * kjs/create_hash_table: Updated to generate new format.
2571 (KJS::keysMatch): Took out unneeded typecast.
2572 (KJS::findEntry): Updated to expect table type 3 -- changed the printf to a plain old assert.
2573 Replaced the modulus with a bit mask.
2574 (KJS::Lookup::findEntry): Get the hash directly, since we know identifiers already have computed
2575 their hash -- saves a branch.
2576 (KJS::Lookup::find): Ditto.
2577 * kjs/lookup.h: Changed attr from 2-byte value to one-byte value. Replaced hashSize with hashSizeMask.
2579 2007-10-24 Maciej Stachowiak <mjs@apple.com>
2583 - remove KJS_CHECKEXCEPTIONs in places where exceptions can't happen for 0.6% SunSpider speedup
2586 (KJS::DoWhileNode::execute):
2587 (KJS::WhileNode::execute):
2588 (KJS::ForNode::execute):
2589 (KJS::ForInNode::execute):
2590 (KJS::SourceElementsNode::execute):
2592 2007-10-23 Darin Adler <darin@apple.com>
2596 * kjs/JSImmediate.h: (KJS::JSImmediate::getUInt32):
2597 Changed an && to an & for a 1% gain in SunSpider.
2599 2007-10-23 Oliver Hunt <oliver@apple.com>
2603 Reduce branching in implementations of some operator implementations, yielding 1.3% boost to SunSpider.
2606 (KJS::MultNode::evaluate):
2607 (KJS::DivNode::evaluate):
2608 (KJS::ModNode::evaluate):
2611 (KJS::AddNode::evaluate):
2612 (KJS::SubNode::evaluate):
2613 (KJS::valueForReadModifyAssignment):
2614 * kjs/operations.cpp:
2617 2007-10-23 Oliver Hunt <oliver@apple.com>
2621 Separating all of the simple (eg. non-read-modify-write) binary operators
2622 into separate classes in preparation for further JS optimisations.
2624 Happily this produces a 0.8% to 1.0% performance increase in SunSpider with
2627 * JavaScriptCore.xcodeproj/project.pbxproj:
2630 (KJS::MultNode::evaluate):
2631 (KJS::DivNode::evaluate):
2632 (KJS::ModNode::evaluate):
2633 (KJS::AddNode::evaluate):
2634 (KJS::SubNode::evaluate):
2635 (KJS::LeftShiftNode::evaluate):
2636 (KJS::RightShiftNode::evaluate):
2637 (KJS::UnsignedRightShiftNode::evaluate):
2638 (KJS::LessNode::evaluate):
2639 (KJS::GreaterNode::evaluate):
2640 (KJS::LessEqNode::evaluate):
2641 (KJS::GreaterEqNode::evaluate):
2642 (KJS::InstanceOfNode::evaluate):
2643 (KJS::InNode::evaluate):
2644 (KJS::EqualNode::evaluate):
2645 (KJS::NotEqualNode::evaluate):
2646 (KJS::StrictEqualNode::evaluate):
2647 (KJS::NotStrictEqualNode::evaluate):
2648 (KJS::BitAndNode::evaluate):
2649 (KJS::BitXOrNode::evaluate):
2650 (KJS::BitOrNode::evaluate):
2651 (KJS::LogicalAndNode::evaluate):
2652 (KJS::LogicalOrNode::evaluate):
2659 (KJS::LeftShiftNode::):
2660 (KJS::RightShiftNode::):
2661 (KJS::UnsignedRightShiftNode::):
2663 (KJS::GreaterNode::):
2664 (KJS::LessEqNode::):
2665 (KJS::GreaterEqNode::):
2666 (KJS::InstanceOfNode::):
2669 (KJS::NotEqualNode::):
2670 (KJS::StrictEqualNode::):
2671 (KJS::NotStrictEqualNode::):
2672 (KJS::BitAndNode::):
2674 (KJS::BitXOrNode::):
2675 (KJS::LogicalAndNode::):
2676 (KJS::LogicalOrNode::):
2677 * kjs/nodes2string.cpp:
2678 (MultNode::streamTo):
2679 (DivNode::streamTo):
2680 (ModNode::streamTo):
2681 (AddNode::streamTo):
2682 (SubNode::streamTo):
2683 (LeftShiftNode::streamTo):
2684 (RightShiftNode::streamTo):
2685 (UnsignedRightShiftNode::streamTo):
2686 (LessNode::streamTo):
2687 (GreaterNode::streamTo):
2688 (LessEqNode::streamTo):
2689 (GreaterEqNode::streamTo):
2690 (InstanceOfNode::streamTo):
2692 (EqualNode::streamTo):
2693 (NotEqualNode::streamTo):
2694 (StrictEqualNode::streamTo):
2695 (NotStrictEqualNode::streamTo):
2696 (BitAndNode::streamTo):
2697 (BitXOrNode::streamTo):
2698 (BitOrNode::streamTo):
2699 (LogicalAndNode::streamTo):
2701 2007-10-23 Darin Adler <darin@apple.com>
2705 - fix http://bugs.webkit.org/show_bug.cgi?id=15639
2706 fix Math.abs(0), Math.ceil(-0), and Math.floor(-0)
2708 Test: fast/js/math.html
2710 * kjs/math_object.cpp: (MathFuncImp::callAsFunction):
2711 Fix abs to look at the sign bit. Add a special case for values in the range
2712 between -0 and -1 and a special case for ceil and for -0 for floor.
2714 2007-10-23 Darin Adler <darin@apple.com>
2718 - streamline exception handling code for a >1% speed-up of SunSpider
2720 * kjs/nodes.cpp: Changed macros to use functions for everything that's not
2721 part of normal execution. We'll take function call overhead when propagating
2722 an exception or out of memory.
2723 (KJS::createOutOfMemoryCompletion): Added.
2724 (KJS::substitute): Use append instead of the relatively inefficient + operator.
2725 (KJS::Node::rethrowException): Added.
2726 * kjs/nodes.h: Added rethrowException.
2728 2007-10-22 Darin Adler <darin@apple.com>
2732 - fix http://bugs.webkit.org/show_bug.cgi?id=15636
2733 some JavaScriptCore regression tests are failing due to numeric conversion
2735 This should restore correctness and make speed better too, restoring some
2736 of the optimization we lost in my last check-in.
2738 * kjs/JSImmediate.h:
2739 (KJS::JSImmediate::getTruncatedInt32): Added. Uses the range checking idiom
2740 I used in my patch yesterday.
2741 (KJS::JSImmediate::getTruncatedUInt32): Ditto.
2743 * kjs/internal.h: Removed getInt32 and added getTruncatedInt/UInt32.
2745 (KJS::NumberImp::getUInt32): Changed to always use double, since I can't find
2746 a way to write this more efficiently for float.
2747 (KJS::NumberImp::getTruncatedInt32): Added.
2748 (KJS::NumberImp::getTruncatedUInt32): Added.
2750 * kjs/value.h: Removed getInt32 and added getTruncatedInt/UInt32.
2751 (KJS::JSValue::getUInt32):
2752 (KJS::JSValue::getTruncatedInt32): Added.
2753 (KJS::JSValue::getTruncatedUInt32): Added.
2754 (KJS::JSValue::toInt32): Changed getInt32 call to getTruncatedInt32.
2755 (KJS::JSValue::toUInt32): Changed getUInt32 call to getTruncatedUInt32.
2757 (KJS::JSCell::getTruncatedInt32): Added.
2758 (KJS::JSCell::getTruncatedUInt32): Added.
2759 (KJS::JSValue::toInteger): Changed getUInt32 call to getTruncatedInt32.
2760 (KJS::JSValue::toInt32SlowCase): Removed extra getInt32 call I accidentally
2762 (KJS::JSValue::toUInt32SlowCase): Ditto.
2763 (KJS::JSValue::toUInt16): Changed getUInt32 call to getTruncatedUInt32.
2765 * JavaScriptCore.exp: Updated.
2767 2007-10-22 Darin Adler <darin@apple.com>
2771 - fix http://bugs.webkit.org/show_bug.cgi?id=15632
2772 js1_5/Array/array-001.js test failing
2774 One of the JavaScriptCore tests was failing; it failed because of
2775 my change to NumberImp::getUInt32. The incorrect code I copied was
2776 from JSImmediate::getUInt32, and was a pre-existing bug.
2778 This patch fixes correctness, but will surely slow down SunSpider.
2779 We may be able to code this tighter and get the speed back.
2781 * kjs/JSImmediate.h:
2782 (KJS::JSImmediate::getInt32): Renamed from toInt32 to more accurately
2783 reflect the fact that this function only returns true if the value is
2784 accurate (no fractional part, etc.). Changed code so that it returns
2785 false when the value has a fraction.
2786 (KJS::JSImmediate::getUInt32): Ditto.
2789 (KJS::NumberImp::getInt32): Changed code so that it returns false when
2790 the value has a fraction. Restores the old behavior.
2791 (KJS::NumberImp::getUInt32): Ditto.
2794 (KJS::JSValue::getInt32): Updated for name change.
2795 (KJS::JSValue::getUInt32): Ditto.
2796 (KJS::JSValue::toInt32): Ditto.
2797 (KJS::JSValue::toUInt32): Ditto.
2799 2007-10-22 Darin Adler <darin@apple.com>
2803 - fix crash seen when running JavaScriptCore tests
2805 * kjs/array_instance.cpp: (KJS::ArrayInstance::mark):
2806 Copy and paste error: I accidentally had code here that was
2807 making a copy of the HashMap -- that's illegal inside a mark
2808 function and was unnecessary. The other callsite was modifying
2809 the map as it iterated it, but this function is not.
2811 2007-10-22 Maciej Stachowiak <mjs@apple.com>
2815 - Avoid moving floats into integer registers in jsNumber() for 3% speedup on SunSpider
2816 http://bugs.webkit.org/show_bug.cgi?id=15627
2818 * kjs/JSImmediate.h:
2819 (KJS::JSImmediate::fromDouble): Avoid moving floats to integer
2820 registers since this is very slow.
2822 2007-10-22 Darin Adler <darin@apple.com>
2824 Reviewed by Eric Seidel.
2826 - http://bugs.webkit.org/show_bug.cgi?id=15617
2827 improve speed of integer conversions
2829 Makes SunSpider 6% faster.
2831 * kjs/JSImmediate.h: Added toInt32 and toUInt32, with separate versions for
2834 (KJS::JSValue::getUInt32): Call JSImmediate::toUInt32.
2836 * kjs/internal.h: Added getInt32.
2838 (KJS::NumberImp::getInt32): Added.
2839 (KJS::NumberImp::getUInt32): Replaced with more-optimal implementation
2840 stolen from JSValue.
2843 (KJS::jsNumber): Marked ALWAYS_INLINE, because this wasn't getting
2845 (KJS::JSValue::getInt32): Added.
2846 (KJS::JSValue::getUInt32): Changed to call the new JSImmediate::toUInt32
2847 to avoid converting from float to double.
2848 (KJS::JSValue::toInt32): Made inline, separated out the slow case.
2849 (KJS::JSValue::toUInt32): Ditto.
2851 (KJS::JSCell::getInt32): Added.
2852 (KJS::JSValue::toInt32SlowCase): Renamed from toInt32. Changed to use the
2853 new getInt32. Added a faster case for in-range numbers.
2854 (KJS::JSValue::toUInt32SlowCase): Ditto.
2855 (KJS::JSValue::toUInt16): Added a faster case for in-range numbers.
2857 * JavaScriptCore.exp: Updated for changes.
2859 2007-10-22 Adam Roben <aroben@apple.com>
2863 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn off
2864 warning about implicit conversion to bool.
2866 2007-10-22 Mark Rowe <mrowe@apple.com>
2870 * kjs/array_instance.cpp:
2872 2007-10-22 Darin Adler <darin@apple.com>
2876 - http://bugs.webkit.org/show_bug.cgi?id=15606
2877 make cut-off for sparse vs. dense arrays smarter for speed with large arrays
2879 Makes the morph test in SunSpider 26% faster, and the overall
2880 benchmark 3% faster.
2882 This also fixes some small problems we had with the distinction
2883 between nonexistent and undefined values in arrays.
2885 * kjs/array_instance.h: Tweaked formatting and naming.
2886 * kjs/array_instance.cpp: Copied from kjs/array_object.cpp.
2887 (KJS::storageSize): Added. Computes the size of the storage given a vector length.
2888 (KJS::increasedVectorLength): Added. Implements the rule for resizing the vector.
2889 (KJS::isDenseEnoughForVector): Added.
2890 (KJS::ArrayInstance::ArrayInstance): Initialize the new fields.
2891 (KJS::ArrayInstance::~ArrayInstance): Since m_storage is now never 0, delete it.
2892 (KJS::ArrayInstance::getItem): Updated for name changes.
2893 (KJS::ArrayInstance::lengthGetter): Ditto.
2894 (KJS::ArrayInstance::inlineGetOwnPropertySlot): Added. Allows both versions of
2895 getOwnPropertySlot to share more code.
2896 (KJS::ArrayInstance::getOwnPropertySlot): Just refactored, no code change.
2897 (KJS::ArrayInstance::put): Added logic for extending the vector as long as the
2898 array is dense enough. Also keep m_numValuesInVector up to date.
2899 (KJS::ArrayInstance::deleteProperty): Added code to keep m_numValuesInVector
2901 (KJS::ArrayInstance::getPropertyNames): Fixed bug where this would omit names
2902 for array indices with undefined values.
2903 (KJS::ArrayInstance::increaseVectorLength): Renamed from resizeStorage. Also
2904 simplified to only handle getting larger.
2905 (KJS::ArrayInstance::setLength): Added code to update m_numValuesInVector, to
2906 zero out the unused part of the vector and to delete the map if it's no longer
2908 (KJS::ArrayInstance::mark): Tweaked formatting.
2909 (KJS::compareByStringForQSort): Ditto.
2910 (KJS::ArrayInstance::sort): Ditto.
2911 (KJS::CompareWithCompareFunctionArguments::CompareWithCompareFunctionArguments):
2913 (KJS::compareWithCompareFunctionForQSort): Ditto.
2914 (KJS::ArrayInstance::compactForSorting): Fixed bug where this would turn
2915 undefined values into nonexistent values in some cases.
2917 * kjs/array_object.h: Removed MAX_ARRAY_INDEX.
2918 * kjs/array_object.cpp: Removed ArrayInstance. Moved to a separate file.
2920 * JavaScriptCore.pri: Added array_instance.cpp.
2921 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
2922 * kjs/AllInOneFile.cpp: Ditto.
2924 2007-10-22 Andrew Wellington <proton@wiretapped.net>
2926 Reviewed by Mark Rowe.
2928 Fix for local database support after r26879
2929 Ensure that ENABLE_DATABASE and ENABLE_ICONDATABASE are correctly set
2931 * Configurations/JavaScriptCore.xcconfig:
2933 2007-10-22 Simon Hausmann <hausmann@kde.org>
2937 Build fix for the non-qmake builds.
2939 * wtf/Platform.h: Default to enabling the database features unless
2940 otherwise specified. (similar to ENABLE_ICONDATABASE)
2942 2007-10-22 Holger Freyther <zecke@selfish.org>
2944 Reviewed by Simon Hausmann <hausmann@kde.org>.
2946 * Do not build testkjs as an application bundle. This is
2947 needed for run-javascriptcore-tests on OSX.
2948 * Also, based on r26633, allow to test the WebKit/Qt port on OSX.
2949 * Set DYLD_LIBRARY_PATH if it was set in the environment. It must be set
2950 as we do not have -rpath on OSX.
2954 2007-10-21 Mark Rowe <mrowe@apple.com>
2958 http://bugs.webkit.org/show_bug.cgi?id=15575
2959 Bug 15575: [GTK] Implement threading using GThread
2961 * wtf/Platform.h: Do not enable pthreads for Gtk.
2963 2007-10-21 Mark Rowe <mrowe@apple.com>
2967 Fix http://bugs.webkit.org/show_bug.cgi?id=15603
2968 Bug 15603: Regression(r26847): Crash when sorting an empty array from JavaScript
2970 * kjs/array_object.cpp:
2971 (KJS::freeStorage): Reinstate null-check that was removed in r26847.
2973 2007-10-21 Darin Adler <darin@apple.com>
2977 * kjs/array_instance.h: Removed unused ExecState parameter.
2978 * kjs/array_object.cpp:
2979 (KJS::ArrayInstance::put): Ditto.
2980 (KJS::ArrayInstance::setLength): Ditto.
2982 2007-10-21 Darin Adler <darin@apple.com>
2984 * kjs/array_object.cpp: (KJS::ArrayInstance::put):
2985 Add missing assignment that was causing regression test crash.
2987 2007-10-21 Darin Adler <darin@apple.com>
2991 - http://bugs.webkit.org/show_bug.cgi?id=15585
2992 speed up sparse arrays by using a custom map
2994 Speeds up SunSpider by 10%.
2996 * kjs/array_object.cpp:
2997 (allocateStorage): Leave room for an additional pointer.
2998 (reallocateStorage): Ditto.
2999 (freeStorage): Ditto.
3000 (ArrayInstance::~ArrayInstance): Delete the overflow map if present.
3001 (ArrayInstance::getItem): Read values from the overflow map if present.
3002 Removed the check of length, since it slows down the common case.
3003 (ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback
3004 to the property map.
3005 (ArrayInstance::put): Write values into the overflow map as needed.
3006 Also create overflow map when needed.
3007 (ArrayInstance::deleteProperty): Remove values from the overflow map
3009 (ArrayInstance::getPropertyNames): Add a name for each identifier in
3010 the property map. This is extremely inefficient.
3011 (ArrayInstance::setLength): Remove any values in the overflow map
3012 that are past the new length, as we formerly did with the property map.
3013 (ArrayInstance::mark): Mark any values in the overflow map.
3014 (compareByStringForQSort): Removed unneeded undefined case, since
3015 compactForSorting guarantees we will have no undefined values.
3016 (compareWithCompareFunctionForQSort): Ditto.
3017 (ArrayInstance::compactForSorting): Copy all the values out of the
3018 overflow map and destroy it.
3020 * kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
3021 * kjs/property_map.cpp: Ditto.
3023 2007-10-20 Darin Adler <darin@apple.com>
3027 - http://bugs.webkit.org/show_bug.cgi?id=15579
3028 stop churning identifier reference counts copying Completion objects
3030 * kjs/completion.h: Replace the Identifier with an Identifier*.
3032 (ForInNode::execute): Update for change to Completion constructor.
3033 (ContinueNode::execute): Ditto.
3034 (BreakNode::execute): Ditto.
3036 2007-10-20 Mark Rowe <mrowe@apple.com>
3040 Gtk changes needed to enable HTML 5 client-side database storage.
3042 * wtf/Platform.h: Have Gtk use pthreads for now.
3044 2007-10-20 Geoffrey Garen <ggaren@apple.com>
3046 Reviewed by Maciej Stachowiak.
3048 Fixed http://bugs.webkit.org/show_bug.cgi?id=15570
3049 Store gathered declaration nodes in the function body node.
3051 This means that you only have to gather the declaration nodes the first
3052 time the function executes. Performance gain of 2.10% on SunSpider,
3053 0.90% on command-line JS iBench.
3055 * kjs/nodes.cpp: Split declaration stack initialization code off into
3056 initializeDeclarationStacks().
3057 (FunctionBodyNode::FunctionBodyNode):
3058 (FunctionBodyNode::initializeDeclarationStacks):
3059 (FunctionBodyNode::processDeclarations):
3061 * kjs/nodes.h: Changed DeclarationStacks structure to hold references,
3062 since the actual Vectors are now stored either on the stack or in the
3065 2007-10-19 Geoffrey Garen <ggaren@apple.com>
3067 Reviewed by Darin Adler.
3069 http://bugs.webkit.org/show_bug.cgi?id=15559
3070 Moved processDeclarations call into FunctionBodyNode::execute
3072 To improve encapsulation, moved processDeclarations call into
3073 FunctionBodyNode::execute. Also marked processDeclarations
3074 ALWAYS_INLINE, since it has only 1 caller now. This is a .71% speedup
3075 on command-line JS iBench.
3078 (KJS::FunctionImp::callAsFunction):
3079 (KJS::GlobalFuncImp::callAsFunction):
3081 * kjs/interpreter.cpp:
3082 (KJS::Interpreter::evaluate):
3084 (FunctionBodyNode::execute):
3087 2007-10-19 Brady Eidson <beidson@apple.com>
3091 Queue -> Deque! and small style tweaks
3093 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
3094 * JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
3095 * wtf/Deque.h: Added.
3096 (WTF::DequeNode::DequeNode):
3097 (WTF::Deque::Deque):
3098 (WTF::Deque::~Deque):
3100 (WTF::Deque::isEmpty):
3101 (WTF::Deque::append):
3102 (WTF::Deque::prepend):
3103 (WTF::Deque::first):
3105 (WTF::Deque::removeFirst):
3106 (WTF::Deque::clear):
3107 * wtf/Queue.h: Removed.
3110 2007-10-19 Brady Eidson <beidson@apple.com>
3114 Added a simple LinkedList based Queue to wtf
3115 We can make a better, more sophisticated an efficient one later, but have
3116 needed one for some time, now!
3118 * JavaScriptCore.xcodeproj/project.pbxproj:
3119 * wtf/Queue.h: Added.
3120 (WTF::QueueNode::QueueNode):
3121 (WTF::Queue::Queue):
3122 (WTF::Queue::~Queue):
3124 (WTF::Queue::isEmpty):
3125 (WTF::Queue::append):
3126 (WTF::Queue::prepend):
3127 (WTF::Queue::first):
3129 (WTF::Queue::removeFirst):
3130 (WTF::Queue::clear):
3132 2007-10-19 Nikolas Zimmermann <zimmermann@kde.org>
3136 Try to fix Qt/Win build slave, by including windows.h also on Qt/Win.
3138 * kjs/testkjs.cpp: Change PLATFORM(WIN) to PLATFORM(WIN_OS)
3140 2007-10-19 Simon Hausmann <hausmann@kde.org>
3144 Fix compilation on Windows when wchar_t is a typedef instead of a native type (triggered by -Zc:wchar_t-).
3145 Don't provide the wchar_t overloads then as they conflict with the unsigned short ones.
3148 (WTF::isASCIIAlpha):
3149 (WTF::isASCIIAlphanumeric):
3150 (WTF::isASCIIDigit):
3151 (WTF::isASCIIHexDigit):
3152 (WTF::isASCIILower):
3153 (WTF::isASCIISpace):
3154 (WTF::toASCIILower):
3155 (WTF::toASCIIUpper):
3157 2007-10-19 Simon Hausmann <hausmann@kde.org>
3161 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.
3165 2007-10-18 Maciej Stachowiak <mjs@apple.com>
3169 - use __declspec(thread) for fast thread-local storage on Windows
3171 - 2.2% speedup on sunspider (on Windows)
3172 - 7% speedup on the string section
3173 - 6% speedup on JS iBench
3175 - fixed <rdar://problem/5473084> PLT on Windows got 2.5% slower between r25406 and r25422
3176 - fixed at least some of <rdar://5527965? i-Bench JS was 14% slower in 310A11 than 310A10
3179 * wtf/FastMalloc.cpp:
3180 (WTF::getThreadHeap):
3181 (WTF::setThreadHeap):
3182 (WTF::TCMalloc_ThreadCache::GetCache):
3183 (WTF::TCMalloc_ThreadCache::GetCacheIfPresent):
3184 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
3186 2007-10-17 Darin Adler <darin@apple.com>
3188 Reviewed by Mark Rowe.
3190 - fix http://bugs.webkit.org/show_bug.cgi?id=15543
3191 <rdar://problem/5545639> REGRESSION (r26697):
3192 GoogleDocs: Can't create new documents or open existing ones
3194 Test: fast/js/regexp-non-character.html
3196 * pcre/pcre_compile.c: (check_escape): Take out the checks for valid characters
3197 in the \u sequences -- not needed and actively harmful.
3199 2007-10-17 Anders Carlsson <andersca@apple.com>
3204 #define USE_PTHREADS on Mac.
3206 2007-10-17 Geoffrey Garen <ggaren@apple.com>
3208 Reviewed by Darin Adler.
3210 Merged DeclaredFunctionImp into FunctionImp (the base class) because
3211 the distinction between the two was unused.
3213 Removed codeType() from FunctionImp because FunctionImp and its
3214 subclasses all returned FunctionCode, so it was unused, practically
3217 Removed a different codeType() from GlobalFuncImp because it was unused.
3218 (Perhaps it was vestigial from a time when GlobalFuncImp used to
3219 inherit from FunctionImp.)
3221 * bindings/runtime_method.cpp:
3222 * bindings/runtime_method.h:
3225 (KJS::FunctionImp::FunctionImp):
3226 (KJS::FunctionImp::callAsFunction):
3227 (KJS::FunctionImp::construct):
3228 (KJS::FunctionImp::execute):
3229 (KJS::FunctionImp::processVarDecls):
3231 (KJS::FunctionImp::implementsConstruct):
3232 (KJS::FunctionImp::scope):
3233 * kjs/function_object.cpp:
3234 (FunctionProtoFunc::callAsFunction):
3235 (FunctionObjectImp::construct):
3237 (FuncDeclNode::processFuncDecl):
3238 (FuncExprNode::evaluate):
3240 2007-10-17 Adam Roben <aroben@apple.com>
3242 Windows build fix part 2.
3244 Fix was by Darin, reviewed by Anders and Adam.
3246 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add
3247 FastMallocPCRE.cpp to the project, and let Visual Studio have its way
3248 with the post-build step.
3249 * pcre/pcre.h: Don't DLL export the entry points just because this
3250 is Win32 -- this is an internal copy of PCRE and should be private.
3251 * pcre/pcre_compile.c: Fix an uninitialized variable warning --
3252 there's no real problem but it's better to quiet the compiler by
3253 tweaking the code slightly than turn off the warning entirely.
3255 2007-10-17 Adam Roben <aroben@apple.com>
3261 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
3262 some mismatched signed/unsigned comparison warnings.
3264 (match): #if-out some labels that don't seem to exist.
3266 2007-10-17 Mark Rowe <mrowe@apple.com>
3270 * JavaScriptCore.pri: Add FastMallocPCRE.cpp.
3271 * pcre/pcre_get. #if out two functions that depend on pcre_get_stringnumber, which
3272 is currently unavailable for UTF-16.
3274 2007-10-16 Darin Adler <darin@apple.com>
3278 - merged PCRE changes between 6.4 and 6.5
3280 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3281 * JavaScriptCore.xcodeproj/project.pbxproj:
3282 Removed pcre_config.c, pcre_globals.c, pcre_info.c, pcre_maketables.c,
3283 pcre_printint.src, pcre_refcount.c, pcre_study.c, pcre_try_flipped.c,
3284 pcre_ucp_findchar.c, pcre_version.c, and ucptable.c. Added pcre_ucp_searchfuncs.c.
3290 * pcre/pcre-config.h:
3293 * pcre/pcre_compile.c:
3295 * pcre/pcre_fullinfo.c:
3297 * pcre/pcre_internal.h:
3298 * pcre/pcre_maketables.c:
3299 * pcre/pcre_ord2utf8.c:
3300 * pcre/pcre_tables.c:
3301 * pcre/pcre_ucp_searchfuncs.c: Copied from pcre/pcre_ucp_findchar.c.
3302 * pcre/pcre_xclass.c:
3304 * pcre/ucpinternal.h:
3306 Updated with new versions from the PCRE 6.5 release, merged with changes.
3308 * pcre/pcre_config.c: Removed.
3309 * pcre/pcre_globals.c: Removed.
3310 * pcre/pcre_info.c: Removed.
3311 * pcre/pcre_printint.src: Removed.
3312 * pcre/pcre_refcount.c: Removed.
3313 * pcre/pcre_study.c: Removed.
3314 * pcre/pcre_try_flipped.c: Removed.
3315 * pcre/pcre_ucp_findchar.c: Removed.
3316 * pcre/pcre_version.c: Removed.
3318 2007-10-16 Geoffrey Garen <ggaren@apple.com>
3320 Reviewed by Darin Adler.
3322 Removed KJS_VERBOSE because it was getting in the way of readability,
3323 and the messages didn't seem very helpful.
3326 (KJS::FunctionImp::callAsFunction):
3327 (KJS::FunctionImp::passInParameters):
3331 (KJS::JSObject::put):
3334 2007-10-16 Geoffrey Garen <ggaren@apple.com>
3336 Reviewed by Darin Adler.
3338 Removed the Parameter class because it was a redundant wrapper around
3342 (KJS::FunctionImp::passInParameters):
3343 (KJS::FunctionImp::getParameterName):
3345 (FunctionBodyNode::addParam):
3347 (KJS::FunctionBodyNode::):
3349 2007-10-16 Geoffrey Garen <ggaren@apple.com>
3351 Reviewed by Darin Adler.
3353 Global replace of assert with ASSERT.
3355 2007-10-16 Adam Roben <aroben@apple.com>
3357 Make testkjs not delay-load WebKit
3359 Soon, delay-loading WebKit will be impossible (because we will be
3360 using __declspec(thread) for thread-local storage). This change
3361 prepares testkjs for the future.
3365 * JavaScriptCore.vcproj/JavaScriptCore.sln: Removed WebKitInitializer,
3367 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Don't link against
3368 WebKitInitializer, don't delay-load WebKit.
3369 * kjs/testkjs.cpp: Don't use WebKitInitializer.
3371 2007-10-16 Adam Roben <aroben@apple.com>
3373 Updated testkjs for the rename of WebKit_debug.dll to WebKit.dll for the Debug configuration
3375 Reviewed by Kevin McCullough.
3377 * JavaScriptCore.vcproj/debug.vsprops: Added WebKitDLLConfigSuffix.
3378 * JavaScriptCore.vcproj/debug_internal.vsprops: Ditto.
3379 * JavaScriptCore.vcproj/release.vsprops: Ditto.
3380 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Use
3381 WebKitDLLConfigSuffix when referring to WebKit.dll, and fixed a typo
3382 in the name of icuuc36[_debug].dll.
3384 2007-10-16 Geoffrey Garen <ggaren@apple.com>
3386 Reviewed by Maciej Stachowiak.
3388 Re-structured variable and function declaration code.
3390 Command-line JS iBench shows no regression.
3392 Here are the changes:
3394 1. Function declarations are now processed at the same time as var
3395 declarations -- namely, immediately upon entry to an execution context.
3396 This does not match Firefox, which waits to process a function
3397 declaration until the declaration's containing block executes, but it
3398 does match IE and the ECMA spec. (10.1.3 states that var and function
3399 declarations should be processed at the same time -- namely, "On
3400 entering an execution context." 12.2 states that "A Block does not
3401 define a new execution scope.")
3403 2. Declaration processing proceeds iteratively now, rather than
3404 recursively, storing the nodes is finds in stacks. This will later
3405 facilitate an optimization to hold on to the gathered declaration nodes,
3406 rather than re-fetching them in every function call.
3407 [ http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3409 Modified these tests because they expected the incorrect Mozilla
3410 behavior described above:
3412 * tests/mozilla/ecma_3/Function/scope-001.js:
3413 * tests/mozilla/js1_5/Scope/regress-184107.js:
3415 2007-10-16 Darin Adler <darin@apple.com>
3417 - try to fix the GTK build
3419 * kjs/ustring.cpp: Include ASCIICType.h, not ASCIICtype.h.
3421 2007-10-16 Darin Adler <darin@apple.com>
3423 - try to fix the Windows build
3425 * kjs/date_object.cpp: (KJS::parseDate): A couple instances of isspace were
3426 in here. Not sure why it wasn't failing elsewhere. Changed to isASCIISpace.
3428 2007-10-16 Darin Adler <darin@apple.com>
3430 - try to fix the GTK build
3432 * kjs/ustring.cpp: Include ASCIICType.h.
3434 2007-10-16 Darin Adler <darin@apple.com>
3436 Reviewed by Maciej and Geoff (and looked over by Eric).
3438 - http://bugs.webkit.org/show_bug.cgi?id=15519
3439 eliminate use of <ctype.h> for processing ASCII
3441 * wtf/ASCIICType.h: Added.
3442 * wtf/DisallowCType.h: Added.
3444 * kjs/config.h: Include DisallowCType.h.
3446 * kjs/date_object.cpp:
3447 (KJS::skipSpacesAndComments):
3453 (KJS::UString::toDouble):
3454 Use ASCIICType.h functions instead of ctype.h ones.
3456 2007-10-14 Maciej Stachowiak <mjs@apple.com>
3460 - fixes for "New JavaScript benchmark"
3461 http://bugs.webkit.org/show_bug.cgi?id=15515
3464 (TestFunctionImp::callAsFunction): Implement "load" for compatibility
3466 (TestFunctionImp::): ditto
3468 (kjsmain): Drop useless --> from output.
3470 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3472 Removed unnecessary #include.
3474 * API/JSObjectRef.cpp:
3476 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3478 Double-reverse build fix. My tree was out of date.
3481 (NumberNode::evaluate):
3483 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3488 (NumberNode::evaluate):
3490 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3492 Reviewed by Darin Adler.
3494 Removed surprising self-named "hack" that made nested functions
3495 available as named properties of their containing functions, and placed
3496 containing function objects in the scope chains of nested functions.
3498 There were a few reasons to remove this "hack:"
3500 1. It contradicted FF, IE, and the ECMA spec.
3502 2. It incurred a performance penalty, since merely parsing a function
3503 required parsing its body for nested functions (and so on).
3505 3. SVN history contains no explanation for why it was added. It was just
3506 legacy code in a large merge a long, long time ago.
3508 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3511 (FuncDeclNode::processFuncDecl):
3513 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3515 Reviewed by Darin Adler.
3517 Removed the concept of AnonymousCode. It was unused, and it doesn't
3518 exist in the ECMA spec.
3520 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3523 (KJS::Context::Context):
3527 (ReturnNode::execute):
3529 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3531 Reviewed by Darin Adler.
3533 Made function parameters DontDelete. This matches FF and the vague
3534 description in ECMA 10.1.3. It's also required in order to make
3535 symbol table based lookup of function parameters valid. (If the
3536 parameters aren't DontDelete, you can't guarantee that you'll find
3537 them later in the symbol table.)
3539 [ Patch broken off from http://bugs.webkit.org/show_bug.cgi?id=14868 ]
3542 (KJS::FunctionImp::passInParameters):
3544 2007-10-15 Geoffrey Garen <ggaren@apple.com>
3546 Reviewed by Maciej Stachowiak.