1 2008-05-21 Alp Toker <alp@nuanti.com>
3 GTK+ port build fixes following squirrelfish merge r33979.
7 2008-05-21 Maciej Stachowiak <mjs@apple.com>
11 - save a hash lookup wne writing to global properties
12 0.3% speedup on SunSpider, 7% on bitops-bitwise-and
15 (KJS::resolveBase): Check for being a the end of the scope chain
18 2008-05-21 Alp Toker <alp@nuanti.com>
20 Rubber-stamped by Maciej.
22 Replace non-standard #pragma marks with comments to avoid compiler
25 * profiler/ProfileNode.cpp:
27 2008-05-21 Geoffrey Garen <ggaren@apple.com>
29 Reviewed by Mark Rowe.
31 Fix layout test failure in fast/dom/getter-on-window-object2 introduced in r33961.
34 * kjs/JSGlobalObject.cpp:
35 (KJS::JSGlobalObject::defineGetter):
36 (KJS::JSGlobalObject::defineSetter):
37 * kjs/JSGlobalObject.h:
39 === End merge of squirrelfish ===
41 2008-05-21 Geoffrey Garen <ggaren@apple.com>
43 Reviewed by Tim Hatcher.
45 Merged with trunk WebCore's new debugger.
47 * kjs/DebuggerCallFrame.cpp:
48 (KJS::DebuggerCallFrame::evaluate): Changed this function to separate
49 the exception value from the return value. The WebKit debugger treats
50 them as one, but the WebCore debugger doesn't.
52 * kjs/DebuggerCallFrame.h:
53 (KJS::DebuggerCallFrame::dynamicGlobalObject): Added a new accessor for
54 the dynamic global object, since the debugger doesn't want the lexical
57 2008-05-21 Oliver Hunt <oliver@apple.com>
61 Bug 19116: SquirrelFish shouldn't regress on variable lookups
62 <https://bugs.webkit.org/show_bug.cgi?id=19116>
64 Optimise cross scope assignment, 0.4% progression in sunspider.
67 (KJS::CodeBlock::dump):
68 * VM/CodeGenerator.cpp:
69 (KJS::CodeGenerator::emitPutScopedVar):
72 (KJS::Machine::privateExecute):
75 (KJS::AssignResolveNode::emitCode):
77 2008-05-21 Maciej Stachowiak <mjs@apple.com>
81 - check property map before symbol table in JSGlobalObject::getOwnPropertySlot
82 0.5% speedup on SunSpider
84 * kjs/JSGlobalObject.h:
85 (KJS::JSGlobalObject::getOwnPropertySlot): Check property map before symbol table
86 because symbol table access is likely to have been optimized.
88 2008-05-21 Oliver Hunt <oliver@apple.com>
92 Bug 19116: SquirrelFish shouldn't regress on variable lookups
93 <https://bugs.webkit.org/show_bug.cgi?id=19116>
95 Optimise multiscope lookup of statically resolvable function calls.
96 SunSpider reports a 1.5% improvement, including 37% on
97 controlflow-recursive for some reason :D
100 (KJS::CodeBlock::dump):
101 * VM/CodeGenerator.cpp:
102 (KJS::CodeGenerator::emitResolve):
103 * VM/CodeGenerator.h:
105 (KJS::FunctionCallResolveNode::emitCode):
107 2008-05-21 Maciej Stachowiak <mjs@apple.com>
111 - give JSGlobalObject a special version of getOwnPropertySlot that tells you if the slot is directly writable
112 (WebCore change using this is a 2.6% speedup on in-browser SunSpider).
114 * JavaScriptCore.exp:
115 * kjs/JSGlobalObject.h:
116 (KJS::JSGlobalObject::getOwnPropertySlot):
117 * kjs/JSVariableObject.h:
118 (KJS::JSVariableObject::symbolTableGet):
120 (KJS::JSObject::getDirectLocation):
121 (KJS::JSObject::getOwnPropertySlotForWrite):
122 * kjs/property_map.cpp:
123 (KJS::PropertyMap::getLocation):
124 * kjs/property_map.h:
125 * kjs/property_slot.h:
126 (KJS::PropertySlot::putValue):
128 2008-05-20 Oliver Hunt <oliver@apple.com>
132 Bug 19116: SquirrelFish shouldn't regress on variable lookups
133 <https://bugs.webkit.org/show_bug.cgi?id=19116>
135 This restores multiscope optimisation to simple resolve, producing
136 a 2.6% progression in SunSpider. Have verified that none of the
137 sites broken by the multiscope optimisation in trunk were effected
141 (KJS::CodeBlock::dump):
143 (KJS::CodeBlock::CodeBlock):
144 * VM/CodeGenerator.cpp:
145 (KJS::CodeGenerator::findScopedProperty):
146 (KJS::CodeGenerator::emitResolve):
147 * VM/CodeGenerator.h:
150 (KJS::Machine::privateExecute):
152 * kjs/JSVariableObject.h:
154 2008-05-20 Oliver Hunt <oliver@apple.com>
156 Reviewed by NOBODY (Build fix).
158 Fixerate the windows build.
160 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
161 * VM/CodeGenerator.cpp:
163 * kjs/JSGlobalObject.h:
167 2008-05-20 Oliver Hunt <oliver@apple.com>
171 Bug 19110: SquirrelFish: Google Maps - no maps
172 <https://bugs.webkit.org/show_bug.cgi?id=19110>
174 Correct a comedy of errors present in my original patch to "fix"
175 exceptions occurring midway through pre and post increment. This
176 solution is cleaner than the original, doesn't need the additional
177 opcodes, and as an added benefit does not break Google Maps.
179 Sunspider reports a 0.4% progression.
182 (KJS::CodeBlock::dump):
183 * VM/CodeGenerator.cpp:
184 * VM/CodeGenerator.h:
186 (KJS::Machine::privateExecute):
189 (KJS::PreIncResolveNode::emitCode):
190 (KJS::PreDecResolveNode::emitCode):
191 (KJS::PreIncBracketNode::emitCode):
192 (KJS::PreDecBracketNode::emitCode):
193 (KJS::PreIncDotNode::emitCode):
194 (KJS::PreDecDotNode::emitCode):
196 2008-05-20 Maciej Stachowiak <mjs@apple.com>
200 - inline JSGlobalObject::getOwnPropertySlot
201 1% improvement on in-browser SunSpider (a wash command-line)
203 * kjs/JSGlobalObject.cpp:
204 * kjs/JSGlobalObject.h:
205 (KJS::JSGlobalObject::getOwnPropertySlot):
207 2008-05-18 Oliver Hunt <oliver@apple.com>
211 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
212 <https://bugs.webkit.org/show_bug.cgi?id=18752>
214 Handle exceptions thrown by toString conversion in subscript operators,
215 this should basically complete exception handling in SquirrelFish.
217 Sunspider reports no regression.
220 (KJS::Machine::privateExecute):
222 2008-05-17 Geoffrey Garen <ggaren@apple.com>
224 Reviewed by Oliver Hunt.
226 [Reapplying patch with previously missing files from r33553 -- Oliver]
230 SunSpider reports no change.
232 * JavaScriptCore.xcodeproj/project.pbxproj: Added DebuggerCallFrame.h/.cpp,
233 and created a debugger folder.
235 * VM/CodeGenerator.cpp:
236 (KJS::CodeGenerator::generate): If the debugger is attached, always
237 generate full scope chains for its sake.
240 (KJS::Machine::unwindCallFrame): Notify the debugger when unwinding
241 due to an exception, so it doesn't keep stale call frames around.
243 (KJS::Machine::execute): Set Callee to 0 in eval frames, so the
244 debugger can distinguish them from function call frames.
246 (KJS::Machine::debug): Simplified this function, since the debugger
247 doesn't actually need all the information we used to provide.
249 (KJS::Machine::privateExecute): Treat debugging hooks like other function
250 calls, so the code we hook into (the debugger UI) can be optimized.
252 * kjs/debugger.cpp: Nixed these default callback implementations and
253 made the callbacks pure virtual instead, so the compiler could tell me
254 if I made a mistake in one of the subclasses.
256 * kjs/debugger.h: Removed a bunch of irrelevent data from the debugger
257 callbacks. Changed from passing an ExecState* to passing a
258 DebuggerCallFrame*, since an ExecState* doesn't contain sufficient
262 (KJS::globalFuncEval): Easiest bug fix evar!
264 [Previously missing files from r33553]
265 * kjs/DebuggerCallFrame.cpp: Copied from JavaScriptCore/profiler/FunctionCallProfile.h.
266 (KJS::DebuggerCallFrame::functionName):
267 (KJS::DebuggerCallFrame::thisObject):
268 (KJS::DebuggerCallFrame::evaluateScript):
269 * kjs/DebuggerCallFrame.h: Copied from JavaScriptCore/VM/Register.h.
270 (KJS::DebuggerCallFrame::DebuggerCallFrame):
271 (KJS::DebuggerCallFrame::scopeChain):
272 (KJS::DebuggerCallFrame::exception):
274 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
278 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
279 <https://bugs.webkit.org/show_bug.cgi?id=18991>
281 Fix the last remaining blocking cases of this bug.
285 (KJS::ReadModifyResolveNode::emitCode):
287 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
293 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
294 <https://bugs.webkit.org/show_bug.cgi?id=18991>
296 Ensure that the code generated for assignments uses temporaries whenever
297 necessary. This patch covers the vast majority of situations, but there
298 are still a few left.
300 This patch also adds some missing cases to CodeBlock::dump().
303 (KJS::CodeBlock::dump):
304 * VM/CodeGenerator.h:
305 (KJS::CodeGenerator::destinationForAssignResult):
306 (KJS::CodeGenerator::leftHandSideNeedsCopy):
307 (KJS::CodeGenerator::emitNodeForLeftHandSide):
311 (KJS::AssignDotNode::emitCode):
312 (KJS::ReadModifyDotNode::emitCode):
313 (KJS::AssignBracketNode::emitCode):
314 (KJS::ReadModifyBracketNode::emitCode):
315 (KJS::ForInNode::ForInNode):
317 (KJS::ReadModifyResolveNode::):
318 (KJS::AssignResolveNode::):
319 (KJS::ReadModifyBracketNode::):
320 (KJS::AssignBracketNode::):
321 (KJS::AssignDotNode::):
322 (KJS::ReadModifyDotNode::):
324 2008-05-17 Oliver Hunt <oliver@apple.com>
328 Bug 19106: SquirrelFish: Activation is not marked correctly
329 <https://bugs.webkit.org/show_bug.cgi?id=19106>
331 We can't rely on the symbol table for a count of the number of globals
332 we need to mark as that misses duplicate parameters and 'this'. Now we
333 use the actual local register count from the codeBlock.
335 * kjs/JSActivation.cpp:
336 (KJS::JSActivation::mark):
338 2008-05-16 Oliver Hunt <oliver@apple.com>
342 Bug 19076: SquirrelFish: RegisterFile can be corrupted if implictly reenter global scope with no declared vars
343 <https://bugs.webkit.org/show_bug.cgi?id=19076>
345 Don't delay allocation of initial global RegisterFile, as we can't guarantee we will be able
346 to allocate the global 'this' register safely at any point after initialisation of the Global
349 Unfortunately this initial allocation caused a regression of 0.2-0.3%, however this patch adds
350 support for the static slot optimisation for the global Math object which brings it to a 0.3%
353 * VM/CodeGenerator.cpp:
354 (KJS::CodeGenerator::programCodeThis):
355 (KJS::CodeGenerator::CodeGenerator):
356 (KJS::CodeGenerator::addParameter):
357 * VM/CodeGenerator.h:
359 (KJS::Machine::execute):
361 * kjs/JSGlobalObject.cpp:
362 (KJS::JSGlobalObject::reset):
363 * kjs/JSGlobalObject.h:
364 (KJS::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
365 (KJS::JSGlobalObject::addStaticGlobals):
368 2008-05-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
370 Reviewed by Oliver Hunt.
372 Bug 19098: SquirrelFish: Ref'd temporaries can be clobbered
373 <https://bugs.webkit.org/show_bug.cgi?id=19098>
375 When doing code generation for a statement list, increase the reference
376 count on a register that might eventually be returned, so that it doesn't
377 get clobbered by a request for a new temporary.
380 (KJS::statementListEmitCode):
382 2008-05-16 Maciej Stachowiak <mjs@apple.com>
386 - fixed Bug 19044: SquirrelFish: Bogus values enter evaluation when closing over scope with parameter and var with same name
387 https://bugs.webkit.org/show_bug.cgi?id=19044
389 * kjs/JSActivation.cpp:
390 (KJS::JSActivation::copyRegisters): Use numLocals from the code
391 block rather than the size of the symbol table for the number of
392 registers to copy, to account for duplicate parameters and vars
393 with the same name as parameters (we still have potentially
394 suboptimal codegen in that we allocate a local register for the
395 var in the latter case but it is never used).
397 2008-05-15 Geoffrey Garen <ggaren@apple.com>
401 We regret to inform you that your program is crashing because you were
405 (KJS::Machine::privateExecute): Math is hard.
407 2008-05-14 Geoffrey Garen <ggaren@apple.com>
409 Reviewed by Oliver Hunt.
411 A little more debugger action: filled in op_debug. All debugger control
412 flow works now, but variable inspection and backtraces still don't.
414 SunSpider reports no change.
416 * VM/CodeGenerator.cpp: Changed op_debug to accept line number parameters.
419 (KJS::Machine::getFunctionAndArguments): Moved op_debug into a
420 NEVER_INLINE function to avoid a stunning 10% performance regression.
421 Also factored out a common function for retrieving the function and
422 arguments from a call frame.
424 * kjs/JSActivation.cpp:
425 (KJS::JSActivation::createArgumentsObject): Use the new factored out
426 function mentioned above.
429 (KJS::Parser::parse): Increment m_sourceId before assigning it, so the
430 sourceId we send to the debugger matches the sourceId recorded in the
433 * kjs/nodes.cpp: Emit debugging hooks.
435 2008-05-14 Oliver Hunt <oliver@apple.com>
439 Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
440 <https://bugs.webkit.org/show_bug.cgi?id=19024>
442 This fixes a number of issues. The most important is that we now check every register
443 file for tainting rather than just looking for function register files as that was
444 insufficient. Additionally guarded against implicit re-entry into Eval code.
446 Also added a few additional assertions to reduce the amout of time between something
447 going wrong and us seeing the error.
450 (KJS::Machine::execute):
451 (KJS::Machine::privateExecute):
452 * VM/RegisterFile.cpp:
453 (KJS::RegisterFile::growBuffer):
454 (KJS::RegisterFile::addGlobalSlots):
455 * VM/RegisterFileStack.cpp:
456 (KJS::RegisterFileStack::pushGlobalRegisterFile):
457 (KJS::RegisterFileStack::pushFunctionRegisterFile):
458 * VM/RegisterFileStack.h:
459 (KJS::RegisterFileStack::inImplicitCall):
461 2008-05-14 Geoffrey Garen <ggaren@apple.com>
463 Reviewed by Oliver Hunt.
465 A little more debugger action: emit opcodes for debugger hooks. Right
466 now, the opcode implementation is just a stub.
468 SunSpider reports no change.
470 Some example codegen for "function f() { 1; }":
472 [ 0] dbg DidEnterCallFrame
473 [ 2] dbg WillExecuteStatement
474 [ 4] load tr0, 1(@k0)
475 [ 7] load tr0, undefined(@k1)
476 [ 10] dbg WillLeaveCallFrame
479 2008-05-14 Oliver Hunt <oliver@apple.com>
483 Bug 19025: SQUIRRELFISH: malformed syntax in onload handler causes crash
484 <https://bugs.webkit.org/show_bug.cgi?id=19025>
486 Simple fix -- move the use of functionBodyNode to after the null check.
488 * kjs/function_object.cpp:
489 (KJS::FunctionObjectImp::construct):
491 2008-05-13 Geoffrey Garen <ggaren@apple.com>
493 Reviewed by Oliver Hunt.
495 Fixed a codegen crash with run-time parse errors.
497 SunSpider reports no change.
499 emitThrowError needs to return the temporary holding the error, not dst,
500 since dst may be NULL. In fact, emitThrowError shouldn't take a dst
501 parameter at all, since exceptions should not modify the destination
504 2008-05-13 Oliver Hunt <oliver@apple.com>
508 Bug 19027: SquirrelFish: Incorrect codegen for pre-increment
509 <https://bugs.webkit.org/show_bug.cgi?id=19027>
511 This fixes the codegen issues for the pre-inc/decrement operators
512 to prevent incorrectly clobbering the destination in the event of
516 (KJS::CodeBlock::dump):
517 * VM/CodeGenerator.cpp:
518 (KJS::CodeGenerator::emitPreInc):
519 (KJS::CodeGenerator::emitPreDec):
520 * VM/CodeGenerator.h:
522 (KJS::Machine::privateExecute):
525 (KJS::PreIncResolveNode::emitCode):
526 (KJS::PreDecResolveNode::emitCode):
527 (KJS::PreIncBracketNode::emitCode):
528 (KJS::PreDecBracketNode::emitCode):
529 (KJS::PreIncDotNode::emitCode):
530 (KJS::PreDecDotNode::emitCode):
532 2008-05-13 Geoffrey Garen <ggaren@apple.com>
534 Reviewed by Oliver Hunt.
536 A little more debugger action: supply a real line number, sourceId,
537 and sourceURL in op_new_error.
539 SunSpider reports a .2% speedup. Not sure what that's about.
542 (KJS::Machine::privateExecute): Use the new good stuff in op_new_error.
545 (KJS::RegExpNode::emitCode): Use the shared emitThrowError instead of
548 2008-05-13 Geoffrey Garen <ggaren@apple.com>
550 Reviewed by Oliver Hunt.
552 A little more debugger action: implemented the exception callback.
554 SunSpider reports a .2% speedup. Not sure what that's about.
556 * VM/CodeBlock.h: A little refactoring here. Store a pointer to our
557 owner ScopeNode so we can retrieve data from it. This allows us to
558 stop storing copies of the data ourselves. Also, store a "this" register
559 instead of a code type, since we were only using the code type to
560 calculate the "this" register.
562 * VM/CodeGenerator.cpp:
563 (KJS::CodeGenerator::generate): Calculate the "this" register mentioned
564 above. Also, take care of removing "this" from the symbol table after
565 codegen is done, since relying on the timing of a destructor for correct
566 behavior is not so good.
569 (KJS::Machine::throwException): Invoke the debugger's exception callback.
570 (KJS::Machine::privateExecute): Use the "this" register mentioned above.
572 2008-05-13 Geoffrey Garen <ggaren@apple.com>
574 Reviewed by Oliver Hunt.
576 Removed some unused exception machinery.
578 SunSpider reports a .3% speedup.
580 * API/JSCallbackObject.h:
581 * API/JSCallbackObjectFunctions.h:
582 * JavaScriptCore.exp:
584 (KJS::Machine::privateExecute):
590 2008-05-13 Geoffrey Garen <ggaren@apple.com>
592 Reviewed by Oliver Hunt.
594 A little more debugger action.
597 * kjs/debugger.h: Removed debuggersPresent because it was unused.
598 Replaced AttachedGlobalObject linked list with a HashSet because HashSet
599 is faster and simpler. Changed all functions to return void instead of
600 bool, because no clients ever return false, and we don't want to support
603 * kjs/nodes.cpp: Did some up-keep to avoid build bustage.
604 (KJS::Node::handleException):
605 (KJS::BreakpointCheckStatement::execute):
606 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
608 2008-05-13 Oliver Hunt <oliver@apple.com>
612 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
613 <https://bugs.webkit.org/show_bug.cgi?id=18752>
615 Replace old attempt at "branchless" exceptions as the extra information
616 being passed made gcc an unhappy compiler, replacing these custom toNumber
617 calls with ordinary toNumber logic (by relying on toNumber now preventing
618 side effects after an exception has been thrown) provided sufficient leeway
619 to add the additional checks for the remaining unchecked cases.
621 This leaves only toString conversions in certain contexts as possibly
627 (KJS::resolveBaseAndProperty):
628 (KJS::resolveBaseAndFunc):
629 (KJS::Machine::privateExecute):
632 (KJS::JSValue::safeGetNumber):
634 2008-05-13 Geoffrey Garen <ggaren@apple.com>
636 Reviewed by Oliver Hunt.
638 First steps toward supporting the debugger API: support the sourceParsed
639 callback; plus some minor fixups.
641 SunSpider reports no regression.
643 * VM/CodeGenerator.h: Removed a misleading comment.
645 * kjs/Parser.h: Changed the parser to take an ExecState*, so it can
646 implement the sourceParsed callback -- that way, we only have to
647 implement the callback in one place.
649 * kjs/debugger.cpp: Nixed DebuggerImp, because its sole purpose in life
650 was to demonstrate the misapplication of design patterns.
652 * kjs/debugger.h: Changed sourceParsed to take a SourceProvider, to
653 reduce copying, and not to return a value, because pausing execution
654 after parsing is complicated, and no clients needed that ability, anyway.
656 * kjs/grammar.y: Make sure never to pass a NULL SourceElements* to
657 didFinishParsing -- that simplifies some code down the road.
659 * kjs/nodes.cpp: Don't generate special AST nodes just because the
660 debugger is attached -- that's a relic of the old AST execution model,
661 and those nodes haven't been maintained.
663 2008-05-13 Oliver Hunt <oliver@apple.com>
667 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
668 <https://bugs.webkit.org/show_bug.cgi?id=18752>
670 First step: prevent incorrect evaluation of valueOf/toString conversion
671 in right hand side of expression after earlier conversion throws.
673 * API/JSCallbackObjectFunctions.h:
676 (KJS::JSObject::defaultValue):
678 2008-05-12 Oliver Hunt <oliver@apple.com>
682 Bug 18934: SQUIRRELFISH: ASSERT @ nytimes.com due to RegisterFile being clobbered
683 <https://bugs.webkit.org/show_bug.cgi?id=18934>
685 Unfortunately we cannot create new statically optimised globals if there are any
686 tainted RegisterFiles on the RegisterFileStack. To handle this we re-introduce
687 (in a slightly cleaner form) the inImplicitCall concept to the RegisterFileStack.
690 (KJS::Machine::execute):
691 * VM/RegisterFileStack.cpp:
692 (KJS::RegisterFileStack::pushFunctionRegisterFile):
693 * VM/RegisterFileStack.h:
695 2008-05-12 Geoffrey Garen <ggaren@apple.com>
697 Reviewed by Maciej Stachowiak.
699 Introduced support for function.caller.
701 Improved support for walking interesting scopes for function introspection.
703 This fixes all remaining layout tests not blocked by rebasing to trunk.
705 SunSpider reports no change.
708 (KJS::Machine::dumpRegisters): Fixed a spacing issue.
710 2008-05-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
714 Bug 18961: SQUIRRELFISH: Gmail doesn't load
715 <https://bugs.webkit.org/show_bug.cgi?id=18961>
717 Fix codegen for logical nodes so that they don't use their destination
721 (KJS::LogicalAndNode::emitCode):
722 (KJS::LogicalOrNode::emitCode):
724 2008-05-10 Maciej Stachowiak <mjs@apple.com>
728 - JavaScriptCore part of fix for: "SQUIRRELFISH: function toString broken after calling"
729 https://bugs.webkit.org/show_bug.cgi?id=18869
731 Three layout tests are fixed:
732 fast/js/toString-elision-trailing-comma.html
733 fast/js/toString-prefix-postfix-preserve-parens.html
734 fast/js/kde/lval-exceptions.html
736 Functions now save a shared subrange of the original source used
737 to make them (so in the common case this adds no storage above the
740 * kjs/SourceProvider.h: Added.
741 (KJS::SourceProvider): New abstract base class for classes that provide on-demand access
742 to the source for a JavaScript program. This allows function objects to have access to their
743 original source without copying.
744 (KJS::UStringSourceProvider): SourceProvider subclass backed by a KJS::UString.
745 (KJS::UStringSourceProvider::create):
746 (KJS::UStringSourceProvider::getRange):
747 (KJS::UStringSourceProvider::data):
748 (KJS::UStringSourceProvider::length):
749 (KJS::UStringSourceProvider::UStringSourceProvider):
750 * kjs/SourceRange.h: Added.
751 (KJS::SourceRange::SourceRange): Class that holds a SourceProvider and a character range into
752 the source, to encapsulate on-demand access to the source of a function.
753 (KJS::SourceRange::toString):
755 (KJS::eval): Pass a UStringSourceProvider to the parser.
757 (KJS::Parser::parse): Take a SourceProvider and pass it on to the lexer.
759 (KJS::Parser::parse): Take a SourceProvider.
761 (KJS::Lexer::setCode): Take a SourceProvider; keep it around, and
762 use it to get the raw buffer and length.
764 (KJS::Lexer::sourceRange): Convenience function to get a source
765 range based on the lexer's source provieder, and char offsets
766 right before and after the desired range.
768 (KJS::globalFuncEval): Pass a UStringSourceProvider to the parser.
769 * kjs/function_object.cpp:
770 (KJS::functionProtoFuncToString): Use toSourceString to get the source.
771 (KJS::FunctionObjectImp::construct): Give the parser a UStringSourceProvider.
772 * kjs/grammar.y: When parsing a function declaration, function
773 expression, or getter or setter, tell the function body about its
775 * kjs/interpreter.cpp:
776 (KJS::Interpreter::checkSyntax): Pass a SourceProvider to the parser.
777 (KJS::Interpreter::evaluate): Pass a SourceProvider to the parser.
780 (KJS::FunctionBodyNode::setSource): Establish a SourceRange for this function.
781 (KJS::FunctionBodyNode::toSourceString): Get the source string out
783 (KJS::FuncExprNode::): Take a SourceRange and set it on the body.
784 (KJS::FuncDeclNode::): ditto
786 (prettyPrintScript): Use a SourceProvider appropriately.
787 * JavaScriptCore.exp: Export new symbols.
788 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add new files.
789 * JavaScriptCore.xcodeproj/project.pbxproj: Add new files.
791 2008-05-09 Oliver Hunt <oliver@apple.com>
795 Bring back RegisterFile tainting in order to correctly handle
796 natively implemented getters and setters that re-enter JavaScript
799 (KJS::Machine::privateExecute):
802 (KJS::FunctionImp::callAsFunction):
804 (KJS::JSObject::put):
805 (KJS::tryGetAndCallProperty):
806 * kjs/property_slot.cpp:
807 (KJS::PropertySlot::functionGetter):
809 2008-05-09 Maciej Stachowiak <mjs@apple.com>
813 - track character offsets of open and close braces, in preparation for saving function source
815 I verified that there is no performance regression from this change.
820 (KJS::Lexer::matchPunctuator):
823 2008-05-09 Oliver Hunt <oliver@apple.com>
825 Reviewed by Nobody (build fix).
829 * kjs/JSGlobalObject.cpp:
830 (KJS::JSGlobalObject::restoreLocalStorage):
832 2008-05-09 Oliver Hunt <oliver@apple.com>
836 Build fixes for SquirrelFish on windows.
838 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
839 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
841 * kjs/JSGlobalObject.cpp:
842 (KJS::JSGlobalObject::restoreLocalStorage):
844 (KJS::Collector::allocate):
845 (KJS::Collector::allocateNumber):
847 (KJS::Collector::allocate):
848 (KJS::Collector::allocateNumber):
849 * kjs/property_slot.cpp:
851 2008-05-08 Maciej Stachowiak <mjs@apple.com>
855 - fix activation tearoff in the case where functions are called with too many arguments
858 fast/canvas/patternfill-repeat.html
859 fast/dom/SelectorAPI/bug-17313.html
862 (KJS::slideRegisterWindowForCall):
863 (KJS::scopeChainForCall):
864 (KJS::Machine::execute):
865 (KJS::Machine::privateExecute):
867 2008-05-08 Geoffrey Garen <ggaren@apple.com>
869 Reviewed by Oliver Hunt.
871 Fixed failure in fast/canvas/canvas-pattern-behaviour.html.
873 SunSpider reports a small speedup. Not sure what that's about.
876 (KJS::CodeBlock::dump): Fixed op_call_eval to dump as "op_call_eval".
877 This helped me while debugging.
880 (KJS::Machine::unwindCallFrame): When looking for an activation to tear
881 off, don't use the scope chain. Inside eval, the scope chain doesn't
882 belong to us; it belongs to our calling function.
884 Also, don't use the needsFullScopeChain flag to decide whether to tear
885 off the activation. "function.arguments" can create an activation
886 for a function whose needsFullScopeChain flag is set to false.
888 2008-05-08 Maciej Stachowiak <mjs@apple.com>
892 - fix function.call for calls of more than 8 arguments
894 Fixes svg/carto.net/button.svg
897 (KJS::List::getSlice): properly set up the m_buffer of the target list.
899 2008-05-08 Maciej Stachowiak <mjs@apple.com>
903 - don't return a null RegisterID from RegExpNode in the exception case, since the caller may need a real register
906 - fast/regex/early-acid3-86.html
907 - http/tests/misc/acid3.html
910 (KJS::RegExpNode::emitCode):
912 2008-05-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
916 Fix a performance regression caused by the introduction of property
917 attributes to SymbolTable in r32859 by encoding the attributes and the
918 register index into a single field of SymbolTableEntry.
920 This leaves Node::optimizeVariableAccess() definitely broken, although
921 it was probably not entirely correct in SquirrelFish before this change.
924 (KJS::missingThisObjectMarker):
925 * VM/CodeGenerator.cpp:
926 (KJS::CodeGenerator::addVar):
927 (KJS::CodeGenerator::CodeGenerator):
928 (KJS::CodeGenerator::registerForLocal):
929 (KJS::CodeGenerator::registerForLocalConstInit):
930 (KJS::CodeGenerator::isLocalConstant):
931 (KJS::CodeGenerator::addConstant):
932 (KJS::CodeGenerator::emitCall):
933 * VM/CodeGenerator.h:
934 (KJS::CodeGenerator::IdentifierMapIndexHashTraits::emptyValue):
936 (KJS::Machine::privateExecute):
937 * kjs/JSGlobalObject.cpp:
938 (KJS::JSGlobalObject::saveLocalStorage):
939 * kjs/JSVariableObject.cpp:
940 (KJS::JSVariableObject::getPropertyNames):
941 (KJS::JSVariableObject::getPropertyAttributes):
942 * kjs/JSVariableObject.h:
943 (KJS::JSVariableObject::symbolTableGet):
944 (KJS::JSVariableObject::symbolTablePut):
945 (KJS::JSVariableObject::symbolTablePutWithAttributes):
947 (KJS::SymbolTableEntry::SymbolTableEntry):
948 (KJS::SymbolTableEntry::isEmpty):
949 (KJS::SymbolTableEntry::getIndex):
950 (KJS::SymbolTableEntry::getAttributes):
951 (KJS::SymbolTableEntry::setAttributes):
952 (KJS::SymbolTableEntry::isReadOnly):
954 (KJS::getSymbolTableEntry):
955 (KJS::PostIncResolveNode::optimizeVariableAccess):
956 (KJS::PostDecResolveNode::optimizeVariableAccess):
957 (KJS::DeleteResolveNode::optimizeVariableAccess):
958 (KJS::TypeOfResolveNode::optimizeVariableAccess):
959 (KJS::PreIncResolveNode::optimizeVariableAccess):
960 (KJS::PreDecResolveNode::optimizeVariableAccess):
961 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
962 (KJS::AssignResolveNode::optimizeVariableAccess):
963 (KJS::ProgramNode::initializeSymbolTable):
965 2008-05-06 Maciej Stachowiak <mjs@apple.com>
967 Rubber stamped by Oliver.
969 - add missing ! in an assert that I failed to reverse
971 * VM/CodeGenerator.cpp:
972 (KJS::CodeGenerator::CodeGenerator):
974 2008-05-06 Maciej Stachowiak <mjs@apple.com>
978 - fixed "SQUIRRELFISH: window.this shows up as a property, but it shouldn't"
979 https://bugs.webkit.org/show_bug.cgi?id=18868
981 The basic approach is to have "this" only be present in the symbol
982 table at compile time, not runtime.
984 * VM/CodeGenerator.cpp:
985 (KJS::CodeGenerator::~CodeGenerator): Remove "this" from symbol table.
986 (KJS::CodeGenerator::CodeGenerator): Add "this" back when re-using
988 * VM/CodeGenerator.h:
990 (KJS::Machine::execute): Don't assert that "this" is in the symbol table.
992 2008-05-06 Geoffrey Garen <ggaren@apple.com>
994 Reviewed by Oliver Hunt.
996 Trivial support for function.arguments: Currently, we only support
997 function.arguments from within the scope of function.
999 This fixes the remaining Mozilla JS test failures.
1001 SunSpider reports no change.
1003 * JavaScriptCore.exp:
1006 (KJS::Machine::privateExecute): Separated scope chain deref from
1007 activation register copying: since it is now possible for client code
1008 to create an activation on behalf of a function that otherwise wouldn't
1009 need one, having an activation no longer necessarily means that you need
1010 to deref the scope chain.
1012 (KJS::Machine::getCallFrame): For now, this function only examines the
1013 current scope. Walking parent scopes requires some refactoring in the
1014 way we track execution stacks.
1016 * kjs/ExecState.cpp:
1017 (KJS::ExecState::ExecState): We use a negative call frame offset to
1018 indicate that a given scope is not a function call scope.
1020 2008-05-05 Oliver Hunt <oliver@apple.com>
1024 Fix call frame set up for native -> JS function calls.
1027 (KJS::Machine::execute):
1029 2008-05-05 Geoffrey Garen <ggaren@apple.com>
1031 Reviewed by Maciej Stachowiak.
1033 Fixed ecma_3/Object/8.6.2.6-001.js, and similar bugs.
1035 SunSpider reports a .4% speedup. Not sure what that's about.
1038 (KJS::Machine::privateExecute): Check for exception return from equal,
1039 since toPrimitive can throw.
1041 * kjs/operations.cpp:
1042 (KJS::strictEqual): In response to an error I made in an earlier version
1043 of this patch, I changed strictEqual to make clear the fact that it
1044 performs no conversions and can't throw, making it slightly more efficient
1047 2008-05-05 Maciej Stachowiak <mjs@apple.com>
1051 - fix some dumb mistakes in my last patch
1053 * VM/CodeGenerator.cpp:
1054 (KJS::CodeGenerator::emitPushScope):
1055 (KJS::CodeGenerator::emitGetPropertyNames):
1057 (KJS::Machine::privateExecute):
1059 2008-05-05 Maciej Stachowiak <mjs@apple.com>
1063 - document opcodes relating to jumps, scopes, and property name iteration
1065 Documented jmp, jtrue, false, push_scope, pop_scope, get_pnames,
1066 next_pname and jmp_scopes.
1068 * VM/CodeGenerator.cpp:
1069 (KJS::CodeGenerator::emitJump):
1070 (KJS::CodeGenerator::emitJumpIfTrue):
1071 (KJS::CodeGenerator::emitJumpIfFalse):
1072 (KJS::CodeGenerator::emitPushScope):
1073 (KJS::CodeGenerator::emitNextPropertyName):
1074 (KJS::CodeGenerator::emitGetPropertyNames):
1075 * VM/CodeGenerator.h:
1077 (KJS::Machine::privateExecute):
1079 (KJS::LogicalAndNode::emitCode):
1080 (KJS::LogicalOrNode::emitCode):
1081 (KJS::ConditionalNode::emitCode):
1082 (KJS::IfNode::emitCode):
1083 (KJS::IfElseNode::emitCode):
1084 (KJS::DoWhileNode::emitCode):
1085 (KJS::WhileNode::emitCode):
1086 (KJS::ForNode::emitCode):
1087 (KJS::ForInNode::emitCode):
1088 (KJS::WithNode::emitCode):
1090 2008-05-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1094 Bug 18749: SQUIRRELFISH: const support is broken
1095 <https://bugs.webkit.org/show_bug.cgi?id=18749>
1097 Adds support for const during code generation.
1099 Fixes 2 layout tests.
1102 * VM/CodeGenerator.cpp:
1103 (KJS::CodeGenerator::addVar):
1104 (KJS::CodeGenerator::CodeGenerator):
1105 (KJS::CodeGenerator::isLocalConstant):
1106 * VM/CodeGenerator.h:
1107 (KJS::CodeGenerator::addVar):
1109 (KJS::PostIncResolveNode::emitCode):
1110 (KJS::PostDecResolveNode::emitCode):
1111 (KJS::PreIncResolveNode::emitCode):
1112 (KJS::PreDecResolveNode::emitCode):
1113 (KJS::ReadModifyResolveNode::emitCode):
1114 (KJS::AssignResolveNode::emitCode):
1116 2008-05-04 Maciej Stachowiak <mjs@apple.com>
1120 - document some more opcodes (and fix argument names)
1122 Added docs for eq, neq, stricteq, nstriceq, less and lesseq.
1124 * VM/CodeGenerator.cpp:
1125 (KJS::CodeGenerator::emitEqual):
1126 (KJS::CodeGenerator::emitNotEqual):
1127 (KJS::CodeGenerator::emitStrictEqual):
1128 (KJS::CodeGenerator::emitNotStrictEqual):
1129 (KJS::CodeGenerator::emitLess):
1130 (KJS::CodeGenerator::emitLessEq):
1131 * VM/CodeGenerator.h:
1133 (KJS::Machine::privateExecute):
1135 (KJS::LessNode::emitCode):
1136 (KJS::GreaterNode::emitCode):
1137 (KJS::LessEqNode::emitCode):
1138 (KJS::GreaterEqNode::emitCode):
1139 (KJS::EqualNode::emitCode):
1140 (KJS::NotEqualNode::emitCode):
1141 (KJS::StrictEqualNode::emitCode):
1142 (KJS::NotStrictEqualNode::emitCode):
1143 (KJS::CaseBlockNode::emitCodeForBlock):
1145 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1147 Reviewed by Maciej Stachowiak.
1149 More scaffolding for f.arguments.
1151 Track the offset of the last call frame in the ExecState, so we can
1152 produce a backtrace at any time.
1154 Also, record numLocals, the sum of numVars + numParameters, in each code
1155 block, to make updates to the ExecState a little cheaper than they
1158 We now use numLocals in a bunch of places where we used to calculate
1159 numVars + numParameters or -numVars - numParameters.
1161 Reports are mixed, but all in all, this seems to be a wash on SunSpider.
1163 2008-05-04 Oliver Hunt <oliver@apple.com>
1167 Whoops, correctly handle properties that don't exist in the
1170 * kjs/JSVariableObject.h:
1171 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1173 2008-05-04 Oliver Hunt <oliver@apple.com>
1177 Add attribute information to SymbolTable as ground work for
1178 various DontEnum and ReadOnly issues.
1180 * VM/CodeGenerator.cpp:
1181 (KJS::CodeGenerator::addVar):
1182 (KJS::CodeGenerator::CodeGenerator):
1183 (KJS::CodeGenerator::registerForLocal):
1184 (KJS::CodeGenerator::registerForLocalConstInit):
1185 (KJS::CodeGenerator::addConstant):
1187 (KJS::Machine::execute):
1188 * kjs/JSGlobalObject.cpp:
1189 (KJS::JSGlobalObject::saveLocalStorage):
1190 * kjs/JSVariableObject.cpp:
1191 (KJS::JSVariableObject::getPropertyNames):
1192 (KJS::JSVariableObject::getPropertyAttributes):
1193 * kjs/JSVariableObject.h:
1194 (KJS::JSVariableObject::symbolTablePut):
1195 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1196 * kjs/SymbolTable.h:
1197 (KJS::SymbolTableEntry::SymbolTableEntry):
1198 (KJS::SymbolTableIndexHashTraits::emptyValue):
1200 (KJS::getSymbolTableEntry):
1201 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1202 (KJS::AssignResolveNode::optimizeVariableAccess):
1203 (KJS::ProgramNode::initializeSymbolTable):
1205 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1207 Reviewed by Oliver Hunt.
1209 More scaffolding for f.arguments.
1211 Store the register file associated with an ExecState in the ExecState.
1213 SunSpider reports no change.
1215 * kjs/JSGlobalObject.h:
1216 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Moved
1217 registerFileStack above globalExec, so it gets initialized first.
1218 Removed remnants of old activation scheme.
1220 2008-05-04 Maciej Stachowiak <mjs@apple.com>
1222 Rubber stamped by Oliver.
1224 - renamed a few opcodes and fixed assembly formatting to accomodate the longest opcode
1228 resolve_base_and_property --> resolve_with_base
1229 resolve_base_and_func --> resolve_func
1230 get_prop_id --> get_by_id
1231 put_prop_id --> put_by_id
1232 delete_prop_id --> del_by_id
1233 get_prop_val --> get_by_val
1234 put_prop_val --> put_by_val
1235 delete_prop_val --> del_by_val
1236 put_prop_index --> put_by_index
1239 (KJS::printUnaryOp):
1240 (KJS::printBinaryOp):
1241 (KJS::printConditionalJump):
1242 (KJS::CodeBlock::dump):
1243 * VM/CodeGenerator.cpp:
1244 (KJS::CodeGenerator::emitEqual):
1245 (KJS::CodeGenerator::emitNotEqual):
1246 (KJS::CodeGenerator::emitResolveWithBase):
1247 (KJS::CodeGenerator::emitResolveFunction):
1248 (KJS::CodeGenerator::emitGetById):
1249 (KJS::CodeGenerator::emitPutById):
1250 (KJS::CodeGenerator::emitDeleteById):
1251 (KJS::CodeGenerator::emitGetByVal):
1252 (KJS::CodeGenerator::emitPutByVal):
1253 (KJS::CodeGenerator::emitDeleteByVal):
1254 (KJS::CodeGenerator::emitPutByIndex):
1255 * VM/CodeGenerator.h:
1257 (KJS::Machine::privateExecute):
1260 (KJS::ArrayNode::emitCode):
1261 (KJS::PropertyListNode::emitCode):
1262 (KJS::BracketAccessorNode::emitCode):
1263 (KJS::DotAccessorNode::emitCode):
1264 (KJS::EvalFunctionCallNode::emitCode):
1265 (KJS::FunctionCallResolveNode::emitCode):
1266 (KJS::FunctionCallBracketNode::emitCode):
1267 (KJS::FunctionCallDotNode::emitCode):
1268 (KJS::PostIncResolveNode::emitCode):
1269 (KJS::PostDecResolveNode::emitCode):
1270 (KJS::PostIncBracketNode::emitCode):
1271 (KJS::PostDecBracketNode::emitCode):
1272 (KJS::PostIncDotNode::emitCode):
1273 (KJS::PostDecDotNode::emitCode):
1274 (KJS::DeleteResolveNode::emitCode):
1275 (KJS::DeleteBracketNode::emitCode):
1276 (KJS::DeleteDotNode::emitCode):
1277 (KJS::TypeOfResolveNode::emitCode):
1278 (KJS::PreIncResolveNode::emitCode):
1279 (KJS::PreDecResolveNode::emitCode):
1280 (KJS::PreIncBracketNode::emitCode):
1281 (KJS::PreDecBracketNode::emitCode):
1282 (KJS::PreIncDotNode::emitCode):
1283 (KJS::PreDecDotNode::emitCode):
1284 (KJS::ReadModifyResolveNode::emitCode):
1285 (KJS::AssignResolveNode::emitCode):
1286 (KJS::AssignDotNode::emitCode):
1287 (KJS::ReadModifyDotNode::emitCode):
1288 (KJS::AssignBracketNode::emitCode):
1289 (KJS::ReadModifyBracketNode::emitCode):
1290 (KJS::ConstDeclNode::emitCodeSingle):
1291 (KJS::ForInNode::emitCode):
1292 (KJS::TryNode::emitCode):
1294 2008-05-04 Oliver Hunt <oliver@apple.com>
1298 Fix assertion when accessing arguments object with too many arguments provided
1300 The arguments constructor was assuming that the register offset given for argv
1301 was an absolute offset into the registerfile, rather than the offset from the
1302 frame. This patches corrects that issue.
1304 * kjs/JSActivation.cpp:
1305 (KJS::JSActivation::createArgumentsObject):
1307 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1309 Rubber stamped by Sam Weinig.
1311 Cleaned up Machine.cpp according to our style guidelines: moved static
1312 data to the top of the file; moved stand-alone functions below that;
1313 moved the Machine constructor above other Machine member functions.
1315 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1319 - fix accidental breakage from last patch
1322 (KJS::Machine::privateExecute):
1324 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1328 - a bunch more opcode documentation and corresponding parameter name fixes
1330 I renamed a few opcodes:
1332 type_of --> typeof (that's what the JS operator is named)
1333 instance_of --> instanceof (ditto)
1334 create_error --> new_error (for consistency with other new_* opcodes)
1336 I documented the following opcodes:
1358 I also fixed formatting on some existing opcode docs.
1361 (KJS::CodeBlock::dump):
1362 * VM/CodeGenerator.cpp:
1363 (KJS::CodeGenerator::emitMove):
1364 (KJS::CodeGenerator::emitNot):
1365 (KJS::CodeGenerator::emitPreInc):
1366 (KJS::CodeGenerator::emitPreDec):
1367 (KJS::CodeGenerator::emitPostInc):
1368 (KJS::CodeGenerator::emitPostDec):
1369 (KJS::CodeGenerator::emitToJSNumber):
1370 (KJS::CodeGenerator::emitNegate):
1371 (KJS::CodeGenerator::emitBitNot):
1372 (KJS::CodeGenerator::emitInstanceOf):
1373 (KJS::CodeGenerator::emitTypeOf):
1374 (KJS::CodeGenerator::emitIn):
1375 (KJS::CodeGenerator::emitLoad):
1376 (KJS::CodeGenerator::emitNewObject):
1377 (KJS::CodeGenerator::emitNewArray):
1378 (KJS::CodeGenerator::emitNewRegExp):
1379 (KJS::CodeGenerator::emitNewError):
1380 * VM/CodeGenerator.h:
1381 (KJS::CodeGenerator::scopeDepth):
1382 (KJS::CodeGenerator::addVar):
1384 (KJS::Machine::privateExecute):
1387 (KJS::Node::emitThrowError):
1388 (KJS::RegExpNode::emitCode):
1389 (KJS::TypeOfValueNode::emitCode):
1390 (KJS::UnaryPlusNode::emitCode):
1391 (KJS::NegateNode::emitCode):
1392 (KJS::BitwiseNotNode::emitCode):
1393 (KJS::LogicalNotNode::emitCode):
1394 (KJS::InstanceOfNode::emitCode):
1395 (KJS::InNode::emitCode):
1397 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1399 Reviewed by Geoff and Sam.
1401 - generate HTML bytecode docs at build time
1403 * DerivedSources.make:
1405 * docs/make-bytecode-docs.pl: Added.
1407 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1409 Reviewed by Sam Weinig.
1411 Update ExecState::m_scopeChain when switching scope chains inside the
1414 This fixes uses of lexicalGlobalObject, such as, in a subframe
1416 alert(top.makeArray() instanceof Array ? "FAIL" : "PASS");
1418 and a bunch of the security failures listed in
1419 https://bugs.webkit.org/show_bug.cgi?id=18870. (Those tests still fail,
1420 seemingly because of regressions in exception messages).
1422 SunSpider reports no change.
1424 * VM/Machine.cpp: Factored out scope chain updating into a common
1425 function that takes care to update ExecState::m_scopeChain, too.
1427 * kjs/ExecState.h: I made Machine a friend of ExecState so that Machine
1428 could update ExecState::m_scopeChain, even though that value is
1429 read-only for everyone else.
1431 * kjs/JSGlobalObject.h:
1432 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Changed
1433 this client to be a little friendlier to ExecState's internal
1434 storage type for scope chain data.
1436 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1438 Reviewed by Sam Weinig.
1440 Fixed https://bugs.webkit.org/show_bug.cgi?id=18876
1441 Squirrelfish: ScopeChainNode leak in op_jmp_scopes.
1443 SunSpider reports no change.
1446 (KJS::Machine::privateExecute): Don't construct a ScopeChain object,
1447 since the direct threaded interpreter will goto across its destructor.
1449 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1451 Reviewed by Oliver Hunt.
1453 A bit more efficient fix than r32832: Don't copy globals into function
1454 register files; instead, have the RegisterFileStack track only the base
1455 of the last *global* register file, so the global object's register
1456 references stay good.
1458 SunSpider reports a .3% speedup. Not sure what that's about.
1460 2008-05-03 Oliver Hunt <oliver@apple.com>
1464 Bug 18864: SquirrelFish: Support getter and setter definition in object literals
1465 <https://bugs.webkit.org/show_bug.cgi?id=18864>
1467 Add new opcodes to allow us to add getters and setters to an object. These are
1468 only used by the codegen for object literals.
1470 * VM/CodeGenerator.cpp:
1471 (KJS::CodeGenerator::emitPutGetter):
1472 (KJS::CodeGenerator::emitPutSetter):
1473 * VM/CodeGenerator.h:
1475 (KJS::Machine::privateExecute):
1478 (KJS::PropertyListNode::emitCode):
1480 2008-05-02 Maciej Stachowiak <mjs@apple.com>
1484 - properly copy globals into and out of implicit call register
1485 files, otherwise they will fail at global lookup
1487 Fixes fast/js/array-tostring-and-join.html layout test.
1489 * VM/RegisterFileStack.cpp:
1490 (KJS::RegisterFileStack::pushGlobalRegisterFile):
1491 (KJS::RegisterFileStack::popGlobalRegisterFile):
1492 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1493 (KJS::RegisterFileStack::popFunctionRegisterFile):
1495 2008-05-02 Geoffrey Garen <ggaren@apple.com>
1497 Reviewed by Oliver Hunt.
1499 Fixed https://bugs.webkit.org/show_bug.cgi?id=18822
1500 SQUIRRELFISH: incorrect eval used in some cases
1502 Changed all code inside the machine to fetch the lexical global object
1503 directly from the scope chain, instead of from the ExecState.
1505 Clients who fetch the lexical global object through the ExecState
1508 SunSpider reports no change.
1511 (KJS::Machine::privateExecute): Fetch the lexical global object from
1515 (KJS::ExecState::ExecState::lexicalGlobalObject): Moved the logic for
1516 this function into ScopeChainNode, but kept this function around to
1517 support existing clients.
1519 2008-05-02 Geoffrey Garen <ggaren@apple.com>
1521 Rubber stamped by Oliver Hunt.
1523 Removed ExecState.cpp from AllInOneFile.cpp, for a .2% speedup.
1525 * JavaScriptCore.xcodeproj/project.pbxproj:
1526 * kjs/AllInOneFile.cpp:
1528 2008-05-01 Oliver Hunt <oliver@apple.com>
1530 Reviewed by Geoff and Maciej.
1532 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
1533 <https://bugs.webkit.org/show_bug.cgi?id=18827>
1535 Remove safe/unsafe RegisterFile concept, and instead just add additional
1536 logic to ensure we always push/pop RegisterFiles when executing getters
1537 and setters, similar to the logic for valueOf and toString.
1540 (KJS::Machine::privateExecute):
1541 * VM/RegisterFile.h:
1543 (KJS::FunctionImp::callAsFunction):
1545 (KJS::JSObject::put):
1546 * kjs/property_slot.cpp:
1547 (KJS::PropertySlot::functionGetter):
1549 2008-05-01 Oliver Hunt <oliver@apple.com>
1553 Rename unsafeForReentry to safeForReentry to avoid double negatives.
1556 (KJS::Machine::privateExecute):
1557 * VM/RegisterFile.h:
1559 (KJS::FunctionImp::callAsFunction):
1561 2008-05-01 Oliver Hunt <oliver@apple.com>
1565 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
1566 <https://bugs.webkit.org/show_bug.cgi?id=18827>
1568 This patch makes getters and setters work. It does this by
1569 tracking whether the RegisterFile is "safe", that is whether
1570 the interpreter is in a state that in which it can handle
1571 the RegisterFile being reallocated.
1575 (KJS::Machine::privateExecute):
1576 * VM/RegisterFile.h:
1578 (KJS::FunctionImp::callAsFunction):
1580 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1582 Release build fix: Always compile in "isGlobalObject", since it's
1583 listed in our .exp file.
1585 * kjs/ExecState.cpp:
1586 (KJS::ExecState::isGlobalObject):
1589 2008-04-30 Oliver Hunt <oliver@apple.com>
1593 Minor code restructuring to prepare for getters and setters,
1594 also helps exception semantics a bit.
1597 (KJS::Machine::privateExecute):
1599 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1605 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1607 Debug build fix: export a missing symbol.
1609 * JavaScriptCore.exp:
1611 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1613 Reviewed by Oliver Hunt.
1615 A little more ExecState refactoring: Now, only the global object creates
1618 Also inlined ExecState::lexicalGlobalObject().
1620 SunSpider reports no change.
1622 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1624 WebCore build fix: forward-declare ScopeChain.
1626 * kjs/interpreter.h:
1628 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1630 Build fix for JavaScriptGlue: export a missing symbol.
1632 * JavaScriptCore.exp:
1634 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1636 Reviewed by Oliver Hunt.
1638 Removed a lot of unused bits from ExecState, moving them into
1639 OldInterpreterExecState, the fake scaffolding class.
1641 The clutter was making it hard to see the forest from the trees.
1643 .4% SunSpider speedup, probably because ExecState::lexicalGlobalObject()
1646 2008-04-29 Oliver Hunt <oliver@apple.com>
1650 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
1651 <https://bugs.webkit.org/show_bug.cgi?id=18643>
1653 Prevent static slot optimisation for new variables and functions in
1654 globally re-entrant code called from an an implicit function call.
1656 This is necessary to prevent us from needing to resize the global
1657 slot portion of the root RegisterFile during an implicit (and hence
1658 unguarded) function call.
1660 * VM/CodeGenerator.cpp:
1661 (KJS::CodeGenerator::CodeGenerator):
1662 * VM/CodeGenerator.h:
1664 (KJS::Machine::execute):
1665 * VM/RegisterFile.h:
1666 * VM/RegisterFileStack.cpp:
1667 (KJS::RegisterFileStack::pushGlobalRegisterFile):
1668 (KJS::RegisterFileStack::popGlobalRegisterFile):
1669 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1670 (KJS::RegisterFileStack::popFunctionRegisterFile):
1671 * VM/RegisterFileStack.h:
1672 (KJS::RegisterFileStack::inImplicitFunctionCall):
1673 (KJS::RegisterFileStack::lastGlobal):
1675 (KJS::ProgramNode::generateCode):
1677 (KJS::ProgramNode::):
1679 2008-04-29 Geoffrey Garen <ggaren@apple.com>
1681 Reviewed by Oliver Hunt.
1683 In nested program code, don't propogate "this" back to the parent
1684 register file. ("this" should remain constant in the parent register
1685 file, regardless of the scripts it invokes.)
1687 * VM/RegisterFile.cpp:
1688 (KJS::RegisterFile::copyGlobals):
1690 2008-04-28 Oliver Hunt <oliver@apple.com>
1694 Restore base pointer when popping a global RegisterFile
1696 * VM/RegisterFileStack.cpp:
1697 (KJS::RegisterFileStack::popGlobalRegisterFile):
1699 2008-04-28 Oliver Hunt <oliver@apple.com>
1703 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
1704 <https://bugs.webkit.org/show_bug.cgi?id=18643>
1706 Partial fix. This results in all implicit calls to toString or valueOf
1707 executing in a separate RegisterFile, so ensuring that the the pointers
1708 in the triggering interpreter don't get trashed. This still leaves the
1709 task of preventing new global re-entry from toString and valueOf from
1710 clobbering the RegisterFile.
1713 (KJS::Machine::execute):
1714 * VM/RegisterFileStack.cpp:
1715 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1716 (KJS::RegisterFileStack::popFunctionRegisterFile):
1717 * VM/RegisterFileStack.h:
1719 (KJS::tryGetAndCallProperty):
1721 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1723 Reviewed by Maciej Stachowiak.
1725 Simplified activation object a bit: No need to store the callee
1726 in the activation object -- we can pull it out of the call frame
1727 when needed, instead.
1729 SunSpider reports no change.
1731 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1733 Reviewed by Maciej Stachowiak.
1735 RS by Oliver Hunt on moving JSArguments.cpp out of AllInOneFile.cpp.
1737 Substantially more handling of "arguments": "arguments" works fully
1738 now, but "f.arguments" still doesn't work.
1740 Fixes 10 regression tests.
1742 SunSpider reports no regression.
1744 * kjs/JSActivation.cpp:
1745 (KJS::JSActivation::createArgumentsObject): Reconstruct an arguments
1746 List to pass to the arguments object constructor.
1748 * JavaScriptCore.xcodeproj/project.pbxproj:
1749 * kjs/AllInOneFile.cpp: Removed JSActivation.cpp from AllInOneFile.cpp
1750 because that seems to make GCC happy. (Previously, I had added
1751 JSActivation.cpp to AllInOneFile.cpp because *that* seemed to make GCC
1754 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1756 Reviewed by Maciej Stachowiak.
1758 Groundwork for more handling of "arguments". I'm not checking in the
1759 actual handling of "arguments" yet, because it still needs a little
1760 fiddling to avoid a performance regression.
1762 SunSpider reports no change.
1765 (KJS::initializeCallFrame): Put argc in the register file, so the
1766 arguments object can find it later, to determine arguments.length.
1769 (KJS::FunctionBodyNode::): Added a special code accessor for when you
1770 know the code has already been generated, and you don't have a scopeChain
1771 to supply for potential code generation. (This is the case when the
1772 activation object creates the arguments object.)
1774 2008-04-28 Oliver Hunt <oliver@apple.com>
1778 Replace unsafe use of auto_ptr in Vector with manual memory
1781 * VM/RegisterFileStack.cpp:
1782 (KJS::RegisterFileStack::~RegisterFileStack):
1783 (KJS::RegisterFileStack::popRegisterFile):
1784 * VM/RegisterFileStack.h:
1786 2008-04-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1790 Bug 18746: SQUIRRELFISH: indirect eval used when direct eval should be used
1791 <https://bugs.webkit.org/show_bug.cgi?id=18746>
1793 Change the base to the correct value of the 'this' object after the direct
1794 eval test instead of before.
1796 Fixes 5 layout tests.
1799 (KJS::Machine::privateExecute):
1801 (KJS::EvalFunctionCallNode::emitCode):
1803 2008-04-26 Maciej Stachowiak <mjs@apple.com>
1807 - document all property getting, setting and deleting opcodes
1809 (And fix function parameter names to match corresponding opcode parameter names.)
1811 * VM/CodeGenerator.cpp:
1812 (KJS::CodeGenerator::emitResolve):
1813 (KJS::CodeGenerator::emitResolveBase):
1814 (KJS::CodeGenerator::emitResolveBaseAndProperty):
1815 (KJS::CodeGenerator::emitResolveBaseAndFunc):
1816 (KJS::CodeGenerator::emitGetPropId):
1817 (KJS::CodeGenerator::emitPutPropId):
1818 (KJS::CodeGenerator::emitDeletePropId):
1819 (KJS::CodeGenerator::emitPutPropVal):
1820 * VM/CodeGenerator.h:
1824 (KJS::resolveBaseAndProperty):
1825 (KJS::resolveBaseAndFunc):
1826 (KJS::Machine::privateExecute):
1828 (KJS::ResolveNode::emitCode):
1829 (KJS::ArrayNode::emitCode):
1830 (KJS::PropertyListNode::emitCode):
1831 (KJS::BracketAccessorNode::emitCode):
1832 (KJS::EvalFunctionCallNode::emitCode):
1833 (KJS::FunctionCallResolveNode::emitCode):
1834 (KJS::FunctionCallBracketNode::emitCode):
1835 (KJS::PostIncResolveNode::emitCode):
1836 (KJS::PostDecResolveNode::emitCode):
1837 (KJS::PostIncBracketNode::emitCode):
1838 (KJS::PostDecBracketNode::emitCode):
1839 (KJS::PostIncDotNode::emitCode):
1840 (KJS::PostDecDotNode::emitCode):
1841 (KJS::DeleteResolveNode::emitCode):
1842 (KJS::TypeOfResolveNode::emitCode):
1843 (KJS::PreIncResolveNode::emitCode):
1844 (KJS::PreDecResolveNode::emitCode):
1845 (KJS::PreIncBracketNode::emitCode):
1846 (KJS::PreDecBracketNode::emitCode):
1847 (KJS::AssignResolveNode::emitCode):
1848 (KJS::AssignDotNode::emitCode):
1849 (KJS::ReadModifyDotNode::emitCode):
1850 (KJS::AssignBracketNode::emitCode):
1851 (KJS::ReadModifyBracketNode::emitCode):
1852 (KJS::ConstDeclNode::emitCodeSingle):
1854 2008-04-26 Oliver Hunt <oliver@apple.com>
1858 Bug 18628: SQUIRRELFISH: need to support recursion limit
1859 <https://bugs.webkit.org/show_bug.cgi?id=18628>
1861 Basically completes recursion limiting. There is still some
1862 tuning we may want to do to make things better in the face of
1863 very bad code, but certainly nothing worse than anything already
1866 Also fixes a WebKit test by fixing the exception text :D
1868 * JavaScriptCore.exp:
1869 * VM/ExceptionHelpers.cpp:
1871 (KJS::Machine::execute):
1872 * VM/RegisterFile.cpp:
1873 (KJS::RegisterFile::growBuffer):
1874 (KJS::RegisterFile::addGlobalSlots):
1875 * VM/RegisterFile.h:
1876 (KJS::RegisterFile::grow):
1877 (KJS::RegisterFile::uncheckedGrow):
1878 * VM/RegisterFileStack.cpp:
1879 (KJS::RegisterFileStack::pushRegisterFile):
1880 * VM/RegisterFileStack.h:
1882 2008-04-25 Oliver Hunt <oliver@apple.com>
1886 Bug 18628: SQUIRRELFISH: need to support recursion limit
1887 <https://bugs.webkit.org/show_bug.cgi?id=18628>
1889 Put a limit on the level of reentry recursion. 128 levels of re-entrant recursion
1890 seems reasonable as it is greater than the old eval limit, and a long way short of
1891 the reentry depth needed to overflow the stack.
1894 (KJS::Machine::execute):
1897 2008-04-25 Geoffrey Garen <ggaren@apple.com>
1899 Reviewed by Sam Weinig.
1901 A tiny bit of cleanup to the regexp code.
1903 Removed some static_cast.
1905 Removed createRegExpImp because it's no longer used.
1907 2008-04-25 Oliver Hunt <oliver@apple.com>
1911 Bug 18736: SQUIRRELFISH: switch statements with no default have incorrect codegen
1912 <https://bugs.webkit.org/show_bug.cgi?id=18736>
1914 Ensure the "default" target is correct in the absence of an explicit default handler.
1917 (KJS::CaseBlockNode::emitCodeForBlock):
1919 2008-04-25 Oliver Hunt <oliver@apple.com>
1923 Bug 18628: SQUIRRELFISH: need to support recursion limit
1924 <https://bugs.webkit.org/show_bug.cgi?id=18628>
1926 More bounds checking.
1929 (KJS::Machine::execute):
1930 * VM/RegisterFile.cpp:
1931 (KJS::RegisterFile::growBuffer):
1932 * VM/RegisterFile.h:
1934 2008-04-25 Maciej Stachowiak <mjs@apple.com>
1938 - fix signal catching magic
1940 The signal handlers are restored to _exit but are only set when
1941 running under run-javascriptcore-tests. fprintf from a signal
1942 handler is not safe.
1947 * tests/mozilla/jsDriver.pl:
1949 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1953 Bug 18732: SQUIRRELFISH: exceptions thrown by native constructors are ignored
1954 <https://bugs.webkit.org/show_bug.cgi?id=18732>
1956 Fixes another regression test.
1959 (KJS::Machine::privateExecute):
1961 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1965 Bug 18728: SQUIRRELFISH: invalid regular expression constants should throw exceptions
1966 <https://bugs.webkit.org/show_bug.cgi?id=18728>
1968 Fixes another regression test.
1971 (KJS::RegExpNode::emitCode):
1973 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1975 Reviewed by Geoffrey Garen.
1977 Bug 18735: SQUIRRELFISH: closures are sometimes given an incorrect 'this' value when called
1978 <https://bugs.webkit.org/show_bug.cgi?id=18735>
1980 The overloaded toThisObject method was not copied over to JSActivation.
1982 Fixes two regression tests.
1984 * kjs/JSActivation.cpp:
1985 (KJS::JSActivation::toThisObject):
1986 * kjs/JSActivation.h:
1988 2008-04-24 Geoffrey Garen <ggaren@apple.com>
1990 Reviewed by Oliver Hunt.
1992 Added support for arguments.callee.
1994 2008-04-24 Oliver Hunt <oliver@apple.com>
1998 Bug 18628: SQUIRRELFISH: need to support recursion limit
1999 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2001 Partial fix -- this gets us some of the required bounds checking, but not
2002 complete coverage. But it does manage to do them without regressing :D
2004 * VM/ExceptionHelpers.cpp:
2006 (KJS::createStackOverflowError):
2007 * VM/ExceptionHelpers.h:
2009 (KJS::slideRegisterWindowForCall):
2010 (KJS::Machine::execute):
2011 (KJS::Machine::privateExecute):
2012 * VM/RegisterFile.cpp:
2013 * VM/RegisterFile.h:
2014 (KJS::RegisterFile::):
2015 (KJS::RegisterFile::RegisterFile):
2016 (KJS::RegisterFile::grow):
2018 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2020 Reviewed by Oliver Hunt.
2022 A tiny bit more handling of "arguments": create a real, but mostly
2023 hollow, arguments object.
2025 Fixes 2 regression tests.
2027 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2031 Bug 18717: SQUIRRELFISH: eval returns the wrong value for a variable declaration statement
2032 <https://bugs.webkit.org/show_bug.cgi?id=18717>
2034 Fixes a regression test, but exposes the failure of another due to the
2035 lack of getters and setters.
2038 (KJS::ConstDeclNode::emitCodeSingle):
2039 (KJS::ConstDeclNode::emitCode):
2040 (KJS::ConstStatementNode::emitCode):
2041 (KJS::VarStatementNode::emitCode):
2044 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2046 Reviewed by Sam Weinig.
2048 Print a CRASH statement when crashing, so test failures are not a
2055 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2057 Reviewed by Geoffrey Garen.
2059 Bug 18716: SQUIRRELFISH: typeof should return undefined for an undefined variable reference
2060 <https://bugs.webkit.org/show_bug.cgi?id=18716>
2062 This fixes 2 more regression tests.
2065 (KJS::TypeOfResolveNode::emitCode):
2067 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2069 Reviewed by Sam Weinig.
2071 Put the callee in the call frame.
2073 Necessary in order to support "arguments" and "arguments.callee".
2075 Also fixes a latent GC bug, where an executing function could be
2076 subject to GC if the register holding it were overwritten. Here's
2077 an example that would have caused problems:
2081 // Flood the machine stack to eliminate any old pointers to f.
2084 // Overwrite f in the register file.
2088 for (var i = 0; i < 5000; ++i) {
2092 // Welcome to crash-ville.
2101 * VM/Machine.h: Changed the order of arguments to
2102 execute(FunctionBodyNode*...) to match the other execute functions.
2103 * kjs/function.cpp: Updated to match new argument requirements from
2104 execute(FunctionBodyNode*...). Renamed newObj to thisObj to match the
2105 rest of JavaScriptCore.
2107 SunSpider reports no change.
2109 2008-04-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2113 Bug 18707: SQUIRRELFISH: eval always performs toString() on its argument
2114 <https://bugs.webkit.org/show_bug.cgi?id=18707>
2116 This fixes 4 more regression tests.
2121 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2125 - fix logic bug in SegmentedVector::grow which would sometimes fail to resize a segment when needed
2129 * VM/SegmentedVector.h:
2130 (KJS::SegmentedVector::grow):
2132 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2134 Reviewed by Maciej Stachowiak.
2136 Degenerate handling of "arguments" as a property of the activation
2137 object. Currently, we just return a vanilla object.
2139 SunSpider reports no change.
2143 ecma_3/Function/regress-94506.js.
2145 Reveals to have been secretly broken:
2147 ecma_3/Function/15.3.4.3-1.js
2148 ecma_3/Function/15.3.4.4-1.js
2150 These tests were passing incorrectly. testkjs creates a global array
2151 named "arguments" to hold command-line arguments. That array was
2152 tricking these tests into thinking that an arguments object with length
2153 0 had been created. Since our new vanilla object shadows the global
2154 property named arguments, that object no longer fools these tests into
2157 Net change: +1 failing test.
2159 * kjs/AllInOneFile.cpp: Had to put JSActivation.cpp into AllInOneFile.cpp
2160 to solve a surprising 8.6% regression in bitops-3bit-bits-in-byte.
2162 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2166 - save and restore callFrame
2169 (KJS::slideRegisterWindowForCall):
2170 (KJS::Machine::execute):
2171 (KJS::Machine::privateExecute):
2175 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2177 Reviewed by Maciej Stachowiak.
2179 Fixed scopes for named function expressions.
2181 Fixes one regression test.
2185 (1) The function's name is supposed to have attributes DontDelete,
2186 ReadOnly, regardless of the type of code executing.
2188 (2) Push the name object on the function's scope chain, rather than
2189 the ExecState's scope chain because, well, that's where it belongs.
2191 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2193 Reviewed by Oliver Hunt.
2195 Inlined JSObject::putDirect, for a .4% SunSpider speedup.
2197 I did this as a first step toward removing nodes.cpp from
2198 AllInOneFile.cpp, but I'm putting that larger project aside for now.
2200 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2202 Rubber stamped by Geoff.
2204 - add OldInterpreterExecState class and use it in dead code
2206 This will allow removing things from the real ExecState class
2207 without having to figure out how to remove all this code without
2208 getting a perf regression.
2211 (KJS::ExpressionNode::evaluateToNumber):
2212 (KJS::ExpressionNode::evaluateToBoolean):
2213 (KJS::ExpressionNode::evaluateToInt32):
2214 (KJS::ExpressionNode::evaluateToUInt32):
2215 (KJS::Node::setErrorCompletion):
2216 (KJS::Node::throwError):
2217 (KJS::Node::throwUndefinedVariableError):
2218 (KJS::Node::handleException):
2219 (KJS::Node::rethrowException):
2220 (KJS::BreakpointCheckStatement::execute):
2221 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
2222 (KJS::NullNode::evaluate):
2223 (KJS::FalseNode::evaluate):
2224 (KJS::TrueNode::evaluate):
2225 (KJS::NumberNode::evaluate):
2226 (KJS::NumberNode::evaluateToNumber):
2227 (KJS::NumberNode::evaluateToBoolean):
2228 (KJS::NumberNode::evaluateToInt32):
2229 (KJS::NumberNode::evaluateToUInt32):
2230 (KJS::ImmediateNumberNode::evaluate):
2231 (KJS::ImmediateNumberNode::evaluateToInt32):
2232 (KJS::ImmediateNumberNode::evaluateToUInt32):
2233 (KJS::StringNode::evaluate):
2234 (KJS::StringNode::evaluateToNumber):
2235 (KJS::StringNode::evaluateToBoolean):
2236 (KJS::RegExpNode::evaluate):
2237 (KJS::ThisNode::evaluate):
2238 (KJS::ResolveNode::inlineEvaluate):
2239 (KJS::ResolveNode::evaluate):
2240 (KJS::ResolveNode::evaluateToNumber):
2241 (KJS::ResolveNode::evaluateToBoolean):
2242 (KJS::ResolveNode::evaluateToInt32):
2243 (KJS::ResolveNode::evaluateToUInt32):
2244 (KJS::getSymbolTableEntry):
2245 (KJS::ResolveNode::optimizeVariableAccess):
2246 (KJS::LocalVarAccessNode::inlineEvaluate):
2247 (KJS::LocalVarAccessNode::evaluate):
2248 (KJS::LocalVarAccessNode::evaluateToNumber):
2249 (KJS::LocalVarAccessNode::evaluateToBoolean):
2250 (KJS::LocalVarAccessNode::evaluateToInt32):
2251 (KJS::LocalVarAccessNode::evaluateToUInt32):
2252 (KJS::getNonLocalSymbol):
2253 (KJS::ScopedVarAccessNode::inlineEvaluate):
2254 (KJS::ScopedVarAccessNode::evaluate):
2255 (KJS::ScopedVarAccessNode::evaluateToNumber):
2256 (KJS::ScopedVarAccessNode::evaluateToBoolean):
2257 (KJS::ScopedVarAccessNode::evaluateToInt32):
2258 (KJS::ScopedVarAccessNode::evaluateToUInt32):
2259 (KJS::NonLocalVarAccessNode::inlineEvaluate):
2260 (KJS::NonLocalVarAccessNode::evaluate):
2261 (KJS::NonLocalVarAccessNode::evaluateToNumber):
2262 (KJS::NonLocalVarAccessNode::evaluateToBoolean):
2263 (KJS::NonLocalVarAccessNode::evaluateToInt32):
2264 (KJS::NonLocalVarAccessNode::evaluateToUInt32):
2265 (KJS::ElementNode::optimizeVariableAccess):
2266 (KJS::ElementNode::evaluate):
2267 (KJS::ArrayNode::optimizeVariableAccess):
2268 (KJS::ArrayNode::evaluate):
2269 (KJS::ObjectLiteralNode::optimizeVariableAccess):
2270 (KJS::ObjectLiteralNode::evaluate):
2271 (KJS::PropertyListNode::optimizeVariableAccess):
2272 (KJS::PropertyListNode::evaluate):
2273 (KJS::PropertyNode::optimizeVariableAccess):
2274 (KJS::PropertyNode::evaluate):
2275 (KJS::BracketAccessorNode::optimizeVariableAccess):
2276 (KJS::BracketAccessorNode::inlineEvaluate):
2277 (KJS::BracketAccessorNode::evaluate):
2278 (KJS::BracketAccessorNode::evaluateToNumber):
2279 (KJS::BracketAccessorNode::evaluateToBoolean):
2280 (KJS::BracketAccessorNode::evaluateToInt32):
2281 (KJS::BracketAccessorNode::evaluateToUInt32):
2282 (KJS::DotAccessorNode::optimizeVariableAccess):
2283 (KJS::DotAccessorNode::inlineEvaluate):
2284 (KJS::DotAccessorNode::evaluate):
2285 (KJS::DotAccessorNode::evaluateToNumber):
2286 (KJS::DotAccessorNode::evaluateToBoolean):
2287 (KJS::DotAccessorNode::evaluateToInt32):
2288 (KJS::DotAccessorNode::evaluateToUInt32):
2289 (KJS::ArgumentListNode::optimizeVariableAccess):
2290 (KJS::ArgumentListNode::evaluateList):
2291 (KJS::ArgumentsNode::optimizeVariableAccess):
2292 (KJS::NewExprNode::optimizeVariableAccess):
2293 (KJS::NewExprNode::inlineEvaluate):
2294 (KJS::NewExprNode::evaluate):
2295 (KJS::NewExprNode::evaluateToNumber):
2296 (KJS::NewExprNode::evaluateToBoolean):
2297 (KJS::NewExprNode::evaluateToInt32):
2298 (KJS::NewExprNode::evaluateToUInt32):
2299 (KJS::ExpressionNode::resolveAndCall):
2300 (KJS::EvalFunctionCallNode::optimizeVariableAccess):
2301 (KJS::EvalFunctionCallNode::evaluate):
2302 (KJS::FunctionCallValueNode::optimizeVariableAccess):
2303 (KJS::FunctionCallValueNode::evaluate):
2304 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
2305 (KJS::FunctionCallResolveNode::inlineEvaluate):
2306 (KJS::FunctionCallResolveNode::evaluate):
2307 (KJS::FunctionCallResolveNode::evaluateToNumber):
2308 (KJS::FunctionCallResolveNode::evaluateToBoolean):
2309 (KJS::FunctionCallResolveNode::evaluateToInt32):
2310 (KJS::FunctionCallResolveNode::evaluateToUInt32):
2311 (KJS::LocalVarFunctionCallNode::inlineEvaluate):
2312 (KJS::LocalVarFunctionCallNode::evaluate):
2313 (KJS::LocalVarFunctionCallNode::evaluateToNumber):
2314 (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
2315 (KJS::LocalVarFunctionCallNode::evaluateToInt32):
2316 (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
2317 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
2318 (KJS::ScopedVarFunctionCallNode::evaluate):
2319 (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
2320 (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
2321 (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
2322 (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
2323 (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
2324 (KJS::NonLocalVarFunctionCallNode::evaluate):
2325 (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
2326 (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
2327 (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
2328 (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
2329 (KJS::FunctionCallBracketNode::optimizeVariableAccess):
2330 (KJS::FunctionCallBracketNode::evaluate):
2331 (KJS::FunctionCallDotNode::optimizeVariableAccess):
2332 (KJS::FunctionCallDotNode::inlineEvaluate):
2333 (KJS::FunctionCallDotNode::evaluate):
2334 (KJS::FunctionCallDotNode::evaluateToNumber):
2335 (KJS::FunctionCallDotNode::evaluateToBoolean):
2336 (KJS::FunctionCallDotNode::evaluateToInt32):
2337 (KJS::FunctionCallDotNode::evaluateToUInt32):
2338 (KJS::PostIncResolveNode::optimizeVariableAccess):
2339 (KJS::PostIncResolveNode::evaluate):
2340 (KJS::PostIncLocalVarNode::evaluate):
2341 (KJS::PostDecResolveNode::optimizeVariableAccess):
2342 (KJS::PostDecResolveNode::evaluate):
2343 (KJS::PostDecLocalVarNode::evaluate):
2344 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
2345 (KJS::PostDecLocalVarNode::evaluateToNumber):
2346 (KJS::PostDecLocalVarNode::evaluateToBoolean):
2347 (KJS::PostDecLocalVarNode::evaluateToInt32):
2348 (KJS::PostDecLocalVarNode::evaluateToUInt32):
2349 (KJS::PostfixBracketNode::optimizeVariableAccess):
2350 (KJS::PostIncBracketNode::evaluate):
2351 (KJS::PostDecBracketNode::evaluate):
2352 (KJS::PostfixDotNode::optimizeVariableAccess):
2353 (KJS::PostIncDotNode::evaluate):
2354 (KJS::PostDecDotNode::evaluate):
2355 (KJS::PostfixErrorNode::evaluate):
2356 (KJS::DeleteResolveNode::optimizeVariableAccess):
2357 (KJS::DeleteResolveNode::evaluate):
2358 (KJS::LocalVarDeleteNode::evaluate):
2359 (KJS::DeleteBracketNode::optimizeVariableAccess):
2360 (KJS::DeleteBracketNode::evaluate):
2361 (KJS::DeleteDotNode::optimizeVariableAccess):
2362 (KJS::DeleteDotNode::evaluate):
2363 (KJS::DeleteValueNode::optimizeVariableAccess):
2364 (KJS::DeleteValueNode::evaluate):
2365 (KJS::VoidNode::optimizeVariableAccess):
2366 (KJS::VoidNode::evaluate):
2367 (KJS::TypeOfValueNode::optimizeVariableAccess):
2368 (KJS::TypeOfResolveNode::optimizeVariableAccess):
2369 (KJS::LocalVarTypeOfNode::evaluate):
2370 (KJS::TypeOfResolveNode::evaluate):
2371 (KJS::TypeOfValueNode::evaluate):
2372 (KJS::PreIncResolveNode::optimizeVariableAccess):
2373 (KJS::PreIncLocalVarNode::evaluate):
2374 (KJS::PreIncResolveNode::evaluate):
2375 (KJS::PreDecResolveNode::optimizeVariableAccess):
2376 (KJS::PreDecLocalVarNode::evaluate):
2377 (KJS::PreDecResolveNode::evaluate):
2378 (KJS::PreIncConstNode::evaluate):
2379 (KJS::PreDecConstNode::evaluate):
2380 (KJS::PostIncConstNode::evaluate):
2381 (KJS::PostDecConstNode::evaluate):
2382 (KJS::PrefixBracketNode::optimizeVariableAccess):
2383 (KJS::PreIncBracketNode::evaluate):
2384 (KJS::PreDecBracketNode::evaluate):
2385 (KJS::PrefixDotNode::optimizeVariableAccess):
2386 (KJS::PreIncDotNode::evaluate):
2387 (KJS::PreDecDotNode::evaluate):
2388 (KJS::PrefixErrorNode::evaluate):
2389 (KJS::UnaryPlusNode::optimizeVariableAccess):
2390 (KJS::UnaryPlusNode::evaluate):
2391 (KJS::UnaryPlusNode::evaluateToBoolean):
2392 (KJS::UnaryPlusNode::evaluateToNumber):
2393 (KJS::UnaryPlusNode::evaluateToInt32):
2394 (KJS::UnaryPlusNode::evaluateToUInt32):
2395 (KJS::NegateNode::optimizeVariableAccess):
2396 (KJS::NegateNode::evaluate):
2397 (KJS::NegateNode::evaluateToNumber):
2398 (KJS::BitwiseNotNode::optimizeVariableAccess):
2399 (KJS::BitwiseNotNode::inlineEvaluateToInt32):
2400 (KJS::BitwiseNotNode::evaluate):
2401 (KJS::BitwiseNotNode::evaluateToNumber):
2402 (KJS::BitwiseNotNode::evaluateToBoolean):
2403 (KJS::BitwiseNotNode::evaluateToInt32):
2404 (KJS::BitwiseNotNode::evaluateToUInt32):
2405 (KJS::LogicalNotNode::optimizeVariableAccess):
2406 (KJS::LogicalNotNode::evaluate):
2407 (KJS::LogicalNotNode::evaluateToBoolean):
2408 (KJS::MultNode::optimizeVariableAccess):
2409 (KJS::MultNode::inlineEvaluateToNumber):
2410 (KJS::MultNode::evaluate):
2411 (KJS::MultNode::evaluateToNumber):
2412 (KJS::MultNode::evaluateToBoolean):
2413 (KJS::MultNode::evaluateToInt32):
2414 (KJS::MultNode::evaluateToUInt32):
2415 (KJS::DivNode::optimizeVariableAccess):
2416 (KJS::DivNode::inlineEvaluateToNumber):
2417 (KJS::DivNode::evaluate):
2418 (KJS::DivNode::evaluateToNumber):
2419 (KJS::DivNode::evaluateToInt32):
2420 (KJS::DivNode::evaluateToUInt32):
2421 (KJS::ModNode::optimizeVariableAccess):
2422 (KJS::ModNode::inlineEvaluateToNumber):
2423 (KJS::ModNode::evaluate):
2424 (KJS::ModNode::evaluateToNumber):
2425 (KJS::ModNode::evaluateToBoolean):
2426 (KJS::ModNode::evaluateToInt32):
2427 (KJS::ModNode::evaluateToUInt32):
2428 (KJS::throwOutOfMemoryErrorToNumber):
2430 (KJS::addSlowCaseToNumber):
2433 (KJS::AddNode::optimizeVariableAccess):
2434 (KJS::AddNode::evaluate):
2435 (KJS::AddNode::inlineEvaluateToNumber):
2436 (KJS::AddNode::evaluateToNumber):
2437 (KJS::AddNode::evaluateToInt32):
2438 (KJS::AddNode::evaluateToUInt32):
2439 (KJS::AddNumbersNode::inlineEvaluateToNumber):
2440 (KJS::AddNumbersNode::evaluate):
2441 (KJS::AddNumbersNode::evaluateToNumber):
2442 (KJS::AddNumbersNode::evaluateToInt32):
2443 (KJS::AddNumbersNode::evaluateToUInt32):
2444 (KJS::AddStringsNode::evaluate):
2445 (KJS::AddStringLeftNode::evaluate):
2446 (KJS::AddStringRightNode::evaluate):
2447 (KJS::SubNode::optimizeVariableAccess):
2448 (KJS::SubNode::inlineEvaluateToNumber):
2449 (KJS::SubNode::evaluate):
2450 (KJS::SubNode::evaluateToNumber):
2451 (KJS::SubNode::evaluateToInt32):
2452 (KJS::SubNode::evaluateToUInt32):
2453 (KJS::LeftShiftNode::optimizeVariableAccess):
2454 (KJS::LeftShiftNode::inlineEvaluateToInt32):
2455 (KJS::LeftShiftNode::evaluate):
2456 (KJS::LeftShiftNode::evaluateToNumber):
2457 (KJS::LeftShiftNode::evaluateToInt32):
2458 (KJS::LeftShiftNode::evaluateToUInt32):
2459 (KJS::RightShiftNode::optimizeVariableAccess):
2460 (KJS::RightShiftNode::inlineEvaluateToInt32):
2461 (KJS::RightShiftNode::evaluate):
2462 (KJS::RightShiftNode::evaluateToNumber):
2463 (KJS::RightShiftNode::evaluateToInt32):
2464 (KJS::RightShiftNode::evaluateToUInt32):
2465 (KJS::UnsignedRightShiftNode::optimizeVariableAccess):
2466 (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
2467 (KJS::UnsignedRightShiftNode::evaluate):
2468 (KJS::UnsignedRightShiftNode::evaluateToNumber):
2469 (KJS::UnsignedRightShiftNode::evaluateToInt32):
2470 (KJS::UnsignedRightShiftNode::evaluateToUInt32):
2473 (KJS::LessNode::optimizeVariableAccess):
2474 (KJS::LessNode::inlineEvaluateToBoolean):
2475 (KJS::LessNode::evaluate):
2476 (KJS::LessNode::evaluateToBoolean):
2477 (KJS::LessNumbersNode::inlineEvaluateToBoolean):
2478 (KJS::LessNumbersNode::evaluate):
2479 (KJS::LessNumbersNode::evaluateToBoolean):
2480 (KJS::LessStringsNode::inlineEvaluateToBoolean):
2481 (KJS::LessStringsNode::evaluate):
2482 (KJS::LessStringsNode::evaluateToBoolean):
2483 (KJS::GreaterNode::optimizeVariableAccess):
2484 (KJS::GreaterNode::inlineEvaluateToBoolean):
2485 (KJS::GreaterNode::evaluate):
2486 (KJS::GreaterNode::evaluateToBoolean):
2487 (KJS::LessEqNode::optimizeVariableAccess):
2488 (KJS::LessEqNode::inlineEvaluateToBoolean):
2489 (KJS::LessEqNode::evaluate):
2490 (KJS::LessEqNode::evaluateToBoolean):
2491 (KJS::GreaterEqNode::optimizeVariableAccess):
2492 (KJS::GreaterEqNode::inlineEvaluateToBoolean):
2493 (KJS::GreaterEqNode::evaluate):
2494 (KJS::GreaterEqNode::evaluateToBoolean):
2495 (KJS::InstanceOfNode::optimizeVariableAccess):
2496 (KJS::InstanceOfNode::evaluate):
2497 (KJS::InstanceOfNode::evaluateToBoolean):
2498 (KJS::InNode::optimizeVariableAccess):
2499 (KJS::InNode::evaluate):
2500 (KJS::InNode::evaluateToBoolean):
2501 (KJS::EqualNode::optimizeVariableAccess):
2502 (KJS::EqualNode::inlineEvaluateToBoolean):
2503 (KJS::EqualNode::evaluate):
2504 (KJS::EqualNode::evaluateToBoolean):
2505 (KJS::NotEqualNode::optimizeVariableAccess):
2506 (KJS::NotEqualNode::inlineEvaluateToBoolean):
2507 (KJS::NotEqualNode::evaluate):
2508 (KJS::NotEqualNode::evaluateToBoolean):
2509 (KJS::StrictEqualNode::optimizeVariableAccess):
2510 (KJS::StrictEqualNode::inlineEvaluateToBoolean):
2511 (KJS::StrictEqualNode::evaluate):
2512 (KJS::StrictEqualNode::evaluateToBoolean):
2513 (KJS::NotStrictEqualNode::optimizeVariableAccess):
2514 (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
2515 (KJS::NotStrictEqualNode::evaluate):
2516 (KJS::NotStrictEqualNode::evaluateToBoolean):
2517 (KJS::BitAndNode::optimizeVariableAccess):
2518 (KJS::BitAndNode::evaluate):
2519 (KJS::BitAndNode::inlineEvaluateToInt32):
2520 (KJS::BitAndNode::evaluateToNumber):
2521 (KJS::BitAndNode::evaluateToBoolean):
2522 (KJS::BitAndNode::evaluateToInt32):
2523 (KJS::BitAndNode::evaluateToUInt32):
2524 (KJS::BitXOrNode::optimizeVariableAccess):
2525 (KJS::BitXOrNode::inlineEvaluateToInt32):
2526 (KJS::BitXOrNode::evaluate):
2527 (KJS::BitXOrNode::evaluateToNumber):
2528 (KJS::BitXOrNode::evaluateToBoolean):
2529 (KJS::BitXOrNode::evaluateToInt32):
2530 (KJS::BitXOrNode::evaluateToUInt32):
2531 (KJS::BitOrNode::optimizeVariableAccess):
2532 (KJS::BitOrNode::inlineEvaluateToInt32):
2533 (KJS::BitOrNode::evaluate):
2534 (KJS::BitOrNode::evaluateToNumber):
2535 (KJS::BitOrNode::evaluateToBoolean):
2536 (KJS::BitOrNode::evaluateToInt32):
2537 (KJS::BitOrNode::evaluateToUInt32):
2538 (KJS::LogicalAndNode::optimizeVariableAccess):
2539 (KJS::LogicalAndNode::evaluate):
2540 (KJS::LogicalAndNode::evaluateToBoolean):
2541 (KJS::LogicalOrNode::optimizeVariableAccess):
2542 (KJS::LogicalOrNode::evaluate):
2543 (KJS::LogicalOrNode::evaluateToBoolean):
2544 (KJS::ConditionalNode::optimizeVariableAccess):
2545 (KJS::ConditionalNode::evaluate):
2546 (KJS::ConditionalNode::evaluateToBoolean):
2547 (KJS::ConditionalNode::evaluateToNumber):
2548 (KJS::ConditionalNode::evaluateToInt32):
2549 (KJS::ConditionalNode::evaluateToUInt32):
2550 (KJS::valueForReadModifyAssignment):
2551 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
2552 (KJS::AssignResolveNode::optimizeVariableAccess):
2553 (KJS::ReadModifyLocalVarNode::evaluate):
2554 (KJS::AssignLocalVarNode::evaluate):
2555 (KJS::ReadModifyConstNode::evaluate):
2556 (KJS::AssignConstNode::evaluate):
2557 (KJS::ReadModifyResolveNode::evaluate):
2558 (KJS::AssignResolveNode::evaluate):
2559 (KJS::AssignDotNode::optimizeVariableAccess):
2560 (KJS::AssignDotNode::evaluate):
2561 (KJS::ReadModifyDotNode::optimizeVariableAccess):
2562 (KJS::ReadModifyDotNode::evaluate):
2563 (KJS::AssignErrorNode::evaluate):
2564 (KJS::AssignBracketNode::optimizeVariableAccess):
2565 (KJS::AssignBracketNode::evaluate):
2566 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
2567 (KJS::ReadModifyBracketNode::evaluate):
2568 (KJS::CommaNode::optimizeVariableAccess):
2569 (KJS::CommaNode::evaluate):
2570 (KJS::ConstDeclNode::optimizeVariableAccess):
2571 (KJS::ConstDeclNode::handleSlowCase):
2572 (KJS::ConstDeclNode::evaluateSingle):
2573 (KJS::ConstDeclNode::evaluate):
2574 (KJS::ConstStatementNode::optimizeVariableAccess):
2575 (KJS::ConstStatementNode::execute):
2576 (KJS::statementListExecute):
2577 (KJS::BlockNode::optimizeVariableAccess):
2578 (KJS::BlockNode::execute):
2579 (KJS::EmptyStatementNode::execute):
2580 (KJS::ExprStatementNode::optimizeVariableAccess):
2581 (KJS::ExprStatementNode::execute):
2582 (KJS::VarStatementNode::optimizeVariableAccess):
2583 (KJS::VarStatementNode::execute):
2584 (KJS::IfNode::optimizeVariableAccess):
2585 (KJS::IfNode::execute):
2586 (KJS::IfElseNode::optimizeVariableAccess):
2587 (KJS::IfElseNode::execute):
2588 (KJS::DoWhileNode::optimizeVariableAccess):
2589 (KJS::DoWhileNode::execute):
2590 (KJS::WhileNode::optimizeVariableAccess):
2591 (KJS::WhileNode::execute):
2592 (KJS::ForNode::optimizeVariableAccess):
2593 (KJS::ForNode::execute):
2594 (KJS::ForInNode::optimizeVariableAccess):
2595 (KJS::ForInNode::execute):
2596 (KJS::ContinueNode::execute):
2597 (KJS::BreakNode::execute):
2598 (KJS::ReturnNode::optimizeVariableAccess):
2599 (KJS::ReturnNode::execute):
2600 (KJS::WithNode::optimizeVariableAccess):
2601 (KJS::WithNode::execute):
2602 (KJS::CaseClauseNode::optimizeVariableAccess):
2603 (KJS::CaseClauseNode::evaluate):
2604 (KJS::CaseClauseNode::executeStatements):
2605 (KJS::ClauseListNode::optimizeVariableAccess):
2606 (KJS::CaseBlockNode::optimizeVariableAccess):
2607 (KJS::CaseBlockNode::executeBlock):
2608 (KJS::SwitchNode::optimizeVariableAccess):
2609 (KJS::SwitchNode::execute):
2610 (KJS::LabelNode::optimizeVariableAccess):
2611 (KJS::LabelNode::execute):
2612 (KJS::ThrowNode::optimizeVariableAccess):
2613 (KJS::ThrowNode::execute):
2614 (KJS::TryNode::optimizeVariableAccess):
2615 (KJS::TryNode::execute):
2616 (KJS::ProgramNode::initializeSymbolTable):
2617 (KJS::ScopeNode::optimizeVariableAccess):
2618 (KJS::ProgramNode::processDeclarations):
2619 (KJS::EvalNode::processDeclarations):
2620 (KJS::ProgramNode::execute):
2621 (KJS::EvalNode::execute):
2622 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
2623 (KJS::FuncDeclNode::execute):
2624 (KJS::FuncExprNode::evaluate):
2629 (KJS::ArgumentsNode::):
2631 2008-04-23 Oliver Hunt <oliver@apple.com>
2635 Bug 18672: SQUIRRELFISH: codegen fails with a large number of temporaries
2636 <https://bugs.webkit.org/show_bug.cgi?id=18672>
2638 Add a SegmentedVector type, which provides a Vector<T> which maintains
2639 existing memory locations during resize. This allows dynamically sizing
2640 local, temporary and label "vectors" in CodeGenerator.
2642 * JavaScriptCore.xcodeproj/project.pbxproj:
2643 * VM/CodeGenerator.cpp:
2644 (KJS::CodeGenerator::addVar):
2645 (KJS::CodeGenerator::CodeGenerator):
2646 (KJS::CodeGenerator::newTemporary):
2647 (KJS::CodeGenerator::newLabel):
2648 * VM/CodeGenerator.h:
2649 * VM/SegmentedVector.h: Added.
2650 (KJS::SegmentedVector::SegmentedVector):
2651 (KJS::SegmentedVector::~SegmentedVector):
2652 (KJS::SegmentedVector::last):
2653 (KJS::SegmentedVector::append):
2654 (KJS::SegmentedVector::removeLast):
2655 (KJS::SegmentedVector::size):
2656 (KJS::SegmentedVector::operator[]):
2657 (KJS::SegmentedVector::resize):
2658 (KJS::SegmentedVector::shrink):
2659 (KJS::SegmentedVector::grow):
2661 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2663 Reviewed by Maciej Stachowiak.
2665 A little refactoring in preparation for supporting 'arguments'.
2667 Fixes 2 regression tests.
2669 SunSpider reports no change.
2671 We now check the activation register, instead of the codeBlock, to
2672 determine whether we need to tear off the activation. This is to support
2673 "f.arguments", which will create an activation/arguments pair for f,
2674 even though the needsFullScopeChain flag is false for f's codeBlock.
2676 The test fixes resulted from calling initializeCallFrame for re-entrant
2677 function code, instead of initializing (not enough) parts of the call
2680 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2684 - propagate the "this" value properly to local eval
2686 (fixes a measly one regression test)
2689 (KJS::CodeBlock::CodeBlock):
2690 (KJS::ProgramCodeBlock::ProgramCodeBlock):
2691 (KJS::EvalCodeBlock::EvalCodeBlock):
2693 (KJS::Machine::privateExecute):
2695 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2699 Add support for function declarations in eval code.
2701 (this fixes 12 more regression tests)
2704 * VM/CodeGenerator.cpp:
2705 (KJS::CodeGenerator::CodeGenerator):
2706 * VM/CodeGenerator.h:
2708 (KJS::Machine::execute):
2710 (KJS::EvalNode::generateCode):
2712 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2716 Implement LabelNode.
2718 * VM/CodeGenerator.cpp:
2719 (KJS::CodeGenerator::pushJumpContext):
2720 (KJS::CodeGenerator::jumpContextForContinue):
2721 (KJS::CodeGenerator::jumpContextForBreak):
2722 * VM/CodeGenerator.h:
2724 (KJS::DoWhileNode::emitCode):
2725 (KJS::WhileNode::emitCode):
2726 (KJS::ForNode::emitCode):
2727 (KJS::ForInNode::emitCode):
2728 (KJS::ContinueNode::emitCode):
2729 (KJS::BreakNode::emitCode):
2730 (KJS::SwitchNode::emitCode):
2731 (KJS::LabelNode::emitCode):
2733 2008-04-22 Geoffrey Garen <ggaren@apple.com>
2735 Reviewed by Oliver Hunt.
2737 Fixed crash when unwinding from exceptions inside eval.
2740 (KJS::Machine::unwindCallFrame): Don't assume that the top of the
2741 current call frame's scope chain is an activation: it can be the global
2744 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2749 (main): Convert signals to exit codes, so that crashing tests are
2750 detected as regression test failures.
2752 2008-04-22 Geoffrey Garen <ggaren@apple.com>
2754 Reviewed by Oliver Hunt and Maciej Stachowiak.
2756 Renamed "needsActivation" to "needsFullScopeChain" because lying will
2757 make hair grow on the backs of your hands.
2759 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2761 Reviewed by Maciej Stachowiak.
2763 Fixed ScopeChainNode lifetime problems:
2765 (1) In "with" and "catch" scopes, we would construct a ScopeChain
2766 object and then jump across its destructor, leaking the ScopeChainNode
2769 (2) In global and eval scopes, we would fail to initially ref
2770 "scopeChain", causing us to overrelease it later. Now that we ref
2771 "scopeChain" properly, we also need to deref it when the script
2774 SunSpider reports a .2% regression, but an earlier round of ScopeChain
2775 refactoring was a .4% speedup, so there.
2777 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2781 - use global object instead of null for "this" on unqualified calls
2783 This fixes 10 more JSC test regressions.
2786 (KJS::Machine::privateExecute):
2788 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2792 - throw proper exceptions for objects that don't implement call or construct
2794 This fixes 21 more JSC test regressions. It is also seemingly an
2797 * VM/ExceptionHelpers.cpp:
2798 (KJS::createNotAnObjectError):
2799 (KJS::createNotAConstructorError):
2800 (KJS::createNotAFunctionError):
2801 * VM/ExceptionHelpers.h:
2803 (KJS::Machine::privateExecute):
2805 2008-04-21 Oliver Hunt <oliver@apple.com>
2809 Implement emitCode for ConstDeclNode.
2811 This fixes the crash (assertion) in js1_5/Scope/scope-001.js
2813 * VM/CodeGenerator.cpp:
2814 (KJS::CodeGenerator::registerForLocalConstInit):
2815 * VM/CodeGenerator.h:
2817 (KJS::AssignResolveNode::emitCode):
2818 (KJS::ConstDeclNode::emitCodeSingle):
2819 (KJS::ConstDeclNode::emitCode):
2820 (KJS::ConstStatementNode::emitCode):
2823 2008-04-21 Maciej Stachowiak <mjs@apple.com>
2827 - add some support for the split window object
2829 This fixes many layout tests.
2832 (KJS::resolveBaseAndFunc): Use toThisObject() to ensure we get the
2833 wrapper global, if one exists, as the "this" object.
2835 (KJS::globalFuncEval): Use toGlobalObject() to handle the wrapper
2838 2008-04-21 Maciej Stachowiak <mjs@apple.com>
2842 - restore ScopeChain::operator= to avoid crash on many layout tests
2844 Otherwise, FunctionImp::setScope would cause a reference
2845 underflow. I implemented using the copy construct and swap idiom.
2847 * kjs/scope_chain.h:
2848 (KJS::ScopeChain::swap):
2849 (KJS::ScopeChain::operator=):
2851 2008-04-21 Oliver Hunt <oliver@apple.com>
2855 Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
2856 <https://bugs.webkit.org/show_bug.cgi?id=18649>
2858 Allocate a callframe for eval() and initialise with a null codeBlock to
2859 indicate native code. This prevents the unwinder from clobbering the
2863 (KJS::Machine::execute):
2865 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2867 Reviewed by Sam Weinig.
2869 Removed ScopeChain::push(ScopeChain&) because it was unused. Moved
2870 ScopeChain::print to ScopeChainNode.
2872 ScopeChain is now nothing more than a resource-handling wrapper around
2875 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2879 Bug 18671: SquirrelFish: continue inside switch fails
2880 <https://bugs.webkit.org/show_bug.cgi?id=18671>
2882 * VM/CodeGenerator.cpp:
2883 (KJS::CodeGenerator::jumpContextForLabel):
2884 * VM/CodeGenerator.h:
2886 (KJS::ContinueNode::emitCode):
2888 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2890 Reviewed by Sam Weinig.
2892 Moved push(JSObject*) and pop() from ScopeChain to ScopeChainNode,
2893 rearranging scope_chain.h a bit.
2895 SunSpider reports no change.
2897 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2899 Reviewed by Sam Weinig.
2901 Moved bottom() from ScopeChain to ScopeChainNode, simplifying it based
2902 on the knowledge that the ScopeChain is never empty.
2904 SunSpider reports no change.
2906 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2908 Reviewed by Oliver Hunt.
2910 Moved begin() and end() from ScopeChain to ScopeChainNode.
2912 Also marked a few methods "const".
2914 SunSpider reports no change.
2916 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2918 Reviewed by Maciej Stachowiak.
2920 Turned ScopeChain::depth into a stand-alone function, and simplified it
2923 I also moved ScopeChain::depth to Machine.cpp because it doesn't report
2924 the true depth of the ScopeChain -- just the Machine's perspective of
2925 its depth within a given call frame.
2927 SunSpider reports no change.
2929 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2931 Reviewed by Maciej Stachowiak.
2933 Removed indirection in ScopeChain::ref / ScopeChain::deref.
2935 SunSpider reports no change.
2937 * kjs/scope_chain.h:
2938 (KJS::ScopeChain::ScopeChain):
2939 (KJS::ScopeChain::~ScopeChain):
2940 (KJS::ScopeChain::clear):
2942 2008-04-21 Oliver Hunt <oliver@apple.com>
2944 Reviewed by NOBODY(Build fix)
2949 (KJS::ConstDeclNode::evaluateSingle):
2951 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2955 Bug 18664: SQUIRRELFISH: correctly throw a SyntaxError when parsing of eval code fails
2956 <https://bugs.webkit.org/show_bug.cgi?id=18664>
2958 Correctly throw a SyntaxError when parsing of eval code fails.
2963 2008-04-21 Oliver Hunt <oliver@apple.com>
2967 Partial fix for Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
2969 Make sure we correct the register state before jumping to vm_throw.
2972 (KJS::Machine::privateExecute):
2974 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2976 Reviewed by Maciej Stachowiak.
2978 Simplified ScopeChain ref/deref.
2980 SunSpider reports a .4% speedup.
2982 * kjs/scope_chain.h:
2983 (KJS::ScopeChainNode::ref): Removed this function because it was nonsense.
2984 ScopeChainNodes are initialized with a refCount of 1, so the loop was
2985 guaranteed to iterate exactly once.
2987 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2989 Reviewed by Maciej Stachowiak.
2991 Removed support for empty ScopeChains.
2993 SunSpider reports no change.
2995 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2997 Reviewed by Maciej Stachowiak.
2999 Removed some completely unused ScopeChain member functions.
3001 SunSpider reports no change.
3003 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3005 Reviewed by Maciej Stachowiak.
3007 Avoid creating unnecessary ScopeChain objects, to reduce refcount churn.
3009 SunSpider reports no change.
3011 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3013 Rubber stamped by Alexey.
3020 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3024 - only print "End:" output when -d flag is passed.
3026 This fixes half of our failing JSC regression tests.
3031 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3035 Add support for variable declarations in eval code.
3038 (KJS::EvalCodeBlock::EvalCodeBlock):
3039 * VM/CodeGenerator.cpp:
3040 (KJS::CodeGenerator::CodeGenerator):
3041 * VM/CodeGenerator.h:
3043 (KJS::Machine::execute):
3046 (KJS::globalFuncEval):
3048 (KJS::EvalNode::generateCode):
3052 2008-04-20 Oliver Hunt <oliver@apple.com>
3056 Throw exceptions for invalid continue, break, and return statements.
3058 Simple refactoring and extension of Cameron's AssignErrorNode, etc patch
3060 * VM/CodeGenerator.cpp:
3061 (KJS::CodeGenerator::CodeGenerator):
3062 (KJS::CodeGenerator::pushJumpContext):
3063 (KJS::CodeGenerator::popJumpContext):
3064 (KJS::CodeGenerator::jumpContextForLabel):
3065 * VM/CodeGenerator.h:
3067 (KJS::Node::emitThrowError):
3068 (KJS::ContinueNode::emitCode):
3069 (KJS::BreakNode::emitCode):
3070 (KJS::ReturnNode::emitCode):
3073 2008-04-20 Geoffrey Garen <ggaren@apple.com>
3075 Reviewed by Oliver Hunt.
3077 Removed Machine.cpp from AllInOneFile.cpp, and manually inlined a few
3078 things that used to be inlined automatically.
3080 1.9% speedup on SunSpider.
3082 My hope is that we'll face fewer surprises in Machine.cpp codegen, now
3083 that GCC is making fewer decisions. The speedup seems to confirm that.
3085 2008-04-20 Oliver Hunt <oliver@apple.com>
3089 Bug 18642: Iterator context may get placed into the return register, leading to much badness
3090 <https://bugs.webkit.org/show_bug.cgi?id=18642>
3092 To prevent incorrectly reusing what will become the result register for
3093 eval and global code execution, we need to request and ref the destination
3094 in advance of codegen. Unfortunately this may lead to unnecessary copying,
3095 although in future we can probably limit this. Curiously SunSpider shows
3096 a progression in a number of tests, although it comes out as a wash overall.
3099 (KJS::EvalNode::emitCode):
3100 (KJS::ProgramNode::emitCode):
3102 2008-04-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3106 Add support for AssignErrorNode, PrefixErrorNode, and PostfixErrorNode.
3109 (KJS::CodeBlock::dump):
3110 * VM/CodeGenerator.cpp:
3111 (KJS::CodeGenerator::emitCreateError):
3112 * VM/CodeGenerator.h:
3114 (KJS::Machine::privateExecute):
3117 (KJS::PostfixErrorNode::emitCode):
3118 (KJS::PrefixErrorNode::emitCode):
3119 (KJS::AssignErrorNode::emitCode):
3122 2008-04-20 Oliver Hunt <oliver@apple.com>
3124 Reviewed by Geoff and Mark.
3126 Provide line number information in exceptions
3128 Simple patch, adds line number information metadata to CodeBlock
3129 and a simple method to get the line number responsible for a given
3133 (KJS::CodeBlock::lineNumberForVPC):
3135 * VM/CodeGenerator.h:
3136 (KJS::CodeGenerator::emitNode):
3138 (KJS::Machine::throwException):
3140 2008-04-20 Oliver Hunt <oliver@apple.com>
3144 Provide "sourceURL" in exceptions
3148 (KJS::Machine::throwException):
3150 (KJS::EvalNode::generateCode):
3151 (KJS::ProgramNode::generateCode):
3153 2008-04-19 Oliver Hunt <oliver@apple.com>
3157 Don't call emitCode directly on subnodes, instead use CodeGenerator::emitNode
3159 This patch just a preparation for tracking line numbers.
3162 (KJS::ObjectLiteralNode::emitCode):
3163 (KJS::PropertyListNode::emitCode):
3164 (KJS::ArgumentListNode::emitCode):
3165 (KJS::TryNode::emitCode):
3167 2008-04-19 Oliver Hunt <oliver@apple.com>
3171 Bug 18619: Support continue, break, and return in try .. finally blocks
3172 <https://bugs.webkit.org/show_bug.cgi?id=18619>
3174 This patch replaces the current partial finally support (which uses code
3175 duplication to achieve what it does) with a subroutine based approach.
3176 This has a number of advantages over code duplication:
3178 * Simplified exception handling as the finaliser code only exists in
3179 one place, so no "magic" is needed to get the correct handler for a
3181 * When we support instruction to line number mapping we won't need to
3182 worry about the dramatic code movement caused by duplication
3184 On the downside it is necessary to add two new opcodes, op_jsr and op_sret
3185 to enter and exit the finaliser subroutines, happily SunSpider reports
3186 a performance progression (gcc amazes me) and ubench reports a wash.
3188 While jsr and sret provide a mechanism that allows us to enter and exit
3189 any arbitrary finaliser we need to, it was still necessary to increase
3190 the amount of information tracked when entering and exiting both finaliser
3191 scopes and dynamic scopes ("with"). This means "scopeDepth" is now
3192 the combination of "finaliserDepth" and "dynamicScopeDepth". We also
3193 now use a scopeContextStack to ensure that we pop scopes and execute
3194 finalisers in the correct order. This increases the cost of "with" nodes
3195 during codegen, but it should not be significant enough to effect real
3196 world performance and greatly simplifies codegen for return, break and
3197 continue when interacting with finalisers.
3200 (KJS::CodeBlock::dump):
3201 Pretty printing of jsr/sret opcodes
3203 * VM/CodeGenerator.cpp:
3204 (KJS::CodeGenerator::CodeGenerator):
3205 (KJS::CodeGenerator::emitPushScope):
3206 (KJS::CodeGenerator::emitPopScope):
3207 Dynamic scopes need to be tracked on the scopeContextStack now
3209 (KJS::CodeGenerator::pushFinallyContext):
3210 (KJS::CodeGenerator::popFinallyContext):
3211 Handle entry and exit from code regions with finalisers. This is
3212 needed solely to support return, continue and break inside finaliser
3215 (KJS::CodeGenerator::emitComplexJumpScopes):
3216 Helper function for emitJumpScopes to handle the complex codegen
3217 needed to handle return, continue and break inside a finaliser region
3219 (KJS::CodeGenerator::emitJumpScopes):
3220 Updated to be aware of finalisers, if a cross-scope jump occurs inside
3221 a finaliser we hand off codegen to emitComplexJumpScopes, otherwise
3222 we can handle the normal (trivial) case with a single instruction.
3224 (KJS::CodeGenerator::emitJumpSubroutine):
3225 (KJS::CodeGenerator::emitSubroutineReturn):
3226 Trivial opcode emitter functions.
3228 * VM/CodeGenerator.h:
3229 (KJS::CodeGenerator::scopeDepth):
3231 (KJS::Machine::privateExecute):
3232 Implement op_jsr and op_sret.
3235 Ad op_jsr and op_sret
3238 (KJS::TryNode::emitCode):
3239 Fix codegen for new finaliser model.
3241 2008-04-17 Mark Rowe <mrowe@apple.com>
3243 Rubber-stamped by Oliver Hunt.
3245 Remove unnecessary files from testkjs, testapi and minidom targets.
3247 * JavaScriptCore.xcodeproj/project.pbxproj:
3249 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3251 Reviewed by Oliver Hunt.
3253 Fixed ASSERT seen during run-sunspider of a debug build.
3255 * VM/CodeGenerator.h: Made the default codegen buffers bigger. SunSpider
3256 runs all tests in one global environment, so you end up with more than
3257 128 locals. This is just a stop-gap until we code up a real
3258 solution to arbitrary symbol and label limits.
3260 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3262 Reviewed by Oliver Hunt.
3264 Fixed a bug in exception unwinding, where we wouldn't deref the scope
3265 chain in global scope, so we would leak ScopeChainNodes when exceptions
3266 were thrown inside "with" and "catch" scopes.
3268 Also did some cleanup of the unwinding code along the way.
3270 Scope chain reference counting is still wrong in a few ways. I thought
3271 I would fix this portion of it first.
3273 run-sunspider shows no change.
3276 (KJS::Machine::unwindCallFrame):
3277 (KJS::Machine::throwException):
3278 (KJS::Machine::privateExecute):
3281 2008-04-17 Oliver Hunt <oliver@apple.com>
3285 Add more exception checking to toNumber conversions
3287 This corrects op_pre_dec, op_negate, op_mod and op_sub.
3290 (KJS::Machine::privateExecute):
3292 2008-04-17 Geoffrey Garen <ggaren@apple.com> and Cameron Zwarich <cwzwarich@uwaterloo.ca>
3294 Reviewed by Oliver Hunt.
3298 Introduced a new opcode: op_call_eval. In the normal case, it performs
3299 an eval. In the case where eval has been overridden in some way, it
3300 performs a function call.
3302 * VM/CodeGenerator.h: Added a feature so the code generator knows not
3303 to optimized locals in eval code.
3305 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3307 Reviewed by Sam Weinig.
3309 Added some ASSERTs to document codegen failures in
3310 run-javascriptcore-tests.
3312 For all tests, program-level codegen now either succeeds, or fails with
3315 * VM/CodeGenerator.cpp:
3316 (KJS::CodeGenerator::addVar):
3317 (KJS::CodeGenerator::CodeGenerator):
3318 (KJS::CodeGenerator::newTemporary):
3319 (KJS::CodeGenerator::newLabel):
3321 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3323 Reviewed by Maciej Stachowiak.
3325 Fixed another case of a dst register being an unreferenced temporary
3326 (caused an ASSERT when running the full sunspider suite).
3329 (KJS::CaseBlockNode::emitCodeForBlock):
3331 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3335 - add documentation (and meaningful parameter names) for arithmetic and bitwise binary ops
3338 (KJS::CodeBlock::dump):
3339 * VM/CodeGenerator.cpp:
3340 (KJS::CodeGenerator::emitMul):
3341 (KJS::CodeGenerator::emitDiv):
3342 (KJS::CodeGenerator::emitMod):
3343 (KJS::CodeGenerator::emitSub):
3344 (KJS::CodeGenerator::emitLeftShift):
3345 (KJS::CodeGenerator::emitRightShift):
3346 (KJS::CodeGenerator::emitUnsignedRightShift):
3347 (KJS::CodeGenerator::emitBitAnd):
3348 (KJS::CodeGenerator::emitBitXOr):
3349 (KJS::CodeGenerator::emitBitOr):
3350 * VM/CodeGenerator.h:
3352 (KJS::Machine::privateExecute):
3355 (KJS::MultNode::emitCode):
3356 (KJS::DivNode::emitCode):
3357 (KJS::ModNode::emitCode):
3358 (KJS::SubNode::emitCode):
3359 (KJS::LeftShiftNode::emitCode):
3360 (KJS::RightShiftNode::emitCode):
3361 (KJS::UnsignedRightShiftNode::emitCode):
3362 (KJS::BitAndNode::emitCode):
3363 (KJS::BitXOrNode::emitCode):
3364 (KJS::BitOrNode::emitCode):
3365 (KJS::emitReadModifyAssignment):
3366 (KJS::ReadModifyResolveNode::emitCode):
3368 2008-04-16 Oliver Hunt <oliver@apple.com>
3372 Exception checks for toNumber in op_pre_inc
3374 This is somewhat more convoluted than the simple hadException checks
3375 we currently use. Instead we use special toNumber conversions that
3376 select between the exception and ordinary vPC. This allows us to
3377 remove any branches in the common case (incrementing a number).
3379 * API/JSCallbackObject.h:
3380 * API/JSCallbackObjectFunctions.h:
3383 * JavaScriptCore.exp:
3384 * JavaScriptCore.xcodeproj/project.pbxproj:
3385 * VM/JSPropertyNameIterator.cpp:
3386 (KJS::JSPropertyNameIterator::toNumber):
3387 * VM/JSPropertyNameIterator.h:
3389 (KJS::Machine::privateExecute):
3391 * kjs/ExecState.cpp:
3392 (KJS::ExecState::ExecState):
3394 * kjs/JSNotAnObject.cpp:
3395 (KJS::JSNotAnObject::toNumber):
3396 * kjs/JSNotAnObject.h:
3398 (KJS::StringImp::toNumber):
3399 (KJS::NumberImp::toNumber):
3400 (KJS::GetterSetterImp::toNumber):
3403 (KJS::JSObject::toNumber):
3406 (KJS::JSValue::toNumber):
3408 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3412 - ensure that activations are kept in a register to protect them from GC
3414 Also renamed OptionalCalleeScopeChain constant to OptionalCalleeActivation, since
3415 that is what is now kept there, and there is no more need to keep the scope chain in
3419 (KJS::initializeCallFrame):
3420 (KJS::scopeChainForCall):
3424 2008-04-16 Geoffrey Garen <ggaren@apple.com>
3426 Reviewed by Oliver Hunt.
3428 Made "this" work in program code / global scope.
3430 The machine can initialize "this" prior to execution because it knows
3431 that, for program code, "this" is always stored in lr1.
3434 (KJS::Machine::execute):
3437 * kjs/interpreter.cpp:
3438 (KJS::Interpreter::evaluate):
3440 2008-04-16 Geoffrey Garen <ggaren@apple.com>
3442 Reviewed by Oliver Hunt.
3444 Fixed a codegen bug when returning from inside a dynamic scope (a with
3445 or catch block): we need to pop any dynamic scope(s) that have been
3446 added so op_ret can find the activation object at the top of the scope
3450 (KJS::ReturnNode::emitCode): If we're returning from inside a dynamic
3451 scope, emit a jmp_scopes to take care of popping any dynamic scope(s)
3452 and then branching to the return instruction.
3454 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3458 - document the add and get_prop_id opcodes
3460 In addition to adding documentation in comments, I changed
3461 references to register IDs or indices relating to these opcodes to
3462 have meaningful names instead of r0 r1 r2.
3464 * VM/CodeGenerator.cpp:
3465 (KJS::CodeGenerator::emitAdd):
3466 * VM/CodeGenerator.h:
3468 (KJS::Machine::privateExecute):
3470 (KJS::DotAccessorNode::emitCode):
3471 (KJS::FunctionCallDotNode::emitCode):
3472 (KJS::PostIncDotNode::emitCode):
3473 (KJS::PostDecDotNode::emitCode):
3474 (KJS::PreIncDotNode::emitCode):
3475 (KJS::PreDecDotNode::emitCode):
3476 (KJS::AddNode::emitCode):
3477 (KJS::ReadModifyDotNode::emitCode):
3479 2008-04-15 Geoffrey Garen <ggaren@apple.com>
3481 Reviewed by Oliver Hunt and Maciej Stachowiak.
3483 Fixed a codegen bug in with and switch, and added an ASSERT to
3484 make sure it doesn't happen again.
3486 emitCode() assumes that dst, if non-zero, is either referenced or
3487 non-temporary (i.e., it assumes that newTemporary() will return a
3488 register not equal to dst). Certain callers to emitCode() weren't
3489 guaranteeing that to be so, so temporary register values were being
3492 * VM/CodeGenerator.h:
3493 (KJS::CodeGenerator::emitNode): ASSERT that dst is referenced or non-temporary.
3496 (KJS::CommaNode::emitCode): Reference the dst we pass.
3498 (KJS::WithNode::emitCode): No need to pass an explicit dst register.
3500 (KJS::CaseBlockNode::emitCodeForBlock): No need to pass an explicit dst register.
3501 (KJS::SwitchNode::emitCode): No need to pass an explicit dst register.
3503 * kjs/nodes.h: Made dst the last parameter to emitCodeForBlock, to match
3506 2008-04-15 Oliver Hunt <oliver@apple.com>
3510 Bug 18526: Throw exceptions when resolve fails for op_resolve_base_and_func.
3511 <https://bugs.webkit.org/show_bug.cgi?id=18526>
3513 Very simple fix, sunspider shows a 0.7% progression, ubench shows a 0.4% regression.
3516 (KJS::resolveBaseAndFunc):
3517 (KJS::Machine::privateExecute):
3519 2008-04-15 Maciej Stachowiak <mjs@apple.com>
3523 - fix incorrect result on 3d-raytrace test
3525 Oliver found and tracked down this bug, I just typed in the fix.
3528 (KJS::slideRegisterWindowForCall): When setting omitted parameters to undefined,
3529 account for the space for local variables.
3531 2008-04-15 Maciej Stachowiak <mjs@apple.com>
3535 - fix codegen handling of dst registers
3537 1.006x speedup (not sure why).
3539 Most emitCode functions take an optional "dst" parameter that says
3540 where the output of the instruction should be written. I made some
3541 functions for convenient handling of the dst register:
3543 * VM/CodeGenerator.h:
3544 (KJS::CodeGenerator::tempDestination): Takes the dst register. Returns it if
3545 it is not null and is a temporary, otherwise allocates a new temporary. This is
3546 intended for cases where an intermediate value might be written into the dst
3548 (KJS::CodeGenerator::finalDestination): Takes the dst register and an optional
3549 register that was used as a temp destination. Picks the right thing for the final
3550 output. Intended to be used as the output register for the instruction that generates
3551 the final value of a particular node.
3553 (KJS::CodeGenerator::moveToDestinationIfNeeded): Takes dst and a
3554 RegisterID; moves from the register to dst if dst is defined and
3555 different from the register. This is intended for cases where the
3556 result of a node is already in a specific register (likely a
3557 local), and so no code needs to be generated unless a specific
3558 destination has been requested, in which case a move is needed.
3560 I also applied these methods throughout emitCode functions. In
3561 some cases this was just cleanup, in other cases I fixed actual
3562 codegen bugs. Below I have given specific comments for the cases
3563 where I believe I fixed a codegen bug, or improved quality of codegen.
3566 (KJS::NullNode::emitCode):
3567 (KJS::FalseNode::emitCode):
3568 (KJS::TrueNode::emitCode):
3569 (KJS::NumberNode::emitCode):
3570 (KJS::StringNode::emitCode):
3571 (KJS::RegExpNode::emitCode):
3572 (KJS::ThisNode::emitCode): Now avoids emitting a mov when dst is
3573 the same as the this register (the unlikely case of "this = this");
3574 (KJS::ResolveNode::emitCode): Now avoids emitting a mov when dst
3575 is the same as the local regiester, in the local var case (the
3576 unlikely case of "x = x");
3577 (KJS::ArrayNode::emitCode): Fixed a codegen bug where array
3578 literal element expressions may have observed an intermediate
3579 value of constructing the array.
3580 (KJS::ObjectLiteralNode::emitCode):
3581 (KJS::PropertyListNode::emitCode): Fixed a codegen bug where object literal
3582 property definition expressions may have obesrved an intermediate value of
3583 constructing the object.
3584 (KJS::BracketAccessorNode::emitCode):
3585 (KJS::DotAccessorNode::emitCode):
3586 (KJS::NewExprNode::emitCode):
3587 (KJS::FunctionCallValueNode::emitCode):
3588 (KJS::FunctionCallBracketNode::emitCode):
3589 (KJS::FunctionCallDotNode::emitCode):
3590 (KJS::PostIncResolveNode::emitCode):
3591 (KJS::PostDecResolveNode::emitCode):
3592 (KJS::PostIncBracketNode::emitCode):
3593 (KJS::PostDecBracketNode::emitCode):
3594 (KJS::PostIncDotNode::emitCode):
3595 (KJS::PostDecDotNode::emitCode):
3596 (KJS::DeleteResolveNode::emitCode):
3597 (KJS::DeleteBracketNode::emitCode):
3598 (KJS::DeleteDotNode::emitCode):
3599 (KJS::DeleteValueNode::emitCode):
3600 (KJS::VoidNode::emitCode):
3601 (KJS::TypeOfResolveNode::emitCode):
3602 (KJS::TypeOfValueNode::emitCode):
3603 (KJS::PreIncResolveNode::emitCode): Fixed a codegen bug where the final
3604 value would not be output to the dst register in the local var case.
3605 (KJS::PreDecResolveNode::emitCode): Fixed a codegen bug where the final
3606 value would not be output to the dst register in the local var case.
3607 (KJS::PreIncBracketNode::emitCode):
3608 (KJS::PreDecBracketNode::emitCode):
3609 (KJS::PreIncDotNode::emitCode):
3610 (KJS::PreDecDotNode::emitCode):
3611 (KJS::UnaryPlusNode::emitCode):
3612 (KJS::NegateNode::emitCode):
3613 (KJS::BitwiseNotNode::emitCode):
3614 (KJS::LogicalNotNode::emitCode):
3615 (KJS::MultNode::emitCode):
3616 (KJS::DivNode::emitCode):
3617 (KJS::ModNode::emitCode):
3618 (KJS::AddNode::emitCode):
3619 (KJS::SubNode::emitCode):
3620 (KJS::LeftShiftNode::emitCode):
3621 (KJS::RightShiftNode::emitCode):
3622 (KJS::UnsignedRightShiftNode::emitCode):
3623 (KJS::LessNode::emitCode):
3624 (KJS::GreaterNode::emitCode):
3625 (KJS::LessEqNode::emitCode):
3626 (KJS::GreaterEqNode::emitCode):
3627 (KJS::InstanceOfNode::emitCode):
3628 (KJS::InNode::emitCode):
3629 (KJS::EqualNode::emitCode):
3630 (KJS::NotEqualNode::emitCode):
3631 (KJS::StrictEqualNode::emitCode):
3632 (KJS::NotStrictEqualNode::emitCode):
3633 (KJS::BitAndNode::emitCode):
3634 (KJS::BitXOrNode::emitCode):
3635 (KJS::BitOrNode::emitCode):
3636 (KJS::LogicalAndNode::emitCode):
3637 (KJS::LogicalOrNode::emitCode):
3638 (KJS::ConditionalNode::emitCode):
3639 (KJS::emitReadModifyAssignment): Allow an out argument separate from the operands,
3640 needed for fixes below.
3641 (KJS::ReadModifyResolveNode::emitCode): Fixed a codegen bug where the right side of
3642 the expression may observe an intermediate value.
3643 (KJS::AssignResolveNode::emitCode): Fixed a codegen bug where the right side of the
3644 expression may observe an intermediate value.
3645 (KJS::ReadModifyDotNode::emitCode): Fixed a codegen bug where the right side of the
3646 expression may observe an intermediate value.
3647 (KJS::ReadModifyBracketNode::emitCode): Fixed a codegen bug where the right side of the
3648 expression may observe an intermediate value.
3649 (KJS::CommaNode::emitCode): Avoid writing temporary value to dst register.
3650 (KJS::ReturnNode::emitCode): Void return should return undefined, not null.
3651 (KJS::FuncExprNode::emitCode):
3653 2008-04-15 Maciej Stachowiak <mjs@apple.com>
3657 - fix huge performance regression (from trunk) in string-unpack-code
3659 This restores string-unpack-code performance to parity with
3660 trunk (2.27x speedup relative to previous SquirrelFish)
3663 (KJS::Machine::execute): Shrink register file after call to avoid
3666 2008-04-15 Geoffrey Garen <ggaren@apple.com>
3668 Reviewed by Sam Weinig.
3670 Fixed dumpCallFrame to match our new convention of passing around a
3671 ScopeChainNode* instead of a ScopeChain*.
3673 * JavaScriptCore.exp:
3675 (KJS::Machine::dumpCallFrame):
3678 2008-04-15 Oliver Hunt <oliver@apple.com>
3682 Bug 18436: Need to throw exception on read/modify/write or similar resolve for nonexistent property
3683 <https://bugs.webkit.org/show_bug.cgi?id=18436>
3685 Add op_resolve_base_and_property for read/modify/write operations,
3686 this adds a "superinstruction" to resolve the base and value of a
3687 property simultaneously. Just using resolveBase and resolve results
3688 in an 5% regression in ubench, 30% in loop-empty-resolve (which is
3689 expected). 1.3% progression in sunspider, 2.1% in ubench, with a
3690 21% gain in loop-empty-resolve. The only outlier is function-missing-args
3691 which gets a 3% regression that I could never resolve.
3694 (KJS::CodeBlock::dump):
3695 * VM/CodeGenerator.cpp:
3696 (KJS::CodeGenerator::emitResolveBaseAndProperty):
3697 * VM/CodeGenerator.h:
3699 (KJS::resolveBaseAndProperty):
3700 (KJS::Machine::privateExecute):
3703 (KJS::PostIncResolveNode::emitCode):
3704 (KJS::PostDecResolveNode::emitCode):
3705 (KJS::PreIncResolveNode::emitCode):
3706 (KJS::PreDecResolveNode::emitCode):
3707 (KJS::ReadModifyResolveNode::emitCode):
3709 2008-04-15 Maciej Stachowiak <mjs@apple.com>
3713 - fixed "SquirrelFish crashes due to bad scope chain on some SunSpider tests"
3714 https://bugs.webkit.org/show_bug.cgi?id=18508
3716 3d-raytrace and string-unpack-code now run.
3718 The basic approach is to pass around ScopeChainNode* instead of
3719 ScopeChain*, which in addition to not becoming suddenly an invalid
3720 pointer also saves an indirection.
3722 This is an 0.4% speedup on SunSpider --squirrelfish (1.8% on --ubench)
3727 (KJS::resolveBaseAndFunc):
3728 (KJS::initializeCallFrame):
3729 (KJS::scopeChainForCall):
3730 (KJS::Machine::unwindCallFrame):
3731 (KJS::Machine::throwException):
3732 (KJS::Machine::execute):
3733 (KJS::Machine::privateExecute):
3738 (KJS::EvalNode::generateCode):
3739 (KJS::FunctionBodyNode::generateCode):
3740 (KJS::ProgramNode::generateCode):
3741 (KJS::ProgramNode::processDeclarations):
3742 (KJS::EvalNode::processDeclarations):
3743 (KJS::FuncDeclNode::makeFunction):
3744 (KJS::FuncExprNode::makeFunction):
3746 (KJS::ProgramNode::):
3748 (KJS::FunctionBodyNode::):
3750 * kjs/scope_chain.h:
3751 (KJS::ScopeChainNode::ScopeChainNode):
3752 (KJS::ScopeChainNode::deref):
3753 (KJS::ScopeChainIterator::ScopeChainIterator):
3754 (KJS::ScopeChainIterator::operator*):
3755 (KJS::ScopeChainIterator::operator->):
3756 (KJS::ScopeChain::ScopeChain):
3757 (KJS::ScopeChain::node):
3758 (KJS::ScopeChain::deref):
3759 (KJS::ScopeChain::ref):
3760 (KJS::ScopeChainNode::ref):
3761 (KJS::ScopeChainNode::release):
3762 (KJS::ScopeChainNode::begin):
3763 (KJS::ScopeChainNode::end):
3765 2008-04-14 Geoffrey Garen <ggaren@apple.com>
3767 Reviewed by Oliver Hunt.
3769 Fixed crash when accessing registers in a torn-off activation object.
3771 * kjs/JSActivation.cpp:
3772 (KJS::JSActivation::copyRegisters): Update our registerOffset after
3773 copying our registers, since our offset should now be relative to
3774 our private register array, not the shared register file.
3776 2008-04-14 Maciej Stachowiak <mjs@apple.com>
3780 - fix a codegen flaw that makes some tests run way too fast or way too slow
3782 The basic problem was that FunctionCallResolveNode results in
3783 codegen which can incorrectly write an intermediate value into the
3784 dst register even when that is a local. I added convenience
3785 functions to CodeGenerator for getting this right, but for now I
3786 only fixed FunctionCallResolve.
3788 * VM/CodeGenerator.h:
3789 (KJS::CodeGenerator::tempDestination):
3790 (KJS::CodeGenerator::):
3792 (KJS::FunctionCallResolveNode::emitCode):
3794 2008-04-14 Gabor Loki <loki@inf.u-szeged.hu>
3796 Reviewed and slightly tweaked by Geoffrey Garen.
3798 Bug 18489: Squirrelfish doesn't build on linux
3799 <https://bugs.webkit.org/show_bug.cgi?id=18489>
3801 * JavaScriptCore.pri: Add VM into include path and its files into
3803 * VM/JSPropertyNameIterator.cpp: Fix include name
3804 * VM/Machine.cpp: Add UNLIKELY macro for GCC
3805 * VM/Machine.h: Add missing includes
3806 * VM/RegisterFile.cpp: Add missing include
3807 * kjs/testkjs.pro: Add VM into include path
3809 2008-04-14 Geoffrey Garen <ggaren@apple.com>
3811 Reviewed by Sam Weinig.
3813 Restored OwnPtr in some places where I had removed it previously. We
3814 can have an OwnPtr to an undefined class in a header as long as the
3815 class's destructor isn't in the header.
3817 2008-04-14 Geoffrey Garen <ggaren@apple.com>
3819 Reviewed by Sam Weinig.
3821 Fixed access to "this" inside dynamic scopes.
3823 * VM/CodeGenerator.cpp:
3824 (KJS::CodeGenerator::registerForLocal): Always return a register for
3825 "this", even if we're not optimizing access to other locals. Because
3826 "this" is a keyword, it's always in a register and always accessible.
3828 * VM/CodeGenerator.h:
3829 (KJS::CodeGenerator::shouldOptimizeLocals): Factored out a function
3830 for determining whether we should optimize access to locals, since
3831 eval will need to make this test a little more complicated.
3833 2008-04-14 Maciej Stachowiak <mjs@apple.com>
3837 - fix crash when running SunSpider full harness
3839 When growing the register file's buffer to make space for new globals,
3840 make sure to copy accounting for the fact that the new space is logically
3841 at the beginning of the buffer in this case, instead of at the end as when
3842 growing for a new call frame.
3844 * VM/RegisterFile.cpp:
3845 (KJS::RegisterFile::newBuffer):
3846 (KJS::RegisterFile::growBuffer):
3847 (KJS::RegisterFile::addGlobalSlots):
3848 * VM/RegisterFile.h:
3850 2008-04-11 Geoffrey Garen <ggaren@apple.com>
3852 Reviewed by Sam Weinig.
3854 Mark constant pools for global and eval code (collectively known as
3855 "program code"). (Constant pools for function code are already marked by
3858 The global object is responsible for marking program code constant
3859 pools. Code blocks add themselves to the mark set at creation time, and
3860 remove themselves from the mark set at destruction time.
3862 sunspider --squirrelfish reports a 1% speedup, perhaps because
3863 generateCode() is now non-virtual.
3865 * kjs/nodes.cpp: I had to use manual init and delete in this file
3866 because putting an OwnPtr into the header would have created a circular
3869 2008-04-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3873 Bug 18231: Improve support for function call nodes in SquirrelFish
3874 <https://bugs.webkit.org/show_bug.cgi?id=18231>
3876 Use correct value of 'this' for function calls.
3879 (KJS::CodeBlock::dump):
3880 * VM/CodeGenerator.cpp:
3881 (KJS::CodeGenerator::emitResolveBaseAndFunc):
3882 * VM/CodeGenerator.h:
3884 (KJS::resolveBaseAndFunc):
3885 (KJS::Machine::privateExecute):
3888 (KJS::FunctionCallResolveNode::emitCode):
3890 2008-04-10 Geoffrey Garen <ggaren@apple.com>
3894 * kjs/interpreter.cpp:
3895 (KJS::Interpreter::evaluate):
3897 2008-04-10 Geoffrey Garen <ggaren@apple.com>
3899 Reviewed by Sam Weinig.
3901 Fixed Interpreter::execute to honor the new model for returning non-NULL
3902 values when an exception is thrown.
3904 * kjs/interpreter.cpp:
3905 (KJS::Interpreter::evaluate):
3907 2008-04-10 Oliver Hunt <oliver@apple.com>
3911 Fix SquirrelFish interpreter to pass internal exceptions back to
3912 native code correctly.
3914 * JavaScriptCore.xcodeproj/project.pbxproj:
3916 (KJS::Machine::privateExecute):
3918 2008-04-10 Sam Weinig <sam@webkit.org>
3920 Reviewed by Geoffrey Garen.
3922 Replace the use of getCallData in op_construct with the new
3923 getConstructData function that replaces implementsConstruct.
3925 * API/JSCallbackConstructor.cpp:
3926 (KJS::JSCallbackConstructor::getConstructData):
3927 * API/JSCallbackConstructor.h:
3928 * API/JSCallbackObject.h:
3929 * API/JSCallbackObjectFunctions.h:
3930 (KJS::::getConstructData):
3932 * API/JSObjectRef.cpp:
3933 (JSObjectIsConstructor):
3934 * JavaScriptCore.exp:
3935 * JavaScriptCore.xcodeproj/project.pbxproj:
3937 (KJS::Machine::privateExecute):
3939 * kjs/ConstructData.h: Copied from JavaScriptCore/kjs/CallData.h.
3941 * kjs/array_object.cpp:
3942 (KJS::ArrayObjectImp::getConstructData):
3943 * kjs/array_object.h:
3944 * kjs/bool_object.cpp:
3945 (KJS::BooleanObjectImp::getConstructData):
3946 * kjs/bool_object.h:
3947 * kjs/date_object.cpp:
3948 (KJS::DateObjectImp::getConstructData):
3949 * kjs/date_object.h:
3950 * kjs/error_object.cpp:
3951 (KJS::ErrorObjectImp::getConstructData):
3952 (KJS::NativeErrorImp::getConstructData):
3953 * kjs/error_object.h:
3955 (KJS::FunctionImp::getCallData):
3956 (KJS::FunctionImp::getConstructData):
3957 (KJS::FunctionImp::construct):
3959 * kjs/function_object.cpp:
3960 (KJS::FunctionObjectImp::getConstructData):
3961 * kjs/function_object.h:
3963 (KJS::NewExprNode::inlineEvaluate):
3964 * kjs/number_object.cpp:
3965 (KJS::NumberObjectImp::getConstructData):
3966 * kjs/number_object.h:
3969 * kjs/object_object.cpp:
3970 (KJS::ObjectObjectImp::getConstructData):
3971 * kjs/object_object.h:
3972 * kjs/regexp_object.cpp:
3973 (KJS::RegExpObjectImp::getConstructData):
3974 * kjs/regexp_object.h:
3975 * kjs/string_object.cpp:
3976 (KJS::StringObjectImp::getConstructData):
3977 * kjs/string_object.h:
3979 (KJS::JSCell::getConstructData):
3981 (KJS::JSValue::getConstructData):
3983 2008-04-10 Oliver Hunt <oliver@apple.com>
3987 Bug 18420: SquirrelFish: need to throw Reference and Type errors
3988 when attempting invalid operations on JSValues
3990 Add validation and exception checks to SquirrelFish so that the
3991 correct exceptions are thrown for undefined variables, type errors
3992 and toObject failure. Also handle exceptions thrown by native
3995 * JavaScriptCore.xcodeproj/project.pbxproj:
3996 * VM/ExceptionHelpers.cpp: Added.
3999 (KJS::createUndefinedVariableError):
4000 * VM/ExceptionHelpers.h: Added.
4004 Modified to signal failure
4006 Wrapper for JSValue::isObject and exception creation (these need
4007 to be merged, lest GCC go off the deep end)
4008 (KJS::Machine::privateExecute):
4009 Adding the many exception and validity checks.
4011 * kjs/JSNotAnObject.cpp: Added.
4012 Stub object used to reduce the need for multiple exception checks
4013 when toObject fails.
4014 (KJS::JSNotAnObject::toPrimitive):
4015 (KJS::JSNotAnObject::getPrimitiveNumber):
4016 (KJS::JSNotAnObject::toBoolean):
4017 (KJS::JSNotAnObject::toNumber):
4018 (KJS::JSNotAnObject::toString):
4019 (KJS::JSNotAnObject::toObject):
4020 (KJS::JSNotAnObject::mark):
4021 (KJS::JSNotAnObject::getOwnPropertySlot):
4022 (KJS::JSNotAnObject::put):
4023 (KJS::JSNotAnObject::deleteProperty):
4024 (KJS::JSNotAnObject::defaultValue):
4025 (KJS::JSNotAnObject::construct):
4026 (KJS::JSNotAnObject::callAsFunction):
4027 (KJS::JSNotAnObject::getPropertyNames):
4028 * kjs/JSNotAnObject.h: Added.
4029 (KJS::JSNotAnObject::JSNotAnObject):
4030 * kjs/JSImmediate.cpp:
4031 (KJS::JSImmediate::toObject):
4032 modified to create an JSNotAnObject rather than throwing an exception
4035 2008-04-10 Geoffrey Garen <ggaren@apple.com>
4037 Reviewed by Oliver Hunt.
4039 Pass a function body node its function's scope chain, rather than the
4040 current execution context's scope chain, when compiling it.
4042 This doesn't matter yet, but it will once we start using the scope
4043 chain during compilation.
4045 sunspider --squirrelfish notes a tiny speedup.
4048 (KJS::Machine::privateExecute):
4050 2008-04-10 Geoffrey Garen <ggaren@apple.com>
4052 Reviewed by Oliver Hunt.
4054 Fix two bugs when throwing exceptions from re-entrant JS calls:
4056 (1) Don't shrink the register file to 0, since our caller may still
4059 (2) In case of exception, return jsNull() instead of 0 because,
4060 surprisingly, some JavaScriptCore clients rely on a function's return
4061 value being safe to operate on even if the function threw an exception.
4065 - Changed FunctionImp::callAsFunction to honor the new semantics of
4066 exceptions not returning 0.
4068 - Renamed "handlerPC" to "handlerVPC" to match other uses of "VPC".
4070 - Renamed "exceptionData" to "exceptionValue", because "data" seemed to
4071 imply something more than just a JSValue.
4073 - Merged prepareException into throwException, since throwException was
4074 its only caller, and it seemed weird that throwException didn't take
4075 an exception as an argument.
4077 sunspider --squirrelfish does not seem to complain on my machine, but it
4078 complains a little (.6%) on Oliver's.
4080 2008-04-10 Geoffrey Garen <ggaren@apple.com>
4082 Reviewed by Maciej Stachowiak.
4084 Fixed op_construct for CallTypeNative to reacquire "r" before setting
4085 its return value, since registerBase can theoretically change during the
4086 execution of arbitrary code. (Not sure if any native constructors
4087 actually make this possible.)
4089 sunspider --squirrelfish does not seem to complain.
4092 (KJS::Machine::privateExecute):
4094 2008-04-10 Geoffrey Garen <ggaren@apple.com>
4096 Reviewed by Oliver Hunt and Sam Weinig.
4098 Re-entrant execution of function code (global code -> built-in function
4101 Miraculously, sunspider --squirrelfish does not seem to complain.
4103 A re-entrant function call is the same as a normal function call with
4104 one exception: the re-entrant call leaves everything except for
4105 CallerCodeBlock in the call frame header uninitialized, since the call
4106 doesn't need to return to JS code. (It sets CallerCodeBlock to 0, to
4107 indicate that the call shouldn't return to JS code.)
4109 Also fixed a few issues along the way:
4111 - Fixed two bugs in the read-write List implementation that caused
4112 m_size and m_buffer to go stale.
4114 - Changed native call code to update "r" *before* setting the return
4115 value, since the call may in turn call JS code, which changes the value
4118 - Migrated initialization of "r" outside of Machine::privateExecute,
4119 because global code and function code initialize "r" differently.
4121 - Migrated a codegen warning from Machine::privateExecute to the wiki.
4123 - Removed unnecessary "r" parameter from slideRegisterWindowForCall
4126 (KJS::slideRegisterWindowForCall):
4127 (KJS::scopeChainForCall):
4128 (KJS::Machine::execute):
4129 (KJS::Machine::privateExecute):
4132 (KJS::FunctionImp::callAsFunction):
4134 (KJS::List::getSlice):
4138 2008-04-10 Maciej Stachowiak <mjs@apple.com>
4142 - fix problem with code generation for return with no argument
4147 (KJS::ReturnNode::emitCode):
4149 2008-04-10 Maciej Stachowiak <mjs@apple.com>
4153 - Implement support for JS constructors
4155 access-binary-trees and access-nbody now run.
4157 Inexplicably a 1% speedup.
4160 (KJS::initializeCallFrame):
4161 (KJS::Machine::privateExecute):
4165 2008-04-10 Maciej Stachowiak <mjs@apple.com>
4169 - More code cleanup in preparation for JS constructors
4171 Factor the remaining interesting parts of JS function calls into
4172 slideRegisterWindowForCall and scopeChainForCall.
4175 (KJS::slideRegisterWindowForCall):
4176 (KJS::scopeChainForCall):