1 2008-05-22 Oliver Hunt <oliver@apple.com>
5 Don't leak the SymbolTable when compiling eval code.
8 (KJS::EvalNode::generateCode):
10 2008-05-22 Simon Hausmann <hausmann@webkit.org>
16 * JavaScriptCore.pri: Added DebuggerCallFrame to the build.
17 * VM/LabelID.h: Include limits.h for UINT_MAX.
18 * wtf/VectorTraits.h: Include memory for std::auto_ptr.
20 2008-05-22 Geoffrey Garen <ggaren@apple.com>
22 Reviewed by Adam Roben.
24 Removed the old recursion guard mechanism, since squirrelfish has its
25 own mechanism. Also removed some old JS call tracing code, since we
26 have other ways to do that, too.
28 SunSpider reports no change.
31 (KJS::JSObject::call):
33 2008-05-22 Maciej Stachowiak <mjs@apple.com>
37 - fixed <rdar://problem/5954979> crash on celtic kane JS benchmark
40 (KJS::WithNode::emitCode):
41 (KJS::TryNode::emitCode):
43 2008-05-21 Kevin McCullough <kmccullough@apple.com>
45 Reviewed by Maciej and Geoff.
47 <rdar://problem/5951561> Turn on JavaScript Profiler
48 -As part of the effort to turn on the profiler it would be helpful if it
49 did not need ExecStates to represent the stack location of the currently
51 -We now create each node as necessary with a reference to the current
52 node and each node knows its parent so that the tree can be made without
55 * profiler/Profile.cpp:
56 (KJS::Profile::Profile): The current node starts at the head.
57 (KJS::Profile::stopProfiling): The current node is cleared when profiling
59 (KJS::Profile::willExecute): The current node either adds a new child or
60 starts and returns a reference to an already existing child if the call
61 ID that is requested already exists.
62 (KJS::Profile::didExecute): The current node finishes and returns its
64 * profiler/Profile.h: Use a single callIdentifier instead of a vector
65 since we no longer use the whole stack.
66 * profiler/ProfileNode.cpp: Now profile nodes keep a reference to their
68 (KJS::ProfileNode::ProfileNode): Initialize the parent.
69 (KJS::ProfileNode::didExecute): Record the time and return the parent.
70 (KJS::ProfileNode::addOrStartChild): If the given callIdentifier is
71 already a child, start it and return it, otherwise create a new one and
73 (KJS::ProfileNode::stopProfiling): Same logic, just use the new function.
74 * profiler/ProfileNode.h: Utilize the parent.
75 (KJS::ProfileNode::create):
76 (KJS::ProfileNode::parent):
77 * profiler/Profiler.cpp:
78 (KJS::Profiler::startProfiling): Here is the only place where the
79 ExecState is used to figure out where in the stack the profiler is
81 (KJS::dispatchFunctionToProfiles): Only send one CallIdentifier instead
83 (KJS::Profiler::willExecute): Ditto.
84 (KJS::Profiler::didExecute): Ditto.
85 (KJS::createCallIdentifier): Create only one CallIdentifier.
86 (KJS::createCallIdentifierFromFunctionImp): Ditto.
87 * profiler/Profiler.h:
89 2008-05-21 Darin Adler <darin@apple.com>
93 - https://bugs.webkit.org/show_bug.cgi?id=19180
94 speed up the < operator for the case when both values are integers
96 Makes standalone SunSpider 1.022x faster.
99 (KJS::jsLess): Add a special case for when both are numbers that fit in a JSImmediate.
101 2008-05-21 Maciej Stachowiak <mjs@apple.com>
103 Reviewed by Oliver and Sam.
105 - fixed <rdar://problem/5815631> REGRESSION (r31239): Multiscope optimisation of function calls results in incorrect this value (breaks tvtv.de)
107 Track global this value in the scope chain so we can retrieve it
108 efficiently but it follows lexical scope properly.
111 (KJS::ExecState::globalThisValue):
112 * kjs/JSGlobalObject.h:
113 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
114 * kjs/function_object.cpp:
115 (KJS::FunctionObjectImp::construct):
117 (KJS::ScopeChainNode::ScopeChainNode):
118 (KJS::ScopeChainNode::globalThisObject):
119 (KJS::ScopeChainNode::push):
120 (KJS::ScopeChain::ScopeChain):
122 2008-05-21 Kevin McCullough <kmccullough@apple.com>
128 2008-05-21 Kevin McCullough <kmccullough@apple.com>
132 <rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
134 - This patch updatest the times of the visible nodes correctly, but to do
135 so, some of the design of the ProfileNode changed.
137 * JavaScriptCore.exp: export focus' symbol.
138 * profiler/Profile.cpp: ProfileNodes now take a reference to the head of
139 the profile tree to get up-to-date accurate total profile time.
140 (KJS::Profile::Profile): Pass 0 for the head node.
141 (KJS::Profile::stopProfiling): stopProfiling no longer needs the time
142 passed into it, since it can get it from the head and it does not need to
143 be told it is the head because it can figure it out on it's own.
144 (KJS::Profile::willExecute): Set the head node for each created node.
145 * profiler/Profile.h:
146 (KJS::Profile::focus): Instead of taking a CallIdentifier that the caller
147 would have to create, now focus() takes a ProfileNode that they should
148 already have a reference to and focus() can extract the CallIdentifier
150 * profiler/ProfileNode.cpp: Create actual and visible versions fo the
151 total and self times for focus and exclude. Also add a head node
152 reference so that nodes can get information from their head.
153 (KJS::ProfileNode::ProfileNode):
154 (KJS::ProfileNode::stopProfiling): Rename the total and self time
155 variables and set the visual ones to the actual ones, so that without any
156 changes to the visual versions of these variables, their times will match
158 (KJS::ProfileNode::focus): Now focus() has a bool to force it's children
159 to be visible if this node is visible. If this node does not match the
160 CallIdentifier being focused then the visibleTotalTime is only updated if
161 one or more of it's children is the CallIdentifier being focused.
162 (KJS::ProfileNode::restoreAll): Restores all variables with respect to
163 the visible data in the ProfileNode.
164 (KJS::ProfileNode::endAndRecordCall): Name change.
165 (KJS::ProfileNode::debugPrintData): Dump the new variables.
166 (KJS::ProfileNode::debugPrintDataSampleStyle): Name change.
167 * profiler/ProfileNode.h: Use the new variables and reference to the head
169 (KJS::ProfileNode::create):
170 (KJS::ProfileNode::totalTime):
171 (KJS::ProfileNode::setTotalTime):
172 (KJS::ProfileNode::selfTime):
173 (KJS::ProfileNode::setSelfTime):
174 (KJS::ProfileNode::totalPercent):
175 (KJS::ProfileNode::selfPercent):
176 (KJS::ProfileNode::setVisible):
178 2008-05-21 Alp Toker <alp@nuanti.com>
180 GTK+/UNIX testkjs build fix. Include signal.h.
184 2008-05-21 Oliver Hunt <oliver@apple.com>
186 Reviewed by NOBODY (Build fix).
188 Yet more windows build fixes
190 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
192 2008-05-21 Oliver Hunt <oliver@apple.com>
194 Reviewed by NOBODY (Build fix).
196 Yet more windows build fixes
198 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
200 2008-05-21 Alp Toker <alp@nuanti.com>
202 GTK+ build fix. Add DebuggerCallFrame.cpp and take AllInOneFile.cpp
203 changes into account.
207 2008-05-21 Oliver Hunt <oliver@apple.com>
209 Reviewed by NOBODY (Build fix).
211 Add DebuggerCallFrame.{h,cpp} to the project file
213 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
215 2008-05-21 Alp Toker <alp@nuanti.com>
217 GTK+ port build fixes following squirrelfish merge r33979.
221 2008-05-21 Maciej Stachowiak <mjs@apple.com>
225 - save a hash lookup wne writing to global properties
226 0.3% speedup on SunSpider, 7% on bitops-bitwise-and
229 (KJS::resolveBase): Check for being a the end of the scope chain
232 2008-05-21 Alp Toker <alp@nuanti.com>
234 Rubber-stamped by Maciej.
236 Replace non-standard #pragma marks with comments to avoid compiler
239 * profiler/ProfileNode.cpp:
241 2008-05-21 Geoffrey Garen <ggaren@apple.com>
243 Reviewed by Mark Rowe.
245 Fix layout test failure in fast/dom/getter-on-window-object2 introduced in r33961.
247 * JavaScriptCore.exp:
248 * kjs/JSGlobalObject.cpp:
249 (KJS::JSGlobalObject::defineGetter):
250 (KJS::JSGlobalObject::defineSetter):
251 * kjs/JSGlobalObject.h:
253 === End merge of squirrelfish ===
255 2008-05-21 Geoffrey Garen <ggaren@apple.com>
257 Reviewed by Tim Hatcher.
259 Merged with trunk WebCore's new debugger.
261 * kjs/DebuggerCallFrame.cpp:
262 (KJS::DebuggerCallFrame::evaluate): Changed this function to separate
263 the exception value from the return value. The WebKit debugger treats
264 them as one, but the WebCore debugger doesn't.
266 * kjs/DebuggerCallFrame.h:
267 (KJS::DebuggerCallFrame::dynamicGlobalObject): Added a new accessor for
268 the dynamic global object, since the debugger doesn't want the lexical
271 2008-05-21 Oliver Hunt <oliver@apple.com>
275 Bug 19116: SquirrelFish shouldn't regress on variable lookups
276 <https://bugs.webkit.org/show_bug.cgi?id=19116>
278 Optimise cross scope assignment, 0.4% progression in sunspider.
281 (KJS::CodeBlock::dump):
282 * VM/CodeGenerator.cpp:
283 (KJS::CodeGenerator::emitPutScopedVar):
284 * VM/CodeGenerator.h:
286 (KJS::Machine::privateExecute):
289 (KJS::AssignResolveNode::emitCode):
291 2008-05-21 Maciej Stachowiak <mjs@apple.com>
295 - check property map before symbol table in JSGlobalObject::getOwnPropertySlot
296 0.5% speedup on SunSpider
298 * kjs/JSGlobalObject.h:
299 (KJS::JSGlobalObject::getOwnPropertySlot): Check property map before symbol table
300 because symbol table access is likely to have been optimized.
302 2008-05-21 Oliver Hunt <oliver@apple.com>
306 Bug 19116: SquirrelFish shouldn't regress on variable lookups
307 <https://bugs.webkit.org/show_bug.cgi?id=19116>
309 Optimise multiscope lookup of statically resolvable function calls.
310 SunSpider reports a 1.5% improvement, including 37% on
311 controlflow-recursive for some reason :D
314 (KJS::CodeBlock::dump):
315 * VM/CodeGenerator.cpp:
316 (KJS::CodeGenerator::emitResolve):
317 * VM/CodeGenerator.h:
319 (KJS::FunctionCallResolveNode::emitCode):
321 2008-05-21 Maciej Stachowiak <mjs@apple.com>
325 - give JSGlobalObject a special version of getOwnPropertySlot that tells you if the slot is directly writable
326 (WebCore change using this is a 2.6% speedup on in-browser SunSpider).
328 * JavaScriptCore.exp:
329 * kjs/JSGlobalObject.h:
330 (KJS::JSGlobalObject::getOwnPropertySlot):
331 * kjs/JSVariableObject.h:
332 (KJS::JSVariableObject::symbolTableGet):
334 (KJS::JSObject::getDirectLocation):
335 (KJS::JSObject::getOwnPropertySlotForWrite):
336 * kjs/property_map.cpp:
337 (KJS::PropertyMap::getLocation):
338 * kjs/property_map.h:
339 * kjs/property_slot.h:
340 (KJS::PropertySlot::putValue):
342 2008-05-20 Oliver Hunt <oliver@apple.com>
346 Bug 19116: SquirrelFish shouldn't regress on variable lookups
347 <https://bugs.webkit.org/show_bug.cgi?id=19116>
349 This restores multiscope optimisation to simple resolve, producing
350 a 2.6% progression in SunSpider. Have verified that none of the
351 sites broken by the multiscope optimisation in trunk were effected
355 (KJS::CodeBlock::dump):
357 (KJS::CodeBlock::CodeBlock):
358 * VM/CodeGenerator.cpp:
359 (KJS::CodeGenerator::findScopedProperty):
360 (KJS::CodeGenerator::emitResolve):
361 * VM/CodeGenerator.h:
364 (KJS::Machine::privateExecute):
366 * kjs/JSVariableObject.h:
368 2008-05-20 Oliver Hunt <oliver@apple.com>
370 Reviewed by NOBODY (Build fix).
372 Fixerate the windows build.
374 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
375 * VM/CodeGenerator.cpp:
377 * kjs/JSGlobalObject.h:
381 2008-05-20 Oliver Hunt <oliver@apple.com>
385 Bug 19110: SquirrelFish: Google Maps - no maps
386 <https://bugs.webkit.org/show_bug.cgi?id=19110>
388 Correct a comedy of errors present in my original patch to "fix"
389 exceptions occurring midway through pre and post increment. This
390 solution is cleaner than the original, doesn't need the additional
391 opcodes, and as an added benefit does not break Google Maps.
393 Sunspider reports a 0.4% progression.
396 (KJS::CodeBlock::dump):
397 * VM/CodeGenerator.cpp:
398 * VM/CodeGenerator.h:
400 (KJS::Machine::privateExecute):
403 (KJS::PreIncResolveNode::emitCode):
404 (KJS::PreDecResolveNode::emitCode):
405 (KJS::PreIncBracketNode::emitCode):
406 (KJS::PreDecBracketNode::emitCode):
407 (KJS::PreIncDotNode::emitCode):
408 (KJS::PreDecDotNode::emitCode):
410 2008-05-20 Maciej Stachowiak <mjs@apple.com>
414 - inline JSGlobalObject::getOwnPropertySlot
415 1% improvement on in-browser SunSpider (a wash command-line)
417 * kjs/JSGlobalObject.cpp:
418 * kjs/JSGlobalObject.h:
419 (KJS::JSGlobalObject::getOwnPropertySlot):
421 2008-05-18 Oliver Hunt <oliver@apple.com>
425 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
426 <https://bugs.webkit.org/show_bug.cgi?id=18752>
428 Handle exceptions thrown by toString conversion in subscript operators,
429 this should basically complete exception handling in SquirrelFish.
431 Sunspider reports no regression.
434 (KJS::Machine::privateExecute):
436 2008-05-17 Geoffrey Garen <ggaren@apple.com>
438 Reviewed by Oliver Hunt.
440 [Reapplying patch with previously missing files from r33553 -- Oliver]
444 SunSpider reports no change.
446 * JavaScriptCore.xcodeproj/project.pbxproj: Added DebuggerCallFrame.h/.cpp,
447 and created a debugger folder.
449 * VM/CodeGenerator.cpp:
450 (KJS::CodeGenerator::generate): If the debugger is attached, always
451 generate full scope chains for its sake.
454 (KJS::Machine::unwindCallFrame): Notify the debugger when unwinding
455 due to an exception, so it doesn't keep stale call frames around.
457 (KJS::Machine::execute): Set Callee to 0 in eval frames, so the
458 debugger can distinguish them from function call frames.
460 (KJS::Machine::debug): Simplified this function, since the debugger
461 doesn't actually need all the information we used to provide.
463 (KJS::Machine::privateExecute): Treat debugging hooks like other function
464 calls, so the code we hook into (the debugger UI) can be optimized.
466 * kjs/debugger.cpp: Nixed these default callback implementations and
467 made the callbacks pure virtual instead, so the compiler could tell me
468 if I made a mistake in one of the subclasses.
470 * kjs/debugger.h: Removed a bunch of irrelevent data from the debugger
471 callbacks. Changed from passing an ExecState* to passing a
472 DebuggerCallFrame*, since an ExecState* doesn't contain sufficient
476 (KJS::globalFuncEval): Easiest bug fix evar!
478 [Previously missing files from r33553]
479 * kjs/DebuggerCallFrame.cpp: Copied from JavaScriptCore/profiler/FunctionCallProfile.h.
480 (KJS::DebuggerCallFrame::functionName):
481 (KJS::DebuggerCallFrame::thisObject):
482 (KJS::DebuggerCallFrame::evaluateScript):
483 * kjs/DebuggerCallFrame.h: Copied from JavaScriptCore/VM/Register.h.
484 (KJS::DebuggerCallFrame::DebuggerCallFrame):
485 (KJS::DebuggerCallFrame::scopeChain):
486 (KJS::DebuggerCallFrame::exception):
488 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
492 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
493 <https://bugs.webkit.org/show_bug.cgi?id=18991>
495 Fix the last remaining blocking cases of this bug.
499 (KJS::ReadModifyResolveNode::emitCode):
501 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
507 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
508 <https://bugs.webkit.org/show_bug.cgi?id=18991>
510 Ensure that the code generated for assignments uses temporaries whenever
511 necessary. This patch covers the vast majority of situations, but there
512 are still a few left.
514 This patch also adds some missing cases to CodeBlock::dump().
517 (KJS::CodeBlock::dump):
518 * VM/CodeGenerator.h:
519 (KJS::CodeGenerator::destinationForAssignResult):
520 (KJS::CodeGenerator::leftHandSideNeedsCopy):
521 (KJS::CodeGenerator::emitNodeForLeftHandSide):
525 (KJS::AssignDotNode::emitCode):
526 (KJS::ReadModifyDotNode::emitCode):
527 (KJS::AssignBracketNode::emitCode):
528 (KJS::ReadModifyBracketNode::emitCode):
529 (KJS::ForInNode::ForInNode):
531 (KJS::ReadModifyResolveNode::):
532 (KJS::AssignResolveNode::):
533 (KJS::ReadModifyBracketNode::):
534 (KJS::AssignBracketNode::):
535 (KJS::AssignDotNode::):
536 (KJS::ReadModifyDotNode::):
538 2008-05-17 Oliver Hunt <oliver@apple.com>
542 Bug 19106: SquirrelFish: Activation is not marked correctly
543 <https://bugs.webkit.org/show_bug.cgi?id=19106>
545 We can't rely on the symbol table for a count of the number of globals
546 we need to mark as that misses duplicate parameters and 'this'. Now we
547 use the actual local register count from the codeBlock.
549 * kjs/JSActivation.cpp:
550 (KJS::JSActivation::mark):
552 2008-05-16 Oliver Hunt <oliver@apple.com>
556 Bug 19076: SquirrelFish: RegisterFile can be corrupted if implictly reenter global scope with no declared vars
557 <https://bugs.webkit.org/show_bug.cgi?id=19076>
559 Don't delay allocation of initial global RegisterFile, as we can't guarantee we will be able
560 to allocate the global 'this' register safely at any point after initialisation of the Global
563 Unfortunately this initial allocation caused a regression of 0.2-0.3%, however this patch adds
564 support for the static slot optimisation for the global Math object which brings it to a 0.3%
567 * VM/CodeGenerator.cpp:
568 (KJS::CodeGenerator::programCodeThis):
569 (KJS::CodeGenerator::CodeGenerator):
570 (KJS::CodeGenerator::addParameter):
571 * VM/CodeGenerator.h:
573 (KJS::Machine::execute):
575 * kjs/JSGlobalObject.cpp:
576 (KJS::JSGlobalObject::reset):
577 * kjs/JSGlobalObject.h:
578 (KJS::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
579 (KJS::JSGlobalObject::addStaticGlobals):
582 2008-05-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
584 Reviewed by Oliver Hunt.
586 Bug 19098: SquirrelFish: Ref'd temporaries can be clobbered
587 <https://bugs.webkit.org/show_bug.cgi?id=19098>
589 When doing code generation for a statement list, increase the reference
590 count on a register that might eventually be returned, so that it doesn't
591 get clobbered by a request for a new temporary.
594 (KJS::statementListEmitCode):
596 2008-05-16 Maciej Stachowiak <mjs@apple.com>
600 - fixed Bug 19044: SquirrelFish: Bogus values enter evaluation when closing over scope with parameter and var with same name
601 https://bugs.webkit.org/show_bug.cgi?id=19044
603 * kjs/JSActivation.cpp:
604 (KJS::JSActivation::copyRegisters): Use numLocals from the code
605 block rather than the size of the symbol table for the number of
606 registers to copy, to account for duplicate parameters and vars
607 with the same name as parameters (we still have potentially
608 suboptimal codegen in that we allocate a local register for the
609 var in the latter case but it is never used).
611 2008-05-15 Geoffrey Garen <ggaren@apple.com>
615 We regret to inform you that your program is crashing because you were
619 (KJS::Machine::privateExecute): Math is hard.
621 2008-05-14 Geoffrey Garen <ggaren@apple.com>
623 Reviewed by Oliver Hunt.
625 A little more debugger action: filled in op_debug. All debugger control
626 flow works now, but variable inspection and backtraces still don't.
628 SunSpider reports no change.
630 * VM/CodeGenerator.cpp: Changed op_debug to accept line number parameters.
633 (KJS::Machine::getFunctionAndArguments): Moved op_debug into a
634 NEVER_INLINE function to avoid a stunning 10% performance regression.
635 Also factored out a common function for retrieving the function and
636 arguments from a call frame.
638 * kjs/JSActivation.cpp:
639 (KJS::JSActivation::createArgumentsObject): Use the new factored out
640 function mentioned above.
643 (KJS::Parser::parse): Increment m_sourceId before assigning it, so the
644 sourceId we send to the debugger matches the sourceId recorded in the
647 * kjs/nodes.cpp: Emit debugging hooks.
649 2008-05-14 Oliver Hunt <oliver@apple.com>
653 Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
654 <https://bugs.webkit.org/show_bug.cgi?id=19024>
656 This fixes a number of issues. The most important is that we now check every register
657 file for tainting rather than just looking for function register files as that was
658 insufficient. Additionally guarded against implicit re-entry into Eval code.
660 Also added a few additional assertions to reduce the amout of time between something
661 going wrong and us seeing the error.
664 (KJS::Machine::execute):
665 (KJS::Machine::privateExecute):
666 * VM/RegisterFile.cpp:
667 (KJS::RegisterFile::growBuffer):
668 (KJS::RegisterFile::addGlobalSlots):
669 * VM/RegisterFileStack.cpp:
670 (KJS::RegisterFileStack::pushGlobalRegisterFile):
671 (KJS::RegisterFileStack::pushFunctionRegisterFile):
672 * VM/RegisterFileStack.h:
673 (KJS::RegisterFileStack::inImplicitCall):
675 2008-05-14 Geoffrey Garen <ggaren@apple.com>
677 Reviewed by Oliver Hunt.
679 A little more debugger action: emit opcodes for debugger hooks. Right
680 now, the opcode implementation is just a stub.
682 SunSpider reports no change.
684 Some example codegen for "function f() { 1; }":
686 [ 0] dbg DidEnterCallFrame
687 [ 2] dbg WillExecuteStatement
688 [ 4] load tr0, 1(@k0)
689 [ 7] load tr0, undefined(@k1)
690 [ 10] dbg WillLeaveCallFrame
693 2008-05-14 Oliver Hunt <oliver@apple.com>
697 Bug 19025: SQUIRRELFISH: malformed syntax in onload handler causes crash
698 <https://bugs.webkit.org/show_bug.cgi?id=19025>
700 Simple fix -- move the use of functionBodyNode to after the null check.
702 * kjs/function_object.cpp:
703 (KJS::FunctionObjectImp::construct):
705 2008-05-13 Geoffrey Garen <ggaren@apple.com>
707 Reviewed by Oliver Hunt.
709 Fixed a codegen crash with run-time parse errors.
711 SunSpider reports no change.
713 emitThrowError needs to return the temporary holding the error, not dst,
714 since dst may be NULL. In fact, emitThrowError shouldn't take a dst
715 parameter at all, since exceptions should not modify the destination
718 2008-05-13 Oliver Hunt <oliver@apple.com>
722 Bug 19027: SquirrelFish: Incorrect codegen for pre-increment
723 <https://bugs.webkit.org/show_bug.cgi?id=19027>
725 This fixes the codegen issues for the pre-inc/decrement operators
726 to prevent incorrectly clobbering the destination in the event of
730 (KJS::CodeBlock::dump):
731 * VM/CodeGenerator.cpp:
732 (KJS::CodeGenerator::emitPreInc):
733 (KJS::CodeGenerator::emitPreDec):
734 * VM/CodeGenerator.h:
736 (KJS::Machine::privateExecute):
739 (KJS::PreIncResolveNode::emitCode):
740 (KJS::PreDecResolveNode::emitCode):
741 (KJS::PreIncBracketNode::emitCode):
742 (KJS::PreDecBracketNode::emitCode):
743 (KJS::PreIncDotNode::emitCode):
744 (KJS::PreDecDotNode::emitCode):
746 2008-05-13 Geoffrey Garen <ggaren@apple.com>
748 Reviewed by Oliver Hunt.
750 A little more debugger action: supply a real line number, sourceId,
751 and sourceURL in op_new_error.
753 SunSpider reports a .2% speedup. Not sure what that's about.
756 (KJS::Machine::privateExecute): Use the new good stuff in op_new_error.
759 (KJS::RegExpNode::emitCode): Use the shared emitThrowError instead of
762 2008-05-13 Geoffrey Garen <ggaren@apple.com>
764 Reviewed by Oliver Hunt.
766 A little more debugger action: implemented the exception callback.
768 SunSpider reports a .2% speedup. Not sure what that's about.
770 * VM/CodeBlock.h: A little refactoring here. Store a pointer to our
771 owner ScopeNode so we can retrieve data from it. This allows us to
772 stop storing copies of the data ourselves. Also, store a "this" register
773 instead of a code type, since we were only using the code type to
774 calculate the "this" register.
776 * VM/CodeGenerator.cpp:
777 (KJS::CodeGenerator::generate): Calculate the "this" register mentioned
778 above. Also, take care of removing "this" from the symbol table after
779 codegen is done, since relying on the timing of a destructor for correct
780 behavior is not so good.
783 (KJS::Machine::throwException): Invoke the debugger's exception callback.
784 (KJS::Machine::privateExecute): Use the "this" register mentioned above.
786 2008-05-13 Geoffrey Garen <ggaren@apple.com>
788 Reviewed by Oliver Hunt.
790 Removed some unused exception machinery.
792 SunSpider reports a .3% speedup.
794 * API/JSCallbackObject.h:
795 * API/JSCallbackObjectFunctions.h:
796 * JavaScriptCore.exp:
798 (KJS::Machine::privateExecute):
804 2008-05-13 Geoffrey Garen <ggaren@apple.com>
806 Reviewed by Oliver Hunt.
808 A little more debugger action.
811 * kjs/debugger.h: Removed debuggersPresent because it was unused.
812 Replaced AttachedGlobalObject linked list with a HashSet because HashSet
813 is faster and simpler. Changed all functions to return void instead of
814 bool, because no clients ever return false, and we don't want to support
817 * kjs/nodes.cpp: Did some up-keep to avoid build bustage.
818 (KJS::Node::handleException):
819 (KJS::BreakpointCheckStatement::execute):
820 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
822 2008-05-13 Oliver Hunt <oliver@apple.com>
826 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
827 <https://bugs.webkit.org/show_bug.cgi?id=18752>
829 Replace old attempt at "branchless" exceptions as the extra information
830 being passed made gcc an unhappy compiler, replacing these custom toNumber
831 calls with ordinary toNumber logic (by relying on toNumber now preventing
832 side effects after an exception has been thrown) provided sufficient leeway
833 to add the additional checks for the remaining unchecked cases.
835 This leaves only toString conversions in certain contexts as possibly
841 (KJS::resolveBaseAndProperty):
842 (KJS::resolveBaseAndFunc):
843 (KJS::Machine::privateExecute):
846 (KJS::JSValue::safeGetNumber):
848 2008-05-13 Geoffrey Garen <ggaren@apple.com>
850 Reviewed by Oliver Hunt.
852 First steps toward supporting the debugger API: support the sourceParsed
853 callback; plus some minor fixups.
855 SunSpider reports no regression.
857 * VM/CodeGenerator.h: Removed a misleading comment.
859 * kjs/Parser.h: Changed the parser to take an ExecState*, so it can
860 implement the sourceParsed callback -- that way, we only have to
861 implement the callback in one place.
863 * kjs/debugger.cpp: Nixed DebuggerImp, because its sole purpose in life
864 was to demonstrate the misapplication of design patterns.
866 * kjs/debugger.h: Changed sourceParsed to take a SourceProvider, to
867 reduce copying, and not to return a value, because pausing execution
868 after parsing is complicated, and no clients needed that ability, anyway.
870 * kjs/grammar.y: Make sure never to pass a NULL SourceElements* to
871 didFinishParsing -- that simplifies some code down the road.
873 * kjs/nodes.cpp: Don't generate special AST nodes just because the
874 debugger is attached -- that's a relic of the old AST execution model,
875 and those nodes haven't been maintained.
877 2008-05-13 Oliver Hunt <oliver@apple.com>
881 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
882 <https://bugs.webkit.org/show_bug.cgi?id=18752>
884 First step: prevent incorrect evaluation of valueOf/toString conversion
885 in right hand side of expression after earlier conversion throws.
887 * API/JSCallbackObjectFunctions.h:
890 (KJS::JSObject::defaultValue):
892 2008-05-12 Oliver Hunt <oliver@apple.com>
896 Bug 18934: SQUIRRELFISH: ASSERT @ nytimes.com due to RegisterFile being clobbered
897 <https://bugs.webkit.org/show_bug.cgi?id=18934>
899 Unfortunately we cannot create new statically optimised globals if there are any
900 tainted RegisterFiles on the RegisterFileStack. To handle this we re-introduce
901 (in a slightly cleaner form) the inImplicitCall concept to the RegisterFileStack.
904 (KJS::Machine::execute):
905 * VM/RegisterFileStack.cpp:
906 (KJS::RegisterFileStack::pushFunctionRegisterFile):
907 * VM/RegisterFileStack.h:
909 2008-05-12 Geoffrey Garen <ggaren@apple.com>
911 Reviewed by Maciej Stachowiak.
913 Introduced support for function.caller.
915 Improved support for walking interesting scopes for function introspection.
917 This fixes all remaining layout tests not blocked by rebasing to trunk.
919 SunSpider reports no change.
922 (KJS::Machine::dumpRegisters): Fixed a spacing issue.
924 2008-05-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
928 Bug 18961: SQUIRRELFISH: Gmail doesn't load
929 <https://bugs.webkit.org/show_bug.cgi?id=18961>
931 Fix codegen for logical nodes so that they don't use their destination
935 (KJS::LogicalAndNode::emitCode):
936 (KJS::LogicalOrNode::emitCode):
938 2008-05-10 Maciej Stachowiak <mjs@apple.com>
942 - JavaScriptCore part of fix for: "SQUIRRELFISH: function toString broken after calling"
943 https://bugs.webkit.org/show_bug.cgi?id=18869
945 Three layout tests are fixed:
946 fast/js/toString-elision-trailing-comma.html
947 fast/js/toString-prefix-postfix-preserve-parens.html
948 fast/js/kde/lval-exceptions.html
950 Functions now save a shared subrange of the original source used
951 to make them (so in the common case this adds no storage above the
954 * kjs/SourceProvider.h: Added.
955 (KJS::SourceProvider): New abstract base class for classes that provide on-demand access
956 to the source for a JavaScript program. This allows function objects to have access to their
957 original source without copying.
958 (KJS::UStringSourceProvider): SourceProvider subclass backed by a KJS::UString.
959 (KJS::UStringSourceProvider::create):
960 (KJS::UStringSourceProvider::getRange):
961 (KJS::UStringSourceProvider::data):
962 (KJS::UStringSourceProvider::length):
963 (KJS::UStringSourceProvider::UStringSourceProvider):
964 * kjs/SourceRange.h: Added.
965 (KJS::SourceRange::SourceRange): Class that holds a SourceProvider and a character range into
966 the source, to encapsulate on-demand access to the source of a function.
967 (KJS::SourceRange::toString):
969 (KJS::eval): Pass a UStringSourceProvider to the parser.
971 (KJS::Parser::parse): Take a SourceProvider and pass it on to the lexer.
973 (KJS::Parser::parse): Take a SourceProvider.
975 (KJS::Lexer::setCode): Take a SourceProvider; keep it around, and
976 use it to get the raw buffer and length.
978 (KJS::Lexer::sourceRange): Convenience function to get a source
979 range based on the lexer's source provieder, and char offsets
980 right before and after the desired range.
982 (KJS::globalFuncEval): Pass a UStringSourceProvider to the parser.
983 * kjs/function_object.cpp:
984 (KJS::functionProtoFuncToString): Use toSourceString to get the source.
985 (KJS::FunctionObjectImp::construct): Give the parser a UStringSourceProvider.
986 * kjs/grammar.y: When parsing a function declaration, function
987 expression, or getter or setter, tell the function body about its
989 * kjs/interpreter.cpp:
990 (KJS::Interpreter::checkSyntax): Pass a SourceProvider to the parser.
991 (KJS::Interpreter::evaluate): Pass a SourceProvider to the parser.
994 (KJS::FunctionBodyNode::setSource): Establish a SourceRange for this function.
995 (KJS::FunctionBodyNode::toSourceString): Get the source string out
997 (KJS::FuncExprNode::): Take a SourceRange and set it on the body.
998 (KJS::FuncDeclNode::): ditto
1000 (prettyPrintScript): Use a SourceProvider appropriately.
1001 * JavaScriptCore.exp: Export new symbols.
1002 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add new files.
1003 * JavaScriptCore.xcodeproj/project.pbxproj: Add new files.
1005 2008-05-09 Oliver Hunt <oliver@apple.com>
1009 Bring back RegisterFile tainting in order to correctly handle
1010 natively implemented getters and setters that re-enter JavaScript
1013 (KJS::Machine::privateExecute):
1014 * VM/RegisterFile.h:
1016 (KJS::FunctionImp::callAsFunction):
1018 (KJS::JSObject::put):
1019 (KJS::tryGetAndCallProperty):
1020 * kjs/property_slot.cpp:
1021 (KJS::PropertySlot::functionGetter):
1023 2008-05-09 Maciej Stachowiak <mjs@apple.com>
1027 - track character offsets of open and close braces, in preparation for saving function source
1029 I verified that there is no performance regression from this change.
1034 (KJS::Lexer::matchPunctuator):
1037 2008-05-09 Oliver Hunt <oliver@apple.com>
1039 Reviewed by Nobody (build fix).
1043 * kjs/JSGlobalObject.cpp:
1044 (KJS::JSGlobalObject::restoreLocalStorage):
1046 2008-05-09 Oliver Hunt <oliver@apple.com>
1050 Build fixes for SquirrelFish on windows.
1052 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1053 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
1055 * kjs/JSGlobalObject.cpp:
1056 (KJS::JSGlobalObject::restoreLocalStorage):
1057 * kjs/collector.cpp:
1058 (KJS::Collector::allocate):
1059 (KJS::Collector::allocateNumber):
1061 (KJS::Collector::allocate):
1062 (KJS::Collector::allocateNumber):
1063 * kjs/property_slot.cpp:
1065 2008-05-08 Maciej Stachowiak <mjs@apple.com>
1069 - fix activation tearoff in the case where functions are called with too many arguments
1072 fast/canvas/patternfill-repeat.html
1073 fast/dom/SelectorAPI/bug-17313.html
1076 (KJS::slideRegisterWindowForCall):
1077 (KJS::scopeChainForCall):
1078 (KJS::Machine::execute):
1079 (KJS::Machine::privateExecute):
1081 2008-05-08 Geoffrey Garen <ggaren@apple.com>
1083 Reviewed by Oliver Hunt.
1085 Fixed failure in fast/canvas/canvas-pattern-behaviour.html.
1087 SunSpider reports a small speedup. Not sure what that's about.
1090 (KJS::CodeBlock::dump): Fixed op_call_eval to dump as "op_call_eval".
1091 This helped me while debugging.
1094 (KJS::Machine::unwindCallFrame): When looking for an activation to tear
1095 off, don't use the scope chain. Inside eval, the scope chain doesn't
1096 belong to us; it belongs to our calling function.
1098 Also, don't use the needsFullScopeChain flag to decide whether to tear
1099 off the activation. "function.arguments" can create an activation
1100 for a function whose needsFullScopeChain flag is set to false.
1102 2008-05-08 Maciej Stachowiak <mjs@apple.com>
1106 - fix function.call for calls of more than 8 arguments
1108 Fixes svg/carto.net/button.svg
1111 (KJS::List::getSlice): properly set up the m_buffer of the target list.
1113 2008-05-08 Maciej Stachowiak <mjs@apple.com>
1117 - don't return a null RegisterID from RegExpNode in the exception case, since the caller may need a real register
1120 - fast/regex/early-acid3-86.html
1121 - http/tests/misc/acid3.html
1124 (KJS::RegExpNode::emitCode):
1126 2008-05-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1130 Fix a performance regression caused by the introduction of property
1131 attributes to SymbolTable in r32859 by encoding the attributes and the
1132 register index into a single field of SymbolTableEntry.
1134 This leaves Node::optimizeVariableAccess() definitely broken, although
1135 it was probably not entirely correct in SquirrelFish before this change.
1138 (KJS::missingThisObjectMarker):
1139 * VM/CodeGenerator.cpp:
1140 (KJS::CodeGenerator::addVar):
1141 (KJS::CodeGenerator::CodeGenerator):
1142 (KJS::CodeGenerator::registerForLocal):
1143 (KJS::CodeGenerator::registerForLocalConstInit):
1144 (KJS::CodeGenerator::isLocalConstant):
1145 (KJS::CodeGenerator::addConstant):
1146 (KJS::CodeGenerator::emitCall):
1147 * VM/CodeGenerator.h:
1148 (KJS::CodeGenerator::IdentifierMapIndexHashTraits::emptyValue):
1150 (KJS::Machine::privateExecute):
1151 * kjs/JSGlobalObject.cpp:
1152 (KJS::JSGlobalObject::saveLocalStorage):
1153 * kjs/JSVariableObject.cpp:
1154 (KJS::JSVariableObject::getPropertyNames):
1155 (KJS::JSVariableObject::getPropertyAttributes):
1156 * kjs/JSVariableObject.h:
1157 (KJS::JSVariableObject::symbolTableGet):
1158 (KJS::JSVariableObject::symbolTablePut):
1159 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1160 * kjs/SymbolTable.h:
1161 (KJS::SymbolTableEntry::SymbolTableEntry):
1162 (KJS::SymbolTableEntry::isEmpty):
1163 (KJS::SymbolTableEntry::getIndex):
1164 (KJS::SymbolTableEntry::getAttributes):
1165 (KJS::SymbolTableEntry::setAttributes):
1166 (KJS::SymbolTableEntry::isReadOnly):
1168 (KJS::getSymbolTableEntry):
1169 (KJS::PostIncResolveNode::optimizeVariableAccess):
1170 (KJS::PostDecResolveNode::optimizeVariableAccess):
1171 (KJS::DeleteResolveNode::optimizeVariableAccess):
1172 (KJS::TypeOfResolveNode::optimizeVariableAccess):
1173 (KJS::PreIncResolveNode::optimizeVariableAccess):
1174 (KJS::PreDecResolveNode::optimizeVariableAccess):
1175 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1176 (KJS::AssignResolveNode::optimizeVariableAccess):
1177 (KJS::ProgramNode::initializeSymbolTable):
1179 2008-05-06 Maciej Stachowiak <mjs@apple.com>
1181 Rubber stamped by Oliver.
1183 - add missing ! in an assert that I failed to reverse
1185 * VM/CodeGenerator.cpp:
1186 (KJS::CodeGenerator::CodeGenerator):
1188 2008-05-06 Maciej Stachowiak <mjs@apple.com>
1192 - fixed "SQUIRRELFISH: window.this shows up as a property, but it shouldn't"
1193 https://bugs.webkit.org/show_bug.cgi?id=18868
1195 The basic approach is to have "this" only be present in the symbol
1196 table at compile time, not runtime.
1198 * VM/CodeGenerator.cpp:
1199 (KJS::CodeGenerator::~CodeGenerator): Remove "this" from symbol table.
1200 (KJS::CodeGenerator::CodeGenerator): Add "this" back when re-using
1202 * VM/CodeGenerator.h:
1204 (KJS::Machine::execute): Don't assert that "this" is in the symbol table.
1206 2008-05-06 Geoffrey Garen <ggaren@apple.com>
1208 Reviewed by Oliver Hunt.
1210 Trivial support for function.arguments: Currently, we only support
1211 function.arguments from within the scope of function.
1213 This fixes the remaining Mozilla JS test failures.
1215 SunSpider reports no change.
1217 * JavaScriptCore.exp:
1220 (KJS::Machine::privateExecute): Separated scope chain deref from
1221 activation register copying: since it is now possible for client code
1222 to create an activation on behalf of a function that otherwise wouldn't
1223 need one, having an activation no longer necessarily means that you need
1224 to deref the scope chain.
1226 (KJS::Machine::getCallFrame): For now, this function only examines the
1227 current scope. Walking parent scopes requires some refactoring in the
1228 way we track execution stacks.
1230 * kjs/ExecState.cpp:
1231 (KJS::ExecState::ExecState): We use a negative call frame offset to
1232 indicate that a given scope is not a function call scope.
1234 2008-05-05 Oliver Hunt <oliver@apple.com>
1238 Fix call frame set up for native -> JS function calls.
1241 (KJS::Machine::execute):
1243 2008-05-05 Geoffrey Garen <ggaren@apple.com>
1245 Reviewed by Maciej Stachowiak.
1247 Fixed ecma_3/Object/8.6.2.6-001.js, and similar bugs.
1249 SunSpider reports a .4% speedup. Not sure what that's about.
1252 (KJS::Machine::privateExecute): Check for exception return from equal,
1253 since toPrimitive can throw.
1255 * kjs/operations.cpp:
1256 (KJS::strictEqual): In response to an error I made in an earlier version
1257 of this patch, I changed strictEqual to make clear the fact that it
1258 performs no conversions and can't throw, making it slightly more efficient
1261 2008-05-05 Maciej Stachowiak <mjs@apple.com>
1265 - fix some dumb mistakes in my last patch
1267 * VM/CodeGenerator.cpp:
1268 (KJS::CodeGenerator::emitPushScope):
1269 (KJS::CodeGenerator::emitGetPropertyNames):
1271 (KJS::Machine::privateExecute):
1273 2008-05-05 Maciej Stachowiak <mjs@apple.com>
1277 - document opcodes relating to jumps, scopes, and property name iteration
1279 Documented jmp, jtrue, false, push_scope, pop_scope, get_pnames,
1280 next_pname and jmp_scopes.
1282 * VM/CodeGenerator.cpp:
1283 (KJS::CodeGenerator::emitJump):
1284 (KJS::CodeGenerator::emitJumpIfTrue):
1285 (KJS::CodeGenerator::emitJumpIfFalse):
1286 (KJS::CodeGenerator::emitPushScope):
1287 (KJS::CodeGenerator::emitNextPropertyName):
1288 (KJS::CodeGenerator::emitGetPropertyNames):
1289 * VM/CodeGenerator.h:
1291 (KJS::Machine::privateExecute):
1293 (KJS::LogicalAndNode::emitCode):
1294 (KJS::LogicalOrNode::emitCode):
1295 (KJS::ConditionalNode::emitCode):
1296 (KJS::IfNode::emitCode):
1297 (KJS::IfElseNode::emitCode):
1298 (KJS::DoWhileNode::emitCode):
1299 (KJS::WhileNode::emitCode):
1300 (KJS::ForNode::emitCode):
1301 (KJS::ForInNode::emitCode):
1302 (KJS::WithNode::emitCode):
1304 2008-05-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1308 Bug 18749: SQUIRRELFISH: const support is broken
1309 <https://bugs.webkit.org/show_bug.cgi?id=18749>
1311 Adds support for const during code generation.
1313 Fixes 2 layout tests.
1316 * VM/CodeGenerator.cpp:
1317 (KJS::CodeGenerator::addVar):
1318 (KJS::CodeGenerator::CodeGenerator):
1319 (KJS::CodeGenerator::isLocalConstant):
1320 * VM/CodeGenerator.h:
1321 (KJS::CodeGenerator::addVar):
1323 (KJS::PostIncResolveNode::emitCode):
1324 (KJS::PostDecResolveNode::emitCode):
1325 (KJS::PreIncResolveNode::emitCode):
1326 (KJS::PreDecResolveNode::emitCode):
1327 (KJS::ReadModifyResolveNode::emitCode):
1328 (KJS::AssignResolveNode::emitCode):
1330 2008-05-04 Maciej Stachowiak <mjs@apple.com>
1334 - document some more opcodes (and fix argument names)
1336 Added docs for eq, neq, stricteq, nstriceq, less and lesseq.
1338 * VM/CodeGenerator.cpp:
1339 (KJS::CodeGenerator::emitEqual):
1340 (KJS::CodeGenerator::emitNotEqual):
1341 (KJS::CodeGenerator::emitStrictEqual):
1342 (KJS::CodeGenerator::emitNotStrictEqual):
1343 (KJS::CodeGenerator::emitLess):
1344 (KJS::CodeGenerator::emitLessEq):
1345 * VM/CodeGenerator.h:
1347 (KJS::Machine::privateExecute):
1349 (KJS::LessNode::emitCode):
1350 (KJS::GreaterNode::emitCode):
1351 (KJS::LessEqNode::emitCode):
1352 (KJS::GreaterEqNode::emitCode):
1353 (KJS::EqualNode::emitCode):
1354 (KJS::NotEqualNode::emitCode):
1355 (KJS::StrictEqualNode::emitCode):
1356 (KJS::NotStrictEqualNode::emitCode):
1357 (KJS::CaseBlockNode::emitCodeForBlock):
1359 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1361 Reviewed by Maciej Stachowiak.
1363 More scaffolding for f.arguments.
1365 Track the offset of the last call frame in the ExecState, so we can
1366 produce a backtrace at any time.
1368 Also, record numLocals, the sum of numVars + numParameters, in each code
1369 block, to make updates to the ExecState a little cheaper than they
1372 We now use numLocals in a bunch of places where we used to calculate
1373 numVars + numParameters or -numVars - numParameters.
1375 Reports are mixed, but all in all, this seems to be a wash on SunSpider.
1377 2008-05-04 Oliver Hunt <oliver@apple.com>
1381 Whoops, correctly handle properties that don't exist in the
1384 * kjs/JSVariableObject.h:
1385 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1387 2008-05-04 Oliver Hunt <oliver@apple.com>
1391 Add attribute information to SymbolTable as ground work for
1392 various DontEnum and ReadOnly issues.
1394 * VM/CodeGenerator.cpp:
1395 (KJS::CodeGenerator::addVar):
1396 (KJS::CodeGenerator::CodeGenerator):
1397 (KJS::CodeGenerator::registerForLocal):
1398 (KJS::CodeGenerator::registerForLocalConstInit):
1399 (KJS::CodeGenerator::addConstant):
1401 (KJS::Machine::execute):
1402 * kjs/JSGlobalObject.cpp:
1403 (KJS::JSGlobalObject::saveLocalStorage):
1404 * kjs/JSVariableObject.cpp:
1405 (KJS::JSVariableObject::getPropertyNames):
1406 (KJS::JSVariableObject::getPropertyAttributes):
1407 * kjs/JSVariableObject.h:
1408 (KJS::JSVariableObject::symbolTablePut):
1409 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1410 * kjs/SymbolTable.h:
1411 (KJS::SymbolTableEntry::SymbolTableEntry):
1412 (KJS::SymbolTableIndexHashTraits::emptyValue):
1414 (KJS::getSymbolTableEntry):
1415 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1416 (KJS::AssignResolveNode::optimizeVariableAccess):
1417 (KJS::ProgramNode::initializeSymbolTable):
1419 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1421 Reviewed by Oliver Hunt.
1423 More scaffolding for f.arguments.
1425 Store the register file associated with an ExecState in the ExecState.
1427 SunSpider reports no change.
1429 * kjs/JSGlobalObject.h:
1430 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Moved
1431 registerFileStack above globalExec, so it gets initialized first.
1432 Removed remnants of old activation scheme.
1434 2008-05-04 Maciej Stachowiak <mjs@apple.com>
1436 Rubber stamped by Oliver.
1438 - renamed a few opcodes and fixed assembly formatting to accomodate the longest opcode
1442 resolve_base_and_property --> resolve_with_base
1443 resolve_base_and_func --> resolve_func
1444 get_prop_id --> get_by_id
1445 put_prop_id --> put_by_id
1446 delete_prop_id --> del_by_id
1447 get_prop_val --> get_by_val
1448 put_prop_val --> put_by_val
1449 delete_prop_val --> del_by_val
1450 put_prop_index --> put_by_index
1453 (KJS::printUnaryOp):
1454 (KJS::printBinaryOp):
1455 (KJS::printConditionalJump):
1456 (KJS::CodeBlock::dump):
1457 * VM/CodeGenerator.cpp:
1458 (KJS::CodeGenerator::emitEqual):
1459 (KJS::CodeGenerator::emitNotEqual):
1460 (KJS::CodeGenerator::emitResolveWithBase):
1461 (KJS::CodeGenerator::emitResolveFunction):
1462 (KJS::CodeGenerator::emitGetById):
1463 (KJS::CodeGenerator::emitPutById):
1464 (KJS::CodeGenerator::emitDeleteById):
1465 (KJS::CodeGenerator::emitGetByVal):
1466 (KJS::CodeGenerator::emitPutByVal):
1467 (KJS::CodeGenerator::emitDeleteByVal):
1468 (KJS::CodeGenerator::emitPutByIndex):
1469 * VM/CodeGenerator.h:
1471 (KJS::Machine::privateExecute):
1474 (KJS::ArrayNode::emitCode):
1475 (KJS::PropertyListNode::emitCode):
1476 (KJS::BracketAccessorNode::emitCode):
1477 (KJS::DotAccessorNode::emitCode):
1478 (KJS::EvalFunctionCallNode::emitCode):
1479 (KJS::FunctionCallResolveNode::emitCode):
1480 (KJS::FunctionCallBracketNode::emitCode):
1481 (KJS::FunctionCallDotNode::emitCode):
1482 (KJS::PostIncResolveNode::emitCode):
1483 (KJS::PostDecResolveNode::emitCode):
1484 (KJS::PostIncBracketNode::emitCode):
1485 (KJS::PostDecBracketNode::emitCode):
1486 (KJS::PostIncDotNode::emitCode):
1487 (KJS::PostDecDotNode::emitCode):
1488 (KJS::DeleteResolveNode::emitCode):
1489 (KJS::DeleteBracketNode::emitCode):
1490 (KJS::DeleteDotNode::emitCode):
1491 (KJS::TypeOfResolveNode::emitCode):
1492 (KJS::PreIncResolveNode::emitCode):
1493 (KJS::PreDecResolveNode::emitCode):
1494 (KJS::PreIncBracketNode::emitCode):
1495 (KJS::PreDecBracketNode::emitCode):
1496 (KJS::PreIncDotNode::emitCode):
1497 (KJS::PreDecDotNode::emitCode):
1498 (KJS::ReadModifyResolveNode::emitCode):
1499 (KJS::AssignResolveNode::emitCode):
1500 (KJS::AssignDotNode::emitCode):
1501 (KJS::ReadModifyDotNode::emitCode):
1502 (KJS::AssignBracketNode::emitCode):
1503 (KJS::ReadModifyBracketNode::emitCode):
1504 (KJS::ConstDeclNode::emitCodeSingle):
1505 (KJS::ForInNode::emitCode):
1506 (KJS::TryNode::emitCode):
1508 2008-05-04 Oliver Hunt <oliver@apple.com>
1512 Fix assertion when accessing arguments object with too many arguments provided
1514 The arguments constructor was assuming that the register offset given for argv
1515 was an absolute offset into the registerfile, rather than the offset from the
1516 frame. This patches corrects that issue.
1518 * kjs/JSActivation.cpp:
1519 (KJS::JSActivation::createArgumentsObject):
1521 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1523 Rubber stamped by Sam Weinig.
1525 Cleaned up Machine.cpp according to our style guidelines: moved static
1526 data to the top of the file; moved stand-alone functions below that;
1527 moved the Machine constructor above other Machine member functions.
1529 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1533 - fix accidental breakage from last patch
1536 (KJS::Machine::privateExecute):
1538 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1542 - a bunch more opcode documentation and corresponding parameter name fixes
1544 I renamed a few opcodes:
1546 type_of --> typeof (that's what the JS operator is named)
1547 instance_of --> instanceof (ditto)
1548 create_error --> new_error (for consistency with other new_* opcodes)
1550 I documented the following opcodes:
1572 I also fixed formatting on some existing opcode docs.
1575 (KJS::CodeBlock::dump):
1576 * VM/CodeGenerator.cpp:
1577 (KJS::CodeGenerator::emitMove):
1578 (KJS::CodeGenerator::emitNot):
1579 (KJS::CodeGenerator::emitPreInc):
1580 (KJS::CodeGenerator::emitPreDec):
1581 (KJS::CodeGenerator::emitPostInc):
1582 (KJS::CodeGenerator::emitPostDec):
1583 (KJS::CodeGenerator::emitToJSNumber):
1584 (KJS::CodeGenerator::emitNegate):
1585 (KJS::CodeGenerator::emitBitNot):
1586 (KJS::CodeGenerator::emitInstanceOf):
1587 (KJS::CodeGenerator::emitTypeOf):
1588 (KJS::CodeGenerator::emitIn):
1589 (KJS::CodeGenerator::emitLoad):
1590 (KJS::CodeGenerator::emitNewObject):
1591 (KJS::CodeGenerator::emitNewArray):
1592 (KJS::CodeGenerator::emitNewRegExp):
1593 (KJS::CodeGenerator::emitNewError):
1594 * VM/CodeGenerator.h:
1595 (KJS::CodeGenerator::scopeDepth):
1596 (KJS::CodeGenerator::addVar):
1598 (KJS::Machine::privateExecute):
1601 (KJS::Node::emitThrowError):
1602 (KJS::RegExpNode::emitCode):
1603 (KJS::TypeOfValueNode::emitCode):
1604 (KJS::UnaryPlusNode::emitCode):
1605 (KJS::NegateNode::emitCode):
1606 (KJS::BitwiseNotNode::emitCode):
1607 (KJS::LogicalNotNode::emitCode):
1608 (KJS::InstanceOfNode::emitCode):
1609 (KJS::InNode::emitCode):
1611 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1613 Reviewed by Geoff and Sam.
1615 - generate HTML bytecode docs at build time
1617 * DerivedSources.make:
1619 * docs/make-bytecode-docs.pl: Added.
1621 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1623 Reviewed by Sam Weinig.
1625 Update ExecState::m_scopeChain when switching scope chains inside the
1628 This fixes uses of lexicalGlobalObject, such as, in a subframe
1630 alert(top.makeArray() instanceof Array ? "FAIL" : "PASS");
1632 and a bunch of the security failures listed in
1633 https://bugs.webkit.org/show_bug.cgi?id=18870. (Those tests still fail,
1634 seemingly because of regressions in exception messages).
1636 SunSpider reports no change.
1638 * VM/Machine.cpp: Factored out scope chain updating into a common
1639 function that takes care to update ExecState::m_scopeChain, too.
1641 * kjs/ExecState.h: I made Machine a friend of ExecState so that Machine
1642 could update ExecState::m_scopeChain, even though that value is
1643 read-only for everyone else.
1645 * kjs/JSGlobalObject.h:
1646 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Changed
1647 this client to be a little friendlier to ExecState's internal
1648 storage type for scope chain data.
1650 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1652 Reviewed by Sam Weinig.
1654 Fixed https://bugs.webkit.org/show_bug.cgi?id=18876
1655 Squirrelfish: ScopeChainNode leak in op_jmp_scopes.
1657 SunSpider reports no change.
1660 (KJS::Machine::privateExecute): Don't construct a ScopeChain object,
1661 since the direct threaded interpreter will goto across its destructor.
1663 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1665 Reviewed by Oliver Hunt.
1667 A bit more efficient fix than r32832: Don't copy globals into function
1668 register files; instead, have the RegisterFileStack track only the base
1669 of the last *global* register file, so the global object's register
1670 references stay good.
1672 SunSpider reports a .3% speedup. Not sure what that's about.
1674 2008-05-03 Oliver Hunt <oliver@apple.com>
1678 Bug 18864: SquirrelFish: Support getter and setter definition in object literals
1679 <https://bugs.webkit.org/show_bug.cgi?id=18864>
1681 Add new opcodes to allow us to add getters and setters to an object. These are
1682 only used by the codegen for object literals.
1684 * VM/CodeGenerator.cpp:
1685 (KJS::CodeGenerator::emitPutGetter):
1686 (KJS::CodeGenerator::emitPutSetter):
1687 * VM/CodeGenerator.h:
1689 (KJS::Machine::privateExecute):
1692 (KJS::PropertyListNode::emitCode):
1694 2008-05-02 Maciej Stachowiak <mjs@apple.com>
1698 - properly copy globals into and out of implicit call register
1699 files, otherwise they will fail at global lookup
1701 Fixes fast/js/array-tostring-and-join.html layout test.
1703 * VM/RegisterFileStack.cpp:
1704 (KJS::RegisterFileStack::pushGlobalRegisterFile):
1705 (KJS::RegisterFileStack::popGlobalRegisterFile):
1706 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1707 (KJS::RegisterFileStack::popFunctionRegisterFile):
1709 2008-05-02 Geoffrey Garen <ggaren@apple.com>
1711 Reviewed by Oliver Hunt.
1713 Fixed https://bugs.webkit.org/show_bug.cgi?id=18822
1714 SQUIRRELFISH: incorrect eval used in some cases
1716 Changed all code inside the machine to fetch the lexical global object
1717 directly from the scope chain, instead of from the ExecState.
1719 Clients who fetch the lexical global object through the ExecState
1722 SunSpider reports no change.
1725 (KJS::Machine::privateExecute): Fetch the lexical global object from
1729 (KJS::ExecState::ExecState::lexicalGlobalObject): Moved the logic for
1730 this function into ScopeChainNode, but kept this function around to
1731 support existing clients.
1733 2008-05-02 Geoffrey Garen <ggaren@apple.com>
1735 Rubber stamped by Oliver Hunt.
1737 Removed ExecState.cpp from AllInOneFile.cpp, for a .2% speedup.
1739 * JavaScriptCore.xcodeproj/project.pbxproj:
1740 * kjs/AllInOneFile.cpp:
1742 2008-05-01 Oliver Hunt <oliver@apple.com>
1744 Reviewed by Geoff and Maciej.
1746 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
1747 <https://bugs.webkit.org/show_bug.cgi?id=18827>
1749 Remove safe/unsafe RegisterFile concept, and instead just add additional
1750 logic to ensure we always push/pop RegisterFiles when executing getters
1751 and setters, similar to the logic for valueOf and toString.
1754 (KJS::Machine::privateExecute):
1755 * VM/RegisterFile.h:
1757 (KJS::FunctionImp::callAsFunction):
1759 (KJS::JSObject::put):
1760 * kjs/property_slot.cpp:
1761 (KJS::PropertySlot::functionGetter):
1763 2008-05-01 Oliver Hunt <oliver@apple.com>
1767 Rename unsafeForReentry to safeForReentry to avoid double negatives.
1770 (KJS::Machine::privateExecute):
1771 * VM/RegisterFile.h:
1773 (KJS::FunctionImp::callAsFunction):
1775 2008-05-01 Oliver Hunt <oliver@apple.com>
1779 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
1780 <https://bugs.webkit.org/show_bug.cgi?id=18827>
1782 This patch makes getters and setters work. It does this by
1783 tracking whether the RegisterFile is "safe", that is whether
1784 the interpreter is in a state that in which it can handle
1785 the RegisterFile being reallocated.
1789 (KJS::Machine::privateExecute):
1790 * VM/RegisterFile.h:
1792 (KJS::FunctionImp::callAsFunction):
1794 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1796 Release build fix: Always compile in "isGlobalObject", since it's
1797 listed in our .exp file.
1799 * kjs/ExecState.cpp:
1800 (KJS::ExecState::isGlobalObject):
1803 2008-04-30 Oliver Hunt <oliver@apple.com>
1807 Minor code restructuring to prepare for getters and setters,
1808 also helps exception semantics a bit.
1811 (KJS::Machine::privateExecute):
1813 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1819 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1821 Debug build fix: export a missing symbol.
1823 * JavaScriptCore.exp:
1825 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1827 Reviewed by Oliver Hunt.
1829 A little more ExecState refactoring: Now, only the global object creates
1832 Also inlined ExecState::lexicalGlobalObject().
1834 SunSpider reports no change.
1836 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1838 WebCore build fix: forward-declare ScopeChain.
1840 * kjs/interpreter.h:
1842 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1844 Build fix for JavaScriptGlue: export a missing symbol.
1846 * JavaScriptCore.exp:
1848 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1850 Reviewed by Oliver Hunt.
1852 Removed a lot of unused bits from ExecState, moving them into
1853 OldInterpreterExecState, the fake scaffolding class.
1855 The clutter was making it hard to see the forest from the trees.
1857 .4% SunSpider speedup, probably because ExecState::lexicalGlobalObject()
1860 2008-04-29 Oliver Hunt <oliver@apple.com>
1864 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
1865 <https://bugs.webkit.org/show_bug.cgi?id=18643>
1867 Prevent static slot optimisation for new variables and functions in
1868 globally re-entrant code called from an an implicit function call.
1870 This is necessary to prevent us from needing to resize the global
1871 slot portion of the root RegisterFile during an implicit (and hence
1872 unguarded) function call.
1874 * VM/CodeGenerator.cpp:
1875 (KJS::CodeGenerator::CodeGenerator):
1876 * VM/CodeGenerator.h:
1878 (KJS::Machine::execute):
1879 * VM/RegisterFile.h:
1880 * VM/RegisterFileStack.cpp:
1881 (KJS::RegisterFileStack::pushGlobalRegisterFile):
1882 (KJS::RegisterFileStack::popGlobalRegisterFile):
1883 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1884 (KJS::RegisterFileStack::popFunctionRegisterFile):
1885 * VM/RegisterFileStack.h:
1886 (KJS::RegisterFileStack::inImplicitFunctionCall):
1887 (KJS::RegisterFileStack::lastGlobal):
1889 (KJS::ProgramNode::generateCode):
1891 (KJS::ProgramNode::):
1893 2008-04-29 Geoffrey Garen <ggaren@apple.com>
1895 Reviewed by Oliver Hunt.
1897 In nested program code, don't propogate "this" back to the parent
1898 register file. ("this" should remain constant in the parent register
1899 file, regardless of the scripts it invokes.)
1901 * VM/RegisterFile.cpp:
1902 (KJS::RegisterFile::copyGlobals):
1904 2008-04-28 Oliver Hunt <oliver@apple.com>
1908 Restore base pointer when popping a global RegisterFile
1910 * VM/RegisterFileStack.cpp:
1911 (KJS::RegisterFileStack::popGlobalRegisterFile):
1913 2008-04-28 Oliver Hunt <oliver@apple.com>
1917 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
1918 <https://bugs.webkit.org/show_bug.cgi?id=18643>
1920 Partial fix. This results in all implicit calls to toString or valueOf
1921 executing in a separate RegisterFile, so ensuring that the the pointers
1922 in the triggering interpreter don't get trashed. This still leaves the
1923 task of preventing new global re-entry from toString and valueOf from
1924 clobbering the RegisterFile.
1927 (KJS::Machine::execute):
1928 * VM/RegisterFileStack.cpp:
1929 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1930 (KJS::RegisterFileStack::popFunctionRegisterFile):
1931 * VM/RegisterFileStack.h:
1933 (KJS::tryGetAndCallProperty):
1935 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1937 Reviewed by Maciej Stachowiak.
1939 Simplified activation object a bit: No need to store the callee
1940 in the activation object -- we can pull it out of the call frame
1941 when needed, instead.
1943 SunSpider reports no change.
1945 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1947 Reviewed by Maciej Stachowiak.
1949 RS by Oliver Hunt on moving JSArguments.cpp out of AllInOneFile.cpp.
1951 Substantially more handling of "arguments": "arguments" works fully
1952 now, but "f.arguments" still doesn't work.
1954 Fixes 10 regression tests.
1956 SunSpider reports no regression.
1958 * kjs/JSActivation.cpp:
1959 (KJS::JSActivation::createArgumentsObject): Reconstruct an arguments
1960 List to pass to the arguments object constructor.
1962 * JavaScriptCore.xcodeproj/project.pbxproj:
1963 * kjs/AllInOneFile.cpp: Removed JSActivation.cpp from AllInOneFile.cpp
1964 because that seems to make GCC happy. (Previously, I had added
1965 JSActivation.cpp to AllInOneFile.cpp because *that* seemed to make GCC
1968 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1970 Reviewed by Maciej Stachowiak.
1972 Groundwork for more handling of "arguments". I'm not checking in the
1973 actual handling of "arguments" yet, because it still needs a little
1974 fiddling to avoid a performance regression.
1976 SunSpider reports no change.
1979 (KJS::initializeCallFrame): Put argc in the register file, so the
1980 arguments object can find it later, to determine arguments.length.
1983 (KJS::FunctionBodyNode::): Added a special code accessor for when you
1984 know the code has already been generated, and you don't have a scopeChain
1985 to supply for potential code generation. (This is the case when the
1986 activation object creates the arguments object.)
1988 2008-04-28 Oliver Hunt <oliver@apple.com>
1992 Replace unsafe use of auto_ptr in Vector with manual memory
1995 * VM/RegisterFileStack.cpp:
1996 (KJS::RegisterFileStack::~RegisterFileStack):
1997 (KJS::RegisterFileStack::popRegisterFile):
1998 * VM/RegisterFileStack.h:
2000 2008-04-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2004 Bug 18746: SQUIRRELFISH: indirect eval used when direct eval should be used
2005 <https://bugs.webkit.org/show_bug.cgi?id=18746>
2007 Change the base to the correct value of the 'this' object after the direct
2008 eval test instead of before.
2010 Fixes 5 layout tests.
2013 (KJS::Machine::privateExecute):
2015 (KJS::EvalFunctionCallNode::emitCode):
2017 2008-04-26 Maciej Stachowiak <mjs@apple.com>
2021 - document all property getting, setting and deleting opcodes
2023 (And fix function parameter names to match corresponding opcode parameter names.)
2025 * VM/CodeGenerator.cpp:
2026 (KJS::CodeGenerator::emitResolve):
2027 (KJS::CodeGenerator::emitResolveBase):
2028 (KJS::CodeGenerator::emitResolveBaseAndProperty):
2029 (KJS::CodeGenerator::emitResolveBaseAndFunc):
2030 (KJS::CodeGenerator::emitGetPropId):
2031 (KJS::CodeGenerator::emitPutPropId):
2032 (KJS::CodeGenerator::emitDeletePropId):
2033 (KJS::CodeGenerator::emitPutPropVal):
2034 * VM/CodeGenerator.h:
2038 (KJS::resolveBaseAndProperty):
2039 (KJS::resolveBaseAndFunc):
2040 (KJS::Machine::privateExecute):
2042 (KJS::ResolveNode::emitCode):
2043 (KJS::ArrayNode::emitCode):
2044 (KJS::PropertyListNode::emitCode):
2045 (KJS::BracketAccessorNode::emitCode):
2046 (KJS::EvalFunctionCallNode::emitCode):
2047 (KJS::FunctionCallResolveNode::emitCode):
2048 (KJS::FunctionCallBracketNode::emitCode):
2049 (KJS::PostIncResolveNode::emitCode):
2050 (KJS::PostDecResolveNode::emitCode):
2051 (KJS::PostIncBracketNode::emitCode):
2052 (KJS::PostDecBracketNode::emitCode):
2053 (KJS::PostIncDotNode::emitCode):
2054 (KJS::PostDecDotNode::emitCode):
2055 (KJS::DeleteResolveNode::emitCode):
2056 (KJS::TypeOfResolveNode::emitCode):
2057 (KJS::PreIncResolveNode::emitCode):
2058 (KJS::PreDecResolveNode::emitCode):
2059 (KJS::PreIncBracketNode::emitCode):
2060 (KJS::PreDecBracketNode::emitCode):
2061 (KJS::AssignResolveNode::emitCode):
2062 (KJS::AssignDotNode::emitCode):
2063 (KJS::ReadModifyDotNode::emitCode):
2064 (KJS::AssignBracketNode::emitCode):
2065 (KJS::ReadModifyBracketNode::emitCode):
2066 (KJS::ConstDeclNode::emitCodeSingle):
2068 2008-04-26 Oliver Hunt <oliver@apple.com>
2072 Bug 18628: SQUIRRELFISH: need to support recursion limit
2073 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2075 Basically completes recursion limiting. There is still some
2076 tuning we may want to do to make things better in the face of
2077 very bad code, but certainly nothing worse than anything already
2080 Also fixes a WebKit test by fixing the exception text :D
2082 * JavaScriptCore.exp:
2083 * VM/ExceptionHelpers.cpp:
2085 (KJS::Machine::execute):
2086 * VM/RegisterFile.cpp:
2087 (KJS::RegisterFile::growBuffer):
2088 (KJS::RegisterFile::addGlobalSlots):
2089 * VM/RegisterFile.h:
2090 (KJS::RegisterFile::grow):
2091 (KJS::RegisterFile::uncheckedGrow):
2092 * VM/RegisterFileStack.cpp:
2093 (KJS::RegisterFileStack::pushRegisterFile):
2094 * VM/RegisterFileStack.h:
2096 2008-04-25 Oliver Hunt <oliver@apple.com>
2100 Bug 18628: SQUIRRELFISH: need to support recursion limit
2101 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2103 Put a limit on the level of reentry recursion. 128 levels of re-entrant recursion
2104 seems reasonable as it is greater than the old eval limit, and a long way short of
2105 the reentry depth needed to overflow the stack.
2108 (KJS::Machine::execute):
2111 2008-04-25 Geoffrey Garen <ggaren@apple.com>
2113 Reviewed by Sam Weinig.
2115 A tiny bit of cleanup to the regexp code.
2117 Removed some static_cast.
2119 Removed createRegExpImp because it's no longer used.
2121 2008-04-25 Oliver Hunt <oliver@apple.com>
2125 Bug 18736: SQUIRRELFISH: switch statements with no default have incorrect codegen
2126 <https://bugs.webkit.org/show_bug.cgi?id=18736>
2128 Ensure the "default" target is correct in the absence of an explicit default handler.
2131 (KJS::CaseBlockNode::emitCodeForBlock):
2133 2008-04-25 Oliver Hunt <oliver@apple.com>
2137 Bug 18628: SQUIRRELFISH: need to support recursion limit
2138 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2140 More bounds checking.
2143 (KJS::Machine::execute):
2144 * VM/RegisterFile.cpp:
2145 (KJS::RegisterFile::growBuffer):
2146 * VM/RegisterFile.h:
2148 2008-04-25 Maciej Stachowiak <mjs@apple.com>
2152 - fix signal catching magic
2154 The signal handlers are restored to _exit but are only set when
2155 running under run-javascriptcore-tests. fprintf from a signal
2156 handler is not safe.
2161 * tests/mozilla/jsDriver.pl:
2163 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2167 Bug 18732: SQUIRRELFISH: exceptions thrown by native constructors are ignored
2168 <https://bugs.webkit.org/show_bug.cgi?id=18732>
2170 Fixes another regression test.
2173 (KJS::Machine::privateExecute):
2175 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2179 Bug 18728: SQUIRRELFISH: invalid regular expression constants should throw exceptions
2180 <https://bugs.webkit.org/show_bug.cgi?id=18728>
2182 Fixes another regression test.
2185 (KJS::RegExpNode::emitCode):
2187 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2189 Reviewed by Geoffrey Garen.
2191 Bug 18735: SQUIRRELFISH: closures are sometimes given an incorrect 'this' value when called
2192 <https://bugs.webkit.org/show_bug.cgi?id=18735>
2194 The overloaded toThisObject method was not copied over to JSActivation.
2196 Fixes two regression tests.
2198 * kjs/JSActivation.cpp:
2199 (KJS::JSActivation::toThisObject):
2200 * kjs/JSActivation.h:
2202 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2204 Reviewed by Oliver Hunt.
2206 Added support for arguments.callee.
2208 2008-04-24 Oliver Hunt <oliver@apple.com>
2212 Bug 18628: SQUIRRELFISH: need to support recursion limit
2213 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2215 Partial fix -- this gets us some of the required bounds checking, but not
2216 complete coverage. But it does manage to do them without regressing :D
2218 * VM/ExceptionHelpers.cpp:
2220 (KJS::createStackOverflowError):
2221 * VM/ExceptionHelpers.h:
2223 (KJS::slideRegisterWindowForCall):
2224 (KJS::Machine::execute):
2225 (KJS::Machine::privateExecute):
2226 * VM/RegisterFile.cpp:
2227 * VM/RegisterFile.h:
2228 (KJS::RegisterFile::):
2229 (KJS::RegisterFile::RegisterFile):
2230 (KJS::RegisterFile::grow):
2232 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2234 Reviewed by Oliver Hunt.
2236 A tiny bit more handling of "arguments": create a real, but mostly
2237 hollow, arguments object.
2239 Fixes 2 regression tests.
2241 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2245 Bug 18717: SQUIRRELFISH: eval returns the wrong value for a variable declaration statement
2246 <https://bugs.webkit.org/show_bug.cgi?id=18717>
2248 Fixes a regression test, but exposes the failure of another due to the
2249 lack of getters and setters.
2252 (KJS::ConstDeclNode::emitCodeSingle):
2253 (KJS::ConstDeclNode::emitCode):
2254 (KJS::ConstStatementNode::emitCode):
2255 (KJS::VarStatementNode::emitCode):
2258 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2260 Reviewed by Sam Weinig.
2262 Print a CRASH statement when crashing, so test failures are not a
2269 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2271 Reviewed by Geoffrey Garen.
2273 Bug 18716: SQUIRRELFISH: typeof should return undefined for an undefined variable reference
2274 <https://bugs.webkit.org/show_bug.cgi?id=18716>
2276 This fixes 2 more regression tests.
2279 (KJS::TypeOfResolveNode::emitCode):
2281 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2283 Reviewed by Sam Weinig.
2285 Put the callee in the call frame.
2287 Necessary in order to support "arguments" and "arguments.callee".
2289 Also fixes a latent GC bug, where an executing function could be
2290 subject to GC if the register holding it were overwritten. Here's
2291 an example that would have caused problems:
2295 // Flood the machine stack to eliminate any old pointers to f.
2298 // Overwrite f in the register file.
2302 for (var i = 0; i < 5000; ++i) {
2306 // Welcome to crash-ville.
2315 * VM/Machine.h: Changed the order of arguments to
2316 execute(FunctionBodyNode*...) to match the other execute functions.
2317 * kjs/function.cpp: Updated to match new argument requirements from
2318 execute(FunctionBodyNode*...). Renamed newObj to thisObj to match the
2319 rest of JavaScriptCore.
2321 SunSpider reports no change.
2323 2008-04-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2327 Bug 18707: SQUIRRELFISH: eval always performs toString() on its argument
2328 <https://bugs.webkit.org/show_bug.cgi?id=18707>
2330 This fixes 4 more regression tests.
2335 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2339 - fix logic bug in SegmentedVector::grow which would sometimes fail to resize a segment when needed
2343 * VM/SegmentedVector.h:
2344 (KJS::SegmentedVector::grow):
2346 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2348 Reviewed by Maciej Stachowiak.
2350 Degenerate handling of "arguments" as a property of the activation
2351 object. Currently, we just return a vanilla object.
2353 SunSpider reports no change.
2357 ecma_3/Function/regress-94506.js.
2359 Reveals to have been secretly broken:
2361 ecma_3/Function/15.3.4.3-1.js
2362 ecma_3/Function/15.3.4.4-1.js
2364 These tests were passing incorrectly. testkjs creates a global array
2365 named "arguments" to hold command-line arguments. That array was
2366 tricking these tests into thinking that an arguments object with length
2367 0 had been created. Since our new vanilla object shadows the global
2368 property named arguments, that object no longer fools these tests into
2371 Net change: +1 failing test.
2373 * kjs/AllInOneFile.cpp: Had to put JSActivation.cpp into AllInOneFile.cpp
2374 to solve a surprising 8.6% regression in bitops-3bit-bits-in-byte.
2376 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2380 - save and restore callFrame
2383 (KJS::slideRegisterWindowForCall):
2384 (KJS::Machine::execute):
2385 (KJS::Machine::privateExecute):
2389 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2391 Reviewed by Maciej Stachowiak.
2393 Fixed scopes for named function expressions.
2395 Fixes one regression test.
2399 (1) The function's name is supposed to have attributes DontDelete,
2400 ReadOnly, regardless of the type of code executing.
2402 (2) Push the name object on the function's scope chain, rather than
2403 the ExecState's scope chain because, well, that's where it belongs.
2405 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2407 Reviewed by Oliver Hunt.
2409 Inlined JSObject::putDirect, for a .4% SunSpider speedup.
2411 I did this as a first step toward removing nodes.cpp from
2412 AllInOneFile.cpp, but I'm putting that larger project aside for now.
2414 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2416 Rubber stamped by Geoff.
2418 - add OldInterpreterExecState class and use it in dead code
2420 This will allow removing things from the real ExecState class
2421 without having to figure out how to remove all this code without
2422 getting a perf regression.
2425 (KJS::ExpressionNode::evaluateToNumber):
2426 (KJS::ExpressionNode::evaluateToBoolean):
2427 (KJS::ExpressionNode::evaluateToInt32):
2428 (KJS::ExpressionNode::evaluateToUInt32):
2429 (KJS::Node::setErrorCompletion):
2430 (KJS::Node::throwError):
2431 (KJS::Node::throwUndefinedVariableError):
2432 (KJS::Node::handleException):
2433 (KJS::Node::rethrowException):
2434 (KJS::BreakpointCheckStatement::execute):
2435 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
2436 (KJS::NullNode::evaluate):
2437 (KJS::FalseNode::evaluate):
2438 (KJS::TrueNode::evaluate):
2439 (KJS::NumberNode::evaluate):
2440 (KJS::NumberNode::evaluateToNumber):
2441 (KJS::NumberNode::evaluateToBoolean):
2442 (KJS::NumberNode::evaluateToInt32):
2443 (KJS::NumberNode::evaluateToUInt32):
2444 (KJS::ImmediateNumberNode::evaluate):
2445 (KJS::ImmediateNumberNode::evaluateToInt32):
2446 (KJS::ImmediateNumberNode::evaluateToUInt32):
2447 (KJS::StringNode::evaluate):
2448 (KJS::StringNode::evaluateToNumber):
2449 (KJS::StringNode::evaluateToBoolean):
2450 (KJS::RegExpNode::evaluate):
2451 (KJS::ThisNode::evaluate):
2452 (KJS::ResolveNode::inlineEvaluate):
2453 (KJS::ResolveNode::evaluate):
2454 (KJS::ResolveNode::evaluateToNumber):
2455 (KJS::ResolveNode::evaluateToBoolean):
2456 (KJS::ResolveNode::evaluateToInt32):
2457 (KJS::ResolveNode::evaluateToUInt32):
2458 (KJS::getSymbolTableEntry):
2459 (KJS::ResolveNode::optimizeVariableAccess):
2460 (KJS::LocalVarAccessNode::inlineEvaluate):
2461 (KJS::LocalVarAccessNode::evaluate):
2462 (KJS::LocalVarAccessNode::evaluateToNumber):
2463 (KJS::LocalVarAccessNode::evaluateToBoolean):
2464 (KJS::LocalVarAccessNode::evaluateToInt32):
2465 (KJS::LocalVarAccessNode::evaluateToUInt32):
2466 (KJS::getNonLocalSymbol):
2467 (KJS::ScopedVarAccessNode::inlineEvaluate):
2468 (KJS::ScopedVarAccessNode::evaluate):
2469 (KJS::ScopedVarAccessNode::evaluateToNumber):
2470 (KJS::ScopedVarAccessNode::evaluateToBoolean):
2471 (KJS::ScopedVarAccessNode::evaluateToInt32):
2472 (KJS::ScopedVarAccessNode::evaluateToUInt32):
2473 (KJS::NonLocalVarAccessNode::inlineEvaluate):
2474 (KJS::NonLocalVarAccessNode::evaluate):
2475 (KJS::NonLocalVarAccessNode::evaluateToNumber):
2476 (KJS::NonLocalVarAccessNode::evaluateToBoolean):
2477 (KJS::NonLocalVarAccessNode::evaluateToInt32):
2478 (KJS::NonLocalVarAccessNode::evaluateToUInt32):
2479 (KJS::ElementNode::optimizeVariableAccess):
2480 (KJS::ElementNode::evaluate):
2481 (KJS::ArrayNode::optimizeVariableAccess):
2482 (KJS::ArrayNode::evaluate):
2483 (KJS::ObjectLiteralNode::optimizeVariableAccess):
2484 (KJS::ObjectLiteralNode::evaluate):
2485 (KJS::PropertyListNode::optimizeVariableAccess):
2486 (KJS::PropertyListNode::evaluate):
2487 (KJS::PropertyNode::optimizeVariableAccess):
2488 (KJS::PropertyNode::evaluate):
2489 (KJS::BracketAccessorNode::optimizeVariableAccess):
2490 (KJS::BracketAccessorNode::inlineEvaluate):
2491 (KJS::BracketAccessorNode::evaluate):
2492 (KJS::BracketAccessorNode::evaluateToNumber):
2493 (KJS::BracketAccessorNode::evaluateToBoolean):
2494 (KJS::BracketAccessorNode::evaluateToInt32):
2495 (KJS::BracketAccessorNode::evaluateToUInt32):
2496 (KJS::DotAccessorNode::optimizeVariableAccess):
2497 (KJS::DotAccessorNode::inlineEvaluate):
2498 (KJS::DotAccessorNode::evaluate):
2499 (KJS::DotAccessorNode::evaluateToNumber):
2500 (KJS::DotAccessorNode::evaluateToBoolean):
2501 (KJS::DotAccessorNode::evaluateToInt32):
2502 (KJS::DotAccessorNode::evaluateToUInt32):
2503 (KJS::ArgumentListNode::optimizeVariableAccess):
2504 (KJS::ArgumentListNode::evaluateList):
2505 (KJS::ArgumentsNode::optimizeVariableAccess):
2506 (KJS::NewExprNode::optimizeVariableAccess):
2507 (KJS::NewExprNode::inlineEvaluate):
2508 (KJS::NewExprNode::evaluate):
2509 (KJS::NewExprNode::evaluateToNumber):
2510 (KJS::NewExprNode::evaluateToBoolean):
2511 (KJS::NewExprNode::evaluateToInt32):
2512 (KJS::NewExprNode::evaluateToUInt32):
2513 (KJS::ExpressionNode::resolveAndCall):
2514 (KJS::EvalFunctionCallNode::optimizeVariableAccess):
2515 (KJS::EvalFunctionCallNode::evaluate):
2516 (KJS::FunctionCallValueNode::optimizeVariableAccess):
2517 (KJS::FunctionCallValueNode::evaluate):
2518 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
2519 (KJS::FunctionCallResolveNode::inlineEvaluate):
2520 (KJS::FunctionCallResolveNode::evaluate):
2521 (KJS::FunctionCallResolveNode::evaluateToNumber):
2522 (KJS::FunctionCallResolveNode::evaluateToBoolean):
2523 (KJS::FunctionCallResolveNode::evaluateToInt32):
2524 (KJS::FunctionCallResolveNode::evaluateToUInt32):
2525 (KJS::LocalVarFunctionCallNode::inlineEvaluate):
2526 (KJS::LocalVarFunctionCallNode::evaluate):
2527 (KJS::LocalVarFunctionCallNode::evaluateToNumber):
2528 (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
2529 (KJS::LocalVarFunctionCallNode::evaluateToInt32):
2530 (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
2531 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
2532 (KJS::ScopedVarFunctionCallNode::evaluate):
2533 (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
2534 (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
2535 (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
2536 (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
2537 (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
2538 (KJS::NonLocalVarFunctionCallNode::evaluate):
2539 (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
2540 (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
2541 (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
2542 (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
2543 (KJS::FunctionCallBracketNode::optimizeVariableAccess):
2544 (KJS::FunctionCallBracketNode::evaluate):
2545 (KJS::FunctionCallDotNode::optimizeVariableAccess):
2546 (KJS::FunctionCallDotNode::inlineEvaluate):
2547 (KJS::FunctionCallDotNode::evaluate):
2548 (KJS::FunctionCallDotNode::evaluateToNumber):
2549 (KJS::FunctionCallDotNode::evaluateToBoolean):
2550 (KJS::FunctionCallDotNode::evaluateToInt32):
2551 (KJS::FunctionCallDotNode::evaluateToUInt32):
2552 (KJS::PostIncResolveNode::optimizeVariableAccess):
2553 (KJS::PostIncResolveNode::evaluate):
2554 (KJS::PostIncLocalVarNode::evaluate):
2555 (KJS::PostDecResolveNode::optimizeVariableAccess):
2556 (KJS::PostDecResolveNode::evaluate):
2557 (KJS::PostDecLocalVarNode::evaluate):
2558 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
2559 (KJS::PostDecLocalVarNode::evaluateToNumber):
2560 (KJS::PostDecLocalVarNode::evaluateToBoolean):
2561 (KJS::PostDecLocalVarNode::evaluateToInt32):
2562 (KJS::PostDecLocalVarNode::evaluateToUInt32):
2563 (KJS::PostfixBracketNode::optimizeVariableAccess):
2564 (KJS::PostIncBracketNode::evaluate):
2565 (KJS::PostDecBracketNode::evaluate):
2566 (KJS::PostfixDotNode::optimizeVariableAccess):
2567 (KJS::PostIncDotNode::evaluate):
2568 (KJS::PostDecDotNode::evaluate):
2569 (KJS::PostfixErrorNode::evaluate):
2570 (KJS::DeleteResolveNode::optimizeVariableAccess):
2571 (KJS::DeleteResolveNode::evaluate):
2572 (KJS::LocalVarDeleteNode::evaluate):
2573 (KJS::DeleteBracketNode::optimizeVariableAccess):
2574 (KJS::DeleteBracketNode::evaluate):
2575 (KJS::DeleteDotNode::optimizeVariableAccess):
2576 (KJS::DeleteDotNode::evaluate):
2577 (KJS::DeleteValueNode::optimizeVariableAccess):
2578 (KJS::DeleteValueNode::evaluate):
2579 (KJS::VoidNode::optimizeVariableAccess):
2580 (KJS::VoidNode::evaluate):
2581 (KJS::TypeOfValueNode::optimizeVariableAccess):
2582 (KJS::TypeOfResolveNode::optimizeVariableAccess):
2583 (KJS::LocalVarTypeOfNode::evaluate):
2584 (KJS::TypeOfResolveNode::evaluate):
2585 (KJS::TypeOfValueNode::evaluate):
2586 (KJS::PreIncResolveNode::optimizeVariableAccess):
2587 (KJS::PreIncLocalVarNode::evaluate):
2588 (KJS::PreIncResolveNode::evaluate):
2589 (KJS::PreDecResolveNode::optimizeVariableAccess):
2590 (KJS::PreDecLocalVarNode::evaluate):
2591 (KJS::PreDecResolveNode::evaluate):
2592 (KJS::PreIncConstNode::evaluate):
2593 (KJS::PreDecConstNode::evaluate):
2594 (KJS::PostIncConstNode::evaluate):
2595 (KJS::PostDecConstNode::evaluate):
2596 (KJS::PrefixBracketNode::optimizeVariableAccess):
2597 (KJS::PreIncBracketNode::evaluate):
2598 (KJS::PreDecBracketNode::evaluate):
2599 (KJS::PrefixDotNode::optimizeVariableAccess):
2600 (KJS::PreIncDotNode::evaluate):
2601 (KJS::PreDecDotNode::evaluate):
2602 (KJS::PrefixErrorNode::evaluate):
2603 (KJS::UnaryPlusNode::optimizeVariableAccess):
2604 (KJS::UnaryPlusNode::evaluate):
2605 (KJS::UnaryPlusNode::evaluateToBoolean):
2606 (KJS::UnaryPlusNode::evaluateToNumber):
2607 (KJS::UnaryPlusNode::evaluateToInt32):
2608 (KJS::UnaryPlusNode::evaluateToUInt32):
2609 (KJS::NegateNode::optimizeVariableAccess):
2610 (KJS::NegateNode::evaluate):
2611 (KJS::NegateNode::evaluateToNumber):
2612 (KJS::BitwiseNotNode::optimizeVariableAccess):
2613 (KJS::BitwiseNotNode::inlineEvaluateToInt32):
2614 (KJS::BitwiseNotNode::evaluate):
2615 (KJS::BitwiseNotNode::evaluateToNumber):
2616 (KJS::BitwiseNotNode::evaluateToBoolean):
2617 (KJS::BitwiseNotNode::evaluateToInt32):
2618 (KJS::BitwiseNotNode::evaluateToUInt32):
2619 (KJS::LogicalNotNode::optimizeVariableAccess):
2620 (KJS::LogicalNotNode::evaluate):
2621 (KJS::LogicalNotNode::evaluateToBoolean):
2622 (KJS::MultNode::optimizeVariableAccess):
2623 (KJS::MultNode::inlineEvaluateToNumber):
2624 (KJS::MultNode::evaluate):
2625 (KJS::MultNode::evaluateToNumber):
2626 (KJS::MultNode::evaluateToBoolean):
2627 (KJS::MultNode::evaluateToInt32):
2628 (KJS::MultNode::evaluateToUInt32):
2629 (KJS::DivNode::optimizeVariableAccess):
2630 (KJS::DivNode::inlineEvaluateToNumber):
2631 (KJS::DivNode::evaluate):
2632 (KJS::DivNode::evaluateToNumber):
2633 (KJS::DivNode::evaluateToInt32):
2634 (KJS::DivNode::evaluateToUInt32):
2635 (KJS::ModNode::optimizeVariableAccess):
2636 (KJS::ModNode::inlineEvaluateToNumber):
2637 (KJS::ModNode::evaluate):
2638 (KJS::ModNode::evaluateToNumber):
2639 (KJS::ModNode::evaluateToBoolean):
2640 (KJS::ModNode::evaluateToInt32):
2641 (KJS::ModNode::evaluateToUInt32):
2642 (KJS::throwOutOfMemoryErrorToNumber):
2644 (KJS::addSlowCaseToNumber):
2647 (KJS::AddNode::optimizeVariableAccess):
2648 (KJS::AddNode::evaluate):
2649 (KJS::AddNode::inlineEvaluateToNumber):
2650 (KJS::AddNode::evaluateToNumber):
2651 (KJS::AddNode::evaluateToInt32):
2652 (KJS::AddNode::evaluateToUInt32):
2653 (KJS::AddNumbersNode::inlineEvaluateToNumber):
2654 (KJS::AddNumbersNode::evaluate):
2655 (KJS::AddNumbersNode::evaluateToNumber):
2656 (KJS::AddNumbersNode::evaluateToInt32):
2657 (KJS::AddNumbersNode::evaluateToUInt32):
2658 (KJS::AddStringsNode::evaluate):
2659 (KJS::AddStringLeftNode::evaluate):
2660 (KJS::AddStringRightNode::evaluate):
2661 (KJS::SubNode::optimizeVariableAccess):
2662 (KJS::SubNode::inlineEvaluateToNumber):
2663 (KJS::SubNode::evaluate):
2664 (KJS::SubNode::evaluateToNumber):
2665 (KJS::SubNode::evaluateToInt32):
2666 (KJS::SubNode::evaluateToUInt32):
2667 (KJS::LeftShiftNode::optimizeVariableAccess):
2668 (KJS::LeftShiftNode::inlineEvaluateToInt32):
2669 (KJS::LeftShiftNode::evaluate):
2670 (KJS::LeftShiftNode::evaluateToNumber):
2671 (KJS::LeftShiftNode::evaluateToInt32):
2672 (KJS::LeftShiftNode::evaluateToUInt32):
2673 (KJS::RightShiftNode::optimizeVariableAccess):
2674 (KJS::RightShiftNode::inlineEvaluateToInt32):
2675 (KJS::RightShiftNode::evaluate):
2676 (KJS::RightShiftNode::evaluateToNumber):
2677 (KJS::RightShiftNode::evaluateToInt32):
2678 (KJS::RightShiftNode::evaluateToUInt32):
2679 (KJS::UnsignedRightShiftNode::optimizeVariableAccess):
2680 (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
2681 (KJS::UnsignedRightShiftNode::evaluate):
2682 (KJS::UnsignedRightShiftNode::evaluateToNumber):
2683 (KJS::UnsignedRightShiftNode::evaluateToInt32):
2684 (KJS::UnsignedRightShiftNode::evaluateToUInt32):
2687 (KJS::LessNode::optimizeVariableAccess):
2688 (KJS::LessNode::inlineEvaluateToBoolean):
2689 (KJS::LessNode::evaluate):
2690 (KJS::LessNode::evaluateToBoolean):
2691 (KJS::LessNumbersNode::inlineEvaluateToBoolean):
2692 (KJS::LessNumbersNode::evaluate):
2693 (KJS::LessNumbersNode::evaluateToBoolean):
2694 (KJS::LessStringsNode::inlineEvaluateToBoolean):
2695 (KJS::LessStringsNode::evaluate):
2696 (KJS::LessStringsNode::evaluateToBoolean):
2697 (KJS::GreaterNode::optimizeVariableAccess):
2698 (KJS::GreaterNode::inlineEvaluateToBoolean):
2699 (KJS::GreaterNode::evaluate):
2700 (KJS::GreaterNode::evaluateToBoolean):
2701 (KJS::LessEqNode::optimizeVariableAccess):
2702 (KJS::LessEqNode::inlineEvaluateToBoolean):
2703 (KJS::LessEqNode::evaluate):
2704 (KJS::LessEqNode::evaluateToBoolean):
2705 (KJS::GreaterEqNode::optimizeVariableAccess):
2706 (KJS::GreaterEqNode::inlineEvaluateToBoolean):
2707 (KJS::GreaterEqNode::evaluate):
2708 (KJS::GreaterEqNode::evaluateToBoolean):
2709 (KJS::InstanceOfNode::optimizeVariableAccess):
2710 (KJS::InstanceOfNode::evaluate):
2711 (KJS::InstanceOfNode::evaluateToBoolean):
2712 (KJS::InNode::optimizeVariableAccess):
2713 (KJS::InNode::evaluate):
2714 (KJS::InNode::evaluateToBoolean):
2715 (KJS::EqualNode::optimizeVariableAccess):
2716 (KJS::EqualNode::inlineEvaluateToBoolean):
2717 (KJS::EqualNode::evaluate):
2718 (KJS::EqualNode::evaluateToBoolean):
2719 (KJS::NotEqualNode::optimizeVariableAccess):
2720 (KJS::NotEqualNode::inlineEvaluateToBoolean):
2721 (KJS::NotEqualNode::evaluate):
2722 (KJS::NotEqualNode::evaluateToBoolean):
2723 (KJS::StrictEqualNode::optimizeVariableAccess):
2724 (KJS::StrictEqualNode::inlineEvaluateToBoolean):
2725 (KJS::StrictEqualNode::evaluate):
2726 (KJS::StrictEqualNode::evaluateToBoolean):
2727 (KJS::NotStrictEqualNode::optimizeVariableAccess):
2728 (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
2729 (KJS::NotStrictEqualNode::evaluate):
2730 (KJS::NotStrictEqualNode::evaluateToBoolean):
2731 (KJS::BitAndNode::optimizeVariableAccess):
2732 (KJS::BitAndNode::evaluate):
2733 (KJS::BitAndNode::inlineEvaluateToInt32):
2734 (KJS::BitAndNode::evaluateToNumber):
2735 (KJS::BitAndNode::evaluateToBoolean):
2736 (KJS::BitAndNode::evaluateToInt32):
2737 (KJS::BitAndNode::evaluateToUInt32):
2738 (KJS::BitXOrNode::optimizeVariableAccess):
2739 (KJS::BitXOrNode::inlineEvaluateToInt32):
2740 (KJS::BitXOrNode::evaluate):
2741 (KJS::BitXOrNode::evaluateToNumber):
2742 (KJS::BitXOrNode::evaluateToBoolean):
2743 (KJS::BitXOrNode::evaluateToInt32):
2744 (KJS::BitXOrNode::evaluateToUInt32):
2745 (KJS::BitOrNode::optimizeVariableAccess):
2746 (KJS::BitOrNode::inlineEvaluateToInt32):
2747 (KJS::BitOrNode::evaluate):
2748 (KJS::BitOrNode::evaluateToNumber):
2749 (KJS::BitOrNode::evaluateToBoolean):
2750 (KJS::BitOrNode::evaluateToInt32):
2751 (KJS::BitOrNode::evaluateToUInt32):
2752 (KJS::LogicalAndNode::optimizeVariableAccess):
2753 (KJS::LogicalAndNode::evaluate):
2754 (KJS::LogicalAndNode::evaluateToBoolean):
2755 (KJS::LogicalOrNode::optimizeVariableAccess):
2756 (KJS::LogicalOrNode::evaluate):
2757 (KJS::LogicalOrNode::evaluateToBoolean):
2758 (KJS::ConditionalNode::optimizeVariableAccess):
2759 (KJS::ConditionalNode::evaluate):
2760 (KJS::ConditionalNode::evaluateToBoolean):
2761 (KJS::ConditionalNode::evaluateToNumber):
2762 (KJS::ConditionalNode::evaluateToInt32):
2763 (KJS::ConditionalNode::evaluateToUInt32):
2764 (KJS::valueForReadModifyAssignment):
2765 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
2766 (KJS::AssignResolveNode::optimizeVariableAccess):
2767 (KJS::ReadModifyLocalVarNode::evaluate):
2768 (KJS::AssignLocalVarNode::evaluate):
2769 (KJS::ReadModifyConstNode::evaluate):
2770 (KJS::AssignConstNode::evaluate):
2771 (KJS::ReadModifyResolveNode::evaluate):
2772 (KJS::AssignResolveNode::evaluate):
2773 (KJS::AssignDotNode::optimizeVariableAccess):
2774 (KJS::AssignDotNode::evaluate):
2775 (KJS::ReadModifyDotNode::optimizeVariableAccess):
2776 (KJS::ReadModifyDotNode::evaluate):
2777 (KJS::AssignErrorNode::evaluate):
2778 (KJS::AssignBracketNode::optimizeVariableAccess):
2779 (KJS::AssignBracketNode::evaluate):
2780 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
2781 (KJS::ReadModifyBracketNode::evaluate):
2782 (KJS::CommaNode::optimizeVariableAccess):
2783 (KJS::CommaNode::evaluate):
2784 (KJS::ConstDeclNode::optimizeVariableAccess):
2785 (KJS::ConstDeclNode::handleSlowCase):
2786 (KJS::ConstDeclNode::evaluateSingle):
2787 (KJS::ConstDeclNode::evaluate):
2788 (KJS::ConstStatementNode::optimizeVariableAccess):
2789 (KJS::ConstStatementNode::execute):
2790 (KJS::statementListExecute):
2791 (KJS::BlockNode::optimizeVariableAccess):
2792 (KJS::BlockNode::execute):
2793 (KJS::EmptyStatementNode::execute):
2794 (KJS::ExprStatementNode::optimizeVariableAccess):
2795 (KJS::ExprStatementNode::execute):
2796 (KJS::VarStatementNode::optimizeVariableAccess):
2797 (KJS::VarStatementNode::execute):
2798 (KJS::IfNode::optimizeVariableAccess):
2799 (KJS::IfNode::execute):
2800 (KJS::IfElseNode::optimizeVariableAccess):
2801 (KJS::IfElseNode::execute):
2802 (KJS::DoWhileNode::optimizeVariableAccess):
2803 (KJS::DoWhileNode::execute):
2804 (KJS::WhileNode::optimizeVariableAccess):
2805 (KJS::WhileNode::execute):
2806 (KJS::ForNode::optimizeVariableAccess):
2807 (KJS::ForNode::execute):
2808 (KJS::ForInNode::optimizeVariableAccess):
2809 (KJS::ForInNode::execute):
2810 (KJS::ContinueNode::execute):
2811 (KJS::BreakNode::execute):
2812 (KJS::ReturnNode::optimizeVariableAccess):
2813 (KJS::ReturnNode::execute):
2814 (KJS::WithNode::optimizeVariableAccess):
2815 (KJS::WithNode::execute):
2816 (KJS::CaseClauseNode::optimizeVariableAccess):
2817 (KJS::CaseClauseNode::evaluate):
2818 (KJS::CaseClauseNode::executeStatements):
2819 (KJS::ClauseListNode::optimizeVariableAccess):
2820 (KJS::CaseBlockNode::optimizeVariableAccess):
2821 (KJS::CaseBlockNode::executeBlock):
2822 (KJS::SwitchNode::optimizeVariableAccess):
2823 (KJS::SwitchNode::execute):
2824 (KJS::LabelNode::optimizeVariableAccess):
2825 (KJS::LabelNode::execute):
2826 (KJS::ThrowNode::optimizeVariableAccess):
2827 (KJS::ThrowNode::execute):
2828 (KJS::TryNode::optimizeVariableAccess):
2829 (KJS::TryNode::execute):
2830 (KJS::ProgramNode::initializeSymbolTable):
2831 (KJS::ScopeNode::optimizeVariableAccess):
2832 (KJS::ProgramNode::processDeclarations):
2833 (KJS::EvalNode::processDeclarations):
2834 (KJS::ProgramNode::execute):
2835 (KJS::EvalNode::execute):
2836 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
2837 (KJS::FuncDeclNode::execute):
2838 (KJS::FuncExprNode::evaluate):
2843 (KJS::ArgumentsNode::):
2845 2008-04-23 Oliver Hunt <oliver@apple.com>
2849 Bug 18672: SQUIRRELFISH: codegen fails with a large number of temporaries
2850 <https://bugs.webkit.org/show_bug.cgi?id=18672>
2852 Add a SegmentedVector type, which provides a Vector<T> which maintains
2853 existing memory locations during resize. This allows dynamically sizing
2854 local, temporary and label "vectors" in CodeGenerator.
2856 * JavaScriptCore.xcodeproj/project.pbxproj:
2857 * VM/CodeGenerator.cpp:
2858 (KJS::CodeGenerator::addVar):
2859 (KJS::CodeGenerator::CodeGenerator):
2860 (KJS::CodeGenerator::newTemporary):
2861 (KJS::CodeGenerator::newLabel):
2862 * VM/CodeGenerator.h:
2863 * VM/SegmentedVector.h: Added.
2864 (KJS::SegmentedVector::SegmentedVector):
2865 (KJS::SegmentedVector::~SegmentedVector):
2866 (KJS::SegmentedVector::last):
2867 (KJS::SegmentedVector::append):
2868 (KJS::SegmentedVector::removeLast):
2869 (KJS::SegmentedVector::size):
2870 (KJS::SegmentedVector::operator[]):
2871 (KJS::SegmentedVector::resize):
2872 (KJS::SegmentedVector::shrink):
2873 (KJS::SegmentedVector::grow):
2875 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2877 Reviewed by Maciej Stachowiak.
2879 A little refactoring in preparation for supporting 'arguments'.
2881 Fixes 2 regression tests.
2883 SunSpider reports no change.
2885 We now check the activation register, instead of the codeBlock, to
2886 determine whether we need to tear off the activation. This is to support
2887 "f.arguments", which will create an activation/arguments pair for f,
2888 even though the needsFullScopeChain flag is false for f's codeBlock.
2890 The test fixes resulted from calling initializeCallFrame for re-entrant
2891 function code, instead of initializing (not enough) parts of the call
2894 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2898 - propagate the "this" value properly to local eval
2900 (fixes a measly one regression test)
2903 (KJS::CodeBlock::CodeBlock):
2904 (KJS::ProgramCodeBlock::ProgramCodeBlock):
2905 (KJS::EvalCodeBlock::EvalCodeBlock):
2907 (KJS::Machine::privateExecute):
2909 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2913 Add support for function declarations in eval code.
2915 (this fixes 12 more regression tests)
2918 * VM/CodeGenerator.cpp:
2919 (KJS::CodeGenerator::CodeGenerator):
2920 * VM/CodeGenerator.h:
2922 (KJS::Machine::execute):
2924 (KJS::EvalNode::generateCode):
2926 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2930 Implement LabelNode.
2932 * VM/CodeGenerator.cpp:
2933 (KJS::CodeGenerator::pushJumpContext):
2934 (KJS::CodeGenerator::jumpContextForContinue):
2935 (KJS::CodeGenerator::jumpContextForBreak):
2936 * VM/CodeGenerator.h:
2938 (KJS::DoWhileNode::emitCode):
2939 (KJS::WhileNode::emitCode):
2940 (KJS::ForNode::emitCode):
2941 (KJS::ForInNode::emitCode):
2942 (KJS::ContinueNode::emitCode):
2943 (KJS::BreakNode::emitCode):
2944 (KJS::SwitchNode::emitCode):
2945 (KJS::LabelNode::emitCode):
2947 2008-04-22 Geoffrey Garen <ggaren@apple.com>
2949 Reviewed by Oliver Hunt.
2951 Fixed crash when unwinding from exceptions inside eval.
2954 (KJS::Machine::unwindCallFrame): Don't assume that the top of the
2955 current call frame's scope chain is an activation: it can be the global
2958 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2963 (main): Convert signals to exit codes, so that crashing tests are
2964 detected as regression test failures.
2966 2008-04-22 Geoffrey Garen <ggaren@apple.com>
2968 Reviewed by Oliver Hunt and Maciej Stachowiak.
2970 Renamed "needsActivation" to "needsFullScopeChain" because lying will
2971 make hair grow on the backs of your hands.
2973 2008-04-21 Geoffrey Garen <ggaren@apple.com>
2975 Reviewed by Maciej Stachowiak.
2977 Fixed ScopeChainNode lifetime problems:
2979 (1) In "with" and "catch" scopes, we would construct a ScopeChain
2980 object and then jump across its destructor, leaking the ScopeChainNode
2983 (2) In global and eval scopes, we would fail to initially ref
2984 "scopeChain", causing us to overrelease it later. Now that we ref
2985 "scopeChain" properly, we also need to deref it when the script
2988 SunSpider reports a .2% regression, but an earlier round of ScopeChain
2989 refactoring was a .4% speedup, so there.
2991 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2995 - use global object instead of null for "this" on unqualified calls
2997 This fixes 10 more JSC test regressions.
3000 (KJS::Machine::privateExecute):
3002 2008-04-22 Maciej Stachowiak <mjs@apple.com>
3006 - throw proper exceptions for objects that don't implement call or construct
3008 This fixes 21 more JSC test regressions. It is also seemingly an
3011 * VM/ExceptionHelpers.cpp:
3012 (KJS::createNotAnObjectError):
3013 (KJS::createNotAConstructorError):
3014 (KJS::createNotAFunctionError):
3015 * VM/ExceptionHelpers.h:
3017 (KJS::Machine::privateExecute):
3019 2008-04-21 Oliver Hunt <oliver@apple.com>
3023 Implement emitCode for ConstDeclNode.
3025 This fixes the crash (assertion) in js1_5/Scope/scope-001.js
3027 * VM/CodeGenerator.cpp:
3028 (KJS::CodeGenerator::registerForLocalConstInit):
3029 * VM/CodeGenerator.h:
3031 (KJS::AssignResolveNode::emitCode):
3032 (KJS::ConstDeclNode::emitCodeSingle):
3033 (KJS::ConstDeclNode::emitCode):
3034 (KJS::ConstStatementNode::emitCode):
3037 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3041 - add some support for the split window object
3043 This fixes many layout tests.
3046 (KJS::resolveBaseAndFunc): Use toThisObject() to ensure we get the
3047 wrapper global, if one exists, as the "this" object.
3049 (KJS::globalFuncEval): Use toGlobalObject() to handle the wrapper
3052 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3056 - restore ScopeChain::operator= to avoid crash on many layout tests
3058 Otherwise, FunctionImp::setScope would cause a reference
3059 underflow. I implemented using the copy construct and swap idiom.
3061 * kjs/scope_chain.h:
3062 (KJS::ScopeChain::swap):
3063 (KJS::ScopeChain::operator=):
3065 2008-04-21 Oliver Hunt <oliver@apple.com>
3069 Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
3070 <https://bugs.webkit.org/show_bug.cgi?id=18649>
3072 Allocate a callframe for eval() and initialise with a null codeBlock to
3073 indicate native code. This prevents the unwinder from clobbering the
3077 (KJS::Machine::execute):
3079 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3081 Reviewed by Sam Weinig.
3083 Removed ScopeChain::push(ScopeChain&) because it was unused. Moved
3084 ScopeChain::print to ScopeChainNode.
3086 ScopeChain is now nothing more than a resource-handling wrapper around
3089 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3093 Bug 18671: SquirrelFish: continue inside switch fails
3094 <https://bugs.webkit.org/show_bug.cgi?id=18671>
3096 * VM/CodeGenerator.cpp:
3097 (KJS::CodeGenerator::jumpContextForLabel):
3098 * VM/CodeGenerator.h:
3100 (KJS::ContinueNode::emitCode):
3102 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3104 Reviewed by Sam Weinig.
3106 Moved push(JSObject*) and pop() from ScopeChain to ScopeChainNode,
3107 rearranging scope_chain.h a bit.
3109 SunSpider reports no change.
3111 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3113 Reviewed by Sam Weinig.
3115 Moved bottom() from ScopeChain to ScopeChainNode, simplifying it based
3116 on the knowledge that the ScopeChain is never empty.
3118 SunSpider reports no change.
3120 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3122 Reviewed by Oliver Hunt.
3124 Moved begin() and end() from ScopeChain to ScopeChainNode.
3126 Also marked a few methods "const".
3128 SunSpider reports no change.
3130 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3132 Reviewed by Maciej Stachowiak.
3134 Turned ScopeChain::depth into a stand-alone function, and simplified it
3137 I also moved ScopeChain::depth to Machine.cpp because it doesn't report
3138 the true depth of the ScopeChain -- just the Machine's perspective of
3139 its depth within a given call frame.
3141 SunSpider reports no change.
3143 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3145 Reviewed by Maciej Stachowiak.
3147 Removed indirection in ScopeChain::ref / ScopeChain::deref.
3149 SunSpider reports no change.
3151 * kjs/scope_chain.h:
3152 (KJS::ScopeChain::ScopeChain):
3153 (KJS::ScopeChain::~ScopeChain):
3154 (KJS::ScopeChain::clear):
3156 2008-04-21 Oliver Hunt <oliver@apple.com>
3158 Reviewed by NOBODY(Build fix)
3163 (KJS::ConstDeclNode::evaluateSingle):
3165 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3169 Bug 18664: SQUIRRELFISH: correctly throw a SyntaxError when parsing of eval code fails
3170 <https://bugs.webkit.org/show_bug.cgi?id=18664>
3172 Correctly throw a SyntaxError when parsing of eval code fails.
3177 2008-04-21 Oliver Hunt <oliver@apple.com>
3181 Partial fix for Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
3183 Make sure we correct the register state before jumping to vm_throw.
3186 (KJS::Machine::privateExecute):
3188 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3190 Reviewed by Maciej Stachowiak.
3192 Simplified ScopeChain ref/deref.
3194 SunSpider reports a .4% speedup.
3196 * kjs/scope_chain.h:
3197 (KJS::ScopeChainNode::ref): Removed this function because it was nonsense.
3198 ScopeChainNodes are initialized with a refCount of 1, so the loop was
3199 guaranteed to iterate exactly once.
3201 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3203 Reviewed by Maciej Stachowiak.
3205 Removed support for empty ScopeChains.
3207 SunSpider reports no change.
3209 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3211 Reviewed by Maciej Stachowiak.
3213 Removed some completely unused ScopeChain member functions.
3215 SunSpider reports no change.
3217 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3219 Reviewed by Maciej Stachowiak.
3221 Avoid creating unnecessary ScopeChain objects, to reduce refcount churn.
3223 SunSpider reports no change.
3225 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3227 Rubber stamped by Alexey.
3234 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3238 - only print "End:" output when -d flag is passed.
3240 This fixes half of our failing JSC regression tests.
3245 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3249 Add support for variable declarations in eval code.
3252 (KJS::EvalCodeBlock::EvalCodeBlock):
3253 * VM/CodeGenerator.cpp:
3254 (KJS::CodeGenerator::CodeGenerator):
3255 * VM/CodeGenerator.h:
3257 (KJS::Machine::execute):
3260 (KJS::globalFuncEval):
3262 (KJS::EvalNode::generateCode):
3266 2008-04-20 Oliver Hunt <oliver@apple.com>
3270 Throw exceptions for invalid continue, break, and return statements.
3272 Simple refactoring and extension of Cameron's AssignErrorNode, etc patch
3274 * VM/CodeGenerator.cpp:
3275 (KJS::CodeGenerator::CodeGenerator):
3276 (KJS::CodeGenerator::pushJumpContext):
3277 (KJS::CodeGenerator::popJumpContext):
3278 (KJS::CodeGenerator::jumpContextForLabel):
3279 * VM/CodeGenerator.h:
3281 (KJS::Node::emitThrowError):
3282 (KJS::ContinueNode::emitCode):
3283 (KJS::BreakNode::emitCode):
3284 (KJS::ReturnNode::emitCode):
3287 2008-04-20 Geoffrey Garen <ggaren@apple.com>
3289 Reviewed by Oliver Hunt.
3291 Removed Machine.cpp from AllInOneFile.cpp, and manually inlined a few
3292 things that used to be inlined automatically.
3294 1.9% speedup on SunSpider.
3296 My hope is that we'll face fewer surprises in Machine.cpp codegen, now
3297 that GCC is making fewer decisions. The speedup seems to confirm that.
3299 2008-04-20 Oliver Hunt <oliver@apple.com>
3303 Bug 18642: Iterator context may get placed into the return register, leading to much badness
3304 <https://bugs.webkit.org/show_bug.cgi?id=18642>
3306 To prevent incorrectly reusing what will become the result register for
3307 eval and global code execution, we need to request and ref the destination
3308 in advance of codegen. Unfortunately this may lead to unnecessary copying,
3309 although in future we can probably limit this. Curiously SunSpider shows
3310 a progression in a number of tests, although it comes out as a wash overall.
3313 (KJS::EvalNode::emitCode):
3314 (KJS::ProgramNode::emitCode):
3316 2008-04-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3320 Add support for AssignErrorNode, PrefixErrorNode, and PostfixErrorNode.
3323 (KJS::CodeBlock::dump):
3324 * VM/CodeGenerator.cpp:
3325 (KJS::CodeGenerator::emitCreateError):
3326 * VM/CodeGenerator.h:
3328 (KJS::Machine::privateExecute):
3331 (KJS::PostfixErrorNode::emitCode):
3332 (KJS::PrefixErrorNode::emitCode):
3333 (KJS::AssignErrorNode::emitCode):
3336 2008-04-20 Oliver Hunt <oliver@apple.com>
3338 Reviewed by Geoff and Mark.
3340 Provide line number information in exceptions
3342 Simple patch, adds line number information metadata to CodeBlock
3343 and a simple method to get the line number responsible for a given
3347 (KJS::CodeBlock::lineNumberForVPC):
3349 * VM/CodeGenerator.h:
3350 (KJS::CodeGenerator::emitNode):
3352 (KJS::Machine::throwException):
3354 2008-04-20 Oliver Hunt <oliver@apple.com>
3358 Provide "sourceURL" in exceptions
3362 (KJS::Machine::throwException):
3364 (KJS::EvalNode::generateCode):
3365 (KJS::ProgramNode::generateCode):
3367 2008-04-19 Oliver Hunt <oliver@apple.com>
3371 Don't call emitCode directly on subnodes, instead use CodeGenerator::emitNode
3373 This patch just a preparation for tracking line numbers.
3376 (KJS::ObjectLiteralNode::emitCode):
3377 (KJS::PropertyListNode::emitCode):
3378 (KJS::ArgumentListNode::emitCode):
3379 (KJS::TryNode::emitCode):
3381 2008-04-19 Oliver Hunt <oliver@apple.com>
3385 Bug 18619: Support continue, break, and return in try .. finally blocks
3386 <https://bugs.webkit.org/show_bug.cgi?id=18619>
3388 This patch replaces the current partial finally support (which uses code
3389 duplication to achieve what it does) with a subroutine based approach.
3390 This has a number of advantages over code duplication:
3392 * Simplified exception handling as the finaliser code only exists in
3393 one place, so no "magic" is needed to get the correct handler for a
3395 * When we support instruction to line number mapping we won't need to
3396 worry about the dramatic code movement caused by duplication
3398 On the downside it is necessary to add two new opcodes, op_jsr and op_sret
3399 to enter and exit the finaliser subroutines, happily SunSpider reports
3400 a performance progression (gcc amazes me) and ubench reports a wash.
3402 While jsr and sret provide a mechanism that allows us to enter and exit
3403 any arbitrary finaliser we need to, it was still necessary to increase
3404 the amount of information tracked when entering and exiting both finaliser
3405 scopes and dynamic scopes ("with"). This means "scopeDepth" is now
3406 the combination of "finaliserDepth" and "dynamicScopeDepth". We also
3407 now use a scopeContextStack to ensure that we pop scopes and execute
3408 finalisers in the correct order. This increases the cost of "with" nodes
3409 during codegen, but it should not be significant enough to effect real
3410 world performance and greatly simplifies codegen for return, break and
3411 continue when interacting with finalisers.
3414 (KJS::CodeBlock::dump):
3415 Pretty printing of jsr/sret opcodes
3417 * VM/CodeGenerator.cpp:
3418 (KJS::CodeGenerator::CodeGenerator):
3419 (KJS::CodeGenerator::emitPushScope):
3420 (KJS::CodeGenerator::emitPopScope):
3421 Dynamic scopes need to be tracked on the scopeContextStack now
3423 (KJS::CodeGenerator::pushFinallyContext):
3424 (KJS::CodeGenerator::popFinallyContext):
3425 Handle entry and exit from code regions with finalisers. This is
3426 needed solely to support return, continue and break inside finaliser
3429 (KJS::CodeGenerator::emitComplexJumpScopes):
3430 Helper function for emitJumpScopes to handle the complex codegen
3431 needed to handle return, continue and break inside a finaliser region
3433 (KJS::CodeGenerator::emitJumpScopes):
3434 Updated to be aware of finalisers, if a cross-scope jump occurs inside
3435 a finaliser we hand off codegen to emitComplexJumpScopes, otherwise
3436 we can handle the normal (trivial) case with a single instruction.
3438 (KJS::CodeGenerator::emitJumpSubroutine):
3439 (KJS::CodeGenerator::emitSubroutineReturn):
3440 Trivial opcode emitter functions.
3442 * VM/CodeGenerator.h:
3443 (KJS::CodeGenerator::scopeDepth):
3445 (KJS::Machine::privateExecute):
3446 Implement op_jsr and op_sret.
3449 Ad op_jsr and op_sret
3452 (KJS::TryNode::emitCode):
3453 Fix codegen for new finaliser model.
3455 2008-04-17 Mark Rowe <mrowe@apple.com>
3457 Rubber-stamped by Oliver Hunt.
3459 Remove unnecessary files from testkjs, testapi and minidom targets.
3461 * JavaScriptCore.xcodeproj/project.pbxproj:
3463 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3465 Reviewed by Oliver Hunt.
3467 Fixed ASSERT seen during run-sunspider of a debug build.
3469 * VM/CodeGenerator.h: Made the default codegen buffers bigger. SunSpider
3470 runs all tests in one global environment, so you end up with more than
3471 128 locals. This is just a stop-gap until we code up a real
3472 solution to arbitrary symbol and label limits.
3474 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3476 Reviewed by Oliver Hunt.
3478 Fixed a bug in exception unwinding, where we wouldn't deref the scope
3479 chain in global scope, so we would leak ScopeChainNodes when exceptions
3480 were thrown inside "with" and "catch" scopes.
3482 Also did some cleanup of the unwinding code along the way.
3484 Scope chain reference counting is still wrong in a few ways. I thought
3485 I would fix this portion of it first.
3487 run-sunspider shows no change.
3490 (KJS::Machine::unwindCallFrame):
3491 (KJS::Machine::throwException):
3492 (KJS::Machine::privateExecute):
3495 2008-04-17 Oliver Hunt <oliver@apple.com>
3499 Add more exception checking to toNumber conversions
3501 This corrects op_pre_dec, op_negate, op_mod and op_sub.
3504 (KJS::Machine::privateExecute):
3506 2008-04-17 Geoffrey Garen <ggaren@apple.com> and Cameron Zwarich <cwzwarich@uwaterloo.ca>
3508 Reviewed by Oliver Hunt.
3512 Introduced a new opcode: op_call_eval. In the normal case, it performs
3513 an eval. In the case where eval has been overridden in some way, it
3514 performs a function call.
3516 * VM/CodeGenerator.h: Added a feature so the code generator knows not
3517 to optimized locals in eval code.
3519 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3521 Reviewed by Sam Weinig.
3523 Added some ASSERTs to document codegen failures in
3524 run-javascriptcore-tests.
3526 For all tests, program-level codegen now either succeeds, or fails with
3529 * VM/CodeGenerator.cpp:
3530 (KJS::CodeGenerator::addVar):
3531 (KJS::CodeGenerator::CodeGenerator):
3532 (KJS::CodeGenerator::newTemporary):
3533 (KJS::CodeGenerator::newLabel):
3535 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3537 Reviewed by Maciej Stachowiak.
3539 Fixed another case of a dst register being an unreferenced temporary
3540 (caused an ASSERT when running the full sunspider suite).
3543 (KJS::CaseBlockNode::emitCodeForBlock):
3545 2008-04-16 Maciej Stachowiak <mjs@apple.com>
3549 - add documentation (and meaningful parameter names) for arithmetic and bitwise binary ops
3552 (KJS::CodeBlock::dump):
3553 * VM/CodeGenerator.cpp:
3554 (KJS::CodeGenerator::emitMul):
3555 (KJS::CodeGenerator::emitDiv):
3556 (KJS::CodeGenerator::emitMod):
3557 (KJS::CodeGenerator::emitSub):
3558 (KJS::CodeGenerator::emitLeftShift):
3559 (KJS::CodeGenerator::emitRightShift):