1 2007-11-15 Eric Seidel <eric@webkit.org>
5 Clean up match function to match WebKit style
7 * JavaScriptCore.xcodeproj/project.pbxproj:
11 2007-11-15 Steve Falkenburg <sfalken@apple.com>
15 * JavaScriptCore.vcproj/JavaScriptCore.make:
17 2007-11-14 Alexey Proskuryakov <ap@webkit.org>
21 http://bugs.webkit.org/show_bug.cgi?id=15982
22 Improve JSString UTF-8 decoding
24 * API/JSStringRef.cpp:
25 (JSStringCreateWithUTF8CString): Use strict decoding, return 0 on error.
27 * wtf/unicode/UTF8.cpp:
28 (WTF::Unicode::convertUTF16ToUTF8):
29 (WTF::Unicode::convertUTF8ToUTF16):
31 Made these function names start with a lower case letter.
33 * kjs/ustring.cpp: (KJS::UString::UTF8String): Updated for the above renaming.
35 * bindings/c/c_utility.cpp:
36 (KJS::Bindings::convertUTF8ToUTF16WithLatin1Fallback): Renamed to highlight the difference
37 from convertUTF8ToUTF16 in wtf/unicode.
38 (KJS::Bindings::convertNPStringToUTF16): Updated for the above renaming.
39 (KJS::Bindings::identifierFromNPIdentifier): Ditto.
40 * bindings/c/c_utility.h: Made convertUTF8ToUTF16WithLatin1Fallback() a file static.
42 2007-11-14 Sam Weinig <sam@webkit.org>
44 Rubber-stamped by Anders.
46 Fix the Xcode project file after it was messed up in r27402.
48 * JavaScriptCore.xcodeproj/project.pbxproj:
50 2007-11-14 Eric Seidel <eric@webkit.org>
54 More PCRE style cleanup.
56 * pcre/pcre_compile.cpp:
59 2007-11-14 Adam Roben <aroben@apple.com>
61 Clean up the bison conflict checking script
65 * DerivedSources.make:
67 2007-11-14 Eric Seidel <eric@webkit.org>
71 Another round of PCRE cleanups: inlines
73 SunSpider claims that this, combined with my previous PCRE cleanup were a 0.7% speedup, go figure.
75 * pcre/pcre_compile.cpp:
80 * pcre/pcre_internal.h:
87 2007-11-14 Eric Seidel <eric@webkit.org>
91 Give PCRE a (small) bath.
92 Fix some formating and break things off into separate functions
93 http://bugs.webkit.org/show_bug.cgi?id=15993
95 * pcre/pcre_compile.cpp:
96 (calculateCompiledPatternLengthAndFlags):
97 (printCompiledRegExp):
100 * pcre/pcre_internal.h:
101 (compile_data::compile_data):
103 2007-11-14 Geoffrey Garen <ggaren@apple.com>
105 Reviewed by Eric Seidel.
107 Cleaned up the JavaScript grammar a bit.
109 1. Changed BlockNode to always hold a child vector (which may be empty),
110 eliminating a few NULL-check branches in the common execution case.
112 2. Changed the Block production to correctly report its starting and
113 ending line numbers to the debugger. (It used to report its ending line
114 as its starting line.) Also, removed duplicate line-reporting code
115 inside the BlockNode constructor.
117 3. Moved curly braces up from FunctionBody production into parent
118 productions. (I had to move the line number reporting code, too, since
119 it depends on the location of the curly braces.) This matches the ECMA
120 spec more closely, and makes some future changes I plan easier.
122 4. Fixed statementList* convenience functions to deal appropriately with
125 SunSpider reports a small and statistically insignificant speedup.
129 (KJS::statementListPushFIFO):
130 (KJS::statementListGetDeclarations):
131 (KJS::statementListInitializeDeclarationStack):
132 (KJS::statementListInitializeVariableAccessStack):
133 (KJS::BlockNode::BlockNode):
134 (KJS::BlockNode::optimizeVariableAccess):
135 (KJS::BlockNode::getDeclarations):
136 (KJS::BlockNode::execute):
137 (KJS::FunctionBodyNode::initializeDeclarationStacks):
138 (KJS::FunctionBodyNode::optimizeVariableAccess):
140 2007-11-13 Anders Carlsson <andersca@apple.com>
142 Add RefCounted.h (And remove Shared.h)
144 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
146 2007-11-13 Geoffrey Garen <ggaren@apple.com>
152 2007-11-13 Geoffrey Garen <ggaren@apple.com>
154 Reviewed by Anders Carlsson.
156 Renamed Shared to RefCounted.
159 * JavaScriptCore.xcodeproj/project.pbxproj:
162 * wtf/RefCounted.h: Copied from JavaScriptCore/wtf/Shared.h.
163 (WTF::RefCounted::RefCounted):
164 * wtf/Shared.h: Removed.
166 2007-11-13 Adam Roben <aroben@apple.com>
172 * kjs/regexp.h: Added a missing #include.
174 2007-11-13 Geoffrey Garen <ggaren@apple.com>
176 Reviewed by Sam Weinig.
178 Moved Shared.h into wtf so it could be used in more places. Deployed
179 Shared in places where JSCore previously had hand-rolled ref-counting
182 * API/JSClassRef.cpp:
183 (OpaqueJSClass::OpaqueJSClass):
185 * API/JSObjectRef.cpp:
188 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
189 * JavaScriptCore.xcodeproj/project.pbxproj:
190 * kjs/interpreter.cpp:
191 (KJS::Interpreter::init):
194 (KJS::RegExp::RegExp):
196 * wtf/Shared.h: Copied from WebCore/platform/Shared.h.
198 2007-11-13 Eric Seidel <eric@webkit.org>
202 Add an ASSERT to getTruncatedInt32 to enforce proper usage.
203 Best part about this patch? It doesn't break the web!
206 (KJS::JSImmediate::getTruncatedInt32):
207 (KJS::JSImmediate::toDouble):
208 (KJS::JSImmediate::getUInt32):
210 2007-11-13 Alexey Proskuryakov <ap@webkit.org>
214 * bindings/c/c_utility.cpp:
215 (KJS::Bindings::convertUTF8ToUTF16):
217 (KJS::UString::UTF8String):
218 * wtf/unicode/UTF8.cpp:
219 (WTF::Unicode::ConvertUTF8ToUTF16):
221 2007-11-13 Darin Adler <darin@apple.com>
225 - fix http://bugs.webkit.org/show_bug.cgi?id=11231
226 RegExp bug when handling newline characters
227 and a number of other differences between PCRE behvior
228 and JavaScript regular expressions:
230 + single-digit sequences like \4 should be treated as octal
231 character constants, unless there is a sufficient number
232 of brackets for them to be treated as backreferences
234 + \8 turns into the character "8", not a binary zero character
235 followed by "8" (same for 9)
237 + only the first 3 digits should be considered part of an
238 octal character constant (the old behavior was to decode
239 an arbitrarily long sequence and then mask with 0xFF)
241 + if \x is followed by anything other than two valid hex digits,
242 then it should simply be treated a the letter "x"; that includes
243 not supporting the \x{41} syntax
245 + if \u is followed by anything less than four valid hex digits,
246 then it should simply be treated a the letter "u"
248 + an extra "+" should be a syntax error, rather than being treated
249 as the "possessive quantifier"
251 + if a "]" character appears immediately after a "[" character that
252 starts a character class, then that's an empty character class,
253 rather than being the start of a character class that includes a
256 + a "$" should not match a terminating newline; we could have gotten
257 PCRE to handle this the way we wanted by passing an appropriate option
259 Test: fast/js/regexp-no-extensions.html
261 * pcre/pcre_compile.cpp:
262 (check_escape): Check backreferences against bracount to catch both
263 overflows and things that should be treated as octal. Rewrite octal
264 loop to not go on indefinitely. Rewrite both hex loops to match and
266 (compile_branch): Restructure loops so that we don't special-case a "]"
267 at the beginning of a character class. Remove code that treated "+" as
268 the possessive quantifier.
269 (jsRegExpCompile): Change the "]" handling here too.
271 * pcre/pcre_exec.cpp: (match): Changed CIRC to match the DOLL implementation.
272 Changed DOLL to remove handling of "terminating newline", a Perl concept
275 * tests/mozilla/expected.html: Two tests are fixed now:
276 ecma_3/RegExp/regress-100199.js and ecma_3/RegExp/regress-188206.js.
277 One test fails now: ecma_3/RegExp/perlstress-002.js -- our success before
278 was due to a bug (we treated all 1-character numeric escapes as backreferences).
279 The date tests also now both expect success -- whatever was making them fail
280 before was probably due to the time being close to a DST shift; maybe we need
281 to get rid of those tests.
283 2007-11-13 Darin Adler <darin@apple.com>
285 * kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32):
286 Remove too-strong assert that was firing constantly and preventing even basic
287 web browsing from working in a debug build. This function is used in many
288 cases where the immediate value is not a number; the assertion could perhaps
289 be added back later with a bit of reorganization.
291 2007-11-13 Alp Toker <alp@atoker.com>
293 Build fix for breakage to non-Mac builds introduced in r27746.
297 2007-11-13 Eric Seidel <eric@webkit.org>
301 Clean up evaluateToBoolean functions to use inlines instead of copy/paste code
305 (KJS::GreaterNode::inlineEvaluateToBoolean):
306 (KJS::GreaterNode::evaluate):
307 (KJS::LessEqNode::inlineEvaluateToBoolean):
308 (KJS::LessEqNode::evaluate):
309 (KJS::GreaterEqNode::inlineEvaluateToBoolean):
310 (KJS::GreaterEqNode::evaluate):
311 (KJS::InNode::evaluateToBoolean):
312 (KJS::EqualNode::inlineEvaluateToBoolean):
313 (KJS::EqualNode::evaluate):
314 (KJS::NotEqualNode::inlineEvaluateToBoolean):
315 (KJS::NotEqualNode::evaluate):
316 (KJS::StrictEqualNode::inlineEvaluateToBoolean):
317 (KJS::StrictEqualNode::evaluate):
318 (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
319 (KJS::NotStrictEqualNode::evaluate):
322 2007-11-12 Geoffrey Garen <ggaren@apple.com>
324 Reviewed by Sam Weinig.
326 Fixed http://bugs.webkit.org/show_bug.cgi?id=15958
327 base64 spends 1.1% of total time checking for special Infinity case
329 Use a fast character test instead of calling strncmp.
331 1.1% speedup on string-base64. SunSpider reports a .4% speedup overall;
332 Sharks reports only .1%. Who are you going to believe? Huh?
335 (KJS::UString::toDouble):
337 2007-11-12 Eric Seidel <eric@webkit.org>
341 Add evaluateToInt32 and evaluateUInt32 methods and deploy them.
342 Fix a few missing evaluateToBoolean methods
343 Deploy all evaluateTo* functions to more nodes to avoid slowdowns
344 http://bugs.webkit.org/show_bug.cgi?id=15950
346 SunSpider claims this is at least a 1.4% speedup.
349 (KJS::JSImmediate::getTruncatedInt32):
350 (KJS::JSImmediate::toDouble):
351 (KJS::JSImmediate::getUInt32):
353 (KJS::ExpressionNode::evaluateToNumber):
354 (KJS::ExpressionNode::evaluateToInt32):
355 (KJS::ExpressionNode::evaluateToUInt32):
356 (KJS::NumberNode::evaluateToInt32):
357 (KJS::NumberNode::evaluateToUInt32):
358 (KJS::ImmediateNumberNode::evaluateToInt32):
359 (KJS::ImmediateNumberNode::evaluateToUInt32):
360 (KJS::ResolveNode::evaluate):
361 (KJS::ResolveNode::evaluateToNumber):
362 (KJS::ResolveNode::evaluateToBoolean):
363 (KJS::ResolveNode::evaluateToInt32):
364 (KJS::ResolveNode::evaluateToUInt32):
365 (KJS::LocalVarAccessNode::evaluateToInt32):
366 (KJS::LocalVarAccessNode::evaluateToUInt32):
367 (KJS::BracketAccessorNode::evaluateToNumber):
368 (KJS::BracketAccessorNode::evaluateToBoolean):
369 (KJS::BracketAccessorNode::evaluateToInt32):
370 (KJS::BracketAccessorNode::evaluateToUInt32):
371 (KJS::DotAccessorNode::inlineEvaluate):
372 (KJS::DotAccessorNode::evaluate):
373 (KJS::DotAccessorNode::evaluateToNumber):
374 (KJS::DotAccessorNode::evaluateToBoolean):
375 (KJS::DotAccessorNode::evaluateToInt32):
376 (KJS::DotAccessorNode::evaluateToUInt32):
377 (KJS::NewExprNode::inlineEvaluate):
378 (KJS::NewExprNode::evaluate):
379 (KJS::NewExprNode::evaluateToNumber):
380 (KJS::NewExprNode::evaluateToBoolean):
381 (KJS::NewExprNode::evaluateToInt32):
382 (KJS::NewExprNode::evaluateToUInt32):
383 (KJS::FunctionCallResolveNode::inlineEvaluate):
384 (KJS::FunctionCallResolveNode::evaluate):
385 (KJS::FunctionCallResolveNode::evaluateToNumber):
386 (KJS::FunctionCallResolveNode::evaluateToBoolean):
387 (KJS::FunctionCallResolveNode::evaluateToInt32):
388 (KJS::FunctionCallResolveNode::evaluateToUInt32):
389 (KJS::LocalVarFunctionCallNode::evaluate):
390 (KJS::LocalVarFunctionCallNode::evaluateToNumber):
391 (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
392 (KJS::LocalVarFunctionCallNode::evaluateToInt32):
393 (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
394 (KJS::FunctionCallDotNode::evaluate):
395 (KJS::FunctionCallDotNode::evaluateToNumber):
396 (KJS::FunctionCallDotNode::evaluateToBoolean):
397 (KJS::FunctionCallDotNode::evaluateToInt32):
398 (KJS::FunctionCallDotNode::evaluateToUInt32):
399 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
400 (KJS::PostDecLocalVarNode::evaluateToNumber):
401 (KJS::PostDecLocalVarNode::evaluateToBoolean):
402 (KJS::PostDecLocalVarNode::evaluateToInt32):
403 (KJS::PostDecLocalVarNode::evaluateToUInt32):
404 (KJS::typeStringForValue):
405 (KJS::UnaryPlusNode::evaluate):
406 (KJS::UnaryPlusNode::evaluateToBoolean):
407 (KJS::UnaryPlusNode::evaluateToNumber):
408 (KJS::UnaryPlusNode::evaluateToInt32):
409 (KJS::BitwiseNotNode::inlineEvaluateToInt32):
410 (KJS::BitwiseNotNode::evaluate):
411 (KJS::BitwiseNotNode::evaluateToNumber):
412 (KJS::BitwiseNotNode::evaluateToBoolean):
413 (KJS::BitwiseNotNode::evaluateToInt32):
414 (KJS::MultNode::evaluateToBoolean):
415 (KJS::MultNode::evaluateToInt32):
416 (KJS::MultNode::evaluateToUInt32):
417 (KJS::DivNode::evaluateToInt32):
418 (KJS::DivNode::evaluateToUInt32):
419 (KJS::ModNode::evaluateToBoolean):
420 (KJS::ModNode::evaluateToInt32):
421 (KJS::ModNode::evaluateToUInt32):
422 (KJS::AddNode::evaluateToNumber):
423 (KJS::AddNode::evaluateToInt32):
424 (KJS::AddNode::evaluateToUInt32):
425 (KJS::AddNumbersNode::evaluateToInt32):
426 (KJS::AddNumbersNode::evaluateToUInt32):
427 (KJS::SubNode::evaluateToInt32):
428 (KJS::SubNode::evaluateToUInt32):
429 (KJS::LeftShiftNode::inlineEvaluateToInt32):
430 (KJS::LeftShiftNode::evaluate):
431 (KJS::LeftShiftNode::evaluateToNumber):
432 (KJS::LeftShiftNode::evaluateToInt32):
433 (KJS::RightShiftNode::inlineEvaluateToInt32):
434 (KJS::RightShiftNode::evaluate):
435 (KJS::RightShiftNode::evaluateToNumber):
436 (KJS::RightShiftNode::evaluateToInt32):
437 (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
438 (KJS::UnsignedRightShiftNode::evaluate):
439 (KJS::UnsignedRightShiftNode::evaluateToNumber):
440 (KJS::UnsignedRightShiftNode::evaluateToInt32):
441 (KJS::LessNode::inlineEvaluateToBoolean):
442 (KJS::LessNode::evaluate):
443 (KJS::LessNode::evaluateToBoolean):
444 (KJS::LessNumbersNode::inlineEvaluateToBoolean):
445 (KJS::LessNumbersNode::evaluate):
446 (KJS::LessNumbersNode::evaluateToBoolean):
447 (KJS::LessStringsNode::inlineEvaluateToBoolean):
448 (KJS::LessStringsNode::evaluate):
449 (KJS::BitAndNode::evaluate):
450 (KJS::BitAndNode::inlineEvaluateToInt32):
451 (KJS::BitAndNode::evaluateToNumber):
452 (KJS::BitAndNode::evaluateToBoolean):
453 (KJS::BitAndNode::evaluateToInt32):
454 (KJS::BitXOrNode::inlineEvaluateToInt32):
455 (KJS::BitXOrNode::evaluate):
456 (KJS::BitXOrNode::evaluateToNumber):
457 (KJS::BitXOrNode::evaluateToBoolean):
458 (KJS::BitXOrNode::evaluateToInt32):
459 (KJS::BitOrNode::inlineEvaluateToInt32):
460 (KJS::BitOrNode::evaluate):
461 (KJS::BitOrNode::evaluateToNumber):
462 (KJS::BitOrNode::evaluateToBoolean):
463 (KJS::BitOrNode::evaluateToInt32):
464 (KJS::ConditionalNode::evaluateToNumber):
465 (KJS::ConditionalNode::evaluateToInt32):
466 (KJS::ConditionalNode::evaluateToUInt32):
467 (KJS::valueForReadModifyAssignment):
468 (KJS::AssignExprNode::evaluate):
469 (KJS::AssignExprNode::evaluateToBoolean):
470 (KJS::AssignExprNode::evaluateToNumber):
471 (KJS::AssignExprNode::evaluateToInt32):
472 (KJS::VarDeclNode::handleSlowCase):
474 (KJS::FunctionCallResolveNode::precedence):
475 (KJS::AddNode::precedence):
477 (KJS::LessNumbersNode::):
478 (KJS::LessStringsNode::):
480 (KJS::JSValue::toInt32SlowCase):
481 (KJS::JSValue::toUInt32SlowCase):
483 (KJS::JSValue::asCell):
484 (KJS::JSValue::toInt32):
485 (KJS::JSValue::toUInt32):
487 2007-11-12 Alexey Proskuryakov <ap@webkit.org>
491 http://bugs.webkit.org/show_bug.cgi?id=15953
492 Add UTF-8 encoding/decoding to WTF
494 * kjs/ustring.h: Moved UTF8SequenceLength() and decodeUTF8Sequence() to wtf/unicode.
495 * kjs/ustring.cpp: (KJS::UString::UTF8String): Changed this function to take a strict/lenient
496 parameter. Callers are not interested in getting decoding results in strict mode, so
497 this allows for bailing out as soon as an error is seen.
500 (KJS::encode): Updated for new UString::UTF8String() signature.
502 * API/JSStringRef.cpp:
503 (JSStringCreateWithCharacters): Disambiguate UChar.
504 (JSStringCreateWithUTF8CString): Actually use UTF-8 when creating the string!
505 * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): Use ConvertUTF8ToUTF16().
507 * wtf/unicode/UTF8.cpp: Added.
508 (WTF::Unicode::inlineUTF8SequenceLengthNonASCII):
509 (WTF::Unicode::inlineUTF8SequenceLength):
510 (WTF::Unicode::UTF8SequenceLength):
511 (WTF::Unicode::decodeUTF8Sequence):
513 (WTF::Unicode::ConvertUTF16ToUTF8):
514 (WTF::Unicode::isLegalUTF8):
515 (WTF::Unicode::ConvertUTF8ToUTF16):
516 * wtf/unicode/UTF8.h: Added.
518 Some code moved from ustring.h, some adapted from unicode.org sources.
520 * JavaScriptCore.exp:
521 * JavaScriptCore.pri:
522 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
523 * JavaScriptCore.xcodeproj/project.pbxproj:
524 * JavaScriptCoreSources.bkl:
527 2007-11-12 Josh Aas <joshmoz@gmail.com>
531 - http://bugs.webkit.org/show_bug.cgi?id=15946
532 add NPPValue NPPVpluginDrawingModel (Mozilla bug 403418 compat)
536 2007-11-12 Darin Adler <darin@apple.com>
540 - http://bugs.webkit.org/show_bug.cgi?id=15951
541 REGRESSION: assertion failure in regexp match() when running JS tests
543 Test: fast/js/regexp-many-brackets.html
545 * pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for
546 the BRANUMBER opcode.
548 2007-11-12 Darin Adler <darin@apple.com>
552 - fix use of prefix and config.h, got rid of a few unneeded things in
553 the PCRE code; no behavior changes
555 * API/JSBase.cpp: Added include of config.h.
556 * API/JSCallbackConstructor.cpp: Ditto.
557 * API/JSCallbackFunction.cpp: Ditto.
558 * API/JSCallbackObject.cpp: Ditto.
559 * API/JSClassRef.cpp: Ditto.
560 * API/JSContextRef.cpp: Ditto.
561 * API/JSObjectRef.cpp: Ditto.
562 * API/JSStringRef.cpp: Ditto.
563 * API/JSValueRef.cpp: Ditto.
565 * JavaScriptCorePrefix.h: Removed obsolete <ctype.h> workaround.
566 Moved new/delete macros after includes, as they are in WebCore's prefix.
569 * pcre/dftables.cpp: (main): Changed back to not use a separate maketables
570 function. This is needed for PCRE, but not helpful for our use. Also changed
571 the tables to all be 128 entries long instead of 256, since only the first
574 * pcre/pcre_compile.cpp: Added include of config.h. Eliminated digitab,
575 which was only being used to check hex digits. Changed all uses of TRUE and
576 FALSE to use the C++ true and false instead.
577 (check_escape): Just the TRUE/FALSE thing.
578 (is_counted_repeat): Ditto.
579 (could_be_empty_branch): Ditto.
580 (get_othercase_range): Ditto.
581 (compile_branch): Ditto.
582 (compile_regex): Ditto.
583 (is_anchored): Ditto.
584 (is_startline): Ditto.
585 (find_firstassertedchar): Ditto.
586 (jsRegExpCompile): Ditto.
588 * pcre/pcre_exec.cpp: Added include of config.h. Changed all uses of TRUE and
589 FALSE to use the C++ true and false instead.
590 (match_ref): Just the TRUE/FALSE thing.
591 (match): Ditto. Removed some unneeded braces.
592 (jsRegExpExecute): Just the TRUE/FALSE thing.
594 * pcre/pcre_internal.h: Moved the constants needed by dftables.cpp to the top
595 of the file instead of the bottom, so they can be used. Also changed the table
596 sizes to 128 instead of 256. Removed macro definitions of FALSE and TRUE.
597 Set array sizes for all the const arrays. Changed _pcre_utf8_table1_size to
598 be a macro instead of a extern int.
600 * pcre/pcre_maketables.cpp: Removed. It's all in dftables.cpp now.
602 * pcre/pcre_tables.cpp: Made table sizes explicit.
604 * pcre/pcre_xclass.cpp: Just the TRUE/FALSE thing.
606 2007-11-12 Adam Roben <aroben@apple.com>
610 * wtf/FastMalloc.h: Add missing using statement.
612 2007-11-11 Oliver Hunt <oliver@apple.com>
616 Add special fastZeroedMalloc function to replace a
617 number of fastCalloc calls where one argument was 1.
619 This results in a 0.4% progression in SunSpider, more
620 than making up for the earlier regression caused by
621 additional overflow checks.
623 * JavaScriptCore.exp:
624 * kjs/array_instance.cpp:
625 * kjs/property_map.cpp:
626 * wtf/FastMalloc.cpp:
630 2007-11-11 Adam Roben <aroben@apple.com>
632 Fix <rdar://5578982> ASSERT in HashTable::checkTableConsistencyExceptSize beneath WebNotificationCenter
634 The bug was due to a mismatch between HashMap::remove and
635 HashTable::checkTableConsistency. HashMap::remove can delete the value
636 stored in the HashTable (by derefing it), which is not normally
637 allowed by HashTable. It's OK in this case because the value is about
638 to be removed from the table, but HashTable wasn't aware of this.
640 HashMap::remove now performs the consistency check itself before
643 Darin noticed that the same bug would occur in HashSet, so I've fixed
649 (WTF::HashMap::remove): Perform the HashTable consistency check
650 manually before calling deref.
652 (WTF::HashSet::remove): Ditto.
653 * wtf/HashTable.h: Made checkTableConsistency public so that HashMap
654 and HashSet can call it.
655 (WTF::HashTable::removeAndInvalidateWithoutEntryConsistencyCheck):
657 (WTF::HashTable::removeAndInvalidate): Added.
658 (WTF::HashTable::remove):
659 (WTF::HashTable::removeWithoutEntryConsistencyCheck): Added.
661 2007-11-11 Mark Rowe <mrowe@apple.com>
663 Build fix. Use the correct filename case.
667 2007-11-11 Geoffrey Garen <ggaren@apple.com>
669 Reviewed by Sam Weinig.
671 Fixed http://bugs.webkit.org/show_bug.cgi?id=15902
672 15% of string-validate-input.js is spent compiling the same regular expression
674 Store a compiled representation of the regular expression in the AST.
676 Only a .2% SunSpider speedup overall, but a 10.6% speedup on
677 string-validate-input.js.
680 (KJS::RegExpNode::evaluate):
683 * kjs/nodes2string.cpp:
684 (KJS::RegExpNode::streamTo):
686 (KJS::RegExp::flags):
688 (KJS::RegExp::pattern):
689 * kjs/regexp_object.cpp:
690 (KJS::RegExpObjectImp::construct):
691 (KJS::RegExpObjectImp::createRegExpImp):
692 * kjs/regexp_object.h:
694 2007-11-11 Oliver Hunt <oliver@apple.com>
698 Partial fix for <rdar://problem/5585334> numfuzz: integer overflows opening malformed SVG file in WebCore::ImageBuffer::create
700 Unfortunately this is a very slight regression, but is unavoidable.
702 * wtf/FastMalloc.cpp:
704 2007-11-10 Eric Seidel <eric@webkit.org>
708 Add simple type inferencing to the parser, and create custom
709 AddNode and LessNode subclasses based on inferred types.
710 http://bugs.webkit.org/show_bug.cgi?id=15884
712 SunSpider claims this is at least a 0.5% speedup.
714 * JavaScriptCore.exp:
717 (KJS::NumberImp::getPrimitiveNumber):
718 (KJS::GetterSetterImp::getPrimitiveNumber):
724 (KJS::StringNode::evaluate):
725 (KJS::StringNode::evaluateToNumber):
726 (KJS::StringNode::evaluateToBoolean):
727 (KJS::RegExpNode::evaluate):
728 (KJS::UnaryPlusNode::optimizeVariableAccess):
729 (KJS::AddNode::evaluate):
730 (KJS::AddNode::evaluateToNumber):
731 (KJS::AddNumbersNode::inlineEvaluateToNumber):
732 (KJS::AddNumbersNode::evaluate):
733 (KJS::AddNumbersNode::evaluateToNumber):
734 (KJS::AddStringsNode::evaluate):
735 (KJS::AddStringLeftNode::evaluate):
736 (KJS::AddStringRightNode::evaluate):
739 (KJS::LessNumbersNode::evaluate):
740 (KJS::LessStringsNode::evaluate):
742 (KJS::ExpressionNode::):
744 (KJS::RegExpNode::precedence):
745 (KJS::TypeOfResolveNode::):
746 (KJS::LocalVarTypeOfNode::):
747 (KJS::UnaryPlusNode::):
748 (KJS::UnaryPlusNode::precedence):
750 (KJS::AddNode::precedence):
751 (KJS::AddNumbersNode::):
752 (KJS::AddStringLeftNode::):
753 (KJS::AddStringRightNode::):
754 (KJS::AddStringsNode::):
756 (KJS::LessNode::precedence):
757 (KJS::LessNumbersNode::):
758 (KJS::LessStringsNode::):
759 * kjs/nodes2string.cpp:
760 (KJS::StringNode::streamTo):
764 (KJS::JSValue::getPrimitiveNumber):
766 2007-11-11 Darin Adler <darin@apple.com>
768 - try another way of fixing dftables builds -- refactor pcre_internal.h a bit
770 * pcre/pcre_internal.h: Make most of this header do nothing when DFTABLES is set.
771 Later we can break it into two files.
773 * JavaScriptCore.vcproj/dftables/dftables.vcproj: Take out now-unneeded include paths.
774 * pcre/dftables.cpp: Set DFTABLES. Use delete instead of free.
775 * pcre/dftables.pro: Take out now-unneeded include paths.
776 * pcre/pcre_maketables.cpp: Use new instead of malloc.
778 2007-11-11 Darin Adler <darin@apple.com>
780 * pcre/dftables.pro: Try fixing Qt builds (I looked at qt-win) by adding
781 another include path.
783 2007-11-11 Darin Adler <darin@apple.com>
785 * JavaScriptCore.xcodeproj/project.pbxproj: Try fixing Mac Tiger builds
786 by adding another include path.
788 2007-11-11 Darin Adler <darin@apple.com>
792 - http://bugs.webkit.org/show_bug.cgi?id=15924
793 next round of changes to JSRegExp (formerly PCRE)
795 This is a combination of converting to C++, tweaking the API, and adding
796 some additional optimizations.
798 Future steps will involve getting rid of the use of UTF-8 completely
799 (we'll use UTF-16 exclusively instead), eliminating more source files,
800 and some more speed-ups.
802 SunSpider says the current round is an 0.9% speed-up overall, and a
803 5.3% speed-up for regexp.
805 * JavaScriptCore.exp: Updated for new entry points.
807 * JavaScriptCore.pri:
808 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
809 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
810 * JavaScriptCore.xcodeproj/project.pbxproj:
811 * JavaScriptCoreSources.bkl:
813 Updated for new source file names and ForwardingHeaders.
816 (KJS::RegExp::RegExp): Changed to use the error message without calling
817 strdup on it and to pass the new types and options.
818 (KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message.
819 (KJS::RegExp::match): Pass the new types and options.
820 * kjs/regexp.h: Update type of m_constructionError.
822 * pcre/AUTHORS: Update to reflect the status of the project -- we don't include
823 the Google parts, and this isn't the PCRE library, per se.
824 * pcre/COPYING: Ditto.
826 * pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c.
827 (main): Removed unneeded ctype_digit.
829 * pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar.
831 * pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c.
832 Moved a lot of private stuff used only within this file here from pcre_internal.h.
833 Renumbered the error codes.
834 (error_text): Use a single string with embedded nulls for the error text (I got
835 this idea from newer versions of PCRE).
836 (check_escape): Changed return type to be enum instead of int. Replaced ctype_digit
837 uses with isASCIIDigit.
838 (is_counted_repeat): Ditto.
839 (read_repeat_counts): Ditto.
840 (first_significant_code): Ditto.
841 (find_fixedlength): Ditto.
842 (could_be_empty_branch): Ditto.
843 (compile_branch): Ditto. Also removed some code that handles changing options.
844 JavaScript doesn't have any of the features that allow options to change.
845 (compile_regex): Updated for change to options parameter.
846 (is_anchored): Ditto.
847 (find_firstassertedchar): Ditto.
848 (jsRegExpCompile): Changed to take separate flags instead of an options int.
849 Also changed to call new/delete instead of pcre_malloc/free.
850 (jsRegExpFree): Ditto.
852 * pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c.
853 Added a case that uses computed goto for the opcode loop, but did not turn it on.
854 Changed the RMATCH macro to handle returns more efficiently by putting the where
855 pointer in the new frame instead of the old one, allowing us to branch to the
856 return with a single statement. Switched to new/delete from pcre_malloc/free.
857 Changed many RRETURN callers to not set the return value since it's already
858 set correctly. Replaced the rrc variable with an is_match variable. Values other
859 than "match" and "no match" are now handled differently. This allows us to remove
860 the code to check for those cases in various rules.
861 (match): All the case statements use a macro BEGIN_OPCODE instead. And all the
862 continue statements, or break statements that break out of the outer case use
863 a macro NEXT_OPCODE instead. Replaced a few if statements with assertions.
864 (jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused
865 start_match field from the match block.
867 * pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h
868 in here. Removed various unused types. Converted from JSRegExpChar to UChar.
869 Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be
870 used in multiple places. Unfortunately we lose the comments for each opcode; we
871 should find a place to put those back. Removed ctype_digit.
873 * pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c.
874 (pcre_maketables): Got rid of the conditional code that allows this to be compiled
875 in -- it's only used for dftables now (and soon may be obsolete entirely).
876 Changed code for cbit_digit to not use isdigit, and took the "_" case out of the
877 loop. Removed ctype_digit.
879 * pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c.
881 * pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c.
882 Moved _pcre_OP_lengths out of here into pcre_exec.cpp.
884 * pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c.
885 Updated for other file name changes.
887 * pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c.
889 * pcre/ucpinternal.h: Updated header.
891 * pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c.
893 * wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to
894 & for this operation. Also added an overload that takes an int because that's
895 useful for PCRE. Later we could optimize for int and overload other functions in
896 this file; stuck to this simple one for now.
898 * wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper.
899 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
901 * pcre/LICENCE: Removed.
902 * pcre/pcre-config.h: Removed.
903 * wtf/FastMallocPCRE.cpp: Removed.
905 * pcre/dftables.c: Renamed to cpp.
906 * pcre/pcre_compile.c: Ditto.
907 * pcre/pcre_exec.c: Ditto.
908 * pcre/pcre_maketables.c: Ditto.
909 * pcre/pcre_ord2utf8.c: Ditto.
910 * pcre/pcre_tables.c: Ditto.
911 * pcre/pcre_ucp_searchfuncs.c: Ditto.
912 * pcre/pcre_xclass.c: Ditto.
913 * pcre/ucptable.c: Ditto.
915 2007-11-11 Eric Seidel <eric@webkit.org>
919 Add KJS_CHECKEXCEPTIONBOOLEAN to match rest of nodes.cpp
922 (KJS::ExpressionNode::evaluateToBoolean):
923 (KJS::LessNode::evaluateToBoolean):
924 (KJS::GreaterNode::evaluateToBoolean):
925 (KJS::LessEqNode::evaluateToBoolean):
926 (KJS::GreaterEqNode::evaluateToBoolean):
927 (KJS::InstanceOfNode::evaluateToBoolean):
928 (KJS::InNode::evaluateToBoolean):
929 (KJS::EqualNode::evaluateToBoolean):
930 (KJS::NotEqualNode::evaluateToBoolean):
931 (KJS::StrictEqualNode::evaluateToBoolean):
932 (KJS::NotStrictEqualNode::evaluateToBoolean):
933 (KJS::LogicalAndNode::evaluateToBoolean):
934 (KJS::LogicalOrNode::evaluateToBoolean):
935 (KJS::ConditionalNode::evaluateToBoolean):
937 2007-11-10 Darin Adler <darin@apple.com>
941 - fix http://bugs.webkit.org/show_bug.cgi?id=15927
942 REGRESSION(r27487): delete a.c followed by __defineGetter__("c", ...) incorrectly deletes another property
943 and <rdar://problem/5586384> REGRESSION (r27487): Can't switch out of Edit HTML Source mode on Leopard Wiki
945 Test: fast/js/delete-then-put.html
947 * kjs/property_map.cpp:
948 (KJS::PropertyMap::put): Added a missing "- 1"; code to find an empty slot was not working.
949 (KJS::PropertyMap::checkConsistency): Added a missing range check that would have caught this
952 - roll out a last-minute change to my evaluateToBoolean patch that was incorrect.
954 * kjs/nodes.h: (KJS::ExprStatementNode::ExprStatementNode): Take out call to
955 optimizeForUnnecessaryResult, since the result is used in some cases.
957 2007-11-10 Adam Roben <aroben@apple.com>
961 Roll out some changes that were (seemingly accidentally) checked in
964 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
966 2007-11-10 Darin Adler <darin@apple.com>
970 - http://bugs.webkit.org/show_bug.cgi?id=15915
971 add an evaluation path for booleans like the one we have for numbers
973 Gives 1.1% on SunSpider.
975 * kjs/grammar.y: Create TrueNode and FalseNode instead of BooleanNode.
977 * kjs/nodes.h: Changed to use Noncopyable. Moved optimizeForUnnecessaryResult
978 down from Node to ExpressionNode. Changed some classes to not inherit from
979 ExpressionNode where not necessary, and removed unnneeded evaluate functions
980 as well as evaluate functions that need not be virtual. Call the
981 optimizeForUnnecessaryResult function on the start of a for loop too.
983 (KJS::ExpressionNode::evaluateToBoolean): Added.
984 (KJS::FalseNode::evaluate): Added.
985 (KJS::TrueNode::evaluate): Added.
986 (KJS::NumberNode::evaluateToBoolean): Added.
987 (KJS::StringNode::evaluateToBoolean): Added.
988 (KJS::LocalVarAccessNode::evaluateToBoolean): Added.
989 (KJS::BracketAccessorNode::evaluateToBoolean): Added.
990 (KJS::LogicalNotNode::evaluate): Changed to call evaluateToBoolean.
991 (KJS::LogicalNotNode::evaluateToBoolean): Added.
992 (KJS::lessThan): Changed to return bool.
993 (KJS::lessThanEq): Ditto.
994 (KJS::LessNode::evaluate): Changed since lessThan returns bool.
995 (KJS::LessNode::evaluateToBoolean): Added.
996 (KJS::GreaterNode::evaluate): Changed since lessThanEq returns bool.
997 (KJS::GreaterNode::evaluateToBoolean): Added.
998 (KJS::LessEqNode::evaluate): Changed since lessThanEq returns bool.
999 (KJS::LessEqNode::evaluateToBoolean): Added.
1000 (KJS::GreaterEqNode::evaluate): Changed since lessThan returns bool.
1001 (KJS::GreaterEqNode::evaluateToBoolean): Added.
1002 (KJS::InstanceOfNode::evaluateToBoolean): Added.
1003 (KJS::InNode::evaluateToBoolean): Added.
1004 (KJS::EqualNode::evaluateToBoolean): Added.
1005 (KJS::NotEqualNode::evaluateToBoolean): Added.
1006 (KJS::StrictEqualNode::evaluateToBoolean): Added.
1007 (KJS::NotStrictEqualNode::evaluateToBoolean): Added.
1008 (KJS::ConditionalNode::evaluate): Changed to call evaluateToBoolean.
1009 (KJS::IfNode::execute): Ditto.
1010 (KJS::DoWhileNode::execute): Ditto.
1011 (KJS::WhileNode::execute): Ditto.
1012 (KJS::ForNode::execute): Ditto.
1014 * kjs/nodes2string.cpp:
1015 (KJS::FalseNode::streamTo): Added.
1016 (KJS::TrueNode::streamTo): Added.
1018 2007-11-09 Adam Roben <aroben@apple.com>
1025 (KJS::jsNumber): Add some explicit casts.
1027 2007-11-08 Darin Adler <darin@apple.com>
1033 * kjs/property_map.cpp:
1035 2007-11-08 Darin Adler <darin@apple.com>
1037 - roll out accidentally-checked in changes
1039 * kjs/nodes.cpp: Back to previous version.
1040 * kjs/nodes.h: Ditto.
1041 * kjs/grammar.y: Ditto.
1043 2007-11-08 Darin Adler <darin@apple.com>
1047 - http://bugs.webkit.org/show_bug.cgi?id=15912
1048 fasta spends a lot of time in qsort
1050 * kjs/property_map.cpp:
1051 (KJS::PropertyMap::getEnumerablePropertyNames):
1052 Use insertion sort instead of qsort for small sets of property names.
1053 We can probably do some even-better speedups of for/in, but this nets
1054 0.6% overall and 6.7% on fasta.
1056 2007-11-08 Darin Adler <darin@apple.com>
1060 - http://bugs.webkit.org/show_bug.cgi?id=15906
1061 getting characters by indexing into a string is very slow
1063 This fixes one source of the slowness -- the conversion to an unused
1064 Identifier as we call the get function from the slot -- but doesn't
1065 fix others, such as the fact that we have to allocate a new UString::Rep
1066 for every single character.
1068 Speeds up string-base64 30%, and at least 0.5% overall.
1069 But does slow down access-fannkuch quite a bit. Might be worth
1070 revisiting in the future to see what we can do about that (although
1071 I did look at a profile for a while).
1073 * kjs/property_slot.h: Add a new marker for "numeric" property slots;
1074 slots where we don't need to pass the identifier to the get function.
1075 (KJS::PropertySlot::getValue): Added code to call the numeric get function.
1076 (KJS::PropertySlot::setCustomNumeric): Added.
1077 * kjs/string_object.cpp:
1078 (KJS::StringInstance::indexGetter): Changed to use substr() instead
1079 of constructing a wholly new UString each time.
1080 (KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
1081 takes advantage of setCustomNumeric to avoid creating an Identifier.
1082 (KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
1084 2007-11-08 Darin Adler <darin@apple.com>
1088 - http://bugs.webkit.org/show_bug.cgi?id=15904
1089 more speed-ups possible by tightening up int version of JSImmediate
1091 1% improvement of SunSpider
1093 * kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
1094 (KJS::JSImmediate::from): Overload for most numeric types; many types can
1095 do fewer branches and checks.
1096 (KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
1097 (KJS::JSImmediate::getTruncatedInt32): Ditto.
1098 (KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
1099 between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
1101 * kjs/grammar.y: Update since fromDouble is now just from.
1102 * kjs/nodes.h: Ditto.
1104 * kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
1106 2007-11-08 Kevin Ollivier <kevino@theolliviers.com>
1108 Bakefiles for building JavaScriptCore, needed by wx port.
1110 Reviewed by Mark Rowe.
1112 * JavaScriptCoreSources.bkl: Added.
1113 * jscore.bkl: Added.
1115 2007-11-08 Oliver Hunt <oliver@apple.com>
1119 Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
1121 The implementation of JSImmediate::areBothImmediateNumbers relies on
1122 (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
1123 a unique result when both immediate values are numbers.
1125 The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
1126 By swapping the value of NumberType and UndefinedType this ceases to be a problem.
1131 2007-11-08 Darin Adler <darin@apple.com>
1135 * kjs/nodes.h: Add missing parameter name.
1137 2007-11-08 Eric Seidel <eric@webkit.org>
1141 Add ExpressionNode subclass of Node, use it.
1145 (KJS::ForInNode::ForInNode):
1147 (KJS::ExpressionNode::):
1149 (KJS::NullNode::precedence):
1150 (KJS::BooleanNode::):
1151 (KJS::BooleanNode::precedence):
1152 (KJS::RegExpNode::):
1153 (KJS::RegExpNode::precedence):
1155 (KJS::ThisNode::precedence):
1156 (KJS::ResolveNode::):
1157 (KJS::ElementNode::):
1159 (KJS::PropertyNode::):
1160 (KJS::PropertyNode::precedence):
1161 (KJS::PropertyNode::name):
1162 (KJS::PropertyListNode::):
1163 (KJS::ObjectLiteralNode::):
1164 (KJS::ObjectLiteralNode::precedence):
1165 (KJS::BracketAccessorNode::):
1166 (KJS::DotAccessorNode::):
1167 (KJS::DotAccessorNode::precedence):
1168 (KJS::ArgumentListNode::):
1169 (KJS::ArgumentsNode::):
1170 (KJS::NewExprNode::):
1171 (KJS::NewExprNode::precedence):
1172 (KJS::FunctionCallValueNode::):
1173 (KJS::FunctionCallValueNode::precedence):
1174 (KJS::FunctionCallResolveNode::):
1175 (KJS::FunctionCallBracketNode::):
1176 (KJS::FunctionCallBracketNode::precedence):
1177 (KJS::FunctionCallDotNode::):
1178 (KJS::FunctionCallDotNode::precedence):
1179 (KJS::PrePostResolveNode::):
1180 (KJS::PostfixBracketNode::):
1181 (KJS::PostfixBracketNode::precedence):
1182 (KJS::PostIncBracketNode::):
1183 (KJS::PostIncBracketNode::isIncrement):
1184 (KJS::PostDecBracketNode::):
1185 (KJS::PostDecBracketNode::isIncrement):
1186 (KJS::PostfixDotNode::):
1187 (KJS::PostfixDotNode::precedence):
1188 (KJS::PostIncDotNode::):
1189 (KJS::PostIncDotNode::isIncrement):
1190 (KJS::PostDecDotNode::):
1191 (KJS::PostDecDotNode::isIncrement):
1192 (KJS::PostfixErrorNode::):
1193 (KJS::PostfixErrorNode::precedence):
1194 (KJS::DeleteResolveNode::):
1195 (KJS::DeleteBracketNode::):
1196 (KJS::DeleteBracketNode::precedence):
1197 (KJS::DeleteDotNode::):
1198 (KJS::DeleteDotNode::precedence):
1199 (KJS::DeleteValueNode::):
1200 (KJS::DeleteValueNode::precedence):
1202 (KJS::VoidNode::precedence):
1203 (KJS::TypeOfResolveNode::):
1204 (KJS::TypeOfValueNode::):
1205 (KJS::PrefixBracketNode::):
1206 (KJS::PrefixBracketNode::precedence):
1207 (KJS::PreIncBracketNode::):
1208 (KJS::PreIncBracketNode::isIncrement):
1209 (KJS::PreDecBracketNode::):
1210 (KJS::PreDecBracketNode::isIncrement):
1211 (KJS::PrefixDotNode::):
1212 (KJS::PrefixDotNode::precedence):
1213 (KJS::PreIncDotNode::):
1214 (KJS::PreIncDotNode::isIncrement):
1215 (KJS::PreDecDotNode::):
1216 (KJS::PreDecDotNode::isIncrement):
1217 (KJS::PrefixErrorNode::):
1218 (KJS::PrefixErrorNode::precedence):
1219 (KJS::UnaryPlusNode::):
1220 (KJS::UnaryPlusNode::precedence):
1221 (KJS::NegateNode::):
1222 (KJS::NegateNode::precedence):
1223 (KJS::BitwiseNotNode::):
1224 (KJS::BitwiseNotNode::precedence):
1225 (KJS::LogicalNotNode::):
1226 (KJS::LogicalNotNode::precedence):
1228 (KJS::AddNode::precedence):
1229 (KJS::LeftShiftNode::):
1230 (KJS::LeftShiftNode::precedence):
1231 (KJS::RightShiftNode::):
1232 (KJS::RightShiftNode::precedence):
1233 (KJS::UnsignedRightShiftNode::):
1234 (KJS::UnsignedRightShiftNode::precedence):
1236 (KJS::LessNode::precedence):
1237 (KJS::GreaterNode::):
1238 (KJS::GreaterNode::precedence):
1239 (KJS::LessEqNode::):
1240 (KJS::LessEqNode::precedence):
1241 (KJS::GreaterEqNode::):
1242 (KJS::GreaterEqNode::precedence):
1243 (KJS::InstanceOfNode::):
1244 (KJS::InstanceOfNode::precedence):
1246 (KJS::InNode::precedence):
1248 (KJS::EqualNode::precedence):
1249 (KJS::NotEqualNode::):
1250 (KJS::NotEqualNode::precedence):
1251 (KJS::StrictEqualNode::):
1252 (KJS::StrictEqualNode::precedence):
1253 (KJS::NotStrictEqualNode::):
1254 (KJS::NotStrictEqualNode::precedence):
1255 (KJS::BitAndNode::):
1256 (KJS::BitAndNode::precedence):
1258 (KJS::BitOrNode::precedence):
1259 (KJS::BitXOrNode::):
1260 (KJS::BitXOrNode::precedence):
1261 (KJS::LogicalAndNode::):
1262 (KJS::LogicalAndNode::precedence):
1263 (KJS::LogicalOrNode::):
1264 (KJS::LogicalOrNode::precedence):
1265 (KJS::ConditionalNode::):
1266 (KJS::ConditionalNode::precedence):
1267 (KJS::ReadModifyResolveNode::):
1268 (KJS::ReadModifyResolveNode::precedence):
1269 (KJS::AssignResolveNode::):
1270 (KJS::AssignResolveNode::precedence):
1271 (KJS::ReadModifyBracketNode::):
1272 (KJS::ReadModifyBracketNode::precedence):
1273 (KJS::AssignBracketNode::):
1274 (KJS::AssignBracketNode::precedence):
1275 (KJS::AssignDotNode::):
1276 (KJS::AssignDotNode::precedence):
1277 (KJS::ReadModifyDotNode::):
1278 (KJS::ReadModifyDotNode::precedence):
1279 (KJS::AssignErrorNode::):
1280 (KJS::AssignErrorNode::precedence):
1282 (KJS::CommaNode::precedence):
1283 (KJS::AssignExprNode::):
1284 (KJS::AssignExprNode::precedence):
1285 (KJS::ExprStatementNode::):
1287 (KJS::DoWhileNode::):
1289 (KJS::ReturnNode::):
1292 (KJS::ParameterNode::):
1293 (KJS::CaseClauseNode::):
1294 (KJS::CaseClauseNode::precedence):
1295 (KJS::ClauseListNode::):
1296 (KJS::SwitchNode::):
1298 2007-11-08 Oliver Hunt <oliver@apple.com>
1302 Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
1304 This only improves bitwise-and performance, as the additional logic required
1305 for similar code paths on or, xor, and shifting requires additional operations
1306 and branches that negate (and in certain cases, regress) any advantage we might
1309 This improves performance on all bitop tests, the cryptography tests, as well as
1310 the string-base64 and string-unpack-code tests. No significant degradation on
1313 * kjs/JSImmediate.h:
1314 (KJS::JSImmediate::areBothImmediateNumbers):
1315 (KJS::JSImmediate::andImmediateNumbers):
1317 (KJS::BitAndNode::evaluate):
1319 (KJS::jsNumberFromAnd):
1321 2007-11-08 Adam Roben <aroben@apple.com>
1323 Stop using KJS inside of MathExtras.h
1327 * wtf/MathExtras.h: Removed an unused header, and a now-unused
1328 forward-declaration.
1329 (wtf_atan2): Use std::numeric_limits intead of KJS.
1331 2007-11-08 Sam Weinig <sam@webkit.org>
1335 * kjs/date_object.cpp:
1336 (KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
1337 (KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
1338 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
1340 2007-11-08 Mark Rowe <mrowe@apple.com>
1344 * kjs/lookup.h: Add missing include.
1346 2007-11-08 Sam Weinig <sam@webkit.org>
1350 Convert JavaScript internal function objects to use one class per
1351 function. This avoids a switch statement inside what used to be
1352 the shared function classes and will allow Shark to better analyze
1355 To make this switch, the value property of the HashEntry was changed
1356 to a union of an intptr_t (which is used to continue handle valueGetters)
1357 and function pointer which points to a static constructor for the
1358 individual new function objects.
1360 SunSpider claims this is a 1.0% speedup.
1362 * kjs/array_object.cpp:
1363 (KJS::ArrayPrototype::getOwnPropertySlot):
1365 (KJS::ArrayProtoFuncToString::callAsFunction):
1366 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
1367 (KJS::ArrayProtoFuncJoin::callAsFunction):
1368 (KJS::ArrayProtoFuncConcat::callAsFunction):
1369 (KJS::ArrayProtoFuncPop::callAsFunction):
1370 (KJS::ArrayProtoFuncPush::callAsFunction):
1371 (KJS::ArrayProtoFuncReverse::callAsFunction):
1372 (KJS::ArrayProtoFuncShift::callAsFunction):
1373 (KJS::ArrayProtoFuncSlice::callAsFunction):
1374 (KJS::ArrayProtoFuncSort::callAsFunction):
1375 (KJS::ArrayProtoFuncSplice::callAsFunction):
1376 (KJS::ArrayProtoFuncUnShift::callAsFunction):
1377 (KJS::ArrayProtoFuncFilter::callAsFunction):
1378 (KJS::ArrayProtoFuncMap::callAsFunction):
1379 (KJS::ArrayProtoFuncEvery::callAsFunction):
1380 (KJS::ArrayProtoFuncForEach::callAsFunction):
1381 (KJS::ArrayProtoFuncSome::callAsFunction):
1382 (KJS::ArrayProtoFuncIndexOf::callAsFunction):
1383 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
1384 * kjs/array_object.h:
1385 (KJS::ArrayPrototype::classInfo):
1386 * kjs/create_hash_table:
1387 * kjs/date_object.cpp:
1388 (KJS::DatePrototype::getOwnPropertySlot):
1389 (KJS::DateProtoFuncToString::callAsFunction):
1390 (KJS::DateProtoFuncToUTCString::callAsFunction):
1391 (KJS::DateProtoFuncToDateString::callAsFunction):
1392 (KJS::DateProtoFuncToTimeString::callAsFunction):
1393 (KJS::DateProtoFuncToLocaleString::callAsFunction):
1394 (KJS::DateProtoFuncToLocaleDateString::callAsFunction):
1395 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
1396 (KJS::DateProtoFuncValueOf::callAsFunction):
1397 (KJS::DateProtoFuncGetTime::callAsFunction):
1398 (KJS::DateProtoFuncGetFullYear::callAsFunction):
1399 (KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
1400 (KJS::DateProtoFuncToGMTString::callAsFunction):
1401 (KJS::DateProtoFuncGetMonth::callAsFunction):
1402 (KJS::DateProtoFuncGetUTCMonth::callAsFunction):
1403 (KJS::DateProtoFuncGetDate::callAsFunction):
1404 (KJS::DateProtoFuncGetUTCDate::callAsFunction):
1405 (KJS::DateProtoFuncGetDay::callAsFunction):
1406 (KJS::DateProtoFuncGetUTCDay::callAsFunction):
1407 (KJS::DateProtoFuncGetHours::callAsFunction):
1408 (KJS::DateProtoFuncGetUTCHours::callAsFunction):
1409 (KJS::DateProtoFuncGetMinutes::callAsFunction):
1410 (KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
1411 (KJS::DateProtoFuncGetSeconds::callAsFunction):
1412 (KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
1413 (KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
1414 (KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
1415 (KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
1416 (KJS::DateProtoFuncSetTime::callAsFunction):
1417 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
1418 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
1419 (KJS::DateProtoFuncSetSeconds::callAsFunction):
1420 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
1421 (KJS::DateProtoFuncSetMinutes::callAsFunction):
1422 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
1423 (KJS::DateProtoFuncSetHours::callAsFunction):
1424 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
1425 (KJS::DateProtoFuncSetDate::callAsFunction):
1426 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
1427 (KJS::DateProtoFuncSetMonth::callAsFunction):
1428 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
1429 (KJS::DateProtoFuncSetFullYear::callAsFunction):
1430 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
1431 (KJS::DateProtoFuncSetYear::callAsFunction):
1432 (KJS::DateProtoFuncGetYear::callAsFunction):
1433 * kjs/date_object.h:
1435 (KJS::Lookup::find):
1438 (KJS::staticFunctionGetter):
1439 (KJS::staticValueGetter):
1440 (KJS::getStaticPropertySlot):
1441 (KJS::getStaticFunctionSlot):
1443 * kjs/math_object.cpp:
1444 (KJS::MathObjectImp::getOwnPropertySlot):
1445 (KJS::MathProtoFuncAbs::callAsFunction):
1446 (KJS::MathProtoFuncACos::callAsFunction):
1447 (KJS::MathProtoFuncASin::callAsFunction):
1448 (KJS::MathProtoFuncATan::callAsFunction):
1449 (KJS::MathProtoFuncATan2::callAsFunction):
1450 (KJS::MathProtoFuncCeil::callAsFunction):
1451 (KJS::MathProtoFuncCos::callAsFunction):
1452 (KJS::MathProtoFuncExp::callAsFunction):
1453 (KJS::MathProtoFuncFloor::callAsFunction):
1454 (KJS::MathProtoFuncLog::callAsFunction):
1455 (KJS::MathProtoFuncMax::callAsFunction):
1456 (KJS::MathProtoFuncMin::callAsFunction):
1457 (KJS::MathProtoFuncPow::callAsFunction):
1458 (KJS::MathProtoFuncRandom::callAsFunction):
1459 (KJS::MathProtoFuncRound::callAsFunction):
1460 (KJS::MathProtoFuncSin::callAsFunction):
1461 (KJS::MathProtoFuncSqrt::callAsFunction):
1462 (KJS::MathProtoFuncTan::callAsFunction):
1463 * kjs/math_object.h:
1464 (KJS::MathObjectImp::classInfo):
1465 (KJS::MathObjectImp::):
1466 * kjs/string_object.cpp:
1467 (KJS::StringPrototype::getOwnPropertySlot):
1468 (KJS::StringProtoFuncToString::callAsFunction):
1469 (KJS::StringProtoFuncValueOf::callAsFunction):
1470 (KJS::StringProtoFuncCharAt::callAsFunction):
1471 (KJS::StringProtoFuncCharCodeAt::callAsFunction):
1472 (KJS::StringProtoFuncConcat::callAsFunction):
1473 (KJS::StringProtoFuncIndexOf::callAsFunction):
1474 (KJS::StringProtoFuncLastIndexOf::callAsFunction):
1475 (KJS::StringProtoFuncMatch::callAsFunction):
1476 (KJS::StringProtoFuncSearch::callAsFunction):
1477 (KJS::StringProtoFuncReplace::callAsFunction):
1478 (KJS::StringProtoFuncSlice::callAsFunction):
1479 (KJS::StringProtoFuncSplit::callAsFunction):
1480 (KJS::StringProtoFuncSubstr::callAsFunction):
1481 (KJS::StringProtoFuncSubstring::callAsFunction):
1482 (KJS::StringProtoFuncToLowerCase::callAsFunction):
1483 (KJS::StringProtoFuncToUpperCase::callAsFunction):
1484 (KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
1485 (KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
1486 (KJS::StringProtoFuncLocaleCompare::callAsFunction):
1487 (KJS::StringProtoFuncBig::callAsFunction):
1488 (KJS::StringProtoFuncSmall::callAsFunction):
1489 (KJS::StringProtoFuncBlink::callAsFunction):
1490 (KJS::StringProtoFuncBold::callAsFunction):
1491 (KJS::StringProtoFuncFixed::callAsFunction):
1492 (KJS::StringProtoFuncItalics::callAsFunction):
1493 (KJS::StringProtoFuncStrike::callAsFunction):
1494 (KJS::StringProtoFuncSub::callAsFunction):
1495 (KJS::StringProtoFuncSup::callAsFunction):
1496 (KJS::StringProtoFuncFontcolor::callAsFunction):
1497 (KJS::StringProtoFuncFontsize::callAsFunction):
1498 (KJS::StringProtoFuncAnchor::callAsFunction):
1499 (KJS::StringProtoFuncLink::callAsFunction):
1500 * kjs/string_object.h:
1502 2007-11-08 Adam Roben <aroben@apple.com>
1506 Reviewed by Sam and Ada.
1508 * wtf/MathExtras.h: Get rid of a circular #include dependency to fix
1511 2007-11-08 Adam Roben <aroben@apple.com>
1513 Fix a precedence warning on Windows
1515 * kjs/JSImmediate.h:
1516 (KJS::JSImmediate::toBoolean):
1518 2007-11-08 Mark Rowe <mrowe@apple.com>
1520 Build fix for JavaScriptGlue.
1522 * wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
1524 2007-11-08 Darin Adler <darin@apple.com>
1528 * kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
1530 2007-11-08 Oliver Hunt <oliver@apple.com>
1534 Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
1536 Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
1537 we should now have faster array access, faster immediate to double conversion, and the
1538 potential to further improve bitwise operators in future.
1540 This also removes the need for unions to avoid strict aliasing problems when extracting
1541 a value from immediates.
1543 * kjs/JSImmediate.h:
1545 (KJS::JSImmediate::trueImmediate):
1546 (KJS::JSImmediate::falseImmediate):
1547 (KJS::JSImmediate::undefinedImmediate):
1548 (KJS::JSImmediate::nullImmediate):
1549 (KJS::JSImmediate::toBoolean):
1553 2007-11-07 Eric Seidel <eric@webkit.org>
1555 Reviewed by Darin and Oliver.
1557 Add evaluateToNumber parallel evaluation tree to speed up number operations.
1558 Make ImmediateNumberNode a subclass of NumberNode.
1559 Share evaluate logic between evaluate and evaluateToNumber using inline functions
1560 There is still a lot of improvement to be made here.
1562 SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
1563 Given the huge win that this prepares us for with simple type inferencing I see the small
1564 regression in base64 being worth the substantial overall improvement.
1568 (KJS::Node::evaluateToNumber):
1569 (KJS::NumberNode::evaluate):
1570 (KJS::NumberNode::evaluateToNumber):
1571 (KJS::StringNode::evaluateToNumber):
1572 (KJS::LocalVarAccessNode::inlineEvaluate):
1573 (KJS::LocalVarAccessNode::evaluate):
1574 (KJS::LocalVarAccessNode::evaluateToNumber):
1575 (KJS::BracketAccessorNode::inlineEvaluate):
1576 (KJS::BracketAccessorNode::evaluate):
1577 (KJS::BracketAccessorNode::evaluateToNumber):
1578 (KJS::NegateNode::evaluate):
1579 (KJS::NegateNode::evaluateToNumber):
1580 (KJS::MultNode::inlineEvaluateToNumber):
1581 (KJS::MultNode::evaluate):
1582 (KJS::MultNode::evaluateToNumber):
1583 (KJS::DivNode::inlineEvaluateToNumber):
1584 (KJS::DivNode::evaluate):
1585 (KJS::DivNode::evaluateToNumber):
1586 (KJS::ModNode::inlineEvaluateToNumber):
1587 (KJS::ModNode::evaluate):
1588 (KJS::ModNode::evaluateToNumber):
1589 (KJS::throwOutOfMemoryErrorToNumber):
1590 (KJS::addSlowCaseToNumber):
1593 (KJS::AddNode::evaluateToNumber):
1594 (KJS::SubNode::inlineEvaluateToNumber):
1595 (KJS::SubNode::evaluate):
1596 (KJS::SubNode::evaluateToNumber):
1597 (KJS::valueForReadModifyAssignment):
1598 (KJS::ReadModifyLocalVarNode::evaluate):
1599 (KJS::ReadModifyResolveNode::evaluate):
1600 (KJS::ReadModifyDotNode::evaluate):
1601 (KJS::ReadModifyBracketNode::evaluate):
1604 (KJS::NumberNode::):
1605 (KJS::ImmediateNumberNode::):
1606 (KJS::AddNode::precedence):
1607 * kjs/nodes2string.cpp:
1608 (KJS::NumberNode::streamTo):
1610 2007-11-07 Mark Rowe <mrowe@apple.com>
1614 Fix up initialization after being mangled in r27572, and remove the
1615 ternary expression as extraCost will always be zero for the numeric
1618 * kjs/collector.cpp:
1619 (KJS::Collector::heapAllocate):
1621 2007-11-07 Mark Rowe <mrowe@apple.com>
1625 * kjs/regexp_object.cpp:
1627 2007-11-07 Geoffrey Garen <ggaren@apple.com>
1629 Reviewed by Beth Dakin.
1631 Eliminated a bogus (though compiled-out) branch in the collector.
1633 * kjs/collector.cpp:
1634 (KJS::Collector::heapAllocate):
1636 2007-11-06 Geoffrey Garen <ggaren@apple.com>
1638 Reviewed by Darin Adler.
1640 Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861
1641 5.8% of string-validate-input.js is spent creating RegExpImps
1643 Put RegExpImp properties into a static hashtable to avoid a slew of
1644 PropertyMap churn when creating a RegExpImp.
1646 Factored important bits of regular expression implementation out of
1647 RegExpImp (the JS object) and into RegExp (the PCRE wrapper class),
1648 making RegExp a ref-counted class. (This will help later.)
1650 Removed PCRE_POSIX support because I didn't quite know how to test it
1651 and keep it working with these changes.
1653 1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
1655 * kjs/regexp.h: A few interface changes:
1656 1. Renamed "subpatterns()" => "numSubpatterns()"
1657 2. Made flag enumeration private and replaced it with public getters for
1659 3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
1660 4. Made RegExp take a string of flags instead of an int, eliminating
1661 duplicated flag parsing code elsewhere.
1663 * kjs/regexp_object.cpp:
1664 (KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile:
1665 - Fixed a bug where compile(undefined) would throw an exception.
1666 - Removed some now-redundant code.
1667 - Used RegExp sharing to eliminate an allocation and a bunch of
1668 PropertyMap thrash. (Not a big win since compile is a deprecated
1669 function. I mainly did this to test the plubming.)
1671 2007-11-07 Simon Hausmann <hausmann@kde.org>
1673 Reviewed by nobody, Qt/Windows build fix.
1675 JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
1676 testkjs.pro, too, where it's included from.
1680 2007-11-07 Simon Hausmann <shausman@trolltech.com>
1684 Fix "nmake clean" for the Qt/Windows build by replacing tmp/ with a variable that ends with the correct type of slash/backslash depending on the choice of compiler/make tool.
1686 * JavaScriptCore.pri:
1689 2007-11-07 Lars Knoll <lars@trolltech.com>
1695 Pretty embarrassing bug. Has the potential to fix quite a few test failures.
1697 * wtf/unicode/qt4/UnicodeQt4.h:
1698 (WTF::Unicode::umemcasecmp):
1700 2007-11-06 Maciej Stachowiak <mjs@apple.com>
1704 - only collect when the heap is full, unless we have lots of extra cost garbage
1706 1.1% SunSpider speedup.
1708 This shouldn't hit memory use much since the extra space in those
1709 blocks hangs around either way.
1711 * kjs/collector.cpp:
1712 (KJS::Collector::heapAllocate):
1713 (KJS::Collector::collect): Fix logic error that reversed the sense of collect's
1716 2007-11-06 Oliver Hunt <oliver@apple.com>
1720 Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
1722 We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
1723 'for (...; ...; ++<var>) ...'.
1726 (KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
1727 (KJS::PostIncLocalVarNode::evaluate):
1728 (KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
1729 (KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
1730 (KJS::PostDecLocalVarNode::evaluate):
1731 (KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
1733 (KJS::PrePostResolveNode::):
1734 (KJS::PostIncResolveNode::):
1735 (KJS::PostIncLocalVarNode::):
1736 (KJS::PostDecResolveNode::):
1737 (KJS::PostDecLocalVarNode::):
1738 (KJS::PreIncResolveNode::):
1739 (KJS::PreDecResolveNode::):
1740 (KJS::ForNode::ForNode):
1742 2007-11-06 Eric Seidel <eric@webkit.org>
1746 This fixes a regressed layout test for string + object
1748 SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
1751 (KJS::add): remove erroneous "fast path" for string + *
1753 2007-11-06 Geoffrey Garen <ggaren@apple.com>
1755 Reviewed by Eric Seidel.
1757 Added toJSNumber, a fast path for converting a JSValue to a JS number,
1758 and deployed it in postfix expressions. In the fast case this
1759 eliminates a call to jsNumber.
1761 0.4% speedup on SunSpider.
1765 (KJS::PostIncResolveNode::evaluate):
1766 (KJS::PostIncLocalVarNode::evaluate):
1767 (KJS::PostDecResolveNode::evaluate):
1768 (KJS::PostDecLocalVarNode::evaluate):
1769 (KJS::PostIncBracketNode::evaluate):
1770 (KJS::PostDecBracketNode::evaluate):
1771 (KJS::PostIncDotNode::evaluate):
1772 (KJS::PostDecDotNode::evaluate):
1773 (KJS::UnaryPlusNode::evaluate):
1775 (KJS::JSValue::toJSNumber):
1777 2007-11-06 Darin Adler <darin@apple.com>
1781 - http://bugs.webkit.org/show_bug.cgi?id=15846
1782 REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
1784 There was a mistake in the algorithm used to find an empty slot in the property
1785 map entries vector; when we were putting in a new property value and not overwriting
1786 an existing deleted sentinel, we would enlarge the entries vector, but would not
1787 overwrite the stale data that's in the new part. It was easy to pin this down by
1788 turning on property map consistency checks -- I never would have landed with this
1789 bug if I had run the regression tests once with consistency checks on!
1791 * kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
1792 foundDeletedElement is false to always use the item at the end of the entries vector.
1793 Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
1795 2007-11-06 Oliver Hunt <oliver@apple.com>
1799 Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
1804 2007-11-06 Oliver Hunt <oliver@apple.com>
1808 Replace boolean comparisons in AddNode with mask
1809 comparisons for a 0.2% improvement in sunspider.
1811 * JavaScriptCore.xcodeproj/project.pbxproj:
1815 2007-11-06 Eric Seidel <eric@webkit.org>
1819 SunSpider claims this is a 1.1% speedup.
1822 (KJS::throwOutOfMemoryError): Added, non inline.
1823 (KJS::addSlowCase): renamed from add(), non inline.
1824 (KJS::add): add fast path for String + String, Number + Number and String + *
1826 2007-11-06 Eric Seidel <eric@webkit.org>
1830 Avoid more UString creation.
1832 SunSpider claims this is a 0.4% speedup.
1834 * kjs/regexp_object.cpp:
1835 (KJS::RegExpObjectImp::construct): use UString::find(UChar)
1837 2007-11-05 Mark Rowe <mrowe@apple.com>
1841 * kjs/array_object.cpp:
1842 (KJS::ArrayProtoFunc::callAsFunction):
1844 2007-11-05 Adam Roben <aroben@apple.com>
1850 2007-11-05 Mark Rowe <mrowe@apple.com>
1852 Build fix. Add missing #include.
1854 * kjs/operations.cpp:
1856 2007-11-05 Eric Seidel <eric@webkit.org>
1860 Remove another call to toString(exec)
1862 SunSpider claims this is a 0.5% speedup.
1864 * kjs/operations.cpp:
1865 (KJS::equal): remove another toString
1867 2007-11-05 Eric Seidel <eric@webkit.org>
1869 * kjs/operations.cpp:
1870 (KJS::equal): correct broken change.
1872 2007-11-05 Eric Seidel <eric@webkit.org>
1876 Remove one more call to toString(exec).
1878 SunSpider claims this is a 0.7% speedup.
1880 * kjs/operations.cpp:
1881 (KJS::equal): remove a call to toString()
1883 2007-11-05 Mark Rowe <mrowe@apple.com>
1889 2007-11-05 Mark Rowe <mrowe@apple.com>
1895 2007-11-05 Geoffrey Garen <ggaren@apple.com>
1897 Touched a file to test my new HTTP access.
1899 * kjs/scope_chain.cpp:
1901 2007-11-05 Alp Toker <alp@atoker.com>
1903 Unreviewed build fix for qmake-based ports.
1905 Someone with a better understanding of qmake still needs to sort out
1906 the INCLUDEPATH/DEPENDPATH mess.
1908 * JavaScriptCore.pri:
1910 2007-11-05 Geoffrey Garen <ggaren@apple.com>
1912 Reviewed by Darin Adler.
1914 http://bugs.webkit.org/show_bug.cgi?id=15835
1916 Switched List implementation from a custom heap allocator to an inline
1917 Vector, for a disappointing .5% SunSpider speedup.
1919 Also renamed List::slice to List::getSlice because "get" is the
1920 conventional prefix for functions returning a value through an out
1923 * kjs/array_object.cpp:
1924 (KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
1925 calls and memory accesses.
1927 * kjs/bool_object.cpp:
1928 (BooleanObjectImp::construct): Removed questionable use of iterator.
1931 * kjs/list.h: New List class, implemented in terms of Vector. Two
1932 interesting differences:
1933 1. The inline capacity is 8, not 5. Many of the Lists constructed
1934 during a SunSpider run are larger than 5; almost none are larger
1937 2. The growth factor is 4, not 2. Since we can guarantee that Lists
1938 aren't long-lived, we can grow them more aggressively, to avoid
1941 * kjs/regexp_object.cpp:
1942 (RegExpObjectImp::construct): Removed redundant function calls.
1944 * kjs/string_object.cpp:
1945 (KJS::StringObjectImp::construct): Removed questionable use of iterator.
1948 (WTF::::uncheckedAppend): Added a fast, unchecked version of append.
1950 2007-11-05 Mark Rowe <mrowe@apple.com>
1952 Reviewed by Alp Toker.
1954 Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
1956 * JavaScriptCore.pri:
1959 2007-11-04 Darin Adler <darin@apple.com>
1963 - http://bugs.webkit.org/show_bug.cgi?id=15826
1964 optimize opcode loop and case insensitive ASCII compares for a 30% speedup
1966 SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
1968 * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
1970 * pcre/pcre_compile.c:
1971 (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
1972 added OP_NOT since there was no reason it should not be in here.
1973 (could_be_empty_branch): Ditto.
1974 (compile_branch): Streamlined all the single-character cases; there was a bit of
1975 duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
1976 But in particular, compile to those opcodes when the single character match is
1978 (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
1980 * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
1981 the matchframe, after I discovered that none of them needed to be saved and restored
1982 across recursive match calls. Also eliminated the ignored result field from the
1983 matchframe, since I discovered that rrc ("recursive result code") was already the
1984 exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
1985 statement of the switch instead of doing them before the switch. This removes a
1986 branch from each iteration of the opcode interpreter, just as removal of "op"
1987 removed at least one store from each iteration. Last, but not least, add the
1988 OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
1989 surrogate pair and the letter case can be handled efficiently.
1991 2007-11-04 Darin Adler <darin@apple.com>
1993 * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
1995 2007-11-03 Darin Adler <darin@apple.com>
1997 - fix non-Mac builds; remove some more unused PCRE stuff
1999 * pcre/pcre_compile.c:
2000 (compile_branch): Removed branch chain and some unused ESC values.
2001 (compile_regex): Ditto.
2002 (jsRegExpCompile): Ditto.
2004 (match): Removed unused branch targets. Don't use macros any more.
2005 (jsRegExpExecute): More of the same.
2007 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
2008 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
2009 * pcre/pcre.pri: Ditto.
2011 * pcre/MERGING: Removed.
2012 * pcre/pcre_fullinfo.c: Removed.
2013 * pcre/pcre_get.c: Removed.
2014 * pcre/pcre_internal.h:
2015 * pcre/ucp.h: Removed.
2017 2007-11-03 Darin Adler <darin@apple.com>
2021 - http://bugs.webkit.org/show_bug.cgi?id=15821
2022 remove unused PCRE features for speed
2024 A first step toward removing the PCRE features we don't use.
2025 This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
2026 the SunSpider regular expression test.
2028 Replaced the public interface with one that doesn't use the
2029 name PCRE. Removed code we don't need for JavaScript and various
2030 configurations we don't use. This is in preparation for still
2031 more changes in the future. We'll probably switch to C++ and
2032 make some even more significant changes to the regexp engine
2033 to get some additional speed.
2035 There's probably additional unused stuff that I haven't
2038 This does mean that our PCRE is now a fork, but I think that's
2039 not really a big deal.
2041 * JavaScriptCore.exp: Remove the 5 old entry points and add
2042 the 3 new entry points for WebCore's direct use of the regular
2045 * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
2046 its sense and now there's a USE(POSIX_REGEX) instead, which should
2047 probably not be set by anyone. Maybe later we'll just get rid of it
2052 (KJS::RegExp::RegExp): Switch to new jsRegExp function names and
2053 defines. Cut down on the number of functions used.
2054 (KJS::RegExp::~RegExp): Ditto.
2055 (KJS::RegExp::match): Ditto.
2057 * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
2060 * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
2061 size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
2062 POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
2063 and JAVASCRIPT. These are all no longer configurable in our copy
2066 * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
2067 version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
2068 the include of <stdlib.h>, and most of the constants and
2069 functions defined in this header. Changed the naming scheme to
2070 use a JSRegExp prefix rather than a pcre prefix. In the future,
2071 we'll probably change this to be a C++ header.
2073 * pcre/pcre_compile.c: Removed all unused code branches,
2074 including many whole functions and various byte codes.
2075 Kept changes outside of removal to a minimum.
2077 (first_significant_code):
2080 (could_be_empty_branch):
2085 (find_firstassertedchar):
2086 (jsRegExpCompile): Renamed from pcre_compile2 and changed the
2087 parameters around a bit.
2088 (jsRegExpFree): Added.
2090 * pcre/pcre_exec.c: Removed many unused opcodes and variables.
2091 Also started tearing down the NO_RECURSE mechanism since it's
2092 now the default. In some cases there were things in the explicit
2093 frame that could be turned into plain old local variables and
2094 other small like optimizations.
2097 (match): Changed parameters quite a bit since it's now not used
2099 (jsRegExpExecute): Renamed from pcre_exec.
2101 * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
2102 PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
2103 PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
2104 PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
2105 _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
2106 and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
2108 * pcre/pcre_maketables.c: Changed to only compile in dftables.
2109 Also got rid of many of the tables that we don't use.
2111 * pcre/pcre_tables.c: Removed the unused Unicode property tables.
2113 * pcre/pcre_ucp_searchfuncs.c: Removed everything except for
2114 _pcre_ucp_othercase.
2116 * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
2117 for classes based on Unicode properties.
2119 * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
2120 to eliminate this completely, but we need the regular expression
2121 code to be C++ first.
2123 * pcre/pcre_fullinfo.c:
2126 Files that are no longer needed. I didn't remove them with this
2127 check-in, because I didn't want to modify all the project files.
2129 2007-11-03 Maciej Stachowiak <mjs@apple.com>
2133 - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
2135 It turns out that doing this check costs more than it saves.
2137 * kjs/JSImmediate.h:
2138 (KJS::JSImmediate::fromDouble):
2140 2007-11-03 Sam Weinig <sam@webkit.org>
2144 Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
2145 The variable had been kept around for binary compatibility, but since nothing
2146 else is there is no point in continuing to keep it around.
2148 * API/JSCallbackConstructor.cpp:
2150 * API/JSCallbackFunction.cpp:
2152 * API/JSCallbackObject.cpp:
2154 * bindings/objc/objc_runtime.mm:
2155 * bindings/runtime_array.cpp:
2156 * bindings/runtime_object.cpp:
2157 * kjs/array_instance.cpp:
2159 * kjs/array_object.cpp:
2161 * kjs/bool_object.cpp:
2162 * kjs/date_object.cpp:
2164 * kjs/error_object.cpp:
2170 * kjs/math_object.cpp:
2171 * kjs/number_object.cpp:
2173 * kjs/regexp_object.cpp:
2174 * kjs/string_object.cpp:
2177 2007-11-03 Kevin McCullough <kmccullough@apple.com>
2179 - Updated testkjs results to make the build bots green until we
2180 can fix the tests that are failing. The new failures are in DST.
2182 * tests/mozilla/expected.html:
2184 2007-11-03 Maciej Stachowiak <mjs@apple.com>
2188 - don't print the var twice for ForInNodes with a var declaration
2190 * kjs/nodes2string.cpp:
2191 (KJS::ForInNode::streamTo):
2193 2007-11-03 Darin Adler <darin@apple.com>
2195 * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
2196 C-incompatible declaration.
2198 2007-11-03 Mark Rowe <mrowe@apple.com>
2202 * kjs/nodes.cpp: Add missing include.
2204 2007-11-03 Darin Adler <darin@apple.com>
2208 - fix http://bugs.webkit.org/show_bug.cgi?id=15814
2209 <rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
2211 These changes cause us to match the JavaScript specification and pass the
2212 fast/js/kde/encode_decode_uri.html test.
2214 * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
2215 new strict mode, throwing an exception if there are malformed UTF-16 surrogate
2218 * kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
2220 (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
2221 those might be illegal in some sense, they aren't supposed to get any special
2222 handling in the place where this function is currently used.
2223 (KJS::UString::UTF8String): Added the strictness.
2225 2007-11-03 Darin Adler <darin@apple.com>
2229 - http://bugs.webkit.org/show_bug.cgi?id=15812
2230 some JavaScript tests (from the Mozilla test suite) are failing
2232 Two or three fixes get 7 more of the Mozilla tests passing.
2233 This gets us down from 61 failing tests to 54.
2235 * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
2236 Made this inline and gave it a more specific type. Some day we should
2237 probably do that for all of these -- might even get a bit of a speed
2239 * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
2240 inline in the header.
2242 * kjs/regexp_object.h:
2243 * kjs/regexp_object.cpp:
2244 (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
2245 switch statement into the RegExpImp object, so they can be shared with
2246 RegExpImp::callAsFunction.
2247 (KJS::RegExpImp::match): Added. Common code used by both test and exec.
2248 (KJS::RegExpImp::test): Added.
2249 (KJS::RegExpImp::exec): Added.
2250 (KJS::RegExpImp::implementsCall): Added.
2251 (KJS::RegExpImp::callAsFunction): Added.
2252 (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
2253 lastInput to null rather than empty string -- we take advantage of the
2254 difference in RegExpImp::match.
2255 (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
2256 just to get at a field like this.
2258 * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
2259 the JavaScript specification. If there are not 4 hex digits after the \u,
2260 then it's processed as if it wasn't an escape sequence at all.
2262 * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
2263 for JavaScript (4 specific Unicode values).
2265 (match): Changed all call sites to use IS_NEWLINE.
2268 * tests/mozilla/expected.html: Updated to expect 7 more successful tests.
2270 2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
2272 Sort files(...); sections of Xcode project files.
2274 Rubber-stamped by Darin.
2276 * JavaScriptCore.xcodeproj/project.pbxproj:
2278 2007-11-03 Maciej Stachowiak <mjs@apple.com>
2282 - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
2286 (KJS::VarDeclNode::optimizeVariableAccess):
2287 (KJS::VarDeclNode::getDeclarations):
2288 (KJS::VarDeclNode::handleSlowCase):
2289 (KJS::VarDeclNode::evaluateSingle):
2290 (KJS::VarDeclNode::evaluate):
2291 (KJS::VarStatementNode::execute):
2293 (KJS::VarDeclNode::):
2294 (KJS::VarStatementNode::):
2295 * kjs/nodes2string.cpp:
2296 (KJS::VarDeclNode::streamTo):
2298 2007-11-03 Alexey Proskuryakov <ap@webkit.org>
2302 http://bugs.webkit.org/show_bug.cgi?id=15800
2303 REGRESSION (r27303): RegExp leaks
2305 * kjs/regexp_object.h:
2306 (KJS::RegExpImp::setRegExp):
2307 (KJS::RegExpImp::regExp):
2308 (KJS::RegExpImp::classInfo):
2309 * kjs/regexp_object.cpp:
2310 (RegExpImp::RegExpImp):
2311 (RegExpImp::~RegExpImp):
2312 Renamed reg member variable to m_regExp, changed it to use OwnPtr.
2314 2007-11-02 Maciej Stachowiak <mjs@apple.com>
2318 - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
2322 (KJS::statementListPushFIFO):
2323 (KJS::statementListGetDeclarations):
2324 (KJS::statementListInitializeDeclarationStacks):
2325 (KJS::statementListInitializeVariableAccessStack):
2326 (KJS::statementListExecute):
2327 (KJS::BlockNode::BlockNode):
2328 (KJS::FunctionBodyNode::FunctionBodyNode):
2329 (KJS::ProgramNode::ProgramNode):
2331 (KJS::CaseClauseNode::):
2333 2007-11-02 Darin Adler <darin@apple.com>
2337 - http://bugs.webkit.org/show_bug.cgi?id=15791
2338 change property map data structure for less memory use, better speed
2340 The property map now has an array of indices and a separate array of
2341 property map entries. This slightly slows down lookup because of a second
2342 memory acess, but makes property maps smaller and faster to iterate in
2343 functions like mark().
2345 SunSpider says this is 1.2% faster, although it makes the bitwise-end test
2346 more than 10% slower. To fix that we'll need to optimize global variable lookup.
2348 * kjs/property_map.cpp:
2349 (KJS::PropertyMapEntry::PropertyMapEntry):
2350 (KJS::PropertyMapHashTable::entries):
2351 (KJS::PropertyMapHashTable::allocationSize):
2352 (KJS::SavedProperties::SavedProperties):
2353 (KJS::SavedProperties::~SavedProperties):
2354 (KJS::PropertyMap::checkConsistency):
2355 (KJS::PropertyMap::~PropertyMap):
2356 (KJS::PropertyMap::clear):
2357 (KJS::PropertyMap::get):
2358 (KJS::PropertyMap::getLocation):
2359 (KJS::PropertyMap::put):
2360 (KJS::PropertyMap::insert):
2361 (KJS::PropertyMap::createTable):
2362 (KJS::PropertyMap::rehash):
2363 (KJS::PropertyMap::remove):
2364 (KJS::PropertyMap::mark):
2365 (KJS::comparePropertyMapEntryIndices):
2366 (KJS::PropertyMap::containsGettersOrSetters):
2367 (KJS::PropertyMap::getEnumerablePropertyNames):
2368 (KJS::PropertyMap::save):
2369 (KJS::PropertyMap::restore):
2370 * kjs/property_map.h:
2372 2007-11-02 Darin Adler <darin@apple.com>
2376 - http://bugs.webkit.org/show_bug.cgi?id=15807
2377 HashMap needs a take() function that combines get and remove
2379 * wtf/HashMap.h: Added take function. Simplistic implementation for now,
2380 but still does only one hash table lookup.
2382 * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
2383 a find followed by a remove.
2385 2007-11-02 David Carson <dacarson@gmail.com>
2389 Fix compiler warning "warning: suggest parentheses around && within ||"
2390 http://bugs.webkit.org/show_bug.cgi?id=15764
2392 * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
2394 2007-11-01 Geoffrey Garen <ggaren@apple.com>
2396 Reviewed by Maciej Stachowiak.
2398 In preparation for making List a simple stack-allocated Vector:
2400 Removed all instances of List copying and/or assignment, and made List
2401 inherit from Noncopyable.
2403 Functions that used to return a List by copy now take List& out
2406 Layout tests and JS tests pass.
2409 (KJS::List::slice): Replaced copyTail with a more generic slice
2410 alternative. (JavaScriptCore only calls slice(1), but WebCore calls
2413 2007-11-01 Geoffrey Garen <ggaren@apple.com>
2415 Reviewed by Maciej Stachowiak.
2417 Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
2418 REGRESSION(r27344): Crash on load at finance.yahoo.com
2420 Reverted a small portion of my last check-in. (The speedup and the List
2421 removal are still there, though.)
2423 ActivationImp needs to hold a pointer to its function, and mark that
2424 pointer (rather than accessing its function through its ExecState, and
2425 counting on the active scope to mark its function) because a closure
2426 can cause an ActivationImp to outlive its ExecState along with any
2429 * kjs/ExecState.cpp:
2430 (KJS::ExecState::ExecState):
2432 (KJS::FunctionImp::~FunctionImp):
2433 (KJS::ActivationImp::ActivationImp):
2435 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
2437 Also made HashTable a little more crash-happy in debug builds, so
2438 problems like this will show up earlier:
2441 (WTF::HashTable::~HashTable):
2443 2007-11-01 Geoffrey Garen <ggaren@apple.com>
2445 Reviewed by Adam Roben.
2447 Addressed some of Darin's review comments.
2449 Used perl -p, which is the shorthand while(<>) {}.
2451 Made sure not to suppress bison's output.
2453 Added line to removed bison_out.txt, since this script removes other
2454 intermediate files, too.
2456 * DerivedSources.make:
2458 2007-11-01 Geoffrey Garen <ggaren@apple.com>
2460 Reviewed by Oliver Hunt.
2462 Removed List from ActivationImp, in preparation for making all lists
2467 1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
2469 * kjs/ExecState.cpp:
2470 (KJS::ExecState::ExecState):
2471 (KJS::ExecState::~ExecState):
2473 (KJS::ActivationImp::ActivationImp):
2474 (KJS::ActivationImp::createArgumentsObject):
2476 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
2478 2007-11-01 Adam Roben <aroben@apple.com>
2480 Use jsNumberCell instead of jsNumber when converting double constants to JSValues
2482 This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
2483 ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
2485 It also gets rid of an MSVC warning that we previously had to silence.
2489 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
2490 back on the "overflow in constant arithmetic" warning.
2491 * kjs/number_object.cpp:
2492 (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
2495 2007-10-31 Adam Roben <aroben@apple.com>
2501 2007-10-31 Maciej Stachowiak <mjs@apple.com>
2505 - shave some cycles off of local storage access for a 1% SunSpider speedup
2507 Keep the LocalStorage pointer in the ExecState, instead of getting
2508 it from the ActivationImp all the time.
2510 * kjs/ExecState.cpp:
2511 (KJS::ExecState::updateLocalStorage):
2513 (KJS::ExecState::localStorage):
2515 (KJS::LocalVarAccessNode::evaluate):
2516 (KJS::LocalVarFunctionCallNode::evaluate):
2517 (KJS::PostIncLocalVarNode::evaluate):
2518 (KJS::PostDecLocalVarNode::evaluate):
2519 (KJS::LocalVarTypeOfNode::evaluate):
2520 (KJS::PreIncLocalVarNode::evaluate):
2521 (KJS::PreDecLocalVarNode::evaluate):
2522 (KJS::ReadModifyLocalVarNode::evaluate):
2523 (KJS::AssignLocalVarNode::evaluate):
2524 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2526 2007-10-31 Adam Roben <aroben@apple.com>
2528 Fix a crash on launch due to a static initializer race
2530 We now use fast inline assembler spinlocks which can be statically
2531 initialized at compile time.
2533 As a side benefit, this speeds up SunSpider by 0.4%.
2537 * wtf/FastMalloc.cpp:
2539 (TCMalloc_SpinLock::Lock):
2540 (TCMalloc_SpinLock::Unlock):
2541 (TCMalloc_SlowLock):
2542 * wtf/TCSystemAlloc.cpp:
2544 2007-10-31 Kevin McCullough <kmccullough@apple.com>
2548 - Corrected spelling.
2552 2007-10-31 Mark Rowe <mrowe@apple.com>
2554 Further Gtk build fixage.
2556 * kjs/regexp_object.cpp:
2558 2007-10-31 Mark Rowe <mrowe@apple.com>
2564 2007-10-31 Darin Adler <darin@apple.com>
2568 - fix http://bugs.webkit.org/show_bug.cgi?id=15749
2569 RegExp/RegExpObjectImp cause needless UString creation
2571 Speeds things up 0.4% according to SunSpider.
2573 * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
2574 because this library doesn't use the real PCRE -- it uses its
2575 own PCRE that works on UTF-16.
2577 * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
2578 Use Noncopyable. Change the return value of match.
2580 (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
2581 (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
2582 (KJS::RegExp::match): Change to return the position as an int and the
2583 ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
2585 * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
2586 require a result string.
2587 * kjs/regexp_object.cpp:
2588 (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
2589 (RegExpObjectImp::performMatch): Change so it doesn't return a string.
2590 (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
2591 the main result with the backreferences; now it doesn't need to take
2593 (RegExpObjectImp::getBackref): Minor tweaks.
2594 (RegExpObjectImp::getLastParen): Ditto.
2595 (RegExpObjectImp::getLeftContext): Ditto.
2596 (RegExpObjectImp::getRightContext): Ditto.
2597 (RegExpObjectImp::getValueProperty): Change LastMatch case to call
2598 getBackref(0) so we don't need a separate getLastMatch function.
2600 * kjs/string_object.cpp:
2601 (KJS::replace): Update to use new performMatch, including merging the
2602 matched string section with the other substrings.
2603 (KJS::StringProtoFunc::callAsFunction): Update functions to use the
2604 new performMatch and match. Also change to use OwnArrayPtr.
2606 2007-10-31 Oliver Hunt <oliver@apple.com>
2608 * kjs/nodes.h: include OwnPtr.h
2610 2007-10-31 Oliver Hunt <oliver@apple.com>
2614 Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
2618 (KJS::statementListPushFIFO):
2619 (KJS::statementListGetDeclarations):
2620 (KJS::statementListInitializeDeclarationStacks):
2621 (KJS::statementListInitializeVariableAccessStack):
2622 (KJS::statementListExecute):
2623 (KJS::BlockNode::optimizeVariableAccess):
2624 (KJS::BlockNode::BlockNode):
2625 (KJS::BlockNode::getDeclarations):
2626 (KJS::BlockNode::execute):
2627 (KJS::CaseClauseNode::optimizeVariableAccess):
2628 (KJS::CaseClauseNode::getDeclarations):
2629 (KJS::CaseClauseNode::evalStatements):
2630 (KJS::FunctionBodyNode::initializeDeclarationStacks):
2631 (KJS::FunctionBodyNode::optimizeVariableAccess):
2633 * kjs/nodes2string.cpp:
2634 (KJS::statementListStreamTo):
2635 (KJS::BlockNode::streamTo):
2636 (KJS::CaseClauseNode::streamTo):
2638 2007-10-30 Mark Rowe <mrowe@apple.com>
2640 * kjs/property_map.cpp: Added a missing using directive to fix the build
2641 for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
2643 2007-10-31 Maciej Stachowiak <mjs@apple.com>
2645 * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
2648 2007-10-31 Alexey Proskuryakov <ap@webkit.org>
2652 http://bugs.webkit.org/show_bug.cgi?id=11001
2653 WebKit doesn't support RegExp.compile method
2655 Test: fast/js/regexp-compile.html
2657 * kjs/regexp_object.cpp:
2658 (RegExpPrototype::RegExpPrototype):
2659 (RegExpProtoFunc::callAsFunction):
2660 * kjs/regexp_object.h:
2661 (KJS::RegExpProtoFunc::):
2662 Added RegExp.compile.
2664 * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
2666 2007-10-31 Maciej Stachowiak <mjs@apple.com>
2670 - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
2672 Integer divide sucks. Fortunately, a bunch of shifts and XORs
2673 biased towards the high bits is sufficient to provide a good
2674 double hash. Besides the SunSpider win, I used the dump statistics
2675 mode for both to verify that collisions did not increase and that
2676 the longest collision chain is not any longer.
2678 * kjs/property_map.cpp:
2680 (KJS::PropertyMap::get):
2681 (KJS::PropertyMap::getLocation):
2682 (KJS::PropertyMap::put):
2683 (KJS::PropertyMap::insert):
2684 (KJS::PropertyMap::remove):
2685 (KJS::PropertyMap::checkConsistency):
2689 (WTF::::lookupForWriting):
2690 (WTF::::fullLookupForWriting):
2693 2007-10-30 Adam Roben <aroben@apple.com>
2695 * kjs/collector.h: Make HeapType public so it can be used for non-member
2696 things like the HeapConstants struct template. Fixes the build on Windows.
2698 2007-10-30 Adam Roben <aroben@apple.com>
2700 Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
2702 Speeds up SunSpider by 0.4%.
2704 Reviewed by Steve and Maciej.
2706 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
2707 a warning during LTCG in release builds about double -> float
2709 * wtf/AlwaysInline.h:
2712 2007-10-30 Adam Roben <aroben@apple.com>
2714 Use GetCurrentThreadId instead of pthread_self in FastMalloc
2716 Speeds up SunSpider by 0.3%.
2720 * wtf/FastMalloc.cpp:
2721 (WTF::TCMalloc_ThreadCache::InitTSD):
2722 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
2724 2007-10-30 Adam Roben <aroben@apple.com>
2726 Switch to a Win32 critical section implementation of spinlocks
2728 Speeds up SunSpider by 0.4%.
2732 * wtf/FastMalloc.cpp:
2734 (TCMalloc_SpinLock::TCMalloc_SpinLock):
2735 (TCMalloc_SpinLock::Init):
2736 (TCMalloc_SpinLock::Finalize):
2737 (TCMalloc_SpinLock::Lock):
2738 (TCMalloc_SpinLock::Unlock):
2739 * wtf/TCSystemAlloc.cpp:
2741 2007-10-30 Adam Roben <aroben@apple.com>
2743 Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
2745 http://bugs.webkit.org/show_bug.cgi?id=15586
2747 Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
2749 Use Win32 TLS functions instead of __declspec(thread), which breaks
2754 * wtf/FastMalloc.cpp:
2755 (WTF::getThreadHeap):
2756 (WTF::TCMalloc_ThreadCache::InitModule):
2758 2007-10-30 Maciej Stachowiak <mjs@apple.com>
2762 - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
2763 http://bugs.webkit.org/show_bug.cgi?id=15772
2765 We do this by using a single mark bit per two number cells, and
2768 Besides being an 0.5% win overall, this is a 7.1% win on morph.
2770 * kjs/collector.cpp:
2772 (KJS::Collector::heapAllocate):
2773 (KJS::Collector::markStackObjectsConservatively):
2774 (KJS::Collector::sweep):
2776 (KJS::SmallCollectorCell::):
2778 2007-10-30 Geoffrey Garen <ggaren@apple.com>
2780 Reviewed by Adam Roben, Sam Weinig.
2782 Made conflicts in grammar.y a persistent build failure.
2784 * DerivedSources.make:
2786 2007-10-30 Kevin McCullough <kmccullough@apple.com>
2788 Reviewed by Adam and Geoff.
2790 - Added a new cast so all the casts are in the same place.
2795 2007-10-30 Geoffrey Garen <ggaren@apple.com>
2797 Reviewed by Darin Adler.
2799 Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
2803 ecma_2/Statements/dowhile-001.js
2804 ecma_2/Statements/dowhile-002.js
2805 ecma_2/Statements/dowhile-003.js
2806 ecma_2/Statements/dowhile-004.js
2807 ecma_2/Statements/dowhile-005.js
2808 ecma_2/Statements/dowhile-006.js
2809 ecma_2/Statements/dowhile-007.js
2810 js1_2/statements/do_while.js
2812 and layout tests, including
2814 do-while-expression-value.html
2815 do-while-semicolon.html
2816 do-while-without-semicolon.html
2820 * kjs/grammar.y: Use the explicit "error" production, as we do with other
2821 automatic semicolon insertions, to disambiguate "do { } while();" from
2822 "do { } while()" followed by ";" (the empty statement).
2824 2007-10-29 Oliver Hunt <oliver@apple.com>
2828 Debranching remaining assignment nodes, and miscellaneous cleanup
2830 Split read-modify code paths out of AssignBracketNode and AssignDotNode
2831 Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
2832 and ReadModifyResolveNode evaluate methods
2834 Leads to a 1% gain in SunSpider.
2838 (KJS::ReadModifyLocalVarNode::evaluate):
2839 (KJS::ReadModifyResolveNode::evaluate):
2840 (KJS::AssignDotNode::evaluate):
2841 (KJS::ReadModifyDotNode::optimizeVariableAccess):
2842 (KJS::ReadModifyDotNode::evaluate):
2843 (KJS::AssignBracketNode::evaluate):
2844 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
2845 (KJS::ReadModifyBracketNode::evaluate):
2847 (KJS::AssignBracketNode::):
2848 (KJS::AssignBracketNode::precedence):
2849 (KJS::AssignDotNode::):
2850 (KJS::AssignDotNode::precedence):
2851 * kjs/nodes2string.cpp:
2852 (KJS::ReadModifyBracketNode::streamTo):
2853 (KJS::AssignBracketNode::streamTo):
2854 (KJS::ReadModifyDotNode::streamTo):
2855 (KJS::AssignDotNode::streamTo):
2857 2007-10-29 Oliver Hunt <oliver@apple.com>
2859 Debranching various Node::evaluate implementations
2863 Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
2864 Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
2866 Gains 1.6% on SunSpider
2868 * JavaScriptCore.xcodeproj/project.pbxproj:
2871 (KJS::PostIncResolveNode::optimizeVariableAccess):
2872 (KJS::PostIncResolveNode::evaluate):
2873 (KJS::PostIncLocalVarNode::evaluate):
2874 (KJS::PostDecResolveNode::optimizeVariableAccess):
2875 (KJS::PostDecResolveNode::evaluate):
2876 (KJS::PostDecLocalVarNode::evaluate):
2877 (KJS::PostIncBracketNode::evaluate):
2878 (KJS::PostDecBracketNode::evaluate):
2879 (KJS::PostIncDotNode::evaluate):
2880 (KJS::PostDecDotNode::evaluate):
2881 (KJS::PreIncResolveNode::optimizeVariableAccess):
2882 (KJS::PreIncLocalVarNode::evaluate):
2883 (KJS::PreIncResolveNode::evaluate):
2884 (KJS::PreDecResolveNode::optimizeVariableAccess):
2885 (KJS::PreDecLocalVarNode::evaluate):
2886 (KJS::PreDecResolveNode::evaluate):
2887 (KJS::PreIncBracketNode::evaluate):
2888 (KJS::PreDecBracketNode::evaluate):
2889 (KJS::PreIncDotNode::evaluate):
2890 (KJS::PreDecDotNode::evaluate):
2891 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
2892 (KJS::AssignResolveNode::optimizeVariableAccess):
2893 (KJS::AssignLocalVarNode::evaluate):
2894 (KJS::AssignResolveNode::evaluate):
2896 (KJS::PostDecResolveNode::):
2897 (KJS::PostDecResolveNode::precedence):
2898 (KJS::PostDecLocalVarNode::):
2899 (KJS::PostfixBracketNode::):
2900 (KJS::PostfixBracketNode::precedence):
2901 (KJS::PostIncBracketNode::):
2902 (KJS::PostIncBracketNode::isIncrement):
2903 (KJS::PostDecBracketNode::):
2904 (KJS::PostDecBracketNode::isIncrement):
2905 (KJS::PostfixDotNode::):
2906 (KJS::PostfixDotNode::precedence):
2907 (KJS::PostIncDotNode::):
2908 (KJS::PostIncDotNode::isIncrement):
2909 (KJS::PostDecDotNode::):
2910 (KJS::PreIncResolveNode::):
2911 (KJS::PreDecResolveNode::):
2912 (KJS::PreDecResolveNode::precedence):
2913 (KJS::PreDecLocalVarNode::):
2914 (KJS::PrefixBracketNode::):
2915 (KJS::PrefixBracketNode::precedence):
2916 (KJS::PreIncBracketNode::):
2917 (KJS::PreIncBracketNode::isIncrement):
2918 (KJS::PreDecBracketNode::):
2919 (KJS::PreDecBracketNode::isIncrement):
2920 (KJS::PrefixDotNode::):
2921 (KJS::PrefixDotNode::precedence):
2922 (KJS::PreIncDotNode::):
2923 (KJS::PreIncDotNode::isIncrement):
2924 (KJS::PreDecDotNode::):
2925 (KJS::ReadModifyResolveNode::):
2926 (KJS::ReadModifyLocalVarNode::):
2927 (KJS::AssignResolveNode::):
2928 (KJS::AssignResolveNode::precedence):
2929 * kjs/nodes2string.cpp:
2930 (KJS::PostIncResolveNode::streamTo):
2931 (KJS::PostDecResolveNode::streamTo):
2932 (KJS::PostfixBracketNode::streamTo):
2933 (KJS::PostfixDotNode::streamTo):
2934 (KJS::PreIncResolveNode::streamTo):
2935 (KJS::PreDecResolveNode::streamTo):
2936 (KJS::ReadModifyResolveNode::streamTo):
2937 (KJS::AssignResolveNode::streamTo):
2939 2007-10-29 Maciej Stachowiak <mjs@apple.com>
2941 Not reviewed, build fix.
2943 - Include Vector.h in a way that actually works.
2945 * kjs/LocalStorage.h:
2947 2007-10-29 Maciej Stachowiak <mjs@apple.com>
2949 Not reviewed, build fix.
2951 - Install LocalStorage.h as a private header.
2953 * JavaScriptCore.xcodeproj/project.pbxproj:
2955 2007-10-29 Maciej Stachowiak <mjs@apple.com>
2959 - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
2961 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2962 * JavaScriptCore.xcodeproj/project.pbxproj:
2963 * kjs/LocalStorage.h: Added.
2964 (KJS::LocalStorageEntry::LocalStorageEntry):
2968 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2970 2007-10-29 Geoffrey Garen <ggaren@apple.com>
2972 Reviewed by Oliver Hunt.
2974 Some small tweaks that I notice while reviewing Oliver's last patch.
2976 Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
2978 No change in SunSpider because SunSpider doesn't take the code path that
2979 would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
2982 (KJS::LocalVarPostfixNode::evaluate):
2983 (KJS::TypeOfResolveNode::optimizeVariableAccess):
2984 (KJS::LocalVarTypeOfNode::evaluate):
2985 (KJS::PrefixResolveNode::optimizeVariableAccess):
2986 (KJS::LocalVarPrefixNode::evaluate):
2987 (KJS::AssignResolveNode::optimizeVariableAccess):
2988 (KJS::LocalVarAssignNode::evaluate):
2990 (KJS::LocalVarTypeOfNode::):
2991 (KJS::PrefixResolveNode::):
2992 (KJS::LocalVarPrefixNode::):
2993 (KJS::AssignResolveNode::):
2994 (KJS::LocalVarAssignNode::):
2996 2007-10-29 Eric Seidel <eric@webkit.org>
3000 SunSpider claims this was a 0.7% speedup.
3002 * kjs/string_object.cpp:
3003 (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
3005 2007-10-29 Maciej Stachowiak <mjs@apple.com>
3009 - re-enable asserts for access to empty or deleted keys
3013 (WTF::::lookupForWriting):
3014 (WTF::::fullLookupForWriting):
3017 2007-10-29 Eric Seidel <eric@webkit.org>
3019 Build fix only, no review.
3021 * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
3023 2007-10-29 Mark Rowe <mrowe@apple.com>
3025 Gtk build fix. Move struct declarations into nodes.h.
3030 2007-10-29 Eric Seidel <eric@webkit.org>
3034 Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
3035 Make it a compile time error to use toString(ExecState) on a StringInstance
3037 SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
3040 (KJS::StringImp::getLength):
3041 * kjs/string_object.cpp:
3042 (KJS::StringInstance::lengthGetter):
3043 (KJS::StringInstance::inlineGetOwnPropertySlot):
3044 (KJS::StringInstance::getOwnPropertySlot):
3045 * kjs/string_object.h:
3047 2007-10-28 Oliver Hunt <oliver@apple.com>
3051 Add nodes to allow Assignment, TypeOf, and prefix operators to
3052 make use of the new optimised local variable look up.
3054 5% gain on sunspider
3057 (KJS::TypeOfResolveNode::optimizeVariableAccess):
3058 (KJS::LocalTypeOfAccessNode::evaluate):
3059 (KJS::PrefixResolveNode::optimizeVariableAccess):
3060 (KJS::PrefixLocalAccessNode::evaluate):
3061 (KJS::AssignResolveNode::optimizeVariableAccess):
3062 (KJS::AssignLocalAccessNode::evaluate):
3064 (KJS::TypeOfResolveNode::):
3065 (KJS::TypeOfResolveNode::precedence):
3066 (KJS::LocalTypeOfAccessNode::):
3067 (KJS::PrefixResolveNode::):
3068 (KJS::PrefixResolveNode::precedence):
3069 (KJS::PrefixLocalAccessNode::):
3070 (KJS::AssignResolveNode::):
3071 (KJS::AssignLocalAccessNode::):
3073 2007-10-28 Maciej Stachowiak <mjs@apple.com>
3077 - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
3078 http://bugs.webkit.org/show_bug.cgi?id=15748
3080 Not a significant speedup or slowdown on SunSpider.
3083 (KJS::clearNewNodes):
3087 (KJS::BlockNode::BlockNode):
3088 (KJS::CaseBlockNode::CaseBlockNode):
3089 (KJS::FunctionBodyNode::FunctionBodyNode):
3090 (KJS::SourceElementsNode::SourceElementsNode):
3091 (KJS::ProgramNode::ProgramNode):
3093 (KJS::ElementNode::):
3095 (KJS::PropertyListNode::):
3096 (KJS::ObjectLiteralNode::):
3097 (KJS::ArgumentListNode::):
3098 (KJS::ArgumentsNode::):
3099 (KJS::VarDeclListNode::):
3100 (KJS::VarStatementNode::):
3102 (KJS::ParameterNode::):
3103 (KJS::FuncExprNode::):
3104 (KJS::FuncDeclNode::):
3105 (KJS::SourceElementsNode::):
3106 (KJS::CaseClauseNode::):
3107 (KJS::ClauseListNode::):
3109 2007-10-28 Mark Rowe <mrowe@apple.com>
3111 Disable assertions in a manner that doesn't break the Qt Windows build.
3115 (WTF::::lookupForWriting):
3116 (WTF::::fullLookupForWriting):
3118 2007-10-28 Geoffrey Garen <ggaren@apple.com>
3120 Temporarily disabling some ASSERTs I introduced in my last check-in
3121 because of http://bugs.webkit.org/show_bug.cgi?id=15747
3122 Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
3126 (WTF::::lookupForWriting):
3127 (WTF::::fullLookupForWriting):
3130 2007-10-28 Geoffrey Garen <ggaren@apple.com>
3132 Reviewed by Darin Adler.
3134 Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
3135 #ifndef ASSERT_DISABLED is no good!
3137 Replaced with #if !ASSERT_DISABLED.
3141 (WTF::::lookupForWriting):
3142 (WTF::::fullLookupForWriting):
3145 2007-10-28 Geoffrey Garen <ggaren@apple.com>
3147 Reviewed by Darin Adler.
3149 Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
3150 to the AST transfom that replaces slow resolve nodes with fast local
3151 variable alternatives.
3153 2.5% speedup on SunSpider.
3155 Also added some missing copyright notices.
3158 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
3159 (KJS::FunctionCallResolveNode::evaluate):
3160 (KJS::LocalVarFunctionCallNode::evaluate):
3161 (KJS::PostfixResolveNode::optimizeVariableAccess):
3162 (KJS::PostfixResolveNode::evaluate):
3163 (KJS::LocalVarPostfixNode::evaluate):
3164 (KJS::DeleteResolveNode::optimizeVariableAccess):
3165 (KJS::DeleteResolveNode::evaluate):
3166 (KJS::LocalVarDeleteNode::evaluate):
3168 (KJS::FunctionCallResolveNode::):
3169 (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
3170 (KJS::PostfixResolveNode::):
3171 (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
3172 (KJS::DeleteResolveNode::):
3173 (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
3175 2007-10-28 Eric Seidel <eric@webkit.org>
3179 Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
3180 Add virtual keyword to a few virtual functions previously unmarked.
3183 (KJS::StringImp::type):
3184 (KJS::NumberImp::type):
3186 (KJS::UString::Rep::deref):
3188 2007-10-28 Darin Adler <darin@apple.com>
3190 - fix "broken everything" from the storage leak fix
3192 * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
3193 * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
3195 2007-10-28 Darin Adler <darin@apple.com>
3199 - turn on unused parameter waring on Mac OS X because it's already on elsewhere
3201 * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
3207 Fixed unused variables by using them or marked them with UNUSED_PARAM.
3209 * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
3210 Removed parameter names to indicate they are unused.
3212 2007-10-28 Darin Adler <darin@apple.com>
3216 - fix a storage leak where we ref the UString every time we replace
3217 a ResolveNode with a LocalVarAccessNode
3219 * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
3220 that takes PlacementNewAdopt.
3222 * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
3223 with PlacementNewAdopt instead of the old value of ident.
3225 * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
3226 takes PlacementNewAdopt.
3228 2007-10-28 Darin Adler <darin@apple.com>
3230 - Windows build fix; get rid of unused parameter
3232 * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
3233 * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
3234 The assertions weren't all that helpful.
3236 2007-10-28 Mark Rowe <mrowe@apple.com>
3238 Gtk build fix. Add include of MathExtras.h.
3240 * kjs/string_object.cpp:
3242 2007-10-28 Mark Rowe <mrowe@apple.com>
3244 Reviewed by Maciej and Tim.
3246 Replace uses of isNaN and isInf with isnan and isinf, and
3247 remove isNaN and isInf.
3249 * kjs/config.h: Remove unused HAVE_'s.
3250 * kjs/date_object.cpp:
3251 (KJS::DateInstance::getTime):
3252 (KJS::DateInstance::getUTCTime):
3253 (KJS::DateProtoFunc::callAsFunction):
3254 (KJS::DateObjectImp::construct):
3255 (KJS::DateObjectFuncImp::callAsFunction):
3257 (KJS::GlobalFuncImp::callAsFunction):
3258 * kjs/math_object.cpp:
3259 (MathFuncImp::callAsFunction):
3260 * kjs/nodes2string.cpp:
3261 (KJS::isParserRoundTripNumber):
3262 * kjs/number_object.cpp:
3263 (NumberProtoFunc::callAsFunction):
3264 * kjs/operations.cpp:
3266 * kjs/string_object.cpp:
3267 (KJS::StringProtoFunc::callAsFunction):
3269 (KJS::UString::from):
3271 (KJS::JSValue::toInteger):
3272 (KJS::JSValue::toInt32SlowCase):
3273 (KJS::JSValue::toUInt32SlowCase):
3275 2007-10-28 Geoffrey Garen <ggaren@apple.com>
3277 Build fix: use the new-fangled missingSymbolMarker().
3280 (KJS::ResolveNode::optimizeVariableAccess):
3282 (KJS::LocalVarAccessNode::LocalVarAccessNode):
3284 2007-10-28 Geoffrey Garen <ggaren@apple.com>
3286 Reviewed by Maciej Stachowiak, Darin Adler.
3288 Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
3291 AST transfom to replace slow resolve nodes with fast local variable
3292 alternatives that do direct memory access. Currently, only ResolveNode
3293 provides a fast local variable alternative. 6 others are soon to come.
3295 16.7% speedup on SunSpider.
3297 Most of this patch is just scaffolding to support iterating all the
3298 resolve nodes in the AST through optimizeResolveNodes(). In
3299 optimizeResolveNodes(), most classes just push their child nodes onto
3300 the processing stack, while ResolveNodes actually replace themselves in
3301 the tree with more optimized alternatives, if possible.
3303 Here are the interesting bits:
3305 * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
3306 in Node and ResolveNode. This tag allows you to use placement new to
3307 swap out a base class Node in favor of a subclass copy that holds the
3308 same data. (Without this tag, default initialization would NULL out
3309 RefPtrs, change line numbers, etc.)
3312 (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
3313 that the fast path is impossible, to make sure we didn't leave anything
3316 (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
3317 transformation happens.
3319 (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
3320 optimization happens.
3322 * kjs/function.h: Added symbolTable() accessor for, for the sake of
3325 2007-10-28 Mark Rowe <mrowe@apple.com>
3329 Fix "AllInOneFile.o has a global initializer in it".
3331 Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
3332 We can avoid this by moving it inside an inline function.
3334 * kjs/SymbolTable.h:
3335 (KJS::missingSymbolMarker):
3337 (KJS::ActivationImp::getOwnPropertySlot):
3338 (KJS::ActivationImp::put):
3340 2007-10-28 Maciej Stachowiak <mjs@apple.com>
3344 - Added assertions to protect against adding empty or deleted keys to a HashTable
3347 (WTF::HashTable::lookup):
3348 (WTF::HashTable::lookupForWriting):
3349 (WTF::HashTable::fullLookupForWriting):
3350 (WTF::HashTable::add):
3352 2007-10-28 Darin Adler <darin@apple.com>
3356 * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
3357 Use isNaN and isInf instead of isnan and isinf.
3359 2007-10-28 Darin Adler <darin@apple.com>
3363 - http://bugs.webkit.org/show_bug.cgi?id=15735
3364 remove GroupNode to simplify AST and possibly get a modest speedup
3366 This patch removes 4 node types: GroupNode, PropertyNameNode,
3367 FunctionCallParenBracketNode, and FunctionCallParenDotNode.
3369 To remove GroupNode, we add knowledge of precedence to the tree nodes,
3370 and use that when serializing to determine where parentheses are needed.
3371 This means we no longer have to represent parentheses in the tree.
3373 The precedence values are named after productions in the grammar from the
3374 JavaScript standard.
3376 SunSpider says this is an 0.4% speedup.
3379 * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
3380 serialization, so I moved it to the file that takes care of that.
3382 * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
3383 indicate failure instead of a separate boolean. Got rid of PropertyNameNode
3384 by merging the PropertyName rule into the Property rule (which was easier
3385 than figuring out how to pass the Identifier from one node to another).
3386 Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
3387 and FunctionCallParenDotNode.
3389 * kjs/nodes.h: Removed unused forward declarations and Operator values.
3390 Added Precedence enum, and precedence function to all nodes. Removed
3391 nodeInsideAllParens. Added streamBinaryOperator function for serialization.
3392 Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
3393 Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
3395 * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
3396 (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
3397 of converting it from an Identifier to a jsString then back to a UString
3398 then into an Identifier again!
3400 * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
3401 function for each of Endl, Indent, Unindent, and DotExpr instead of using a
3402 single function with a switch. Added a precedence that you can stream in, to
3403 cause the next node serialized to add parentheses based on that precedence value.
3404 (KJS::operatorString): Moved to the top of the file.
3405 (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
3406 workaround for snprintf, since StringExtras.h takes care of that.
3407 (KJS::operator<<): Made the char and char* versions faster by using UString's
3408 character append functions instead of constructing a UString. Added the logic
3409 to the Node* version to add parentheses if needed.
3410 (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
3411 (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
3412 (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
3414 (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
3415 (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
3416 (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
3417 (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
3418 (KJS::FunctionCallBracketNode::streamTo): Ditto.
3419 (KJS::FunctionCallDotNode::streamTo): Ditto.
3420 (KJS::PostfixBracketNode::streamTo): Ditto.
3421 (KJS::PostfixDotNode::streamTo): Ditto.
3422 (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
3423 (KJS::DeleteBracketNode::streamTo): Use PrecCall.
3424 (KJS::DeleteDotNode::streamTo): Ditto.
3425 (KJS::DeleteValueNode::streamTo): Use PrecUnary.
3426 (KJS::VoidNode::streamTo): Ditto.
3427 (KJS::TypeOfValueNode::streamTo): Ditto.
3428 (KJS::PrefixBracketNode::streamTo): Use PrecCall.
3429 (KJS::PrefixDotNode::streamTo): Ditto.
3430 (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
3431 (KJS::UnaryPlusNode::streamTo): Ditto.
3432 (KJS::NegateNode::streamTo): Ditto.
3433 (KJS::BitwiseNotNode::streamTo): Ditto.
3434 (KJS::LogicalNotNode::streamTo): Ditto.
3435 (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
3436 (KJS::DivNode::streamTo): Ditto.
3437 (KJS::ModNode::streamTo): Ditto.
3438 (KJS::AddNode::streamTo): Ditto.
3439 (KJS::SubNode::streamTo): Ditto.
3440 (KJS::LeftShiftNode::streamTo): Ditto.
3441 (KJS::RightShiftNode::streamTo): Ditto.
3442 (KJS::UnsignedRightShiftNode::streamTo): Ditto.
3443 (KJS::LessNode::streamTo): Ditto.
3444 (KJS::GreaterNode::streamTo): Ditto.
3445 (KJS::LessEqNode::streamTo): Ditto.
3446 (KJS::GreaterEqNode::streamTo): Ditto.
3447 (KJS::InstanceOfNode::streamTo): Ditto.
3448 (KJS::InNode::streamTo): Ditto.
3449 (KJS::EqualNode::streamTo): Ditto.
3450 (KJS::NotEqualNode::streamTo): Ditto.
3451 (KJS::StrictEqualNode::streamTo): Ditto.
3452 (KJS::NotStrictEqualNode::streamTo): Ditto.
3453 (KJS::BitAndNode::streamTo): Ditto.
3454 (KJS::BitXOrNode::streamTo): Ditto.
3455 (KJS::BitOrNode::streamTo): Ditto.
3456 (KJS::LogicalAndNode::streamTo): Ditto.
3457 (KJS::LogicalOrNode::streamTo): Ditto.
3458 (KJS::ConditionalNode::streamTo): Ditto.
3459 (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
3460 (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
3461 the bracket and PrecAssignment for the right side.
3462 (KJS::AssignDotNode::streamTo): Ditto.
3463 (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
3464 and PrecAssignment for the right side.
3465 (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
3466 (KJS::AssignExprNode::streamTo): Use PrecAssignment.
3468 2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
3470 Define wx port and set wx port USE options.
3472 Reviewed by Adam Roben.
3476 2007-10-28 Mark Rowe <mrowe@apple.com>
3478 We don't include "config.h" in headers.
3480 * bindings/jni/jni_instance.h:
3485 2007-10-28 Maciej Stachowiak <mjs@apple.com>
3487 Rubber stamped by Mark.
3489 - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
3491 * kjs/SymbolTable.h:
3492 (KJS::SymbolTableIndexHashTraits::emptyValue):
3494 (KJS::ActivationImp::getOwnPropertySlot):
3495 (KJS::ActivationImp::put):
3497 2007-10-28 Maciej Stachowiak <mjs@apple.com>
3501 - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
3503 * kjs/SymbolTable.h:
3504 (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
3505 (KJS::IdentifierRepHash::equal): ditto
3506 (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
3507 (KJS::SymbolTable): change to a typedef for a HashMap.
3509 (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
3510 (KJS::ActivationImp::deleteProperty): ditto
3511 (KJS::ActivationImp::put): ditto
3514 (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
3515 you now have to store a UString::rep, not an identifier.
3517 2007-10-27 Maciej Stachowiak <mjs@apple.com>
3521 - numerous HashTable performance improvements
3523 This does not quite add up to a measurable win on SunSpider, but it allows a
3524 follow-on > 3% improvement and probably helps WebCore too.
3526 I made the following improvements, among others:
3528 - Made HashFunctions note whether it is ok to compare a real value with the equal() function
3529 to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
3531 - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
3532 std::pairs for cases that don't need them. There are now four versions, one for read-only access,