1 2008-05-22 Oliver Hunt <oliver@apple.com>
5 Bug 19116: SquirrelFish shouldn't regress on variable lookups
6 <https://bugs.webkit.org/show_bug.cgi?id=19116>
8 Last of the multiscope look up optimisations. This is a wash overall on SunSpider
9 but is a factor of 5-10 improvement in multiscope read/write/modify (eg. ++, --, +=,
10 ... applied to any non-local var).
13 (KJS::PostIncResolveNode::emitCode):
14 (KJS::PostDecResolveNode::emitCode):
15 (KJS::PreIncResolveNode::emitCode):
16 (KJS::PreDecResolveNode::emitCode):
17 (KJS::ReadModifyResolveNode::emitCode):
19 2008-05-22 David Kilzer <ddkilzer@apple.com>
21 <rdar://problem/5954233> Add method to release free memory from FastMalloc
23 Patch suggested by Mark Rowe. Rubber-stamped by Maciej.
25 * JavaScriptCore.exp: Export _releaseFastMallocFreeMemory.
27 (WTF::TCMallocStats::): Added releaseFastMallocFreeMemory() for both
28 system malloc and FastMalloc code paths.
29 * wtf/FastMalloc.h: Define releaseFastMallocFreeMemory().
31 2008-05-22 Oliver Hunt <oliver@apple.com>
35 Roll out r34020 as it causes recursion tests to fail.
38 (KJS::JSObject::call):
40 2008-05-22 Oliver Hunt <oliver@apple.com>
44 Don't leak the SymbolTable when compiling eval code.
47 (KJS::EvalNode::generateCode):
49 2008-05-22 Simon Hausmann <hausmann@webkit.org>
55 * JavaScriptCore.pri: Added DebuggerCallFrame to the build.
56 * VM/LabelID.h: Include limits.h for UINT_MAX.
57 * wtf/VectorTraits.h: Include memory for std::auto_ptr.
59 2008-05-22 Geoffrey Garen <ggaren@apple.com>
61 Reviewed by Adam Roben.
63 Removed the old recursion guard mechanism, since squirrelfish has its
64 own mechanism. Also removed some old JS call tracing code, since we
65 have other ways to do that, too.
67 SunSpider reports no change.
70 (KJS::JSObject::call):
72 2008-05-22 Maciej Stachowiak <mjs@apple.com>
76 - fixed <rdar://problem/5954979> crash on celtic kane JS benchmark
79 (KJS::WithNode::emitCode):
80 (KJS::TryNode::emitCode):
82 2008-05-21 Kevin McCullough <kmccullough@apple.com>
84 Reviewed by Maciej and Geoff.
86 <rdar://problem/5951561> Turn on JavaScript Profiler
87 -As part of the effort to turn on the profiler it would be helpful if it
88 did not need ExecStates to represent the stack location of the currently
90 -We now create each node as necessary with a reference to the current
91 node and each node knows its parent so that the tree can be made without
94 * profiler/Profile.cpp:
95 (KJS::Profile::Profile): The current node starts at the head.
96 (KJS::Profile::stopProfiling): The current node is cleared when profiling
98 (KJS::Profile::willExecute): The current node either adds a new child or
99 starts and returns a reference to an already existing child if the call
100 ID that is requested already exists.
101 (KJS::Profile::didExecute): The current node finishes and returns its
103 * profiler/Profile.h: Use a single callIdentifier instead of a vector
104 since we no longer use the whole stack.
105 * profiler/ProfileNode.cpp: Now profile nodes keep a reference to their
107 (KJS::ProfileNode::ProfileNode): Initialize the parent.
108 (KJS::ProfileNode::didExecute): Record the time and return the parent.
109 (KJS::ProfileNode::addOrStartChild): If the given callIdentifier is
110 already a child, start it and return it, otherwise create a new one and
112 (KJS::ProfileNode::stopProfiling): Same logic, just use the new function.
113 * profiler/ProfileNode.h: Utilize the parent.
114 (KJS::ProfileNode::create):
115 (KJS::ProfileNode::parent):
116 * profiler/Profiler.cpp:
117 (KJS::Profiler::startProfiling): Here is the only place where the
118 ExecState is used to figure out where in the stack the profiler is
120 (KJS::dispatchFunctionToProfiles): Only send one CallIdentifier instead
122 (KJS::Profiler::willExecute): Ditto.
123 (KJS::Profiler::didExecute): Ditto.
124 (KJS::createCallIdentifier): Create only one CallIdentifier.
125 (KJS::createCallIdentifierFromFunctionImp): Ditto.
126 * profiler/Profiler.h:
128 2008-05-21 Darin Adler <darin@apple.com>
132 - https://bugs.webkit.org/show_bug.cgi?id=19180
133 speed up the < operator for the case when both values are integers
135 Makes standalone SunSpider 1.022x faster.
138 (KJS::jsLess): Add a special case for when both are numbers that fit in a JSImmediate.
140 2008-05-21 Maciej Stachowiak <mjs@apple.com>
142 Reviewed by Oliver and Sam.
144 - fixed <rdar://problem/5815631> REGRESSION (r31239): Multiscope optimisation of function calls results in incorrect this value (breaks tvtv.de)
146 Track global this value in the scope chain so we can retrieve it
147 efficiently but it follows lexical scope properly.
150 (KJS::ExecState::globalThisValue):
151 * kjs/JSGlobalObject.h:
152 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData):
153 * kjs/function_object.cpp:
154 (KJS::FunctionObjectImp::construct):
156 (KJS::ScopeChainNode::ScopeChainNode):
157 (KJS::ScopeChainNode::globalThisObject):
158 (KJS::ScopeChainNode::push):
159 (KJS::ScopeChain::ScopeChain):
161 2008-05-21 Kevin McCullough <kmccullough@apple.com>
167 2008-05-21 Kevin McCullough <kmccullough@apple.com>
171 <rdar://problem/5950867> JSProfiler: Allow the profiler to "Focus" a
173 - This patch updatest the times of the visible nodes correctly, but to do
174 so, some of the design of the ProfileNode changed.
176 * JavaScriptCore.exp: export focus' symbol.
177 * profiler/Profile.cpp: ProfileNodes now take a reference to the head of
178 the profile tree to get up-to-date accurate total profile time.
179 (KJS::Profile::Profile): Pass 0 for the head node.
180 (KJS::Profile::stopProfiling): stopProfiling no longer needs the time
181 passed into it, since it can get it from the head and it does not need to
182 be told it is the head because it can figure it out on it's own.
183 (KJS::Profile::willExecute): Set the head node for each created node.
184 * profiler/Profile.h:
185 (KJS::Profile::focus): Instead of taking a CallIdentifier that the caller
186 would have to create, now focus() takes a ProfileNode that they should
187 already have a reference to and focus() can extract the CallIdentifier
189 * profiler/ProfileNode.cpp: Create actual and visible versions fo the
190 total and self times for focus and exclude. Also add a head node
191 reference so that nodes can get information from their head.
192 (KJS::ProfileNode::ProfileNode):
193 (KJS::ProfileNode::stopProfiling): Rename the total and self time
194 variables and set the visual ones to the actual ones, so that without any
195 changes to the visual versions of these variables, their times will match
197 (KJS::ProfileNode::focus): Now focus() has a bool to force it's children
198 to be visible if this node is visible. If this node does not match the
199 CallIdentifier being focused then the visibleTotalTime is only updated if
200 one or more of it's children is the CallIdentifier being focused.
201 (KJS::ProfileNode::restoreAll): Restores all variables with respect to
202 the visible data in the ProfileNode.
203 (KJS::ProfileNode::endAndRecordCall): Name change.
204 (KJS::ProfileNode::debugPrintData): Dump the new variables.
205 (KJS::ProfileNode::debugPrintDataSampleStyle): Name change.
206 * profiler/ProfileNode.h: Use the new variables and reference to the head
208 (KJS::ProfileNode::create):
209 (KJS::ProfileNode::totalTime):
210 (KJS::ProfileNode::setTotalTime):
211 (KJS::ProfileNode::selfTime):
212 (KJS::ProfileNode::setSelfTime):
213 (KJS::ProfileNode::totalPercent):
214 (KJS::ProfileNode::selfPercent):
215 (KJS::ProfileNode::setVisible):
217 2008-05-21 Alp Toker <alp@nuanti.com>
219 GTK+/UNIX testkjs build fix. Include signal.h.
223 2008-05-21 Oliver Hunt <oliver@apple.com>
225 Reviewed by NOBODY (Build fix).
227 Yet more windows build fixes
229 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
231 2008-05-21 Oliver Hunt <oliver@apple.com>
233 Reviewed by NOBODY (Build fix).
235 Yet more windows build fixes
237 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
239 2008-05-21 Alp Toker <alp@nuanti.com>
241 GTK+ build fix. Add DebuggerCallFrame.cpp and take AllInOneFile.cpp
242 changes into account.
246 2008-05-21 Oliver Hunt <oliver@apple.com>
248 Reviewed by NOBODY (Build fix).
250 Add DebuggerCallFrame.{h,cpp} to the project file
252 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
254 2008-05-21 Alp Toker <alp@nuanti.com>
256 GTK+ port build fixes following squirrelfish merge r33979.
260 2008-05-21 Maciej Stachowiak <mjs@apple.com>
264 - save a hash lookup wne writing to global properties
265 0.3% speedup on SunSpider, 7% on bitops-bitwise-and
268 (KJS::resolveBase): Check for being a the end of the scope chain
271 2008-05-21 Alp Toker <alp@nuanti.com>
273 Rubber-stamped by Maciej.
275 Replace non-standard #pragma marks with comments to avoid compiler
278 * profiler/ProfileNode.cpp:
280 2008-05-21 Geoffrey Garen <ggaren@apple.com>
282 Reviewed by Mark Rowe.
284 Fix layout test failure in fast/dom/getter-on-window-object2 introduced in r33961.
286 * JavaScriptCore.exp:
287 * kjs/JSGlobalObject.cpp:
288 (KJS::JSGlobalObject::defineGetter):
289 (KJS::JSGlobalObject::defineSetter):
290 * kjs/JSGlobalObject.h:
292 === End merge of squirrelfish ===
294 2008-05-21 Geoffrey Garen <ggaren@apple.com>
296 Reviewed by Tim Hatcher.
298 Merged with trunk WebCore's new debugger.
300 * kjs/DebuggerCallFrame.cpp:
301 (KJS::DebuggerCallFrame::evaluate): Changed this function to separate
302 the exception value from the return value. The WebKit debugger treats
303 them as one, but the WebCore debugger doesn't.
305 * kjs/DebuggerCallFrame.h:
306 (KJS::DebuggerCallFrame::dynamicGlobalObject): Added a new accessor for
307 the dynamic global object, since the debugger doesn't want the lexical
310 2008-05-21 Oliver Hunt <oliver@apple.com>
314 Bug 19116: SquirrelFish shouldn't regress on variable lookups
315 <https://bugs.webkit.org/show_bug.cgi?id=19116>
317 Optimise cross scope assignment, 0.4% progression in sunspider.
320 (KJS::CodeBlock::dump):
321 * VM/CodeGenerator.cpp:
322 (KJS::CodeGenerator::emitPutScopedVar):
323 * VM/CodeGenerator.h:
325 (KJS::Machine::privateExecute):
328 (KJS::AssignResolveNode::emitCode):
330 2008-05-21 Maciej Stachowiak <mjs@apple.com>
334 - check property map before symbol table in JSGlobalObject::getOwnPropertySlot
335 0.5% speedup on SunSpider
337 * kjs/JSGlobalObject.h:
338 (KJS::JSGlobalObject::getOwnPropertySlot): Check property map before symbol table
339 because symbol table access is likely to have been optimized.
341 2008-05-21 Oliver Hunt <oliver@apple.com>
345 Bug 19116: SquirrelFish shouldn't regress on variable lookups
346 <https://bugs.webkit.org/show_bug.cgi?id=19116>
348 Optimise multiscope lookup of statically resolvable function calls.
349 SunSpider reports a 1.5% improvement, including 37% on
350 controlflow-recursive for some reason :D
353 (KJS::CodeBlock::dump):
354 * VM/CodeGenerator.cpp:
355 (KJS::CodeGenerator::emitResolve):
356 * VM/CodeGenerator.h:
358 (KJS::FunctionCallResolveNode::emitCode):
360 2008-05-21 Maciej Stachowiak <mjs@apple.com>
364 - give JSGlobalObject a special version of getOwnPropertySlot that tells you if the slot is directly writable
365 (WebCore change using this is a 2.6% speedup on in-browser SunSpider).
367 * JavaScriptCore.exp:
368 * kjs/JSGlobalObject.h:
369 (KJS::JSGlobalObject::getOwnPropertySlot):
370 * kjs/JSVariableObject.h:
371 (KJS::JSVariableObject::symbolTableGet):
373 (KJS::JSObject::getDirectLocation):
374 (KJS::JSObject::getOwnPropertySlotForWrite):
375 * kjs/property_map.cpp:
376 (KJS::PropertyMap::getLocation):
377 * kjs/property_map.h:
378 * kjs/property_slot.h:
379 (KJS::PropertySlot::putValue):
381 2008-05-20 Oliver Hunt <oliver@apple.com>
385 Bug 19116: SquirrelFish shouldn't regress on variable lookups
386 <https://bugs.webkit.org/show_bug.cgi?id=19116>
388 This restores multiscope optimisation to simple resolve, producing
389 a 2.6% progression in SunSpider. Have verified that none of the
390 sites broken by the multiscope optimisation in trunk were effected
394 (KJS::CodeBlock::dump):
396 (KJS::CodeBlock::CodeBlock):
397 * VM/CodeGenerator.cpp:
398 (KJS::CodeGenerator::findScopedProperty):
399 (KJS::CodeGenerator::emitResolve):
400 * VM/CodeGenerator.h:
403 (KJS::Machine::privateExecute):
405 * kjs/JSVariableObject.h:
407 2008-05-20 Oliver Hunt <oliver@apple.com>
409 Reviewed by NOBODY (Build fix).
411 Fixerate the windows build.
413 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
414 * VM/CodeGenerator.cpp:
416 * kjs/JSGlobalObject.h:
420 2008-05-20 Oliver Hunt <oliver@apple.com>
424 Bug 19110: SquirrelFish: Google Maps - no maps
425 <https://bugs.webkit.org/show_bug.cgi?id=19110>
427 Correct a comedy of errors present in my original patch to "fix"
428 exceptions occurring midway through pre and post increment. This
429 solution is cleaner than the original, doesn't need the additional
430 opcodes, and as an added benefit does not break Google Maps.
432 Sunspider reports a 0.4% progression.
435 (KJS::CodeBlock::dump):
436 * VM/CodeGenerator.cpp:
437 * VM/CodeGenerator.h:
439 (KJS::Machine::privateExecute):
442 (KJS::PreIncResolveNode::emitCode):
443 (KJS::PreDecResolveNode::emitCode):
444 (KJS::PreIncBracketNode::emitCode):
445 (KJS::PreDecBracketNode::emitCode):
446 (KJS::PreIncDotNode::emitCode):
447 (KJS::PreDecDotNode::emitCode):
449 2008-05-20 Maciej Stachowiak <mjs@apple.com>
453 - inline JSGlobalObject::getOwnPropertySlot
454 1% improvement on in-browser SunSpider (a wash command-line)
456 * kjs/JSGlobalObject.cpp:
457 * kjs/JSGlobalObject.h:
458 (KJS::JSGlobalObject::getOwnPropertySlot):
460 2008-05-18 Oliver Hunt <oliver@apple.com>
464 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
465 <https://bugs.webkit.org/show_bug.cgi?id=18752>
467 Handle exceptions thrown by toString conversion in subscript operators,
468 this should basically complete exception handling in SquirrelFish.
470 Sunspider reports no regression.
473 (KJS::Machine::privateExecute):
475 2008-05-17 Geoffrey Garen <ggaren@apple.com>
477 Reviewed by Oliver Hunt.
479 [Reapplying patch with previously missing files from r33553 -- Oliver]
483 SunSpider reports no change.
485 * JavaScriptCore.xcodeproj/project.pbxproj: Added DebuggerCallFrame.h/.cpp,
486 and created a debugger folder.
488 * VM/CodeGenerator.cpp:
489 (KJS::CodeGenerator::generate): If the debugger is attached, always
490 generate full scope chains for its sake.
493 (KJS::Machine::unwindCallFrame): Notify the debugger when unwinding
494 due to an exception, so it doesn't keep stale call frames around.
496 (KJS::Machine::execute): Set Callee to 0 in eval frames, so the
497 debugger can distinguish them from function call frames.
499 (KJS::Machine::debug): Simplified this function, since the debugger
500 doesn't actually need all the information we used to provide.
502 (KJS::Machine::privateExecute): Treat debugging hooks like other function
503 calls, so the code we hook into (the debugger UI) can be optimized.
505 * kjs/debugger.cpp: Nixed these default callback implementations and
506 made the callbacks pure virtual instead, so the compiler could tell me
507 if I made a mistake in one of the subclasses.
509 * kjs/debugger.h: Removed a bunch of irrelevent data from the debugger
510 callbacks. Changed from passing an ExecState* to passing a
511 DebuggerCallFrame*, since an ExecState* doesn't contain sufficient
515 (KJS::globalFuncEval): Easiest bug fix evar!
517 [Previously missing files from r33553]
518 * kjs/DebuggerCallFrame.cpp: Copied from JavaScriptCore/profiler/FunctionCallProfile.h.
519 (KJS::DebuggerCallFrame::functionName):
520 (KJS::DebuggerCallFrame::thisObject):
521 (KJS::DebuggerCallFrame::evaluateScript):
522 * kjs/DebuggerCallFrame.h: Copied from JavaScriptCore/VM/Register.h.
523 (KJS::DebuggerCallFrame::DebuggerCallFrame):
524 (KJS::DebuggerCallFrame::scopeChain):
525 (KJS::DebuggerCallFrame::exception):
527 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
531 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
532 <https://bugs.webkit.org/show_bug.cgi?id=18991>
534 Fix the last remaining blocking cases of this bug.
538 (KJS::ReadModifyResolveNode::emitCode):
540 2008-05-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
546 Bug 18991: SquirrelFish: Major codegen issue in a.b=expr, a[b]=expr
547 <https://bugs.webkit.org/show_bug.cgi?id=18991>
549 Ensure that the code generated for assignments uses temporaries whenever
550 necessary. This patch covers the vast majority of situations, but there
551 are still a few left.
553 This patch also adds some missing cases to CodeBlock::dump().
556 (KJS::CodeBlock::dump):
557 * VM/CodeGenerator.h:
558 (KJS::CodeGenerator::destinationForAssignResult):
559 (KJS::CodeGenerator::leftHandSideNeedsCopy):
560 (KJS::CodeGenerator::emitNodeForLeftHandSide):
564 (KJS::AssignDotNode::emitCode):
565 (KJS::ReadModifyDotNode::emitCode):
566 (KJS::AssignBracketNode::emitCode):
567 (KJS::ReadModifyBracketNode::emitCode):
568 (KJS::ForInNode::ForInNode):
570 (KJS::ReadModifyResolveNode::):
571 (KJS::AssignResolveNode::):
572 (KJS::ReadModifyBracketNode::):
573 (KJS::AssignBracketNode::):
574 (KJS::AssignDotNode::):
575 (KJS::ReadModifyDotNode::):
577 2008-05-17 Oliver Hunt <oliver@apple.com>
581 Bug 19106: SquirrelFish: Activation is not marked correctly
582 <https://bugs.webkit.org/show_bug.cgi?id=19106>
584 We can't rely on the symbol table for a count of the number of globals
585 we need to mark as that misses duplicate parameters and 'this'. Now we
586 use the actual local register count from the codeBlock.
588 * kjs/JSActivation.cpp:
589 (KJS::JSActivation::mark):
591 2008-05-16 Oliver Hunt <oliver@apple.com>
595 Bug 19076: SquirrelFish: RegisterFile can be corrupted if implictly reenter global scope with no declared vars
596 <https://bugs.webkit.org/show_bug.cgi?id=19076>
598 Don't delay allocation of initial global RegisterFile, as we can't guarantee we will be able
599 to allocate the global 'this' register safely at any point after initialisation of the Global
602 Unfortunately this initial allocation caused a regression of 0.2-0.3%, however this patch adds
603 support for the static slot optimisation for the global Math object which brings it to a 0.3%
606 * VM/CodeGenerator.cpp:
607 (KJS::CodeGenerator::programCodeThis):
608 (KJS::CodeGenerator::CodeGenerator):
609 (KJS::CodeGenerator::addParameter):
610 * VM/CodeGenerator.h:
612 (KJS::Machine::execute):
614 * kjs/JSGlobalObject.cpp:
615 (KJS::JSGlobalObject::reset):
616 * kjs/JSGlobalObject.h:
617 (KJS::JSGlobalObject::GlobalPropertyInfo::GlobalPropertyInfo):
618 (KJS::JSGlobalObject::addStaticGlobals):
621 2008-05-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
623 Reviewed by Oliver Hunt.
625 Bug 19098: SquirrelFish: Ref'd temporaries can be clobbered
626 <https://bugs.webkit.org/show_bug.cgi?id=19098>
628 When doing code generation for a statement list, increase the reference
629 count on a register that might eventually be returned, so that it doesn't
630 get clobbered by a request for a new temporary.
633 (KJS::statementListEmitCode):
635 2008-05-16 Maciej Stachowiak <mjs@apple.com>
639 - fixed Bug 19044: SquirrelFish: Bogus values enter evaluation when closing over scope with parameter and var with same name
640 https://bugs.webkit.org/show_bug.cgi?id=19044
642 * kjs/JSActivation.cpp:
643 (KJS::JSActivation::copyRegisters): Use numLocals from the code
644 block rather than the size of the symbol table for the number of
645 registers to copy, to account for duplicate parameters and vars
646 with the same name as parameters (we still have potentially
647 suboptimal codegen in that we allocate a local register for the
648 var in the latter case but it is never used).
650 2008-05-15 Geoffrey Garen <ggaren@apple.com>
654 We regret to inform you that your program is crashing because you were
658 (KJS::Machine::privateExecute): Math is hard.
660 2008-05-14 Geoffrey Garen <ggaren@apple.com>
662 Reviewed by Oliver Hunt.
664 A little more debugger action: filled in op_debug. All debugger control
665 flow works now, but variable inspection and backtraces still don't.
667 SunSpider reports no change.
669 * VM/CodeGenerator.cpp: Changed op_debug to accept line number parameters.
672 (KJS::Machine::getFunctionAndArguments): Moved op_debug into a
673 NEVER_INLINE function to avoid a stunning 10% performance regression.
674 Also factored out a common function for retrieving the function and
675 arguments from a call frame.
677 * kjs/JSActivation.cpp:
678 (KJS::JSActivation::createArgumentsObject): Use the new factored out
679 function mentioned above.
682 (KJS::Parser::parse): Increment m_sourceId before assigning it, so the
683 sourceId we send to the debugger matches the sourceId recorded in the
686 * kjs/nodes.cpp: Emit debugging hooks.
688 2008-05-14 Oliver Hunt <oliver@apple.com>
692 Bug 19024: SQUIRRELFISH: ASSERTION FAILED: activation->isActivationObject() in Machine::unwindCallFrame
693 <https://bugs.webkit.org/show_bug.cgi?id=19024>
695 This fixes a number of issues. The most important is that we now check every register
696 file for tainting rather than just looking for function register files as that was
697 insufficient. Additionally guarded against implicit re-entry into Eval code.
699 Also added a few additional assertions to reduce the amout of time between something
700 going wrong and us seeing the error.
703 (KJS::Machine::execute):
704 (KJS::Machine::privateExecute):
705 * VM/RegisterFile.cpp:
706 (KJS::RegisterFile::growBuffer):
707 (KJS::RegisterFile::addGlobalSlots):
708 * VM/RegisterFileStack.cpp:
709 (KJS::RegisterFileStack::pushGlobalRegisterFile):
710 (KJS::RegisterFileStack::pushFunctionRegisterFile):
711 * VM/RegisterFileStack.h:
712 (KJS::RegisterFileStack::inImplicitCall):
714 2008-05-14 Geoffrey Garen <ggaren@apple.com>
716 Reviewed by Oliver Hunt.
718 A little more debugger action: emit opcodes for debugger hooks. Right
719 now, the opcode implementation is just a stub.
721 SunSpider reports no change.
723 Some example codegen for "function f() { 1; }":
725 [ 0] dbg DidEnterCallFrame
726 [ 2] dbg WillExecuteStatement
727 [ 4] load tr0, 1(@k0)
728 [ 7] load tr0, undefined(@k1)
729 [ 10] dbg WillLeaveCallFrame
732 2008-05-14 Oliver Hunt <oliver@apple.com>
736 Bug 19025: SQUIRRELFISH: malformed syntax in onload handler causes crash
737 <https://bugs.webkit.org/show_bug.cgi?id=19025>
739 Simple fix -- move the use of functionBodyNode to after the null check.
741 * kjs/function_object.cpp:
742 (KJS::FunctionObjectImp::construct):
744 2008-05-13 Geoffrey Garen <ggaren@apple.com>
746 Reviewed by Oliver Hunt.
748 Fixed a codegen crash with run-time parse errors.
750 SunSpider reports no change.
752 emitThrowError needs to return the temporary holding the error, not dst,
753 since dst may be NULL. In fact, emitThrowError shouldn't take a dst
754 parameter at all, since exceptions should not modify the destination
757 2008-05-13 Oliver Hunt <oliver@apple.com>
761 Bug 19027: SquirrelFish: Incorrect codegen for pre-increment
762 <https://bugs.webkit.org/show_bug.cgi?id=19027>
764 This fixes the codegen issues for the pre-inc/decrement operators
765 to prevent incorrectly clobbering the destination in the event of
769 (KJS::CodeBlock::dump):
770 * VM/CodeGenerator.cpp:
771 (KJS::CodeGenerator::emitPreInc):
772 (KJS::CodeGenerator::emitPreDec):
773 * VM/CodeGenerator.h:
775 (KJS::Machine::privateExecute):
778 (KJS::PreIncResolveNode::emitCode):
779 (KJS::PreDecResolveNode::emitCode):
780 (KJS::PreIncBracketNode::emitCode):
781 (KJS::PreDecBracketNode::emitCode):
782 (KJS::PreIncDotNode::emitCode):
783 (KJS::PreDecDotNode::emitCode):
785 2008-05-13 Geoffrey Garen <ggaren@apple.com>
787 Reviewed by Oliver Hunt.
789 A little more debugger action: supply a real line number, sourceId,
790 and sourceURL in op_new_error.
792 SunSpider reports a .2% speedup. Not sure what that's about.
795 (KJS::Machine::privateExecute): Use the new good stuff in op_new_error.
798 (KJS::RegExpNode::emitCode): Use the shared emitThrowError instead of
801 2008-05-13 Geoffrey Garen <ggaren@apple.com>
803 Reviewed by Oliver Hunt.
805 A little more debugger action: implemented the exception callback.
807 SunSpider reports a .2% speedup. Not sure what that's about.
809 * VM/CodeBlock.h: A little refactoring here. Store a pointer to our
810 owner ScopeNode so we can retrieve data from it. This allows us to
811 stop storing copies of the data ourselves. Also, store a "this" register
812 instead of a code type, since we were only using the code type to
813 calculate the "this" register.
815 * VM/CodeGenerator.cpp:
816 (KJS::CodeGenerator::generate): Calculate the "this" register mentioned
817 above. Also, take care of removing "this" from the symbol table after
818 codegen is done, since relying on the timing of a destructor for correct
819 behavior is not so good.
822 (KJS::Machine::throwException): Invoke the debugger's exception callback.
823 (KJS::Machine::privateExecute): Use the "this" register mentioned above.
825 2008-05-13 Geoffrey Garen <ggaren@apple.com>
827 Reviewed by Oliver Hunt.
829 Removed some unused exception machinery.
831 SunSpider reports a .3% speedup.
833 * API/JSCallbackObject.h:
834 * API/JSCallbackObjectFunctions.h:
835 * JavaScriptCore.exp:
837 (KJS::Machine::privateExecute):
843 2008-05-13 Geoffrey Garen <ggaren@apple.com>
845 Reviewed by Oliver Hunt.
847 A little more debugger action.
850 * kjs/debugger.h: Removed debuggersPresent because it was unused.
851 Replaced AttachedGlobalObject linked list with a HashSet because HashSet
852 is faster and simpler. Changed all functions to return void instead of
853 bool, because no clients ever return false, and we don't want to support
856 * kjs/nodes.cpp: Did some up-keep to avoid build bustage.
857 (KJS::Node::handleException):
858 (KJS::BreakpointCheckStatement::execute):
859 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
861 2008-05-13 Oliver Hunt <oliver@apple.com>
865 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
866 <https://bugs.webkit.org/show_bug.cgi?id=18752>
868 Replace old attempt at "branchless" exceptions as the extra information
869 being passed made gcc an unhappy compiler, replacing these custom toNumber
870 calls with ordinary toNumber logic (by relying on toNumber now preventing
871 side effects after an exception has been thrown) provided sufficient leeway
872 to add the additional checks for the remaining unchecked cases.
874 This leaves only toString conversions in certain contexts as possibly
880 (KJS::resolveBaseAndProperty):
881 (KJS::resolveBaseAndFunc):
882 (KJS::Machine::privateExecute):
885 (KJS::JSValue::safeGetNumber):
887 2008-05-13 Geoffrey Garen <ggaren@apple.com>
889 Reviewed by Oliver Hunt.
891 First steps toward supporting the debugger API: support the sourceParsed
892 callback; plus some minor fixups.
894 SunSpider reports no regression.
896 * VM/CodeGenerator.h: Removed a misleading comment.
898 * kjs/Parser.h: Changed the parser to take an ExecState*, so it can
899 implement the sourceParsed callback -- that way, we only have to
900 implement the callback in one place.
902 * kjs/debugger.cpp: Nixed DebuggerImp, because its sole purpose in life
903 was to demonstrate the misapplication of design patterns.
905 * kjs/debugger.h: Changed sourceParsed to take a SourceProvider, to
906 reduce copying, and not to return a value, because pausing execution
907 after parsing is complicated, and no clients needed that ability, anyway.
909 * kjs/grammar.y: Make sure never to pass a NULL SourceElements* to
910 didFinishParsing -- that simplifies some code down the road.
912 * kjs/nodes.cpp: Don't generate special AST nodes just because the
913 debugger is attached -- that's a relic of the old AST execution model,
914 and those nodes haven't been maintained.
916 2008-05-13 Oliver Hunt <oliver@apple.com>
920 Bug 18752: SQUIRRELFISH: exceptions are not always handled by the vm
921 <https://bugs.webkit.org/show_bug.cgi?id=18752>
923 First step: prevent incorrect evaluation of valueOf/toString conversion
924 in right hand side of expression after earlier conversion throws.
926 * API/JSCallbackObjectFunctions.h:
929 (KJS::JSObject::defaultValue):
931 2008-05-12 Oliver Hunt <oliver@apple.com>
935 Bug 18934: SQUIRRELFISH: ASSERT @ nytimes.com due to RegisterFile being clobbered
936 <https://bugs.webkit.org/show_bug.cgi?id=18934>
938 Unfortunately we cannot create new statically optimised globals if there are any
939 tainted RegisterFiles on the RegisterFileStack. To handle this we re-introduce
940 (in a slightly cleaner form) the inImplicitCall concept to the RegisterFileStack.
943 (KJS::Machine::execute):
944 * VM/RegisterFileStack.cpp:
945 (KJS::RegisterFileStack::pushFunctionRegisterFile):
946 * VM/RegisterFileStack.h:
948 2008-05-12 Geoffrey Garen <ggaren@apple.com>
950 Reviewed by Maciej Stachowiak.
952 Introduced support for function.caller.
954 Improved support for walking interesting scopes for function introspection.
956 This fixes all remaining layout tests not blocked by rebasing to trunk.
958 SunSpider reports no change.
961 (KJS::Machine::dumpRegisters): Fixed a spacing issue.
963 2008-05-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
967 Bug 18961: SQUIRRELFISH: Gmail doesn't load
968 <https://bugs.webkit.org/show_bug.cgi?id=18961>
970 Fix codegen for logical nodes so that they don't use their destination
974 (KJS::LogicalAndNode::emitCode):
975 (KJS::LogicalOrNode::emitCode):
977 2008-05-10 Maciej Stachowiak <mjs@apple.com>
981 - JavaScriptCore part of fix for: "SQUIRRELFISH: function toString broken after calling"
982 https://bugs.webkit.org/show_bug.cgi?id=18869
984 Three layout tests are fixed:
985 fast/js/toString-elision-trailing-comma.html
986 fast/js/toString-prefix-postfix-preserve-parens.html
987 fast/js/kde/lval-exceptions.html
989 Functions now save a shared subrange of the original source used
990 to make them (so in the common case this adds no storage above the
993 * kjs/SourceProvider.h: Added.
994 (KJS::SourceProvider): New abstract base class for classes that provide on-demand access
995 to the source for a JavaScript program. This allows function objects to have access to their
996 original source without copying.
997 (KJS::UStringSourceProvider): SourceProvider subclass backed by a KJS::UString.
998 (KJS::UStringSourceProvider::create):
999 (KJS::UStringSourceProvider::getRange):
1000 (KJS::UStringSourceProvider::data):
1001 (KJS::UStringSourceProvider::length):
1002 (KJS::UStringSourceProvider::UStringSourceProvider):
1003 * kjs/SourceRange.h: Added.
1004 (KJS::SourceRange::SourceRange): Class that holds a SourceProvider and a character range into
1005 the source, to encapsulate on-demand access to the source of a function.
1006 (KJS::SourceRange::toString):
1008 (KJS::eval): Pass a UStringSourceProvider to the parser.
1010 (KJS::Parser::parse): Take a SourceProvider and pass it on to the lexer.
1012 (KJS::Parser::parse): Take a SourceProvider.
1014 (KJS::Lexer::setCode): Take a SourceProvider; keep it around, and
1015 use it to get the raw buffer and length.
1017 (KJS::Lexer::sourceRange): Convenience function to get a source
1018 range based on the lexer's source provieder, and char offsets
1019 right before and after the desired range.
1021 (KJS::globalFuncEval): Pass a UStringSourceProvider to the parser.
1022 * kjs/function_object.cpp:
1023 (KJS::functionProtoFuncToString): Use toSourceString to get the source.
1024 (KJS::FunctionObjectImp::construct): Give the parser a UStringSourceProvider.
1025 * kjs/grammar.y: When parsing a function declaration, function
1026 expression, or getter or setter, tell the function body about its
1028 * kjs/interpreter.cpp:
1029 (KJS::Interpreter::checkSyntax): Pass a SourceProvider to the parser.
1030 (KJS::Interpreter::evaluate): Pass a SourceProvider to the parser.
1031 * kjs/interpreter.h:
1033 (KJS::FunctionBodyNode::setSource): Establish a SourceRange for this function.
1034 (KJS::FunctionBodyNode::toSourceString): Get the source string out
1036 (KJS::FuncExprNode::): Take a SourceRange and set it on the body.
1037 (KJS::FuncDeclNode::): ditto
1039 (prettyPrintScript): Use a SourceProvider appropriately.
1040 * JavaScriptCore.exp: Export new symbols.
1041 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: Add new files.
1042 * JavaScriptCore.xcodeproj/project.pbxproj: Add new files.
1044 2008-05-09 Oliver Hunt <oliver@apple.com>
1048 Bring back RegisterFile tainting in order to correctly handle
1049 natively implemented getters and setters that re-enter JavaScript
1052 (KJS::Machine::privateExecute):
1053 * VM/RegisterFile.h:
1055 (KJS::FunctionImp::callAsFunction):
1057 (KJS::JSObject::put):
1058 (KJS::tryGetAndCallProperty):
1059 * kjs/property_slot.cpp:
1060 (KJS::PropertySlot::functionGetter):
1062 2008-05-09 Maciej Stachowiak <mjs@apple.com>
1066 - track character offsets of open and close braces, in preparation for saving function source
1068 I verified that there is no performance regression from this change.
1073 (KJS::Lexer::matchPunctuator):
1076 2008-05-09 Oliver Hunt <oliver@apple.com>
1078 Reviewed by Nobody (build fix).
1082 * kjs/JSGlobalObject.cpp:
1083 (KJS::JSGlobalObject::restoreLocalStorage):
1085 2008-05-09 Oliver Hunt <oliver@apple.com>
1089 Build fixes for SquirrelFish on windows.
1091 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1092 * JavaScriptCore.vcproj/testkjs/testkjs.vcproj:
1094 * kjs/JSGlobalObject.cpp:
1095 (KJS::JSGlobalObject::restoreLocalStorage):
1096 * kjs/collector.cpp:
1097 (KJS::Collector::allocate):
1098 (KJS::Collector::allocateNumber):
1100 (KJS::Collector::allocate):
1101 (KJS::Collector::allocateNumber):
1102 * kjs/property_slot.cpp:
1104 2008-05-08 Maciej Stachowiak <mjs@apple.com>
1108 - fix activation tearoff in the case where functions are called with too many arguments
1111 fast/canvas/patternfill-repeat.html
1112 fast/dom/SelectorAPI/bug-17313.html
1115 (KJS::slideRegisterWindowForCall):
1116 (KJS::scopeChainForCall):
1117 (KJS::Machine::execute):
1118 (KJS::Machine::privateExecute):
1120 2008-05-08 Geoffrey Garen <ggaren@apple.com>
1122 Reviewed by Oliver Hunt.
1124 Fixed failure in fast/canvas/canvas-pattern-behaviour.html.
1126 SunSpider reports a small speedup. Not sure what that's about.
1129 (KJS::CodeBlock::dump): Fixed op_call_eval to dump as "op_call_eval".
1130 This helped me while debugging.
1133 (KJS::Machine::unwindCallFrame): When looking for an activation to tear
1134 off, don't use the scope chain. Inside eval, the scope chain doesn't
1135 belong to us; it belongs to our calling function.
1137 Also, don't use the needsFullScopeChain flag to decide whether to tear
1138 off the activation. "function.arguments" can create an activation
1139 for a function whose needsFullScopeChain flag is set to false.
1141 2008-05-08 Maciej Stachowiak <mjs@apple.com>
1145 - fix function.call for calls of more than 8 arguments
1147 Fixes svg/carto.net/button.svg
1150 (KJS::List::getSlice): properly set up the m_buffer of the target list.
1152 2008-05-08 Maciej Stachowiak <mjs@apple.com>
1156 - don't return a null RegisterID from RegExpNode in the exception case, since the caller may need a real register
1159 - fast/regex/early-acid3-86.html
1160 - http/tests/misc/acid3.html
1163 (KJS::RegExpNode::emitCode):
1165 2008-05-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1169 Fix a performance regression caused by the introduction of property
1170 attributes to SymbolTable in r32859 by encoding the attributes and the
1171 register index into a single field of SymbolTableEntry.
1173 This leaves Node::optimizeVariableAccess() definitely broken, although
1174 it was probably not entirely correct in SquirrelFish before this change.
1177 (KJS::missingThisObjectMarker):
1178 * VM/CodeGenerator.cpp:
1179 (KJS::CodeGenerator::addVar):
1180 (KJS::CodeGenerator::CodeGenerator):
1181 (KJS::CodeGenerator::registerForLocal):
1182 (KJS::CodeGenerator::registerForLocalConstInit):
1183 (KJS::CodeGenerator::isLocalConstant):
1184 (KJS::CodeGenerator::addConstant):
1185 (KJS::CodeGenerator::emitCall):
1186 * VM/CodeGenerator.h:
1187 (KJS::CodeGenerator::IdentifierMapIndexHashTraits::emptyValue):
1189 (KJS::Machine::privateExecute):
1190 * kjs/JSGlobalObject.cpp:
1191 (KJS::JSGlobalObject::saveLocalStorage):
1192 * kjs/JSVariableObject.cpp:
1193 (KJS::JSVariableObject::getPropertyNames):
1194 (KJS::JSVariableObject::getPropertyAttributes):
1195 * kjs/JSVariableObject.h:
1196 (KJS::JSVariableObject::symbolTableGet):
1197 (KJS::JSVariableObject::symbolTablePut):
1198 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1199 * kjs/SymbolTable.h:
1200 (KJS::SymbolTableEntry::SymbolTableEntry):
1201 (KJS::SymbolTableEntry::isEmpty):
1202 (KJS::SymbolTableEntry::getIndex):
1203 (KJS::SymbolTableEntry::getAttributes):
1204 (KJS::SymbolTableEntry::setAttributes):
1205 (KJS::SymbolTableEntry::isReadOnly):
1207 (KJS::getSymbolTableEntry):
1208 (KJS::PostIncResolveNode::optimizeVariableAccess):
1209 (KJS::PostDecResolveNode::optimizeVariableAccess):
1210 (KJS::DeleteResolveNode::optimizeVariableAccess):
1211 (KJS::TypeOfResolveNode::optimizeVariableAccess):
1212 (KJS::PreIncResolveNode::optimizeVariableAccess):
1213 (KJS::PreDecResolveNode::optimizeVariableAccess):
1214 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1215 (KJS::AssignResolveNode::optimizeVariableAccess):
1216 (KJS::ProgramNode::initializeSymbolTable):
1218 2008-05-06 Maciej Stachowiak <mjs@apple.com>
1220 Rubber stamped by Oliver.
1222 - add missing ! in an assert that I failed to reverse
1224 * VM/CodeGenerator.cpp:
1225 (KJS::CodeGenerator::CodeGenerator):
1227 2008-05-06 Maciej Stachowiak <mjs@apple.com>
1231 - fixed "SQUIRRELFISH: window.this shows up as a property, but it shouldn't"
1232 https://bugs.webkit.org/show_bug.cgi?id=18868
1234 The basic approach is to have "this" only be present in the symbol
1235 table at compile time, not runtime.
1237 * VM/CodeGenerator.cpp:
1238 (KJS::CodeGenerator::~CodeGenerator): Remove "this" from symbol table.
1239 (KJS::CodeGenerator::CodeGenerator): Add "this" back when re-using
1241 * VM/CodeGenerator.h:
1243 (KJS::Machine::execute): Don't assert that "this" is in the symbol table.
1245 2008-05-06 Geoffrey Garen <ggaren@apple.com>
1247 Reviewed by Oliver Hunt.
1249 Trivial support for function.arguments: Currently, we only support
1250 function.arguments from within the scope of function.
1252 This fixes the remaining Mozilla JS test failures.
1254 SunSpider reports no change.
1256 * JavaScriptCore.exp:
1259 (KJS::Machine::privateExecute): Separated scope chain deref from
1260 activation register copying: since it is now possible for client code
1261 to create an activation on behalf of a function that otherwise wouldn't
1262 need one, having an activation no longer necessarily means that you need
1263 to deref the scope chain.
1265 (KJS::Machine::getCallFrame): For now, this function only examines the
1266 current scope. Walking parent scopes requires some refactoring in the
1267 way we track execution stacks.
1269 * kjs/ExecState.cpp:
1270 (KJS::ExecState::ExecState): We use a negative call frame offset to
1271 indicate that a given scope is not a function call scope.
1273 2008-05-05 Oliver Hunt <oliver@apple.com>
1277 Fix call frame set up for native -> JS function calls.
1280 (KJS::Machine::execute):
1282 2008-05-05 Geoffrey Garen <ggaren@apple.com>
1284 Reviewed by Maciej Stachowiak.
1286 Fixed ecma_3/Object/8.6.2.6-001.js, and similar bugs.
1288 SunSpider reports a .4% speedup. Not sure what that's about.
1291 (KJS::Machine::privateExecute): Check for exception return from equal,
1292 since toPrimitive can throw.
1294 * kjs/operations.cpp:
1295 (KJS::strictEqual): In response to an error I made in an earlier version
1296 of this patch, I changed strictEqual to make clear the fact that it
1297 performs no conversions and can't throw, making it slightly more efficient
1300 2008-05-05 Maciej Stachowiak <mjs@apple.com>
1304 - fix some dumb mistakes in my last patch
1306 * VM/CodeGenerator.cpp:
1307 (KJS::CodeGenerator::emitPushScope):
1308 (KJS::CodeGenerator::emitGetPropertyNames):
1310 (KJS::Machine::privateExecute):
1312 2008-05-05 Maciej Stachowiak <mjs@apple.com>
1316 - document opcodes relating to jumps, scopes, and property name iteration
1318 Documented jmp, jtrue, false, push_scope, pop_scope, get_pnames,
1319 next_pname and jmp_scopes.
1321 * VM/CodeGenerator.cpp:
1322 (KJS::CodeGenerator::emitJump):
1323 (KJS::CodeGenerator::emitJumpIfTrue):
1324 (KJS::CodeGenerator::emitJumpIfFalse):
1325 (KJS::CodeGenerator::emitPushScope):
1326 (KJS::CodeGenerator::emitNextPropertyName):
1327 (KJS::CodeGenerator::emitGetPropertyNames):
1328 * VM/CodeGenerator.h:
1330 (KJS::Machine::privateExecute):
1332 (KJS::LogicalAndNode::emitCode):
1333 (KJS::LogicalOrNode::emitCode):
1334 (KJS::ConditionalNode::emitCode):
1335 (KJS::IfNode::emitCode):
1336 (KJS::IfElseNode::emitCode):
1337 (KJS::DoWhileNode::emitCode):
1338 (KJS::WhileNode::emitCode):
1339 (KJS::ForNode::emitCode):
1340 (KJS::ForInNode::emitCode):
1341 (KJS::WithNode::emitCode):
1343 2008-05-05 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1347 Bug 18749: SQUIRRELFISH: const support is broken
1348 <https://bugs.webkit.org/show_bug.cgi?id=18749>
1350 Adds support for const during code generation.
1352 Fixes 2 layout tests.
1355 * VM/CodeGenerator.cpp:
1356 (KJS::CodeGenerator::addVar):
1357 (KJS::CodeGenerator::CodeGenerator):
1358 (KJS::CodeGenerator::isLocalConstant):
1359 * VM/CodeGenerator.h:
1360 (KJS::CodeGenerator::addVar):
1362 (KJS::PostIncResolveNode::emitCode):
1363 (KJS::PostDecResolveNode::emitCode):
1364 (KJS::PreIncResolveNode::emitCode):
1365 (KJS::PreDecResolveNode::emitCode):
1366 (KJS::ReadModifyResolveNode::emitCode):
1367 (KJS::AssignResolveNode::emitCode):
1369 2008-05-04 Maciej Stachowiak <mjs@apple.com>
1373 - document some more opcodes (and fix argument names)
1375 Added docs for eq, neq, stricteq, nstriceq, less and lesseq.
1377 * VM/CodeGenerator.cpp:
1378 (KJS::CodeGenerator::emitEqual):
1379 (KJS::CodeGenerator::emitNotEqual):
1380 (KJS::CodeGenerator::emitStrictEqual):
1381 (KJS::CodeGenerator::emitNotStrictEqual):
1382 (KJS::CodeGenerator::emitLess):
1383 (KJS::CodeGenerator::emitLessEq):
1384 * VM/CodeGenerator.h:
1386 (KJS::Machine::privateExecute):
1388 (KJS::LessNode::emitCode):
1389 (KJS::GreaterNode::emitCode):
1390 (KJS::LessEqNode::emitCode):
1391 (KJS::GreaterEqNode::emitCode):
1392 (KJS::EqualNode::emitCode):
1393 (KJS::NotEqualNode::emitCode):
1394 (KJS::StrictEqualNode::emitCode):
1395 (KJS::NotStrictEqualNode::emitCode):
1396 (KJS::CaseBlockNode::emitCodeForBlock):
1398 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1400 Reviewed by Maciej Stachowiak.
1402 More scaffolding for f.arguments.
1404 Track the offset of the last call frame in the ExecState, so we can
1405 produce a backtrace at any time.
1407 Also, record numLocals, the sum of numVars + numParameters, in each code
1408 block, to make updates to the ExecState a little cheaper than they
1411 We now use numLocals in a bunch of places where we used to calculate
1412 numVars + numParameters or -numVars - numParameters.
1414 Reports are mixed, but all in all, this seems to be a wash on SunSpider.
1416 2008-05-04 Oliver Hunt <oliver@apple.com>
1420 Whoops, correctly handle properties that don't exist in the
1423 * kjs/JSVariableObject.h:
1424 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1426 2008-05-04 Oliver Hunt <oliver@apple.com>
1430 Add attribute information to SymbolTable as ground work for
1431 various DontEnum and ReadOnly issues.
1433 * VM/CodeGenerator.cpp:
1434 (KJS::CodeGenerator::addVar):
1435 (KJS::CodeGenerator::CodeGenerator):
1436 (KJS::CodeGenerator::registerForLocal):
1437 (KJS::CodeGenerator::registerForLocalConstInit):
1438 (KJS::CodeGenerator::addConstant):
1440 (KJS::Machine::execute):
1441 * kjs/JSGlobalObject.cpp:
1442 (KJS::JSGlobalObject::saveLocalStorage):
1443 * kjs/JSVariableObject.cpp:
1444 (KJS::JSVariableObject::getPropertyNames):
1445 (KJS::JSVariableObject::getPropertyAttributes):
1446 * kjs/JSVariableObject.h:
1447 (KJS::JSVariableObject::symbolTablePut):
1448 (KJS::JSVariableObject::symbolTablePutWithAttributes):
1449 * kjs/SymbolTable.h:
1450 (KJS::SymbolTableEntry::SymbolTableEntry):
1451 (KJS::SymbolTableIndexHashTraits::emptyValue):
1453 (KJS::getSymbolTableEntry):
1454 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
1455 (KJS::AssignResolveNode::optimizeVariableAccess):
1456 (KJS::ProgramNode::initializeSymbolTable):
1458 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1460 Reviewed by Oliver Hunt.
1462 More scaffolding for f.arguments.
1464 Store the register file associated with an ExecState in the ExecState.
1466 SunSpider reports no change.
1468 * kjs/JSGlobalObject.h:
1469 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Moved
1470 registerFileStack above globalExec, so it gets initialized first.
1471 Removed remnants of old activation scheme.
1473 2008-05-04 Maciej Stachowiak <mjs@apple.com>
1475 Rubber stamped by Oliver.
1477 - renamed a few opcodes and fixed assembly formatting to accomodate the longest opcode
1481 resolve_base_and_property --> resolve_with_base
1482 resolve_base_and_func --> resolve_func
1483 get_prop_id --> get_by_id
1484 put_prop_id --> put_by_id
1485 delete_prop_id --> del_by_id
1486 get_prop_val --> get_by_val
1487 put_prop_val --> put_by_val
1488 delete_prop_val --> del_by_val
1489 put_prop_index --> put_by_index
1492 (KJS::printUnaryOp):
1493 (KJS::printBinaryOp):
1494 (KJS::printConditionalJump):
1495 (KJS::CodeBlock::dump):
1496 * VM/CodeGenerator.cpp:
1497 (KJS::CodeGenerator::emitEqual):
1498 (KJS::CodeGenerator::emitNotEqual):
1499 (KJS::CodeGenerator::emitResolveWithBase):
1500 (KJS::CodeGenerator::emitResolveFunction):
1501 (KJS::CodeGenerator::emitGetById):
1502 (KJS::CodeGenerator::emitPutById):
1503 (KJS::CodeGenerator::emitDeleteById):
1504 (KJS::CodeGenerator::emitGetByVal):
1505 (KJS::CodeGenerator::emitPutByVal):
1506 (KJS::CodeGenerator::emitDeleteByVal):
1507 (KJS::CodeGenerator::emitPutByIndex):
1508 * VM/CodeGenerator.h:
1510 (KJS::Machine::privateExecute):
1513 (KJS::ArrayNode::emitCode):
1514 (KJS::PropertyListNode::emitCode):
1515 (KJS::BracketAccessorNode::emitCode):
1516 (KJS::DotAccessorNode::emitCode):
1517 (KJS::EvalFunctionCallNode::emitCode):
1518 (KJS::FunctionCallResolveNode::emitCode):
1519 (KJS::FunctionCallBracketNode::emitCode):
1520 (KJS::FunctionCallDotNode::emitCode):
1521 (KJS::PostIncResolveNode::emitCode):
1522 (KJS::PostDecResolveNode::emitCode):
1523 (KJS::PostIncBracketNode::emitCode):
1524 (KJS::PostDecBracketNode::emitCode):
1525 (KJS::PostIncDotNode::emitCode):
1526 (KJS::PostDecDotNode::emitCode):
1527 (KJS::DeleteResolveNode::emitCode):
1528 (KJS::DeleteBracketNode::emitCode):
1529 (KJS::DeleteDotNode::emitCode):
1530 (KJS::TypeOfResolveNode::emitCode):
1531 (KJS::PreIncResolveNode::emitCode):
1532 (KJS::PreDecResolveNode::emitCode):
1533 (KJS::PreIncBracketNode::emitCode):
1534 (KJS::PreDecBracketNode::emitCode):
1535 (KJS::PreIncDotNode::emitCode):
1536 (KJS::PreDecDotNode::emitCode):
1537 (KJS::ReadModifyResolveNode::emitCode):
1538 (KJS::AssignResolveNode::emitCode):
1539 (KJS::AssignDotNode::emitCode):
1540 (KJS::ReadModifyDotNode::emitCode):
1541 (KJS::AssignBracketNode::emitCode):
1542 (KJS::ReadModifyBracketNode::emitCode):
1543 (KJS::ConstDeclNode::emitCodeSingle):
1544 (KJS::ForInNode::emitCode):
1545 (KJS::TryNode::emitCode):
1547 2008-05-04 Oliver Hunt <oliver@apple.com>
1551 Fix assertion when accessing arguments object with too many arguments provided
1553 The arguments constructor was assuming that the register offset given for argv
1554 was an absolute offset into the registerfile, rather than the offset from the
1555 frame. This patches corrects that issue.
1557 * kjs/JSActivation.cpp:
1558 (KJS::JSActivation::createArgumentsObject):
1560 2008-05-04 Geoffrey Garen <ggaren@apple.com>
1562 Rubber stamped by Sam Weinig.
1564 Cleaned up Machine.cpp according to our style guidelines: moved static
1565 data to the top of the file; moved stand-alone functions below that;
1566 moved the Machine constructor above other Machine member functions.
1568 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1572 - fix accidental breakage from last patch
1575 (KJS::Machine::privateExecute):
1577 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1581 - a bunch more opcode documentation and corresponding parameter name fixes
1583 I renamed a few opcodes:
1585 type_of --> typeof (that's what the JS operator is named)
1586 instance_of --> instanceof (ditto)
1587 create_error --> new_error (for consistency with other new_* opcodes)
1589 I documented the following opcodes:
1611 I also fixed formatting on some existing opcode docs.
1614 (KJS::CodeBlock::dump):
1615 * VM/CodeGenerator.cpp:
1616 (KJS::CodeGenerator::emitMove):
1617 (KJS::CodeGenerator::emitNot):
1618 (KJS::CodeGenerator::emitPreInc):
1619 (KJS::CodeGenerator::emitPreDec):
1620 (KJS::CodeGenerator::emitPostInc):
1621 (KJS::CodeGenerator::emitPostDec):
1622 (KJS::CodeGenerator::emitToJSNumber):
1623 (KJS::CodeGenerator::emitNegate):
1624 (KJS::CodeGenerator::emitBitNot):
1625 (KJS::CodeGenerator::emitInstanceOf):
1626 (KJS::CodeGenerator::emitTypeOf):
1627 (KJS::CodeGenerator::emitIn):
1628 (KJS::CodeGenerator::emitLoad):
1629 (KJS::CodeGenerator::emitNewObject):
1630 (KJS::CodeGenerator::emitNewArray):
1631 (KJS::CodeGenerator::emitNewRegExp):
1632 (KJS::CodeGenerator::emitNewError):
1633 * VM/CodeGenerator.h:
1634 (KJS::CodeGenerator::scopeDepth):
1635 (KJS::CodeGenerator::addVar):
1637 (KJS::Machine::privateExecute):
1640 (KJS::Node::emitThrowError):
1641 (KJS::RegExpNode::emitCode):
1642 (KJS::TypeOfValueNode::emitCode):
1643 (KJS::UnaryPlusNode::emitCode):
1644 (KJS::NegateNode::emitCode):
1645 (KJS::BitwiseNotNode::emitCode):
1646 (KJS::LogicalNotNode::emitCode):
1647 (KJS::InstanceOfNode::emitCode):
1648 (KJS::InNode::emitCode):
1650 2008-05-03 Maciej Stachowiak <mjs@apple.com>
1652 Reviewed by Geoff and Sam.
1654 - generate HTML bytecode docs at build time
1656 * DerivedSources.make:
1658 * docs/make-bytecode-docs.pl: Added.
1660 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1662 Reviewed by Sam Weinig.
1664 Update ExecState::m_scopeChain when switching scope chains inside the
1667 This fixes uses of lexicalGlobalObject, such as, in a subframe
1669 alert(top.makeArray() instanceof Array ? "FAIL" : "PASS");
1671 and a bunch of the security failures listed in
1672 https://bugs.webkit.org/show_bug.cgi?id=18870. (Those tests still fail,
1673 seemingly because of regressions in exception messages).
1675 SunSpider reports no change.
1677 * VM/Machine.cpp: Factored out scope chain updating into a common
1678 function that takes care to update ExecState::m_scopeChain, too.
1680 * kjs/ExecState.h: I made Machine a friend of ExecState so that Machine
1681 could update ExecState::m_scopeChain, even though that value is
1682 read-only for everyone else.
1684 * kjs/JSGlobalObject.h:
1685 (KJS::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Changed
1686 this client to be a little friendlier to ExecState's internal
1687 storage type for scope chain data.
1689 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1691 Reviewed by Sam Weinig.
1693 Fixed https://bugs.webkit.org/show_bug.cgi?id=18876
1694 Squirrelfish: ScopeChainNode leak in op_jmp_scopes.
1696 SunSpider reports no change.
1699 (KJS::Machine::privateExecute): Don't construct a ScopeChain object,
1700 since the direct threaded interpreter will goto across its destructor.
1702 2008-05-03 Geoffrey Garen <ggaren@apple.com>
1704 Reviewed by Oliver Hunt.
1706 A bit more efficient fix than r32832: Don't copy globals into function
1707 register files; instead, have the RegisterFileStack track only the base
1708 of the last *global* register file, so the global object's register
1709 references stay good.
1711 SunSpider reports a .3% speedup. Not sure what that's about.
1713 2008-05-03 Oliver Hunt <oliver@apple.com>
1717 Bug 18864: SquirrelFish: Support getter and setter definition in object literals
1718 <https://bugs.webkit.org/show_bug.cgi?id=18864>
1720 Add new opcodes to allow us to add getters and setters to an object. These are
1721 only used by the codegen for object literals.
1723 * VM/CodeGenerator.cpp:
1724 (KJS::CodeGenerator::emitPutGetter):
1725 (KJS::CodeGenerator::emitPutSetter):
1726 * VM/CodeGenerator.h:
1728 (KJS::Machine::privateExecute):
1731 (KJS::PropertyListNode::emitCode):
1733 2008-05-02 Maciej Stachowiak <mjs@apple.com>
1737 - properly copy globals into and out of implicit call register
1738 files, otherwise they will fail at global lookup
1740 Fixes fast/js/array-tostring-and-join.html layout test.
1742 * VM/RegisterFileStack.cpp:
1743 (KJS::RegisterFileStack::pushGlobalRegisterFile):
1744 (KJS::RegisterFileStack::popGlobalRegisterFile):
1745 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1746 (KJS::RegisterFileStack::popFunctionRegisterFile):
1748 2008-05-02 Geoffrey Garen <ggaren@apple.com>
1750 Reviewed by Oliver Hunt.
1752 Fixed https://bugs.webkit.org/show_bug.cgi?id=18822
1753 SQUIRRELFISH: incorrect eval used in some cases
1755 Changed all code inside the machine to fetch the lexical global object
1756 directly from the scope chain, instead of from the ExecState.
1758 Clients who fetch the lexical global object through the ExecState
1761 SunSpider reports no change.
1764 (KJS::Machine::privateExecute): Fetch the lexical global object from
1768 (KJS::ExecState::ExecState::lexicalGlobalObject): Moved the logic for
1769 this function into ScopeChainNode, but kept this function around to
1770 support existing clients.
1772 2008-05-02 Geoffrey Garen <ggaren@apple.com>
1774 Rubber stamped by Oliver Hunt.
1776 Removed ExecState.cpp from AllInOneFile.cpp, for a .2% speedup.
1778 * JavaScriptCore.xcodeproj/project.pbxproj:
1779 * kjs/AllInOneFile.cpp:
1781 2008-05-01 Oliver Hunt <oliver@apple.com>
1783 Reviewed by Geoff and Maciej.
1785 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
1786 <https://bugs.webkit.org/show_bug.cgi?id=18827>
1788 Remove safe/unsafe RegisterFile concept, and instead just add additional
1789 logic to ensure we always push/pop RegisterFiles when executing getters
1790 and setters, similar to the logic for valueOf and toString.
1793 (KJS::Machine::privateExecute):
1794 * VM/RegisterFile.h:
1796 (KJS::FunctionImp::callAsFunction):
1798 (KJS::JSObject::put):
1799 * kjs/property_slot.cpp:
1800 (KJS::PropertySlot::functionGetter):
1802 2008-05-01 Oliver Hunt <oliver@apple.com>
1806 Rename unsafeForReentry to safeForReentry to avoid double negatives.
1809 (KJS::Machine::privateExecute):
1810 * VM/RegisterFile.h:
1812 (KJS::FunctionImp::callAsFunction):
1814 2008-05-01 Oliver Hunt <oliver@apple.com>
1818 Bug 18827: SquirrelFish: Prevent getters and setters from destroying the current RegisterFile
1819 <https://bugs.webkit.org/show_bug.cgi?id=18827>
1821 This patch makes getters and setters work. It does this by
1822 tracking whether the RegisterFile is "safe", that is whether
1823 the interpreter is in a state that in which it can handle
1824 the RegisterFile being reallocated.
1828 (KJS::Machine::privateExecute):
1829 * VM/RegisterFile.h:
1831 (KJS::FunctionImp::callAsFunction):
1833 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1835 Release build fix: Always compile in "isGlobalObject", since it's
1836 listed in our .exp file.
1838 * kjs/ExecState.cpp:
1839 (KJS::ExecState::isGlobalObject):
1842 2008-04-30 Oliver Hunt <oliver@apple.com>
1846 Minor code restructuring to prepare for getters and setters,
1847 also helps exception semantics a bit.
1850 (KJS::Machine::privateExecute):
1852 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1858 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1860 Debug build fix: export a missing symbol.
1862 * JavaScriptCore.exp:
1864 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1866 Reviewed by Oliver Hunt.
1868 A little more ExecState refactoring: Now, only the global object creates
1871 Also inlined ExecState::lexicalGlobalObject().
1873 SunSpider reports no change.
1875 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1877 WebCore build fix: forward-declare ScopeChain.
1879 * kjs/interpreter.h:
1881 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1883 Build fix for JavaScriptGlue: export a missing symbol.
1885 * JavaScriptCore.exp:
1887 2008-04-30 Geoffrey Garen <ggaren@apple.com>
1889 Reviewed by Oliver Hunt.
1891 Removed a lot of unused bits from ExecState, moving them into
1892 OldInterpreterExecState, the fake scaffolding class.
1894 The clutter was making it hard to see the forest from the trees.
1896 .4% SunSpider speedup, probably because ExecState::lexicalGlobalObject()
1899 2008-04-29 Oliver Hunt <oliver@apple.com>
1903 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
1904 <https://bugs.webkit.org/show_bug.cgi?id=18643>
1906 Prevent static slot optimisation for new variables and functions in
1907 globally re-entrant code called from an an implicit function call.
1909 This is necessary to prevent us from needing to resize the global
1910 slot portion of the root RegisterFile during an implicit (and hence
1911 unguarded) function call.
1913 * VM/CodeGenerator.cpp:
1914 (KJS::CodeGenerator::CodeGenerator):
1915 * VM/CodeGenerator.h:
1917 (KJS::Machine::execute):
1918 * VM/RegisterFile.h:
1919 * VM/RegisterFileStack.cpp:
1920 (KJS::RegisterFileStack::pushGlobalRegisterFile):
1921 (KJS::RegisterFileStack::popGlobalRegisterFile):
1922 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1923 (KJS::RegisterFileStack::popFunctionRegisterFile):
1924 * VM/RegisterFileStack.h:
1925 (KJS::RegisterFileStack::inImplicitFunctionCall):
1926 (KJS::RegisterFileStack::lastGlobal):
1928 (KJS::ProgramNode::generateCode):
1930 (KJS::ProgramNode::):
1932 2008-04-29 Geoffrey Garen <ggaren@apple.com>
1934 Reviewed by Oliver Hunt.
1936 In nested program code, don't propogate "this" back to the parent
1937 register file. ("this" should remain constant in the parent register
1938 file, regardless of the scripts it invokes.)
1940 * VM/RegisterFile.cpp:
1941 (KJS::RegisterFile::copyGlobals):
1943 2008-04-28 Oliver Hunt <oliver@apple.com>
1947 Restore base pointer when popping a global RegisterFile
1949 * VM/RegisterFileStack.cpp:
1950 (KJS::RegisterFileStack::popGlobalRegisterFile):
1952 2008-04-28 Oliver Hunt <oliver@apple.com>
1956 Bug 18643: SQUIRRELFISH: need to support implicit function calls (valueOf, toString, getters/setters)
1957 <https://bugs.webkit.org/show_bug.cgi?id=18643>
1959 Partial fix. This results in all implicit calls to toString or valueOf
1960 executing in a separate RegisterFile, so ensuring that the the pointers
1961 in the triggering interpreter don't get trashed. This still leaves the
1962 task of preventing new global re-entry from toString and valueOf from
1963 clobbering the RegisterFile.
1966 (KJS::Machine::execute):
1967 * VM/RegisterFileStack.cpp:
1968 (KJS::RegisterFileStack::pushFunctionRegisterFile):
1969 (KJS::RegisterFileStack::popFunctionRegisterFile):
1970 * VM/RegisterFileStack.h:
1972 (KJS::tryGetAndCallProperty):
1974 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1976 Reviewed by Maciej Stachowiak.
1978 Simplified activation object a bit: No need to store the callee
1979 in the activation object -- we can pull it out of the call frame
1980 when needed, instead.
1982 SunSpider reports no change.
1984 2008-04-28 Geoffrey Garen <ggaren@apple.com>
1986 Reviewed by Maciej Stachowiak.
1988 RS by Oliver Hunt on moving JSArguments.cpp out of AllInOneFile.cpp.
1990 Substantially more handling of "arguments": "arguments" works fully
1991 now, but "f.arguments" still doesn't work.
1993 Fixes 10 regression tests.
1995 SunSpider reports no regression.
1997 * kjs/JSActivation.cpp:
1998 (KJS::JSActivation::createArgumentsObject): Reconstruct an arguments
1999 List to pass to the arguments object constructor.
2001 * JavaScriptCore.xcodeproj/project.pbxproj:
2002 * kjs/AllInOneFile.cpp: Removed JSActivation.cpp from AllInOneFile.cpp
2003 because that seems to make GCC happy. (Previously, I had added
2004 JSActivation.cpp to AllInOneFile.cpp because *that* seemed to make GCC
2007 2008-04-28 Geoffrey Garen <ggaren@apple.com>
2009 Reviewed by Maciej Stachowiak.
2011 Groundwork for more handling of "arguments". I'm not checking in the
2012 actual handling of "arguments" yet, because it still needs a little
2013 fiddling to avoid a performance regression.
2015 SunSpider reports no change.
2018 (KJS::initializeCallFrame): Put argc in the register file, so the
2019 arguments object can find it later, to determine arguments.length.
2022 (KJS::FunctionBodyNode::): Added a special code accessor for when you
2023 know the code has already been generated, and you don't have a scopeChain
2024 to supply for potential code generation. (This is the case when the
2025 activation object creates the arguments object.)
2027 2008-04-28 Oliver Hunt <oliver@apple.com>
2031 Replace unsafe use of auto_ptr in Vector with manual memory
2034 * VM/RegisterFileStack.cpp:
2035 (KJS::RegisterFileStack::~RegisterFileStack):
2036 (KJS::RegisterFileStack::popRegisterFile):
2037 * VM/RegisterFileStack.h:
2039 2008-04-27 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2043 Bug 18746: SQUIRRELFISH: indirect eval used when direct eval should be used
2044 <https://bugs.webkit.org/show_bug.cgi?id=18746>
2046 Change the base to the correct value of the 'this' object after the direct
2047 eval test instead of before.
2049 Fixes 5 layout tests.
2052 (KJS::Machine::privateExecute):
2054 (KJS::EvalFunctionCallNode::emitCode):
2056 2008-04-26 Maciej Stachowiak <mjs@apple.com>
2060 - document all property getting, setting and deleting opcodes
2062 (And fix function parameter names to match corresponding opcode parameter names.)
2064 * VM/CodeGenerator.cpp:
2065 (KJS::CodeGenerator::emitResolve):
2066 (KJS::CodeGenerator::emitResolveBase):
2067 (KJS::CodeGenerator::emitResolveBaseAndProperty):
2068 (KJS::CodeGenerator::emitResolveBaseAndFunc):
2069 (KJS::CodeGenerator::emitGetPropId):
2070 (KJS::CodeGenerator::emitPutPropId):
2071 (KJS::CodeGenerator::emitDeletePropId):
2072 (KJS::CodeGenerator::emitPutPropVal):
2073 * VM/CodeGenerator.h:
2077 (KJS::resolveBaseAndProperty):
2078 (KJS::resolveBaseAndFunc):
2079 (KJS::Machine::privateExecute):
2081 (KJS::ResolveNode::emitCode):
2082 (KJS::ArrayNode::emitCode):
2083 (KJS::PropertyListNode::emitCode):
2084 (KJS::BracketAccessorNode::emitCode):
2085 (KJS::EvalFunctionCallNode::emitCode):
2086 (KJS::FunctionCallResolveNode::emitCode):
2087 (KJS::FunctionCallBracketNode::emitCode):
2088 (KJS::PostIncResolveNode::emitCode):
2089 (KJS::PostDecResolveNode::emitCode):
2090 (KJS::PostIncBracketNode::emitCode):
2091 (KJS::PostDecBracketNode::emitCode):
2092 (KJS::PostIncDotNode::emitCode):
2093 (KJS::PostDecDotNode::emitCode):
2094 (KJS::DeleteResolveNode::emitCode):
2095 (KJS::TypeOfResolveNode::emitCode):
2096 (KJS::PreIncResolveNode::emitCode):
2097 (KJS::PreDecResolveNode::emitCode):
2098 (KJS::PreIncBracketNode::emitCode):
2099 (KJS::PreDecBracketNode::emitCode):
2100 (KJS::AssignResolveNode::emitCode):
2101 (KJS::AssignDotNode::emitCode):
2102 (KJS::ReadModifyDotNode::emitCode):
2103 (KJS::AssignBracketNode::emitCode):
2104 (KJS::ReadModifyBracketNode::emitCode):
2105 (KJS::ConstDeclNode::emitCodeSingle):
2107 2008-04-26 Oliver Hunt <oliver@apple.com>
2111 Bug 18628: SQUIRRELFISH: need to support recursion limit
2112 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2114 Basically completes recursion limiting. There is still some
2115 tuning we may want to do to make things better in the face of
2116 very bad code, but certainly nothing worse than anything already
2119 Also fixes a WebKit test by fixing the exception text :D
2121 * JavaScriptCore.exp:
2122 * VM/ExceptionHelpers.cpp:
2124 (KJS::Machine::execute):
2125 * VM/RegisterFile.cpp:
2126 (KJS::RegisterFile::growBuffer):
2127 (KJS::RegisterFile::addGlobalSlots):
2128 * VM/RegisterFile.h:
2129 (KJS::RegisterFile::grow):
2130 (KJS::RegisterFile::uncheckedGrow):
2131 * VM/RegisterFileStack.cpp:
2132 (KJS::RegisterFileStack::pushRegisterFile):
2133 * VM/RegisterFileStack.h:
2135 2008-04-25 Oliver Hunt <oliver@apple.com>
2139 Bug 18628: SQUIRRELFISH: need to support recursion limit
2140 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2142 Put a limit on the level of reentry recursion. 128 levels of re-entrant recursion
2143 seems reasonable as it is greater than the old eval limit, and a long way short of
2144 the reentry depth needed to overflow the stack.
2147 (KJS::Machine::execute):
2150 2008-04-25 Geoffrey Garen <ggaren@apple.com>
2152 Reviewed by Sam Weinig.
2154 A tiny bit of cleanup to the regexp code.
2156 Removed some static_cast.
2158 Removed createRegExpImp because it's no longer used.
2160 2008-04-25 Oliver Hunt <oliver@apple.com>
2164 Bug 18736: SQUIRRELFISH: switch statements with no default have incorrect codegen
2165 <https://bugs.webkit.org/show_bug.cgi?id=18736>
2167 Ensure the "default" target is correct in the absence of an explicit default handler.
2170 (KJS::CaseBlockNode::emitCodeForBlock):
2172 2008-04-25 Oliver Hunt <oliver@apple.com>
2176 Bug 18628: SQUIRRELFISH: need to support recursion limit
2177 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2179 More bounds checking.
2182 (KJS::Machine::execute):
2183 * VM/RegisterFile.cpp:
2184 (KJS::RegisterFile::growBuffer):
2185 * VM/RegisterFile.h:
2187 2008-04-25 Maciej Stachowiak <mjs@apple.com>
2191 - fix signal catching magic
2193 The signal handlers are restored to _exit but are only set when
2194 running under run-javascriptcore-tests. fprintf from a signal
2195 handler is not safe.
2200 * tests/mozilla/jsDriver.pl:
2202 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2206 Bug 18732: SQUIRRELFISH: exceptions thrown by native constructors are ignored
2207 <https://bugs.webkit.org/show_bug.cgi?id=18732>
2209 Fixes another regression test.
2212 (KJS::Machine::privateExecute):
2214 2008-04-25 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2218 Bug 18728: SQUIRRELFISH: invalid regular expression constants should throw exceptions
2219 <https://bugs.webkit.org/show_bug.cgi?id=18728>
2221 Fixes another regression test.
2224 (KJS::RegExpNode::emitCode):
2226 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2228 Reviewed by Geoffrey Garen.
2230 Bug 18735: SQUIRRELFISH: closures are sometimes given an incorrect 'this' value when called
2231 <https://bugs.webkit.org/show_bug.cgi?id=18735>
2233 The overloaded toThisObject method was not copied over to JSActivation.
2235 Fixes two regression tests.
2237 * kjs/JSActivation.cpp:
2238 (KJS::JSActivation::toThisObject):
2239 * kjs/JSActivation.h:
2241 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2243 Reviewed by Oliver Hunt.
2245 Added support for arguments.callee.
2247 2008-04-24 Oliver Hunt <oliver@apple.com>
2251 Bug 18628: SQUIRRELFISH: need to support recursion limit
2252 <https://bugs.webkit.org/show_bug.cgi?id=18628>
2254 Partial fix -- this gets us some of the required bounds checking, but not
2255 complete coverage. But it does manage to do them without regressing :D
2257 * VM/ExceptionHelpers.cpp:
2259 (KJS::createStackOverflowError):
2260 * VM/ExceptionHelpers.h:
2262 (KJS::slideRegisterWindowForCall):
2263 (KJS::Machine::execute):
2264 (KJS::Machine::privateExecute):
2265 * VM/RegisterFile.cpp:
2266 * VM/RegisterFile.h:
2267 (KJS::RegisterFile::):
2268 (KJS::RegisterFile::RegisterFile):
2269 (KJS::RegisterFile::grow):
2271 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2273 Reviewed by Oliver Hunt.
2275 A tiny bit more handling of "arguments": create a real, but mostly
2276 hollow, arguments object.
2278 Fixes 2 regression tests.
2280 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2284 Bug 18717: SQUIRRELFISH: eval returns the wrong value for a variable declaration statement
2285 <https://bugs.webkit.org/show_bug.cgi?id=18717>
2287 Fixes a regression test, but exposes the failure of another due to the
2288 lack of getters and setters.
2291 (KJS::ConstDeclNode::emitCodeSingle):
2292 (KJS::ConstDeclNode::emitCode):
2293 (KJS::ConstStatementNode::emitCode):
2294 (KJS::VarStatementNode::emitCode):
2297 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2299 Reviewed by Sam Weinig.
2301 Print a CRASH statement when crashing, so test failures are not a
2308 2008-04-24 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2310 Reviewed by Geoffrey Garen.
2312 Bug 18716: SQUIRRELFISH: typeof should return undefined for an undefined variable reference
2313 <https://bugs.webkit.org/show_bug.cgi?id=18716>
2315 This fixes 2 more regression tests.
2318 (KJS::TypeOfResolveNode::emitCode):
2320 2008-04-24 Geoffrey Garen <ggaren@apple.com>
2322 Reviewed by Sam Weinig.
2324 Put the callee in the call frame.
2326 Necessary in order to support "arguments" and "arguments.callee".
2328 Also fixes a latent GC bug, where an executing function could be
2329 subject to GC if the register holding it were overwritten. Here's
2330 an example that would have caused problems:
2334 // Flood the machine stack to eliminate any old pointers to f.
2337 // Overwrite f in the register file.
2341 for (var i = 0; i < 5000; ++i) {
2345 // Welcome to crash-ville.
2354 * VM/Machine.h: Changed the order of arguments to
2355 execute(FunctionBodyNode*...) to match the other execute functions.
2356 * kjs/function.cpp: Updated to match new argument requirements from
2357 execute(FunctionBodyNode*...). Renamed newObj to thisObj to match the
2358 rest of JavaScriptCore.
2360 SunSpider reports no change.
2362 2008-04-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2366 Bug 18707: SQUIRRELFISH: eval always performs toString() on its argument
2367 <https://bugs.webkit.org/show_bug.cgi?id=18707>
2369 This fixes 4 more regression tests.
2374 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2378 - fix logic bug in SegmentedVector::grow which would sometimes fail to resize a segment when needed
2382 * VM/SegmentedVector.h:
2383 (KJS::SegmentedVector::grow):
2385 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2387 Reviewed by Maciej Stachowiak.
2389 Degenerate handling of "arguments" as a property of the activation
2390 object. Currently, we just return a vanilla object.
2392 SunSpider reports no change.
2396 ecma_3/Function/regress-94506.js.
2398 Reveals to have been secretly broken:
2400 ecma_3/Function/15.3.4.3-1.js
2401 ecma_3/Function/15.3.4.4-1.js
2403 These tests were passing incorrectly. testkjs creates a global array
2404 named "arguments" to hold command-line arguments. That array was
2405 tricking these tests into thinking that an arguments object with length
2406 0 had been created. Since our new vanilla object shadows the global
2407 property named arguments, that object no longer fools these tests into
2410 Net change: +1 failing test.
2412 * kjs/AllInOneFile.cpp: Had to put JSActivation.cpp into AllInOneFile.cpp
2413 to solve a surprising 8.6% regression in bitops-3bit-bits-in-byte.
2415 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2419 - save and restore callFrame
2422 (KJS::slideRegisterWindowForCall):
2423 (KJS::Machine::execute):
2424 (KJS::Machine::privateExecute):
2428 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2430 Reviewed by Maciej Stachowiak.
2432 Fixed scopes for named function expressions.
2434 Fixes one regression test.
2438 (1) The function's name is supposed to have attributes DontDelete,
2439 ReadOnly, regardless of the type of code executing.
2441 (2) Push the name object on the function's scope chain, rather than
2442 the ExecState's scope chain because, well, that's where it belongs.
2444 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2446 Reviewed by Oliver Hunt.
2448 Inlined JSObject::putDirect, for a .4% SunSpider speedup.
2450 I did this as a first step toward removing nodes.cpp from
2451 AllInOneFile.cpp, but I'm putting that larger project aside for now.
2453 2008-04-23 Maciej Stachowiak <mjs@apple.com>
2455 Rubber stamped by Geoff.
2457 - add OldInterpreterExecState class and use it in dead code
2459 This will allow removing things from the real ExecState class
2460 without having to figure out how to remove all this code without
2461 getting a perf regression.
2464 (KJS::ExpressionNode::evaluateToNumber):
2465 (KJS::ExpressionNode::evaluateToBoolean):
2466 (KJS::ExpressionNode::evaluateToInt32):
2467 (KJS::ExpressionNode::evaluateToUInt32):
2468 (KJS::Node::setErrorCompletion):
2469 (KJS::Node::throwError):
2470 (KJS::Node::throwUndefinedVariableError):
2471 (KJS::Node::handleException):
2472 (KJS::Node::rethrowException):
2473 (KJS::BreakpointCheckStatement::execute):
2474 (KJS::BreakpointCheckStatement::optimizeVariableAccess):
2475 (KJS::NullNode::evaluate):
2476 (KJS::FalseNode::evaluate):
2477 (KJS::TrueNode::evaluate):
2478 (KJS::NumberNode::evaluate):
2479 (KJS::NumberNode::evaluateToNumber):
2480 (KJS::NumberNode::evaluateToBoolean):
2481 (KJS::NumberNode::evaluateToInt32):
2482 (KJS::NumberNode::evaluateToUInt32):
2483 (KJS::ImmediateNumberNode::evaluate):
2484 (KJS::ImmediateNumberNode::evaluateToInt32):
2485 (KJS::ImmediateNumberNode::evaluateToUInt32):
2486 (KJS::StringNode::evaluate):
2487 (KJS::StringNode::evaluateToNumber):
2488 (KJS::StringNode::evaluateToBoolean):
2489 (KJS::RegExpNode::evaluate):
2490 (KJS::ThisNode::evaluate):
2491 (KJS::ResolveNode::inlineEvaluate):
2492 (KJS::ResolveNode::evaluate):
2493 (KJS::ResolveNode::evaluateToNumber):
2494 (KJS::ResolveNode::evaluateToBoolean):
2495 (KJS::ResolveNode::evaluateToInt32):
2496 (KJS::ResolveNode::evaluateToUInt32):
2497 (KJS::getSymbolTableEntry):
2498 (KJS::ResolveNode::optimizeVariableAccess):
2499 (KJS::LocalVarAccessNode::inlineEvaluate):
2500 (KJS::LocalVarAccessNode::evaluate):
2501 (KJS::LocalVarAccessNode::evaluateToNumber):
2502 (KJS::LocalVarAccessNode::evaluateToBoolean):
2503 (KJS::LocalVarAccessNode::evaluateToInt32):
2504 (KJS::LocalVarAccessNode::evaluateToUInt32):
2505 (KJS::getNonLocalSymbol):
2506 (KJS::ScopedVarAccessNode::inlineEvaluate):
2507 (KJS::ScopedVarAccessNode::evaluate):
2508 (KJS::ScopedVarAccessNode::evaluateToNumber):
2509 (KJS::ScopedVarAccessNode::evaluateToBoolean):
2510 (KJS::ScopedVarAccessNode::evaluateToInt32):
2511 (KJS::ScopedVarAccessNode::evaluateToUInt32):
2512 (KJS::NonLocalVarAccessNode::inlineEvaluate):
2513 (KJS::NonLocalVarAccessNode::evaluate):
2514 (KJS::NonLocalVarAccessNode::evaluateToNumber):
2515 (KJS::NonLocalVarAccessNode::evaluateToBoolean):
2516 (KJS::NonLocalVarAccessNode::evaluateToInt32):
2517 (KJS::NonLocalVarAccessNode::evaluateToUInt32):
2518 (KJS::ElementNode::optimizeVariableAccess):
2519 (KJS::ElementNode::evaluate):
2520 (KJS::ArrayNode::optimizeVariableAccess):
2521 (KJS::ArrayNode::evaluate):
2522 (KJS::ObjectLiteralNode::optimizeVariableAccess):
2523 (KJS::ObjectLiteralNode::evaluate):
2524 (KJS::PropertyListNode::optimizeVariableAccess):
2525 (KJS::PropertyListNode::evaluate):
2526 (KJS::PropertyNode::optimizeVariableAccess):
2527 (KJS::PropertyNode::evaluate):
2528 (KJS::BracketAccessorNode::optimizeVariableAccess):
2529 (KJS::BracketAccessorNode::inlineEvaluate):
2530 (KJS::BracketAccessorNode::evaluate):
2531 (KJS::BracketAccessorNode::evaluateToNumber):
2532 (KJS::BracketAccessorNode::evaluateToBoolean):
2533 (KJS::BracketAccessorNode::evaluateToInt32):
2534 (KJS::BracketAccessorNode::evaluateToUInt32):
2535 (KJS::DotAccessorNode::optimizeVariableAccess):
2536 (KJS::DotAccessorNode::inlineEvaluate):
2537 (KJS::DotAccessorNode::evaluate):
2538 (KJS::DotAccessorNode::evaluateToNumber):
2539 (KJS::DotAccessorNode::evaluateToBoolean):
2540 (KJS::DotAccessorNode::evaluateToInt32):
2541 (KJS::DotAccessorNode::evaluateToUInt32):
2542 (KJS::ArgumentListNode::optimizeVariableAccess):
2543 (KJS::ArgumentListNode::evaluateList):
2544 (KJS::ArgumentsNode::optimizeVariableAccess):
2545 (KJS::NewExprNode::optimizeVariableAccess):
2546 (KJS::NewExprNode::inlineEvaluate):
2547 (KJS::NewExprNode::evaluate):
2548 (KJS::NewExprNode::evaluateToNumber):
2549 (KJS::NewExprNode::evaluateToBoolean):
2550 (KJS::NewExprNode::evaluateToInt32):
2551 (KJS::NewExprNode::evaluateToUInt32):
2552 (KJS::ExpressionNode::resolveAndCall):
2553 (KJS::EvalFunctionCallNode::optimizeVariableAccess):
2554 (KJS::EvalFunctionCallNode::evaluate):
2555 (KJS::FunctionCallValueNode::optimizeVariableAccess):
2556 (KJS::FunctionCallValueNode::evaluate):
2557 (KJS::FunctionCallResolveNode::optimizeVariableAccess):
2558 (KJS::FunctionCallResolveNode::inlineEvaluate):
2559 (KJS::FunctionCallResolveNode::evaluate):
2560 (KJS::FunctionCallResolveNode::evaluateToNumber):
2561 (KJS::FunctionCallResolveNode::evaluateToBoolean):
2562 (KJS::FunctionCallResolveNode::evaluateToInt32):
2563 (KJS::FunctionCallResolveNode::evaluateToUInt32):
2564 (KJS::LocalVarFunctionCallNode::inlineEvaluate):
2565 (KJS::LocalVarFunctionCallNode::evaluate):
2566 (KJS::LocalVarFunctionCallNode::evaluateToNumber):
2567 (KJS::LocalVarFunctionCallNode::evaluateToBoolean):
2568 (KJS::LocalVarFunctionCallNode::evaluateToInt32):
2569 (KJS::LocalVarFunctionCallNode::evaluateToUInt32):
2570 (KJS::ScopedVarFunctionCallNode::inlineEvaluate):
2571 (KJS::ScopedVarFunctionCallNode::evaluate):
2572 (KJS::ScopedVarFunctionCallNode::evaluateToNumber):
2573 (KJS::ScopedVarFunctionCallNode::evaluateToBoolean):
2574 (KJS::ScopedVarFunctionCallNode::evaluateToInt32):
2575 (KJS::ScopedVarFunctionCallNode::evaluateToUInt32):
2576 (KJS::NonLocalVarFunctionCallNode::inlineEvaluate):
2577 (KJS::NonLocalVarFunctionCallNode::evaluate):
2578 (KJS::NonLocalVarFunctionCallNode::evaluateToNumber):
2579 (KJS::NonLocalVarFunctionCallNode::evaluateToBoolean):
2580 (KJS::NonLocalVarFunctionCallNode::evaluateToInt32):
2581 (KJS::NonLocalVarFunctionCallNode::evaluateToUInt32):
2582 (KJS::FunctionCallBracketNode::optimizeVariableAccess):
2583 (KJS::FunctionCallBracketNode::evaluate):
2584 (KJS::FunctionCallDotNode::optimizeVariableAccess):
2585 (KJS::FunctionCallDotNode::inlineEvaluate):
2586 (KJS::FunctionCallDotNode::evaluate):
2587 (KJS::FunctionCallDotNode::evaluateToNumber):
2588 (KJS::FunctionCallDotNode::evaluateToBoolean):
2589 (KJS::FunctionCallDotNode::evaluateToInt32):
2590 (KJS::FunctionCallDotNode::evaluateToUInt32):
2591 (KJS::PostIncResolveNode::optimizeVariableAccess):
2592 (KJS::PostIncResolveNode::evaluate):
2593 (KJS::PostIncLocalVarNode::evaluate):
2594 (KJS::PostDecResolveNode::optimizeVariableAccess):
2595 (KJS::PostDecResolveNode::evaluate):
2596 (KJS::PostDecLocalVarNode::evaluate):
2597 (KJS::PostDecLocalVarNode::inlineEvaluateToNumber):
2598 (KJS::PostDecLocalVarNode::evaluateToNumber):
2599 (KJS::PostDecLocalVarNode::evaluateToBoolean):
2600 (KJS::PostDecLocalVarNode::evaluateToInt32):
2601 (KJS::PostDecLocalVarNode::evaluateToUInt32):
2602 (KJS::PostfixBracketNode::optimizeVariableAccess):
2603 (KJS::PostIncBracketNode::evaluate):
2604 (KJS::PostDecBracketNode::evaluate):
2605 (KJS::PostfixDotNode::optimizeVariableAccess):
2606 (KJS::PostIncDotNode::evaluate):
2607 (KJS::PostDecDotNode::evaluate):
2608 (KJS::PostfixErrorNode::evaluate):
2609 (KJS::DeleteResolveNode::optimizeVariableAccess):
2610 (KJS::DeleteResolveNode::evaluate):
2611 (KJS::LocalVarDeleteNode::evaluate):
2612 (KJS::DeleteBracketNode::optimizeVariableAccess):
2613 (KJS::DeleteBracketNode::evaluate):
2614 (KJS::DeleteDotNode::optimizeVariableAccess):
2615 (KJS::DeleteDotNode::evaluate):
2616 (KJS::DeleteValueNode::optimizeVariableAccess):
2617 (KJS::DeleteValueNode::evaluate):
2618 (KJS::VoidNode::optimizeVariableAccess):
2619 (KJS::VoidNode::evaluate):
2620 (KJS::TypeOfValueNode::optimizeVariableAccess):
2621 (KJS::TypeOfResolveNode::optimizeVariableAccess):
2622 (KJS::LocalVarTypeOfNode::evaluate):
2623 (KJS::TypeOfResolveNode::evaluate):
2624 (KJS::TypeOfValueNode::evaluate):
2625 (KJS::PreIncResolveNode::optimizeVariableAccess):
2626 (KJS::PreIncLocalVarNode::evaluate):
2627 (KJS::PreIncResolveNode::evaluate):
2628 (KJS::PreDecResolveNode::optimizeVariableAccess):
2629 (KJS::PreDecLocalVarNode::evaluate):
2630 (KJS::PreDecResolveNode::evaluate):
2631 (KJS::PreIncConstNode::evaluate):
2632 (KJS::PreDecConstNode::evaluate):
2633 (KJS::PostIncConstNode::evaluate):
2634 (KJS::PostDecConstNode::evaluate):
2635 (KJS::PrefixBracketNode::optimizeVariableAccess):
2636 (KJS::PreIncBracketNode::evaluate):
2637 (KJS::PreDecBracketNode::evaluate):
2638 (KJS::PrefixDotNode::optimizeVariableAccess):
2639 (KJS::PreIncDotNode::evaluate):
2640 (KJS::PreDecDotNode::evaluate):
2641 (KJS::PrefixErrorNode::evaluate):
2642 (KJS::UnaryPlusNode::optimizeVariableAccess):
2643 (KJS::UnaryPlusNode::evaluate):
2644 (KJS::UnaryPlusNode::evaluateToBoolean):
2645 (KJS::UnaryPlusNode::evaluateToNumber):
2646 (KJS::UnaryPlusNode::evaluateToInt32):
2647 (KJS::UnaryPlusNode::evaluateToUInt32):
2648 (KJS::NegateNode::optimizeVariableAccess):
2649 (KJS::NegateNode::evaluate):
2650 (KJS::NegateNode::evaluateToNumber):
2651 (KJS::BitwiseNotNode::optimizeVariableAccess):
2652 (KJS::BitwiseNotNode::inlineEvaluateToInt32):
2653 (KJS::BitwiseNotNode::evaluate):
2654 (KJS::BitwiseNotNode::evaluateToNumber):
2655 (KJS::BitwiseNotNode::evaluateToBoolean):
2656 (KJS::BitwiseNotNode::evaluateToInt32):
2657 (KJS::BitwiseNotNode::evaluateToUInt32):
2658 (KJS::LogicalNotNode::optimizeVariableAccess):
2659 (KJS::LogicalNotNode::evaluate):
2660 (KJS::LogicalNotNode::evaluateToBoolean):
2661 (KJS::MultNode::optimizeVariableAccess):
2662 (KJS::MultNode::inlineEvaluateToNumber):
2663 (KJS::MultNode::evaluate):
2664 (KJS::MultNode::evaluateToNumber):
2665 (KJS::MultNode::evaluateToBoolean):
2666 (KJS::MultNode::evaluateToInt32):
2667 (KJS::MultNode::evaluateToUInt32):
2668 (KJS::DivNode::optimizeVariableAccess):
2669 (KJS::DivNode::inlineEvaluateToNumber):
2670 (KJS::DivNode::evaluate):
2671 (KJS::DivNode::evaluateToNumber):
2672 (KJS::DivNode::evaluateToInt32):
2673 (KJS::DivNode::evaluateToUInt32):
2674 (KJS::ModNode::optimizeVariableAccess):
2675 (KJS::ModNode::inlineEvaluateToNumber):
2676 (KJS::ModNode::evaluate):
2677 (KJS::ModNode::evaluateToNumber):
2678 (KJS::ModNode::evaluateToBoolean):
2679 (KJS::ModNode::evaluateToInt32):
2680 (KJS::ModNode::evaluateToUInt32):
2681 (KJS::throwOutOfMemoryErrorToNumber):
2683 (KJS::addSlowCaseToNumber):
2686 (KJS::AddNode::optimizeVariableAccess):
2687 (KJS::AddNode::evaluate):
2688 (KJS::AddNode::inlineEvaluateToNumber):
2689 (KJS::AddNode::evaluateToNumber):
2690 (KJS::AddNode::evaluateToInt32):
2691 (KJS::AddNode::evaluateToUInt32):
2692 (KJS::AddNumbersNode::inlineEvaluateToNumber):
2693 (KJS::AddNumbersNode::evaluate):
2694 (KJS::AddNumbersNode::evaluateToNumber):
2695 (KJS::AddNumbersNode::evaluateToInt32):
2696 (KJS::AddNumbersNode::evaluateToUInt32):
2697 (KJS::AddStringsNode::evaluate):
2698 (KJS::AddStringLeftNode::evaluate):
2699 (KJS::AddStringRightNode::evaluate):
2700 (KJS::SubNode::optimizeVariableAccess):
2701 (KJS::SubNode::inlineEvaluateToNumber):
2702 (KJS::SubNode::evaluate):
2703 (KJS::SubNode::evaluateToNumber):
2704 (KJS::SubNode::evaluateToInt32):
2705 (KJS::SubNode::evaluateToUInt32):
2706 (KJS::LeftShiftNode::optimizeVariableAccess):
2707 (KJS::LeftShiftNode::inlineEvaluateToInt32):
2708 (KJS::LeftShiftNode::evaluate):
2709 (KJS::LeftShiftNode::evaluateToNumber):
2710 (KJS::LeftShiftNode::evaluateToInt32):
2711 (KJS::LeftShiftNode::evaluateToUInt32):
2712 (KJS::RightShiftNode::optimizeVariableAccess):
2713 (KJS::RightShiftNode::inlineEvaluateToInt32):
2714 (KJS::RightShiftNode::evaluate):
2715 (KJS::RightShiftNode::evaluateToNumber):
2716 (KJS::RightShiftNode::evaluateToInt32):
2717 (KJS::RightShiftNode::evaluateToUInt32):
2718 (KJS::UnsignedRightShiftNode::optimizeVariableAccess):
2719 (KJS::UnsignedRightShiftNode::inlineEvaluateToUInt32):
2720 (KJS::UnsignedRightShiftNode::evaluate):
2721 (KJS::UnsignedRightShiftNode::evaluateToNumber):
2722 (KJS::UnsignedRightShiftNode::evaluateToInt32):
2723 (KJS::UnsignedRightShiftNode::evaluateToUInt32):
2726 (KJS::LessNode::optimizeVariableAccess):
2727 (KJS::LessNode::inlineEvaluateToBoolean):
2728 (KJS::LessNode::evaluate):
2729 (KJS::LessNode::evaluateToBoolean):
2730 (KJS::LessNumbersNode::inlineEvaluateToBoolean):
2731 (KJS::LessNumbersNode::evaluate):
2732 (KJS::LessNumbersNode::evaluateToBoolean):
2733 (KJS::LessStringsNode::inlineEvaluateToBoolean):
2734 (KJS::LessStringsNode::evaluate):
2735 (KJS::LessStringsNode::evaluateToBoolean):
2736 (KJS::GreaterNode::optimizeVariableAccess):
2737 (KJS::GreaterNode::inlineEvaluateToBoolean):
2738 (KJS::GreaterNode::evaluate):
2739 (KJS::GreaterNode::evaluateToBoolean):
2740 (KJS::LessEqNode::optimizeVariableAccess):
2741 (KJS::LessEqNode::inlineEvaluateToBoolean):
2742 (KJS::LessEqNode::evaluate):
2743 (KJS::LessEqNode::evaluateToBoolean):
2744 (KJS::GreaterEqNode::optimizeVariableAccess):
2745 (KJS::GreaterEqNode::inlineEvaluateToBoolean):
2746 (KJS::GreaterEqNode::evaluate):
2747 (KJS::GreaterEqNode::evaluateToBoolean):
2748 (KJS::InstanceOfNode::optimizeVariableAccess):
2749 (KJS::InstanceOfNode::evaluate):
2750 (KJS::InstanceOfNode::evaluateToBoolean):
2751 (KJS::InNode::optimizeVariableAccess):
2752 (KJS::InNode::evaluate):
2753 (KJS::InNode::evaluateToBoolean):
2754 (KJS::EqualNode::optimizeVariableAccess):
2755 (KJS::EqualNode::inlineEvaluateToBoolean):
2756 (KJS::EqualNode::evaluate):
2757 (KJS::EqualNode::evaluateToBoolean):
2758 (KJS::NotEqualNode::optimizeVariableAccess):
2759 (KJS::NotEqualNode::inlineEvaluateToBoolean):
2760 (KJS::NotEqualNode::evaluate):
2761 (KJS::NotEqualNode::evaluateToBoolean):
2762 (KJS::StrictEqualNode::optimizeVariableAccess):
2763 (KJS::StrictEqualNode::inlineEvaluateToBoolean):
2764 (KJS::StrictEqualNode::evaluate):
2765 (KJS::StrictEqualNode::evaluateToBoolean):
2766 (KJS::NotStrictEqualNode::optimizeVariableAccess):
2767 (KJS::NotStrictEqualNode::inlineEvaluateToBoolean):
2768 (KJS::NotStrictEqualNode::evaluate):
2769 (KJS::NotStrictEqualNode::evaluateToBoolean):
2770 (KJS::BitAndNode::optimizeVariableAccess):
2771 (KJS::BitAndNode::evaluate):
2772 (KJS::BitAndNode::inlineEvaluateToInt32):
2773 (KJS::BitAndNode::evaluateToNumber):
2774 (KJS::BitAndNode::evaluateToBoolean):
2775 (KJS::BitAndNode::evaluateToInt32):
2776 (KJS::BitAndNode::evaluateToUInt32):
2777 (KJS::BitXOrNode::optimizeVariableAccess):
2778 (KJS::BitXOrNode::inlineEvaluateToInt32):
2779 (KJS::BitXOrNode::evaluate):
2780 (KJS::BitXOrNode::evaluateToNumber):
2781 (KJS::BitXOrNode::evaluateToBoolean):
2782 (KJS::BitXOrNode::evaluateToInt32):
2783 (KJS::BitXOrNode::evaluateToUInt32):
2784 (KJS::BitOrNode::optimizeVariableAccess):
2785 (KJS::BitOrNode::inlineEvaluateToInt32):
2786 (KJS::BitOrNode::evaluate):
2787 (KJS::BitOrNode::evaluateToNumber):
2788 (KJS::BitOrNode::evaluateToBoolean):
2789 (KJS::BitOrNode::evaluateToInt32):
2790 (KJS::BitOrNode::evaluateToUInt32):
2791 (KJS::LogicalAndNode::optimizeVariableAccess):
2792 (KJS::LogicalAndNode::evaluate):
2793 (KJS::LogicalAndNode::evaluateToBoolean):
2794 (KJS::LogicalOrNode::optimizeVariableAccess):
2795 (KJS::LogicalOrNode::evaluate):
2796 (KJS::LogicalOrNode::evaluateToBoolean):
2797 (KJS::ConditionalNode::optimizeVariableAccess):
2798 (KJS::ConditionalNode::evaluate):
2799 (KJS::ConditionalNode::evaluateToBoolean):
2800 (KJS::ConditionalNode::evaluateToNumber):
2801 (KJS::ConditionalNode::evaluateToInt32):
2802 (KJS::ConditionalNode::evaluateToUInt32):
2803 (KJS::valueForReadModifyAssignment):
2804 (KJS::ReadModifyResolveNode::optimizeVariableAccess):
2805 (KJS::AssignResolveNode::optimizeVariableAccess):
2806 (KJS::ReadModifyLocalVarNode::evaluate):
2807 (KJS::AssignLocalVarNode::evaluate):
2808 (KJS::ReadModifyConstNode::evaluate):
2809 (KJS::AssignConstNode::evaluate):
2810 (KJS::ReadModifyResolveNode::evaluate):
2811 (KJS::AssignResolveNode::evaluate):
2812 (KJS::AssignDotNode::optimizeVariableAccess):
2813 (KJS::AssignDotNode::evaluate):
2814 (KJS::ReadModifyDotNode::optimizeVariableAccess):
2815 (KJS::ReadModifyDotNode::evaluate):
2816 (KJS::AssignErrorNode::evaluate):
2817 (KJS::AssignBracketNode::optimizeVariableAccess):
2818 (KJS::AssignBracketNode::evaluate):
2819 (KJS::ReadModifyBracketNode::optimizeVariableAccess):
2820 (KJS::ReadModifyBracketNode::evaluate):
2821 (KJS::CommaNode::optimizeVariableAccess):
2822 (KJS::CommaNode::evaluate):
2823 (KJS::ConstDeclNode::optimizeVariableAccess):
2824 (KJS::ConstDeclNode::handleSlowCase):
2825 (KJS::ConstDeclNode::evaluateSingle):
2826 (KJS::ConstDeclNode::evaluate):
2827 (KJS::ConstStatementNode::optimizeVariableAccess):
2828 (KJS::ConstStatementNode::execute):
2829 (KJS::statementListExecute):
2830 (KJS::BlockNode::optimizeVariableAccess):
2831 (KJS::BlockNode::execute):
2832 (KJS::EmptyStatementNode::execute):
2833 (KJS::ExprStatementNode::optimizeVariableAccess):
2834 (KJS::ExprStatementNode::execute):
2835 (KJS::VarStatementNode::optimizeVariableAccess):
2836 (KJS::VarStatementNode::execute):
2837 (KJS::IfNode::optimizeVariableAccess):
2838 (KJS::IfNode::execute):
2839 (KJS::IfElseNode::optimizeVariableAccess):
2840 (KJS::IfElseNode::execute):
2841 (KJS::DoWhileNode::optimizeVariableAccess):
2842 (KJS::DoWhileNode::execute):
2843 (KJS::WhileNode::optimizeVariableAccess):
2844 (KJS::WhileNode::execute):
2845 (KJS::ForNode::optimizeVariableAccess):
2846 (KJS::ForNode::execute):
2847 (KJS::ForInNode::optimizeVariableAccess):
2848 (KJS::ForInNode::execute):
2849 (KJS::ContinueNode::execute):
2850 (KJS::BreakNode::execute):
2851 (KJS::ReturnNode::optimizeVariableAccess):
2852 (KJS::ReturnNode::execute):
2853 (KJS::WithNode::optimizeVariableAccess):
2854 (KJS::WithNode::execute):
2855 (KJS::CaseClauseNode::optimizeVariableAccess):
2856 (KJS::CaseClauseNode::evaluate):
2857 (KJS::CaseClauseNode::executeStatements):
2858 (KJS::ClauseListNode::optimizeVariableAccess):
2859 (KJS::CaseBlockNode::optimizeVariableAccess):
2860 (KJS::CaseBlockNode::executeBlock):
2861 (KJS::SwitchNode::optimizeVariableAccess):
2862 (KJS::SwitchNode::execute):
2863 (KJS::LabelNode::optimizeVariableAccess):
2864 (KJS::LabelNode::execute):
2865 (KJS::ThrowNode::optimizeVariableAccess):
2866 (KJS::ThrowNode::execute):
2867 (KJS::TryNode::optimizeVariableAccess):
2868 (KJS::TryNode::execute):
2869 (KJS::ProgramNode::initializeSymbolTable):
2870 (KJS::ScopeNode::optimizeVariableAccess):
2871 (KJS::ProgramNode::processDeclarations):
2872 (KJS::EvalNode::processDeclarations):
2873 (KJS::ProgramNode::execute):
2874 (KJS::EvalNode::execute):
2875 (KJS::FunctionBodyNodeWithDebuggerHooks::execute):
2876 (KJS::FuncDeclNode::execute):
2877 (KJS::FuncExprNode::evaluate):
2882 (KJS::ArgumentsNode::):
2884 2008-04-23 Oliver Hunt <oliver@apple.com>
2888 Bug 18672: SQUIRRELFISH: codegen fails with a large number of temporaries
2889 <https://bugs.webkit.org/show_bug.cgi?id=18672>
2891 Add a SegmentedVector type, which provides a Vector<T> which maintains
2892 existing memory locations during resize. This allows dynamically sizing
2893 local, temporary and label "vectors" in CodeGenerator.
2895 * JavaScriptCore.xcodeproj/project.pbxproj:
2896 * VM/CodeGenerator.cpp:
2897 (KJS::CodeGenerator::addVar):
2898 (KJS::CodeGenerator::CodeGenerator):
2899 (KJS::CodeGenerator::newTemporary):
2900 (KJS::CodeGenerator::newLabel):
2901 * VM/CodeGenerator.h:
2902 * VM/SegmentedVector.h: Added.
2903 (KJS::SegmentedVector::SegmentedVector):
2904 (KJS::SegmentedVector::~SegmentedVector):
2905 (KJS::SegmentedVector::last):
2906 (KJS::SegmentedVector::append):
2907 (KJS::SegmentedVector::removeLast):
2908 (KJS::SegmentedVector::size):
2909 (KJS::SegmentedVector::operator[]):
2910 (KJS::SegmentedVector::resize):
2911 (KJS::SegmentedVector::shrink):
2912 (KJS::SegmentedVector::grow):
2914 2008-04-23 Geoffrey Garen <ggaren@apple.com>
2916 Reviewed by Maciej Stachowiak.
2918 A little refactoring in preparation for supporting 'arguments'.
2920 Fixes 2 regression tests.
2922 SunSpider reports no change.
2924 We now check the activation register, instead of the codeBlock, to
2925 determine whether we need to tear off the activation. This is to support
2926 "f.arguments", which will create an activation/arguments pair for f,
2927 even though the needsFullScopeChain flag is false for f's codeBlock.
2929 The test fixes resulted from calling initializeCallFrame for re-entrant
2930 function code, instead of initializing (not enough) parts of the call
2933 2008-04-22 Maciej Stachowiak <mjs@apple.com>
2937 - propagate the "this" value properly to local eval
2939 (fixes a measly one regression test)
2942 (KJS::CodeBlock::CodeBlock):
2943 (KJS::ProgramCodeBlock::ProgramCodeBlock):
2944 (KJS::EvalCodeBlock::EvalCodeBlock):
2946 (KJS::Machine::privateExecute):
2948 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2952 Add support for function declarations in eval code.
2954 (this fixes 12 more regression tests)
2957 * VM/CodeGenerator.cpp:
2958 (KJS::CodeGenerator::CodeGenerator):
2959 * VM/CodeGenerator.h:
2961 (KJS::Machine::execute):
2963 (KJS::EvalNode::generateCode):
2965 2008-04-22 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2969 Implement LabelNode.
2971 * VM/CodeGenerator.cpp:
2972 (KJS::CodeGenerator::pushJumpContext):
2973 (KJS::CodeGenerator::jumpContextForContinue):
2974 (KJS::CodeGenerator::jumpContextForBreak):
2975 * VM/CodeGenerator.h:
2977 (KJS::DoWhileNode::emitCode):
2978 (KJS::WhileNode::emitCode):
2979 (KJS::ForNode::emitCode):
2980 (KJS::ForInNode::emitCode):
2981 (KJS::ContinueNode::emitCode):
2982 (KJS::BreakNode::emitCode):
2983 (KJS::SwitchNode::emitCode):
2984 (KJS::LabelNode::emitCode):
2986 2008-04-22 Geoffrey Garen <ggaren@apple.com>
2988 Reviewed by Oliver Hunt.
2990 Fixed crash when unwinding from exceptions inside eval.
2993 (KJS::Machine::unwindCallFrame): Don't assume that the top of the
2994 current call frame's scope chain is an activation: it can be the global
2997 2008-04-22 Maciej Stachowiak <mjs@apple.com>
3002 (main): Convert signals to exit codes, so that crashing tests are
3003 detected as regression test failures.
3005 2008-04-22 Geoffrey Garen <ggaren@apple.com>
3007 Reviewed by Oliver Hunt and Maciej Stachowiak.
3009 Renamed "needsActivation" to "needsFullScopeChain" because lying will
3010 make hair grow on the backs of your hands.
3012 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3014 Reviewed by Maciej Stachowiak.
3016 Fixed ScopeChainNode lifetime problems:
3018 (1) In "with" and "catch" scopes, we would construct a ScopeChain
3019 object and then jump across its destructor, leaking the ScopeChainNode
3022 (2) In global and eval scopes, we would fail to initially ref
3023 "scopeChain", causing us to overrelease it later. Now that we ref
3024 "scopeChain" properly, we also need to deref it when the script
3027 SunSpider reports a .2% regression, but an earlier round of ScopeChain
3028 refactoring was a .4% speedup, so there.
3030 2008-04-22 Maciej Stachowiak <mjs@apple.com>
3034 - use global object instead of null for "this" on unqualified calls
3036 This fixes 10 more JSC test regressions.
3039 (KJS::Machine::privateExecute):
3041 2008-04-22 Maciej Stachowiak <mjs@apple.com>
3045 - throw proper exceptions for objects that don't implement call or construct
3047 This fixes 21 more JSC test regressions. It is also seemingly an
3050 * VM/ExceptionHelpers.cpp:
3051 (KJS::createNotAnObjectError):
3052 (KJS::createNotAConstructorError):
3053 (KJS::createNotAFunctionError):
3054 * VM/ExceptionHelpers.h:
3056 (KJS::Machine::privateExecute):
3058 2008-04-21 Oliver Hunt <oliver@apple.com>
3062 Implement emitCode for ConstDeclNode.
3064 This fixes the crash (assertion) in js1_5/Scope/scope-001.js
3066 * VM/CodeGenerator.cpp:
3067 (KJS::CodeGenerator::registerForLocalConstInit):
3068 * VM/CodeGenerator.h:
3070 (KJS::AssignResolveNode::emitCode):
3071 (KJS::ConstDeclNode::emitCodeSingle):
3072 (KJS::ConstDeclNode::emitCode):
3073 (KJS::ConstStatementNode::emitCode):
3076 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3080 - add some support for the split window object
3082 This fixes many layout tests.
3085 (KJS::resolveBaseAndFunc): Use toThisObject() to ensure we get the
3086 wrapper global, if one exists, as the "this" object.
3088 (KJS::globalFuncEval): Use toGlobalObject() to handle the wrapper
3091 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3095 - restore ScopeChain::operator= to avoid crash on many layout tests
3097 Otherwise, FunctionImp::setScope would cause a reference
3098 underflow. I implemented using the copy construct and swap idiom.
3100 * kjs/scope_chain.h:
3101 (KJS::ScopeChain::swap):
3102 (KJS::ScopeChain::operator=):
3104 2008-04-21 Oliver Hunt <oliver@apple.com>
3108 Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
3109 <https://bugs.webkit.org/show_bug.cgi?id=18649>
3111 Allocate a callframe for eval() and initialise with a null codeBlock to
3112 indicate native code. This prevents the unwinder from clobbering the
3116 (KJS::Machine::execute):
3118 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3120 Reviewed by Sam Weinig.
3122 Removed ScopeChain::push(ScopeChain&) because it was unused. Moved
3123 ScopeChain::print to ScopeChainNode.
3125 ScopeChain is now nothing more than a resource-handling wrapper around
3128 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3132 Bug 18671: SquirrelFish: continue inside switch fails
3133 <https://bugs.webkit.org/show_bug.cgi?id=18671>
3135 * VM/CodeGenerator.cpp:
3136 (KJS::CodeGenerator::jumpContextForLabel):
3137 * VM/CodeGenerator.h:
3139 (KJS::ContinueNode::emitCode):
3141 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3143 Reviewed by Sam Weinig.
3145 Moved push(JSObject*) and pop() from ScopeChain to ScopeChainNode,
3146 rearranging scope_chain.h a bit.
3148 SunSpider reports no change.
3150 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3152 Reviewed by Sam Weinig.
3154 Moved bottom() from ScopeChain to ScopeChainNode, simplifying it based
3155 on the knowledge that the ScopeChain is never empty.
3157 SunSpider reports no change.
3159 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3161 Reviewed by Oliver Hunt.
3163 Moved begin() and end() from ScopeChain to ScopeChainNode.
3165 Also marked a few methods "const".
3167 SunSpider reports no change.
3169 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3171 Reviewed by Maciej Stachowiak.
3173 Turned ScopeChain::depth into a stand-alone function, and simplified it
3176 I also moved ScopeChain::depth to Machine.cpp because it doesn't report
3177 the true depth of the ScopeChain -- just the Machine's perspective of
3178 its depth within a given call frame.
3180 SunSpider reports no change.
3182 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3184 Reviewed by Maciej Stachowiak.
3186 Removed indirection in ScopeChain::ref / ScopeChain::deref.
3188 SunSpider reports no change.
3190 * kjs/scope_chain.h:
3191 (KJS::ScopeChain::ScopeChain):
3192 (KJS::ScopeChain::~ScopeChain):
3193 (KJS::ScopeChain::clear):
3195 2008-04-21 Oliver Hunt <oliver@apple.com>
3197 Reviewed by NOBODY(Build fix)
3202 (KJS::ConstDeclNode::evaluateSingle):
3204 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3208 Bug 18664: SQUIRRELFISH: correctly throw a SyntaxError when parsing of eval code fails
3209 <https://bugs.webkit.org/show_bug.cgi?id=18664>
3211 Correctly throw a SyntaxError when parsing of eval code fails.
3216 2008-04-21 Oliver Hunt <oliver@apple.com>
3220 Partial fix for Bug 18649: SQUIRRELFISH: correctly handle exceptions in eval code
3222 Make sure we correct the register state before jumping to vm_throw.
3225 (KJS::Machine::privateExecute):
3227 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3229 Reviewed by Maciej Stachowiak.
3231 Simplified ScopeChain ref/deref.
3233 SunSpider reports a .4% speedup.
3235 * kjs/scope_chain.h:
3236 (KJS::ScopeChainNode::ref): Removed this function because it was nonsense.
3237 ScopeChainNodes are initialized with a refCount of 1, so the loop was
3238 guaranteed to iterate exactly once.
3240 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3242 Reviewed by Maciej Stachowiak.
3244 Removed support for empty ScopeChains.
3246 SunSpider reports no change.
3248 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3250 Reviewed by Maciej Stachowiak.
3252 Removed some completely unused ScopeChain member functions.
3254 SunSpider reports no change.
3256 2008-04-21 Geoffrey Garen <ggaren@apple.com>
3258 Reviewed by Maciej Stachowiak.
3260 Avoid creating unnecessary ScopeChain objects, to reduce refcount churn.
3262 SunSpider reports no change.
3264 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3266 Rubber stamped by Alexey.
3273 2008-04-21 Maciej Stachowiak <mjs@apple.com>
3277 - only print "End:" output when -d flag is passed.
3279 This fixes half of our failing JSC regression tests.
3284 2008-04-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3288 Add support for variable declarations in eval code.
3291 (KJS::EvalCodeBlock::EvalCodeBlock):
3292 * VM/CodeGenerator.cpp:
3293 (KJS::CodeGenerator::CodeGenerator):
3294 * VM/CodeGenerator.h:
3296 (KJS::Machine::execute):
3299 (KJS::globalFuncEval):
3301 (KJS::EvalNode::generateCode):
3305 2008-04-20 Oliver Hunt <oliver@apple.com>
3309 Throw exceptions for invalid continue, break, and return statements.
3311 Simple refactoring and extension of Cameron's AssignErrorNode, etc patch
3313 * VM/CodeGenerator.cpp:
3314 (KJS::CodeGenerator::CodeGenerator):
3315 (KJS::CodeGenerator::pushJumpContext):
3316 (KJS::CodeGenerator::popJumpContext):
3317 (KJS::CodeGenerator::jumpContextForLabel):
3318 * VM/CodeGenerator.h:
3320 (KJS::Node::emitThrowError):
3321 (KJS::ContinueNode::emitCode):
3322 (KJS::BreakNode::emitCode):
3323 (KJS::ReturnNode::emitCode):
3326 2008-04-20 Geoffrey Garen <ggaren@apple.com>
3328 Reviewed by Oliver Hunt.
3330 Removed Machine.cpp from AllInOneFile.cpp, and manually inlined a few
3331 things that used to be inlined automatically.
3333 1.9% speedup on SunSpider.
3335 My hope is that we'll face fewer surprises in Machine.cpp codegen, now
3336 that GCC is making fewer decisions. The speedup seems to confirm that.
3338 2008-04-20 Oliver Hunt <oliver@apple.com>
3342 Bug 18642: Iterator context may get placed into the return register, leading to much badness
3343 <https://bugs.webkit.org/show_bug.cgi?id=18642>
3345 To prevent incorrectly reusing what will become the result register for
3346 eval and global code execution, we need to request and ref the destination
3347 in advance of codegen. Unfortunately this may lead to unnecessary copying,
3348 although in future we can probably limit this. Curiously SunSpider shows
3349 a progression in a number of tests, although it comes out as a wash overall.
3352 (KJS::EvalNode::emitCode):
3353 (KJS::ProgramNode::emitCode):
3355 2008-04-20 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3359 Add support for AssignErrorNode, PrefixErrorNode, and PostfixErrorNode.
3362 (KJS::CodeBlock::dump):
3363 * VM/CodeGenerator.cpp:
3364 (KJS::CodeGenerator::emitCreateError):
3365 * VM/CodeGenerator.h:
3367 (KJS::Machine::privateExecute):
3370 (KJS::PostfixErrorNode::emitCode):
3371 (KJS::PrefixErrorNode::emitCode):
3372 (KJS::AssignErrorNode::emitCode):
3375 2008-04-20 Oliver Hunt <oliver@apple.com>
3377 Reviewed by Geoff and Mark.
3379 Provide line number information in exceptions
3381 Simple patch, adds line number information metadata to CodeBlock
3382 and a simple method to get the line number responsible for a given
3386 (KJS::CodeBlock::lineNumberForVPC):
3388 * VM/CodeGenerator.h:
3389 (KJS::CodeGenerator::emitNode):
3391 (KJS::Machine::throwException):
3393 2008-04-20 Oliver Hunt <oliver@apple.com>
3397 Provide "sourceURL" in exceptions
3401 (KJS::Machine::throwException):
3403 (KJS::EvalNode::generateCode):
3404 (KJS::ProgramNode::generateCode):
3406 2008-04-19 Oliver Hunt <oliver@apple.com>
3410 Don't call emitCode directly on subnodes, instead use CodeGenerator::emitNode
3412 This patch just a preparation for tracking line numbers.
3415 (KJS::ObjectLiteralNode::emitCode):
3416 (KJS::PropertyListNode::emitCode):
3417 (KJS::ArgumentListNode::emitCode):
3418 (KJS::TryNode::emitCode):
3420 2008-04-19 Oliver Hunt <oliver@apple.com>
3424 Bug 18619: Support continue, break, and return in try .. finally blocks
3425 <https://bugs.webkit.org/show_bug.cgi?id=18619>
3427 This patch replaces the current partial finally support (which uses code
3428 duplication to achieve what it does) with a subroutine based approach.
3429 This has a number of advantages over code duplication:
3431 * Simplified exception handling as the finaliser code only exists in
3432 one place, so no "magic" is needed to get the correct handler for a
3434 * When we support instruction to line number mapping we won't need to
3435 worry about the dramatic code movement caused by duplication
3437 On the downside it is necessary to add two new opcodes, op_jsr and op_sret
3438 to enter and exit the finaliser subroutines, happily SunSpider reports
3439 a performance progression (gcc amazes me) and ubench reports a wash.
3441 While jsr and sret provide a mechanism that allows us to enter and exit
3442 any arbitrary finaliser we need to, it was still necessary to increase
3443 the amount of information tracked when entering and exiting both finaliser
3444 scopes and dynamic scopes ("with"). This means "scopeDepth" is now
3445 the combination of "finaliserDepth" and "dynamicScopeDepth". We also
3446 now use a scopeContextStack to ensure that we pop scopes and execute
3447 finalisers in the correct order. This increases the cost of "with" nodes
3448 during codegen, but it should not be significant enough to effect real
3449 world performance and greatly simplifies codegen for return, break and
3450 continue when interacting with finalisers.
3453 (KJS::CodeBlock::dump):
3454 Pretty printing of jsr/sret opcodes
3456 * VM/CodeGenerator.cpp:
3457 (KJS::CodeGenerator::CodeGenerator):
3458 (KJS::CodeGenerator::emitPushScope):
3459 (KJS::CodeGenerator::emitPopScope):
3460 Dynamic scopes need to be tracked on the scopeContextStack now
3462 (KJS::CodeGenerator::pushFinallyContext):
3463 (KJS::CodeGenerator::popFinallyContext):
3464 Handle entry and exit from code regions with finalisers. This is
3465 needed solely to support return, continue and break inside finaliser
3468 (KJS::CodeGenerator::emitComplexJumpScopes):
3469 Helper function for emitJumpScopes to handle the complex codegen
3470 needed to handle return, continue and break inside a finaliser region
3472 (KJS::CodeGenerator::emitJumpScopes):
3473 Updated to be aware of finalisers, if a cross-scope jump occurs inside
3474 a finaliser we hand off codegen to emitComplexJumpScopes, otherwise
3475 we can handle the normal (trivial) case with a single instruction.
3477 (KJS::CodeGenerator::emitJumpSubroutine):
3478 (KJS::CodeGenerator::emitSubroutineReturn):
3479 Trivial opcode emitter functions.
3481 * VM/CodeGenerator.h:
3482 (KJS::CodeGenerator::scopeDepth):
3484 (KJS::Machine::privateExecute):
3485 Implement op_jsr and op_sret.
3488 Ad op_jsr and op_sret
3491 (KJS::TryNode::emitCode):
3492 Fix codegen for new finaliser model.
3494 2008-04-17 Mark Rowe <mrowe@apple.com>
3496 Rubber-stamped by Oliver Hunt.
3498 Remove unnecessary files from testkjs, testapi and minidom targets.
3500 * JavaScriptCore.xcodeproj/project.pbxproj:
3502 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3504 Reviewed by Oliver Hunt.
3506 Fixed ASSERT seen during run-sunspider of a debug build.
3508 * VM/CodeGenerator.h: Made the default codegen buffers bigger. SunSpider
3509 runs all tests in one global environment, so you end up with more than
3510 128 locals. This is just a stop-gap until we code up a real
3511 solution to arbitrary symbol and label limits.
3513 2008-04-17 Geoffrey Garen <ggaren@apple.com>
3515 Reviewed by Oliver Hunt.
3517 Fixed a bug in exception unwinding, where we wouldn't deref the scope
3518 chain in global scope, so we would leak ScopeChainNodes when exceptions
3519 were thrown inside "with" and "catch" scopes.
3521 Also did some cleanup of the unwinding code along the way.
3523 Scope chain reference counting is still wrong in a few ways. I thought
3524 I would fix this portion of it first.
3526 run-sunspider shows no change.
3529 (KJS::Machine::unwindCallFrame):
3530 (KJS::Machine::throwException):
3531 (KJS::Machine::privateExecute):
3534 2008-04-17 Oliver Hunt <oliver@apple.com>
3538 Add more exception checking to toNumber conversions
3540 This corrects op_pre_dec, op_negate, op_mod and op_sub.
3543 (KJS::Machine::privateExecute):
3545 2008-04-17 Geoffrey Garen <ggaren@apple.com> and Cameron Zwarich <cwzwarich@uwaterloo.ca>
3547 Reviewed by Oliver Hunt.
3551 Introduced a new opcode: op_call_eval. In the normal case, it performs
3552 an eval. In the case where eval has been overridden in some way, it
3553 performs a function call.
3555 * VM/CodeGenerator.h: Added a feature so the code generator knows not
3556 to optimized locals in eval code.
3558 2008-04-17 Geoffrey Garen <ggaren@apple.com>