1 2008-05-21 Oliver Hunt <oliver@apple.com>
3 Reviewed by NOBODY (Build fix).
5 Add DebuggerCallFrame.{h,cpp} to the project file
7 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
9 2008-05-21 Alp Toker <alp@nuanti.com>
11 GTK+ port build fixes following squirrelfish merge r33979.
15 2008-05-21 Maciej Stachowiak <mjs@apple.com>
19 - save a hash lookup wne writing to global properties
20 0.3% speedup on SunSpider, 7% on bitops-bitwise-and
23 (KJS::resolveBase): Check for being a the end of the scope chain
26 2008-05-21 Alp Toker <alp@nuanti.com>
28 Rubber-stamped by Maciej.
30 Replace non-standard #pragma marks with comments to avoid compiler
33 * profiler/ProfileNode.cpp:
35 2008-05-21 Geoffrey Garen <ggaren@apple.com>
37 Reviewed by Mark Rowe.
39 Fix layout test failure in fast/dom/getter-on-window-object2 introduced in r33961.
42 * kjs/JSGlobalObject.cpp:
43 (KJS::JSGlobalObject::defineGetter):
44 (KJS::JSGlobalObject::defineSetter):
45 * kjs/JSGlobalObject.h:
47 === End merge of squirrelfish ===
49 2008-05-21 Geoffrey Garen <ggaren@apple.com>
51 Reviewed by Tim Hatcher.
53 Merged with trunk WebCore's new debugger.
55 * kjs/DebuggerCallFrame.cpp:
56 (KJS::DebuggerCallFrame::evaluate): Changed this function to separate
57 the exception value from the return value. The WebKit debugger treats
58 them as one, but the WebCore debugger doesn't.
60 * kjs/DebuggerCallFrame.h:
61 (KJS::DebuggerCallFrame::dynamicGlobalObject): Added a new accessor for
62 the dynamic global object, since the debugger doesn't want the lexical
65 2008-05-21 Oliver Hunt <oliver@apple.com>
69 Bug 19116: SquirrelFish shouldn't regress on variable lookups
70 <https://bugs.webkit.org/show_bug.cgi?id=19116>
72 Optimise cross scope assignment, 0.4% progression in sunspider.
75 (KJS::CodeBlock::dump):
76 * VM/CodeGenerator.cpp:
77 (KJS::CodeGenerator::emitPutScopedVar):
80 (KJS::Machine::privateExecute):
83 (KJS::AssignResolveNode::emitCode):
85 2008-05-21 Maciej Stachowiak <mjs@apple.com>
89 - check property map before symbol table in JSGlobalObject::getOwnPropertySlot
90 0.5% speedup on SunSpider
92 * kjs/JSGlobalObject.h:
93 (KJS::JSGlobalObject::getOwnPropertySlot): Check property map before symbol table
94 because symbol table access is likely to have been optimized.
96 2008-05-21 Oliver Hunt <oliver@apple.com>
100 Bug 19116: SquirrelFish shouldn't regress on variable lookups
101 <https://bugs.webkit.org/show_bug.cgi?id=19116>
103 Optimise multiscope lookup of statically resolvable function calls.
104 SunSpider reports a 1.5% improvement, including 37% on
105 controlflow-recursive for some reason :D
108 (KJS::CodeBlock::dump):
109 * VM/CodeGenerator.cpp:
110 (KJS::CodeGenerator::emitResolve):
111 * VM/CodeGenerator.h:
113 (KJS::FunctionCallResolveNode::emitCode):
115 2008-05-21 Maciej Stachowiak <mjs@apple.com>
119 - give JSGlobalObject a special version of getOwnPropertySlot that tells you if the slot is directly writable
120 (WebCore change using this is a 2.6% speedup on in-browser SunSpider).
122 * JavaScriptCore.exp:
123 * kjs/JSGlobalObject.h:
124 (KJS::JSGlobalObject::getOwnPropertySlot):
125 * kjs/JSVariableObject.h:
126 (KJS::JSVariableObject::symbolTableGet):
128 (KJS::JSObject::getDirectLocation):
129 (KJS::JSObject::getOwnPropertySlotForWrite):
130 * kjs/property_map.cpp:
131 (KJS::PropertyMap::getLocation):
132 * kjs/property_map.h:
133 * kjs/property_slot.h:
134 (KJS::PropertySlot::putValue):
136 2008-05-20 Oliver Hunt <oliver@apple.com>
140 Bug 19116: SquirrelFish shouldn't regress on variable lookups
141 <https://bugs.webkit.org/show_bug.cgi?id=19116>
143 This restores multiscope optimisation to simple resolve, producing
144 a 2.6% progression in SunSpider. Have verified that none of the
145 sites broken by the multiscope optimisation in trunk were effected
149 (KJS::CodeBlock::dump):
151 (KJS::CodeBlock::CodeBlock):
152 * VM/CodeGenerator.cpp:
153 (KJS::CodeGenerator::findScopedProperty):
154 (KJS::CodeGenerator::emitResolve):
155 * VM/CodeGenerator.h:
158 (KJS::Machine::privateExecute):
160 * kjs/JSVariableObject.h:
162 2008-05-20 Oliver Hunt <oliver@apple.com>
164 Reviewed by NOBODY (Build fix).
166 Fixerate the windows build.
168 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
169 * VM/CodeGenerator.cpp:
171 * kjs/JSGlobalObject.h:
175 2008-05-20 Oliver Hunt <oliver@apple.com>
179 Bug 19110: SquirrelFish: Google Maps - no maps
180 <https://bugs.webkit.org/show_bug.cgi?id=19110>
182 Correct a comedy of errors present in my original patch to "fix"
183 exceptions occurring midway through pre and post increment. This
184 solution is cleaner than the original, doesn't need the additional
185 opcodes, and as an added benefit does not break Google Maps.
187 Sunspider reports a 0.4% progression.
190 (KJS::CodeBlock::dump):
191 * VM/CodeGenerator.cpp:
192 * VM/CodeGenerator.h:
194 (KJS::Machine::privateExecute):
197 (KJS::PreIncResolveNode::emitCode):
198 (KJS::PreDecResolveNode::emitCode):
199 (KJS::PreIncBracketNode::emitCode):
200 (KJS::PreDecBracketNode::emitCode):
201 (KJS::PreIncDotNode::emitCode):
202 (KJS::PreDecDotNode::emitCode):
204 2008-05-20 Maciej Stachowiak <mjs@apple.com>
208 - inline JSGlobalObject::getOwnPropertySlot
209 1% improvement on in-browser SunSpider (a wash command-line)
211 * kjs/JSGlobalObject.cpp:
212 * kjs/JSGlobalObject.h:
213 (KJS::JSGlobalObject::getOwnPropertySlot):
215 2008-05-18 Oliver Hunt <oliver@apple.com>
219 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
220 <https://bugs.webkit.org/show_bug.cgi?id=18752>
222 Handle exceptions thrown by toString conversion in subscript operators,
223 this should basically complete exception handling in SquirrelFish.
225 Sunspider reports no regression.
228 (KJS::Machine::privateExecute):
230 2008-05-17 Geoffrey Garen <ggaren@apple.com>
232 Reviewed by Oliver Hunt.
234 [Reapplying patch with previously missing files from r33553 -- Oliver]
238 SunSpider reports no change.
240 * JavaScriptCore.xcodeproj/project.pbxproj: Added DebuggerCallFrame.h/.cpp,
241 and created a debugger folder.
243 * VM/CodeGenerator.cpp:
244 (KJS::CodeGenerator::generate): If the debugger is attached, always
245 generate full scope chains for its sake.
248 (KJS::Machine::unwindCallFrame): Notify the debugger when unwinding
249 due to an exception, so it doesn't keep stale call frames around.
251 (KJS::Machine::execute): Set Callee to 0 in eval frames, so the
252 debugger can distinguish them from function call frames.
254 (KJS::Machine::debug): Simplified this function, since the debugger
255 doesn't actually need all the information we used to provide.
257 (KJS::Machine::privateExecute): Treat debugging hooks like other function
258 calls, so the code we hook into (the debugger UI) can be optimized.
260 * kjs/debugger.cpp: Nixed these default callback implementations and
261 made the callbacks pure virtual instead, so the compiler could tell me
262 if I made a mistake in one of the subclasses.
264 * kjs/debugger.h: Removed a bunch of irrelevent data from the debugger
265 callbacks. Changed from passing an ExecState* to passing a
266 DebuggerCallFrame*, since an ExecState* doesn't contain sufficient
270 (KJS::globalFuncEval): Easiest bug fix evar!
272 [Previously missing files from r33553]
273 * kjs/DebuggerCallFrame.cpp: Copied from JavaScriptCore/profiler/FunctionCallProfile.h.
274 (KJS::DebuggerCallFrame::functionName):
275 (KJS::DebuggerCallFrame::thisObject):
276 (KJS::DebuggerCallFrame::evaluateScript):
277 * kjs/DebuggerCallFrame.h: Copied from JavaScriptCore/VM/Register.h.
278 (KJS::DebuggerCallFrame::DebuggerCallFrame):
279 (KJS::DebuggerCallFrame::scopeChain):
280 (KJS::DebuggerCallFrame::exception):
282 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
286 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
287 <https://bugs.webkit.org/show_bug.cgi?id=18991>
289 Fix the last remaining blocking cases of this bug.
293 (KJS::ReadModifyResolveNode::emitCode):
295 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
301 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
302 <https://bugs.webkit.org/show_bug.cgi?id=18991>
304 Ensure that the code generated for assignments uses temporaries whenever
305 necessary. This patch covers the vast majority of situations, but there
306 are still a few left.
308 This patch also adds some missing cases to CodeBlock::dump().
311 (KJS::CodeBlock::dump):
312 * VM/CodeGenerator.h:
313 (KJS::CodeGenerator::destinationForAssignResult):
314 (KJS::CodeGenerator::leftHandSideNeedsCopy):
315 (KJS::CodeGenerator::emitNodeForLeftHandSide):
319 (KJS::AssignDotNode::emitCode):
320 (KJS::ReadModifyDotNode::emitCode):
321 (KJS::AssignBracketNode::emitCode):
322 (KJS::ReadModifyBracketNode::emitCode):
323 (KJS::ForInNode::ForInNode):
325 (KJS::ReadModifyResolveNode::):
326 (KJS::AssignResolveNode::):
327 (KJS::ReadModifyBracketNode::):
328 (KJS::AssignBracketNode::):
329 (KJS::AssignDotNode::):
330 (KJS::ReadModifyDotNode::):
332 2008-05-17 Oliver Hunt <oliver@apple.com>
336 Bug 19106: SquirrelFish: Activation is not marked correctly
337 <https://bugs.webkit.org/show_bug.cgi?id=19106>
339 We can't rely on the symbol table for a count of the number of globals
340 we need to mark as that misses duplicate parameters and 'this'. Now we
341 use the actual local register count from the codeBlock.
343 * kjs/JSActivation.cpp:
344 (KJS::JSActivation::mark):
346 2008-05-16 Oliver Hunt <oliver@apple.com>
350 Bug 19076: SquirrelFish: RegisterFile can be corrupted if implictly reenter global scope with no declared vars
351 <https://bugs.webkit.org/show_bug.cgi?id=19076>
353 Don't delay allocation of initial global RegisterFile, as we can't guarantee we will be able
354 to allocate the global 'this' register safely at any point after initialisation of the Global
357 Unfortunately this initial allocation caused a regression of 0.2-0.3%, however this patch adds
358 support for the static slot optimisation for the global Math object which brings it to a 0.3%
361 * VM/CodeGenerator.cpp:
362 (KJS::CodeGenerator::programCodeThis):
363 (KJS::CodeGenerator::CodeGenerator):
364 (KJS::CodeGenerator::addParameter):
365 * VM/CodeGenerator.h:
367 (KJS::Machine::execute):
369 * kjs/JSGlobalObject.cpp:
370 (KJS::JSGlobalObject::reset):
371 * kjs/JSGlobalObject.h:
372 (KJS::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
373 (KJS::JSGlobalObject::addStaticGlobals):
376 2008-05-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
378 Reviewed by Oliver Hunt.
380 Bug 19098: SquirrelFish: Ref'd temporaries can be clobbered
381 <https://bugs.webkit.org/show_bug.cgi?id=19098>
383 When doing code generation for a statement list, increase the reference
384 count on a register that might eventually be returned, so that it doesn't
385 get clobbered by a request for a new temporary.
388 (KJS::statementListEmitCode):
390 2008-05-16 Maciej Stachowiak <mjs@apple.com>
394 - fixed Bug 19044: SquirrelFish: Bogus values enter evaluation when closing over scope with parameter and var with same name
395 https://bugs.webkit.org/show_bug.cgi?id=19044
397 * kjs/JSActivation.cpp:
398 (KJS::JSActivation::copyRegisters): Use numLocals from the code
399 block rather than the size of the symbol table for the number of
400 registers to copy, to account for duplicate parameters and vars
401 with the same name as parameters (we still have potentially
402 suboptimal codegen in that we allocate a local register for the
403 var in the latter case but it is never used).
405 2008-05-15 Geoffrey Garen <ggaren@apple.com>
409 We regret to inform you that your program is crashing because you were
413 (KJS::Machine::privateExecute): Math is hard.
415 2008-05-14 Geoffrey Garen <ggaren@apple.com>
417 Reviewed by Oliver Hunt.
419 A little more debugger action: filled in op_debug. All debugger control
420 flow works now, but variable inspection and backtraces still don't.
422 SunSpider reports no change.
424 * VM/CodeGenerator.cpp: Changed op_debug to accept line number parameters.
427 (KJS::Machine::getFunctionAndArguments): Moved op_debug into a
428 NEVER_INLINE function to avoid a stunning 10% performance regression.
429 Also factored out a common function for retrieving the function and
430 arguments from a call frame.
432 * kjs/JSActivation.cpp:
433 (KJS::JSActivation::createArgumentsObject): Use the new factored out
434 function mentioned above.
437 (KJS::Parser::parse): Increment m_sourceId before assigning it, so the
438 sourceId we send to the debugger matches the sourceId recorded in the
441 * kjs/nodes.cpp: Emit debugging hooks.
443 2008-05-14 Oliver Hunt <oliver@apple.com>
447 Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
448 <https://bugs.webkit.org/show_bug.cgi?id=19024>
450 This fixes a number of issues. The most important is that we now check every register
451 file for tainting rather than just looking for function register files as that was
452 insufficient. Additionally guarded against implicit re-entry into Eval code.
454 Also added a few additional assertions to reduce the amout of time between something
455 going wrong and us seeing the error.
458 (KJS::Machine::execute):
459 (KJS::Machine::privateExecute):
460 * VM/RegisterFile.cpp:
461 (KJS::RegisterFile::growBuffer):
462 (KJS::RegisterFile::addGlobalSlots):
463 * VM/RegisterFileStack.cpp:
464 (KJS::RegisterFileStack::pushGlobalRegisterFile):
465 (KJS::RegisterFileStack::pushFunctionRegisterFile):
466 * VM/RegisterFileStack.h:
467 (KJS::RegisterFileStack::inImplicitCall):
469 2008-05-14 Geoffrey Garen <ggaren@apple.com>
471 Reviewed by Oliver Hunt.
473 A little more debugger action: emit opcodes for debugger hooks. Right
474 now, the opcode implementation is just a stub.
476 SunSpider reports no change.
478 Some example codegen for "function f() { 1; }":
480 [ 0] dbg DidEnterCallFrame
481 [ 2] dbg WillExecuteStatement
482 [ 4] load tr0, 1(@k0)
483 [ 7] load tr0, undefined(@k1)
484 [ 10] dbg WillLeaveCallFrame
487 2008-05-14 Oliver Hunt <oliver@apple.com>
491 Bug 19025: SQUIRRELFISH: malformed syntax in onload handler causes crash
492 <https://bugs.webkit.org/show_bug.cgi?id=19025>
494 Simple fix -- move the use of functionBodyNode to after the null check.
496 * kjs/function_object.cpp:
497 (KJS::FunctionObjectImp::construct):
499 2008-05-13 Geoffrey Garen <ggaren@apple.com>
501 Reviewed by Oliver Hunt.
503 Fixed a codegen crash with run-time parse errors.
505 SunSpider reports no change.
507 emitThrowError needs to return the temporary holding the error, not dst,
508 since dst may be NULL. In fact, emitThrowError shouldn't take a dst
509 parameter at all, since exceptions should not modify the destination
512 2008-05-13 Oliver Hunt <oliver@apple.com>
516 Bug 19027: SquirrelFish: Incorrect codegen for pre-increment
517 <https://bugs.webkit.org/show_bug.cgi?id=19027>
519 This fixes the codegen issues for the pre-inc/decrement operators
520 to prevent incorrectly clobbering the destination in the event of
524 (KJS::CodeBlock::dump):
525 * VM/CodeGenerator.cpp:
526 (KJS::CodeGenerator::emitPreInc):
527 (KJS::CodeGenerator::emitPreDec):
528 * VM/CodeGenerator.h:
530 (KJS::Machine::privateExecute):
533 (KJS::PreIncResolveNode::emitCode):
534 (KJS::PreDecResolveNode::emitCode):
535 (KJS::PreIncBracketNode::emitCode):
536 (KJS::PreDecBracketNode::emitCode):
537 (KJS::PreIncDotNode::emitCode):
538 (KJS::PreDecDotNode::emitCode):
540 2008-05-13 Geoffrey Garen <ggaren@apple.com>
542 Reviewed by Oliver Hunt.
544 A little more debugger action: supply a real line number, sourceId,
545 and sourceURL in op_new_error.
547 SunSpider reports a .2% speedup. Not sure what that's about.
550 (KJS::Machine::privateExecute): Use the new good stuff in op_new_error.
553 (KJS::RegExpNode::emitCode): Use the shared emitThrowError instead of
556 2008-05-13 Geoffrey Garen <ggaren@apple.com>
558 Reviewed by Oliver Hunt.
560 A little more debugger action: implemented the exception callback.
562 SunSpider reports a .2% speedup. Not sure what that's about.
564 * VM/CodeBlock.h: A little refactoring here. Store a pointer to our
565 owner ScopeNode so we can retrieve data from it. This allows us to
566 stop storing copies of the data ourselves. Also, store a "this" register
567 instead of a code type, since we were only using the code type to
568 calculate the "this" register.
570 * VM/CodeGenerator.cpp:
571 (KJS::CodeGenerator::generate): Calculate the "this" register mentioned
572 above. Also, take care of removing "this" from the symbol table after
573 codegen is done, since relying on the timing of a destructor for correct
574 behavior is not so good.
577 (KJS::Machine::throwException): Invoke the debugger's exception callback.
578 (KJS::Machine::privateExecute): Use the "this" register mentioned above.
580 2008-05-13 Geoffrey Garen <ggaren@apple.com>
582 Reviewed by Oliver Hunt.
584 Removed some unused exception machinery.
586 SunSpider reports a .3% speedup.
588 * API/JSCallbackObject.h:
589 * API/JSCallbackObjectFunctions.h:
590 * JavaScriptCore.exp:
592 (KJS::Machine::privateExecute):
598 2008-05-13 Geoffrey Garen <ggaren@apple.com>
600 Reviewed by Oliver Hunt.
602 A little more debugger action.
605 * kjs/debugger.h: Removed debuggersPresent because it was unused.
606 Replaced AttachedGlobalObject linked list with a HashSet because HashSet
607 is faster and simpler. Changed all functions to return void instead of
608 bool, because no clients ever return false, and we don't want to support
611 * kjs/nodes.cpp: Did some up-keep to avoid build bustage.
612 (KJS::Node::handleException):
613 (KJS::BreakpointCheckStatement::execute):
614 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
616 2008-05-13 Oliver Hunt <oliver@apple.com>
620 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
621 <https://bugs.webkit.org/show_bug.cgi?id=18752>
623 Replace old attempt at "branchless" exceptions as the extra information
624 being passed made gcc an unhappy compiler, replacing these custom toNumber
625 calls with ordinary toNumber logic (by relying on toNumber now preventing
626 side effects after an exception has been thrown) provided sufficient leeway
627 to add the additional checks for the remaining unchecked cases.
629 This leaves only toString conversions in certain contexts as possibly
635 (KJS::resolveBaseAndProperty):
636 (KJS::resolveBaseAndFunc):
637 (KJS::Machine::privateExecute):
640 (KJS::JSValue::safeGetNumber):
642 2008-05-13 Geoffrey Garen <ggaren@apple.com>
644 Reviewed by Oliver Hunt.
646 First steps toward supporting the debugger API: support the sourceParsed
647 callback; plus some minor fixups.
649 SunSpider reports no regression.
651 * VM/CodeGenerator.h: Removed a misleading comment.
653 * kjs/Parser.h: Changed the parser to take an ExecState*, so it can
654 implement the sourceParsed callback -- that way, we only have to
655 implement the callback in one place.
657 * kjs/debugger.cpp: Nixed DebuggerImp, because its sole purpose in life
658 was to demonstrate the misapplication of design patterns.
660 * kjs/debugger.h: Changed sourceParsed to take a SourceProvider, to
661 reduce copying, and not to return a value, because pausing execution
662 after parsing is complicated, and no clients needed that ability, anyway.
664 * kjs/grammar.y: Make sure never to pass a NULL SourceElements* to
665 didFinishParsing -- that simplifies some code down the road.
667 * kjs/nodes.cpp: Don't generate special AST nodes just because the
668 debugger is attached -- that's a relic of the old AST execution model,
669 and those nodes haven't been maintained.
671 2008-05-13 Oliver Hunt <oliver@apple.com>
675 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
676 <https://bugs.webkit.org/show_bug.cgi?id=18752>
678 First step: prevent incorrect evaluation of valueOf/toString conversion
679 in right hand side of expression after earlier conversion throws.
681 * API/JSCallbackObjectFunctions.h:
684 (KJS::JSObject::defaultValue):
686 2008-05-12 Oliver Hunt <oliver@apple.com>
690 Bug 18934: SQUIRRELFISH: ASSERT @ nytimes.com due to RegisterFile being clobbered
691 <https://bugs.webkit.org/show_bug.cgi?id=18934>
693 Unfortunately we cannot create new statically optimised globals if there are any
694 tainted RegisterFiles on the RegisterFileStack. To handle this we re-introduce
695 (in a slightly cleaner form) the inImplicitCall concept to the RegisterFileStack.
698 (KJS::Machine::execute):
699 * VM/RegisterFileStack.cpp:
700 (KJS::RegisterFileStack::pushFunctionRegisterFile):
701 * VM/RegisterFileStack.h:
703 2008-05-12 Geoffrey Garen <ggaren@apple.com>
705 Reviewed by Maciej Stachowiak.
707 Introduced support for function.caller.
709 Improved support for walking interesting scopes for function introspection.
711 This fixes all remaining layout tests not blocked by rebasing to trunk.
713 SunSpider reports no change.
716 (KJS::Machine::dumpRegisters): Fixed a spacing issue.
718 2008-05-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
722 Bug 18961: SQUIRRELFISH: Gmail doesn't load
723 <https://bugs.webkit.org/show_bug.cgi?id=18961>
725 Fix codegen for logical nodes so that they don't use their destination
729 (KJS::LogicalAndNode::emitCode):
730 (KJS::LogicalOrNode::emitCode):
732 2008-05-10 Maciej Stachowiak <mjs@apple.com>
736 - JavaScriptCore part of fix for: "SQUIRRELFISH: function toString broken after calling"
737 https://bugs.webkit.org/show_bug.cgi?id=18869
739 Three layout tests are fixed:
740 fast/js/toString-elision-trailing-comma.html
741 fast/js/toString-prefix-postfix-preserve-parens.html
742 fast/js/kde/lval-exceptions.html
744 Functions now save a shared subrange of the original source used
745 to make them (so in the common case this adds no storage above the
748 * kjs/SourceProvider.h: Added.
749 (KJS::SourceProvider): New abstract base class for classes that provide on-demand access
750 to the source for a JavaScript program. This allows function objects to have access to their
751 original source without copying.
752 (KJS::UStringSourceProvider): SourceProvider subclass backed by a KJS::UString.
753 (KJS::UStringSourceProvider::create):
754 (KJS::UStringSourceProvider::getRange):
755 (KJS::UStringSourceProvider::data):
756 (KJS::UStringSourceProvider::length):
757 (KJS::UStringSourceProvider::UStringSourceProvider):
758 * kjs/SourceRange.h: Added.
759 (KJS::SourceRange::SourceRange): Class that holds a SourceProvider and a character range into
760 the source, to encapsulate on-demand access to the source of a function.
761 (KJS::SourceRange::toString):
763 (KJS::eval): Pass a UStringSourceProvider to the parser.
765 (KJS::Parser::parse): Take a SourceProvider and pass it on to the lexer.
767 (KJS::Parser::parse): Take a SourceProvider.
769 (KJS::Lexer::setCode): Take a SourceProvider; keep it around, and
770 use it to get the raw buffer and length.
772 (KJS::Lexer::sourceRange): Convenience function to get a source
773 range based on the lexer's source provieder, and char offsets
774 right before and after the desired range.
776 (KJS::globalFuncEval): Pass a UStringSourceProvider to the parser.
777 * kjs/function_object.cpp:
778 (KJS::functionProtoFuncToString): Use toSourceString to get the source.
779 (KJS::FunctionObjectImp::construct): Give the parser a UStringSourceProvider.
780 * kjs/grammar.y: When parsing a function declaration, function
781 expression, or getter or setter, tell the function body about its
783 * kjs/interpreter.cpp:
784 (KJS::Interpreter::checkSyntax): Pass a SourceProvider to the parser.
785 (KJS::Interpreter::evaluate): Pass a SourceProvider to the parser.
788 (KJS::FunctionBodyNode::setSource): Establish a SourceRange for this function.
789 (KJS::FunctionBodyNode::toSourceString): Get the source string out
791 (KJS::FuncExprNode::): Take a SourceRange and set it on the body.
792 (KJS::FuncDeclNode::): ditto
794 (prettyPrintScript): Use a SourceProvider appropriately.
795 * JavaScriptCore.exp: Export new symbols.
796 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add new files.
797 * JavaScriptCore.xcodeproj/project.pbxproj: Add new files.
799 2008-05-09 Oliver Hunt <oliver@apple.com>
803 Bring back RegisterFile tainting in order to correctly handle
804 natively implemented getters and setters that re-enter JavaScript
807 (KJS::Machine::privateExecute):
810 (KJS::FunctionImp::callAsFunction):
812 (KJS::JSObject::put):
813 (KJS::tryGetAndCallProperty):
814 * kjs/property_slot.cpp:
815 (KJS::PropertySlot::functionGetter):
817 2008-05-09 Maciej Stachowiak <mjs@apple.com>
821 - track character offsets of open and close braces, in preparation for saving function source
823 I verified that there is no performance regression from this change.
828 (KJS::Lexer::matchPunctuator):
831 2008-05-09 Oliver Hunt <oliver@apple.com>
833 Reviewed by Nobody (build fix).
837 * kjs/JSGlobalObject.cpp:
838 (KJS::JSGlobalObject::restoreLocalStorage):
840 2008-05-09 Oliver Hunt <oliver@apple.com>
844 Build fixes for SquirrelFish on windows.
846 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
847 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
849 * kjs/JSGlobalObject.cpp:
850 (KJS::JSGlobalObject::restoreLocalStorage):
852 (KJS::Collector::allocate):
853 (KJS::Collector::allocateNumber):
855 (KJS::Collector::allocate):
856 (KJS::Collector::allocateNumber):
857 * kjs/property_slot.cpp:
859 2008-05-08 Maciej Stachowiak <mjs@apple.com>
863 - fix activation tearoff in the case where functions are called with too many arguments
866 fast/canvas/patternfill-repeat.html
867 fast/dom/SelectorAPI/bug-17313.html
870 (KJS::slideRegisterWindowForCall):
871 (KJS::scopeChainForCall):
872 (KJS::Machine::execute):
873 (KJS::Machine::privateExecute):
875 2008-05-08 Geoffrey Garen <ggaren@apple.com>
877 Reviewed by Oliver Hunt.
879 Fixed failure in fast/canvas/canvas-pattern-behaviour.html.
881 SunSpider reports a small speedup. Not sure what that's about.
884 (KJS::CodeBlock::dump): Fixed op_call_eval to dump as "op_call_eval".
885 This helped me while debugging.
888 (KJS::Machine::unwindCallFrame): When looking for an activation to tear
889 off, don't use the scope chain. Inside eval, the scope chain doesn't
890 belong to us; it belongs to our calling function.
892 Also, don't use the needsFullScopeChain flag to decide whether to tear
893 off the activation. "function.arguments" can create an activation
894 for a function whose needsFullScopeChain flag is set to false.
896 2008-05-08 Maciej Stachowiak <mjs@apple.com>
900 - fix function.call for calls of more than 8 arguments
902 Fixes svg/carto.net/button.svg
905 (KJS::List::getSlice): properly set up the m_buffer of the target list.
907 2008-05-08 Maciej Stachowiak <mjs@apple.com>
911 - don't return a null RegisterID from RegExpNode in the exception case, since the caller may need a real register
914 - fast/regex/early-acid3-86.html
915 - http/tests/misc/acid3.html
918 (KJS::RegExpNode::emitCode):
920 2008-05-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
924 Fix a performance regression caused by the introduction of property
925 attributes to SymbolTable in r32859 by encoding the attributes and the
926 register index into a single field of SymbolTableEntry.
928 This leaves Node::optimizeVariableAccess() definitely broken, although
929 it was probably not entirely correct in SquirrelFish before this change.
932 (KJS::missingThisObjectMarker):
933 * VM/CodeGenerator.cpp:
934 (KJS::CodeGenerator::addVar):
935 (KJS::CodeGenerator::CodeGenerator):
936 (KJS::CodeGenerator::registerForLocal):
937 (KJS::CodeGenerator::registerForLocalConstInit):
938 (KJS::CodeGenerator::isLocalConstant):
939 (KJS::CodeGenerator::addConstant):
940 (KJS::CodeGenerator::emitCall):
941 * VM/CodeGenerator.h:
942 (KJS::CodeGenerator::IdentifierMapIndexHashTraits::emptyValue):
944 (KJS::Machine::privateExecute):
945 * kjs/JSGlobalObject.cpp:
946 (KJS::JSGlobalObject::saveLocalStorage):
947 * kjs/JSVariableObject.cpp:
948 (KJS::JSVariableObject::getPropertyNames):
949 (KJS::JSVariableObject::getPropertyAttributes):
950 * kjs/JSVariableObject.h:
951 (KJS::JSVariableObject::symbolTableGet):
952 (KJS::JSVariableObject::symbolTablePut):
953 (KJS::JSVariableObject::symbolTablePutWithAttributes):
955 (KJS::SymbolTableEntry::SymbolTableEntry):
956 (KJS::SymbolTableEntry::isEmpty):
957 (KJS::SymbolTableEntry::getIndex):
958 (KJS::SymbolTableEntry::getAttributes):
959 (KJS::SymbolTableEntry::setAttributes):
960 (KJS::SymbolTableEntry::isReadOnly):
962 (KJS::getSymbolTableEntry):
963 (KJS::PostIncResolveNode::optimizeVariableAccess):
964 (KJS::PostDecResolveNode::optimizeVariableAccess):
965 (KJS::DeleteResolveNode::optimizeVariableAccess):
966 (KJS::TypeOfResolveNode::optimizeVariableAccess):
967 (KJS::PreIncResolveNode::optimizeVariableAccess):
968 (KJS::PreDecResolveNode::optimizeVariableAccess):
969 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
970 (KJS::AssignResolveNode::optimizeVariableAccess):
971 (KJS::ProgramNode::initializeSymbolTable):
973 2008-05-06 Maciej Stachowiak <mjs@apple.com>
975 Rubber stamped by Oliver.
977 - add missing ! in an assert that I failed to reverse
979 * VM/CodeGenerator.cpp:
980 (KJS::CodeGenerator::CodeGenerator):
982 2008-05-06 Maciej Stachowiak <mjs@apple.com>
986 - fixed "SQUIRRELFISH: window.this shows up as a property, but it shouldn't"
987 https://bugs.webkit.org/show_bug.cgi?id=18868
989 The basic approach is to have "this" only be present in the symbol
990 table at compile time, not runtime.
992 * VM/CodeGenerator.cpp:
993 (KJS::CodeGenerator::~CodeGenerator): Remove "this" from symbol table.
994 (KJS::CodeGenerator::CodeGenerator): Add "this" back when re-using
996 * VM/CodeGenerator.h:
998 (KJS::Machine::execute): Don't assert that "this" is in the symbol table.
1000 2008-05-06 Geoffrey Garen <ggaren@apple.com>
1002 Reviewed by Oliver Hunt.
1004 Trivial support for function.arguments: Currently, we only support
1005 function.arguments from within the scope of function.
1007 This fixes the remaining Mozilla JS test failures.
1009 SunSpider reports no change.
1011 * JavaScriptCore.exp:
1014 (KJS::Machine::privateExecute): Separated scope chain deref from
1015 activation register copying: since it is now possible for client code
1016 to create an activation on behalf of a function that otherwise wouldn't
1017 need one, having an activation no longer necessarily means that you need
1018 to deref the scope chain.
1020 (KJS::Machine::getCallFrame): For now, this function only examines the
1021 current scope. Walking parent scopes requires some refactoring in the
1022 way we track execution stacks.
1024 * kjs/ExecState.cpp:
1025 (KJS::ExecState::ExecState): We use a negative call frame offset to
1026 indicate that a given scope is not a function call scope.
1028 2008-05-05 Oliver Hunt <oliver@apple.com>
1032 Fix call frame set up for native -> JS function calls.
1035 (KJS::Machine::execute):
1037 2008-05-05 Geoffrey Garen <ggaren@apple.com>
1039 Reviewed by Maciej Stachowiak.
1041 Fixed ecma_3/Object/8.6.2.6-001.js, and similar bugs.
1043 SunSpider reports a .4% speedup. Not sure what that's about.
1046 (KJS::Machine::privateExecute): Check for exception return from equal,
1047 since toPrimitive can throw.
1049 * kjs/operations.cpp:
1050 (KJS::strictEqual): In response to an error I made in an earlier version
1051 of this patch, I changed strictEqual to make clear the fact that it
1052 performs no conversions and can't throw, making it slightly more efficient
1055 2008-05-05 Maciej Stachowiak <mjs@apple.com>
1059 - fix some dumb mistakes in my last patch
1061 * VM/CodeGenerator.cpp:
1062 (KJS::CodeGenerator::emitPushScope):
1063 (KJS::CodeGenerator::emitGetPropertyNames):
1065 (KJS::Machine::privateExecute):
1067 2008-05-05 Maciej Stachowiak <mjs@apple.com>
1071 - document opcodes relating to jumps, scopes, and property name iteration
1073 Documented jmp, jtrue, false, push_scope, pop_scope, get_pnames,
1074 next_pname and jmp_scopes.
1076 * VM/CodeGenerator.cpp:
1077 (KJS::CodeGenerator::emitJump):
1078 (KJS::CodeGenerator::emitJumpIfTrue):
1079 (KJS::CodeGenerator::emitJumpIfFalse):
1080 (KJS::CodeGenerator::emitPushScope):
1081 (KJS::CodeGenerator::emitNextPropertyName):
1082 (KJS::CodeGenerator::emitGetPropertyNames):
1083 * VM/CodeGenerator.h:
1085 (KJS::Machine::privateExecute):
1087 (KJS::LogicalAndNode::emitCode):
1088 (KJS::LogicalOrNode::emitCode):
1089 (KJS::ConditionalNode::emitCode):
1090 (KJS::IfNode::emitCode):
1091 (KJS::IfElseNode::emitCode):
1092 (KJS::DoWhileNode::emitCode):
1093 (KJS::WhileNode::emitCode):
1094 (KJS::ForNode::emitCode):
1095 (KJS::ForInNode::emitCode):
1096 (KJS::WithNode::emitCode):
1098 2008-05-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1102 Bug 18749: SQUIRRELFISH: const support is broken
1103 <https://bugs.webkit.org/show_bug.cgi?id=18749>
1105 Adds support for const during code generation.
1107 Fixes 2 layout tests.
1110 * VM/CodeGenerator.cpp:
1111 (KJS::CodeGenerator::addVar):
1112 (KJS::CodeGenerator::CodeGenerator):
1113 (KJS::CodeGenerator::isLocalConstant):
1114 * VM/CodeGenerator.h:
1115 (KJS::CodeGenerator::addVar):
1117 (KJS::PostIncResolveNode::emitCode):
1118 (KJS::PostDecResolveNode::emitCode):
1119 (KJS::PreIncResolveNode::emitCode):
1120 (KJS::PreDecResolveNode::emitCode):
1121 (KJS::ReadModifyResolveNode::emitCode):
1122 (KJS::AssignResolveNode::emitCode):
1124 2008-05-04 Maciej Stachowiak <mjs@apple.com>
1128 - document some more opcodes (and fix argument names)
1130 Added docs for eq, neq, stricteq, nstriceq, less and lesseq.
1132 * VM/CodeGenerator.cpp:
1133 (KJS::CodeGenerator::emitEqual):
1134 (KJS::CodeGenerator::emitNotEqual):
1135 (KJS::CodeGenerator::emitStrictEqual):
1136 (KJS::CodeGenerator::emitNotStrictEqual):
1137 (KJS::CodeGenerator::emitLess):
1138 (KJS::CodeGenerator::emitLessEq):
1139 * VM/CodeGenerator.h:
1141 (KJS::Machine::privateExecute):
1143 (KJS::LessNode::emitCode):
1144 (KJS::GreaterNode::emitCode):
1145 (KJS::LessEqNode::emitCode):
1146 (KJS::GreaterEqNode::emitCode):
1147 (KJS::EqualNode::emitCode):
1148 (KJS::NotEqualNode::emitCode):
1149 (KJS::StrictEqualNode::emitCode):
1150 (KJS::NotStrictEqualNode::emitCode):
1151 (KJS::CaseBlockNode::emitCodeForBlock):
1153 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1155 Reviewed by Maciej Stachowiak.
1157 More scaffolding for f.arguments.
1159 Track the offset of the last call frame in the ExecState, so we can
1160 produce a backtrace at any time.
1162 Also, record numLocals, the sum of numVars + numParameters, in each code
1163 block, to make updates to the ExecState a little cheaper than they
1166 We now use numLocals in a bunch of places where we used to calculate
1167 numVars + numParameters or -numVars - numParameters.
1169 Reports are mixed, but all in all, this seems to be a wash on SunSpider.
1171 2008-05-04 Oliver Hunt <oliver@apple.com>
1175 Whoops, correctly handle properties that don't exist in the
1178 * kjs/JSVariableObject.h:
1179 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1181 2008-05-04 Oliver Hunt <oliver@apple.com>
1185 Add attribute information to SymbolTable as ground work for
1186 various DontEnum and ReadOnly issues.
1188 * VM/CodeGenerator.cpp:
1189 (KJS::CodeGenerator::addVar):
1190 (KJS::CodeGenerator::CodeGenerator):
1191 (KJS::CodeGenerator::registerForLocal):
1192 (KJS::CodeGenerator::registerForLocalConstInit):
1193 (KJS::CodeGenerator::addConstant):
1195 (KJS::Machine::execute):
1196 * kjs/JSGlobalObject.cpp:
1197 (KJS::JSGlobalObject::saveLocalStorage):
1198 * kjs/JSVariableObject.cpp:
1199 (KJS::JSVariableObject::getPropertyNames):
1200 (KJS::JSVariableObject::getPropertyAttributes):
1201 * kjs/JSVariableObject.h:
1202 (KJS::JSVariableObject::symbolTablePut):
1203 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1204 * kjs/SymbolTable.h:
1205 (KJS::SymbolTableEntry::SymbolTableEntry):
1206 (KJS::SymbolTableIndexHashTraits::emptyValue):
1208 (KJS::getSymbolTableEntry):
1209 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1210 (KJS::AssignResolveNode::optimizeVariableAccess):
1211 (KJS::ProgramNode::initializeSymbolTable):
1213 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1215 Reviewed by Oliver Hunt.
1217 More scaffolding for f.arguments.
1219 Store the register file associated with an ExecState in the ExecState.
1221 SunSpider reports no change.
1223 * kjs/JSGlobalObject.h:
1224 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Moved
1225 registerFileStack above globalExec, so it gets initialized first.
1226 Removed remnants of old activation scheme.
1228 2008-05-04 Maciej Stachowiak <mjs@apple.com>
1230 Rubber stamped by Oliver.
1232 - renamed a few opcodes and fixed assembly formatting to accomodate the longest opcode
1236 resolve_base_and_property --> resolve_with_base
1237 resolve_base_and_func --> resolve_func
1238 get_prop_id --> get_by_id
1239 put_prop_id --> put_by_id
1240 delete_prop_id --> del_by_id
1241 get_prop_val --> get_by_val
1242 put_prop_val --> put_by_val
1243 delete_prop_val --> del_by_val
1244 put_prop_index --> put_by_index
1247 (KJS::printUnaryOp):
1248 (KJS::printBinaryOp):
1249 (KJS::printConditionalJump):
1250 (KJS::CodeBlock::dump):
1251 * VM/CodeGenerator.cpp:
1252 (KJS::CodeGenerator::emitEqual):
1253 (KJS::CodeGenerator::emitNotEqual):
1254 (KJS::CodeGenerator::emitResolveWithBase):
1255 (KJS::CodeGenerator::emitResolveFunction):
1256 (KJS::CodeGenerator::emitGetById):
1257 (KJS::CodeGenerator::emitPutById):
1258 (KJS::CodeGenerator::emitDeleteById):
1259 (KJS::CodeGenerator::emitGetByVal):
1260 (KJS::CodeGenerator::emitPutByVal):
1261 (KJS::CodeGenerator::emitDeleteByVal):
1262 (KJS::CodeGenerator::emitPutByIndex):
1263 * VM/CodeGenerator.h:
1265 (KJS::Machine::privateExecute):
1268 (KJS::ArrayNode::emitCode):
1269 (KJS::PropertyListNode::emitCode):
1270 (KJS::BracketAccessorNode::emitCode):
1271 (KJS::DotAccessorNode::emitCode):
1272 (KJS::EvalFunctionCallNode::emitCode):
1273 (KJS::FunctionCallResolveNode::emitCode):
1274 (KJS::FunctionCallBracketNode::emitCode):
1275 (KJS::FunctionCallDotNode::emitCode):
1276 (KJS::PostIncResolveNode::emitCode):
1277 (KJS::PostDecResolveNode::emitCode):
1278 (KJS::PostIncBracketNode::emitCode):
1279 (KJS::PostDecBracketNode::emitCode):
1280 (KJS::PostIncDotNode::emitCode):
1281 (KJS::PostDecDotNode::emitCode):
1282 (KJS::DeleteResolveNode::emitCode):
1283 (KJS::DeleteBracketNode::emitCode):
1284 (KJS::DeleteDotNode::emitCode):
1285 (KJS::TypeOfResolveNode::emitCode):
1286 (KJS::PreIncResolveNode::emitCode):
1287 (KJS::PreDecResolveNode::emitCode):
1288 (KJS::PreIncBracketNode::emitCode):
1289 (KJS::PreDecBracketNode::emitCode):
1290 (KJS::PreIncDotNode::emitCode):
1291 (KJS::PreDecDotNode::emitCode):
1292 (KJS::ReadModifyResolveNode::emitCode):
1293 (KJS::AssignResolveNode::emitCode):
1294 (KJS::AssignDotNode::emitCode):
1295 (KJS::ReadModifyDotNode::emitCode):
1296 (KJS::AssignBracketNode::emitCode):
1297 (KJS::ReadModifyBracketNode::emitCode):
1298 (KJS::ConstDeclNode::emitCodeSingle):
1299 (KJS::ForInNode::emitCode):
1300 (KJS::TryNode::emitCode):
1302 2008-05-04 Oliver Hunt <oliver@apple.com>
1306 Fix assertion when accessing arguments object with too many arguments provided
1308 The arguments constructor was assuming that the register offset given for argv
1309 was an absolute offset into the registerfile, rather than the offset from the
1310 frame. This patches corrects that issue.
1312 * kjs/JSActivation.cpp:
1313 (KJS::JSActivation::createArgumentsObject):
1315 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1317 Rubber stamped by Sam Weinig.
1319 Cleaned up Machine.cpp according to our style guidelines: moved static
1320 data to the top of the file; moved stand-alone functions below that;
1321 moved the Machine constructor above other Machine member functions.
1323 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1327 - fix accidental breakage from last patch
1330 (KJS::Machine::privateExecute):
1332 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1336 - a bunch more opcode documentation and corresponding parameter name fixes
1338 I renamed a few opcodes:
1340 type_of --> typeof (that's what the JS operator is named)
1341 instance_of --> instanceof (ditto)
1342 create_error --> new_error (for consistency with other new_* opcodes)
1344 I documented the following opcodes:
1366 I also fixed formatting on some existing opcode docs.
1369 (KJS::CodeBlock::dump):
1370 * VM/CodeGenerator.cpp:
1371 (KJS::CodeGenerator::emitMove):
1372 (KJS::CodeGenerator::emitNot):
1373 (KJS::CodeGenerator::emitPreInc):
1374 (KJS::CodeGenerator::emitPreDec):
1375 (KJS::CodeGenerator::emitPostInc):
1376 (KJS::CodeGenerator::emitPostDec):
1377 (KJS::CodeGenerator::emitToJSNumber):
1378 (KJS::CodeGenerator::emitNegate):
1379 (KJS::CodeGenerator::emitBitNot):
1380 (KJS::CodeGenerator::emitInstanceOf):
1381 (KJS::CodeGenerator::emitTypeOf):
1382 (KJS::CodeGenerator::emitIn):
1383 (KJS::CodeGenerator::emitLoad):
1384 (KJS::CodeGenerator::emitNewObject):
1385 (KJS::CodeGenerator::emitNewArray):
1386 (KJS::CodeGenerator::emitNewRegExp):
1387 (KJS::CodeGenerator::emitNewError):
1388 * VM/CodeGenerator.h:
1389 (KJS::CodeGenerator::scopeDepth):
1390 (KJS::CodeGenerator::addVar):
1392 (KJS::Machine::privateExecute):
1395 (KJS::Node::emitThrowError):
1396 (KJS::RegExpNode::emitCode):
1397 (KJS::TypeOfValueNode::emitCode):
1398 (KJS::UnaryPlusNode::emitCode):
1399 (KJS::NegateNode::emitCode):
1400 (KJS::BitwiseNotNode::emitCode):
1401 (KJS::LogicalNotNode::emitCode):
1402 (KJS::InstanceOfNode::emitCode):
1403 (KJS::InNode::emitCode):
1405 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1407 Reviewed by Geoff and Sam.
1409 - generate HTML bytecode docs at build time
1411 * DerivedSources.make:
1413 * docs/make-bytecode-docs.pl: Added.
1415 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1417 Reviewed by Sam Weinig.
1419 Update ExecState::m_scopeChain when switching scope chains inside the
1422 This fixes uses of lexicalGlobalObject, such as, in a subframe
1424 alert(top.makeArray() instanceof Array ? "FAIL" : "PASS");
1426 and a bunch of the security failures listed in
1427 https://bugs.webkit.org/show_bug.cgi?id=18870. (Those tests still fail,
1428 seemingly because of regressions in exception messages).
1430 SunSpider reports no change.
1432 * VM/Machine.cpp: Factored out scope chain updating into a common
1433 function that takes care to update ExecState::m_scopeChain, too.
1435 * kjs/ExecState.h: I made Machine a friend of ExecState so that Machine
1436 could update ExecState::m_scopeChain, even though that value is
1437 read-only for everyone else.
1439 * kjs/JSGlobalObject.h:
1440 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Changed
1441 this client to be a little friendlier to ExecState's internal
1442 storage type for scope chain data.
1444 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1446 Reviewed by Sam Weinig.
1448 Fixed https://bugs.webkit.org/show_bug.cgi?id=18876
1449 Squirrelfish: ScopeChainNode leak in op_jmp_scopes.
1451 SunSpider reports no change.
1454 (KJS::Machine::privateExecute): Don't construct a ScopeChain object,
1455 since the direct threaded interpreter will goto across its destructor.
1457 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1459 Reviewed by Oliver Hunt.
1461 A bit more efficient fix than r32832: Don't copy globals into function
1462 register files; instead, have the RegisterFileStack track only the base
1463 of the last *global* register file, so the global object's register
1464 references stay good.
1466 SunSpider reports a .3% speedup. Not sure what that's about.
1468 2008-05-03 Oliver Hunt <oliver@apple.com>
1472 Bug 18864: SquirrelFish: Support getter and setter definition in object literals
1473 <https://bugs.webkit.org/show_bug.cgi?id=18864>
1475 Add new opcodes to allow us to add getters and setters to an object. These are
1476 only used by the codegen for object literals.
1478 * VM/CodeGenerator.cpp:
1479 (KJS::CodeGenerator::emitPutGetter):
1480 (KJS::CodeGenerator::emitPutSetter):
1481 * VM/CodeGenerator.h:
1483 (KJS::Machine::privateExecute):
1486 (KJS::PropertyListNode::emitCode):
1488 2008-05-02 Maciej Stachowiak <mjs@apple.com>
1492 - properly copy globals into and out of implicit call register
1493 files, otherwise they will fail at global lookup
1495 Fixes fast/js/array-tostring-and-join.html layout test.
1497 * VM/RegisterFileStack.cpp:
1498 (KJS::RegisterFileStack::pushGlobalRegisterFile):
1499 (KJS::RegisterFileStack::popGlobalRegisterFile):
1500 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1501 (KJS::RegisterFileStack::popFunctionRegisterFile):
1503 2008-05-02 Geoffrey Garen <ggaren@apple.com>
1505 Reviewed by Oliver Hunt.
1507 Fixed https://bugs.webkit.org/show_bug.cgi?id=18822
1508 SQUIRRELFISH: incorrect eval used in some cases
1510 Changed all code inside the machine to fetch the lexical global object
1511 directly from the scope chain, instead of from the ExecState.
1513 Clients who fetch the lexical global object through the ExecState
1516 SunSpider reports no change.
1519 (KJS::Machine::privateExecute): Fetch the lexical global object from
1523 (KJS::ExecState::ExecState::lexicalGlobalObject): Moved the logic for
1524 this function into ScopeChainNode, but kept this function around to
1525 support existing clients.
1527 2008-05-02 Geoffrey Garen <ggaren@apple.com>
1529 Rubber stamped by Oliver Hunt.
1531 Removed ExecState.cpp from AllInOneFile.cpp, for a .2% speedup.
1533 * JavaScriptCore.xcodeproj/project.pbxproj:
1534 * kjs/AllInOneFile.cpp:
1536 2008-05-01 Oliver Hunt <oliver@apple.com>
1538 Reviewed by Geoff and Maciej.
1540 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
1541 <https://bugs.webkit.org/show_bug.cgi?id=18827>
1543 Remove safe/unsafe RegisterFile concept, and instead just add additional
1544 logic to ensure we always push/pop RegisterFiles when executing getters
1545 and setters, similar to the logic for valueOf and toString.
1548 (KJS::Machine::privateExecute):
1549 * VM/RegisterFile.h:
1551 (KJS::FunctionImp::callAsFunction):
1553 (KJS::JSObject::put):
1554 * kjs/property_slot.cpp:
1555 (KJS::PropertySlot::functionGetter):
1557 2008-05-01 Oliver Hunt <oliver@apple.com>
1561 Rename unsafeForReentry to safeForReentry to avoid double negatives.
1564 (KJS::Machine::privateExecute):
1565 * VM/RegisterFile.h:
1567 (KJS::FunctionImp::callAsFunction):
1569 2008-05-01 Oliver Hunt <oliver@apple.com>
1573 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
1574 <https://bugs.webkit.org/show_bug.cgi?id=18827>
1576 This patch makes getters and setters work. It does this by
1577 tracking whether the RegisterFile is "safe", that is whether
1578 the interpreter is in a state that in which it can handle
1579 the RegisterFile being reallocated.
1583 (KJS::Machine::privateExecute):
1584 * VM/RegisterFile.h:
1586 (KJS::FunctionImp::callAsFunction):
1588 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1590 Release build fix: Always compile in "isGlobalObject", since it's
1591 listed in our .exp file.
1593 * kjs/ExecState.cpp:
1594 (KJS::ExecState::isGlobalObject):
1597 2008-04-30 Oliver Hunt <oliver@apple.com>
1601 Minor code restructuring to prepare for getters and setters,
1602 also helps exception semantics a bit.
1605 (KJS::Machine::privateExecute):
1607 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1613 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1615 Debug build fix: export a missing symbol.
1617 * JavaScriptCore.exp:
1619 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1621 Reviewed by Oliver Hunt.
1623 A little more ExecState refactoring: Now, only the global object creates
1626 Also inlined ExecState::lexicalGlobalObject().
1628 SunSpider reports no change.
1630 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1632 WebCore build fix: forward-declare ScopeChain.
1634 * kjs/interpreter.h:
1636 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1638 Build fix for JavaScriptGlue: export a missing symbol.
1640 * JavaScriptCore.exp:
1642 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1644 Reviewed by Oliver Hunt.
1646 Removed a lot of unused bits from ExecState, moving them into
1647 OldInterpreterExecState, the fake scaffolding class.
1649 The clutter was making it hard to see the forest from the trees.
1651 .4% SunSpider speedup, probably because ExecState::lexicalGlobalObject()
1654 2008-04-29 Oliver Hunt <oliver@apple.com>
1658 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
1659 <https://bugs.webkit.org/show_bug.cgi?id=18643>
1661 Prevent static slot optimisation for new variables and functions in
1662 globally re-entrant code called from an an implicit function call.
1664 This is necessary to prevent us from needing to resize the global
1665 slot portion of the root RegisterFile during an implicit (and hence
1666 unguarded) function call.
1668 * VM/CodeGenerator.cpp:
1669 (KJS::CodeGenerator::CodeGenerator):
1670 * VM/CodeGenerator.h:
1672 (KJS::Machine::execute):
1673 * VM/RegisterFile.h:
1674 * VM/RegisterFileStack.cpp:
1675 (KJS::RegisterFileStack::pushGlobalRegisterFile):
1676 (KJS::RegisterFileStack::popGlobalRegisterFile):
1677 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1678 (KJS::RegisterFileStack::popFunctionRegisterFile):
1679 * VM/RegisterFileStack.h:
1680 (KJS::RegisterFileStack::inImplicitFunctionCall):
1681 (KJS::RegisterFileStack::lastGlobal):
1683 (KJS::ProgramNode::generateCode):
1685 (KJS::ProgramNode::):
1687 2008-04-29 Geoffrey Garen <ggaren@apple.com>
1689 Reviewed by Oliver Hunt.
1691 In nested program code, don't propogate "this" back to the parent
1692 register file. ("this" should remain constant in the parent register
1693 file, regardless of the scripts it invokes.)
1695 * VM/RegisterFile.cpp:
1696 (KJS::RegisterFile::copyGlobals):
1698 2008-04-28 Oliver Hunt <oliver@apple.com>
1702 Restore base pointer when popping a global RegisterFile
1704 * VM/RegisterFileStack.cpp:
1705 (KJS::RegisterFileStack::popGlobalRegisterFile):
1707 2008-04-28 Oliver Hunt <oliver@apple.com>
1711 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
1712 <https://bugs.webkit.org/show_bug.cgi?id=18643>
1714 Partial fix. This results in all implicit calls to toString or valueOf
1715 executing in a separate RegisterFile, so ensuring that the the pointers
1716 in the triggering interpreter don't get trashed. This still leaves the
1717 task of preventing new global re-entry from toString and valueOf from
1718 clobbering the RegisterFile.
1721 (KJS::Machine::execute):
1722 * VM/RegisterFileStack.cpp:
1723 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1724 (KJS::RegisterFileStack::popFunctionRegisterFile):
1725 * VM/RegisterFileStack.h:
1727 (KJS::tryGetAndCallProperty):
1729 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1731 Reviewed by Maciej Stachowiak.
1733 Simplified activation object a bit: No need to store the callee
1734 in the activation object -- we can pull it out of the call frame
1735 when needed, instead.
1737 SunSpider reports no change.
1739 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1741 Reviewed by Maciej Stachowiak.
1743 RS by Oliver Hunt on moving JSArguments.cpp out of AllInOneFile.cpp.
1745 Substantially more handling of "arguments": "arguments" works fully
1746 now, but "f.arguments" still doesn't work.
1748 Fixes 10 regression tests.
1750 SunSpider reports no regression.
1752 * kjs/JSActivation.cpp:
1753 (KJS::JSActivation::createArgumentsObject): Reconstruct an arguments
1754 List to pass to the arguments object constructor.
1756 * JavaScriptCore.xcodeproj/project.pbxproj:
1757 * kjs/AllInOneFile.cpp: Removed JSActivation.cpp from AllInOneFile.cpp
1758 because that seems to make GCC happy. (Previously, I had added
1759 JSActivation.cpp to AllInOneFile.cpp because *that* seemed to make GCC
1762 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1764 Reviewed by Maciej Stachowiak.
1766 Groundwork for more handling of "arguments". I'm not checking in the
1767 actual handling of "arguments" yet, because it still needs a little
1768 fiddling to avoid a performance regression.
1770 SunSpider reports no change.
1773 (KJS::initializeCallFrame): Put argc in the register file, so the
1774 arguments object can find it later, to determine arguments.length.
1777 (KJS::FunctionBodyNode::): Added a special code accessor for when you
1778 know the code has already been generated, and you don't have a scopeChain
1779 to supply for potential code generation. (This is the case when the
1780 activation object creates the arguments object.)
1782 2008-04-28 Oliver Hunt <oliver@apple.com>
1786 Replace unsafe use of auto_ptr in Vector with manual memory
1789 * VM/RegisterFileStack.cpp:
1790 (KJS::RegisterFileStack::~RegisterFileStack):
1791 (KJS::RegisterFileStack::popRegisterFile):
1792 * VM/RegisterFileStack.h:
1794 2008-04-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1798 Bug 18746: SQUIRRELFISH: indirect eval used when direct eval should be used
1799 <https://bugs.webkit.org/show_bug.cgi?id=18746>
1801 Change the base to the correct value of the 'this' object after the direct
1802 eval test instead of before.
1804 Fixes 5 layout tests.
1807 (KJS::Machine::privateExecute):
1809 (KJS::EvalFunctionCallNode::emitCode):
1811 2008-04-26 Maciej Stachowiak <mjs@apple.com>
1815 - document all property getting, setting and deleting opcodes
1817 (And fix function parameter names to match corresponding opcode parameter names.)
1819 * VM/CodeGenerator.cpp:
1820 (KJS::CodeGenerator::emitResolve):
1821 (KJS::CodeGenerator::emitResolveBase):
1822 (KJS::CodeGenerator::emitResolveBaseAndProperty):
1823 (KJS::CodeGenerator::emitResolveBaseAndFunc):
1824 (KJS::CodeGenerator::emitGetPropId):
1825 (KJS::CodeGenerator::emitPutPropId):
1826 (KJS::CodeGenerator::emitDeletePropId):
1827 (KJS::CodeGenerator::emitPutPropVal):
1828 * VM/CodeGenerator.h:
1832 (KJS::resolveBaseAndProperty):
1833 (KJS::resolveBaseAndFunc):
1834 (KJS::Machine::privateExecute):
1836 (KJS::ResolveNode::emitCode):
1837 (KJS::ArrayNode::emitCode):
1838 (KJS::PropertyListNode::emitCode):
1839 (KJS::BracketAccessorNode::emitCode):
1840 (KJS::EvalFunctionCallNode::emitCode):
1841 (KJS::FunctionCallResolveNode::emitCode):
1842 (KJS::FunctionCallBracketNode::emitCode):
1843 (KJS::PostIncResolveNode::emitCode):
1844 (KJS::PostDecResolveNode::emitCode):
1845 (KJS::PostIncBracketNode::emitCode):
1846 (KJS::PostDecBracketNode::emitCode):
1847 (KJS::PostIncDotNode::emitCode):
1848 (KJS::PostDecDotNode::emitCode):
1849 (KJS::DeleteResolveNode::emitCode):
1850 (KJS::TypeOfResolveNode::emitCode):
1851 (KJS::PreIncResolveNode::emitCode):
1852 (KJS::PreDecResolveNode::emitCode):
1853 (KJS::PreIncBracketNode::emitCode):
1854 (KJS::PreDecBracketNode::emitCode):
1855 (KJS::AssignResolveNode::emitCode):
1856 (KJS::AssignDotNode::emitCode):
1857 (KJS::ReadModifyDotNode::emitCode):
1858 (KJS::AssignBracketNode::emitCode):
1859 (KJS::ReadModifyBracketNode::emitCode):
1860 (KJS::ConstDeclNode::emitCodeSingle):
1862 2008-04-26 Oliver Hunt <oliver@apple.com>
1866 Bug 18628: SQUIRRELFISH: need to support recursion limit
1867 <https://bugs.webkit.org/show_bug.cgi?id=18628>
1869 Basically completes recursion limiting. There is still some
1870 tuning we may want to do to make things better in the face of
1871 very bad code, but certainly nothing worse than anything already
1874 Also fixes a WebKit test by fixing the exception text :D
1876 * JavaScriptCore.exp:
1877 * VM/ExceptionHelpers.cpp:
1879 (KJS::Machine::execute):
1880 * VM/RegisterFile.cpp:
1881 (KJS::RegisterFile::growBuffer):
1882 (KJS::RegisterFile::addGlobalSlots):
1883 * VM/RegisterFile.h:
1884 (KJS::RegisterFile::grow):
1885 (KJS::RegisterFile::uncheckedGrow):
1886 * VM/RegisterFileStack.cpp:
1887 (KJS::RegisterFileStack::pushRegisterFile):
1888 * VM/RegisterFileStack.h:
1890 2008-04-25 Oliver Hunt <oliver@apple.com>
1894 Bug 18628: SQUIRRELFISH: need to support recursion limit
1895 <https://bugs.webkit.org/show_bug.cgi?id=18628>
1897 Put a limit on the level of reentry recursion. 128 levels of re-entrant recursion
1898 seems reasonable as it is greater than the old eval limit, and a long way short of
1899 the reentry depth needed to overflow the stack.
1902 (KJS::Machine::execute):
1905 2008-04-25 Geoffrey Garen <ggaren@apple.com>
1907 Reviewed by Sam Weinig.
1909 A tiny bit of cleanup to the regexp code.
1911 Removed some static_cast.
1913 Removed createRegExpImp because it's no longer used.
1915 2008-04-25 Oliver Hunt <oliver@apple.com>
1919 Bug 18736: SQUIRRELFISH: switch statements with no default have incorrect codegen
1920 <https://bugs.webkit.org/show_bug.cgi?id=18736>
1922 Ensure the "default" target is correct in the absence of an explicit default handler.
1925 (KJS::CaseBlockNode::emitCodeForBlock):
1927 2008-04-25 Oliver Hunt <oliver@apple.com>
1931 Bug 18628: SQUIRRELFISH: need to support recursion limit
1932 <https://bugs.webkit.org/show_bug.cgi?id=18628>
1934 More bounds checking.
1937 (KJS::Machine::execute):
1938 * VM/RegisterFile.cpp:
1939 (KJS::RegisterFile::growBuffer):
1940 * VM/RegisterFile.h:
1942 2008-04-25 Maciej Stachowiak <mjs@apple.com>
1946 - fix signal catching magic
1948 The signal handlers are restored to _exit but are only set when
1949 running under run-javascriptcore-tests. fprintf from a signal
1950 handler is not safe.
1955 * tests/mozilla/jsDriver.pl:
1957 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1961 Bug 18732: SQUIRRELFISH: exceptions thrown by native constructors are ignored
1962 <https://bugs.webkit.org/show_bug.cgi?id=18732>
1964 Fixes another regression test.
1967 (KJS::Machine::privateExecute):
1969 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1973 Bug 18728: SQUIRRELFISH: invalid regular expression constants should throw exceptions
1974 <https://bugs.webkit.org/show_bug.cgi?id=18728>
1976 Fixes another regression test.
1979 (KJS::RegExpNode::emitCode):
1981 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1983 Reviewed by Geoffrey Garen.
1985 Bug 18735: SQUIRRELFISH: closures are sometimes given an incorrect 'this' value when called
1986 <https://bugs.webkit.org/show_bug.cgi?id=18735>
1988 The overloaded toThisObject method was not copied over to JSActivation.
1990 Fixes two regression tests.
1992 * kjs/JSActivation.cpp:
1993 (KJS::JSActivation::toThisObject):
1994 * kjs/JSActivation.h:
1996 2008-04-24 Geoffrey Garen <ggaren@apple.com>
1998 Reviewed by Oliver Hunt.
2000 Added support for arguments.callee.
2002 2008-04-24 Oliver Hunt <oliver@apple.com>
2006 Bug 18628: SQUIRRELFISH: need to support recursion limit
2007 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2009 Partial fix -- this gets us some of the required bounds checking, but not
2010 complete coverage. But it does manage to do them without regressing :D
2012 * VM/ExceptionHelpers.cpp:
2014 (KJS::createStackOverflowError):
2015 * VM/ExceptionHelpers.h:
2017 (KJS::slideRegisterWindowForCall):
2018 (KJS::Machine::execute):
2019 (KJS::Machine::privateExecute):
2020 * VM/RegisterFile.cpp:
2021 * VM/RegisterFile.h:
2022 (KJS::RegisterFile::):
2023 (KJS::RegisterFile::RegisterFile):
2024 (KJS::RegisterFile::grow):
2026 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2028 Reviewed by Oliver Hunt.
2030 A tiny bit more handling of "arguments": create a real, but mostly
2031 hollow, arguments object.
2033 Fixes 2 regression tests.
2035 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2039 Bug 18717: SQUIRRELFISH: eval returns the wrong value for a variable declaration statement
2040 <https://bugs.webkit.org/show_bug.cgi?id=18717>
2042 Fixes a regression test, but exposes the failure of another due to the
2043 lack of getters and setters.
2046 (KJS::ConstDeclNode::emitCodeSingle):
2047 (KJS::ConstDeclNode::emitCode):
2048 (KJS::ConstStatementNode::emitCode):
2049 (KJS::VarStatementNode::emitCode):
2052 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2054 Reviewed by Sam Weinig.
2056 Print a CRASH statement when crashing, so test failures are not a
2063 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2065 Reviewed by Geoffrey Garen.
2067 Bug 18716: SQUIRRELFISH: typeof should return undefined for an undefined variable reference
2068 <https://bugs.webkit.org/show_bug.cgi?id=18716>
2070 This fixes 2 more regression tests.
2073 (KJS::TypeOfResolveNode::emitCode):
2075 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2077 Reviewed by Sam Weinig.
2079 Put the callee in the call frame.
2081 Necessary in order to support "arguments" and "arguments.callee".
2083 Also fixes a latent GC bug, where an executing function could be
2084 subject to GC if the register holding it were overwritten. Here's
2085 an example that would have caused problems:
2089 // Flood the machine stack to eliminate any old pointers to f.
2092 // Overwrite f in the register file.
2096 for (var i = 0; i < 5000; ++i) {
2100 // Welcome to crash-ville.
2109 * VM/Machine.h: Changed the order of arguments to
2110 execute(FunctionBodyNode*...) to match the other execute functions.
2111 * kjs/function.cpp: Updated to match new argument requirements from
2112 execute(FunctionBodyNode*...). Renamed newObj to thisObj to match the
2113 rest of JavaScriptCore.
2115 SunSpider reports no change.
2117 2008-04-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2121 Bug 18707: SQUIRRELFISH: eval always performs toString() on its argument
2122 <https://bugs.webkit.org/show_bug.cgi?id=18707>
2124 This fixes 4 more regression tests.
2129 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2133 - fix logic bug in SegmentedVector::grow which would sometimes fail to resize a segment when needed
2137 * VM/SegmentedVector.h:
2138 (KJS::SegmentedVector::grow):
2140 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2142 Reviewed by Maciej Stachowiak.
2144 Degenerate handling of "arguments" as a property of the activation
2145 object. Currently, we just return a vanilla object.
2147 SunSpider reports no change.
2151 ecma_3/Function/regress-94506.js.
2153 Reveals to have been secretly broken:
2155 ecma_3/Function/15.3.4.3-1.js
2156 ecma_3/Function/15.3.4.4-1.js
2158 These tests were passing incorrectly. testkjs creates a global array
2159 named "arguments" to hold command-line arguments. That array was
2160 tricking these tests into thinking that an arguments object with length
2161 0 had been created. Since our new vanilla object shadows the global
2162 property named arguments, that object no longer fools these tests into
2165 Net change: +1 failing test.
2167 * kjs/AllInOneFile.cpp: Had to put JSActivation.cpp into AllInOneFile.cpp
2168 to solve a surprising 8.6% regression in bitops-3bit-bits-in-byte.
2170 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2174 - save and restore callFrame
2177 (KJS::slideRegisterWindowForCall):
2178 (KJS::Machine::execute):
2179 (KJS::Machine::privateExecute):
2183 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2185 Reviewed by Maciej Stachowiak.
2187 Fixed scopes for named function expressions.
2189 Fixes one regression test.
2193 (1) The function's name is supposed to have attributes DontDelete,
2194 ReadOnly, regardless of the type of code executing.
2196 (2) Push the name object on the function's scope chain, rather than
2197 the ExecState's scope chain because, well, that's where it belongs.
2199 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2201 Reviewed by Oliver Hunt.
2203 Inlined JSObject::putDirect, for a .4% SunSpider speedup.
2205 I did this as a first step toward removing nodes.cpp from
2206 AllInOneFile.cpp, but I'm putting that larger project aside for now.
2208 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2210 Rubber stamped by Geoff.
2212 - add OldInterpreterExecState class and use it in dead code
2214 This will allow removing things from the real ExecState class
2215 without having to figure out how to remove all this code without
2216 getting a perf regression.
2219 (KJS::ExpressionNode::evaluateToNumber):
2220 (KJS::ExpressionNode::evaluateToBoolean):
2221 (KJS::ExpressionNode::evaluateToInt32):
2222 (KJS::ExpressionNode::evaluateToUInt32):
2223 (KJS::Node::setErrorCompletion):
2224 (KJS::Node::throwError):
2225 (KJS::Node::throwUndefinedVariableError):
2226 (KJS::Node::handleException):
2227 (KJS::Node::rethrowException):
2228 (KJS::BreakpointCheckStatement::execute):
2229 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
2230 (KJS::NullNode::evaluate):
2231 (KJS::FalseNode::evaluate):
2232 (KJS::TrueNode::evaluate):
2233 (KJS::NumberNode::evaluate):
2234 (KJS::NumberNode::evaluateToNumber):
2235 (KJS::NumberNode::evaluateToBoolean):
2236 (KJS::NumberNode::evaluateToInt32):
2237 (KJS::NumberNode::evaluateToUInt32):
2238 (KJS::ImmediateNumberNode::evaluate):
2239 (KJS::ImmediateNumberNode::evaluateToInt32):
2240 (KJS::ImmediateNumberNode::evaluateToUInt32):
2241 (KJS::StringNode::evaluate):
2242 (KJS::StringNode::evaluateToNumber):
2243 (KJS::StringNode::evaluateToBoolean):
2244 (KJS::RegExpNode::evaluate):
2245 (KJS::ThisNode::evaluate):
2246 (KJS::ResolveNode::inlineEvaluate):
2247 (KJS::ResolveNode::evaluate):
2248 (KJS::ResolveNode::evaluateToNumber):
2249 (KJS::ResolveNode::evaluateToBoolean):
2250 (KJS::ResolveNode::evaluateToInt32):
2251 (KJS::ResolveNode::evaluateToUInt32):
2252 (KJS::getSymbolTableEntry):
2253 (KJS::ResolveNode::optimizeVariableAccess):
2254 (KJS::LocalVarAccessNode::inlineEvaluate):
2255 (KJS::LocalVarAccessNode::evaluate):
2256 (KJS::LocalVarAccessNode::evaluateToNumber):
2257 (KJS::LocalVarAccessNode::evaluateToBoolean):
2258 (KJS::LocalVarAccessNode::evaluateToInt32):
2259 (KJS::LocalVarAccessNode::evaluateToUInt32):
2260 (KJS::getNonLocalSymbol):
2261 (KJS::ScopedVarAccessNode::inlineEvaluate):
2262 (KJS::ScopedVarAccessNode::evaluate):
2263 (KJS::ScopedVarAccessNode::evaluateToNumber):
2264 (KJS::ScopedVarAccessNode::evaluateToBoolean):
2265 (KJS::ScopedVarAccessNode::evaluateToInt32):
2266 (KJS::ScopedVarAccessNode::evaluateToUInt32):
2267 (KJS::NonLocalVarAccessNode::inlineEvaluate):
2268 (KJS::NonLocalVarAccessNode::evaluate):
2269 (KJS::NonLocalVarAccessNode::evaluateToNumber):
2270 (KJS::NonLocalVarAccessNode::evaluateToBoolean):
2271 (KJS::NonLocalVarAccessNode::evaluateToInt32):
2272 (KJS::NonLocalVarAccessNode::evaluateToUInt32):
2273 (KJS::ElementNode::optimizeVariableAccess):
2274 (KJS::ElementNode::evaluate):
2275 (KJS::ArrayNode::optimizeVariableAccess):
2276 (KJS::ArrayNode::evaluate):
2277 (KJS::ObjectLiteralNode::optimizeVariableAccess):
2278 (KJS::ObjectLiteralNode::evaluate):
2279 (KJS::PropertyListNode::optimizeVariableAccess):
2280 (KJS::PropertyListNode::evaluate):
2281 (KJS::PropertyNode::optimizeVariableAccess):
2282 (KJS::PropertyNode::evaluate):
2283 (KJS::BracketAccessorNode::optimizeVariableAccess):
2284 (KJS::BracketAccessorNode::inlineEvaluate):
2285 (KJS::BracketAccessorNode::evaluate):
2286 (KJS::BracketAccessorNode::evaluateToNumber):
2287 (KJS::BracketAccessorNode::evaluateToBoolean):
2288 (KJS::BracketAccessorNode::evaluateToInt32):
2289 (KJS::BracketAccessorNode::evaluateToUInt32):
2290 (KJS::DotAccessorNode::optimizeVariableAccess):
2291 (KJS::DotAccessorNode::inlineEvaluate):
2292 (KJS::DotAccessorNode::evaluate):
2293 (KJS::DotAccessorNode::evaluateToNumber):
2294 (KJS::DotAccessorNode::evaluateToBoolean):
2295 (KJS::DotAccessorNode::evaluateToInt32):
2296 (KJS::DotAccessorNode::evaluateToUInt32):
2297 (KJS::ArgumentListNode::optimizeVariableAccess):
2298 (KJS::ArgumentListNode::evaluateList):
2299 (KJS::ArgumentsNode::optimizeVariableAccess):
2300 (KJS::NewExprNode::optimizeVariableAccess):
2301 (KJS::NewExprNode::inlineEvaluate):
2302 (KJS::NewExprNode::evaluate):
2303 (KJS::NewExprNode::evaluateToNumber):
2304 (KJS::NewExprNode::evaluateToBoolean):
2305 (KJS::NewExprNode::evaluateToInt32):
2306 (KJS::NewExprNode::evaluateToUInt32):
2307 (KJS::ExpressionNode::resolveAndCall):
2308 (KJS::EvalFunctionCallNode::optimizeVariableAccess):
2309 (KJS::EvalFunctionCallNode::evaluate):
2310 (KJS::FunctionCallValueNode::optimizeVariableAccess):
2311 (KJS::FunctionCallValueNode::evaluate):
2312 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
2313 (KJS::FunctionCallResolveNode::inlineEvaluate):
2314 (KJS::FunctionCallResolveNode::evaluate):
2315 (KJS::FunctionCallResolveNode::evaluateToNumber):
2316 (KJS::FunctionCallResolveNode::evaluateToBoolean):
2317 (KJS::FunctionCallResolveNode::evaluateToInt32):
2318 (KJS::FunctionCallResolveNode::evaluateToUInt32):
2319 (KJS::LocalVarFunctionCallNode::inlineEvaluate):
2320 (KJS::LocalVarFunctionCallNode::evaluate):
2321 (KJS::LocalVarFunctionCallNode::evaluateToNumber):
2322 (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
2323 (KJS::LocalVarFunctionCallNode::evaluateToInt32):
2324 (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
2325 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
2326 (KJS::ScopedVarFunctionCallNode::evaluate):
2327 (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
2328 (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
2329 (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
2330 (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
2331 (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
2332 (KJS::NonLocalVarFunctionCallNode::evaluate):
2333 (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
2334 (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
2335 (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
2336 (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
2337 (KJS::FunctionCallBracketNode::optimizeVariableAccess):
2338 (KJS::FunctionCallBracketNode::evaluate):
2339 (KJS::FunctionCallDotNode::optimizeVariableAccess):
2340 (KJS::FunctionCallDotNode::inlineEvaluate):
2341 (KJS::FunctionCallDotNode::evaluate):
2342 (KJS::FunctionCallDotNode::evaluateToNumber):
2343 (KJS::FunctionCallDotNode::evaluateToBoolean):
2344 (KJS::FunctionCallDotNode::evaluateToInt32):
2345 (KJS::FunctionCallDotNode::evaluateToUInt32):
2346 (KJS::PostIncResolveNode::optimizeVariableAccess):
2347 (KJS::PostIncResolveNode::evaluate):
2348 (KJS::PostIncLocalVarNode::evaluate):
2349 (KJS::PostDecResolveNode::optimizeVariableAccess):
2350 (KJS::PostDecResolveNode::evaluate):
2351 (KJS::PostDecLocalVarNode::evaluate):
2352 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
2353 (KJS::PostDecLocalVarNode::evaluateToNumber):
2354 (KJS::PostDecLocalVarNode::evaluateToBoolean):
2355 (KJS::PostDecLocalVarNode::evaluateToInt32):
2356 (KJS::PostDecLocalVarNode::evaluateToUInt32):
2357 (KJS::PostfixBracketNode::optimizeVariableAccess):
2358 (KJS::PostIncBracketNode::evaluate):
2359 (KJS::PostDecBracketNode::evaluate):
2360 (KJS::PostfixDotNode::optimizeVariableAccess):
2361 (KJS::PostIncDotNode::evaluate):
2362 (KJS::PostDecDotNode::evaluate):
2363 (KJS::PostfixErrorNode::evaluate):
2364 (KJS::DeleteResolveNode::optimizeVariableAccess):
2365 (KJS::DeleteResolveNode::evaluate):
2366 (KJS::LocalVarDeleteNode::evaluate):
2367 (KJS::DeleteBracketNode::optimizeVariableAccess):
2368 (KJS::DeleteBracketNode::evaluate):
2369 (KJS::DeleteDotNode::optimizeVariableAccess):
2370 (KJS::DeleteDotNode::evaluate):
2371 (KJS::DeleteValueNode::optimizeVariableAccess):
2372 (KJS::DeleteValueNode::evaluate):
2373 (KJS::VoidNode::optimizeVariableAccess):
2374 (KJS::VoidNode::evaluate):
2375 (KJS::TypeOfValueNode::optimizeVariableAccess):
2376 (KJS::TypeOfResolveNode::optimizeVariableAccess):
2377 (KJS::LocalVarTypeOfNode::evaluate):
2378 (KJS::TypeOfResolveNode::evaluate):
2379 (KJS::TypeOfValueNode::evaluate):
2380 (KJS::PreIncResolveNode::optimizeVariableAccess):
2381 (KJS::PreIncLocalVarNode::evaluate):
2382 (KJS::PreIncResolveNode::evaluate):
2383 (KJS::PreDecResolveNode::optimizeVariableAccess):
2384 (KJS::PreDecLocalVarNode::evaluate):
2385 (KJS::PreDecResolveNode::evaluate):
2386 (KJS::PreIncConstNode::evaluate):
2387 (KJS::PreDecConstNode::evaluate):
2388 (KJS::PostIncConstNode::evaluate):
2389 (KJS::PostDecConstNode::evaluate):
2390 (KJS::PrefixBracketNode::optimizeVariableAccess):
2391 (KJS::PreIncBracketNode::evaluate):
2392 (KJS::PreDecBracketNode::evaluate):
2393 (KJS::PrefixDotNode::optimizeVariableAccess):
2394 (KJS::PreIncDotNode::evaluate):
2395 (KJS::PreDecDotNode::evaluate):
2396 (KJS::PrefixErrorNode::evaluate):
2397 (KJS::UnaryPlusNode::optimizeVariableAccess):
2398 (KJS::UnaryPlusNode::evaluate):
2399 (KJS::UnaryPlusNode::evaluateToBoolean):
2400 (KJS::UnaryPlusNode::evaluateToNumber):
2401 (KJS::UnaryPlusNode::evaluateToInt32):
2402 (KJS::UnaryPlusNode::evaluateToUInt32):
2403 (KJS::NegateNode::optimizeVariableAccess):
2404 (KJS::NegateNode::evaluate):
2405 (KJS::NegateNode::evaluateToNumber):
2406 (KJS::BitwiseNotNode::optimizeVariableAccess):
2407 (KJS::BitwiseNotNode::inlineEvaluateToInt32):
2408 (KJS::BitwiseNotNode::evaluate):
2409 (KJS::BitwiseNotNode::evaluateToNumber):
2410 (KJS::BitwiseNotNode::evaluateToBoolean):
2411 (KJS::BitwiseNotNode::evaluateToInt32):
2412 (KJS::BitwiseNotNode::evaluateToUInt32):
2413 (KJS::LogicalNotNode::optimizeVariableAccess):
2414 (KJS::LogicalNotNode::evaluate):
2415 (KJS::LogicalNotNode::evaluateToBoolean):
2416 (KJS::MultNode::optimizeVariableAccess):
2417 (KJS::MultNode::inlineEvaluateToNumber):
2418 (KJS::MultNode::evaluate):
2419 (KJS::MultNode::evaluateToNumber):
2420 (KJS::MultNode::evaluateToBoolean):
2421 (KJS::MultNode::evaluateToInt32):
2422 (KJS::MultNode::evaluateToUInt32):
2423 (KJS::DivNode::optimizeVariableAccess):
2424 (KJS::DivNode::inlineEvaluateToNumber):
2425 (KJS::DivNode::evaluate):
2426 (KJS::DivNode::evaluateToNumber):
2427 (KJS::DivNode::evaluateToInt32):
2428 (KJS::DivNode::evaluateToUInt32):
2429 (KJS::ModNode::optimizeVariableAccess):
2430 (KJS::ModNode::inlineEvaluateToNumber):
2431 (KJS::ModNode::evaluate):
2432 (KJS::ModNode::evaluateToNumber):
2433 (KJS::ModNode::evaluateToBoolean):
2434 (KJS::ModNode::evaluateToInt32):
2435 (KJS::ModNode::evaluateToUInt32):
2436 (KJS::throwOutOfMemoryErrorToNumber):
2438 (KJS::addSlowCaseToNumber):
2441 (KJS::AddNode::optimizeVariableAccess):
2442 (KJS::AddNode::evaluate):
2443 (KJS::AddNode::inlineEvaluateToNumber):
2444 (KJS::AddNode::evaluateToNumber):
2445 (KJS::AddNode::evaluateToInt32):
2446 (KJS::AddNode::evaluateToUInt32):
2447 (KJS::AddNumbersNode::inlineEvaluateToNumber):
2448 (KJS::AddNumbersNode::evaluate):
2449 (KJS::AddNumbersNode::evaluateToNumber):
2450 (KJS::AddNumbersNode::evaluateToInt32):
2451 (KJS::AddNumbersNode::evaluateToUInt32):
2452 (KJS::AddStringsNode::evaluate):
2453 (KJS::AddStringLeftNode::evaluate):
2454 (KJS::AddStringRightNode::evaluate):
2455 (KJS::SubNode::optimizeVariableAccess):
2456 (KJS::SubNode::inlineEvaluateToNumber):
2457 (KJS::SubNode::evaluate):
2458 (KJS::SubNode::evaluateToNumber):
2459 (KJS::SubNode::evaluateToInt32):
2460 (KJS::SubNode::evaluateToUInt32):
2461 (KJS::LeftShiftNode::optimizeVariableAccess):
2462 (KJS::LeftShiftNode::inlineEvaluateToInt32):
2463 (KJS::LeftShiftNode::evaluate):
2464 (KJS::LeftShiftNode::evaluateToNumber):
2465 (KJS::LeftShiftNode::evaluateToInt32):
2466 (KJS::LeftShiftNode::evaluateToUInt32):
2467 (KJS::RightShiftNode::optimizeVariableAccess):
2468 (KJS::RightShiftNode::inlineEvaluateToInt32):
2469 (KJS::RightShiftNode::evaluate):
2470 (KJS::RightShiftNode::evaluateToNumber):
2471 (KJS::RightShiftNode::evaluateToInt32):
2472 (KJS::RightShiftNode::evaluateToUInt32):
2473 (KJS::UnsignedRightShiftNode::optimizeVariableAccess):
2474 (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
2475 (KJS::UnsignedRightShiftNode::evaluate):
2476 (KJS::UnsignedRightShiftNode::evaluateToNumber):
2477 (KJS::UnsignedRightShiftNode::evaluateToInt32):
2478 (KJS::UnsignedRightShiftNode::evaluateToUInt32):
2481 (KJS::LessNode::optimizeVariableAccess):
2482 (KJS::LessNode::inlineEvaluateToBoolean):
2483 (KJS::LessNode::evaluate):
2484 (KJS::LessNode::evaluateToBoolean):
2485 (KJS::LessNumbersNode::inlineEvaluateToBoolean):
2486 (KJS::LessNumbersNode::evaluate):
2487 (KJS::LessNumbersNode::evaluateToBoolean):
2488 (KJS::LessStringsNode::inlineEvaluateToBoolean):
2489 (KJS::LessStringsNode::evaluate):
2490 (KJS::LessStringsNode::evaluateToBoolean):
2491 (KJS::GreaterNode::optimizeVariableAccess):
2492 (KJS::GreaterNode::inlineEvaluateToBoolean):
2493 (KJS::GreaterNode::evaluate):
2494 (KJS::GreaterNode::evaluateToBoolean):
2495 (KJS::LessEqNode::optimizeVariableAccess):
2496 (KJS::LessEqNode::inlineEvaluateToBoolean):
2497 (KJS::LessEqNode::evaluate):
2498 (KJS::LessEqNode::evaluateToBoolean):
2499 (KJS::GreaterEqNode::optimizeVariableAccess):
2500 (KJS::GreaterEqNode::inlineEvaluateToBoolean):
2501 (KJS::GreaterEqNode::evaluate):
2502 (KJS::GreaterEqNode::evaluateToBoolean):
2503 (KJS::InstanceOfNode::optimizeVariableAccess):
2504 (KJS::InstanceOfNode::evaluate):
2505 (KJS::InstanceOfNode::evaluateToBoolean):
2506 (KJS::InNode::optimizeVariableAccess):
2507 (KJS::InNode::evaluate):
2508 (KJS::InNode::evaluateToBoolean):
2509 (KJS::EqualNode::optimizeVariableAccess):
2510 (KJS::EqualNode::inlineEvaluateToBoolean):
2511 (KJS::EqualNode::evaluate):
2512 (KJS::EqualNode::evaluateToBoolean):
2513 (KJS::NotEqualNode::optimizeVariableAccess):
2514 (KJS::NotEqualNode::inlineEvaluateToBoolean):
2515 (KJS::NotEqualNode::evaluate):
2516 (KJS::NotEqualNode::evaluateToBoolean):
2517 (KJS::StrictEqualNode::optimizeVariableAccess):
2518 (KJS::StrictEqualNode::inlineEvaluateToBoolean):
2519 (KJS::StrictEqualNode::evaluate):
2520 (KJS::StrictEqualNode::evaluateToBoolean):
2521 (KJS::NotStrictEqualNode::optimizeVariableAccess):
2522 (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
2523 (KJS::NotStrictEqualNode::evaluate):
2524 (KJS::NotStrictEqualNode::evaluateToBoolean):
2525 (KJS::BitAndNode::optimizeVariableAccess):
2526 (KJS::BitAndNode::evaluate):
2527 (KJS::BitAndNode::inlineEvaluateToInt32):
2528 (KJS::BitAndNode::evaluateToNumber):
2529 (KJS::BitAndNode::evaluateToBoolean):
2530 (KJS::BitAndNode::evaluateToInt32):
2531 (KJS::BitAndNode::evaluateToUInt32):
2532 (KJS::BitXOrNode::optimizeVariableAccess):
2533 (KJS::BitXOrNode::inlineEvaluateToInt32):
2534 (KJS::BitXOrNode::evaluate):
2535 (KJS::BitXOrNode::evaluateToNumber):
2536 (KJS::BitXOrNode::evaluateToBoolean):
2537 (KJS::BitXOrNode::evaluateToInt32):
2538 (KJS::BitXOrNode::evaluateToUInt32):
2539 (KJS::BitOrNode::optimizeVariableAccess):
2540 (KJS::BitOrNode::inlineEvaluateToInt32):
2541 (KJS::BitOrNode::evaluate):
2542 (KJS::BitOrNode::evaluateToNumber):
2543 (KJS::BitOrNode::evaluateToBoolean):
2544 (KJS::BitOrNode::evaluateToInt32):
2545 (KJS::BitOrNode::evaluateToUInt32):
2546 (KJS::LogicalAndNode::optimizeVariableAccess):
2547 (KJS::LogicalAndNode::evaluate):
2548 (KJS::LogicalAndNode::evaluateToBoolean):
2549 (KJS::LogicalOrNode::optimizeVariableAccess):
2550 (KJS::LogicalOrNode::evaluate):
2551 (KJS::LogicalOrNode::evaluateToBoolean):
2552 (KJS::ConditionalNode::optimizeVariableAccess):
2553 (KJS::ConditionalNode::evaluate):
2554 (KJS::ConditionalNode::evaluateToBoolean):
2555 (KJS::ConditionalNode::evaluateToNumber):
2556 (KJS::ConditionalNode::evaluateToInt32):
2557 (KJS::ConditionalNode::evaluateToUInt32):
2558 (KJS::valueForReadModifyAssignment):
2559 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
2560 (KJS::AssignResolveNode::optimizeVariableAccess):
2561 (KJS::ReadModifyLocalVarNode::evaluate):
2562 (KJS::AssignLocalVarNode::evaluate):
2563 (KJS::ReadModifyConstNode::evaluate):
2564 (KJS::AssignConstNode::evaluate):
2565 (KJS::ReadModifyResolveNode::evaluate):
2566 (KJS::AssignResolveNode::evaluate):
2567 (KJS::AssignDotNode::optimizeVariableAccess):
2568 (KJS::AssignDotNode::evaluate):
2569 (KJS::ReadModifyDotNode::optimizeVariableAccess):
2570 (KJS::ReadModifyDotNode::evaluate):
2571 (KJS::AssignErrorNode::evaluate):
2572 (KJS::AssignBracketNode::optimizeVariableAccess):
2573 (KJS::AssignBracketNode::evaluate):
2574 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
2575 (KJS::ReadModifyBracketNode::evaluate):
2576 (KJS::CommaNode::optimizeVariableAccess):
2577 (KJS::CommaNode::evaluate):
2578 (KJS::ConstDeclNode::optimizeVariableAccess):
2579 (KJS::ConstDeclNode::handleSlowCase):
2580 (KJS::ConstDeclNode::evaluateSingle):
2581 (KJS::ConstDeclNode::evaluate):
2582 (KJS::ConstStatementNode::optimizeVariableAccess):
2583 (KJS::ConstStatementNode::execute):
2584 (KJS::statementListExecute):
2585 (KJS::BlockNode::optimizeVariableAccess):
2586 (KJS::BlockNode::execute):
2587 (KJS::EmptyStatementNode::execute):
2588 (KJS::ExprStatementNode::optimizeVariableAccess):
2589 (KJS::ExprStatementNode::execute):
2590 (KJS::VarStatementNode::optimizeVariableAccess):
2591 (KJS::VarStatementNode::execute):
2592 (KJS::IfNode::optimizeVariableAccess):
2593 (KJS::IfNode::execute):
2594 (KJS::IfElseNode::optimizeVariableAccess):
2595 (KJS::IfElseNode::execute):
2596 (KJS::DoWhileNode::optimizeVariableAccess):
2597 (KJS::DoWhileNode::execute):
2598 (KJS::WhileNode::optimizeVariableAccess):
2599 (KJS::WhileNode::execute):
2600 (KJS::ForNode::optimizeVariableAccess):
2601 (KJS::ForNode::execute):
2602 (KJS::ForInNode::optimizeVariableAccess):
2603 (KJS::ForInNode::execute):
2604 (KJS::ContinueNode::execute):
2605 (KJS::BreakNode::execute):
2606 (KJS::ReturnNode::optimizeVariableAccess):
2607 (KJS::ReturnNode::execute):
2608 (KJS::WithNode::optimizeVariableAccess):
2609 (KJS::WithNode::execute):
2610 (KJS::CaseClauseNode::optimizeVariableAccess):
2611 (KJS::CaseClauseNode::evaluate):
2612 (KJS::CaseClauseNode::executeStatements):
2613 (KJS::ClauseListNode::optimizeVariableAccess):
2614 (KJS::CaseBlockNode::optimizeVariableAccess):
2615 (KJS::CaseBlockNode::executeBlock):
2616 (KJS::SwitchNode::optimizeVariableAccess):
2617 (KJS::SwitchNode::execute):
2618 (KJS::LabelNode::optimizeVariableAccess):
2619 (KJS::LabelNode::execute):
2620 (KJS::ThrowNode::optimizeVariableAccess):
2621 (KJS::ThrowNode::execute):
2622 (KJS::TryNode::optimizeVariableAccess):
2623 (KJS::TryNode::execute):
2624 (KJS::ProgramNode::initializeSymbolTable):
2625 (KJS::ScopeNode::optimizeVariableAccess):
2626 (KJS::ProgramNode::processDeclarations):
2627 (KJS::EvalNode::processDeclarations):
2628 (KJS::ProgramNode::execute):
2629 (KJS::EvalNode::execute):
2630 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
2631 (KJS::FuncDeclNode::execute):
2632 (KJS::FuncExprNode::evaluate):
2637 (KJS::ArgumentsNode::):
2639 2008-04-23 Oliver Hunt <oliver@apple.com>
2643 Bug 18672: SQUIRRELFISH: codegen fails with a large number of temporaries
2644 <https://bugs.webkit.org/show_bug.cgi?id=18672>
2646 Add a SegmentedVector type, which provides a Vector<T> which maintains
2647 existing memory locations during resize. This allows dynamically sizing
2648 local, temporary and label "vectors" in CodeGenerator.
2650 * JavaScriptCore.xcodeproj/project.pbxproj:
2651 * VM/CodeGenerator.cpp:
2652 (KJS::CodeGenerator::addVar):
2653 (KJS::CodeGenerator::CodeGenerator):
2654 (KJS::CodeGenerator::newTemporary):
2655 (KJS::CodeGenerator::newLabel):
2656 * VM/CodeGenerator.h:
2657 * VM/SegmentedVector.h: Added.
2658 (KJS::SegmentedVector::SegmentedVector):
2659 (KJS::SegmentedVector::~SegmentedVector):
2660 (KJS::SegmentedVector::last):
2661 (KJS::SegmentedVector::append):
2662 (KJS::SegmentedVector::removeLast):
2663 (KJS::SegmentedVector::size):
2664 (KJS::SegmentedVector::operator[]):
2665 (KJS::SegmentedVector::resize):
2666 (KJS::SegmentedVector::shrink):
2667 (KJS::SegmentedVector::grow):
2669 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2671 Reviewed by Maciej Stachowiak.
2673 A little refactoring in preparation for supporting 'arguments'.
2675 Fixes 2 regression tests.
2677 SunSpider reports no change.
2679 We now check the activation register, instead of the codeBlock, to
2680 determine whether we need to tear off the activation. This is to support
2681 "f.arguments", which will create an activation/arguments pair for f,
2682 even though the needsFullScopeChain flag is false for f's codeBlock.
2684 The test fixes resulted from calling initializeCallFrame for re-entrant
2685 function code, instead of initializing (not enough) parts of the call
2688 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2692 - propagate the "this" value properly to local eval
2694 (fixes a measly one regression test)
2697 (KJS::CodeBlock::CodeBlock):
2698 (KJS::ProgramCodeBlock::ProgramCodeBlock):
2699 (KJS::EvalCodeBlock::EvalCodeBlock):
2701 (KJS::Machine::privateExecute):
2703 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2707 Add support for function declarations in eval code.
2709 (this fixes 12 more regression tests)
2712 * VM/CodeGenerator.cpp:
2713 (KJS::CodeGenerator::CodeGenerator):
2714 * VM/CodeGenerator.h:
2716 (KJS::Machine::execute):
2718 (KJS::EvalNode::generateCode):
2720 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2724 Implement LabelNode.
2726 * VM/CodeGenerator.cpp:
2727 (KJS::CodeGenerator::pushJumpContext):
2728 (KJS::CodeGenerator::jumpContextForContinue):
2729 (KJS::CodeGenerator::jumpContextForBreak):
2730 * VM/CodeGenerator.h:
2732 (KJS::DoWhileNode::emitCode):
2733 (KJS::WhileNode::emitCode):
2734 (KJS::ForNode::emitCode):
2735 (KJS::ForInNode::emitCode):
2736 (KJS::ContinueNode::emitCode):
2737 (KJS::BreakNode::emitCode):
2738 (KJS::SwitchNode::emitCode):
2739 (KJS::LabelNode::emitCode):
2741 2008-04-22 Geoffrey Garen <ggaren@apple.com>
2743 Reviewed by Oliver Hunt.
2745 Fixed crash when unwinding from exceptions inside eval.
2748 (KJS::Machine::unwindCallFrame): Don't assume that the top of the
2749 current call frame's scope chain is an activation: it can be the global
2752 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2757 (main): Convert signals to exit codes, so that crashing tests are
2758 detected as regression test failures.
2760 2008-04-22 Geoffrey Garen <ggaren@apple.com>
2762 Reviewed by Oliver Hunt and Maciej Stachowiak.
2764 Renamed "needsActivation" to "needsFullScopeChain" because lying will
2765 make hair grow on the backs of your hands.
2767 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2769 Reviewed by Maciej Stachowiak.
2771 Fixed ScopeChainNode lifetime problems:
2773 (1) In "with" and "catch" scopes, we would construct a ScopeChain
2774 object and then jump across its destructor, leaking the ScopeChainNode
2777 (2) In global and eval scopes, we would fail to initially ref
2778 "scopeChain", causing us to overrelease it later. Now that we ref
2779 "scopeChain" properly, we also need to deref it when the script
2782 SunSpider reports a .2% regression, but an earlier round of ScopeChain
2783 refactoring was a .4% speedup, so there.
2785 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2789 - use global object instead of null for "this" on unqualified calls
2791 This fixes 10 more JSC test regressions.
2794 (KJS::Machine::privateExecute):
2796 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2800 - throw proper exceptions for objects that don't implement call or construct
2802 This fixes 21 more JSC test regressions. It is also seemingly an
2805 * VM/ExceptionHelpers.cpp:
2806 (KJS::createNotAnObjectError):
2807 (KJS::createNotAConstructorError):
2808 (KJS::createNotAFunctionError):
2809 * VM/ExceptionHelpers.h:
2811 (KJS::Machine::privateExecute):
2813 2008-04-21 Oliver Hunt <oliver@apple.com>
2817 Implement emitCode for ConstDeclNode.
2819 This fixes the crash (assertion) in js1_5/Scope/scope-001.js
2821 * VM/CodeGenerator.cpp:
2822 (KJS::CodeGenerator::registerForLocalConstInit):
2823 * VM/CodeGenerator.h:
2825 (KJS::AssignResolveNode::emitCode):
2826 (KJS::ConstDeclNode::emitCodeSingle):
2827 (KJS::ConstDeclNode::emitCode):
2828 (KJS::ConstStatementNode::emitCode):
2831 2008-04-21 Maciej Stachowiak <mjs@apple.com>
2835 - add some support for the split window object
2837 This fixes many layout tests.
2840 (KJS::resolveBaseAndFunc): Use toThisObject() to ensure we get the
2841 wrapper global, if one exists, as the "this" object.
2843 (KJS::globalFuncEval): Use toGlobalObject() to handle the wrapper
2846 2008-04-21 Maciej Stachowiak <mjs@apple.com>
2850 - restore ScopeChain::operator= to avoid crash on many layout tests
2852 Otherwise, FunctionImp::setScope would cause a reference
2853 underflow. I implemented using the copy construct and swap idiom.
2855 * kjs/scope_chain.h:
2856 (KJS::ScopeChain::swap):
2857 (KJS::ScopeChain::operator=):
2859 2008-04-21 Oliver Hunt <oliver@apple.com>
2863 Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
2864 <https://bugs.webkit.org/show_bug.cgi?id=18649>
2866 Allocate a callframe for eval() and initialise with a null codeBlock to
2867 indicate native code. This prevents the unwinder from clobbering the
2871 (KJS::Machine::execute):
2873 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2875 Reviewed by Sam Weinig.
2877 Removed ScopeChain::push(ScopeChain&) because it was unused. Moved
2878 ScopeChain::print to ScopeChainNode.
2880 ScopeChain is now nothing more than a resource-handling wrapper around
2883 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2887 Bug 18671: SquirrelFish: continue inside switch fails
2888 <https://bugs.webkit.org/show_bug.cgi?id=18671>
2890 * VM/CodeGenerator.cpp:
2891 (KJS::CodeGenerator::jumpContextForLabel):
2892 * VM/CodeGenerator.h:
2894 (KJS::ContinueNode::emitCode):
2896 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2898 Reviewed by Sam Weinig.
2900 Moved push(JSObject*) and pop() from ScopeChain to ScopeChainNode,
2901 rearranging scope_chain.h a bit.
2903 SunSpider reports no change.
2905 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2907 Reviewed by Sam Weinig.
2909 Moved bottom() from ScopeChain to ScopeChainNode, simplifying it based
2910 on the knowledge that the ScopeChain is never empty.
2912 SunSpider reports no change.
2914 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2916 Reviewed by Oliver Hunt.
2918 Moved begin() and end() from ScopeChain to ScopeChainNode.
2920 Also marked a few methods "const".
2922 SunSpider reports no change.
2924 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2926 Reviewed by Maciej Stachowiak.
2928 Turned ScopeChain::depth into a stand-alone function, and simplified it
2931 I also moved ScopeChain::depth to Machine.cpp because it doesn't report
2932 the true depth of the ScopeChain -- just the Machine's perspective of
2933 its depth within a given call frame.
2935 SunSpider reports no change.
2937 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2939 Reviewed by Maciej Stachowiak.
2941 Removed indirection in ScopeChain::ref / ScopeChain::deref.
2943 SunSpider reports no change.
2945 * kjs/scope_chain.h:
2946 (KJS::ScopeChain::ScopeChain):
2947 (KJS::ScopeChain::~ScopeChain):
2948 (KJS::ScopeChain::clear):
2950 2008-04-21 Oliver Hunt <oliver@apple.com>
2952 Reviewed by NOBODY(Build fix)
2957 (KJS::ConstDeclNode::evaluateSingle):
2959 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2963 Bug 18664: SQUIRRELFISH: correctly throw a SyntaxError when parsing of eval code fails
2964 <https://bugs.webkit.org/show_bug.cgi?id=18664>
2966 Correctly throw a SyntaxError when parsing of eval code fails.
2971 2008-04-21 Oliver Hunt <oliver@apple.com>
2975 Partial fix for Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
2977 Make sure we correct the register state before jumping to vm_throw.
2980 (KJS::Machine::privateExecute):
2982 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2984 Reviewed by Maciej Stachowiak.
2986 Simplified ScopeChain ref/deref.
2988 SunSpider reports a .4% speedup.
2990 * kjs/scope_chain.h:
2991 (KJS::ScopeChainNode::ref): Removed this function because it was nonsense.
2992 ScopeChainNodes are initialized with a refCount of 1, so the loop was
2993 guaranteed to iterate exactly once.
2995 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2997 Reviewed by Maciej Stachowiak.
2999 Removed support for empty ScopeChains.
3001 SunSpider reports no change.
3003 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3005 Reviewed by Maciej Stachowiak.
3007 Removed some completely unused ScopeChain member functions.
3009 SunSpider reports no change.
3011 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3013 Reviewed by Maciej Stachowiak.
3015 Avoid creating unnecessary ScopeChain objects, to reduce refcount churn.
3017 SunSpider reports no change.
3019 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3021 Rubber stamped by Alexey.
3028 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3032 - only print "End:" output when -d flag is passed.
3034 This fixes half of our failing JSC regression tests.
3039 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3043 Add support for variable declarations in eval code.
3046 (KJS::EvalCodeBlock::EvalCodeBlock):
3047 * VM/CodeGenerator.cpp:
3048 (KJS::CodeGenerator::CodeGenerator):
3049 * VM/CodeGenerator.h:
3051 (KJS::Machine::execute):
3054 (KJS::globalFuncEval):
3056 (KJS::EvalNode::generateCode):
3060 2008-04-20 Oliver Hunt <oliver@apple.com>
3064 Throw exceptions for invalid continue, break, and return statements.
3066 Simple refactoring and extension of Cameron's AssignErrorNode, etc patch
3068 * VM/CodeGenerator.cpp:
3069 (KJS::CodeGenerator::CodeGenerator):
3070 (KJS::CodeGenerator::pushJumpContext):
3071 (KJS::CodeGenerator::popJumpContext):
3072 (KJS::CodeGenerator::jumpContextForLabel):
3073 * VM/CodeGenerator.h:
3075 (KJS::Node::emitThrowError):
3076 (KJS::ContinueNode::emitCode):
3077 (KJS::BreakNode::emitCode):
3078 (KJS::ReturnNode::emitCode):
3081 2008-04-20 Geoffrey Garen <ggaren@apple.com>
3083 Reviewed by Oliver Hunt.
3085 Removed Machine.cpp from AllInOneFile.cpp, and manually inlined a few
3086 things that used to be inlined automatically.
3088 1.9% speedup on SunSpider.
3090 My hope is that we'll face fewer surprises in Machine.cpp codegen, now
3091 that GCC is making fewer decisions. The speedup seems to confirm that.
3093 2008-04-20 Oliver Hunt <oliver@apple.com>
3097 Bug 18642: Iterator context may get placed into the return register, leading to much badness
3098 <https://bugs.webkit.org/show_bug.cgi?id=18642>
3100 To prevent incorrectly reusing what will become the result register for
3101 eval and global code execution, we need to request and ref the destination
3102 in advance of codegen. Unfortunately this may lead to unnecessary copying,
3103 although in future we can probably limit this. Curiously SunSpider shows
3104 a progression in a number of tests, although it comes out as a wash overall.
3107 (KJS::EvalNode::emitCode):
3108 (KJS::ProgramNode::emitCode):
3110 2008-04-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3114 Add support for AssignErrorNode, PrefixErrorNode, and PostfixErrorNode.
3117 (KJS::CodeBlock::dump):
3118 * VM/CodeGenerator.cpp:
3119 (KJS::CodeGenerator::emitCreateError):
3120 * VM/CodeGenerator.h:
3122 (KJS::Machine::privateExecute):
3125 (KJS::PostfixErrorNode::emitCode):
3126 (KJS::PrefixErrorNode::emitCode):
3127 (KJS::AssignErrorNode::emitCode):
3130 2008-04-20 Oliver Hunt <oliver@apple.com>
3132 Reviewed by Geoff and Mark.
3134 Provide line number information in exceptions
3136 Simple patch, adds line number information metadata to CodeBlock
3137 and a simple method to get the line number responsible for a given
3141 (KJS::CodeBlock::lineNumberForVPC):
3143 * VM/CodeGenerator.h:
3144 (KJS::CodeGenerator::emitNode):
3146 (KJS::Machine::throwException):
3148 2008-04-20 Oliver Hunt <oliver@apple.com>
3152 Provide "sourceURL" in exceptions
3156 (KJS::Machine::throwException):
3158 (KJS::EvalNode::generateCode):
3159 (KJS::ProgramNode::generateCode):
3161 2008-04-19 Oliver Hunt <oliver@apple.com>
3165 Don't call emitCode directly on subnodes, instead use CodeGenerator::emitNode
3167 This patch just a preparation for tracking line numbers.
3170 (KJS::ObjectLiteralNode::emitCode):
3171 (KJS::PropertyListNode::emitCode):
3172 (KJS::ArgumentListNode::emitCode):
3173 (KJS::TryNode::emitCode):
3175 2008-04-19 Oliver Hunt <oliver@apple.com>
3179 Bug 18619: Support continue, break, and return in try .. finally blocks
3180 <https://bugs.webkit.org/show_bug.cgi?id=18619>
3182 This patch replaces the current partial finally support (which uses code
3183 duplication to achieve what it does) with a subroutine based approach.
3184 This has a number of advantages over code duplication:
3186 * Simplified exception handling as the finaliser code only exists in
3187 one place, so no "magic" is needed to get the correct handler for a
3189 * When we support instruction to line number mapping we won't need to
3190 worry about the dramatic code movement caused by duplication
3192 On the downside it is necessary to add two new opcodes, op_jsr and op_sret
3193 to enter and exit the finaliser subroutines, happily SunSpider reports
3194 a performance progression (gcc amazes me) and ubench reports a wash.
3196 While jsr and sret provide a mechanism that allows us to enter and exit
3197 any arbitrary finaliser we need to, it was still necessary to increase
3198 the amount of information tracked when entering and exiting both finaliser
3199 scopes and dynamic scopes ("with"). This means "scopeDepth" is now
3200 the combination of "finaliserDepth" and "dynamicScopeDepth". We also
3201 now use a scopeContextStack to ensure that we pop scopes and execute
3202 finalisers in the correct order. This increases the cost of "with" nodes
3203 during codegen, but it should not be significant enough to effect real
3204 world performance and greatly simplifies codegen for return, break and
3205 continue when interacting with finalisers.
3208 (KJS::CodeBlock::dump):
3209 Pretty printing of jsr/sret opcodes
3211 * VM/CodeGenerator.cpp:
3212 (KJS::CodeGenerator::CodeGenerator):
3213 (KJS::CodeGenerator::emitPushScope):
3214 (KJS::CodeGenerator::emitPopScope):
3215 Dynamic scopes need to be tracked on the scopeContextStack now
3217 (KJS::CodeGenerator::pushFinallyContext):
3218 (KJS::CodeGenerator::popFinallyContext):
3219 Handle entry and exit from code regions with finalisers. This is
3220 needed solely to support return, continue and break inside finaliser
3223 (KJS::CodeGenerator::emitComplexJumpScopes):
3224 Helper function for emitJumpScopes to handle the complex codegen
3225 needed to handle return, continue and break inside a finaliser region
3227 (KJS::CodeGenerator::emitJumpScopes):
3228 Updated to be aware of finalisers, if a cross-scope jump occurs inside
3229 a finaliser we hand off codegen to emitComplexJumpScopes, otherwise
3230 we can handle the normal (trivial) case with a single instruction.
3232 (KJS::CodeGenerator::emitJumpSubroutine):
3233 (KJS::CodeGenerator::emitSubroutineReturn):
3234 Trivial opcode emitter functions.
3236 * VM/CodeGenerator.h:
3237 (KJS::CodeGenerator::scopeDepth):
3239 (KJS::Machine::privateExecute):
3240 Implement op_jsr and op_sret.
3243 Ad op_jsr and op_sret
3246 (KJS::TryNode::emitCode):
3247 Fix codegen for new finaliser model.
3249 2008-04-17 Mark Rowe <mrowe@apple.com>
3251 Rubber-stamped by Oliver Hunt.
3253 Remove unnecessary files from testkjs, testapi and minidom targets.
3255 * JavaScriptCore.xcodeproj/project.pbxproj:
3257 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3259 Reviewed by Oliver Hunt.
3261 Fixed ASSERT seen during run-sunspider of a debug build.
3263 * VM/CodeGenerator.h: Made the default codegen buffers bigger. SunSpider
3264 runs all tests in one global environment, so you end up with more than
3265 128 locals. This is just a stop-gap until we code up a real
3266 solution to arbitrary symbol and label limits.
3268 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3270 Reviewed by Oliver Hunt.
3272 Fixed a bug in exception unwinding, where we wouldn't deref the scope
3273 chain in global scope, so we would leak ScopeChainNodes when exceptions
3274 were thrown inside "with" and "catch" scopes.
3276 Also did some cleanup of the unwinding code along the way.
3278 Scope chain reference counting is still wrong in a few ways. I thought
3279 I would fix this portion of it first.
3281 run-sunspider shows no change.
3284 (KJS::Machine::unwindCallFrame):
3285 (KJS::Machine::throwException):
3286 (KJS::Machine::privateExecute):
3289 2008-04-17 Oliver Hunt <oliver@apple.com>
3293 Add more exception checking to toNumber conversions
3295 This corrects op_pre_dec, op_negate, op_mod and op_sub.
3298 (KJS::Machine::privateExecute):
3300 2008-04-17 Geoffrey Garen <ggaren@apple.com> and Cameron Zwarich <cwzwarich@uwaterloo.ca>
3302 Reviewed by Oliver Hunt.
3306 Introduced a new opcode: op_call_eval. In the normal case, it performs
3307 an eval. In the case where eval has been overridden in some way, it
3308 performs a function call.
3310 * VM/CodeGenerator.h: Added a feature so the code generator knows not
3311 to optimized locals in eval code.
3313 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3315 Reviewed by Sam Weinig.
3317 Added some ASSERTs to document codegen failures in
3318 run-javascriptcore-tests.
3320 For all tests, program-level codegen now either succeeds, or fails with
3323 * VM/CodeGenerator.cpp:
3324 (KJS::CodeGenerator::addVar):
3325 (KJS::CodeGenerator::CodeGenerator):
3326 (KJS::CodeGenerator::newTemporary):
3327 (KJS::CodeGenerator::newLabel):
3329 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3331 Reviewed by Maciej Stachowiak.
3333 Fixed another case of a dst register being an unreferenced temporary
3334 (caused an ASSERT when running the full sunspider suite).
3337 (KJS::CaseBlockNode::emitCodeForBlock):
3339 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3343 - add documentation (and meaningful parameter names) for arithmetic and bitwise binary ops
3346 (KJS::CodeBlock::dump):
3347 * VM/CodeGenerator.cpp:
3348 (KJS::CodeGenerator::emitMul):
3349 (KJS::CodeGenerator::emitDiv):
3350 (KJS::CodeGenerator::emitMod):
3351 (KJS::CodeGenerator::emitSub):
3352 (KJS::CodeGenerator::emitLeftShift):
3353 (KJS::CodeGenerator::emitRightShift):
3354 (KJS::CodeGenerator::emitUnsignedRightShift):
3355 (KJS::CodeGenerator::emitBitAnd):
3356 (KJS::CodeGenerator::emitBitXOr):
3357 (KJS::CodeGenerator::emitBitOr):
3358 * VM/CodeGenerator.h:
3360 (KJS::Machine::privateExecute):
3363 (KJS::MultNode::emitCode):
3364 (KJS::DivNode::emitCode):
3365 (KJS::ModNode::emitCode):
3366 (KJS::SubNode::emitCode):
3367 (KJS::LeftShiftNode::emitCode):
3368 (KJS::RightShiftNode::emitCode):
3369 (KJS::UnsignedRightShiftNode::emitCode):
3370 (KJS::BitAndNode::emitCode):
3371 (KJS::BitXOrNode::emitCode):
3372 (KJS::BitOrNode::emitCode):
3373 (KJS::emitReadModifyAssignment):
3374 (KJS::ReadModifyResolveNode::emitCode):
3376 2008-04-16 Oliver Hunt <oliver@apple.com>
3380 Exception checks for toNumber in op_pre_inc
3382 This is somewhat more convoluted than the simple hadException checks
3383 we currently use. Instead we use special toNumber conversions that
3384 select between the exception and ordinary vPC. This allows us to
3385 remove any branches in the common case (incrementing a number).
3387 * API/JSCallbackObject.h:
3388 * API/JSCallbackObjectFunctions.h:
3391 * JavaScriptCore.exp:
3392 * JavaScriptCore.xcodeproj/project.pbxproj:
3393 * VM/JSPropertyNameIterator.cpp:
3394 (KJS::JSPropertyNameIterator::toNumber):
3395 * VM/JSPropertyNameIterator.h:
3397 (KJS::Machine::privateExecute):
3399 * kjs/ExecState.cpp:
3400 (KJS::ExecState::ExecState):
3402 * kjs/JSNotAnObject.cpp:
3403 (KJS::JSNotAnObject::toNumber):
3404 * kjs/JSNotAnObject.h:
3406 (KJS::StringImp::toNumber):
3407 (KJS::NumberImp::toNumber):
3408 (KJS::GetterSetterImp::toNumber):
3411 (KJS::JSObject::toNumber):
3414 (KJS::JSValue::toNumber):
3416 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3420 - ensure that activations are kept in a register to protect them from GC
3422 Also renamed OptionalCalleeScopeChain constant to OptionalCalleeActivation, since
3423 that is what is now kept there, and there is no more need to keep the scope chain in
3427 (KJS::initializeCallFrame):
3428 (KJS::scopeChainForCall):
3432 2008-04-16 Geoffrey Garen <ggaren@apple.com>
3434 Reviewed by Oliver Hunt.
3436 Made "this" work in program code / global scope.
3438 The machine can initialize "this" prior to execution because it knows
3439 that, for program code, "this" is always stored in lr1.
3442 (KJS::Machine::execute):
3445 * kjs/interpreter.cpp:
3446 (KJS::Interpreter::evaluate):
3448 2008-04-16 Geoffrey Garen <ggaren@apple.com>
3450 Reviewed by Oliver Hunt.
3452 Fixed a codegen bug when returning from inside a dynamic scope (a with
3453 or catch block): we need to pop any dynamic scope(s) that have been
3454 added so op_ret can find the activation object at the top of the scope
3458 (KJS::ReturnNode::emitCode): If we're returning from inside a dynamic
3459 scope, emit a jmp_scopes to take care of popping any dynamic scope(s)
3460 and then branching to the return instruction.
3462 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3466 - document the add and get_prop_id opcodes
3468 In addition to adding documentation in comments, I changed
3469 references to register IDs or indices relating to these opcodes to
3470 have meaningful names instead of r0 r1 r2.
3472 * VM/CodeGenerator.cpp:
3473 (KJS::CodeGenerator::emitAdd):
3474 * VM/CodeGenerator.h:
3476 (KJS::Machine::privateExecute):
3478 (KJS::DotAccessorNode::emitCode):
3479 (KJS::FunctionCallDotNode::emitCode):
3480 (KJS::PostIncDotNode::emitCode):
3481 (KJS::PostDecDotNode::emitCode):
3482 (KJS::PreIncDotNode::emitCode):
3483 (KJS::PreDecDotNode::emitCode):
3484 (KJS::AddNode::emitCode):
3485 (KJS::ReadModifyDotNode::emitCode):
3487 2008-04-15 Geoffrey Garen <ggaren@apple.com>
3489 Reviewed by Oliver Hunt and Maciej Stachowiak.
3491 Fixed a codegen bug in with and switch, and added an ASSERT to
3492 make sure it doesn't happen again.
3494 emitCode() assumes that dst, if non-zero, is either referenced or
3495 non-temporary (i.e., it assumes that newTemporary() will return a
3496 register not equal to dst). Certain callers to emitCode() weren't
3497 guaranteeing that to be so, so temporary register values were being
3500 * VM/CodeGenerator.h:
3501 (KJS::CodeGenerator::emitNode): ASSERT that dst is referenced or non-temporary.
3504 (KJS::CommaNode::emitCode): Reference the dst we pass.
3506 (KJS::WithNode::emitCode): No need to pass an explicit dst register.
3508 (KJS::CaseBlockNode::emitCodeForBlock): No need to pass an explicit dst register.
3509 (KJS::SwitchNode::emitCode): No need to pass an explicit dst register.
3511 * kjs/nodes.h: Made dst the last parameter to emitCodeForBlock, to match
3514 2008-04-15 Oliver Hunt <oliver@apple.com>
3518 Bug 18526: Throw exceptions when resolve fails for op_resolve_base_and_func.
3519 <https://bugs.webkit.org/show_bug.cgi?id=18526>
3521 Very simple fix, sunspider shows a 0.7% progression, ubench shows a 0.4% regression.
3524 (KJS::resolveBaseAndFunc):
3525 (KJS::Machine::privateExecute):
3527 2008-04-15 Maciej Stachowiak <mjs@apple.com>
3531 - fix incorrect result on 3d-raytrace test
3533 Oliver found and tracked down this bug, I just typed in the fix.
3536 (KJS::slideRegisterWindowForCall): When setting omitted parameters to undefined,
3537 account for the space for local variables.
3539 2008-04-15 Maciej Stachowiak <mjs@apple.com>
3543 - fix codegen handling of dst registers
3545 1.006x speedup (not sure why).
3547 Most emitCode functions take an optional "dst" parameter that says
3548 where the output of the instruction should be written. I made some
3549 functions for convenient handling of the dst register:
3551 * VM/CodeGenerator.h:
3552 (KJS::CodeGenerator::tempDestination): Takes the dst register. Returns it if
3553 it is not null and is a temporary, otherwise allocates a new temporary. This is
3554 intended for cases where an intermediate value might be written into the dst
3556 (KJS::CodeGenerator::finalDestination): Takes the dst register and an optional
3557 register that was used as a temp destination. Picks the right thing for the final
3558 output. Intended to be used as the output register for the instruction that generates
3559 the final value of a particular node.
3561 (KJS::CodeGenerator::moveToDestinationIfNeeded): Takes dst and a
3562 RegisterID; moves from the register to dst if dst is defined and