1 2007-11-22 Simon Hausmann <hausmann@kde.org>
5 Centralize the setup for all the extra compilers in a addExtraCompiler function.
7 This allows adding a "generated_files" target that builds all generated files using "make generated_files".
8 For the build inside Qt we do not generate actual rules for the extra compilers but instead
9 do the variable substitution of compiler.output manually and add the generated sources to SOURCES.
14 2007-11-20 Mark Rowe <mrowe@apple.com>
16 Reviewed by Tim Hatcher.
18 <rdar://problem/5602936> Need to resolve new GCC 4.2 warnings
20 Fix all warnings emitted by GCC 4.2 when building JavaScriptCore. This allows builds with
21 -Werror to succeed. At present they will crash when executed due to code that is not safe
22 under strict aliasing (<rdar://problem/5536806>).
24 * Configurations/Base.xcconfig: Remove the -Wno-long-double flag.
25 * kjs/date_object.cpp:
26 (KJS::formatTime): Test whether the stack-allocated string is empty rather than at a non-null address.
28 (Bigint::): Tweak formatting to silence warnings.
30 (match): Tweak formatting to silence warnings
31 * wtf/Assertions.cpp: Add printf format attribute to functions that warrant it.
32 * wtf/Assertions.h: Ditto.
34 2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
36 wx port build fix (wx headers include ctype functions).
40 2007-11-19 Kevin Ollivier <kevino@theolliviers.com>
42 Remove outdated and unused Windows port files.
44 Reviewed by Adam Roben.
46 * Makefile.vc: Removed.
47 * README-Win32.txt: Removed.
49 2007-11-18 Eric Seidel <eric@webkit.org>
53 * tests/mozilla/jsDriver.pl: exit non-0 when user aborts test run
55 2007-11-17 Mark Rowe <mrowe@apple.com>
57 Reviewed by Darin Adler.
59 Fix: <rdar://problem/5607032> REGRESSION: testapi exits with assertion failure in debug build
60 <rdar://problem/5440659> JSGlobalContextCreate throws away globalObjectClass's prototype
61 http://bugs.webkit.org/show_bug.cgi?id=16033
63 Split Interpreter's initialization into two distinct steps: the creation of the global prototypes
64 and constructors, and storing them on the global object. This allows JSClassRef's passed to
65 JSGlobalContextCreate to be instantiated with the correct prototype.
67 * API/JSCallbackObject.cpp: Assert at compile-time that the custom global object will fit in a collector cell.
68 * API/JSCallbackObject.h:
69 * API/JSCallbackObjectFunctions.h:
70 (KJS::::JSCallbackObject):
72 * API/JSContextRef.cpp:
73 (JSGlobalContextCreate): Construct and set the interpreter's global object separately. When globalObjectClass
74 is passed we need to set the interpreter's global object before doing the JSCallbackObject's initialization to
75 prevent any JSObjectInitializeCallback's being invoked before a global object is set.
77 (globalObject_initialize): Test the object passed in is correct and that it has the expected global properties.
81 * API/testapi.js: Test that any static properties exposed by the global object's custom class are found.
83 * bindings/testbindings.cpp:
84 (main): Update for changes in Interpreter method signatures.
85 * bindings/testbindings.mm:
88 (KJS::ExecState::ExecState):
89 (KJS::ExecState::mark):
90 (KJS::ExecState::setGlobalObject):
91 * kjs/ExecState.h: Rename scope to m_scopeChain.
92 * kjs/interpreter.cpp:
93 (KJS::Interpreter::Interpreter):
94 (KJS::Interpreter::init):
95 (KJS::Interpreter::globalObject):
96 (KJS::Interpreter::setGlobalObject):
97 (KJS::Interpreter::resetGlobalObjectProperties):
98 (KJS::Interpreter::createObjectsForGlobalObjectProperties):
99 (KJS::Interpreter::setGlobalObjectProperties): Switch to using putDirect to ensure that the global object's put method
100 cannot interfere with setting of the global properties. This prevents a user-written JSClassRef from attempting to
101 call back into JavaScript from the initialization of the global object's members.
104 (setupInterpreter): Update for changes in Interpreter method signatures.
106 2007-11-17 Mark Rowe <mrowe@apple.com>
108 Reviewed by Sam Weinig.
110 Prevent testapi from reporting false leaks. Clear out local variables pointing at
111 JSObjectRefs to allow their values to be collected.
116 2007-11-17 Mark Rowe <mrowe@apple.com>
118 Reviewed by Sam Weinig.
120 Prevent testapi from crashing if testapi.js can not be found by nil-checking the result of createStringWithContentsOfFile.
125 2007-11-17 Alp Toker <alp@atoker.com>
129 http://bugs.webkit.org/show_bug.cgi?id=16032
130 JS minidom is not portable
132 Use a plain UTF-8 string instead of a CFString.
134 Print to stdout, not stderr like CFShow() would have done, since that
135 behaviour seems unintentional.
140 2007-11-17 Steve Falkenburg <sfalken@apple.com>
144 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
146 2007-11-16 Mark Rowe <mrowe@apple.com>
151 (KJS::Lexer::record8):
153 2007-11-16 Mark Rowe <mrowe@apple.com>
157 Replace strings, identifier, buffer8 and buffer16 members of Lexer with vectors.
158 SunSpider claims this is a 0.7% speedup.
163 (KJS::Lexer::record8):
164 (KJS::Lexer::record16):
165 (KJS::Lexer::scanRegExp):
167 (KJS::Lexer::makeIdentifier):
168 (KJS::Lexer::makeUString):
171 (KJS::UString::UString): Add a convenience constructor that takes a const Vector<UChar>&.
174 2007-11-16 Adam Roben <aroben@apple.com>
178 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj: Add a new include path
179 and ignore the int -> bool conversion warning.
181 2007-11-16 Alexey Proskuryakov <ap@webkit.org>
183 Fix Windows debug build.
184 Rubber-stamped by Eric
186 * pcre/pcre_exec.cpp: (match): Removed ASSERT_NOT_REACHED assertions that were making MSVC
187 complain about unreachable code.
189 2007-11-15 Mark Rowe <mrowe@apple.com>
195 2007-11-15 Mark Rowe <mrowe@apple.com>
197 Mac build and header search path sanity fix.
199 Reviewed by Sam Weinig and Tim Hatcher.
201 Move base setting for HEADER_SEARCH_PATHS into Base.xcconfig, and extend
202 it in JavaScriptCore.xcconfig. This removes the need to override it on a
203 per-target basis inside the .xcodeproj file.
205 * Configurations/Base.xcconfig:
206 * Configurations/JavaScriptCore.xcconfig:
207 * JavaScriptCore.xcodeproj/project.pbxproj:
209 2007-11-15 Mark Rowe <mrowe@apple.com>
215 2007-11-15 Geoffrey Garen <ggaren@apple.com>
217 Reviewed by Eric Seidel.
219 Another round of grammar / parsing cleanup.
221 1. Created distinct parser calls for parsing function bodies vs
222 programs. This will help later with optimizing global variable access.
224 2. Turned Parser into a singleton. Cleaned up Lexer's singleton
227 3. Modified Lexer to free a little more memory when done lexing. (Added
228 FIXMEs for similar issues that I didn't fix.)
230 4. Changed Lexer::makeIdentifier and Lexer::makeUString to start
231 respecting the arguments passed to them. (No behavior change, but this
232 problem could have caused serious problems for an unsuspecting user of
235 5. Removed KJS_DEBUG_MEM because it was bit-rotted.
237 6. Removed Parser::prettyPrint because the same work was simpler to do
242 "Parser::accept" => "Parser::didFinishParsing"
243 "Parser::sid" => "Parser::m_sourceID"
244 "Lexer::doneParsing" => "Lexer::clear"
248 * JavaScriptCore.exp:
250 (KJS::Parser::Parser):
251 (KJS::Parser::parseProgram):
252 (KJS::Parser::parseFunctionBody):
253 (KJS::Parser::parse):
254 (KJS::Parser::didFinishParsing):
257 (KJS::Parser::sourceId):
259 (KJS::GlobalFuncImp::callAsFunction):
260 * kjs/function_object.cpp:
261 (FunctionObjectImp::construct):
263 * kjs/interpreter.cpp:
264 (KJS::Interpreter::checkSyntax):
265 (KJS::Interpreter::evaluate):
271 (KJS::Lexer::~Lexer):
272 (KJS::Lexer::scanRegExp):
273 (KJS::Lexer::doneParsing):
274 (KJS::Lexer::makeIdentifier):
275 (KJS::Lexer::makeUString):
277 (KJS::Lexer::pattern):
279 (KJS::Lexer::sawError):
282 (KJS::FunctionBodyNode::FunctionBodyNode):
290 2007-11-15 Oliver Hunt <oliver@apple.com>
294 <rdar://problem/5601548> REGRESSION: All SourceElements and their children leak after a syntax error
296 Add a stub node to maintain the Vector of SourceElements until assignment.
300 (KJS::SourceElementsStub::SourceElementsStub):
301 (KJS::SourceElementsStub::append):
302 (KJS::SourceElementsStub::release):
303 (KJS::SourceElementsStub::):
304 (KJS::SourceElementsStub::precedence):
306 2007-11-15 Eric Seidel <eric@webkit.org>
310 Abstract most of RMATCH into MatchStack functions.
312 SunSpider claims this, combined with the last 2 patches was a 1% speedup, 10% for dna-regexp.
314 * pcre/pcre_exec.cpp:
315 (MatchStack::canUseStackBufferForNextFrame):
316 (MatchStack::allocateNextFrame):
317 (MatchStack::pushNewFrame):
318 (MatchStack::frameIsStackAllocated):
319 (MatchStack::popCurrentFrame):
320 (MatchStack::unrollAnyHeapAllocatedFrames):
323 2007-11-15 Eric Seidel <eric@webkit.org>
327 Remove RETURN_ERROR, add MatchStack
329 * pcre/pcre_exec.cpp:
330 (MatchStack::MatchStack):
331 (MatchStack::unrollAnyHeapAllocatedFrames):
335 2007-11-15 Eric Seidel <eric@webkit.org>
339 Clean up match function to match WebKit style
341 * JavaScriptCore.xcodeproj/project.pbxproj:
342 * pcre/pcre_exec.cpp:
345 2007-11-15 Steve Falkenburg <sfalken@apple.com>
349 * JavaScriptCore.vcproj/JavaScriptCore.make:
351 2007-11-14 Alexey Proskuryakov <ap@webkit.org>
355 http://bugs.webkit.org/show_bug.cgi?id=15982
356 Improve JSString UTF-8 decoding
358 * API/JSStringRef.cpp:
359 (JSStringCreateWithUTF8CString): Use strict decoding, return 0 on error.
361 * wtf/unicode/UTF8.cpp:
362 (WTF::Unicode::convertUTF16ToUTF8):
363 (WTF::Unicode::convertUTF8ToUTF16):
364 * wtf/unicode/UTF8.h:
365 Made these function names start with a lower case letter.
367 * kjs/ustring.cpp: (KJS::UString::UTF8String): Updated for the above renaming.
369 * bindings/c/c_utility.cpp:
370 (KJS::Bindings::convertUTF8ToUTF16WithLatin1Fallback): Renamed to highlight the difference
371 from convertUTF8ToUTF16 in wtf/unicode.
372 (KJS::Bindings::convertNPStringToUTF16): Updated for the above renaming.
373 (KJS::Bindings::identifierFromNPIdentifier): Ditto.
374 * bindings/c/c_utility.h: Made convertUTF8ToUTF16WithLatin1Fallback() a file static.
376 2007-11-14 Sam Weinig <sam@webkit.org>
378 Rubber-stamped by Anders.
380 Fix the Xcode project file after it was messed up in r27402.
382 * JavaScriptCore.xcodeproj/project.pbxproj:
384 2007-11-14 Eric Seidel <eric@webkit.org>
388 More PCRE style cleanup.
390 * pcre/pcre_compile.cpp:
393 2007-11-14 Adam Roben <aroben@apple.com>
395 Clean up the bison conflict checking script
399 * DerivedSources.make:
401 2007-11-14 Eric Seidel <eric@webkit.org>
405 Another round of PCRE cleanups: inlines
407 SunSpider claims that this, combined with my previous PCRE cleanup were a 0.7% speedup, go figure.
409 * pcre/pcre_compile.cpp:
411 * pcre/pcre_exec.cpp:
414 * pcre/pcre_internal.h:
421 2007-11-14 Eric Seidel <eric@webkit.org>
425 Give PCRE a (small) bath.
426 Fix some formating and break things off into separate functions
427 http://bugs.webkit.org/show_bug.cgi?id=15993
429 * pcre/pcre_compile.cpp:
430 (calculateCompiledPatternLengthAndFlags):
431 (printCompiledRegExp):
434 * pcre/pcre_internal.h:
435 (compile_data::compile_data):
437 2007-11-14 Geoffrey Garen <ggaren@apple.com>
439 Reviewed by Eric Seidel.
441 Cleaned up the JavaScript grammar a bit.
443 1. Changed BlockNode to always hold a child vector (which may be empty),
444 eliminating a few NULL-check branches in the common execution case.
446 2. Changed the Block production to correctly report its starting and
447 ending line numbers to the debugger. (It used to report its ending line
448 as its starting line.) Also, removed duplicate line-reporting code
449 inside the BlockNode constructor.
451 3. Moved curly braces up from FunctionBody production into parent
452 productions. (I had to move the line number reporting code, too, since
453 it depends on the location of the curly braces.) This matches the ECMA
454 spec more closely, and makes some future changes I plan easier.
456 4. Fixed statementList* convenience functions to deal appropriately with
459 SunSpider reports a small and statistically insignificant speedup.
463 (KJS::statementListPushFIFO):
464 (KJS::statementListGetDeclarations):
465 (KJS::statementListInitializeDeclarationStack):
466 (KJS::statementListInitializeVariableAccessStack):
467 (KJS::BlockNode::BlockNode):
468 (KJS::BlockNode::optimizeVariableAccess):
469 (KJS::BlockNode::getDeclarations):
470 (KJS::BlockNode::execute):
471 (KJS::FunctionBodyNode::initializeDeclarationStacks):
472 (KJS::FunctionBodyNode::optimizeVariableAccess):
474 2007-11-13 Anders Carlsson <andersca@apple.com>
476 Add RefCounted.h (And remove Shared.h)
478 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
480 2007-11-13 Geoffrey Garen <ggaren@apple.com>
486 2007-11-13 Geoffrey Garen <ggaren@apple.com>
488 Reviewed by Anders Carlsson.
490 Renamed Shared to RefCounted.
493 * JavaScriptCore.xcodeproj/project.pbxproj:
496 * wtf/RefCounted.h: Copied from JavaScriptCore/wtf/Shared.h.
497 (WTF::RefCounted::RefCounted):
498 * wtf/Shared.h: Removed.
500 2007-11-13 Adam Roben <aroben@apple.com>
506 * kjs/regexp.h: Added a missing #include.
508 2007-11-13 Geoffrey Garen <ggaren@apple.com>
510 Reviewed by Sam Weinig.
512 Moved Shared.h into wtf so it could be used in more places. Deployed
513 Shared in places where JSCore previously had hand-rolled ref-counting
516 * API/JSClassRef.cpp:
517 (OpaqueJSClass::OpaqueJSClass):
519 * API/JSObjectRef.cpp:
522 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
523 * JavaScriptCore.xcodeproj/project.pbxproj:
524 * kjs/interpreter.cpp:
525 (KJS::Interpreter::init):
528 (KJS::RegExp::RegExp):
530 * wtf/Shared.h: Copied from WebCore/platform/Shared.h.
532 2007-11-13 Eric Seidel <eric@webkit.org>
536 Add an ASSERT to getTruncatedInt32 to enforce proper usage.
537 Best part about this patch? It doesn't break the web!
540 (KJS::JSImmediate::getTruncatedInt32):
541 (KJS::JSImmediate::toDouble):
542 (KJS::JSImmediate::getUInt32):
544 2007-11-13 Alexey Proskuryakov <ap@webkit.org>
548 * bindings/c/c_utility.cpp:
549 (KJS::Bindings::convertUTF8ToUTF16):
551 (KJS::UString::UTF8String):
552 * wtf/unicode/UTF8.cpp:
553 (WTF::Unicode::ConvertUTF8ToUTF16):
555 2007-11-13 Darin Adler <darin@apple.com>
559 - fix http://bugs.webkit.org/show_bug.cgi?id=11231
560 RegExp bug when handling newline characters
561 and a number of other differences between PCRE behvior
562 and JavaScript regular expressions:
564 + single-digit sequences like \4 should be treated as octal
565 character constants, unless there is a sufficient number
566 of brackets for them to be treated as backreferences
568 + \8 turns into the character "8", not a binary zero character
569 followed by "8" (same for 9)
571 + only the first 3 digits should be considered part of an
572 octal character constant (the old behavior was to decode
573 an arbitrarily long sequence and then mask with 0xFF)
575 + if \x is followed by anything other than two valid hex digits,
576 then it should simply be treated a the letter "x"; that includes
577 not supporting the \x{41} syntax
579 + if \u is followed by anything less than four valid hex digits,
580 then it should simply be treated a the letter "u"
582 + an extra "+" should be a syntax error, rather than being treated
583 as the "possessive quantifier"
585 + if a "]" character appears immediately after a "[" character that
586 starts a character class, then that's an empty character class,
587 rather than being the start of a character class that includes a
590 + a "$" should not match a terminating newline; we could have gotten
591 PCRE to handle this the way we wanted by passing an appropriate option
593 Test: fast/js/regexp-no-extensions.html
595 * pcre/pcre_compile.cpp:
596 (check_escape): Check backreferences against bracount to catch both
597 overflows and things that should be treated as octal. Rewrite octal
598 loop to not go on indefinitely. Rewrite both hex loops to match and
600 (compile_branch): Restructure loops so that we don't special-case a "]"
601 at the beginning of a character class. Remove code that treated "+" as
602 the possessive quantifier.
603 (jsRegExpCompile): Change the "]" handling here too.
605 * pcre/pcre_exec.cpp: (match): Changed CIRC to match the DOLL implementation.
606 Changed DOLL to remove handling of "terminating newline", a Perl concept
609 * tests/mozilla/expected.html: Two tests are fixed now:
610 ecma_3/RegExp/regress-100199.js and ecma_3/RegExp/regress-188206.js.
611 One test fails now: ecma_3/RegExp/perlstress-002.js -- our success before
612 was due to a bug (we treated all 1-character numeric escapes as backreferences).
613 The date tests also now both expect success -- whatever was making them fail
614 before was probably due to the time being close to a DST shift; maybe we need
615 to get rid of those tests.
617 2007-11-13 Darin Adler <darin@apple.com>
619 * kjs/JSImmediate.h: (KJS::JSImmediate::getTruncatedInt32):
620 Remove too-strong assert that was firing constantly and preventing even basic
621 web browsing from working in a debug build. This function is used in many
622 cases where the immediate value is not a number; the assertion could perhaps
623 be added back later with a bit of reorganization.
625 2007-11-13 Alp Toker <alp@atoker.com>
627 Build fix for breakage to non-Mac builds introduced in r27746.
631 2007-11-13 Eric Seidel <eric@webkit.org>
635 Clean up evaluateToBoolean functions to use inlines instead of copy/paste code
639 (KJS::GreaterNode::inlineEvaluateToBoolean):
640 (KJS::GreaterNode::evaluate):
641 (KJS::LessEqNode::inlineEvaluateToBoolean):
642 (KJS::LessEqNode::evaluate):
643 (KJS::GreaterEqNode::inlineEvaluateToBoolean):
644 (KJS::GreaterEqNode::evaluate):
645 (KJS::InNode::evaluateToBoolean):
646 (KJS::EqualNode::inlineEvaluateToBoolean):
647 (KJS::EqualNode::evaluate):
648 (KJS::NotEqualNode::inlineEvaluateToBoolean):
649 (KJS::NotEqualNode::evaluate):
650 (KJS::StrictEqualNode::inlineEvaluateToBoolean):
651 (KJS::StrictEqualNode::evaluate):
652 (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
653 (KJS::NotStrictEqualNode::evaluate):
656 2007-11-12 Geoffrey Garen <ggaren@apple.com>
658 Reviewed by Sam Weinig.
660 Fixed http://bugs.webkit.org/show_bug.cgi?id=15958
661 base64 spends 1.1% of total time checking for special Infinity case
663 Use a fast character test instead of calling strncmp.
665 1.1% speedup on string-base64. SunSpider reports a .4% speedup overall;
666 Sharks reports only .1%. Who are you going to believe? Huh?
669 (KJS::UString::toDouble):
671 2007-11-12 Eric Seidel <eric@webkit.org>
675 Add evaluateToInt32 and evaluateUInt32 methods and deploy them.
676 Fix a few missing evaluateToBoolean methods
677 Deploy all evaluateTo* functions to more nodes to avoid slowdowns
678 http://bugs.webkit.org/show_bug.cgi?id=15950
680 SunSpider claims this is at least a 1.4% speedup.
683 (KJS::JSImmediate::getTruncatedInt32):
684 (KJS::JSImmediate::toDouble):
685 (KJS::JSImmediate::getUInt32):
687 (KJS::ExpressionNode::evaluateToNumber):
688 (KJS::ExpressionNode::evaluateToInt32):
689 (KJS::ExpressionNode::evaluateToUInt32):
690 (KJS::NumberNode::evaluateToInt32):
691 (KJS::NumberNode::evaluateToUInt32):
692 (KJS::ImmediateNumberNode::evaluateToInt32):
693 (KJS::ImmediateNumberNode::evaluateToUInt32):
694 (KJS::ResolveNode::evaluate):
695 (KJS::ResolveNode::evaluateToNumber):
696 (KJS::ResolveNode::evaluateToBoolean):
697 (KJS::ResolveNode::evaluateToInt32):
698 (KJS::ResolveNode::evaluateToUInt32):
699 (KJS::LocalVarAccessNode::evaluateToInt32):
700 (KJS::LocalVarAccessNode::evaluateToUInt32):
701 (KJS::BracketAccessorNode::evaluateToNumber):
702 (KJS::BracketAccessorNode::evaluateToBoolean):
703 (KJS::BracketAccessorNode::evaluateToInt32):
704 (KJS::BracketAccessorNode::evaluateToUInt32):
705 (KJS::DotAccessorNode::inlineEvaluate):
706 (KJS::DotAccessorNode::evaluate):
707 (KJS::DotAccessorNode::evaluateToNumber):
708 (KJS::DotAccessorNode::evaluateToBoolean):
709 (KJS::DotAccessorNode::evaluateToInt32):
710 (KJS::DotAccessorNode::evaluateToUInt32):
711 (KJS::NewExprNode::inlineEvaluate):
712 (KJS::NewExprNode::evaluate):
713 (KJS::NewExprNode::evaluateToNumber):
714 (KJS::NewExprNode::evaluateToBoolean):
715 (KJS::NewExprNode::evaluateToInt32):
716 (KJS::NewExprNode::evaluateToUInt32):
717 (KJS::FunctionCallResolveNode::inlineEvaluate):
718 (KJS::FunctionCallResolveNode::evaluate):
719 (KJS::FunctionCallResolveNode::evaluateToNumber):
720 (KJS::FunctionCallResolveNode::evaluateToBoolean):
721 (KJS::FunctionCallResolveNode::evaluateToInt32):
722 (KJS::FunctionCallResolveNode::evaluateToUInt32):
723 (KJS::LocalVarFunctionCallNode::evaluate):
724 (KJS::LocalVarFunctionCallNode::evaluateToNumber):
725 (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
726 (KJS::LocalVarFunctionCallNode::evaluateToInt32):
727 (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
728 (KJS::FunctionCallDotNode::evaluate):
729 (KJS::FunctionCallDotNode::evaluateToNumber):
730 (KJS::FunctionCallDotNode::evaluateToBoolean):
731 (KJS::FunctionCallDotNode::evaluateToInt32):
732 (KJS::FunctionCallDotNode::evaluateToUInt32):
733 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
734 (KJS::PostDecLocalVarNode::evaluateToNumber):
735 (KJS::PostDecLocalVarNode::evaluateToBoolean):
736 (KJS::PostDecLocalVarNode::evaluateToInt32):
737 (KJS::PostDecLocalVarNode::evaluateToUInt32):
738 (KJS::typeStringForValue):
739 (KJS::UnaryPlusNode::evaluate):
740 (KJS::UnaryPlusNode::evaluateToBoolean):
741 (KJS::UnaryPlusNode::evaluateToNumber):
742 (KJS::UnaryPlusNode::evaluateToInt32):
743 (KJS::BitwiseNotNode::inlineEvaluateToInt32):
744 (KJS::BitwiseNotNode::evaluate):
745 (KJS::BitwiseNotNode::evaluateToNumber):
746 (KJS::BitwiseNotNode::evaluateToBoolean):
747 (KJS::BitwiseNotNode::evaluateToInt32):
748 (KJS::MultNode::evaluateToBoolean):
749 (KJS::MultNode::evaluateToInt32):
750 (KJS::MultNode::evaluateToUInt32):
751 (KJS::DivNode::evaluateToInt32):
752 (KJS::DivNode::evaluateToUInt32):
753 (KJS::ModNode::evaluateToBoolean):
754 (KJS::ModNode::evaluateToInt32):
755 (KJS::ModNode::evaluateToUInt32):
756 (KJS::AddNode::evaluateToNumber):
757 (KJS::AddNode::evaluateToInt32):
758 (KJS::AddNode::evaluateToUInt32):
759 (KJS::AddNumbersNode::evaluateToInt32):
760 (KJS::AddNumbersNode::evaluateToUInt32):
761 (KJS::SubNode::evaluateToInt32):
762 (KJS::SubNode::evaluateToUInt32):
763 (KJS::LeftShiftNode::inlineEvaluateToInt32):
764 (KJS::LeftShiftNode::evaluate):
765 (KJS::LeftShiftNode::evaluateToNumber):
766 (KJS::LeftShiftNode::evaluateToInt32):
767 (KJS::RightShiftNode::inlineEvaluateToInt32):
768 (KJS::RightShiftNode::evaluate):
769 (KJS::RightShiftNode::evaluateToNumber):
770 (KJS::RightShiftNode::evaluateToInt32):
771 (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
772 (KJS::UnsignedRightShiftNode::evaluate):
773 (KJS::UnsignedRightShiftNode::evaluateToNumber):
774 (KJS::UnsignedRightShiftNode::evaluateToInt32):
775 (KJS::LessNode::inlineEvaluateToBoolean):
776 (KJS::LessNode::evaluate):
777 (KJS::LessNode::evaluateToBoolean):
778 (KJS::LessNumbersNode::inlineEvaluateToBoolean):
779 (KJS::LessNumbersNode::evaluate):
780 (KJS::LessNumbersNode::evaluateToBoolean):
781 (KJS::LessStringsNode::inlineEvaluateToBoolean):
782 (KJS::LessStringsNode::evaluate):
783 (KJS::BitAndNode::evaluate):
784 (KJS::BitAndNode::inlineEvaluateToInt32):
785 (KJS::BitAndNode::evaluateToNumber):
786 (KJS::BitAndNode::evaluateToBoolean):
787 (KJS::BitAndNode::evaluateToInt32):
788 (KJS::BitXOrNode::inlineEvaluateToInt32):
789 (KJS::BitXOrNode::evaluate):
790 (KJS::BitXOrNode::evaluateToNumber):
791 (KJS::BitXOrNode::evaluateToBoolean):
792 (KJS::BitXOrNode::evaluateToInt32):
793 (KJS::BitOrNode::inlineEvaluateToInt32):
794 (KJS::BitOrNode::evaluate):
795 (KJS::BitOrNode::evaluateToNumber):
796 (KJS::BitOrNode::evaluateToBoolean):
797 (KJS::BitOrNode::evaluateToInt32):
798 (KJS::ConditionalNode::evaluateToNumber):
799 (KJS::ConditionalNode::evaluateToInt32):
800 (KJS::ConditionalNode::evaluateToUInt32):
801 (KJS::valueForReadModifyAssignment):
802 (KJS::AssignExprNode::evaluate):
803 (KJS::AssignExprNode::evaluateToBoolean):
804 (KJS::AssignExprNode::evaluateToNumber):
805 (KJS::AssignExprNode::evaluateToInt32):
806 (KJS::VarDeclNode::handleSlowCase):
808 (KJS::FunctionCallResolveNode::precedence):
809 (KJS::AddNode::precedence):
811 (KJS::LessNumbersNode::):
812 (KJS::LessStringsNode::):
814 (KJS::JSValue::toInt32SlowCase):
815 (KJS::JSValue::toUInt32SlowCase):
817 (KJS::JSValue::asCell):
818 (KJS::JSValue::toInt32):
819 (KJS::JSValue::toUInt32):
821 2007-11-12 Alexey Proskuryakov <ap@webkit.org>
825 http://bugs.webkit.org/show_bug.cgi?id=15953
826 Add UTF-8 encoding/decoding to WTF
828 * kjs/ustring.h: Moved UTF8SequenceLength() and decodeUTF8Sequence() to wtf/unicode.
829 * kjs/ustring.cpp: (KJS::UString::UTF8String): Changed this function to take a strict/lenient
830 parameter. Callers are not interested in getting decoding results in strict mode, so
831 this allows for bailing out as soon as an error is seen.
834 (KJS::encode): Updated for new UString::UTF8String() signature.
836 * API/JSStringRef.cpp:
837 (JSStringCreateWithCharacters): Disambiguate UChar.
838 (JSStringCreateWithUTF8CString): Actually use UTF-8 when creating the string!
839 * bindings/c/c_utility.cpp: (KJS::Bindings::convertUTF8ToUTF16): Use ConvertUTF8ToUTF16().
841 * wtf/unicode/UTF8.cpp: Added.
842 (WTF::Unicode::inlineUTF8SequenceLengthNonASCII):
843 (WTF::Unicode::inlineUTF8SequenceLength):
844 (WTF::Unicode::UTF8SequenceLength):
845 (WTF::Unicode::decodeUTF8Sequence):
847 (WTF::Unicode::ConvertUTF16ToUTF8):
848 (WTF::Unicode::isLegalUTF8):
849 (WTF::Unicode::ConvertUTF8ToUTF16):
850 * wtf/unicode/UTF8.h: Added.
852 Some code moved from ustring.h, some adapted from unicode.org sources.
854 * JavaScriptCore.exp:
855 * JavaScriptCore.pri:
856 * JavaScriptCore.vcproj/WTF/WTF.vcproj:
857 * JavaScriptCore.xcodeproj/project.pbxproj:
858 * JavaScriptCoreSources.bkl:
861 2007-11-12 Josh Aas <joshmoz@gmail.com>
865 - http://bugs.webkit.org/show_bug.cgi?id=15946
866 add NPPValue NPPVpluginDrawingModel (Mozilla bug 403418 compat)
870 2007-11-12 Darin Adler <darin@apple.com>
874 - http://bugs.webkit.org/show_bug.cgi?id=15951
875 REGRESSION: assertion failure in regexp match() when running JS tests
877 Test: fast/js/regexp-many-brackets.html
879 * pcre/pcre_exec.cpp: (match): Added back accidentally-removed case for
880 the BRANUMBER opcode.
882 2007-11-12 Darin Adler <darin@apple.com>
886 - fix use of prefix and config.h, got rid of a few unneeded things in
887 the PCRE code; no behavior changes
889 * API/JSBase.cpp: Added include of config.h.
890 * API/JSCallbackConstructor.cpp: Ditto.
891 * API/JSCallbackFunction.cpp: Ditto.
892 * API/JSCallbackObject.cpp: Ditto.
893 * API/JSClassRef.cpp: Ditto.
894 * API/JSContextRef.cpp: Ditto.
895 * API/JSObjectRef.cpp: Ditto.
896 * API/JSStringRef.cpp: Ditto.
897 * API/JSValueRef.cpp: Ditto.
899 * JavaScriptCorePrefix.h: Removed obsolete <ctype.h> workaround.
900 Moved new/delete macros after includes, as they are in WebCore's prefix.
903 * pcre/dftables.cpp: (main): Changed back to not use a separate maketables
904 function. This is needed for PCRE, but not helpful for our use. Also changed
905 the tables to all be 128 entries long instead of 256, since only the first
908 * pcre/pcre_compile.cpp: Added include of config.h. Eliminated digitab,
909 which was only being used to check hex digits. Changed all uses of TRUE and
910 FALSE to use the C++ true and false instead.
911 (check_escape): Just the TRUE/FALSE thing.
912 (is_counted_repeat): Ditto.
913 (could_be_empty_branch): Ditto.
914 (get_othercase_range): Ditto.
915 (compile_branch): Ditto.
916 (compile_regex): Ditto.
917 (is_anchored): Ditto.
918 (is_startline): Ditto.
919 (find_firstassertedchar): Ditto.
920 (jsRegExpCompile): Ditto.
922 * pcre/pcre_exec.cpp: Added include of config.h. Changed all uses of TRUE and
923 FALSE to use the C++ true and false instead.
924 (match_ref): Just the TRUE/FALSE thing.
925 (match): Ditto. Removed some unneeded braces.
926 (jsRegExpExecute): Just the TRUE/FALSE thing.
928 * pcre/pcre_internal.h: Moved the constants needed by dftables.cpp to the top
929 of the file instead of the bottom, so they can be used. Also changed the table
930 sizes to 128 instead of 256. Removed macro definitions of FALSE and TRUE.
931 Set array sizes for all the const arrays. Changed _pcre_utf8_table1_size to
932 be a macro instead of a extern int.
934 * pcre/pcre_maketables.cpp: Removed. It's all in dftables.cpp now.
936 * pcre/pcre_tables.cpp: Made table sizes explicit.
938 * pcre/pcre_xclass.cpp: Just the TRUE/FALSE thing.
940 2007-11-12 Adam Roben <aroben@apple.com>
944 * wtf/FastMalloc.h: Add missing using statement.
946 2007-11-11 Oliver Hunt <oliver@apple.com>
950 Add special fastZeroedMalloc function to replace a
951 number of fastCalloc calls where one argument was 1.
953 This results in a 0.4% progression in SunSpider, more
954 than making up for the earlier regression caused by
955 additional overflow checks.
957 * JavaScriptCore.exp:
958 * kjs/array_instance.cpp:
959 * kjs/property_map.cpp:
960 * wtf/FastMalloc.cpp:
964 2007-11-11 Adam Roben <aroben@apple.com>
966 Fix <rdar://5578982> ASSERT in HashTable::checkTableConsistencyExceptSize beneath WebNotificationCenter
968 The bug was due to a mismatch between HashMap::remove and
969 HashTable::checkTableConsistency. HashMap::remove can delete the value
970 stored in the HashTable (by derefing it), which is not normally
971 allowed by HashTable. It's OK in this case because the value is about
972 to be removed from the table, but HashTable wasn't aware of this.
974 HashMap::remove now performs the consistency check itself before
977 Darin noticed that the same bug would occur in HashSet, so I've fixed
983 (WTF::HashMap::remove): Perform the HashTable consistency check
984 manually before calling deref.
986 (WTF::HashSet::remove): Ditto.
987 * wtf/HashTable.h: Made checkTableConsistency public so that HashMap
988 and HashSet can call it.
989 (WTF::HashTable::removeAndInvalidateWithoutEntryConsistencyCheck):
991 (WTF::HashTable::removeAndInvalidate): Added.
992 (WTF::HashTable::remove):
993 (WTF::HashTable::removeWithoutEntryConsistencyCheck): Added.
995 2007-11-11 Mark Rowe <mrowe@apple.com>
997 Build fix. Use the correct filename case.
1001 2007-11-11 Geoffrey Garen <ggaren@apple.com>
1003 Reviewed by Sam Weinig.
1005 Fixed http://bugs.webkit.org/show_bug.cgi?id=15902
1006 15% of string-validate-input.js is spent compiling the same regular expression
1008 Store a compiled representation of the regular expression in the AST.
1010 Only a .2% SunSpider speedup overall, but a 10.6% speedup on
1011 string-validate-input.js.
1014 (KJS::RegExpNode::evaluate):
1016 (KJS::RegExpNode::):
1017 * kjs/nodes2string.cpp:
1018 (KJS::RegExpNode::streamTo):
1020 (KJS::RegExp::flags):
1022 (KJS::RegExp::pattern):
1023 * kjs/regexp_object.cpp:
1024 (KJS::RegExpObjectImp::construct):
1025 (KJS::RegExpObjectImp::createRegExpImp):
1026 * kjs/regexp_object.h:
1028 2007-11-11 Oliver Hunt <oliver@apple.com>
1032 Partial fix for <rdar://problem/5585334> numfuzz: integer overflows opening malformed SVG file in WebCore::ImageBuffer::create
1034 Unfortunately this is a very slight regression, but is unavoidable.
1036 * wtf/FastMalloc.cpp:
1038 2007-11-10 Eric Seidel <eric@webkit.org>
1042 Add simple type inferencing to the parser, and create custom
1043 AddNode and LessNode subclasses based on inferred types.
1044 http://bugs.webkit.org/show_bug.cgi?id=15884
1046 SunSpider claims this is at least a 0.5% speedup.
1048 * JavaScriptCore.exp:
1051 (KJS::NumberImp::getPrimitiveNumber):
1052 (KJS::GetterSetterImp::getPrimitiveNumber):
1058 (KJS::StringNode::evaluate):
1059 (KJS::StringNode::evaluateToNumber):
1060 (KJS::StringNode::evaluateToBoolean):
1061 (KJS::RegExpNode::evaluate):
1062 (KJS::UnaryPlusNode::optimizeVariableAccess):
1063 (KJS::AddNode::evaluate):
1064 (KJS::AddNode::evaluateToNumber):
1065 (KJS::AddNumbersNode::inlineEvaluateToNumber):
1066 (KJS::AddNumbersNode::evaluate):
1067 (KJS::AddNumbersNode::evaluateToNumber):
1068 (KJS::AddStringsNode::evaluate):
1069 (KJS::AddStringLeftNode::evaluate):
1070 (KJS::AddStringRightNode::evaluate):
1073 (KJS::LessNumbersNode::evaluate):
1074 (KJS::LessStringsNode::evaluate):
1076 (KJS::ExpressionNode::):
1077 (KJS::RegExpNode::):
1078 (KJS::RegExpNode::precedence):
1079 (KJS::TypeOfResolveNode::):
1080 (KJS::LocalVarTypeOfNode::):
1081 (KJS::UnaryPlusNode::):
1082 (KJS::UnaryPlusNode::precedence):
1084 (KJS::AddNode::precedence):
1085 (KJS::AddNumbersNode::):
1086 (KJS::AddStringLeftNode::):
1087 (KJS::AddStringRightNode::):
1088 (KJS::AddStringsNode::):
1090 (KJS::LessNode::precedence):
1091 (KJS::LessNumbersNode::):
1092 (KJS::LessStringsNode::):
1093 * kjs/nodes2string.cpp:
1094 (KJS::StringNode::streamTo):
1098 (KJS::JSValue::getPrimitiveNumber):
1100 2007-11-11 Darin Adler <darin@apple.com>
1102 - try another way of fixing dftables builds -- refactor pcre_internal.h a bit
1104 * pcre/pcre_internal.h: Make most of this header do nothing when DFTABLES is set.
1105 Later we can break it into two files.
1107 * JavaScriptCore.vcproj/dftables/dftables.vcproj: Take out now-unneeded include paths.
1108 * pcre/dftables.cpp: Set DFTABLES. Use delete instead of free.
1109 * pcre/dftables.pro: Take out now-unneeded include paths.
1110 * pcre/pcre_maketables.cpp: Use new instead of malloc.
1112 2007-11-11 Darin Adler <darin@apple.com>
1114 * pcre/dftables.pro: Try fixing Qt builds (I looked at qt-win) by adding
1115 another include path.
1117 2007-11-11 Darin Adler <darin@apple.com>
1119 * JavaScriptCore.xcodeproj/project.pbxproj: Try fixing Mac Tiger builds
1120 by adding another include path.
1122 2007-11-11 Darin Adler <darin@apple.com>
1126 - http://bugs.webkit.org/show_bug.cgi?id=15924
1127 next round of changes to JSRegExp (formerly PCRE)
1129 This is a combination of converting to C++, tweaking the API, and adding
1130 some additional optimizations.
1132 Future steps will involve getting rid of the use of UTF-8 completely
1133 (we'll use UTF-16 exclusively instead), eliminating more source files,
1134 and some more speed-ups.
1136 SunSpider says the current round is an 0.9% speed-up overall, and a
1137 5.3% speed-up for regexp.
1139 * JavaScriptCore.exp: Updated for new entry points.
1141 * JavaScriptCore.pri:
1142 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1143 * JavaScriptCore.vcproj/dftables/dftables.vcproj:
1144 * JavaScriptCore.xcodeproj/project.pbxproj:
1145 * JavaScriptCoreSources.bkl:
1147 Updated for new source file names and ForwardingHeaders.
1150 (KJS::RegExp::RegExp): Changed to use the error message without calling
1151 strdup on it and to pass the new types and options.
1152 (KJS::RegExp::~RegExp): Removed the now-unneeded free of the error message.
1153 (KJS::RegExp::match): Pass the new types and options.
1154 * kjs/regexp.h: Update type of m_constructionError.
1156 * pcre/AUTHORS: Update to reflect the status of the project -- we don't include
1157 the Google parts, and this isn't the PCRE library, per se.
1158 * pcre/COPYING: Ditto.
1160 * pcre/dftables.cpp: Copied from JavaScriptCore/pcre/dftables.c.
1161 (main): Removed unneeded ctype_digit.
1163 * pcre/pcre.h: Convert to C++, tweak API a bit. Use UChar instead of JSRegExpChar.
1165 * pcre/pcre_compile.cpp: Copied from JavaScriptCore/pcre/pcre_compile.c.
1166 Moved a lot of private stuff used only within this file here from pcre_internal.h.
1167 Renumbered the error codes.
1168 (error_text): Use a single string with embedded nulls for the error text (I got
1169 this idea from newer versions of PCRE).
1170 (check_escape): Changed return type to be enum instead of int. Replaced ctype_digit
1171 uses with isASCIIDigit.
1172 (is_counted_repeat): Ditto.
1173 (read_repeat_counts): Ditto.
1174 (first_significant_code): Ditto.
1175 (find_fixedlength): Ditto.
1176 (could_be_empty_branch): Ditto.
1177 (compile_branch): Ditto. Also removed some code that handles changing options.
1178 JavaScript doesn't have any of the features that allow options to change.
1179 (compile_regex): Updated for change to options parameter.
1180 (is_anchored): Ditto.
1181 (find_firstassertedchar): Ditto.
1182 (jsRegExpCompile): Changed to take separate flags instead of an options int.
1183 Also changed to call new/delete instead of pcre_malloc/free.
1184 (jsRegExpFree): Ditto.
1186 * pcre/pcre_exec.cpp: Copied from JavaScriptCore/pcre/pcre_exec.c.
1187 Added a case that uses computed goto for the opcode loop, but did not turn it on.
1188 Changed the RMATCH macro to handle returns more efficiently by putting the where
1189 pointer in the new frame instead of the old one, allowing us to branch to the
1190 return with a single statement. Switched to new/delete from pcre_malloc/free.
1191 Changed many RRETURN callers to not set the return value since it's already
1192 set correctly. Replaced the rrc variable with an is_match variable. Values other
1193 than "match" and "no match" are now handled differently. This allows us to remove
1194 the code to check for those cases in various rules.
1195 (match): All the case statements use a macro BEGIN_OPCODE instead. And all the
1196 continue statements, or break statements that break out of the outer case use
1197 a macro NEXT_OPCODE instead. Replaced a few if statements with assertions.
1198 (jsRegExpExecute): Use new/delete instead of pcre_malloc/free. Removed unused
1199 start_match field from the match block.
1201 * pcre/pcre_internal.h: Moved the last few configuration macros from pcre-config.h
1202 in here. Removed various unused types. Converted from JSRegExpChar to UChar.
1203 Eliminated pcre_malloc/free. Replaced the opcode enum with a macro that can be
1204 used in multiple places. Unfortunately we lose the comments for each opcode; we
1205 should find a place to put those back. Removed ctype_digit.
1207 * pcre/pcre_maketables.cpp: Copied from JavaScriptCore/pcre/pcre_maketables.c.
1208 (pcre_maketables): Got rid of the conditional code that allows this to be compiled
1209 in -- it's only used for dftables now (and soon may be obsolete entirely).
1210 Changed code for cbit_digit to not use isdigit, and took the "_" case out of the
1211 loop. Removed ctype_digit.
1213 * pcre/pcre_ord2utf8.cpp: Copied from JavaScriptCore/pcre/pcre_ord2utf8.c.
1215 * pcre/pcre_tables.cpp: Copied from JavaScriptCore/pcre/pcre_tables.c.
1216 Moved _pcre_OP_lengths out of here into pcre_exec.cpp.
1218 * pcre/pcre_ucp_searchfuncs.cpp: Copied from JavaScriptCore/pcre/pcre_ucp_searchfuncs.c.
1219 Updated for other file name changes.
1221 * pcre/pcre_xclass.cpp: Copied from JavaScriptCore/pcre/pcre_xclass.c.
1223 * pcre/ucpinternal.h: Updated header.
1225 * pcre/ucptable.cpp: Copied from JavaScriptCore/pcre/ucptable.c.
1227 * wtf/ASCIICType.h: (WTF::isASCIIDigit): Removed a branch by changing from && to
1228 & for this operation. Also added an overload that takes an int because that's
1229 useful for PCRE. Later we could optimize for int and overload other functions in
1230 this file; stuck to this simple one for now.
1232 * wtf/unicode/icu/UnicodeIcu.h: Removed unused isUpper.
1233 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
1235 * pcre/LICENCE: Removed.
1236 * pcre/pcre-config.h: Removed.
1237 * wtf/FastMallocPCRE.cpp: Removed.
1239 * pcre/dftables.c: Renamed to cpp.
1240 * pcre/pcre_compile.c: Ditto.
1241 * pcre/pcre_exec.c: Ditto.
1242 * pcre/pcre_maketables.c: Ditto.
1243 * pcre/pcre_ord2utf8.c: Ditto.
1244 * pcre/pcre_tables.c: Ditto.
1245 * pcre/pcre_ucp_searchfuncs.c: Ditto.
1246 * pcre/pcre_xclass.c: Ditto.
1247 * pcre/ucptable.c: Ditto.
1249 2007-11-11 Eric Seidel <eric@webkit.org>
1253 Add KJS_CHECKEXCEPTIONBOOLEAN to match rest of nodes.cpp
1256 (KJS::ExpressionNode::evaluateToBoolean):
1257 (KJS::LessNode::evaluateToBoolean):
1258 (KJS::GreaterNode::evaluateToBoolean):
1259 (KJS::LessEqNode::evaluateToBoolean):
1260 (KJS::GreaterEqNode::evaluateToBoolean):
1261 (KJS::InstanceOfNode::evaluateToBoolean):
1262 (KJS::InNode::evaluateToBoolean):
1263 (KJS::EqualNode::evaluateToBoolean):
1264 (KJS::NotEqualNode::evaluateToBoolean):
1265 (KJS::StrictEqualNode::evaluateToBoolean):
1266 (KJS::NotStrictEqualNode::evaluateToBoolean):
1267 (KJS::LogicalAndNode::evaluateToBoolean):
1268 (KJS::LogicalOrNode::evaluateToBoolean):
1269 (KJS::ConditionalNode::evaluateToBoolean):
1271 2007-11-10 Darin Adler <darin@apple.com>
1275 - fix http://bugs.webkit.org/show_bug.cgi?id=15927
1276 REGRESSION(r27487): delete a.c followed by __defineGetter__("c", ...) incorrectly deletes another property
1277 and <rdar://problem/5586384> REGRESSION (r27487): Can't switch out of Edit HTML Source mode on Leopard Wiki
1279 Test: fast/js/delete-then-put.html
1281 * kjs/property_map.cpp:
1282 (KJS::PropertyMap::put): Added a missing "- 1"; code to find an empty slot was not working.
1283 (KJS::PropertyMap::checkConsistency): Added a missing range check that would have caught this
1286 - roll out a last-minute change to my evaluateToBoolean patch that was incorrect.
1288 * kjs/nodes.h: (KJS::ExprStatementNode::ExprStatementNode): Take out call to
1289 optimizeForUnnecessaryResult, since the result is used in some cases.
1291 2007-11-10 Adam Roben <aroben@apple.com>
1295 Roll out some changes that were (seemingly accidentally) checked in
1298 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1300 2007-11-10 Darin Adler <darin@apple.com>
1304 - http://bugs.webkit.org/show_bug.cgi?id=15915
1305 add an evaluation path for booleans like the one we have for numbers
1307 Gives 1.1% on SunSpider.
1309 * kjs/grammar.y: Create TrueNode and FalseNode instead of BooleanNode.
1311 * kjs/nodes.h: Changed to use Noncopyable. Moved optimizeForUnnecessaryResult
1312 down from Node to ExpressionNode. Changed some classes to not inherit from
1313 ExpressionNode where not necessary, and removed unnneeded evaluate functions
1314 as well as evaluate functions that need not be virtual. Call the
1315 optimizeForUnnecessaryResult function on the start of a for loop too.
1317 (KJS::ExpressionNode::evaluateToBoolean): Added.
1318 (KJS::FalseNode::evaluate): Added.
1319 (KJS::TrueNode::evaluate): Added.
1320 (KJS::NumberNode::evaluateToBoolean): Added.
1321 (KJS::StringNode::evaluateToBoolean): Added.
1322 (KJS::LocalVarAccessNode::evaluateToBoolean): Added.
1323 (KJS::BracketAccessorNode::evaluateToBoolean): Added.
1324 (KJS::LogicalNotNode::evaluate): Changed to call evaluateToBoolean.
1325 (KJS::LogicalNotNode::evaluateToBoolean): Added.
1326 (KJS::lessThan): Changed to return bool.
1327 (KJS::lessThanEq): Ditto.
1328 (KJS::LessNode::evaluate): Changed since lessThan returns bool.
1329 (KJS::LessNode::evaluateToBoolean): Added.
1330 (KJS::GreaterNode::evaluate): Changed since lessThanEq returns bool.
1331 (KJS::GreaterNode::evaluateToBoolean): Added.
1332 (KJS::LessEqNode::evaluate): Changed since lessThanEq returns bool.
1333 (KJS::LessEqNode::evaluateToBoolean): Added.
1334 (KJS::GreaterEqNode::evaluate): Changed since lessThan returns bool.
1335 (KJS::GreaterEqNode::evaluateToBoolean): Added.
1336 (KJS::InstanceOfNode::evaluateToBoolean): Added.
1337 (KJS::InNode::evaluateToBoolean): Added.
1338 (KJS::EqualNode::evaluateToBoolean): Added.
1339 (KJS::NotEqualNode::evaluateToBoolean): Added.
1340 (KJS::StrictEqualNode::evaluateToBoolean): Added.
1341 (KJS::NotStrictEqualNode::evaluateToBoolean): Added.
1342 (KJS::ConditionalNode::evaluate): Changed to call evaluateToBoolean.
1343 (KJS::IfNode::execute): Ditto.
1344 (KJS::DoWhileNode::execute): Ditto.
1345 (KJS::WhileNode::execute): Ditto.
1346 (KJS::ForNode::execute): Ditto.
1348 * kjs/nodes2string.cpp:
1349 (KJS::FalseNode::streamTo): Added.
1350 (KJS::TrueNode::streamTo): Added.
1352 2007-11-09 Adam Roben <aroben@apple.com>
1359 (KJS::jsNumber): Add some explicit casts.
1361 2007-11-08 Darin Adler <darin@apple.com>
1367 * kjs/property_map.cpp:
1369 2007-11-08 Darin Adler <darin@apple.com>
1371 - roll out accidentally-checked in changes
1373 * kjs/nodes.cpp: Back to previous version.
1374 * kjs/nodes.h: Ditto.
1375 * kjs/grammar.y: Ditto.
1377 2007-11-08 Darin Adler <darin@apple.com>
1381 - http://bugs.webkit.org/show_bug.cgi?id=15912
1382 fasta spends a lot of time in qsort
1384 * kjs/property_map.cpp:
1385 (KJS::PropertyMap::getEnumerablePropertyNames):
1386 Use insertion sort instead of qsort for small sets of property names.
1387 We can probably do some even-better speedups of for/in, but this nets
1388 0.6% overall and 6.7% on fasta.
1390 2007-11-08 Darin Adler <darin@apple.com>
1394 - http://bugs.webkit.org/show_bug.cgi?id=15906
1395 getting characters by indexing into a string is very slow
1397 This fixes one source of the slowness -- the conversion to an unused
1398 Identifier as we call the get function from the slot -- but doesn't
1399 fix others, such as the fact that we have to allocate a new UString::Rep
1400 for every single character.
1402 Speeds up string-base64 30%, and at least 0.5% overall.
1403 But does slow down access-fannkuch quite a bit. Might be worth
1404 revisiting in the future to see what we can do about that (although
1405 I did look at a profile for a while).
1407 * kjs/property_slot.h: Add a new marker for "numeric" property slots;
1408 slots where we don't need to pass the identifier to the get function.
1409 (KJS::PropertySlot::getValue): Added code to call the numeric get function.
1410 (KJS::PropertySlot::setCustomNumeric): Added.
1411 * kjs/string_object.cpp:
1412 (KJS::StringInstance::indexGetter): Changed to use substr() instead
1413 of constructing a wholly new UString each time.
1414 (KJS::stringInstanceNumericPropertyGetter): Added. Like indexGetter, but
1415 takes advantage of setCustomNumeric to avoid creating an Identifier.
1416 (KJS::StringInstance::getOwnPropertySlot): Changed to use setCustomNumeric.
1418 2007-11-08 Darin Adler <darin@apple.com>
1422 - http://bugs.webkit.org/show_bug.cgi?id=15904
1423 more speed-ups possible by tightening up int version of JSImmediate
1425 1% improvement of SunSpider
1427 * kjs/JSImmediate.h: Eliminate the now-unneeded FPBitValues struct template.
1428 (KJS::JSImmediate::from): Overload for most numeric types; many types can
1429 do fewer branches and checks.
1430 (KJS::JSImmediate::getUInt32): Removed unneeded check for undefined.
1431 (KJS::JSImmediate::getTruncatedInt32): Ditto.
1432 (KJS::JSImmediate::getTruncatedUInt32): Ditto. There's no difference any more
1433 between getUInt32 and getTruncatedUInt32, so that's worth a rename and merge later.
1435 * kjs/grammar.y: Update since fromDouble is now just from.
1436 * kjs/nodes.h: Ditto.
1438 * kjs/value.h: (KJS::jsNumber): Overload for most numeric types.
1440 2007-11-08 Kevin Ollivier <kevino@theolliviers.com>
1442 Bakefiles for building JavaScriptCore, needed by wx port.
1444 Reviewed by Mark Rowe.
1446 * JavaScriptCoreSources.bkl: Added.
1447 * jscore.bkl: Added.
1449 2007-11-08 Oliver Hunt <oliver@apple.com>
1453 Fix regression caused by earlier bitwise and optimisation. 1 & undefined != 1.
1455 The implementation of JSImmediate::areBothImmediateNumbers relies on
1456 (JSImmediate::getTag(immediate1) & JSImmediate::getTag(immediate2)) having
1457 a unique result when both immediate values are numbers.
1459 The regression was due to UndefinedType & NumberType returning NumberType (3 & 1).
1460 By swapping the value of NumberType and UndefinedType this ceases to be a problem.
1465 2007-11-08 Darin Adler <darin@apple.com>
1469 * kjs/nodes.h: Add missing parameter name.
1471 2007-11-08 Eric Seidel <eric@webkit.org>
1475 Add ExpressionNode subclass of Node, use it.
1479 (KJS::ForInNode::ForInNode):
1481 (KJS::ExpressionNode::):
1483 (KJS::NullNode::precedence):
1484 (KJS::BooleanNode::):
1485 (KJS::BooleanNode::precedence):
1486 (KJS::RegExpNode::):
1487 (KJS::RegExpNode::precedence):
1489 (KJS::ThisNode::precedence):
1490 (KJS::ResolveNode::):
1491 (KJS::ElementNode::):
1493 (KJS::PropertyNode::):
1494 (KJS::PropertyNode::precedence):
1495 (KJS::PropertyNode::name):
1496 (KJS::PropertyListNode::):
1497 (KJS::ObjectLiteralNode::):
1498 (KJS::ObjectLiteralNode::precedence):
1499 (KJS::BracketAccessorNode::):
1500 (KJS::DotAccessorNode::):
1501 (KJS::DotAccessorNode::precedence):
1502 (KJS::ArgumentListNode::):
1503 (KJS::ArgumentsNode::):
1504 (KJS::NewExprNode::):
1505 (KJS::NewExprNode::precedence):
1506 (KJS::FunctionCallValueNode::):
1507 (KJS::FunctionCallValueNode::precedence):
1508 (KJS::FunctionCallResolveNode::):
1509 (KJS::FunctionCallBracketNode::):
1510 (KJS::FunctionCallBracketNode::precedence):
1511 (KJS::FunctionCallDotNode::):
1512 (KJS::FunctionCallDotNode::precedence):
1513 (KJS::PrePostResolveNode::):
1514 (KJS::PostfixBracketNode::):
1515 (KJS::PostfixBracketNode::precedence):
1516 (KJS::PostIncBracketNode::):
1517 (KJS::PostIncBracketNode::isIncrement):
1518 (KJS::PostDecBracketNode::):
1519 (KJS::PostDecBracketNode::isIncrement):
1520 (KJS::PostfixDotNode::):
1521 (KJS::PostfixDotNode::precedence):
1522 (KJS::PostIncDotNode::):
1523 (KJS::PostIncDotNode::isIncrement):
1524 (KJS::PostDecDotNode::):
1525 (KJS::PostDecDotNode::isIncrement):
1526 (KJS::PostfixErrorNode::):
1527 (KJS::PostfixErrorNode::precedence):
1528 (KJS::DeleteResolveNode::):
1529 (KJS::DeleteBracketNode::):
1530 (KJS::DeleteBracketNode::precedence):
1531 (KJS::DeleteDotNode::):
1532 (KJS::DeleteDotNode::precedence):
1533 (KJS::DeleteValueNode::):
1534 (KJS::DeleteValueNode::precedence):
1536 (KJS::VoidNode::precedence):
1537 (KJS::TypeOfResolveNode::):
1538 (KJS::TypeOfValueNode::):
1539 (KJS::PrefixBracketNode::):
1540 (KJS::PrefixBracketNode::precedence):
1541 (KJS::PreIncBracketNode::):
1542 (KJS::PreIncBracketNode::isIncrement):
1543 (KJS::PreDecBracketNode::):
1544 (KJS::PreDecBracketNode::isIncrement):
1545 (KJS::PrefixDotNode::):
1546 (KJS::PrefixDotNode::precedence):
1547 (KJS::PreIncDotNode::):
1548 (KJS::PreIncDotNode::isIncrement):
1549 (KJS::PreDecDotNode::):
1550 (KJS::PreDecDotNode::isIncrement):
1551 (KJS::PrefixErrorNode::):
1552 (KJS::PrefixErrorNode::precedence):
1553 (KJS::UnaryPlusNode::):
1554 (KJS::UnaryPlusNode::precedence):
1555 (KJS::NegateNode::):
1556 (KJS::NegateNode::precedence):
1557 (KJS::BitwiseNotNode::):
1558 (KJS::BitwiseNotNode::precedence):
1559 (KJS::LogicalNotNode::):
1560 (KJS::LogicalNotNode::precedence):
1562 (KJS::AddNode::precedence):
1563 (KJS::LeftShiftNode::):
1564 (KJS::LeftShiftNode::precedence):
1565 (KJS::RightShiftNode::):
1566 (KJS::RightShiftNode::precedence):
1567 (KJS::UnsignedRightShiftNode::):
1568 (KJS::UnsignedRightShiftNode::precedence):
1570 (KJS::LessNode::precedence):
1571 (KJS::GreaterNode::):
1572 (KJS::GreaterNode::precedence):
1573 (KJS::LessEqNode::):
1574 (KJS::LessEqNode::precedence):
1575 (KJS::GreaterEqNode::):
1576 (KJS::GreaterEqNode::precedence):
1577 (KJS::InstanceOfNode::):
1578 (KJS::InstanceOfNode::precedence):
1580 (KJS::InNode::precedence):
1582 (KJS::EqualNode::precedence):
1583 (KJS::NotEqualNode::):
1584 (KJS::NotEqualNode::precedence):
1585 (KJS::StrictEqualNode::):
1586 (KJS::StrictEqualNode::precedence):
1587 (KJS::NotStrictEqualNode::):
1588 (KJS::NotStrictEqualNode::precedence):
1589 (KJS::BitAndNode::):
1590 (KJS::BitAndNode::precedence):
1592 (KJS::BitOrNode::precedence):
1593 (KJS::BitXOrNode::):
1594 (KJS::BitXOrNode::precedence):
1595 (KJS::LogicalAndNode::):
1596 (KJS::LogicalAndNode::precedence):
1597 (KJS::LogicalOrNode::):
1598 (KJS::LogicalOrNode::precedence):
1599 (KJS::ConditionalNode::):
1600 (KJS::ConditionalNode::precedence):
1601 (KJS::ReadModifyResolveNode::):
1602 (KJS::ReadModifyResolveNode::precedence):
1603 (KJS::AssignResolveNode::):
1604 (KJS::AssignResolveNode::precedence):
1605 (KJS::ReadModifyBracketNode::):
1606 (KJS::ReadModifyBracketNode::precedence):
1607 (KJS::AssignBracketNode::):
1608 (KJS::AssignBracketNode::precedence):
1609 (KJS::AssignDotNode::):
1610 (KJS::AssignDotNode::precedence):
1611 (KJS::ReadModifyDotNode::):
1612 (KJS::ReadModifyDotNode::precedence):
1613 (KJS::AssignErrorNode::):
1614 (KJS::AssignErrorNode::precedence):
1616 (KJS::CommaNode::precedence):
1617 (KJS::AssignExprNode::):
1618 (KJS::AssignExprNode::precedence):
1619 (KJS::ExprStatementNode::):
1621 (KJS::DoWhileNode::):
1623 (KJS::ReturnNode::):
1626 (KJS::ParameterNode::):
1627 (KJS::CaseClauseNode::):
1628 (KJS::CaseClauseNode::precedence):
1629 (KJS::ClauseListNode::):
1630 (KJS::SwitchNode::):
1632 2007-11-08 Oliver Hunt <oliver@apple.com>
1636 Add a fast path for bitwise-and of two immediate numbers for a 0.7% improvement in SunSpider (4% bitop improvement).
1638 This only improves bitwise-and performance, as the additional logic required
1639 for similar code paths on or, xor, and shifting requires additional operations
1640 and branches that negate (and in certain cases, regress) any advantage we might
1643 This improves performance on all bitop tests, the cryptography tests, as well as
1644 the string-base64 and string-unpack-code tests. No significant degradation on
1647 * kjs/JSImmediate.h:
1648 (KJS::JSImmediate::areBothImmediateNumbers):
1649 (KJS::JSImmediate::andImmediateNumbers):
1651 (KJS::BitAndNode::evaluate):
1653 (KJS::jsNumberFromAnd):
1655 2007-11-08 Adam Roben <aroben@apple.com>
1657 Stop using KJS inside of MathExtras.h
1661 * wtf/MathExtras.h: Removed an unused header, and a now-unused
1662 forward-declaration.
1663 (wtf_atan2): Use std::numeric_limits intead of KJS.
1665 2007-11-08 Sam Weinig <sam@webkit.org>
1669 * kjs/date_object.cpp:
1670 (KJS::DateProtoFuncToLocaleString::callAsFunction): Fix unused arg warning.
1671 (KJS::DateProtoFuncToLocaleDateString::callAsFunction): ditto
1672 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction): ditto
1674 2007-11-08 Mark Rowe <mrowe@apple.com>
1678 * kjs/lookup.h: Add missing include.
1680 2007-11-08 Sam Weinig <sam@webkit.org>
1684 Convert JavaScript internal function objects to use one class per
1685 function. This avoids a switch statement inside what used to be
1686 the shared function classes and will allow Shark to better analyze
1689 To make this switch, the value property of the HashEntry was changed
1690 to a union of an intptr_t (which is used to continue handle valueGetters)
1691 and function pointer which points to a static constructor for the
1692 individual new function objects.
1694 SunSpider claims this is a 1.0% speedup.
1696 * kjs/array_object.cpp:
1697 (KJS::ArrayPrototype::getOwnPropertySlot):
1699 (KJS::ArrayProtoFuncToString::callAsFunction):
1700 (KJS::ArrayProtoFuncToLocaleString::callAsFunction):
1701 (KJS::ArrayProtoFuncJoin::callAsFunction):
1702 (KJS::ArrayProtoFuncConcat::callAsFunction):
1703 (KJS::ArrayProtoFuncPop::callAsFunction):
1704 (KJS::ArrayProtoFuncPush::callAsFunction):
1705 (KJS::ArrayProtoFuncReverse::callAsFunction):
1706 (KJS::ArrayProtoFuncShift::callAsFunction):
1707 (KJS::ArrayProtoFuncSlice::callAsFunction):
1708 (KJS::ArrayProtoFuncSort::callAsFunction):
1709 (KJS::ArrayProtoFuncSplice::callAsFunction):
1710 (KJS::ArrayProtoFuncUnShift::callAsFunction):
1711 (KJS::ArrayProtoFuncFilter::callAsFunction):
1712 (KJS::ArrayProtoFuncMap::callAsFunction):
1713 (KJS::ArrayProtoFuncEvery::callAsFunction):
1714 (KJS::ArrayProtoFuncForEach::callAsFunction):
1715 (KJS::ArrayProtoFuncSome::callAsFunction):
1716 (KJS::ArrayProtoFuncIndexOf::callAsFunction):
1717 (KJS::ArrayProtoFuncLastIndexOf::callAsFunction):
1718 * kjs/array_object.h:
1719 (KJS::ArrayPrototype::classInfo):
1720 * kjs/create_hash_table:
1721 * kjs/date_object.cpp:
1722 (KJS::DatePrototype::getOwnPropertySlot):
1723 (KJS::DateProtoFuncToString::callAsFunction):
1724 (KJS::DateProtoFuncToUTCString::callAsFunction):
1725 (KJS::DateProtoFuncToDateString::callAsFunction):
1726 (KJS::DateProtoFuncToTimeString::callAsFunction):
1727 (KJS::DateProtoFuncToLocaleString::callAsFunction):
1728 (KJS::DateProtoFuncToLocaleDateString::callAsFunction):
1729 (KJS::DateProtoFuncToLocaleTimeString::callAsFunction):
1730 (KJS::DateProtoFuncValueOf::callAsFunction):
1731 (KJS::DateProtoFuncGetTime::callAsFunction):
1732 (KJS::DateProtoFuncGetFullYear::callAsFunction):
1733 (KJS::DateProtoFuncGetUTCFullYear::callAsFunction):
1734 (KJS::DateProtoFuncToGMTString::callAsFunction):
1735 (KJS::DateProtoFuncGetMonth::callAsFunction):
1736 (KJS::DateProtoFuncGetUTCMonth::callAsFunction):
1737 (KJS::DateProtoFuncGetDate::callAsFunction):
1738 (KJS::DateProtoFuncGetUTCDate::callAsFunction):
1739 (KJS::DateProtoFuncGetDay::callAsFunction):
1740 (KJS::DateProtoFuncGetUTCDay::callAsFunction):
1741 (KJS::DateProtoFuncGetHours::callAsFunction):
1742 (KJS::DateProtoFuncGetUTCHours::callAsFunction):
1743 (KJS::DateProtoFuncGetMinutes::callAsFunction):
1744 (KJS::DateProtoFuncGetUTCMinutes::callAsFunction):
1745 (KJS::DateProtoFuncGetSeconds::callAsFunction):
1746 (KJS::DateProtoFuncGetUTCSeconds::callAsFunction):
1747 (KJS::DateProtoFuncGetMilliSeconds::callAsFunction):
1748 (KJS::DateProtoFuncGetUTCMilliseconds::callAsFunction):
1749 (KJS::DateProtoFuncGetTimezoneOffset::callAsFunction):
1750 (KJS::DateProtoFuncSetTime::callAsFunction):
1751 (KJS::DateProtoFuncSetMilliSeconds::callAsFunction):
1752 (KJS::DateProtoFuncSetUTCMilliseconds::callAsFunction):
1753 (KJS::DateProtoFuncSetSeconds::callAsFunction):
1754 (KJS::DateProtoFuncSetUTCSeconds::callAsFunction):
1755 (KJS::DateProtoFuncSetMinutes::callAsFunction):
1756 (KJS::DateProtoFuncSetUTCMinutes::callAsFunction):
1757 (KJS::DateProtoFuncSetHours::callAsFunction):
1758 (KJS::DateProtoFuncSetUTCHours::callAsFunction):
1759 (KJS::DateProtoFuncSetDate::callAsFunction):
1760 (KJS::DateProtoFuncSetUTCDate::callAsFunction):
1761 (KJS::DateProtoFuncSetMonth::callAsFunction):
1762 (KJS::DateProtoFuncSetUTCMonth::callAsFunction):
1763 (KJS::DateProtoFuncSetFullYear::callAsFunction):
1764 (KJS::DateProtoFuncSetUTCFullYear::callAsFunction):
1765 (KJS::DateProtoFuncSetYear::callAsFunction):
1766 (KJS::DateProtoFuncGetYear::callAsFunction):
1767 * kjs/date_object.h:
1769 (KJS::Lookup::find):
1772 (KJS::staticFunctionGetter):
1773 (KJS::staticValueGetter):
1774 (KJS::getStaticPropertySlot):
1775 (KJS::getStaticFunctionSlot):
1777 * kjs/math_object.cpp:
1778 (KJS::MathObjectImp::getOwnPropertySlot):
1779 (KJS::MathProtoFuncAbs::callAsFunction):
1780 (KJS::MathProtoFuncACos::callAsFunction):
1781 (KJS::MathProtoFuncASin::callAsFunction):
1782 (KJS::MathProtoFuncATan::callAsFunction):
1783 (KJS::MathProtoFuncATan2::callAsFunction):
1784 (KJS::MathProtoFuncCeil::callAsFunction):
1785 (KJS::MathProtoFuncCos::callAsFunction):
1786 (KJS::MathProtoFuncExp::callAsFunction):
1787 (KJS::MathProtoFuncFloor::callAsFunction):
1788 (KJS::MathProtoFuncLog::callAsFunction):
1789 (KJS::MathProtoFuncMax::callAsFunction):
1790 (KJS::MathProtoFuncMin::callAsFunction):
1791 (KJS::MathProtoFuncPow::callAsFunction):
1792 (KJS::MathProtoFuncRandom::callAsFunction):
1793 (KJS::MathProtoFuncRound::callAsFunction):
1794 (KJS::MathProtoFuncSin::callAsFunction):
1795 (KJS::MathProtoFuncSqrt::callAsFunction):
1796 (KJS::MathProtoFuncTan::callAsFunction):
1797 * kjs/math_object.h:
1798 (KJS::MathObjectImp::classInfo):
1799 (KJS::MathObjectImp::):
1800 * kjs/string_object.cpp:
1801 (KJS::StringPrototype::getOwnPropertySlot):
1802 (KJS::StringProtoFuncToString::callAsFunction):
1803 (KJS::StringProtoFuncValueOf::callAsFunction):
1804 (KJS::StringProtoFuncCharAt::callAsFunction):
1805 (KJS::StringProtoFuncCharCodeAt::callAsFunction):
1806 (KJS::StringProtoFuncConcat::callAsFunction):
1807 (KJS::StringProtoFuncIndexOf::callAsFunction):
1808 (KJS::StringProtoFuncLastIndexOf::callAsFunction):
1809 (KJS::StringProtoFuncMatch::callAsFunction):
1810 (KJS::StringProtoFuncSearch::callAsFunction):
1811 (KJS::StringProtoFuncReplace::callAsFunction):
1812 (KJS::StringProtoFuncSlice::callAsFunction):
1813 (KJS::StringProtoFuncSplit::callAsFunction):
1814 (KJS::StringProtoFuncSubstr::callAsFunction):
1815 (KJS::StringProtoFuncSubstring::callAsFunction):
1816 (KJS::StringProtoFuncToLowerCase::callAsFunction):
1817 (KJS::StringProtoFuncToUpperCase::callAsFunction):
1818 (KJS::StringProtoFuncToLocaleLowerCase::callAsFunction):
1819 (KJS::StringProtoFuncToLocaleUpperCase::callAsFunction):
1820 (KJS::StringProtoFuncLocaleCompare::callAsFunction):
1821 (KJS::StringProtoFuncBig::callAsFunction):
1822 (KJS::StringProtoFuncSmall::callAsFunction):
1823 (KJS::StringProtoFuncBlink::callAsFunction):
1824 (KJS::StringProtoFuncBold::callAsFunction):
1825 (KJS::StringProtoFuncFixed::callAsFunction):
1826 (KJS::StringProtoFuncItalics::callAsFunction):
1827 (KJS::StringProtoFuncStrike::callAsFunction):
1828 (KJS::StringProtoFuncSub::callAsFunction):
1829 (KJS::StringProtoFuncSup::callAsFunction):
1830 (KJS::StringProtoFuncFontcolor::callAsFunction):
1831 (KJS::StringProtoFuncFontsize::callAsFunction):
1832 (KJS::StringProtoFuncAnchor::callAsFunction):
1833 (KJS::StringProtoFuncLink::callAsFunction):
1834 * kjs/string_object.h:
1836 2007-11-08 Adam Roben <aroben@apple.com>
1840 Reviewed by Sam and Ada.
1842 * wtf/MathExtras.h: Get rid of a circular #include dependency to fix
1845 2007-11-08 Adam Roben <aroben@apple.com>
1847 Fix a precedence warning on Windows
1849 * kjs/JSImmediate.h:
1850 (KJS::JSImmediate::toBoolean):
1852 2007-11-08 Mark Rowe <mrowe@apple.com>
1854 Build fix for JavaScriptGlue.
1856 * wtf/MathExtras.h: Include stdlib.h for srand and RAND_MAX.
1858 2007-11-08 Darin Adler <darin@apple.com>
1862 * kjs/JSImmediate.h: Include MathExtras.h rather than math.h since this file uses "signbit".
1864 2007-11-08 Oliver Hunt <oliver@apple.com>
1868 Replace the use of floats for immediate values with the use of integers for a 4.5% improvement in SunSpider.
1870 Unfortunately this change results in NaN, +Inf, -Inf, and -0 being heap allocated now, but
1871 we should now have faster array access, faster immediate to double conversion, and the
1872 potential to further improve bitwise operators in future.
1874 This also removes the need for unions to avoid strict aliasing problems when extracting
1875 a value from immediates.
1877 * kjs/JSImmediate.h:
1879 (KJS::JSImmediate::trueImmediate):
1880 (KJS::JSImmediate::falseImmediate):
1881 (KJS::JSImmediate::undefinedImmediate):
1882 (KJS::JSImmediate::nullImmediate):
1883 (KJS::JSImmediate::toBoolean):
1887 2007-11-07 Eric Seidel <eric@webkit.org>
1889 Reviewed by Darin and Oliver.
1891 Add evaluateToNumber parallel evaluation tree to speed up number operations.
1892 Make ImmediateNumberNode a subclass of NumberNode.
1893 Share evaluate logic between evaluate and evaluateToNumber using inline functions
1894 There is still a lot of improvement to be made here.
1896 SunSpider claims this is a 1.0% speedup overall (nbody 7.9%), base64 slowing 2.0%
1897 Given the huge win that this prepares us for with simple type inferencing I see the small
1898 regression in base64 being worth the substantial overall improvement.
1902 (KJS::Node::evaluateToNumber):
1903 (KJS::NumberNode::evaluate):
1904 (KJS::NumberNode::evaluateToNumber):
1905 (KJS::StringNode::evaluateToNumber):
1906 (KJS::LocalVarAccessNode::inlineEvaluate):
1907 (KJS::LocalVarAccessNode::evaluate):
1908 (KJS::LocalVarAccessNode::evaluateToNumber):
1909 (KJS::BracketAccessorNode::inlineEvaluate):
1910 (KJS::BracketAccessorNode::evaluate):
1911 (KJS::BracketAccessorNode::evaluateToNumber):
1912 (KJS::NegateNode::evaluate):
1913 (KJS::NegateNode::evaluateToNumber):
1914 (KJS::MultNode::inlineEvaluateToNumber):
1915 (KJS::MultNode::evaluate):
1916 (KJS::MultNode::evaluateToNumber):
1917 (KJS::DivNode::inlineEvaluateToNumber):
1918 (KJS::DivNode::evaluate):
1919 (KJS::DivNode::evaluateToNumber):
1920 (KJS::ModNode::inlineEvaluateToNumber):
1921 (KJS::ModNode::evaluate):
1922 (KJS::ModNode::evaluateToNumber):
1923 (KJS::throwOutOfMemoryErrorToNumber):
1924 (KJS::addSlowCaseToNumber):
1927 (KJS::AddNode::evaluateToNumber):
1928 (KJS::SubNode::inlineEvaluateToNumber):
1929 (KJS::SubNode::evaluate):
1930 (KJS::SubNode::evaluateToNumber):
1931 (KJS::valueForReadModifyAssignment):
1932 (KJS::ReadModifyLocalVarNode::evaluate):
1933 (KJS::ReadModifyResolveNode::evaluate):
1934 (KJS::ReadModifyDotNode::evaluate):
1935 (KJS::ReadModifyBracketNode::evaluate):
1938 (KJS::NumberNode::):
1939 (KJS::ImmediateNumberNode::):
1940 (KJS::AddNode::precedence):
1941 * kjs/nodes2string.cpp:
1942 (KJS::NumberNode::streamTo):
1944 2007-11-07 Mark Rowe <mrowe@apple.com>
1948 Fix up initialization after being mangled in r27572, and remove the
1949 ternary expression as extraCost will always be zero for the numeric
1952 * kjs/collector.cpp:
1953 (KJS::Collector::heapAllocate):
1955 2007-11-07 Mark Rowe <mrowe@apple.com>
1959 * kjs/regexp_object.cpp:
1961 2007-11-07 Geoffrey Garen <ggaren@apple.com>
1963 Reviewed by Beth Dakin.
1965 Eliminated a bogus (though compiled-out) branch in the collector.
1967 * kjs/collector.cpp:
1968 (KJS::Collector::heapAllocate):
1970 2007-11-06 Geoffrey Garen <ggaren@apple.com>
1972 Reviewed by Darin Adler.
1974 Fixed part of http://bugs.webkit.org/show_bug.cgi?id=15861
1975 5.8% of string-validate-input.js is spent creating RegExpImps
1977 Put RegExpImp properties into a static hashtable to avoid a slew of
1978 PropertyMap churn when creating a RegExpImp.
1980 Factored important bits of regular expression implementation out of
1981 RegExpImp (the JS object) and into RegExp (the PCRE wrapper class),
1982 making RegExp a ref-counted class. (This will help later.)
1984 Removed PCRE_POSIX support because I didn't quite know how to test it
1985 and keep it working with these changes.
1987 1.1% SunSpider speedup. 5.8% speedup on string-validate-input.js.
1989 * kjs/regexp.h: A few interface changes:
1990 1. Renamed "subpatterns()" => "numSubpatterns()"
1991 2. Made flag enumeration private and replaced it with public getters for
1993 3. Made RegExp ref-counted so RegExps can be shared by RegExpImps.
1994 4. Made RegExp take a string of flags instead of an int, eliminating
1995 duplicated flag parsing code elsewhere.
1997 * kjs/regexp_object.cpp:
1998 (KJS::RegExpProtoFunc::callAsFunction): For RegExp.compile:
1999 - Fixed a bug where compile(undefined) would throw an exception.
2000 - Removed some now-redundant code.
2001 - Used RegExp sharing to eliminate an allocation and a bunch of
2002 PropertyMap thrash. (Not a big win since compile is a deprecated
2003 function. I mainly did this to test the plubming.)
2005 2007-11-07 Simon Hausmann <hausmann@kde.org>
2007 Reviewed by nobody, Qt/Windows build fix.
2009 JavaScriptCore.pri expects OBJECTS_DIR to be set, so set it in
2010 testkjs.pro, too, where it's included from.
2014 2007-11-07 Simon Hausmann <shausman@trolltech.com>
2018 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.
2020 * JavaScriptCore.pri:
2023 2007-11-07 Lars Knoll <lars@trolltech.com>
2029 Pretty embarrassing bug. Has the potential to fix quite a few test failures.
2031 * wtf/unicode/qt4/UnicodeQt4.h:
2032 (WTF::Unicode::umemcasecmp):
2034 2007-11-06 Maciej Stachowiak <mjs@apple.com>
2038 - only collect when the heap is full, unless we have lots of extra cost garbage
2040 1.1% SunSpider speedup.
2042 This shouldn't hit memory use much since the extra space in those
2043 blocks hangs around either way.
2045 * kjs/collector.cpp:
2046 (KJS::Collector::heapAllocate):
2047 (KJS::Collector::collect): Fix logic error that reversed the sense of collect's
2050 2007-11-06 Oliver Hunt <oliver@apple.com>
2054 Avoid unnecessarily boxing the result from post inc/decrement for 0.3% gain in sunspider
2056 We now convert the common 'for (...; ...; <var>++) ...' to the semantically identical
2057 'for (...; ...; ++<var>) ...'.
2060 (KJS::PostIncResolveNode::optimizeForUnnecessaryResult):
2061 (KJS::PostIncLocalVarNode::evaluate):
2062 (KJS::PostIncLocalVarNode::optimizeForUnnecessaryResult):
2063 (KJS::PostDecResolveNode::optimizeForUnnecessaryResult):
2064 (KJS::PostDecLocalVarNode::evaluate):
2065 (KJS::PostDecLocalVarNode::optimizeForUnnecessaryResult):
2067 (KJS::PrePostResolveNode::):
2068 (KJS::PostIncResolveNode::):
2069 (KJS::PostIncLocalVarNode::):
2070 (KJS::PostDecResolveNode::):
2071 (KJS::PostDecLocalVarNode::):
2072 (KJS::PreIncResolveNode::):
2073 (KJS::PreDecResolveNode::):
2074 (KJS::ForNode::ForNode):
2076 2007-11-06 Eric Seidel <eric@webkit.org>
2080 This fixes a regressed layout test for string + object
2082 SunSpider claims this was an overall 0.3% speedup, although some individual tests were slower.
2085 (KJS::add): remove erroneous "fast path" for string + *
2087 2007-11-06 Geoffrey Garen <ggaren@apple.com>
2089 Reviewed by Eric Seidel.
2091 Added toJSNumber, a fast path for converting a JSValue to a JS number,
2092 and deployed it in postfix expressions. In the fast case this
2093 eliminates a call to jsNumber.
2095 0.4% speedup on SunSpider.
2099 (KJS::PostIncResolveNode::evaluate):
2100 (KJS::PostIncLocalVarNode::evaluate):
2101 (KJS::PostDecResolveNode::evaluate):
2102 (KJS::PostDecLocalVarNode::evaluate):
2103 (KJS::PostIncBracketNode::evaluate):
2104 (KJS::PostDecBracketNode::evaluate):
2105 (KJS::PostIncDotNode::evaluate):
2106 (KJS::PostDecDotNode::evaluate):
2107 (KJS::UnaryPlusNode::evaluate):
2109 (KJS::JSValue::toJSNumber):
2111 2007-11-06 Darin Adler <darin@apple.com>
2115 - http://bugs.webkit.org/show_bug.cgi?id=15846
2116 REGRESSION (r27387): Memory corruption when running fast/js/kde/delete.html
2118 There was a mistake in the algorithm used to find an empty slot in the property
2119 map entries vector; when we were putting in a new property value and not overwriting
2120 an existing deleted sentinel, we would enlarge the entries vector, but would not
2121 overwrite the stale data that's in the new part. It was easy to pin this down by
2122 turning on property map consistency checks -- I never would have landed with this
2123 bug if I had run the regression tests once with consistency checks on!
2125 * kjs/property_map.cpp: (KJS::PropertyMap::put): Changed logic for the case where
2126 foundDeletedElement is false to always use the item at the end of the entries vector.
2127 Also allowed me to merge with the logic for the "no deleted sentinels at all" case.
2129 2007-11-06 Oliver Hunt <oliver@apple.com>
2133 Fix previous patch to use a 3 bit shift, a 16 bit shift causes a regression in sunspider.
2138 2007-11-06 Oliver Hunt <oliver@apple.com>
2142 Replace boolean comparisons in AddNode with mask
2143 comparisons for a 0.2% improvement in sunspider.
2145 * JavaScriptCore.xcodeproj/project.pbxproj:
2149 2007-11-06 Eric Seidel <eric@webkit.org>
2153 SunSpider claims this is a 1.1% speedup.
2156 (KJS::throwOutOfMemoryError): Added, non inline.
2157 (KJS::addSlowCase): renamed from add(), non inline.
2158 (KJS::add): add fast path for String + String, Number + Number and String + *
2160 2007-11-06 Eric Seidel <eric@webkit.org>
2164 Avoid more UString creation.
2166 SunSpider claims this is a 0.4% speedup.
2168 * kjs/regexp_object.cpp:
2169 (KJS::RegExpObjectImp::construct): use UString::find(UChar)
2171 2007-11-05 Mark Rowe <mrowe@apple.com>
2175 * kjs/array_object.cpp:
2176 (KJS::ArrayProtoFunc::callAsFunction):
2178 2007-11-05 Adam Roben <aroben@apple.com>
2184 2007-11-05 Mark Rowe <mrowe@apple.com>
2186 Build fix. Add missing #include.
2188 * kjs/operations.cpp:
2190 2007-11-05 Eric Seidel <eric@webkit.org>
2194 Remove another call to toString(exec)
2196 SunSpider claims this is a 0.5% speedup.
2198 * kjs/operations.cpp:
2199 (KJS::equal): remove another toString
2201 2007-11-05 Eric Seidel <eric@webkit.org>
2203 * kjs/operations.cpp:
2204 (KJS::equal): correct broken change.
2206 2007-11-05 Eric Seidel <eric@webkit.org>
2210 Remove one more call to toString(exec).
2212 SunSpider claims this is a 0.7% speedup.
2214 * kjs/operations.cpp:
2215 (KJS::equal): remove a call to toString()
2217 2007-11-05 Mark Rowe <mrowe@apple.com>
2223 2007-11-05 Mark Rowe <mrowe@apple.com>
2229 2007-11-05 Geoffrey Garen <ggaren@apple.com>
2231 Touched a file to test my new HTTP access.
2233 * kjs/scope_chain.cpp:
2235 2007-11-05 Alp Toker <alp@atoker.com>
2237 Unreviewed build fix for qmake-based ports.
2239 Someone with a better understanding of qmake still needs to sort out
2240 the INCLUDEPATH/DEPENDPATH mess.
2242 * JavaScriptCore.pri:
2244 2007-11-05 Geoffrey Garen <ggaren@apple.com>
2246 Reviewed by Darin Adler.
2248 http://bugs.webkit.org/show_bug.cgi?id=15835
2250 Switched List implementation from a custom heap allocator to an inline
2251 Vector, for a disappointing .5% SunSpider speedup.
2253 Also renamed List::slice to List::getSlice because "get" is the
2254 conventional prefix for functions returning a value through an out
2257 * kjs/array_object.cpp:
2258 (KJS::ArrayProtoFunc::callAsFunction): Removed some redundant function
2259 calls and memory accesses.
2261 * kjs/bool_object.cpp:
2262 (BooleanObjectImp::construct): Removed questionable use of iterator.
2265 * kjs/list.h: New List class, implemented in terms of Vector. Two
2266 interesting differences:
2267 1. The inline capacity is 8, not 5. Many of the Lists constructed
2268 during a SunSpider run are larger than 5; almost none are larger
2271 2. The growth factor is 4, not 2. Since we can guarantee that Lists
2272 aren't long-lived, we can grow them more aggressively, to avoid
2275 * kjs/regexp_object.cpp:
2276 (RegExpObjectImp::construct): Removed redundant function calls.
2278 * kjs/string_object.cpp:
2279 (KJS::StringObjectImp::construct): Removed questionable use of iterator.
2282 (WTF::::uncheckedAppend): Added a fast, unchecked version of append.
2284 2007-11-05 Mark Rowe <mrowe@apple.com>
2286 Reviewed by Alp Toker.
2288 Add DEPENDPATH to JavaScriptCore and pcre to help qmake with dependencies.
2290 * JavaScriptCore.pri:
2293 2007-11-04 Darin Adler <darin@apple.com>
2297 - http://bugs.webkit.org/show_bug.cgi?id=15826
2298 optimize opcode loop and case insensitive ASCII compares for a 30% speedup
2300 SunSpider says it's 2.6% faster overall, 32.5% in the regular expression tests.
2302 * pcre/pcre_internal.h: Added OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
2304 * pcre/pcre_compile.c:
2305 (find_fixedlength): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC. Also
2306 added OP_NOT since there was no reason it should not be in here.
2307 (could_be_empty_branch): Ditto.
2308 (compile_branch): Streamlined all the single-character cases; there was a bit of
2309 duplicate code. Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC as needed.
2310 But in particular, compile to those opcodes when the single character match is
2312 (find_firstassertedchar): Added cases for OP_ASCII_CHAR and OP_ASCII_LETTER_NC.
2314 * pcre/pcre_exec.c: (match): Removed the "min", "minimize", and "op" fields from
2315 the matchframe, after I discovered that none of them needed to be saved and restored
2316 across recursive match calls. Also eliminated the ignored result field from the
2317 matchframe, since I discovered that rrc ("recursive result code") was already the
2318 exact same thing. Moved the handling of opcodes higher than OP_BRA into the default
2319 statement of the switch instead of doing them before the switch. This removes a
2320 branch from each iteration of the opcode interpreter, just as removal of "op"
2321 removed at least one store from each iteration. Last, but not least, add the
2322 OP_ASCII_CHAR and OP_ASCII_LETTER_NC functions. Neither can ever match a
2323 surrogate pair and the letter case can be handled efficiently.
2325 2007-11-04 Darin Adler <darin@apple.com>
2327 * pcre/pcre_exec.c: (match): Try to fix the Windows build by removing unreachable code.
2329 2007-11-03 Darin Adler <darin@apple.com>
2331 - fix non-Mac builds; remove some more unused PCRE stuff
2333 * pcre/pcre_compile.c:
2334 (compile_branch): Removed branch chain and some unused ESC values.
2335 (compile_regex): Ditto.
2336 (jsRegExpCompile): Ditto.
2338 (match): Removed unused branch targets. Don't use macros any more.
2339 (jsRegExpExecute): More of the same.
2341 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Update for removed files.
2342 * JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
2343 * pcre/pcre.pri: Ditto.
2345 * pcre/MERGING: Removed.
2346 * pcre/pcre_fullinfo.c: Removed.
2347 * pcre/pcre_get.c: Removed.
2348 * pcre/pcre_internal.h:
2349 * pcre/ucp.h: Removed.
2351 2007-11-03 Darin Adler <darin@apple.com>
2355 - http://bugs.webkit.org/show_bug.cgi?id=15821
2356 remove unused PCRE features for speed
2358 A first step toward removing the PCRE features we don't use.
2359 This gives a 0.8% speedup on SunSpider, and a 6.5% speedup on
2360 the SunSpider regular expression test.
2362 Replaced the public interface with one that doesn't use the
2363 name PCRE. Removed code we don't need for JavaScript and various
2364 configurations we don't use. This is in preparation for still
2365 more changes in the future. We'll probably switch to C++ and
2366 make some even more significant changes to the regexp engine
2367 to get some additional speed.
2369 There's probably additional unused stuff that I haven't
2372 This does mean that our PCRE is now a fork, but I think that's
2373 not really a big deal.
2375 * JavaScriptCore.exp: Remove the 5 old entry points and add
2376 the 3 new entry points for WebCore's direct use of the regular
2379 * kjs/config.h: Remove the USE(PCRE16) define. I decided to flip
2380 its sense and now there's a USE(POSIX_REGEX) instead, which should
2381 probably not be set by anyone. Maybe later we'll just get rid of it
2386 (KJS::RegExp::RegExp): Switch to new jsRegExp function names and
2387 defines. Cut down on the number of functions used.
2388 (KJS::RegExp::~RegExp): Ditto.
2389 (KJS::RegExp::match): Ditto.
2391 * pcre/dftables.c: (main): Get rid of ctype_letter and ctype_meta,
2394 * pcre/pcre-config.h: Get rid of EBCIDIC, PCRE_DATA_SCOPE, const,
2395 size_t, HAVE_STRERROR, HAVE_MEMMOVE, HAVE_BCOPY, NEWLINE,
2396 POSIX_MALLOC_THRESHOLD, NO_RECURSE, SUPPORT_UCP, SUPPORT_UTF8,
2397 and JAVASCRIPT. These are all no longer configurable in our copy
2400 * pcre/pcre.h: Remove the macro-based kjs prefix hack, the PCRE
2401 version macros, PCRE_UTF16, the code to set up PCRE_DATA_SCOPE,
2402 the include of <stdlib.h>, and most of the constants and
2403 functions defined in this header. Changed the naming scheme to
2404 use a JSRegExp prefix rather than a pcre prefix. In the future,
2405 we'll probably change this to be a C++ header.
2407 * pcre/pcre_compile.c: Removed all unused code branches,
2408 including many whole functions and various byte codes.
2409 Kept changes outside of removal to a minimum.
2411 (first_significant_code):
2414 (could_be_empty_branch):
2419 (find_firstassertedchar):
2420 (jsRegExpCompile): Renamed from pcre_compile2 and changed the
2421 parameters around a bit.
2422 (jsRegExpFree): Added.
2424 * pcre/pcre_exec.c: Removed many unused opcodes and variables.
2425 Also started tearing down the NO_RECURSE mechanism since it's
2426 now the default. In some cases there were things in the explicit
2427 frame that could be turned into plain old local variables and
2428 other small like optimizations.
2431 (match): Changed parameters quite a bit since it's now not used
2433 (jsRegExpExecute): Renamed from pcre_exec.
2435 * pcre/pcre_internal.h: Get rid of PCRE_DEFINITION, PCRE_SPTR,
2436 PCRE_IMS, PCRE_ICHANGED, PCRE_NOPARTIAL, PCRE_STUDY_MAPPED,
2437 PUBLIC_OPTIONS, PUBLIC_EXEC_OPTIONS, PUBLIC_DFA_EXEC_OPTIONS,
2438 PUBLIC_STUDY_OPTIONS, MAGIC_NUMBER, 16 of the opcodes,
2439 _pcre_utt, _pcre_utt_size, _pcre_try_flipped, _pcre_ucp_findprop,
2440 and _pcre_valid_utf8. Also moved pcre_malloc and pcre_free here.
2442 * pcre/pcre_maketables.c: Changed to only compile in dftables.
2443 Also got rid of many of the tables that we don't use.
2445 * pcre/pcre_tables.c: Removed the unused Unicode property tables.
2447 * pcre/pcre_ucp_searchfuncs.c: Removed everything except for
2448 _pcre_ucp_othercase.
2450 * pcre/pcre_xclass.c: (_pcre_xclass): Removed uneeded support
2451 for classes based on Unicode properties.
2453 * wtf/FastMallocPCRE.cpp: Removed unused bits. It would be good
2454 to eliminate this completely, but we need the regular expression
2455 code to be C++ first.
2457 * pcre/pcre_fullinfo.c:
2460 Files that are no longer needed. I didn't remove them with this
2461 check-in, because I didn't want to modify all the project files.
2463 2007-11-03 Maciej Stachowiak <mjs@apple.com>
2467 - remove NaN check from JSImmediate::fromDouble for 0.5% SunSpider speedup
2469 It turns out that doing this check costs more than it saves.
2471 * kjs/JSImmediate.h:
2472 (KJS::JSImmediate::fromDouble):
2474 2007-11-03 Sam Weinig <sam@webkit.org>
2478 Remove dummy variable from ClassInfo reducing the size of the struct by 1 word.
2479 The variable had been kept around for binary compatibility, but since nothing
2480 else is there is no point in continuing to keep it around.
2482 * API/JSCallbackConstructor.cpp:
2484 * API/JSCallbackFunction.cpp:
2486 * API/JSCallbackObject.cpp:
2488 * bindings/objc/objc_runtime.mm:
2489 * bindings/runtime_array.cpp:
2490 * bindings/runtime_object.cpp:
2491 * kjs/array_instance.cpp:
2493 * kjs/array_object.cpp:
2495 * kjs/bool_object.cpp:
2496 * kjs/date_object.cpp:
2498 * kjs/error_object.cpp:
2504 * kjs/math_object.cpp:
2505 * kjs/number_object.cpp:
2507 * kjs/regexp_object.cpp:
2508 * kjs/string_object.cpp:
2511 2007-11-03 Kevin McCullough <kmccullough@apple.com>
2513 - Updated testkjs results to make the build bots green until we
2514 can fix the tests that are failing. The new failures are in DST.
2516 * tests/mozilla/expected.html:
2518 2007-11-03 Maciej Stachowiak <mjs@apple.com>
2522 - don't print the var twice for ForInNodes with a var declaration
2524 * kjs/nodes2string.cpp:
2525 (KJS::ForInNode::streamTo):
2527 2007-11-03 Darin Adler <darin@apple.com>
2529 * pcre/pcre_compile.c: (check_escape): Windows build fix. Get rid of
2530 C-incompatible declaration.
2532 2007-11-03 Mark Rowe <mrowe@apple.com>
2536 * kjs/nodes.cpp: Add missing include.
2538 2007-11-03 Darin Adler <darin@apple.com>
2542 - fix http://bugs.webkit.org/show_bug.cgi?id=15814
2543 <rdar://problem/5536644> fast/js/kde/encode_decode_uri.html fails
2545 These changes cause us to match the JavaScript specification and pass the
2546 fast/js/kde/encode_decode_uri.html test.
2548 * kjs/function.cpp: (KJS::encode): Call the UTF-8 string conversion in its
2549 new strict mode, throwing an exception if there are malformed UTF-16 surrogate
2552 * kjs/ustring.h: Added a strict version of the UTF-8 string conversion.
2554 (KJS::decodeUTF8Sequence): Removed code to disallow U+FFFE and U+FFFF; while
2555 those might be illegal in some sense, they aren't supposed to get any special
2556 handling in the place where this function is currently used.
2557 (KJS::UString::UTF8String): Added the strictness.
2559 2007-11-03 Darin Adler <darin@apple.com>
2563 - http://bugs.webkit.org/show_bug.cgi?id=15812
2564 some JavaScript tests (from the Mozilla test suite) are failing
2566 Two or three fixes get 7 more of the Mozilla tests passing.
2567 This gets us down from 61 failing tests to 54.
2569 * kjs/interpreter.h: (KJS::Interpreter::builtinRegExp):
2570 Made this inline and gave it a more specific type. Some day we should
2571 probably do that for all of these -- might even get a bit of a speed
2573 * kjs/interpreter.cpp: Removed Interpreter::builtinRegExp now that it's
2574 inline in the header.
2576 * kjs/regexp_object.h:
2577 * kjs/regexp_object.cpp:
2578 (KJS::RegExpProtoFunc::callAsFunction): Moved test and exec out of the
2579 switch statement into the RegExpImp object, so they can be shared with
2580 RegExpImp::callAsFunction.
2581 (KJS::RegExpImp::match): Added. Common code used by both test and exec.
2582 (KJS::RegExpImp::test): Added.
2583 (KJS::RegExpImp::exec): Added.
2584 (KJS::RegExpImp::implementsCall): Added.
2585 (KJS::RegExpImp::callAsFunction): Added.
2586 (KJS::RegExpObjectImpPrivate::RegExpObjectImpPrivate): Initialize
2587 lastInput to null rather than empty string -- we take advantage of the
2588 difference in RegExpImp::match.
2589 (KJS::RegExpObjectImp::input): Added. No reason to go through hash tables
2590 just to get at a field like this.
2592 * pcre/pcre_compile.c: (check_escape): Changed the \u handling to match
2593 the JavaScript specification. If there are not 4 hex digits after the \u,
2594 then it's processed as if it wasn't an escape sequence at all.
2596 * pcre/pcre_internal.h: Added IS_NEWLINE, with the appropriate definition
2597 for JavaScript (4 specific Unicode values).
2599 (match): Changed all call sites to use IS_NEWLINE.
2602 * tests/mozilla/expected.html: Updated to expect 7 more successful tests.
2604 2007-11-03 David D. Kilzer <ddkilzer@webkit.org>
2606 Sort files(...); sections of Xcode project files.
2608 Rubber-stamped by Darin.
2610 * JavaScriptCore.xcodeproj/project.pbxproj:
2612 2007-11-03 Maciej Stachowiak <mjs@apple.com>
2616 - remove VarDeclListNode and simplify VarDeclNode evaluation for 0.4% SunSpider speedup
2620 (KJS::VarDeclNode::optimizeVariableAccess):
2621 (KJS::VarDeclNode::getDeclarations):
2622 (KJS::VarDeclNode::handleSlowCase):
2623 (KJS::VarDeclNode::evaluateSingle):
2624 (KJS::VarDeclNode::evaluate):
2625 (KJS::VarStatementNode::execute):
2627 (KJS::VarDeclNode::):
2628 (KJS::VarStatementNode::):
2629 * kjs/nodes2string.cpp:
2630 (KJS::VarDeclNode::streamTo):
2632 2007-11-03 Alexey Proskuryakov <ap@webkit.org>
2636 http://bugs.webkit.org/show_bug.cgi?id=15800
2637 REGRESSION (r27303): RegExp leaks
2639 * kjs/regexp_object.h:
2640 (KJS::RegExpImp::setRegExp):
2641 (KJS::RegExpImp::regExp):
2642 (KJS::RegExpImp::classInfo):
2643 * kjs/regexp_object.cpp:
2644 (RegExpImp::RegExpImp):
2645 (RegExpImp::~RegExpImp):
2646 Renamed reg member variable to m_regExp, changed it to use OwnPtr.
2648 2007-11-02 Maciej Stachowiak <mjs@apple.com>
2652 - add SourceElements as a typedef for Vector<RefPtr<StatementNode> >.
2656 (KJS::statementListPushFIFO):
2657 (KJS::statementListGetDeclarations):
2658 (KJS::statementListInitializeDeclarationStacks):
2659 (KJS::statementListInitializeVariableAccessStack):
2660 (KJS::statementListExecute):
2661 (KJS::BlockNode::BlockNode):
2662 (KJS::FunctionBodyNode::FunctionBodyNode):
2663 (KJS::ProgramNode::ProgramNode):
2665 (KJS::CaseClauseNode::):
2667 2007-11-02 Darin Adler <darin@apple.com>
2671 - http://bugs.webkit.org/show_bug.cgi?id=15791
2672 change property map data structure for less memory use, better speed
2674 The property map now has an array of indices and a separate array of
2675 property map entries. This slightly slows down lookup because of a second
2676 memory acess, but makes property maps smaller and faster to iterate in
2677 functions like mark().
2679 SunSpider says this is 1.2% faster, although it makes the bitwise-end test
2680 more than 10% slower. To fix that we'll need to optimize global variable lookup.
2682 * kjs/property_map.cpp:
2683 (KJS::PropertyMapEntry::PropertyMapEntry):
2684 (KJS::PropertyMapHashTable::entries):
2685 (KJS::PropertyMapHashTable::allocationSize):
2686 (KJS::SavedProperties::SavedProperties):
2687 (KJS::SavedProperties::~SavedProperties):
2688 (KJS::PropertyMap::checkConsistency):
2689 (KJS::PropertyMap::~PropertyMap):
2690 (KJS::PropertyMap::clear):
2691 (KJS::PropertyMap::get):
2692 (KJS::PropertyMap::getLocation):
2693 (KJS::PropertyMap::put):
2694 (KJS::PropertyMap::insert):
2695 (KJS::PropertyMap::createTable):
2696 (KJS::PropertyMap::rehash):
2697 (KJS::PropertyMap::remove):
2698 (KJS::PropertyMap::mark):
2699 (KJS::comparePropertyMapEntryIndices):
2700 (KJS::PropertyMap::containsGettersOrSetters):
2701 (KJS::PropertyMap::getEnumerablePropertyNames):
2702 (KJS::PropertyMap::save):
2703 (KJS::PropertyMap::restore):
2704 * kjs/property_map.h:
2706 2007-11-02 Darin Adler <darin@apple.com>
2710 - http://bugs.webkit.org/show_bug.cgi?id=15807
2711 HashMap needs a take() function that combines get and remove
2713 * wtf/HashMap.h: Added take function. Simplistic implementation for now,
2714 but still does only one hash table lookup.
2716 * kjs/array_instance.cpp: (KJS::ArrayInstance::put): Use take rather than
2717 a find followed by a remove.
2719 2007-11-02 David Carson <dacarson@gmail.com>
2723 Fix compiler warning "warning: suggest parentheses around && within ||"
2724 http://bugs.webkit.org/show_bug.cgi?id=15764
2726 * kjs/value.h: (KJS::JSValue::isNumber): Add parentheses.
2728 2007-11-01 Geoffrey Garen <ggaren@apple.com>
2730 Reviewed by Maciej Stachowiak.
2732 In preparation for making List a simple stack-allocated Vector:
2734 Removed all instances of List copying and/or assignment, and made List
2735 inherit from Noncopyable.
2737 Functions that used to return a List by copy now take List& out
2740 Layout tests and JS tests pass.
2743 (KJS::List::slice): Replaced copyTail with a more generic slice
2744 alternative. (JavaScriptCore only calls slice(1), but WebCore calls
2747 2007-11-01 Geoffrey Garen <ggaren@apple.com>
2749 Reviewed by Maciej Stachowiak.
2751 Fixed http://bugs.webkit.org/show_bug.cgi?id=15785
2752 REGRESSION(r27344): Crash on load at finance.yahoo.com
2754 Reverted a small portion of my last check-in. (The speedup and the List
2755 removal are still there, though.)
2757 ActivationImp needs to hold a pointer to its function, and mark that
2758 pointer (rather than accessing its function through its ExecState, and
2759 counting on the active scope to mark its function) because a closure
2760 can cause an ActivationImp to outlive its ExecState along with any
2763 * kjs/ExecState.cpp:
2764 (KJS::ExecState::ExecState):
2766 (KJS::FunctionImp::~FunctionImp):
2767 (KJS::ActivationImp::ActivationImp):
2769 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
2771 Also made HashTable a little more crash-happy in debug builds, so
2772 problems like this will show up earlier:
2775 (WTF::HashTable::~HashTable):
2777 2007-11-01 Geoffrey Garen <ggaren@apple.com>
2779 Reviewed by Adam Roben.
2781 Addressed some of Darin's review comments.
2783 Used perl -p, which is the shorthand while(<>) {}.
2785 Made sure not to suppress bison's output.
2787 Added line to removed bison_out.txt, since this script removes other
2788 intermediate files, too.
2790 * DerivedSources.make:
2792 2007-11-01 Geoffrey Garen <ggaren@apple.com>
2794 Reviewed by Oliver Hunt.
2796 Removed List from ActivationImp, in preparation for making all lists
2801 1.0% speedup on SunSpider, presumably due to reduced List refcount thrash.
2803 * kjs/ExecState.cpp:
2804 (KJS::ExecState::ExecState):
2805 (KJS::ExecState::~ExecState):
2807 (KJS::ActivationImp::ActivationImp):
2808 (KJS::ActivationImp::createArgumentsObject):
2810 (KJS::ActivationImp::ActivationImpPrivate::ActivationImpPrivate):
2812 2007-11-01 Adam Roben <aroben@apple.com>
2814 Use jsNumberCell instead of jsNumber when converting double constants to JSValues
2816 This fixes fast/js/math.html, ecma/Date/15.9.5.10-1.js, and
2817 ecma/Date/15.9.5.12-1.js, which were suffering from a bug in MSVC.
2819 It also gets rid of an MSVC warning that we previously had to silence.
2823 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Turn
2824 back on the "overflow in constant arithmetic" warning.
2825 * kjs/number_object.cpp:
2826 (NumberObjectImp::getValueProperty): Use jsNumberCell instead of
2829 2007-10-31 Adam Roben <aroben@apple.com>
2835 2007-10-31 Maciej Stachowiak <mjs@apple.com>
2839 - shave some cycles off of local storage access for a 1% SunSpider speedup
2841 Keep the LocalStorage pointer in the ExecState, instead of getting
2842 it from the ActivationImp all the time.
2844 * kjs/ExecState.cpp:
2845 (KJS::ExecState::updateLocalStorage):
2847 (KJS::ExecState::localStorage):
2849 (KJS::LocalVarAccessNode::evaluate):
2850 (KJS::LocalVarFunctionCallNode::evaluate):
2851 (KJS::PostIncLocalVarNode::evaluate):
2852 (KJS::PostDecLocalVarNode::evaluate):
2853 (KJS::LocalVarTypeOfNode::evaluate):
2854 (KJS::PreIncLocalVarNode::evaluate):
2855 (KJS::PreDecLocalVarNode::evaluate):
2856 (KJS::ReadModifyLocalVarNode::evaluate):
2857 (KJS::AssignLocalVarNode::evaluate):
2858 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
2860 2007-10-31 Adam Roben <aroben@apple.com>
2862 Fix a crash on launch due to a static initializer race
2864 We now use fast inline assembler spinlocks which can be statically
2865 initialized at compile time.
2867 As a side benefit, this speeds up SunSpider by 0.4%.
2871 * wtf/FastMalloc.cpp:
2873 (TCMalloc_SpinLock::Lock):
2874 (TCMalloc_SpinLock::Unlock):
2875 (TCMalloc_SlowLock):
2876 * wtf/TCSystemAlloc.cpp:
2878 2007-10-31 Kevin McCullough <kmccullough@apple.com>
2882 - Corrected spelling.
2886 2007-10-31 Mark Rowe <mrowe@apple.com>
2888 Further Gtk build fixage.
2890 * kjs/regexp_object.cpp:
2892 2007-10-31 Mark Rowe <mrowe@apple.com>
2898 2007-10-31 Darin Adler <darin@apple.com>
2902 - fix http://bugs.webkit.org/show_bug.cgi?id=15749
2903 RegExp/RegExpObjectImp cause needless UString creation
2905 Speeds things up 0.4% according to SunSpider.
2907 * kjs/config.h: Define USE(PCRE16) instead of HAVE(PCREPOSIX),
2908 because this library doesn't use the real PCRE -- it uses its
2909 own PCRE that works on UTF-16.
2911 * kjs/regexp.h: Removed a few unused functions. Changed the ifdef.
2912 Use Noncopyable. Change the return value of match.
2914 (KJS::RegExp::RegExp): Call pcre_compile2, for a slight speed boost.
2915 (KJS::RegExp::~RegExp): PCRE16 rather than PCREPOSIX.
2916 (KJS::RegExp::match): Change to return the position as an int and the
2917 ovector as a OwnArrayPtr<int> for efficiency and clearer storage management.
2919 * kjs/regexp_object.h: Change performMatch and arrayOfMatches to no longer
2920 require a result string.
2921 * kjs/regexp_object.cpp:
2922 (RegExpProtoFunc::callAsFunction): Update for new signature of performMatch.
2923 (RegExpObjectImp::performMatch): Change so it doesn't return a string.
2924 (RegExpObjectImp::arrayOfMatches): Simplify by unifying the handling of
2925 the main result with the backreferences; now it doesn't need to take
2927 (RegExpObjectImp::getBackref): Minor tweaks.
2928 (RegExpObjectImp::getLastParen): Ditto.
2929 (RegExpObjectImp::getLeftContext): Ditto.
2930 (RegExpObjectImp::getRightContext): Ditto.
2931 (RegExpObjectImp::getValueProperty): Change LastMatch case to call
2932 getBackref(0) so we don't need a separate getLastMatch function.
2934 * kjs/string_object.cpp:
2935 (KJS::replace): Update to use new performMatch, including merging the
2936 matched string section with the other substrings.
2937 (KJS::StringProtoFunc::callAsFunction): Update functions to use the
2938 new performMatch and match. Also change to use OwnArrayPtr.
2940 2007-10-31 Oliver Hunt <oliver@apple.com>
2942 * kjs/nodes.h: include OwnPtr.h
2944 2007-10-31 Oliver Hunt <oliver@apple.com>
2948 Remove SourceCodeElement class and replaced with a Vector for a 0.8% gain on sunspider
2952 (KJS::statementListPushFIFO):
2953 (KJS::statementListGetDeclarations):
2954 (KJS::statementListInitializeDeclarationStacks):
2955 (KJS::statementListInitializeVariableAccessStack):
2956 (KJS::statementListExecute):
2957 (KJS::BlockNode::optimizeVariableAccess):
2958 (KJS::BlockNode::BlockNode):
2959 (KJS::BlockNode::getDeclarations):
2960 (KJS::BlockNode::execute):
2961 (KJS::CaseClauseNode::optimizeVariableAccess):
2962 (KJS::CaseClauseNode::getDeclarations):
2963 (KJS::CaseClauseNode::evalStatements):
2964 (KJS::FunctionBodyNode::initializeDeclarationStacks):
2965 (KJS::FunctionBodyNode::optimizeVariableAccess):
2967 * kjs/nodes2string.cpp:
2968 (KJS::statementListStreamTo):
2969 (KJS::BlockNode::streamTo):
2970 (KJS::CaseClauseNode::streamTo):
2972 2007-10-30 Mark Rowe <mrowe@apple.com>
2974 * kjs/property_map.cpp: Added a missing using directive to fix the build
2975 for non-Mac ports. Mac worked only because it does the AllInOneFile compile.
2977 2007-10-31 Maciej Stachowiak <mjs@apple.com>
2979 * kjs/property_map.cpp: Include HashTable.h the right way to fix the build
2982 2007-10-31 Alexey Proskuryakov <ap@webkit.org>
2986 http://bugs.webkit.org/show_bug.cgi?id=11001
2987 WebKit doesn't support RegExp.compile method
2989 Test: fast/js/regexp-compile.html
2991 * kjs/regexp_object.cpp:
2992 (RegExpPrototype::RegExpPrototype):
2993 (RegExpProtoFunc::callAsFunction):
2994 * kjs/regexp_object.h:
2995 (KJS::RegExpProtoFunc::):
2996 Added RegExp.compile.
2998 * tests/mozilla/expected.html: js1_2/regexp/compile.js now passes.
3000 2007-10-31 Maciej Stachowiak <mjs@apple.com>
3004 - get rid of integer divide in PropertyMap and HashTable for 1% SunSpider speedup
3006 Integer divide sucks. Fortunately, a bunch of shifts and XORs
3007 biased towards the high bits is sufficient to provide a good
3008 double hash. Besides the SunSpider win, I used the dump statistics
3009 mode for both to verify that collisions did not increase and that
3010 the longest collision chain is not any longer.
3012 * kjs/property_map.cpp:
3014 (KJS::PropertyMap::get):
3015 (KJS::PropertyMap::getLocation):
3016 (KJS::PropertyMap::put):
3017 (KJS::PropertyMap::insert):
3018 (KJS::PropertyMap::remove):
3019 (KJS::PropertyMap::checkConsistency):
3023 (WTF::::lookupForWriting):
3024 (WTF::::fullLookupForWriting):
3027 2007-10-30 Adam Roben <aroben@apple.com>
3029 * kjs/collector.h: Make HeapType public so it can be used for non-member
3030 things like the HeapConstants struct template. Fixes the build on Windows.
3032 2007-10-30 Adam Roben <aroben@apple.com>
3034 Change ALWAYS_INLINE and WTF_PRIVATE_INLINE to use __forceinline on Windows
3036 Speeds up SunSpider by 0.4%.
3038 Reviewed by Steve and Maciej.
3040 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Disable
3041 a warning during LTCG in release builds about double -> float
3043 * wtf/AlwaysInline.h:
3046 2007-10-30 Adam Roben <aroben@apple.com>
3048 Use GetCurrentThreadId instead of pthread_self in FastMalloc
3050 Speeds up SunSpider by 0.3%.
3054 * wtf/FastMalloc.cpp:
3055 (WTF::TCMalloc_ThreadCache::InitTSD):
3056 (WTF::TCMalloc_ThreadCache::CreateCacheIfNecessary):
3058 2007-10-30 Adam Roben <aroben@apple.com>
3060 Switch to a Win32 critical section implementation of spinlocks
3062 Speeds up SunSpider by 0.4%.
3066 * wtf/FastMalloc.cpp:
3068 (TCMalloc_SpinLock::TCMalloc_SpinLock):
3069 (TCMalloc_SpinLock::Init):
3070 (TCMalloc_SpinLock::Finalize):
3071 (TCMalloc_SpinLock::Lock):
3072 (TCMalloc_SpinLock::Unlock):
3073 * wtf/TCSystemAlloc.cpp:
3075 2007-10-30 Adam Roben <aroben@apple.com>
3077 Fix Bug 15586: REGRESSION (r26759-r26785): Windows nightly builds crash with Safari 3 Public Beta
3079 http://bugs.webkit.org/show_bug.cgi?id=15586
3081 Also fixes: <rdar://5565303> Cannot use regsvr32.exe to register WebKit.dll
3083 Use Win32 TLS functions instead of __declspec(thread), which breaks
3088 * wtf/FastMalloc.cpp:
3089 (WTF::getThreadHeap):
3090 (WTF::TCMalloc_ThreadCache::InitModule):
3092 2007-10-30 Maciej Stachowiak <mjs@apple.com>
3096 - allocate numbers in half-size cells, for an 0.5% SunSpider speedup
3097 http://bugs.webkit.org/show_bug.cgi?id=15772
3099 We do this by using a single mark bit per two number cells, and
3102 Besides being an 0.5% win overall, this is a 7.1% win on morph.
3104 * kjs/collector.cpp:
3106 (KJS::Collector::heapAllocate):
3107 (KJS::Collector::markStackObjectsConservatively):
3108 (KJS::Collector::sweep):
3110 (KJS::SmallCollectorCell::):
3112 2007-10-30 Geoffrey Garen <ggaren@apple.com>
3114 Reviewed by Adam Roben, Sam Weinig.
3116 Made conflicts in grammar.y a persistent build failure.
3118 * DerivedSources.make:
3120 2007-10-30 Kevin McCullough <kmccullough@apple.com>
3122 Reviewed by Adam and Geoff.
3124 - Added a new cast so all the casts are in the same place.
3129 2007-10-30 Geoffrey Garen <ggaren@apple.com>
3131 Reviewed by Darin Adler.
3133 Fixed <rdar://problem/5567504> shift/reduce conflict introduced in r24457
3137 ecma_2/Statements/dowhile-001.js
3138 ecma_2/Statements/dowhile-002.js
3139 ecma_2/Statements/dowhile-003.js
3140 ecma_2/Statements/dowhile-004.js
3141 ecma_2/Statements/dowhile-005.js
3142 ecma_2/Statements/dowhile-006.js
3143 ecma_2/Statements/dowhile-007.js
3144 js1_2/statements/do_while.js
3146 and layout tests, including
3148 do-while-expression-value.html
3149 do-while-semicolon.html
3150 do-while-without-semicolon.html
3154 * kjs/grammar.y: Use the explicit "error" production, as we do with other
3155 automatic semicolon insertions, to disambiguate "do { } while();" from
3156 "do { } while()" followed by ";" (the empty statement).
3158 2007-10-29 Oliver Hunt <oliver@apple.com>
3162 Debranching remaining assignment nodes, and miscellaneous cleanup
3164 Split read-modify code paths out of AssignBracketNode and AssignDotNode
3165 Removed now unnecessary check for write-only assignment in ReadModifyLocalVarNode
3166 and ReadModifyResolveNode evaluate methods
3168 Leads to a 1% gain in SunSpider.
3172 (KJS::ReadModifyLocalVarNode::evaluate):
3173 (KJS::ReadModifyResolveNode::evaluate):
3174 (KJS::AssignDotNode::evaluate):
3175 (KJS::ReadModifyDotNode::optimizeVariableAccess):
3176 (KJS::ReadModifyDotNode::evaluate):
3177 (KJS::AssignBracketNode::evaluate):
3178 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
3179 (KJS::ReadModifyBracketNode::evaluate):
3181 (KJS::AssignBracketNode::):
3182 (KJS::AssignBracketNode::precedence):
3183 (KJS::AssignDotNode::):
3184 (KJS::AssignDotNode::precedence):
3185 * kjs/nodes2string.cpp:
3186 (KJS::ReadModifyBracketNode::streamTo):
3187 (KJS::AssignBracketNode::streamTo):
3188 (KJS::ReadModifyDotNode::streamTo):
3189 (KJS::AssignDotNode::streamTo):
3191 2007-10-29 Oliver Hunt <oliver@apple.com>
3193 Debranching various Node::evaluate implementations
3197 Split the read-modify-write assignment cases out of AssignResolveNode and into ReadModifyResolveNode
3198 Split the increment and decrement cases for Prefix- and Postfix- ResolveNode, BracketNode, and DotNode
3200 Gains 1.6% on SunSpider
3202 * JavaScriptCore.xcodeproj/project.pbxproj:
3205 (KJS::PostIncResolveNode::optimizeVariableAccess):
3206 (KJS::PostIncResolveNode::evaluate):
3207 (KJS::PostIncLocalVarNode::evaluate):
3208 (KJS::PostDecResolveNode::optimizeVariableAccess):
3209 (KJS::PostDecResolveNode::evaluate):
3210 (KJS::PostDecLocalVarNode::evaluate):
3211 (KJS::PostIncBracketNode::evaluate):
3212 (KJS::PostDecBracketNode::evaluate):
3213 (KJS::PostIncDotNode::evaluate):
3214 (KJS::PostDecDotNode::evaluate):
3215 (KJS::PreIncResolveNode::optimizeVariableAccess):
3216 (KJS::PreIncLocalVarNode::evaluate):
3217 (KJS::PreIncResolveNode::evaluate):
3218 (KJS::PreDecResolveNode::optimizeVariableAccess):
3219 (KJS::PreDecLocalVarNode::evaluate):
3220 (KJS::PreDecResolveNode::evaluate):
3221 (KJS::PreIncBracketNode::evaluate):
3222 (KJS::PreDecBracketNode::evaluate):
3223 (KJS::PreIncDotNode::evaluate):
3224 (KJS::PreDecDotNode::evaluate):
3225 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
3226 (KJS::AssignResolveNode::optimizeVariableAccess):
3227 (KJS::AssignLocalVarNode::evaluate):
3228 (KJS::AssignResolveNode::evaluate):
3230 (KJS::PostDecResolveNode::):
3231 (KJS::PostDecResolveNode::precedence):
3232 (KJS::PostDecLocalVarNode::):
3233 (KJS::PostfixBracketNode::):
3234 (KJS::PostfixBracketNode::precedence):
3235 (KJS::PostIncBracketNode::):
3236 (KJS::PostIncBracketNode::isIncrement):
3237 (KJS::PostDecBracketNode::):
3238 (KJS::PostDecBracketNode::isIncrement):
3239 (KJS::PostfixDotNode::):
3240 (KJS::PostfixDotNode::precedence):
3241 (KJS::PostIncDotNode::):
3242 (KJS::PostIncDotNode::isIncrement):
3243 (KJS::PostDecDotNode::):
3244 (KJS::PreIncResolveNode::):
3245 (KJS::PreDecResolveNode::):
3246 (KJS::PreDecResolveNode::precedence):
3247 (KJS::PreDecLocalVarNode::):
3248 (KJS::PrefixBracketNode::):
3249 (KJS::PrefixBracketNode::precedence):
3250 (KJS::PreIncBracketNode::):
3251 (KJS::PreIncBracketNode::isIncrement):
3252 (KJS::PreDecBracketNode::):
3253 (KJS::PreDecBracketNode::isIncrement):
3254 (KJS::PrefixDotNode::):
3255 (KJS::PrefixDotNode::precedence):
3256 (KJS::PreIncDotNode::):
3257 (KJS::PreIncDotNode::isIncrement):
3258 (KJS::PreDecDotNode::):
3259 (KJS::ReadModifyResolveNode::):
3260 (KJS::ReadModifyLocalVarNode::):
3261 (KJS::AssignResolveNode::):
3262 (KJS::AssignResolveNode::precedence):
3263 * kjs/nodes2string.cpp:
3264 (KJS::PostIncResolveNode::streamTo):
3265 (KJS::PostDecResolveNode::streamTo):
3266 (KJS::PostfixBracketNode::streamTo):
3267 (KJS::PostfixDotNode::streamTo):
3268 (KJS::PreIncResolveNode::streamTo):
3269 (KJS::PreDecResolveNode::streamTo):
3270 (KJS::ReadModifyResolveNode::streamTo):
3271 (KJS::AssignResolveNode::streamTo):
3273 2007-10-29 Maciej Stachowiak <mjs@apple.com>
3275 Not reviewed, build fix.
3277 - Include Vector.h in a way that actually works.
3279 * kjs/LocalStorage.h:
3281 2007-10-29 Maciej Stachowiak <mjs@apple.com>
3283 Not reviewed, build fix.
3285 - Install LocalStorage.h as a private header.
3287 * JavaScriptCore.xcodeproj/project.pbxproj:
3289 2007-10-29 Maciej Stachowiak <mjs@apple.com>
3293 - Define good VectorTraits for LocalStorage entry for 0.5% speed improvement on SunSpider.
3295 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3296 * JavaScriptCore.xcodeproj/project.pbxproj:
3297 * kjs/LocalStorage.h: Added.
3298 (KJS::LocalStorageEntry::LocalStorageEntry):
3302 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
3304 2007-10-29 Geoffrey Garen <ggaren@apple.com>
3306 Reviewed by Oliver Hunt.
3308 Some small tweaks that I notice while reviewing Oliver's last patch.
3310 Includes removal of an unnecessary KJS_CHECKEXCEPTIONVALUE.
3312 No change in SunSpider because SunSpider doesn't take the code path that
3313 would execute the unnecessary KJS_CHECKEXCEPTIONVALUE much.
3316 (KJS::LocalVarPostfixNode::evaluate):
3317 (KJS::TypeOfResolveNode::optimizeVariableAccess):
3318 (KJS::LocalVarTypeOfNode::evaluate):
3319 (KJS::PrefixResolveNode::optimizeVariableAccess):
3320 (KJS::LocalVarPrefixNode::evaluate):
3321 (KJS::AssignResolveNode::optimizeVariableAccess):
3322 (KJS::LocalVarAssignNode::evaluate):
3324 (KJS::LocalVarTypeOfNode::):
3325 (KJS::PrefixResolveNode::):
3326 (KJS::LocalVarPrefixNode::):
3327 (KJS::AssignResolveNode::):
3328 (KJS::LocalVarAssignNode::):
3330 2007-10-29 Eric Seidel <eric@webkit.org>
3334 SunSpider claims this was a 0.7% speedup.
3336 * kjs/string_object.cpp:
3337 (KJS::StringProtoFunc::callAsFunction): avoid mallocing a jsString in the common case
3339 2007-10-29 Maciej Stachowiak <mjs@apple.com>
3343 - re-enable asserts for access to empty or deleted keys
3347 (WTF::::lookupForWriting):
3348 (WTF::::fullLookupForWriting):
3351 2007-10-29 Eric Seidel <eric@webkit.org>
3353 Build fix only, no review.
3355 * JavaScriptCore.exp: Export symbol for new StringInstance::getOwnPropertySlot
3357 2007-10-29 Mark Rowe <mrowe@apple.com>
3359 Gtk build fix. Move struct declarations into nodes.h.
3364 2007-10-29 Eric Seidel <eric@webkit.org>
3368 Give StringInstance a getOwnPropertySlot(ExecState, unsigned, PropertySlot) fastpath, just like Arrays.
3369 Make it a compile time error to use toString(ExecState) on a StringInstance
3371 SunSpider claims this was a 6.6% speedup overall (22% on string-base64)
3374 (KJS::StringImp::getLength):
3375 * kjs/string_object.cpp:
3376 (KJS::StringInstance::lengthGetter):
3377 (KJS::StringInstance::inlineGetOwnPropertySlot):
3378 (KJS::StringInstance::getOwnPropertySlot):
3379 * kjs/string_object.h:
3381 2007-10-28 Oliver Hunt <oliver@apple.com>
3385 Add nodes to allow Assignment, TypeOf, and prefix operators to
3386 make use of the new optimised local variable look up.
3388 5% gain on sunspider
3391 (KJS::TypeOfResolveNode::optimizeVariableAccess):
3392 (KJS::LocalTypeOfAccessNode::evaluate):
3393 (KJS::PrefixResolveNode::optimizeVariableAccess):
3394 (KJS::PrefixLocalAccessNode::evaluate):
3395 (KJS::AssignResolveNode::optimizeVariableAccess):
3396 (KJS::AssignLocalAccessNode::evaluate):
3398 (KJS::TypeOfResolveNode::):
3399 (KJS::TypeOfResolveNode::precedence):
3400 (KJS::LocalTypeOfAccessNode::):
3401 (KJS::PrefixResolveNode::):
3402 (KJS::PrefixResolveNode::precedence):
3403 (KJS::PrefixLocalAccessNode::):
3404 (KJS::AssignResolveNode::):
3405 (KJS::AssignLocalAccessNode::):
3407 2007-10-28 Maciej Stachowiak <mjs@apple.com>
3411 - avoid creating and then breaking circular lists in the parser, instead track head and tail pointers at parse time
3412 http://bugs.webkit.org/show_bug.cgi?id=15748
3414 Not a significant speedup or slowdown on SunSpider.
3417 (KJS::clearNewNodes):
3421 (KJS::BlockNode::BlockNode):
3422 (KJS::CaseBlockNode::CaseBlockNode):
3423 (KJS::FunctionBodyNode::FunctionBodyNode):
3424 (KJS::SourceElementsNode::SourceElementsNode):
3425 (KJS::ProgramNode::ProgramNode):
3427 (KJS::ElementNode::):
3429 (KJS::PropertyListNode::):
3430 (KJS::ObjectLiteralNode::):
3431 (KJS::ArgumentListNode::):
3432 (KJS::ArgumentsNode::):
3433 (KJS::VarDeclListNode::):
3434 (KJS::VarStatementNode::):
3436 (KJS::ParameterNode::):
3437 (KJS::FuncExprNode::):
3438 (KJS::FuncDeclNode::):
3439 (KJS::SourceElementsNode::):
3440 (KJS::CaseClauseNode::):
3441 (KJS::ClauseListNode::):
3443 2007-10-28 Mark Rowe <mrowe@apple.com>
3445 Disable assertions in a manner that doesn't break the Qt Windows build.
3449 (WTF::::lookupForWriting):
3450 (WTF::::fullLookupForWriting):
3452 2007-10-28 Geoffrey Garen <ggaren@apple.com>
3454 Temporarily disabling some ASSERTs I introduced in my last check-in
3455 because of http://bugs.webkit.org/show_bug.cgi?id=15747
3456 Lots of layout tests fail the !HashTranslator::equal(KeyTraits::emptyValue() ASSERT
3460 (WTF::::lookupForWriting):
3461 (WTF::::fullLookupForWriting):
3464 2007-10-28 Geoffrey Garen <ggaren@apple.com>
3466 Reviewed by Darin Adler.
3468 Fixed http://bugs.webkit.org/show_bug.cgi?id=15746
3469 #ifndef ASSERT_DISABLED is no good!
3471 Replaced with #if !ASSERT_DISABLED.
3475 (WTF::::lookupForWriting):
3476 (WTF::::fullLookupForWriting):
3479 2007-10-28 Geoffrey Garen <ggaren@apple.com>
3481 Reviewed by Darin Adler.
3483 Added FunctionCallResolveNode, PostfixResolveNode, and DeleteResolveNode
3484 to the AST transfom that replaces slow resolve nodes with fast local
3485 variable alternatives.
3487 2.5% speedup on SunSpider.
3489 Also added some missing copyright notices.
3492 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
3493 (KJS::FunctionCallResolveNode::evaluate):
3494 (KJS::LocalVarFunctionCallNode::evaluate):
3495 (KJS::PostfixResolveNode::optimizeVariableAccess):
3496 (KJS::PostfixResolveNode::evaluate):
3497 (KJS::LocalVarPostfixNode::evaluate):
3498 (KJS::DeleteResolveNode::optimizeVariableAccess):
3499 (KJS::DeleteResolveNode::evaluate):
3500 (KJS::LocalVarDeleteNode::evaluate):
3502 (KJS::FunctionCallResolveNode::):
3503 (KJS::LocalVarFunctionCallNode::LocalVarFunctionCallNode):
3504 (KJS::PostfixResolveNode::):
3505 (KJS::LocalVarPostfixNode::LocalVarPostfixNode):
3506 (KJS::DeleteResolveNode::):
3507 (KJS::LocalVarDeleteNode::LocalVarDeleteNode):
3509 2007-10-28 Eric Seidel <eric@webkit.org>
3513 Inline UString::Rep::deref() for a 0.8% improvement in SunSpider
3514 Add virtual keyword to a few virtual functions previously unmarked.
3517 (KJS::StringImp::type):
3518 (KJS::NumberImp::type):
3520 (KJS::UString::Rep::deref):
3522 2007-10-28 Darin Adler <darin@apple.com>
3524 - fix "broken everything" from the storage leak fix
3526 * wtf/RefPtr.h: (WTF::RefPtr::RefPtr): Added a PlacementNewAdopt constructor.
3527 * kjs/ustring.h: (KJS::UString::UString): Pass PlacementNewAdopt along to RefPtr.
3529 2007-10-28 Darin Adler <darin@apple.com>
3533 - turn on unused parameter waring on Mac OS X because it's already on elsewhere
3535 * Configurations/Base.xcconfig: Took out -wno-unused-parameter.
3541 Fixed unused variables by using them or marked them with UNUSED_PARAM.
3543 * kjs/CollectorHeapIntrospector.h: (KJS::CollectorHeapIntrospector::zoneCalloc):
3544 Removed parameter names to indicate they are unused.
3546 2007-10-28 Darin Adler <darin@apple.com>
3550 - fix a storage leak where we ref the UString every time we replace
3551 a ResolveNode with a LocalVarAccessNode
3553 * kjs/identifier.h: (KJS::Identifier::Identifier): Added a constructor
3554 that takes PlacementNewAdopt.
3556 * kjs/nodes.h: (KJS::ResolveNode::ResolveNode): Initialize the ident
3557 with PlacementNewAdopt instead of the old value of ident.
3559 * kjs/ustring.h: (KJS::UString::UString): Added a constructor that
3560 takes PlacementNewAdopt.
3562 2007-10-28 Darin Adler <darin@apple.com>
3564 - Windows build fix; get rid of unused parameter
3566 * kjs/nodes.cpp: (KJS::ResolveNode::optimizeVariableAccess): Don't pass it.
3567 * kjs/nodes.h: (KJS::LocalVarAccessNode::LocalVarAccessNode): Remove it.
3568 The assertions weren't all that helpful.
3570 2007-10-28 Mark Rowe <mrowe@apple.com>
3572 Gtk build fix. Add include of MathExtras.h.
3574 * kjs/string_object.cpp:
3576 2007-10-28 Mark Rowe <mrowe@apple.com>
3578 Reviewed by Maciej and Tim.
3580 Replace uses of isNaN and isInf with isnan and isinf, and
3581 remove isNaN and isInf.
3583 * kjs/config.h: Remove unused HAVE_'s.
3584 * kjs/date_object.cpp:
3585 (KJS::DateInstance::getTime):
3586 (KJS::DateInstance::getUTCTime):
3587 (KJS::DateProtoFunc::callAsFunction):
3588 (KJS::DateObjectImp::construct):
3589 (KJS::DateObjectFuncImp::callAsFunction):
3591 (KJS::GlobalFuncImp::callAsFunction):
3592 * kjs/math_object.cpp:
3593 (MathFuncImp::callAsFunction):
3594 * kjs/nodes2string.cpp:
3595 (KJS::isParserRoundTripNumber):
3596 * kjs/number_object.cpp:
3597 (NumberProtoFunc::callAsFunction):
3598 * kjs/operations.cpp:
3600 * kjs/string_object.cpp:
3601 (KJS::StringProtoFunc::callAsFunction):
3603 (KJS::UString::from):
3605 (KJS::JSValue::toInteger):
3606 (KJS::JSValue::toInt32SlowCase):
3607 (KJS::JSValue::toUInt32SlowCase):
3609 2007-10-28 Geoffrey Garen <ggaren@apple.com>
3611 Build fix: use the new-fangled missingSymbolMarker().
3614 (KJS::ResolveNode::optimizeVariableAccess):
3616 (KJS::LocalVarAccessNode::LocalVarAccessNode):
3618 2007-10-28 Geoffrey Garen <ggaren@apple.com>
3620 Reviewed by Maciej Stachowiak, Darin Adler.
3622 Much supporting work done by Maciej Stachowiak, Maks Orlovich, and
3625 AST transfom to replace slow resolve nodes with fast local variable
3626 alternatives that do direct memory access. Currently, only ResolveNode
3627 provides a fast local variable alternative. 6 others are soon to come.
3629 16.7% speedup on SunSpider.
3631 Most of this patch is just scaffolding to support iterating all the
3632 resolve nodes in the AST through optimizeResolveNodes(). In
3633 optimizeResolveNodes(), most classes just push their child nodes onto
3634 the processing stack, while ResolveNodes actually replace themselves in
3635 the tree with more optimized alternatives, if possible.
3637 Here are the interesting bits:
3639 * kjs/nodes.h: Added PlacementNewAdoptTag, along with implementations
3640 in Node and ResolveNode. This tag allows you to use placement new to
3641 swap out a base class Node in favor of a subclass copy that holds the
3642 same data. (Without this tag, default initialization would NULL out
3643 RefPtrs, change line numbers, etc.)
3646 (KJS::ResolveNode::evaluate): Since we're taking the slow path, ASSERT
3647 that the fast path is impossible, to make sure we didn't leave anything
3650 (KJS::FunctionBodyNode::optimizeResolveNodes): Here's where the AST
3651 transformation happens.
3653 (KJS::ResolveNode::optimizeResolveNodes): Here's where the ResolveNode
3654 optimization happens.
3656 * kjs/function.h: Added symbolTable() accessor for, for the sake of
3659 2007-10-28 Mark Rowe <mrowe@apple.com>
3663 Fix "AllInOneFile.o has a global initializer in it".
3665 Some versions of gcc generate a global initializer for std::numeric_limits<size_t>::max().
3666 We can avoid this by moving it inside an inline function.
3668 * kjs/SymbolTable.h:
3669 (KJS::missingSymbolMarker):
3671 (KJS::ActivationImp::getOwnPropertySlot):
3672 (KJS::ActivationImp::put):
3674 2007-10-28 Maciej Stachowiak <mjs@apple.com>
3678 - Added assertions to protect against adding empty or deleted keys to a HashTable
3681 (WTF::HashTable::lookup):
3682 (WTF::HashTable::lookupForWriting):
3683 (WTF::HashTable::fullLookupForWriting):
3684 (WTF::HashTable::add):
3686 2007-10-28 Darin Adler <darin@apple.com>
3690 * kjs/nodes2string.cpp: (KJS::isParserRoundTripNumber):
3691 Use isNaN and isInf instead of isnan and isinf.
3693 2007-10-28 Darin Adler <darin@apple.com>
3697 - http://bugs.webkit.org/show_bug.cgi?id=15735
3698 remove GroupNode to simplify AST and possibly get a modest speedup
3700 This patch removes 4 node types: GroupNode, PropertyNameNode,
3701 FunctionCallParenBracketNode, and FunctionCallParenDotNode.
3703 To remove GroupNode, we add knowledge of precedence to the tree nodes,
3704 and use that when serializing to determine where parentheses are needed.
3705 This means we no longer have to represent parentheses in the tree.
3707 The precedence values are named after productions in the grammar from the
3708 JavaScript standard.
3710 SunSpider says this is an 0.4% speedup.
3713 * kjs/function.cpp: Removed escapeStringForPrettyPrinting -- it's part of
3714 serialization, so I moved it to the file that takes care of that.
3716 * kjs/grammar.y: Changed makeGetterOrSetterPropertyNode to use 0 to
3717 indicate failure instead of a separate boolean. Got rid of PropertyNameNode
3718 by merging the PropertyName rule into the Property rule (which was easier
3719 than figuring out how to pass the Identifier from one node to another).
3720 Got rid of GroupNode, nodeInsideAllParens(), FunctionCallParenBracketNode,
3721 and FunctionCallParenDotNode.
3723 * kjs/nodes.h: Removed unused forward declarations and Operator values.
3724 Added Precedence enum, and precedence function to all nodes. Removed
3725 nodeInsideAllParens. Added streamBinaryOperator function for serialization.
3726 Removed GroupNode and PropertyNameNode. Made PropertyNode store an Identifier.
3727 Removed FunctionCallParenBracketNode and FunctionCallParenDotNode.
3729 * kjs/nodes.cpp: Removed Node::nodinsideAllParens, GroupNode, and PropertyNameNode.
3730 (KJS::PropertyListNode::evaluate): Changed code to get name directly instead
3731 of converting it from an Identifier to a jsString then back to a UString
3732 then into an Identifier again!
3734 * kjs/nodes2string.cpp: Changed special-token implementation to use a separate
3735 function for each of Endl, Indent, Unindent, and DotExpr instead of using a
3736 single function with a switch. Added a precedence that you can stream in, to
3737 cause the next node serialized to add parentheses based on that precedence value.
3738 (KJS::operatorString): Moved to the top of the file.
3739 (KJS::escapeStringForPrettyPrinting): Moved here from function.cpp. Removed old
3740 workaround for snprintf, since StringExtras.h takes care of that.
3741 (KJS::operator<<): Made the char and char* versions faster by using UString's
3742 character append functions instead of constructing a UString. Added the logic
3743 to the Node* version to add parentheses if needed.
3744 (KJS::Node::streamLeftAssociativeBinaryOperator): Added helper function.
3745 (KJS::ElementNode::streamTo): Use PrecAssignment for the elements.
3746 (KJS::BracketAccessorNode::streamTo): Use PrecCall for the expression before
3748 (KJS::DotAccessorNode::streamTo): Use PrecCall for the expression before the dot.
3749 (KJS::ArgumentListNode::streamTo): Use PrecAssignment for the arguments.
3750 (KJS::NewExprNode::streamTo): Use PrecMember for the expression.
3751 (KJS::FunctionCallValueNode::streamTo): Use PrecCall.
3752 (KJS::FunctionCallBracketNode::streamTo): Ditto.
3753 (KJS::FunctionCallDotNode::streamTo): Ditto.
3754 (KJS::PostfixBracketNode::streamTo): Ditto.
3755 (KJS::PostfixDotNode::streamTo): Ditto.
3756 (KJS::PostfixErrorNode::streamTo): Use PrecLeftHandSide.
3757 (KJS::DeleteBracketNode::streamTo): Use PrecCall.
3758 (KJS::DeleteDotNode::streamTo): Ditto.
3759 (KJS::DeleteValueNode::streamTo): Use PrecUnary.
3760 (KJS::VoidNode::streamTo): Ditto.
3761 (KJS::TypeOfValueNode::streamTo): Ditto.
3762 (KJS::PrefixBracketNode::streamTo): Use PrecCall.
3763 (KJS::PrefixDotNode::streamTo): Ditto.
3764 (KJS::PrefixErrorNode::streamTo): Use PrecUnary.
3765 (KJS::UnaryPlusNode::streamTo): Ditto.
3766 (KJS::NegateNode::streamTo): Ditto.
3767 (KJS::BitwiseNotNode::streamTo): Ditto.
3768 (KJS::LogicalNotNode::streamTo): Ditto.
3769 (KJS::MultNode::streamTo): Use streamLeftAssociativeBinaryOperator.
3770 (KJS::DivNode::streamTo): Ditto.
3771 (KJS::ModNode::streamTo): Ditto.
3772 (KJS::AddNode::streamTo): Ditto.
3773 (KJS::SubNode::streamTo): Ditto.
3774 (KJS::LeftShiftNode::streamTo): Ditto.
3775 (KJS::RightShiftNode::streamTo): Ditto.
3776 (KJS::UnsignedRightShiftNode::streamTo): Ditto.
3777 (KJS::LessNode::streamTo): Ditto.
3778 (KJS::GreaterNode::streamTo): Ditto.
3779 (KJS::LessEqNode::streamTo): Ditto.
3780 (KJS::GreaterEqNode::streamTo): Ditto.
3781 (KJS::InstanceOfNode::streamTo): Ditto.
3782 (KJS::InNode::streamTo): Ditto.
3783 (KJS::EqualNode::streamTo): Ditto.
3784 (KJS::NotEqualNode::streamTo): Ditto.
3785 (KJS::StrictEqualNode::streamTo): Ditto.
3786 (KJS::NotStrictEqualNode::streamTo): Ditto.
3787 (KJS::BitAndNode::streamTo): Ditto.
3788 (KJS::BitXOrNode::streamTo): Ditto.
3789 (KJS::BitOrNode::streamTo): Ditto.
3790 (KJS::LogicalAndNode::streamTo): Ditto.
3791 (KJS::LogicalOrNode::streamTo): Ditto.
3792 (KJS::ConditionalNode::streamTo): Ditto.
3793 (KJS::AssignResolveNode::streamTo): Use PrecAssignment for the right side.
3794 (KJS::AssignBracketNode::streamTo): Use PrecCall for the expression before
3795 the bracket and PrecAssignment for the right side.
3796 (KJS::AssignDotNode::streamTo): Ditto.
3797 (KJS::AssignErrorNode::streamTo): Use PrecLeftHandSide for the left side
3798 and PrecAssignment for the right side.
3799 (KJS::CommaNode::streamTo): Use PrecAssignment for both expressions.
3800 (KJS::AssignExprNode::streamTo): Use PrecAssignment.
3802 2007-10-28 Kevin Ollivier <kevino@theolliviers.com>
3804 Define wx port and set wx port USE options.
3806 Reviewed by Adam Roben.
3810 2007-10-28 Mark Rowe <mrowe@apple.com>
3812 We don't include "config.h" in headers.
3814 * bindings/jni/jni_instance.h:
3819 2007-10-28 Maciej Stachowiak <mjs@apple.com>
3821 Rubber stamped by Mark.
3823 - avoid using non-portable SIZE_T_MAX in favor of std::numeric_limits
3825 * kjs/SymbolTable.h:
3826 (KJS::SymbolTableIndexHashTraits::emptyValue):
3828 (KJS::ActivationImp::getOwnPropertySlot):
3829 (KJS::ActivationImp::put):
3831 2007-10-28 Maciej Stachowiak <mjs@apple.com>
3835 - switch SymbolTable to be a HashMap instead of a PropertyMap for 3% SunSpider speedup
3837 * kjs/SymbolTable.h:
3838 (KJS::IdentifierRepHash::hash): Special hash function for identifier reps.
3839 (KJS::IdentifierRepHash::equal): ditto
3840 (KJS::SymbolTableIndexHashTraits::emptyValue): Special HashTraits for the index value.
3841 (KJS::SymbolTable): change to a typedef for a HashMap.
3843 (KJS::ActivationImp::getOwnPropertySlot): Adjusted for new SymbolTable API.
3844 (KJS::ActivationImp::deleteProperty): ditto
3845 (KJS::ActivationImp::put): ditto
3848 (KJS::FunctionBodyNode::initializesymbolTable): Adjusted, since
3849 you now have to store a UString::rep, not an identifier.
3851 2007-10-27 Maciej Stachowiak <mjs@apple.com>
3855 - numerous HashTable performance improvements
3857 This does not quite add up to a measurable win on SunSpider, but it allows a
3858 follow-on > 3% improvement and probably helps WebCore too.
3860 I made the following improvements, among others:
3862 - Made HashFunctions note whether it is ok to compare a real value with the equal() function
3863 to the empty or deleted value, and used this to optimize the comparisons done in hash lookup.
3865 - Specialized lookup so it doesn't have to do so many extra branches and build so many extra
3866 std::pairs for cases that don't need them. There are now four versions, one for read-only access,
3867 two for writing, and one folded directly into add() (these all were improvments).
3869 - Made HashMap::get() use lookup() directly instead of find() to avoid having to build iterators.
3871 - Made a special constructor for iterators that knows it points to
3872 a valid filled cell and so skips updating itself.
3874 - Reordered memory accesses in the various lookup functions for better code generation
3876 - Made simple translators avoid passing a hash code around
3878 - Other minor tweaks
3882 (WTF::HashTableConstIterator::HashTableConstIterator):
3883 (WTF::HashTableIterator::HashTableIterator):
3884 (WTF::IdentityHashTranslator::translate):
3885 (WTF::HashTable::end):
3886 (WTF::HashTable::lookup):
3887 (WTF::HashTable::lookupForWriting):
3888 (WTF::HashTable::makeKnownGoodIterator):
3889 (WTF::HashTable::makeKnownGoodConstIterator):
3891 (WTF::::lookupForWriting):
3892 (WTF::::fullLookupForWriting):
3894 (WTF::::addPassingHashCode):
3898 * kjs/identifier.cpp:
3900 * wtf/HashFunctions.h:
3908 * wtf/ListHashSet.h:
3909 (WTF::ListHashSetTranslator::translate):
3911 2007-10-27 Darin Adler <darin@apple.com>
3915 - fix ASCIICType.h for some Windows compiles
3917 * wtf/ASCIICType.h: Check the compiler, not the OS, since it's the
3918 compiler/library that has the wchar_t that is just a typedef.
3920 2007-10-27 Kevin McCullough <kmccullough@apple.com>
3923 - Forgot to change the build step when I changed the filename.
3925 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3927 2007-10-27 Geoffrey Garen <ggaren@apple.com>
3929 Reviewed by Darin Adler.
3931 Fixed the rest of "ASSERTION FAILED: _hash in KJS::UString::Rep::
3933 http://bugs.webkit.org/show_bug.cgi?id=15718
3935 * kjs/identifier.cpp: Fixed more cases where an Identifier didn't get a
3936 hash value. Also changed O(n) strlen to O(1) check for empty string.
3937 (KJS::Identifier::add):
3939 * kjs/ustring.cpp: Changed O(n) strlens to O(1) checks for empty string.
3940 (KJS::UString::UString):
3941 (KJS::UString::operator=):
3943 2007-10-27 Darin Adler <darin@apple.com>
3947 - fix pow on Windows
3949 * wtf/MathExtras.h: (wtf_pow): Add a special case for MSVC, which has
3950 a "pow" function that does not properly handle the case where arg1 is
3953 * kjs/math_object.cpp: (MathFuncImp::callAsFunction): Don't explicity
3954 specify "::pow" -- just "pow" is fine.
3956 2007-10-27 Darin Adler <darin@apple.com>
3960 - http://bugs.webkit.org/show_bug.cgi?id=15711
3961 force JSImmediate to be inlined for roughly 1.2% SunSpider speedup
3963 * kjs/JSImmediate.h: Put ALWAYS_INLINE on everything.
3965 * kjs/object.h: Removed redundant includes.
3966 * kjs/value.h: Ditto.
3968 2007-10-27 Maciej Stachowiak <mjs@apple.com>
3972 - fixed "ASSERTION FAILED: _hash in KJS::UString::Rep::computedHash()"
3973 http://bugs.webkit.org/show_bug.cgi?id=15718
3975 * kjs/identifier.cpp:
3976 (KJS::Identifier::addSlowCase): Ensure that empty Identifiers have a hash computed,
3977 now that we count on all Identifiers already having one.
3979 2007-10-27 Mark Rowe <mrowe@apple.com>
3983 * kjs/SymbolTable.h:
3985 2007-10-27 Mark Rowe <mrowe@apple.com>
3991 2007-10-26 Kevin McCullough <kmccullough@apple.com>
3993 Rubber stamp by Adam.
3995 - Renamed JSStringRefCOM to JSStringRefBSTR since it he only thing the
3996 files contain are functions that operate on BSTRs.
3998 * API/JSStringRefBSTR.cpp: Copied from API/JSStringRefCOM.cpp.
3999 * API/JSStringRefBSTR.h: Copied from API/JSStringRefCOM.h.
4000 * API/JSStringRefCOM.cpp: Removed.
4001 * API/JSStringRefCOM.h: Removed.
4002 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4004 2007-10-26 Kevin McCullough <kmccullough@apple.com>
4008 - Made JSStringCreateWithBSTR capable of handling null BSTRs.
4010 * API/JSStringRefCOM.cpp:
4011 (JSStringCreateWithBSTR):
4013 2007-10-26 Sam Weinig <sam@webkit.org>
4017 * kjs/SymbolTable.h: Add header gaurd.
4018 * kjs/nodes.h: #include "SymbolTable.h"
4020 2007-10-26 Geoffrey Garen <ggaren@apple.com>
4022 Suggested by Anders Carlsson.
4027 (KJS::ActivationImp::getOwnPropertySlot):
4029 2007-10-26 Geoffrey Garen <ggaren@apple.com>
4031 Suggested by Darin Adler.
4033 Use computedHash(), which is safer than just directly accessing _hash.
4036 (KJS::Lookup::findEntry):
4037 (KJS::Lookup::find):
4039 2007-10-26 Geoffrey Garen <ggaren@apple.com>
4041 Build fix: svn add SymbolTable.h
4043 * kjs/SymbolTable.h: Added.
4044 (KJS::SymbolTable::set):
4045 (KJS::SymbolTable::get):
4047 2007-10-26 Geoffrey Garen <ggaren@apple.com>
4049 Build fix: export SymbolTable.h to WebCore.
4051 * JavaScriptCore.xcodeproj/project.pbxproj:
4053 2007-10-26 Geoffrey Garen <ggaren@apple.com>
4055 Comment tweak suggested by Maciej.
4058 (KJS::ActivationImp::getOwnPropertySlot):
4060 2007-10-26 Geoffrey Garen <ggaren@apple.com>
4062 Reviewed by Maciej Stachowiak.
4064 Tweaked property maps to remove 2 branches. 2.5% speedup on SunSpider.
4066 * kjs/property_map.cpp: Use a special no branch accessor to the UString's
4067 hash value. Also, return immediately instead of branching to the end
4068 of the loop if the value is not found.
4069 (KJS::PropertyMap::get):
4070 (KJS::PropertyMap::getLocation):
4071 (KJS::PropertyMap::put):
4072 (KJS::PropertyMap::insert):
4073 (KJS::PropertyMap::remove):
4074 (KJS::PropertyMap::checkConsistency):
4077 (KJS::UString::Rep::computedHash): Special no branch accessor to the
4078 UString's hash value. Used when the caller knows that the hash value
4079 has already been computed. (For example, if the caller got the UString
4080 from an Identifier.)
4082 2007-10-26 Geoffrey Garen <ggaren@apple.com>
4084 Reviewed by Maciej Stachowiak.
4086 Switched ActivationImp to using a symbol table. For now, though, all
4087 clients take the slow path.
4089 Net .6% speedup on SunSpider.
4092 - ActivationImp now mallocs in its constructor
4093 - Local variable hits use an extra level of indirection to retrieve
4095 - Local variable misses do two lookups
4098 - Fast initialization of local variables upon function entry
4100 * JavaScriptCore.xcodeproj/project.pbxproj: Added SymbolTable.h
4103 (KJS::ActivationImp::ActivationImp): Malloc a private structure to hold
4104 data that won't fit in a JSCell.
4105 (KJS::ActivationImp::argumentsGetter): Use slow symbol table path for
4107 (KJS::ActivationImp::getOwnPropertySlot): ditto
4108 (KJS::ActivationImp::deleteProperty): ditto
4109 (KJS::ActivationImp::put): ditto
4110 (KJS::ActivationImp::createArgumentsObject): ditto
4112 (KJS::ActivationImp::mark): Call JSObject::mark first so that one of
4113 our properties doesn't try to recursively mark us. (This caused a crash
4114 in earlier testing. Not sure why we haven't run into it before.)
4116 * kjs/nodes.cpp: Functions now build a symbol table the first time
4118 (KJS::VarDeclNode::evaluate):
4119 (KJS::FunctionBodyNode::FunctionBodyNode):
4120 (KJS::FunctionBodyNode::initializeSymbolTable):
4121 (KJS::FunctionBodyNode::processDeclarations):
4122 (KJS::FunctionBodyNode::processDeclarationsForFunctionCode):
4123 (KJS::FunctionBodyNode::processDeclarationsForProgramCode):
4126 (KJS::FunctionBodyNode::symbolTable):
4128 * wtf/Forward.h: Added Vector.
4130 2007-10-26 Kevin McCullough <kmccullough@apple.com>
4132 - Corrected function name mistake in this changelog.
4134 2007-10-26 Kevin McCullough <kmccullough@apple.com>
4135 Reviewed by Sam and Steve.
4137 - Added convenience methods for converting between BSTR and JSStringRefs
4139 * API/JSStringRefCOM.cpp: Added.
4140 (JSStringCreateWithBSTR):
4142 * API/JSStringRefCOM.h: Added.
4143 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
4145 2007-10-26 Mark Rowe <mrowe@apple.com>
4149 * kjs/collector.cpp:
4150 (KJS::Collector::collect):
4152 2007-10-26 Oliver Hunt <oliver@apple.com>
4156 Make the JSC GC use a separate heap for JSNumbers to get a 0.7-1.4% progression in SunSpider.
4158 * kjs/CollectorHeapIntrospector.cpp:
4159 (KJS::CollectorHeapIntrospector::init):
4160 (KJS::CollectorHeapIntrospector::enumerate):
4161 * kjs/CollectorHeapIntrospector.h:
4162 * kjs/collector.cpp:
4163 (KJS::Collector::recordExtraCost):
4164 (KJS::Collector::heapAlloca