1 2008-10-07 Maciej Stachowiak <mjs@apple.com>
3 Reviewed by Oliver Hunt.
5 - make constant folding code more consistent
7 Added a makeSubNode to match add, mult and div; use the makeFooNode functions always,
8 instead of allocating nodes directly in other places in the grammar.
12 2008-10-07 Sam Weinig <sam@webkit.org>
14 Reviewed by Cameron Zwarich.
16 Move hasGetterSetterProperties flag from PropertyMap to StructureID.
20 (JSC::JSObject::defineGetter):
21 (JSC::JSObject::defineSetter):
23 (JSC::JSObject::hasGetterSetterProperties):
24 (JSC::JSObject::getOwnPropertySlotForWrite):
25 (JSC::JSObject::getOwnPropertySlot):
27 * kjs/StructureID.cpp:
28 (JSC::StructureID::StructureID):
29 (JSC::StructureID::addPropertyTransition):
30 (JSC::StructureID::toDictionaryTransition):
31 (JSC::StructureID::changePrototypeTransition):
32 (JSC::StructureID::getterSetterTransition):
34 (JSC::StructureID::hasGetterSetterProperties):
35 (JSC::StructureID::setHasGetterSetterProperties):
37 2008-10-07 Sam Weinig <sam@webkit.org>
39 Reviewed by Cameron Zwarich.
41 Roll r37370 back in with bug fixes.
43 - PropertyMap::storageSize() should reflect the number of keys + deletedOffsets
44 and has nothing to do with the internal deletedSentinel count anymore.
46 2008-10-07 Gavin Barraclough <barraclough@apple.com>
48 Reviewed by Oliver Hunt.
50 Move callframe initialization into JIT code, again.
52 As a part of the restructuring the second result from functions is now
53 returned in edx, allowing the new value of 'r' to be returned via a
54 register, and stored to the stack from JIT code, too.
56 4.5% progression on v8-tests. (3% in their harness)
61 (JSC::CTI::compileOpCall):
62 (JSC::CTI::privateCompileMainPass):
63 (JSC::CTI::privateCompileSlowCases):
64 (JSC::CTI::privateCompile):
66 (JSC::CallRecord::CallRecord):
68 (JSC::Machine::cti_op_call_JSFunction):
69 (JSC::Machine::cti_op_construct_JSConstruct):
70 (JSC::Machine::cti_op_resolve_func):
71 (JSC::Machine::cti_op_post_inc):
72 (JSC::Machine::cti_op_resolve_with_base):
73 (JSC::Machine::cti_op_post_dec):
78 2008-10-07 Mark Rowe <mrowe@apple.com>
80 Fix typo in method name.
85 2008-10-07 Cameron Zwarich <zwarich@apple.com>
87 Rubber-stamped by Mark Rowe.
91 2008-10-06 Sam Weinig <sam@webkit.org>
93 Reviewed by Cameron Zwarich.
95 Fix for https://bugs.webkit.org/show_bug.cgi?id=21415
96 Improve the division between PropertyStorageArray and PropertyMap
98 - Rework ProperyMap to store offsets in the value so that they don't
99 change when rehashing. This allows us not to have to keep the
100 PropertyStorageArray in sync and thus not have to pass it in.
101 - Rename PropertyMap::getOffset -> PropertyMap::get since put/remove
102 now also return offsets.
103 - A Vector of deleted offsets is now needed since the storage is out of
106 1% win on SunSpider. Wash on V8 suite.
108 * JavaScriptCore.exp:
110 (JSC::transitionWillNeedStorageRealloc):
112 (JSC::Machine::privateExecute):
113 Transition logic can be greatly simplified by the fact that
114 the storage capacity is always known, and is correct for the
117 (JSC::JSObject::put): Rename getOffset -> get.
118 (JSC::JSObject::deleteProperty): Ditto.
119 (JSC::JSObject::getPropertyAttributes): Ditto.
120 (JSC::JSObject::removeDirect): Use returned offset to
121 clear the value in the PropertyNameArray.
122 (JSC::JSObject::allocatePropertyStorage): Add assert.
124 (JSC::JSObject::getDirect): Rename getOffset -> get
125 (JSC::JSObject::getDirectLocation): Rename getOffset -> get
126 (JSC::JSObject::putDirect): Use propertyStorageCapacity to determine whether
127 or not to resize. Also, since put now returns an offset (and thus
128 addPropertyTransition does also) setting of the PropertyStorageArray is
130 (JSC::JSObject::transitionTo):
131 * kjs/PropertyMap.cpp:
132 (JSC::PropertyMap::checkConsistency): PropertyStorageArray is no longer
134 (JSC::PropertyMap::operator=): Copy the delete offsets vector.
135 (JSC::PropertyMap::put): Instead of setting the PropertyNameArray
136 explicitly, return the offset where the value should go.
137 (JSC::PropertyMap::remove): Instead of removing from the PropertyNameArray
138 explicitly, return the offset where the value should be removed.
139 (JSC::PropertyMap::get): Switch to using the stored offset, instead
141 (JSC::PropertyMap::insert):
142 (JSC::PropertyMap::expand): This is never called when m_table is null,
143 so remove that branch and add it as an assertion.
144 (JSC::PropertyMap::createTable): Consistency checks no longer take
146 (JSC::PropertyMap::rehash): No need to rehash the PropertyNameArray
147 now that it is completely out of band.
149 (JSC::PropertyMapEntry::PropertyMapEntry): Store offset into PropertyNameArray.
150 (JSC::PropertyMap::get): Switch to using the stored offset, instead
152 * kjs/StructureID.cpp:
153 (JSC::StructureID::StructureID): Initialize the propertyStorageCapacity to
154 JSObject::inlineStorageCapacity.
155 (JSC::StructureID::growPropertyStorageCapacity): Grow the storage capacity as
157 (JSC::StructureID::addPropertyTransition): Copy the storage capacity.
158 (JSC::StructureID::toDictionaryTransition): Ditto.
159 (JSC::StructureID::changePrototypeTransition): Ditto.
160 (JSC::StructureID::getterSetterTransition): Ditto.
162 (JSC::StructureID::propertyStorageCapacity): Add propertyStorageCapacity
163 which is the current capacity for the JSObjects PropertyStorageArray.
164 It starts at the JSObject::inlineStorageCapacity (currently 2), then
165 when it first needs to be resized moves to the JSObject::nonInlineBaseStorageCapacity
166 (currently 16), and after that doubles each time.
168 2008-10-06 Cameron Zwarich <zwarich@apple.com>
170 Reviewed by Oliver Hunt.
172 Bug 21396: Remove the OptionalCalleeActivation call frame slot
173 <https://bugs.webkit.org/show_bug.cgi?id=21396>
175 Remove the OptionalCalleeActivation call frame slot. We have to be
176 careful to store the activation object in a register, because objects
177 in the scope chain do not get marked.
179 This is a 0.3% speedup on both SunSpider and the V8 benchmark.
182 (JSC::CTI::privateCompileMainPass):
184 (JSC::CodeBlock::dump):
185 * VM/CodeGenerator.cpp:
186 (JSC::CodeGenerator::CodeGenerator):
187 (JSC::CodeGenerator::emitReturn):
188 * VM/CodeGenerator.h:
190 (JSC::Machine::dumpRegisters):
191 (JSC::Machine::unwindCallFrame):
192 (JSC::Machine::privateExecute):
193 (JSC::Machine::cti_op_call_JSFunction):
194 (JSC::Machine::cti_op_push_activation):
195 (JSC::Machine::cti_op_tear_off_activation):
196 (JSC::Machine::cti_op_construct_JSConstruct):
198 (JSC::Machine::initializeCallFrame):
200 (JSC::RegisterFile::):
202 2008-10-06 Tony Chang <tony@chromium.org>
204 Reviewed by Alexey Proskuryakov.
206 Chromium doesn't use pthreads on windows, so make its use conditional.
208 Also convert a WORD to a DWORD to avoid a compiler warning. This
209 matches the other methods around it.
211 * wtf/ThreadingWin.cpp:
212 (WTF::wtfThreadEntryPoint):
213 (WTF::ThreadCondition::broadcast):
215 2008-10-06 Mark Mentovai <mark@moxienet.com>
217 Reviewed by Tim Hatcher.
219 Allow ENABLE_DASHBOARD_SUPPORT and ENABLE_MAC_JAVA_BRIDGE to be
222 https://bugs.webkit.org/show_bug.cgi?id=21333
226 2008-10-06 Steve Falkenburg <sfalken@apple.com>
228 https://bugs.webkit.org/show_bug.cgi?id=21416
229 Pass 0 for size to VirtualAlloc, as documented by MSDN.
230 Identified by Application Verifier.
232 Reviewed by Darin Adler.
237 2008-10-06 Kevin McCullough <kmccullough@apple.com>
239 Reviewed by Tim Hatcheri and Oliver Hunt.
241 https://bugs.webkit.org/show_bug.cgi?id=21412
242 Bug 21412: Refactor user initiated profile count to be more stable
243 - Export UString::from for use with creating the profile title.
245 * JavaScriptCore.exp:
247 2008-10-06 Maciej Stachowiak <mjs@apple.com>
249 Not reviewed. Build fix.
251 - revert toBoolean changes (r37333 and r37335); need to make WebCore work with these
253 * API/JSValueRef.cpp:
256 * JavaScriptCore.exp:
258 (JSC::CodeBlock::dump):
260 (JSC::Machine::privateExecute):
261 (JSC::Machine::cti_op_loop_if_true):
262 (JSC::Machine::cti_op_not):
263 (JSC::Machine::cti_op_jtrue):
264 * kjs/ArrayPrototype.cpp:
265 (JSC::arrayProtoFuncFilter):
266 (JSC::arrayProtoFuncEvery):
267 (JSC::arrayProtoFuncSome):
268 * kjs/BooleanConstructor.cpp:
269 (JSC::constructBoolean):
270 (JSC::callBooleanConstructor):
271 * kjs/GetterSetter.h:
273 (JSC::JSValue::toBoolean):
274 * kjs/JSNumberCell.cpp:
275 (JSC::JSNumberCell::toBoolean):
276 * kjs/JSNumberCell.h:
278 (JSC::JSObject::toBoolean):
281 (JSC::JSString::toBoolean):
284 * kjs/RegExpConstructor.cpp:
285 (JSC::setRegExpConstructorMultiline):
286 * kjs/RegExpObject.cpp:
287 (JSC::RegExpObject::match):
288 * kjs/RegExpPrototype.cpp:
289 (JSC::regExpProtoFuncToString):
291 2008-10-06 Maciej Stachowiak <mjs@apple.com>
293 Reviewed by Sam Weinig.
295 - optimize op_jtrue, op_loop_if_true and op_not in various ways
296 https://bugs.webkit.org/show_bug.cgi?id=21404
298 1) Make JSValue::toBoolean nonvirtual and completely inline by
299 making use of the StructureID type field.
301 2) Make JSValue::toBoolean not take an ExecState; doesn't need it.
303 3) Make op_not, op_loop_if_true and op_jtrue not read the
304 ExecState (toBoolean doesn't need it any more) and not check
305 exceptions (toBoolean can't throw).
307 * API/JSValueRef.cpp:
309 * JavaScriptCore.exp:
311 (JSC::CodeBlock::dump):
313 (JSC::Machine::privateExecute):
314 (JSC::Machine::cti_op_loop_if_true):
315 (JSC::Machine::cti_op_not):
316 (JSC::Machine::cti_op_jtrue):
317 * kjs/ArrayPrototype.cpp:
318 (JSC::arrayProtoFuncFilter):
319 (JSC::arrayProtoFuncEvery):
320 (JSC::arrayProtoFuncSome):
321 * kjs/BooleanConstructor.cpp:
322 (JSC::constructBoolean):
323 (JSC::callBooleanConstructor):
324 * kjs/GetterSetter.h:
326 (JSC::JSValue::toBoolean):
327 * kjs/JSNumberCell.cpp:
328 * kjs/JSNumberCell.h:
329 (JSC::JSNumberCell::toBoolean):
332 (JSC::JSObject::toBoolean):
333 (JSC::JSCell::toBoolean):
336 (JSC::JSString::toBoolean):
338 * kjs/RegExpConstructor.cpp:
339 (JSC::setRegExpConstructorMultiline):
340 * kjs/RegExpObject.cpp:
341 (JSC::RegExpObject::match):
342 * kjs/RegExpPrototype.cpp:
343 (JSC::regExpProtoFuncToString):
345 2008-10-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
351 * JavaScriptCore.pri:
353 (JSC::highResUpTime):
355 2008-10-05 Cameron Zwarich <zwarich@apple.com>
357 Reviewed by Oliver Hunt.
359 Remove ScopeNode::containsClosures() now that it is unused.
362 (JSC::ScopeNode::containsClosures):
364 2008-10-05 Maciej Stachowiak <mjs@apple.com>
366 Reviewed by Cameron Zwarich.
368 - fix releas-only test failures caused by the fix to bug 21375
371 (JSC::Machine::unwindCallFrame): Update ExecState while unwinding call frames;
372 it now matters more to have a still-valid ExecState, since dynamicGlobalObject
373 will make use of the ExecState's scope chain.
376 2008-10-05 Cameron Zwarich <zwarich@apple.com>
378 Reviewed by Oliver Hunt.
380 Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
381 <https://bugs.webkit.org/show_bug.cgi?id=21364>
383 Use information from the parser to detect whether an activation is
384 needed or 'arguments' is used, and emit explicit instructions to tear
385 them off before op_ret. This allows a branch to be removed from op_ret
386 and simplifies some other code. This does cause a small change in the
387 behaviour of 'f.arguments'; it is no longer live when 'arguments' is not
388 mentioned in the lexical scope of the function.
390 It should now be easy to remove the OptionaCalleeActivation slot in the
391 call frame, but this will be done in a later patch.
394 (JSC::CTI::privateCompileMainPass):
396 (JSC::CodeBlock::dump):
397 * VM/CodeGenerator.cpp:
398 (JSC::CodeGenerator::emitReturn):
399 * VM/CodeGenerator.h:
401 (JSC::Machine::unwindCallFrame):
402 (JSC::Machine::privateExecute):
403 (JSC::Machine::retrieveArguments):
404 (JSC::Machine::cti_op_create_arguments):
405 (JSC::Machine::cti_op_tear_off_activation):
406 (JSC::Machine::cti_op_tear_off_arguments):
410 (JSC::Arguments::mark):
412 (JSC::Arguments::isTornOff):
413 (JSC::Arguments::Arguments):
414 (JSC::Arguments::copyRegisters):
415 (JSC::JSActivation::copyRegisters):
416 * kjs/JSActivation.cpp:
417 (JSC::JSActivation::argumentsGetter):
418 * kjs/JSActivation.h:
420 2008-10-05 Maciej Stachowiak <mjs@apple.com>
422 Reviewed by Oliver Hunt.
424 - fixed "REGRESSION (r37297): fast/js/deep-recursion-test takes too long and times out"
425 https://bugs.webkit.org/show_bug.cgi?id=21375
427 The problem is that dynamicGlobalObject had become O(N) in number
428 of call frames, but unwinding the stack for an exception called it
429 for every call frame, resulting in O(N^2) behavior for an
430 exception thrown from inside deep recursion.
432 Instead of doing it that way, stash the dynamic global object in JSGlobalData.
434 * JavaScriptCore.exp:
436 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Helper class to temporarily
437 store and later restore a dynamicGlobalObject in JSGlobalData.
438 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
439 (JSC::Machine::execute): In each version, establish a DynamicGlobalObjectScope.
440 For ProgramNode, always establish set new dynamicGlobalObject, for FunctionBody and Eval,
441 only if none is currently set.
444 * kjs/JSGlobalData.cpp:
445 (JSC::JSGlobalData::JSGlobalData): Ininitalize new dynamicGlobalObject field to 0.
446 * kjs/JSGlobalData.h:
447 * kjs/JSGlobalObject.h:
448 (JSC::ExecState::dynamicGlobalObject): Moved here from ExecState for benefit of inlining.
449 Return lexical global object if this is a globalExec(), otherwise look in JSGlobalData
450 for the one stashed there.
452 2008-10-05 Sam Weinig <sam@webkit.org>
454 Reviewed by Maciej Stachowiak.
456 Avoid an extra lookup when transitioning to an existing StructureID
457 by caching the offset of property that caused the transition.
459 1% win on V8 suite. Wash on SunSpider.
461 * kjs/PropertyMap.cpp:
462 (JSC::PropertyMap::put):
464 * kjs/StructureID.cpp:
465 (JSC::StructureID::StructureID):
466 (JSC::StructureID::addPropertyTransition):
468 (JSC::StructureID::setCachedTransistionOffset):
469 (JSC::StructureID::cachedTransistionOffset):
471 2008-10-05 Cameron Zwarich <zwarich@apple.com>
473 Reviewed by Maciej Stachowiak.
475 Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
476 <https://bugs.webkit.org/show_bug.cgi?id=21364>
478 This patch does not yet remove the branch, but it does a bit of refactoring
479 so that a CodeGenerator now knows whether the associated CodeBlock will need
480 a full scope before doing any code generation. This makes it possible to emit
481 explicit tear-off instructions before every op_ret.
484 (JSC::CodeBlock::CodeBlock):
485 * VM/CodeGenerator.cpp:
486 (JSC::CodeGenerator::generate):
487 (JSC::CodeGenerator::CodeGenerator):
488 (JSC::CodeGenerator::emitPushScope):
489 (JSC::CodeGenerator::emitPushNewScope):
491 (JSC::ScopeNode::needsActivation):
493 2008-10-05 Gavin Barraclough <barraclough@apple.com>
495 Reviewed by Cameron Zwarich.
497 Fix for bug #21387 - using SamplingTool with CTI.
499 (1) A repatch offset offset changes due to an additional instruction to update SamplingTool state.
500 (2) Fix an incusion order problem due to ExecState changes.
501 (3) Change to a MACHINE_SAMPLING macro, use of exec should now be accessing global data.
506 (JSC::SamplingTool::privateExecuteReturned):
509 2008-10-04 Mark Rowe <mrowe@apple.com>
511 Reviewed by Tim Hatcher.
513 Add a 'Check For Weak VTables' build phase to catch weak vtables as early as possible.
515 * JavaScriptCore.xcodeproj/project.pbxproj:
517 2008-10-04 Sam Weinig <sam@webkit.org>
519 Reviewed by Oliver Hunt.
521 Fix https://bugs.webkit.org/show_bug.cgi?id=21320
522 leaks of PropertyNameArrayData seen on buildbot
524 - Fix RefPtr cycle by making PropertyNameArrayData's pointer back
525 to the StructureID a weak pointer.
527 * kjs/PropertyNameArray.h:
528 (JSC::PropertyNameArrayData::setCachedStructureID):
529 (JSC::PropertyNameArrayData::cachedStructureID):
530 * kjs/StructureID.cpp:
531 (JSC::StructureID::getEnumerablePropertyNames):
532 (JSC::StructureID::clearEnumerationCache):
533 (JSC::StructureID::~StructureID):
535 2008-10-04 Darin Adler <darin@apple.com>
537 Reviewed by Cameron Zwarich.
539 - https://bugs.webkit.org/show_bug.cgi?id=21295
540 Bug 21295: Replace ExecState with a call frame Register pointer
542 10% faster on Richards; other v8 benchmarks faster too.
545 This does the minimum necessary to get the speedup. Next step in
546 cleaning this up is to replace ExecState with a CallFrame class,
547 and be more judicious about when to pass a call frame and when
548 to pass a global data pointer, global object pointer, or perhaps
549 something else entirely.
551 * VM/CTI.cpp: Remove the debug-only check of the exception in
552 ctiVMThrowTrampoline -- already checked in the code the trampoline
553 jumps to, so not all that useful. Removed the exec argument from
554 ctiTrampoline. Removed emitDebugExceptionCheck -- no longer needed.
555 (JSC::CTI::emitCall): Removed code to set ExecState::m_callFrame.
556 (JSC::CTI::privateCompileMainPass): Removed code in catch to extract
557 the exception from ExecState::m_exception; instead, the code that
558 jumps into catch will make sure the exception is already in eax.
559 * VM/CTI.h: Removed exec from the ctiTrampoline. Also removed the
560 non-helpful "volatile". Temporarily left ARG_exec in as a synonym
561 for ARG_r; I'll change that on a future cleanup pass when introducing
562 more use of the CallFrame type.
563 (JSC::CTI::execute): Removed the ExecState* argument.
565 * VM/ExceptionHelpers.cpp:
566 (JSC::InterruptedExecutionError::InterruptedExecutionError): Take
567 JSGlobalData* instead of ExecState*.
568 (JSC::createInterruptedExecutionException): Ditto.
569 * VM/ExceptionHelpers.h: Ditto. Also removed an unneeded include.
572 (JSC::slideRegisterWindowForCall): Removed the exec and
573 exceptionValue arguments. Changed to return 0 when there's a stack
574 overflow rather than using a separate exception argument to cut
575 down on memory accesses in the calling convention.
576 (JSC::Machine::unwindCallFrame): Removed the exec argument when
577 constructing a DebuggerCallFrame. Also removed code to set
578 ExecState::m_callFrame.
579 (JSC::Machine::throwException): Removed the exec argument when
580 construction a DebuggerCallFrame.
581 (JSC::Machine::execute): Updated to use the register instead of
582 ExecState and also removed various uses of ExecState.
583 (JSC::Machine::debug):
584 (JSC::Machine::privateExecute): Put globalData into a local
585 variable so it can be used throughout the interpreter. Changed
586 the VM_CHECK_EXCEPTION to get the exception in globalData instead
587 of through ExecState.
588 (JSC::Machine::retrieveLastCaller): Turn exec into a registers
589 pointer by calling registers() instead of by getting m_callFrame.
590 (JSC::Machine::callFrame): Ditto.
591 Tweaked exception macros. Made new versions for when you know
592 you have an exception. Get at global exception with ARG_globalData.
593 Got rid of the need to pass in the return value type.
594 (JSC::Machine::cti_op_add): Update to use new version of exception
596 (JSC::Machine::cti_op_pre_inc): Ditto.
597 (JSC::Machine::cti_timeout_check): Ditto.
598 (JSC::Machine::cti_op_instanceof): Ditto.
599 (JSC::Machine::cti_op_new_func): Ditto.
600 (JSC::Machine::cti_op_call_JSFunction): Optimized by using the
601 ARG values directly instead of through local variables -- this gets
602 rid of code that just shuffles things around in the stack frame.
603 Also get rid of ExecState and update for the new way exceptions are
604 handled in slideRegisterWindowForCall.
605 (JSC::Machine::cti_vm_compile): Update to make exec out of r since
606 they are both the same thing now.
607 (JSC::Machine::cti_op_call_NotJSFunction): Ditto.
608 (JSC::Machine::cti_op_init_arguments): Ditto.
609 (JSC::Machine::cti_op_resolve): Ditto.
610 (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
611 (JSC::Machine::cti_op_construct_NotJSConstruct): Ditto.
612 (JSC::Machine::cti_op_resolve_func): Ditto.
613 (JSC::Machine::cti_op_put_by_val): Ditto.
614 (JSC::Machine::cti_op_put_by_val_array): Ditto.
615 (JSC::Machine::cti_op_resolve_skip): Ditto.
616 (JSC::Machine::cti_op_resolve_global): Ditto.
617 (JSC::Machine::cti_op_post_inc): Ditto.
618 (JSC::Machine::cti_op_resolve_with_base): Ditto.
619 (JSC::Machine::cti_op_post_dec): Ditto.
620 (JSC::Machine::cti_op_call_eval): Ditto.
621 (JSC::Machine::cti_op_throw): Ditto. Also rearranged to return
622 the exception value as the return value so it can be used by
624 (JSC::Machine::cti_op_push_scope): Ditto.
625 (JSC::Machine::cti_op_in): Ditto.
626 (JSC::Machine::cti_op_del_by_val): Ditto.
627 (JSC::Machine::cti_vm_throw): Ditto. Also rearranged to return
628 the exception value as the return value so it can be used by
631 * kjs/DebuggerCallFrame.cpp:
632 (JSC::DebuggerCallFrame::functionName): Pass globalData.
633 (JSC::DebuggerCallFrame::evaluate): Eliminated code to make a
635 * kjs/DebuggerCallFrame.h: Removed ExecState argument from
638 * kjs/ExecState.h: Eliminated all data members and made ExecState
639 inherit privately from Register instead. Also added a typedef to
640 the future name for this class, which is CallFrame. It's just a
641 Register* that knows it's a pointer at a call frame. The new class
642 can't be constructed or copied. Changed all functions to use
643 the this pointer instead of m_callFrame. Changed exception-related
644 functions to access an exception in JSGlobalData. Removed functions
645 used by CTI to pass the return address to the throw machinery --
646 this is now done directly with a global in the global data.
648 * kjs/FunctionPrototype.cpp:
649 (JSC::functionProtoFuncToString): Pass globalData instead of exec.
651 * kjs/InternalFunction.cpp:
652 (JSC::InternalFunction::name): Take globalData instead of exec.
653 * kjs/InternalFunction.h: Ditto.
655 * kjs/JSGlobalData.cpp: Initialize the new exception global to 0.
656 * kjs/JSGlobalData.h: Declare two new globals. One for the current
657 exception and another for the return address used by CTI to
658 implement the throw operation.
660 * kjs/JSGlobalObject.cpp:
661 (JSC::JSGlobalObject::init): Removed code to set up globalExec,
662 which is now the same thing as globalCallFrame.
663 (JSC::JSGlobalObject::reset): Get globalExec from our globalExec
664 function so we don't have to repeat the logic twice.
665 (JSC::JSGlobalObject::mark): Removed code to mark the exception;
666 the exception is now stored in JSGlobalData and marked there.
667 (JSC::JSGlobalObject::globalExec): Return a pointer to the end
668 of the global call frame.
669 * kjs/JSGlobalObject.h: Removed the globalExec data member.
672 (JSC::JSObject::putDirectFunction): Pass globalData instead of exec.
675 (JSC::Heap::collect): Mark the global exception.
677 * profiler/ProfileGenerator.cpp:
678 (JSC::ProfileGenerator::addParentForConsoleStart): Pass globalData
679 instead of exec to createCallIdentifier.
681 * profiler/Profiler.cpp:
682 (JSC::Profiler::willExecute): Pass globalData instead of exec to
683 createCallIdentifier.
684 (JSC::Profiler::didExecute): Ditto.
685 (JSC::Profiler::createCallIdentifier): Take globalData instead of
687 (JSC::createCallIdentifierFromFunctionImp): Ditto.
688 * profiler/Profiler.h: Change interface to take a JSGlobalData
689 instead of an ExecState.
691 2008-10-04 Cameron Zwarich <zwarich@apple.com>
693 Reviewed by Darin Adler.
695 Bug 21369: Add opcode documentation for all undocumented opcodes
696 <https://bugs.webkit.org/show_bug.cgi?id=21369>
698 This patch adds opcode documentation for all undocumented opcodes, and
699 it also renames op_init_arguments to op_create_arguments.
702 (JSC::CTI::privateCompileMainPass):
704 (JSC::CodeBlock::dump):
705 * VM/CodeGenerator.cpp:
706 (JSC::CodeGenerator::CodeGenerator):
708 (JSC::Machine::privateExecute):
709 (JSC::Machine::cti_op_create_arguments):
713 2008-10-03 Maciej Stachowiak <mjs@apple.com>
715 Reviewed by Cameron Zwarich.
717 - "this" object in methods called on primitives should be wrapper object
718 https://bugs.webkit.org/show_bug.cgi?id=21362
720 I changed things so that functions which use "this" do a fast
721 version of toThisObject conversion if needed. Currently we miss
722 the conversion entirely, at least for primitive types. Using
723 TypeInfo and the primitive check, I made the fast case bail out
726 This is inexplicably an 1.007x SunSpider speedup (and a wash on V8 benchmarks).
728 Also renamed some opcodes for clarity:
731 init_activation ==> enter_with_activation
734 (JSC::CTI::privateCompileMainPass):
735 (JSC::CTI::privateCompileSlowCases):
737 (JSC::CodeBlock::dump):
738 * VM/CodeGenerator.cpp:
739 (JSC::CodeGenerator::generate):
740 (JSC::CodeGenerator::CodeGenerator):
742 (JSC::Machine::privateExecute):
743 (JSC::Machine::cti_op_convert_this):
746 * kjs/JSActivation.cpp:
747 (JSC::JSActivation::JSActivation):
748 * kjs/JSActivation.h:
749 (JSC::JSActivation::createStructureID):
751 (JSC::JSValue::needsThisConversion):
752 * kjs/JSGlobalData.cpp:
753 (JSC::JSGlobalData::JSGlobalData):
754 * kjs/JSGlobalData.h:
755 * kjs/JSNumberCell.h:
756 (JSC::JSNumberCell::createStructureID):
757 * kjs/JSStaticScopeObject.h:
758 (JSC::JSStaticScopeObject::JSStaticScopeObject):
759 (JSC::JSStaticScopeObject::createStructureID):
761 (JSC::JSString::createStructureID):
764 (JSC::TypeInfo::needsThisConversion):
766 (JSC::ScopeNode::usesThis):
768 2008-10-03 Cameron Zwarich <zwarich@apple.com>
770 Reviewed by Maciej Stachowiak.
772 Bug 21356: The size of the RegisterFile differs depending on 32-bit / 64-bit and Debug / Release
773 <https://bugs.webkit.org/show_bug.cgi?id=21356>
775 The RegisterFile decreases in size (measured in terms of numbers of
776 Registers) as the size of a Register increases. This causes
778 js1_5/Regress/regress-159334.js
780 to fail in 64-bit debug builds. This fix makes the RegisterFile on all
781 platforms the same size that it is in 32-bit Release builds.
784 (JSC::RegisterFile::RegisterFile):
786 2008-10-03 Maciej Stachowiak <mjs@apple.com>
788 Reviewed by Cameron Zwarich.
790 - Some code cleanup to how we handle code features.
792 1) Rename FeatureInfo typedef to CodeFeatures.
793 2) Rename NodeFeatureInfo template to NodeInfo.
794 3) Keep CodeFeature bitmask in ScopeNode instead of trying to break it out into individual bools.
795 4) Rename misleadingly named "needsClosure" method to "containsClosures", which better describes the meaning
797 5) Make setUsersArguments() not take an argument since it only goes one way.
799 * JavaScriptCore.exp:
801 (JSC::CodeBlock::CodeBlock):
804 (JSC::Parser::didFinishParsing):
806 (JSC::Parser::parse):
809 (JSC::ScopeNode::ScopeNode):
810 (JSC::ProgramNode::ProgramNode):
811 (JSC::ProgramNode::create):
812 (JSC::EvalNode::EvalNode):
813 (JSC::EvalNode::create):
814 (JSC::FunctionBodyNode::FunctionBodyNode):
815 (JSC::FunctionBodyNode::create):
817 (JSC::ScopeNode::usesEval):
818 (JSC::ScopeNode::containsClosures):
819 (JSC::ScopeNode::usesArguments):
820 (JSC::ScopeNode::setUsesArguments):
822 2008-10-03 Cameron Zwarich <zwarich@apple.com>
824 Reviewed by Maciej Stachowiak.
826 Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
827 <https://bugs.webkit.org/show_bug.cgi?id=21343>
829 A fix was landed for this issue in r37253, and the ChangeLog assumes
830 that it is a compiler bug, but it turns out that it is a subtle issue
831 with mixing signed and unsigned 32-bit values in a 64-bit environment.
832 In order to properly fix this bug, we should convert our signed offsets
833 into the register file to use ptrdiff_t.
835 This may not be the only instance of this issue, but I will land this
836 fix first and look for more later.
839 (JSC::Machine::getArgumentsData):
842 (JSC::Arguments::getOwnPropertySlot):
844 (JSC::Arguments::init):
846 2008-10-03 Darin Adler <darin@apple.com>
848 * VM/CTI.cpp: Another Windows build fix. Change the args of ctiTrampoline.
850 * kjs/JSNumberCell.h: A build fix for newer versions of gcc. Added
851 declarations of JSGlobalData overloads of jsNumberCell.
853 2008-10-03 Darin Adler <darin@apple.com>
855 - try to fix Windows build
857 * kjs/ScopeChain.h: Add forward declaration of JSGlobalData.
859 2008-10-03 Darin Adler <darin@apple.com>
861 Reviewed by Geoff Garen.
863 - next step of https://bugs.webkit.org/show_bug.cgi?id=21295
864 Turn ExecState into a call frame pointer.
866 Remove m_globalObject and m_globalData from ExecState.
868 SunSpider says this is a wash (slightly faster but not statistically
869 significant); which is good enough since it's a preparation step and
870 not supposed to be a spedup.
872 * API/JSCallbackFunction.cpp:
873 (JSC::JSCallbackFunction::JSCallbackFunction):
874 * kjs/ArrayConstructor.cpp:
875 (JSC::ArrayConstructor::ArrayConstructor):
876 * kjs/BooleanConstructor.cpp:
877 (JSC::BooleanConstructor::BooleanConstructor):
878 * kjs/DateConstructor.cpp:
879 (JSC::DateConstructor::DateConstructor):
880 * kjs/ErrorConstructor.cpp:
881 (JSC::ErrorConstructor::ErrorConstructor):
882 * kjs/FunctionPrototype.cpp:
883 (JSC::FunctionPrototype::FunctionPrototype):
884 * kjs/JSFunction.cpp:
885 (JSC::JSFunction::JSFunction):
886 * kjs/NativeErrorConstructor.cpp:
887 (JSC::NativeErrorConstructor::NativeErrorConstructor):
888 * kjs/NumberConstructor.cpp:
889 (JSC::NumberConstructor::NumberConstructor):
890 * kjs/ObjectConstructor.cpp:
891 (JSC::ObjectConstructor::ObjectConstructor):
892 * kjs/PrototypeFunction.cpp:
893 (JSC::PrototypeFunction::PrototypeFunction):
894 * kjs/RegExpConstructor.cpp:
895 (JSC::RegExpConstructor::RegExpConstructor):
896 * kjs/StringConstructor.cpp:
897 (JSC::StringConstructor::StringConstructor):
898 Pass JSGlobalData* instead of ExecState* to the InternalFunction
901 * API/OpaqueJSString.cpp: Added now-needed include.
903 * JavaScriptCore.exp: Updated.
906 (JSC::CTI::emitSlowScriptCheck): Changed to use ARGS_globalData
907 instead of ARGS_exec.
909 * VM/CTI.h: Added a new argument to the CTI, the global data pointer.
910 While it's possible to get to the global data pointer using the
911 ExecState pointer, it's slow enough that it's better to just keep
912 it around in the CTI arguments.
914 * VM/CodeBlock.h: Moved the CodeType enum here from ExecState.h.
917 (JSC::Machine::execute): Pass fewer arguments when constructing
918 ExecState, and pass the global data pointer when invoking CTI.
919 (JSC::Machine::firstCallFrame): Added. Used to get the dynamic global
920 object, which is in the scope chain of the first call frame.
921 (JSC::Machine::cti_op_add): Use globalData instead of exec when
922 possible, to keep fast cases fast, since it's now more expensive to
923 get to it through the exec pointer.
924 (JSC::Machine::cti_timeout_check): Ditto.
925 (JSC::Machine::cti_op_put_by_id_second): Ditto.
926 (JSC::Machine::cti_op_get_by_id_second): Ditto.
927 (JSC::Machine::cti_op_mul): Ditto.
928 (JSC::Machine::cti_vm_compile): Ditto.
929 (JSC::Machine::cti_op_get_by_val): Ditto.
930 (JSC::Machine::cti_op_sub): Ditto.
931 (JSC::Machine::cti_op_put_by_val): Ditto.
932 (JSC::Machine::cti_op_put_by_val_array): Ditto.
933 (JSC::Machine::cti_op_negate): Ditto.
934 (JSC::Machine::cti_op_div): Ditto.
935 (JSC::Machine::cti_op_pre_dec): Ditto.
936 (JSC::Machine::cti_op_post_inc): Ditto.
937 (JSC::Machine::cti_op_lshift): Ditto.
938 (JSC::Machine::cti_op_bitand): Ditto.
939 (JSC::Machine::cti_op_rshift): Ditto.
940 (JSC::Machine::cti_op_bitnot): Ditto.
941 (JSC::Machine::cti_op_mod): Ditto.
942 (JSC::Machine::cti_op_post_dec): Ditto.
943 (JSC::Machine::cti_op_urshift): Ditto.
944 (JSC::Machine::cti_op_bitxor): Ditto.
945 (JSC::Machine::cti_op_bitor): Ditto.
946 (JSC::Machine::cti_op_call_eval): Ditto.
947 (JSC::Machine::cti_op_throw): Ditto.
948 (JSC::Machine::cti_op_is_string): Ditto.
949 (JSC::Machine::cti_op_debug): Ditto.
950 (JSC::Machine::cti_vm_throw): Ditto.
952 * VM/Machine.h: Added firstCallFrame.
954 * kjs/DebuggerCallFrame.cpp:
955 (JSC::DebuggerCallFrame::evaluate): Pass fewer arguments when
956 constructing ExecState.
958 * kjs/ExecState.cpp: Deleted contents. Later we'll remove the
961 * kjs/ExecState.h: Removed m_globalObject and m_globalData.
962 Moved CodeType into another header.
963 (JSC::ExecState::ExecState): Take only a single argument, a
965 (JSC::ExecState::dynamicGlobalObject): Get the object from
966 the first call frame since it's no longer stored.
967 (JSC::ExecState::globalData): Get the global data from the
968 scope chain, since we no longer store a pointer to it here.
969 (JSC::ExecState::identifierTable): Ditto.
970 (JSC::ExecState::propertyNames): Ditto.
971 (JSC::ExecState::emptyList): Ditto.
972 (JSC::ExecState::lexer): Ditto.
973 (JSC::ExecState::parser): Ditto.
974 (JSC::ExecState::machine): Ditto.
975 (JSC::ExecState::arrayTable): Ditto.
976 (JSC::ExecState::dateTable): Ditto.
977 (JSC::ExecState::mathTable): Ditto.
978 (JSC::ExecState::numberTable): Ditto.
979 (JSC::ExecState::regExpTable): Ditto.
980 (JSC::ExecState::regExpConstructorTable): Ditto.
981 (JSC::ExecState::stringTable): Ditto.
982 (JSC::ExecState::heap): Ditto.
984 * kjs/FunctionConstructor.cpp:
985 (JSC::FunctionConstructor::FunctionConstructor): Pass
986 JSGlobalData* instead of ExecState* to the InternalFunction
988 (JSC::constructFunction): Pass the global data pointer when
989 constructing a new scope chain.
991 * kjs/InternalFunction.cpp:
992 (JSC::InternalFunction::InternalFunction): Take a JSGlobalData*
993 instead of an ExecState*. Later we can change more places to
994 work this way -- it's more efficient to take the type you need
995 since the caller might already have it.
996 * kjs/InternalFunction.h: Ditto.
999 (JSC::JSCell::operator new): Added an overload that takes a
1000 JSGlobalData* so you can construct without an ExecState*.
1002 * kjs/JSGlobalObject.cpp:
1003 (JSC::JSGlobalObject::init): Moved creation of the global scope
1004 chain in here, since it now requires a pointer to the global data.
1005 Moved the initialization of the call frame in here since it requires
1006 the global scope chain node. Removed the extra argument to ExecState
1007 when creating the global ExecState*.
1008 * kjs/JSGlobalObject.h: Removed initialization of globalScopeChain
1009 and the call frame from the JSGlobalObjectData constructor. Added
1010 a thisValue argument to the init function.
1012 * kjs/JSNumberCell.cpp: Added versions of jsNumberCell that take
1013 JSGlobalData* rather than ExecState*.
1014 * kjs/JSNumberCell.h:
1015 (JSC::JSNumberCell::operator new): Added a version that takes
1017 (JSC::JSNumberCell::JSNumberCell): Ditto.
1018 (JSC::jsNumber): Ditto.
1020 (JSC::jsString): Ditto.
1021 (JSC::jsSubstring): Ditto.
1022 (JSC::jsOwnedString): Ditto.
1024 (JSC::JSString::JSString): Changed to take JSGlobalData*.
1025 (JSC::jsEmptyString): Added a version that takes JSGlobalData*.
1026 (JSC::jsSingleCharacterString): Ditto.
1027 (JSC::jsSingleCharacterSubstring): Ditto.
1028 (JSC::jsNontrivialString): Ditto.
1029 (JSC::JSString::getIndex): Ditto.
1030 (JSC::jsString): Ditto.
1031 (JSC::jsSubstring): Ditto.
1032 (JSC::jsOwnedString): Ditto.
1034 * kjs/ScopeChain.h: Added a globalData pointer to each node.
1035 (JSC::ScopeChainNode::ScopeChainNode): Initialize the globalData
1037 (JSC::ScopeChainNode::push): Set the global data pointer in the
1039 (JSC::ScopeChain::ScopeChain): Take a globalData argument.
1041 * kjs/SmallStrings.cpp:
1042 (JSC::SmallStrings::createEmptyString): Take JSGlobalData* instead of
1044 (JSC::SmallStrings::createSingleCharacterString): Ditto.
1045 * kjs/SmallStrings.h:
1046 (JSC::SmallStrings::emptyString): Ditto.
1047 (JSC::SmallStrings::singleCharacterString): Ditto.
1049 2008-10-03 Cameron Zwarich <zwarich@apple.com>
1051 Reviewed by Geoff Garen.
1053 Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
1054 <https://bugs.webkit.org/show_bug.cgi?id=21343>
1056 Add a workaround for a bug in GCC, which affects GCC 4.0, GCC 4.2, and
1057 llvm-gcc 4.2. I put it in an #ifdef because it was a slight regression
1058 on SunSpider in 32-bit, although that might be entirely random.
1060 * kjs/Arguments.cpp:
1061 (JSC::Arguments::getOwnPropertySlot):
1063 2008-10-03 Darin Adler <darin@apple.com>
1065 Rubber stamped by Alexey Proskuryakov.
1067 * kjs/Shell.cpp: (main): Don't delete JSGlobalData. Later, we need to change
1068 this tool to use public JavaScriptCore API instead.
1070 2008-10-03 Darin Adler <darin@apple.com>
1072 Suggested by Alexey Proskuryakov.
1074 * kjs/JSGlobalData.cpp:
1075 (JSC::JSGlobalData::~JSGlobalData): Remove call to heap.destroy() because
1076 it's too late to ref the JSGlobalData object once it's already being
1077 destroyed. In practice this is not a problem because WebCore's JSGlobalData
1078 is never destroyed and JSGlobalContextRelease takes care of calling
1079 heap.destroy() in advance.
1081 2008-10-02 Oliver Hunt <oliver@apple.com>
1083 Reviewed by Maciej Stachowiak.
1085 Replace SSE3 check with an SSE2 check, and implement SSE2 check on windows.
1087 5.6% win on SunSpider on windows.
1090 (JSC::isSSE2Present):
1091 (JSC::CTI::compileBinaryArithOp):
1092 (JSC::CTI::compileBinaryArithOpSlowCase):
1094 2008-10-03 Maciej Stachowiak <mjs@apple.com>
1096 Rubber stamped by Cameron Zwarich.
1098 - fix mistaken change of | to || which caused a big perf regression on EarleyBoyer
1102 2008-10-02 Darin Adler <darin@apple.com>
1104 Reviewed by Geoff Garen.
1106 - https://bugs.webkit.org/show_bug.cgi?id=21321
1107 Bug 21321: speed up JavaScriptCore by inlining Heap in JSGlobalData
1109 1.019x as fast on SunSpider.
1112 (JSEvaluateScript): Use heap. instead of heap-> to work with the heap.
1113 (JSCheckScriptSyntax): Ditto.
1114 (JSGarbageCollect): Ditto.
1115 (JSReportExtraMemoryCost): Ditto.
1116 * API/JSContextRef.cpp:
1117 (JSGlobalContextRetain): Ditto.
1118 (JSGlobalContextRelease): Destroy the heap with the destroy function instead
1119 of the delete operator.
1120 (JSContextGetGlobalObject): Use heap. instead of heap-> to work with the heap.
1121 * API/JSObjectRef.cpp:
1122 (JSObjectMake): Use heap. instead of heap-> to work with the heap.
1123 (JSObjectMakeFunctionWithCallback): Ditto.
1124 (JSObjectMakeConstructor): Ditto.
1125 (JSObjectMakeFunction): Ditto.
1126 (JSObjectMakeArray): Ditto.
1127 (JSObjectMakeDate): Ditto.
1128 (JSObjectMakeError): Ditto.
1129 (JSObjectMakeRegExp): Ditto.
1130 (JSObjectHasProperty): Ditto.
1131 (JSObjectGetProperty): Ditto.
1132 (JSObjectSetProperty): Ditto.
1133 (JSObjectGetPropertyAtIndex): Ditto.
1134 (JSObjectSetPropertyAtIndex): Ditto.
1135 (JSObjectDeleteProperty): Ditto.
1136 (JSObjectCallAsFunction): Ditto.
1137 (JSObjectCallAsConstructor): Ditto.
1138 (JSObjectCopyPropertyNames): Ditto.
1139 (JSPropertyNameAccumulatorAddName): Ditto.
1140 * API/JSValueRef.cpp:
1141 (JSValueIsEqual): Ditto.
1142 (JSValueIsInstanceOfConstructor): Ditto.
1143 (JSValueMakeNumber): Ditto.
1144 (JSValueMakeString): Ditto.
1145 (JSValueToNumber): Ditto.
1146 (JSValueToStringCopy): Ditto.
1147 (JSValueToObject): Ditto.
1148 (JSValueProtect): Ditto.
1149 (JSValueUnprotect): Ditto.
1152 (JSC::ExecState::heap): Update to use the & operator.
1154 * kjs/JSGlobalData.cpp:
1155 (JSC::JSGlobalData::JSGlobalData): Update to initialize a heap member
1156 instead of calling new to make a heap.
1157 (JSC::JSGlobalData::~JSGlobalData): Destroy the heap with the destroy
1158 function instead of the delete operator.
1159 * kjs/JSGlobalData.h: Change from Heap* to a Heap.
1160 * kjs/JSGlobalObject.cpp:
1161 (JSC::JSGlobalObject::mark): Use the & operator here.
1162 (JSC::JSGlobalObject::operator new): Use heap. instead of heap-> to work
1165 2008-10-02 Cameron Zwarich <zwarich@apple.com>
1167 Reviewed by Geoff Garen.
1169 Bug 21317: Replace RegisterFile size and capacity information with Register pointers
1170 <https://bugs.webkit.org/show_bug.cgi?id=21317>
1172 This is a 2.3% speedup on the V8 DeltaBlue benchmark, a 3.3% speedup on
1173 the V8 Raytrace benchmark, and a 1.0% speedup on SunSpider.
1176 (JSC::slideRegisterWindowForCall):
1177 (JSC::Machine::callEval):
1178 (JSC::Machine::execute):
1179 (JSC::Machine::privateExecute):
1180 (JSC::Machine::cti_op_call_JSFunction):
1181 (JSC::Machine::cti_op_construct_JSConstruct):
1182 * VM/RegisterFile.cpp:
1183 (JSC::RegisterFile::~RegisterFile):
1184 * VM/RegisterFile.h:
1185 (JSC::RegisterFile::RegisterFile):
1186 (JSC::RegisterFile::start):
1187 (JSC::RegisterFile::end):
1188 (JSC::RegisterFile::size):
1189 (JSC::RegisterFile::shrink):
1190 (JSC::RegisterFile::grow):
1191 (JSC::RegisterFile::lastGlobal):
1192 (JSC::RegisterFile::markGlobals):
1193 (JSC::RegisterFile::markCallFrames):
1194 * kjs/JSGlobalObject.cpp:
1195 (JSC::JSGlobalObject::copyGlobalsTo):
1197 2008-10-02 Cameron Zwarich <zwarich@apple.com>
1199 Rubber-stamped by Darin Adler.
1201 Change bitwise operations introduced in r37166 to boolean operations. We
1202 only use bitwise operations over boolean operations for increasing
1203 performance in extremely hot code, but that does not apply to anything
1208 2008-10-02 Gavin Barraclough <barraclough@apple.com>
1210 Reviewed by Darin Adler.
1212 Fix for bug #21232 - should reset m_isPendingDash on flush,
1213 and should allow '\-' as beginning or end of a range (though
1214 not to specifiy a range itself).
1217 * wrec/CharacterClassConstructor.cpp:
1218 (JSC::CharacterClassConstructor::put):
1219 (JSC::CharacterClassConstructor::flush):
1220 * wrec/CharacterClassConstructor.h:
1221 (JSC::CharacterClassConstructor::flushBeforeEscapedHyphen):
1223 (JSC::WRECGenerator::generateDisjunction):
1224 (JSC::WRECParser::parseCharacterClass):
1225 (JSC::WRECParser::parseDisjunction):
1228 2008-10-02 Darin Adler <darin@apple.com>
1230 Reviewed by Sam Weinig.
1232 - remove the "static" from declarations in a header file, since we
1233 don't want them to have internal linkage
1235 * VM/Machine.h: Remove the static keyword from the constant and the
1236 three inline functions that Geoff just moved here.
1238 2008-10-02 Geoffrey Garen <ggaren@apple.com>
1240 Reviewed by Sam Weinig.
1242 Fixed https://bugs.webkit.org/show_bug.cgi?id=21283.
1243 Profiler Crashes When Started
1247 (JSC::makeHostCallFramePointer):
1248 (JSC::isHostCallFrame):
1249 (JSC::stripHostCallFrameBit): Moved some things to the header so
1250 JSGlobalObject could use them.
1252 * kjs/JSGlobalObject.h:
1253 (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Call the
1254 new makeHostCallFramePointer API, since 0 no longer indicates a host
1257 2008-10-02 Alexey Proskuryakov <ap@webkit.org>
1259 Reviewed by Darin Adler.
1261 https://bugs.webkit.org/show_bug.cgi?id=21304
1262 Stop using a static wrapper map for WebCore JS bindings
1264 * kjs/JSGlobalData.cpp:
1265 (JSC::JSGlobalData::JSGlobalData):
1266 (JSC::JSGlobalData::~JSGlobalData):
1267 (JSC::JSGlobalData::ClientData::~ClientData):
1268 * kjs/JSGlobalData.h:
1269 Added a client data member to JSGlobalData. WebCore will use it to store bindings-related
1272 * JavaScriptCore.exp: Export virtual ClientData destructor.
1274 2008-10-02 Geoffrey Garen <ggaren@apple.com>
1278 Try to fix Qt build.
1282 2008-10-01 Geoffrey Garen <ggaren@apple.com>
1284 Reviewed by Darin Adler and Cameron Zwarich.
1286 Preliminary step toward dynamic recompilation: Standardized and
1287 simplified the parsing interface.
1289 The main goal in this patch is to make it easy to ask for a duplicate
1290 compilation, and get back a duplicate result -- same source URL, same
1291 debugger / profiler ID, same toString behavior, etc.
1293 The basic unit of compilation and evaluation is now SourceCode, which
1294 encompasses a SourceProvider, a range in that provider, and a starting
1297 A SourceProvider now encompasses a source URL, and *is* a source ID,
1298 since a pointer is a unique identifier.
1302 (JSCheckScriptSyntax): Provide a SourceCode to the Interpreter, since
1303 other APIs are no longer supported.
1306 (JSC::EvalCodeCache::get): Provide a SourceCode to the Interpreter, since
1307 other APIs are no longer supported.
1308 (JSC::CodeBlock::CodeBlock): ASSERT something that used to be ASSERTed
1309 by our caller -- this is a better bottleneck.
1311 * VM/CodeGenerator.cpp:
1312 (JSC::CodeGenerator::CodeGenerator): Updated for the fact that
1313 FunctionBodyNode's parameters are no longer a WTF::Vector.
1315 * kjs/Arguments.cpp:
1316 (JSC::Arguments::Arguments): ditto
1318 * kjs/DebuggerCallFrame.cpp:
1319 (JSC::DebuggerCallFrame::evaluate): Provide a SourceCode to the Parser,
1320 since other APIs are no longer supported.
1322 * kjs/FunctionConstructor.cpp:
1323 (JSC::constructFunction): Provide a SourceCode to the Parser, since
1324 other APIs are no longer supported. Adopt FunctionBodyNode's new
1325 "finishParsing" API.
1327 * kjs/JSFunction.cpp:
1328 (JSC::JSFunction::lengthGetter):
1329 (JSC::JSFunction::getParameterName): Updated for the fact that
1330 FunctionBodyNode's parameters are no longer a wtf::Vector.
1332 * kjs/JSFunction.h: Nixed some cruft.
1334 * kjs/JSGlobalObjectFunctions.cpp:
1335 (JSC::globalFuncEval): Provide a SourceCode to the Parser, since
1336 other APIs are no longer supported.
1339 (JSC::Parser::parse): Require a SourceCode argument, instead of a bunch
1340 of broken out parameters. Stop tracking sourceId as an integer, since we
1341 use the SourceProvider pointer for this now. Don't clamp the
1342 startingLineNumber, since SourceCode does that now.
1345 (JSC::Parser::parse): Standardized the parsing interface to require a
1351 (prettyPrintScript):
1353 (runInteractive): Provide a SourceCode to the Interpreter, since
1354 other APIs are no longer supported.
1356 * kjs/SourceProvider.h:
1357 (JSC::SourceProvider::SourceProvider):
1358 (JSC::SourceProvider::url):
1359 (JSC::SourceProvider::asId):
1360 (JSC::UStringSourceProvider::create):
1361 (JSC::UStringSourceProvider::UStringSourceProvider): Added new
1362 responsibilities described above.
1364 * kjs/SourceRange.h:
1365 (JSC::SourceCode::SourceCode):
1366 (JSC::SourceCode::toString):
1367 (JSC::SourceCode::provider):
1368 (JSC::SourceCode::firstLine):
1369 (JSC::SourceCode::data):
1370 (JSC::SourceCode::length): Added new responsibilities described above.
1371 Renamed SourceRange to SourceCode, based on review feedback. Added
1372 a makeSource function for convenience.
1374 * kjs/debugger.h: Provide a SourceCode to the client, since other APIs
1375 are no longer supported.
1377 * kjs/grammar.y: Provide startingLineNumber when creating a SourceCode.
1379 * kjs/debugger.h: Treat sourceId as intptr_t to avoid loss of precision
1382 * kjs/interpreter.cpp:
1383 (JSC::Interpreter::checkSyntax):
1384 (JSC::Interpreter::evaluate):
1385 * kjs/interpreter.h: Require a SourceCode instead of broken out arguments.
1388 (JSC::Lexer::setCode):
1390 (JSC::Lexer::sourceRange): Fold together the SourceProvider and line number
1391 into a SourceCode. Fixed a bug where the Lexer would accidentally keep
1392 alive the last SourceProvider forever.
1395 (JSC::ScopeNode::ScopeNode):
1396 (JSC::ProgramNode::ProgramNode):
1397 (JSC::ProgramNode::create):
1398 (JSC::EvalNode::EvalNode):
1399 (JSC::EvalNode::generateCode):
1400 (JSC::EvalNode::create):
1401 (JSC::FunctionBodyNode::FunctionBodyNode):
1402 (JSC::FunctionBodyNode::finishParsing):
1403 (JSC::FunctionBodyNode::create):
1404 (JSC::FunctionBodyNode::generateCode):
1405 (JSC::ProgramNode::generateCode):
1406 (JSC::FunctionBodyNode::paramString):
1409 (JSC::ScopeNode::sourceId):
1410 (JSC::FunctionBodyNode::):
1411 (JSC::FunctionBodyNode::parameterCount):
1412 (JSC::FuncExprNode::):
1413 (JSC::FuncDeclNode::): Store a SourceCode in all ScopeNodes, since
1414 SourceCode is now responsible for tracking URL, ID, etc. Streamlined
1415 some ad hoc FunctionBodyNode fixups into a "finishParsing" function, to
1416 help make clear what you need to do in order to finish parsing a
1420 (WTF::::releaseBuffer): Don't ASSERT that releaseBuffer() is only called
1421 when buffer is not 0, since FunctionBodyNode is more than happy
1422 to get back a 0 buffer, and other functions like RefPtr::release() allow
1425 2008-10-01 Cameron Zwarich <zwarich@apple.com>
1427 Reviewed by Maciej Stachowiak.
1429 Bug 21289: REGRESSION (r37160): Inspector crashes on load
1430 <https://bugs.webkit.org/show_bug.cgi?id=21289>
1432 The code in Arguments::mark() in r37160 was wrong. It marks indices in
1433 d->registers, but that makes no sense (they are local variables, not
1434 arguments). It should mark those indices in d->registerArray instead.
1436 This patch also changes Arguments::copyRegisters() to use d->numParameters
1437 instead of recomputing it.
1439 * kjs/Arguments.cpp:
1440 (JSC::Arguments::mark):
1442 (JSC::Arguments::copyRegisters):
1444 2008-09-30 Darin Adler <darin@apple.com>
1446 Reviewed by Eric Seidel.
1448 - https://bugs.webkit.org/show_bug.cgi?id=21214
1449 work on getting rid of ExecState
1451 Eliminate some unneeded uses of dynamicGlobalObject.
1453 * API/JSClassRef.cpp:
1454 (OpaqueJSClass::contextData): Changed to use a map in the global data instead
1455 of on the global object. Also fixed to use only a single hash table lookup.
1457 * API/JSObjectRef.cpp:
1458 (JSObjectMakeConstructor): Use lexicalGlobalObject rather than dynamicGlobalObject
1459 to get the object prototype.
1461 * kjs/ArrayPrototype.cpp:
1462 (JSC::arrayProtoFuncToString): Use arrayVisitedElements set in global data rather
1463 than in the global object.
1464 (JSC::arrayProtoFuncToLocaleString): Ditto.
1465 (JSC::arrayProtoFuncJoin): Ditto.
1467 * kjs/JSGlobalData.cpp:
1468 (JSC::JSGlobalData::JSGlobalData): Don't initialize opaqueJSClassData, since
1469 it's no longer a pointer.
1470 (JSC::JSGlobalData::~JSGlobalData): We still need to delete all the values, but
1471 we don't need to delete the map since it's no longer a pointer.
1473 * kjs/JSGlobalData.h: Made opaqueJSClassData a map instead of a pointer to a map.
1474 Also added arrayVisitedElements.
1476 * kjs/JSGlobalObject.h: Removed arrayVisitedElements.
1479 (functionRun): Use lexicalGlobalObject instead of dynamicGlobalObject.
1480 (functionLoad): Ditto.
1482 2008-10-01 Cameron Zwarich <zwarich@apple.com>
1486 Speculative Windows build fix.
1490 2008-10-01 Cameron Zwarich <zwarich@apple.com>
1492 Reviewed by Darin Adler.
1494 Bug 21123: using "arguments" in a function should not force creation of an activation object
1495 <https://bugs.webkit.org/show_bug.cgi?id=21123>
1497 Make the 'arguments' object not require a JSActivation. We store the
1498 'arguments' object in the OptionalCalleeArguments call frame slot. We
1499 need to be able to get the original 'arguments' object to tear it off
1500 when returning from a function, but 'arguments' may be assigned to in a
1503 Therefore, we use the OptionalCalleeArguments slot when we want to get
1504 the original activation or we know that 'arguments' was not assigned a
1505 different value. When 'arguments' may have been assigned a new value,
1506 we use a new local variable that is initialized with 'arguments'. Since
1507 a function parameter named 'arguments' may overwrite the value of
1508 'arguments', we also need to be careful to look up 'arguments' in the
1509 symbol table, so we get the parameter named 'arguments' instead of the
1510 local variable that we have added for holding the 'arguments' object.
1512 This is a 19.1% win on the V8 Raytrace benchmark using the SunSpider
1513 harness, and a 20.7% win using the V8 harness. This amounts to a 6.5%
1514 total speedup on the V8 benchmark suite using the V8 harness.
1517 (JSC::CTI::privateCompileMainPass):
1519 * VM/CodeGenerator.cpp:
1520 (JSC::CodeGenerator::CodeGenerator):
1522 (JSC::Machine::unwindCallFrame):
1523 (JSC::Machine::privateExecute):
1524 (JSC::Machine::retrieveArguments):
1525 (JSC::Machine::cti_op_init_arguments):
1526 (JSC::Machine::cti_op_ret_activation_arguments):
1528 * VM/RegisterFile.h:
1529 (JSC::RegisterFile::):
1530 * kjs/Arguments.cpp:
1531 (JSC::Arguments::mark):
1532 (JSC::Arguments::fillArgList):
1533 (JSC::Arguments::getOwnPropertySlot):
1534 (JSC::Arguments::put):
1536 (JSC::Arguments::setRegisters):
1537 (JSC::Arguments::init):
1538 (JSC::Arguments::Arguments):
1539 (JSC::Arguments::copyRegisters):
1540 (JSC::JSActivation::copyRegisters):
1541 * kjs/JSActivation.cpp:
1542 (JSC::JSActivation::argumentsGetter):
1543 * kjs/JSActivation.h:
1544 (JSC::JSActivation::JSActivationData::JSActivationData):
1547 (JSC::ScopeNode::setUsesArguments):
1548 * masm/X86Assembler.h:
1549 (JSC::X86Assembler::):
1550 (JSC::X86Assembler::orl_mr):
1552 2008-10-01 Kevin McCullough <kmccullough@apple.com>
1554 Rubberstamped by Geoff Garen.
1556 Remove BreakpointCheckStatement because it's not used anymore.
1557 No effect on sunspider or the jsc tests.
1562 2008-09-30 Oliver Hunt <oliver@apple.com>
1564 Reviewed by Geoff Garen.
1566 Improve performance of CTI on windows.
1568 Currently on platforms where the compiler doesn't allow us to safely
1569 index relative to the address of a parameter we need to actually
1570 provide a pointer to CTI runtime call arguments. This patch improves
1571 performance in this case by making the CTI logic for restoring this
1572 parameter much less conservative by only resetting it before we actually
1573 make a call, rather than between each and every SF bytecode we generate
1576 This results in a 3.6% progression on the v8 benchmark when compiled with MSVC.
1579 (JSC::CTI::emitCall):
1580 (JSC::CTI::compileOpCall):
1581 (JSC::CTI::privateCompileMainPass):
1582 (JSC::CTI::privateCompileSlowCases):
1583 (JSC::CTI::privateCompilePutByIdTransition):
1585 * masm/X86Assembler.h:
1588 2008-09-30 Maciej Stachowiak <mjs@apple.com>
1590 Reviewed by Oliver Hunt.
1592 - track uses of "this", "with" and "catch" in the parser
1594 Knowing this up front will be useful for future optimizations.
1596 Perf and correctness remain the same.
1601 2008-09-30 Sam Weinig <sam@webkit.org>
1603 Reviewed by Mark Rowe.
1605 Add WebKitAvailability macros for JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError,
1606 and JSObjectMakeRegExp
1608 * API/JSObjectRef.h:
1610 2008-09-30 Darin Adler <darin@apple.com>
1612 Reviewed by Geoff Garen.
1614 - https://bugs.webkit.org/show_bug.cgi?id=21214
1615 work on getting rid of ExecState
1617 Replaced the m_prev field of ExecState with a bit in the
1618 call frame pointer to indicate "host" call frames.
1621 (JSC::makeHostCallFramePointer): Added. Sets low bit.
1622 (JSC::isHostCallFrame): Added. Checks low bit.
1623 (JSC::stripHostCallFrameBit): Added. Clears low bit.
1624 (JSC::Machine::unwindCallFrame): Replaced null check that was
1625 formerly used to detect host call frames with an isHostCallFrame check.
1626 (JSC::Machine::execute): Pass in a host call frame pointer rather than
1627 always passing 0 when starting execution from the host. This allows us
1628 to follow the entire call frame pointer chain when desired, or to stop
1629 at the host calls when that's desired.
1630 (JSC::Machine::privateExecute): Replaced null check that was
1631 formerly used to detect host call frames with an isHostCallFrame check.
1632 (JSC::Machine::retrieveCaller): Ditto.
1633 (JSC::Machine::retrieveLastCaller): Ditto.
1634 (JSC::Machine::callFrame): Removed the code to walk up m_prev pointers
1635 and replaced it with code that uses the caller pointer and uses the
1636 stripHostCallFrameBit function.
1638 * kjs/ExecState.cpp: Removed m_prev.
1639 * kjs/ExecState.h: Ditto.
1641 2008-09-30 Cameron Zwarich <zwarich@apple.com>
1643 Reviewed by Geoff Garen.
1645 Move all detection of 'arguments' in a lexical scope to the parser, in
1646 preparation for fixing
1648 Bug 21123: using "arguments" in a function should not force creation of an activation object
1649 <https://bugs.webkit.org/show_bug.cgi?id=21123>
1651 * VM/CodeGenerator.cpp:
1652 (JSC::CodeGenerator::CodeGenerator):
1656 2008-09-30 Geoffrey Garen <ggaren@apple.com>
1661 (runWithScripts): Fixed indentation.
1663 2008-09-30 Mark Rowe <mrowe@apple.com>
1665 Rubber-stamped by Sam Weinig.
1667 Build fix. Move InternalFunction::classInfo implementation into the .cpp
1668 file to prevent the vtable for InternalFunction being generated as a weak symbol.
1669 Has no effect on SunSpider.
1671 * kjs/InternalFunction.cpp:
1672 (JSC::InternalFunction::classInfo):
1673 * kjs/InternalFunction.h:
1675 2008-09-29 Maciej Stachowiak <mjs@apple.com>
1677 Reviewed by Darin Adler.
1679 - optimize appending a number to a string
1680 https://bugs.webkit.org/show_bug.cgi?id=21203
1682 It's pretty common in real-world code (and on some of the v8
1683 benchmarks) to append a number to a string, so I made this one of
1684 the fast cases, and also added support to UString to do it
1685 directly without allocating a temporary UString.
1687 ~1% speedup on v8 benchmark.
1690 (JSC::jsAddSlowCase): Make this NEVER_INLINE because somehow otherwise
1691 the change is a regression.
1692 (JSC::jsAdd): Handle number + string special case.
1693 (JSC::Machine::cti_op_add): Integrate much of the logic of jsAdd to
1694 avoid exception check in the str + str, num + num and str + num cases.
1696 (JSC::expandedSize): Make this a non-member function, since it needs to be
1697 called in non-member functions but not outside this file.
1698 (JSC::expandCapacity): Ditto.
1699 (JSC::UString::expandCapacity): Call the non-member version.
1700 (JSC::createRep): Helper to make a rep from a char*.
1701 (JSC::UString::UString): Use above helper.
1702 (JSC::concatenate): Guts of concatenating constructor for cases where first
1703 item is a UString::Rep, and second is a UChar* and length, or a char*.
1704 (JSC::UString::append): Implement for cases where first item is a UString::Rep,
1705 and second is an int or double. Sadly duplicates logic of UString::from(int)
1706 and UString::from(double).
1709 2008-09-29 Darin Adler <darin@apple.com>
1711 Reviewed by Sam Weinig.
1713 - https://bugs.webkit.org/show_bug.cgi?id=21214
1714 work on getting rid of ExecState
1716 * JavaScriptCore.exp: Updated since JSGlobalObject::init
1717 no longer takes a parameter.
1720 (JSC::Machine::execute): Removed m_registerFile argument
1721 for ExecState constructors.
1723 * kjs/DebuggerCallFrame.cpp:
1724 (JSC::DebuggerCallFrame::evaluate): Removed globalThisValue
1725 argument for ExecState constructor.
1727 * kjs/ExecState.cpp:
1728 (JSC::ExecState::ExecState): Removed globalThisValue and
1729 registerFile arguments to constructors.
1731 * kjs/ExecState.h: Removed m_globalThisValue and
1732 m_registerFile data members.
1734 * kjs/JSGlobalObject.cpp:
1735 (JSC::JSGlobalObject::init): Removed globalThisValue
1736 argument for ExecState constructor.
1738 * kjs/JSGlobalObject.h:
1739 (JSC::JSGlobalObject::JSGlobalObject): Got rid of parameter
1740 for the init function.
1742 2008-09-29 Geoffrey Garen <ggaren@apple.com>
1744 Rubber-stamped by Cameron Zwarich.
1746 Fixed https://bugs.webkit.org/show_bug.cgi?id=21225
1747 Machine::retrieveLastCaller should check for a NULL codeBlock
1749 In order to crash, you would need to call retrieveCaller in a situation
1750 where you had two host call frames in a row in the register file. I
1751 don't know how to make that happen, or if it's even possible, so I don't
1752 have a test case -- but better safe than sorry!
1755 (JSC::Machine::retrieveLastCaller):
1757 2008-09-29 Geoffrey Garen <ggaren@apple.com>
1759 Reviewed by Cameron Zwarich.
1761 Store the callee ScopeChain, not the caller ScopeChain, in the call frame
1762 header. Nix the "scopeChain" local variable and ExecState::m_scopeChain, and
1763 access the callee ScopeChain through the call frame header instead.
1765 Profit: call + return are simpler, because they don't have to update the
1766 "scopeChain" local variable, or ExecState::m_scopeChain.
1768 Because CTI keeps "r" in a register, reading the callee ScopeChain relative
1769 to "r" can be very fast, in any cases we care to optimize.
1771 0% speedup on empty function call benchmark. (5.5% speedup in bytecode.)
1772 0% speedup on SunSpider. (7.5% speedup on controlflow-recursive.)
1773 2% speedup on SunSpider --v8.
1774 2% speedup on v8 benchmark.
1776 * VM/CTI.cpp: Changed scope chain access to read the scope chain from
1777 the call frame header. Sped up op_ret by changing it not to fuss with
1778 the "scopeChain" local variable or ExecState::m_scopeChain.
1780 * VM/CTI.h: Updated CTI trampolines not to take a ScopeChainNode*
1781 argument, since that's stored in the call frame header now.
1783 * VM/Machine.cpp: Access "scopeChain" and "codeBlock" through new helper
1784 functions that read from the call frame header. Updated functions operating
1785 on ExecState::m_callFrame to account for / take advantage of the fact that
1786 Exec:m_callFrame is now never NULL.
1788 Fixed a bug in op_construct, where it would use the caller's default
1789 object prototype, rather than the callee's, when constructing a new object.
1791 * VM/Machine.h: Made some helper functions available. Removed
1792 ScopeChainNode* arguments to a lot of functions, since the ScopeChainNode*
1793 is now stored in the call frame header.
1795 * VM/RegisterFile.h: Renamed "CallerScopeChain" to "ScopeChain", since
1796 that's what it is now.
1798 * kjs/DebuggerCallFrame.cpp: Updated for change to ExecState signature.
1800 * kjs/ExecState.cpp:
1801 * kjs/ExecState.h: Nixed ExecState::m_callFrame, along with the unused
1802 isGlobalObject function.
1804 * kjs/JSGlobalObject.cpp:
1805 * kjs/JSGlobalObject.h: Gave the global object a fake call frame in
1806 which to store the global scope chain, since our code now assumes that
1807 it can always read the scope chain out of the ExecState's call frame.
1809 2008-09-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1811 Reviewed by Sam Weinig.
1813 Remove the isActivationObject() virtual method on JSObject and use
1814 StructureID information instead. This should be slightly faster, but
1815 isActivationObject() is only used in assertions and unwinding the stack
1820 (JSC::Machine::unwindCallFrame):
1821 (JSC::Machine::privateExecute):
1822 (JSC::Machine::cti_op_ret_activation):
1823 * kjs/JSActivation.cpp:
1824 * kjs/JSActivation.h:
1827 2008-09-29 Peter Gal <galpeter@inf.u-szeged.hu>
1829 Reviewed and tweaked by Darin Adler.
1831 Fix build for non-all-in-one platforms.
1833 * kjs/StringPrototype.cpp: Added missing ASCIICType.h include.
1835 2008-09-29 Bradley T. Hughes <bradley.hughes@nokia.com>
1837 Reviewed by Simon Hausmann.
1839 Fix compilation with icpc
1845 2008-09-29 Thiago Macieira <thiago.macieira@nokia.com>
1847 Reviewed by Simon Hausmann.
1849 Changed copyright from Trolltech ASA to Nokia.
1851 Nokia acquired Trolltech ASA, assets were transferred on September 26th 2008.
1854 * wtf/qt/MainThreadQt.cpp:
1856 2008-09-29 Simon Hausmann <hausmann@webkit.org>
1858 Reviewed by Lars Knoll.
1860 Don't accidentially install libJavaScriptCore.a for the build inside
1863 * JavaScriptCore.pro:
1865 2008-09-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1867 Reviewed by Maciej Stachowiak.
1869 Bug 21200: Allow direct access to 'arguments' without using op_resolve
1870 <https://bugs.webkit.org/show_bug.cgi?id=21200>
1872 Allow fast access to the 'arguments' object by adding an extra slot to
1873 the callframe to store it.
1875 This is a 3.0% speedup on the V8 Raytrace benchmark.
1877 * JavaScriptCore.exp:
1879 (JSC::CTI::privateCompileMainPass):
1881 (JSC::CodeBlock::dump):
1882 * VM/CodeGenerator.cpp:
1883 (JSC::CodeGenerator::CodeGenerator):
1884 (JSC::CodeGenerator::registerFor):
1885 * VM/CodeGenerator.h:
1886 (JSC::CodeGenerator::registerFor):
1888 (JSC::Machine::initializeCallFrame):
1889 (JSC::Machine::dumpRegisters):
1890 (JSC::Machine::privateExecute):
1891 (JSC::Machine::retrieveArguments):
1892 (JSC::Machine::cti_op_call_JSFunction):
1893 (JSC::Machine::cti_op_create_arguments):
1894 (JSC::Machine::cti_op_construct_JSConstruct):
1897 * VM/RegisterFile.h:
1898 (JSC::RegisterFile::):
1899 * kjs/JSActivation.cpp:
1900 (JSC::JSActivation::mark):
1901 (JSC::JSActivation::argumentsGetter):
1902 * kjs/JSActivation.h:
1903 (JSC::JSActivation::JSActivationData::JSActivationData):
1906 (JSC::Parser::didFinishParsing):
1908 (JSC::Parser::parse):
1911 (JSC::ScopeNode::ScopeNode):
1912 (JSC::ProgramNode::ProgramNode):
1913 (JSC::ProgramNode::create):
1914 (JSC::EvalNode::EvalNode):
1915 (JSC::EvalNode::create):
1916 (JSC::FunctionBodyNode::FunctionBodyNode):
1917 (JSC::FunctionBodyNode::create):
1919 (JSC::ScopeNode::usesArguments):
1921 2008-09-28 Mark Rowe <mrowe@apple.com>
1923 Reviewed by Sam Weinig.
1925 Add an ASCII fast-path to toLowerCase and toUpperCase.
1927 The fast path speeds up the common case of an ASCII-only string by up to 60% while adding a less than 5% penalty
1928 to the less common non-ASCII case.
1930 This also removes stringProtoFuncToLocaleLowerCase and stringProtoFuncToLocaleUpperCase, which were identical
1931 to the non-locale variants of the functions. toLocaleLowerCase and toLocaleUpperCase now use the non-locale
1932 variants of the functions directly.
1934 * kjs/StringPrototype.cpp:
1935 (JSC::stringProtoFuncToLowerCase):
1936 (JSC::stringProtoFuncToUpperCase):
1938 2008-09-28 Mark Rowe <mrowe@apple.com>
1940 Reviewed by Cameron Zwarich.
1942 Speed up parseInt and parseFloat.
1944 Repeatedly indexing into a UString is slow, so retrieve a pointer into the underlying buffer once up front
1945 and use that instead. This is a 7% win on a parseInt/parseFloat micro-benchmark.
1947 * kjs/JSGlobalObjectFunctions.cpp:
1951 2008-09-28 Simon Hausmann <hausmann@webkit.org>
1953 Reviewed by David Hyatt.
1955 In Qt's initializeThreading re-use an existing thread identifier for the main
1956 thread if it exists.
1958 currentThread() implicitly creates new identifiers and it could be that
1959 it is called before initializeThreading().
1961 * wtf/ThreadingQt.cpp:
1962 (WTF::initializeThreading):
1964 2008-09-27 Keishi Hattori <casey.hattori@gmail.com>
1966 Added Machine::retrieveCaller to the export list.
1968 Reviewed by Kevin McCullough and Tim Hatcher.
1970 * JavaScriptCore.exp: Added Machine::retrieveCaller.
1972 2008-09-27 Anders Carlsson <andersca@apple.com>
1979 2008-09-27 Geoffrey Garen <ggaren@apple.com>
1981 Reviewed by Cameron Zwarich.
1983 https://bugs.webkit.org/show_bug.cgi?id=21175
1985 Store the callee CodeBlock, not the caller CodeBlock, in the call frame
1986 header. Nix the "codeBlock" local variable, and access the callee
1987 CodeBlock through the call frame header instead.
1989 Profit: call + return are simpler, because they don't have to update the
1990 "codeBlock" local variable.
1992 Because CTI keeps "r" in a register, reading the callee CodeBlock relative
1993 to "r" can be very fast, in any cases we care to optimize. Presently,
1994 no such cases seem important.
1996 Also, stop writing "dst" to the call frame header. CTI doesn't use it.
1998 21.6% speedup on empty function call benchmark.
1999 3.8% speedup on SunSpider --v8.
2000 2.1% speedup on v8 benchmark.
2001 0.7% speedup on SunSpider (6% speedup on controlflow-recursive).
2003 Small regression in bytecode, because currently every op_ret reads the
2004 callee CodeBlock to check needsFullScopeChain, and bytecode does not
2005 keep "r" in a register. On-balance, this is probably OK, since CTI is
2006 our high-performance execution model. Also, this should go away once
2007 we make needsFullScopeChain statically determinable at parse time.
2010 (JSC::CTI::compileOpCall): The speedup!
2011 (JSC::CTI::privateCompileSlowCases): ditto
2014 (JSC::): Fixed up magic trampoline constants to account for the nixed
2015 "codeBlock" argument.
2016 (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock"
2017 argument, since codeBlock is now stored in the call frame header.
2019 * VM/Machine.cpp: Read the callee CodeBlock from the register file. Use
2020 a NULL CallerRegisters in the call frame header to signal a built-in
2021 caller, since CodeBlock is now never NULL.
2023 * VM/Machine.h: Made some stand-alone functions Machine member functions
2024 so they could call the private codeBlock() accessor in the Register
2025 class, of which Machine is a friend. Renamed "CallerCodeBlock" to
2026 "CodeBlock", since it's no longer the caller's CodeBlock.
2028 * VM/RegisterFile.h: Marked some methods const to accommodate a
2029 const RegisterFile* being passed around in Machine.cpp.
2031 2008-09-26 Jan Michael Alonzo <jmalonzo@webkit.org>
2033 Gtk build fix. Not reviewed.
2035 Narrow-down the target of the JavaScriptCore .lut.h generator so
2036 it won't try to create the WebCore .lut.hs.
2040 2008-09-26 Matt Lilek <webkit@mattlilek.com>
2042 Reviewed by Tim Hatcher.
2044 Update FEATURE_DEFINES after ENABLE_CROSS_DOCUMENT_MESSAGING was removed.
2046 * Configurations/JavaScriptCore.xcconfig:
2048 2008-09-26 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2050 Rubber-stamped by Anders Carlson.
2052 Change the name 'sc' to 'scopeChainNode' in a few places.
2055 (JSC::EvalNode::generateCode):
2056 (JSC::FunctionBodyNode::generateCode):
2057 (JSC::ProgramNode::generateCode):
2059 2008-09-26 Sam Weinig <sam@webkit.org>
2061 Reviewed by Darin Adler.
2063 Patch for https://bugs.webkit.org/show_bug.cgi?id=21152
2064 Speedup static property get/put
2066 Convert getting/setting static property values to use static functions
2067 instead of storing an integer and switching in getValueProperty/putValueProperty.
2070 (JSC::JSObject::deleteProperty):
2071 (JSC::JSObject::getPropertyAttributes):
2072 * kjs/MathObject.cpp:
2073 (JSC::MathObject::getOwnPropertySlot):
2074 * kjs/NumberConstructor.cpp:
2075 (JSC::numberConstructorNaNValue):
2076 (JSC::numberConstructorNegInfinity):
2077 (JSC::numberConstructorPosInfinity):
2078 (JSC::numberConstructorMaxValue):
2079 (JSC::numberConstructorMinValue):
2080 * kjs/PropertySlot.h:
2081 (JSC::PropertySlot::):
2082 * kjs/RegExpConstructor.cpp:
2083 (JSC::regExpConstructorDollar1):
2084 (JSC::regExpConstructorDollar2):
2085 (JSC::regExpConstructorDollar3):
2086 (JSC::regExpConstructorDollar4):
2087 (JSC::regExpConstructorDollar5):
2088 (JSC::regExpConstructorDollar6):
2089 (JSC::regExpConstructorDollar7):
2090 (JSC::regExpConstructorDollar8):
2091 (JSC::regExpConstructorDollar9):
2092 (JSC::regExpConstructorInput):
2093 (JSC::regExpConstructorMultiline):
2094 (JSC::regExpConstructorLastMatch):
2095 (JSC::regExpConstructorLastParen):
2096 (JSC::regExpConstructorLeftContext):
2097 (JSC::regExpConstructorRightContext):
2098 (JSC::setRegExpConstructorInput):
2099 (JSC::setRegExpConstructorMultiline):
2100 (JSC::RegExpConstructor::setInput):
2101 (JSC::RegExpConstructor::setMultiline):
2102 (JSC::RegExpConstructor::multiline):
2103 * kjs/RegExpConstructor.h:
2104 * kjs/RegExpObject.cpp:
2105 (JSC::regExpObjectGlobal):
2106 (JSC::regExpObjectIgnoreCase):
2107 (JSC::regExpObjectMultiline):
2108 (JSC::regExpObjectSource):
2109 (JSC::regExpObjectLastIndex):
2110 (JSC::setRegExpObjectLastIndex):
2111 * kjs/RegExpObject.h:
2112 (JSC::RegExpObject::setLastIndex):
2113 (JSC::RegExpObject::lastIndex):
2114 (JSC::RegExpObject::RegExpObjectData::RegExpObjectData):
2115 * kjs/StructureID.cpp:
2116 (JSC::StructureID::getEnumerablePropertyNames):
2117 * kjs/create_hash_table:
2121 (JSC::HashTable::createTable):
2122 (JSC::HashTable::deleteTable):
2123 (JSC::setUpStaticFunctionSlot):
2125 (JSC::HashEntry::initialize):
2126 (JSC::HashEntry::setKey):
2127 (JSC::HashEntry::key):
2128 (JSC::HashEntry::attributes):
2129 (JSC::HashEntry::function):
2130 (JSC::HashEntry::functionLength):
2131 (JSC::HashEntry::propertyGetter):
2132 (JSC::HashEntry::propertyPutter):
2133 (JSC::HashEntry::lexerValue):
2135 (JSC::HashTable::entry):
2136 (JSC::getStaticPropertySlot):
2137 (JSC::getStaticValueSlot):
2140 2008-09-26 Gavin Barraclough <barraclough@apple.com>
2142 Reviewed by Maciej Stachowiak & Oliver Hunt.
2144 Add support for reusing temporary JSNumberCells. This change is based on the observation
2145 that if the result of certain operations is a JSNumberCell and is consumed by a subsequent
2146 operation that would produce a JSNumberCell, we can reuse the object rather than allocating
2147 a fresh one. E.g. given the expression ((a * b) * c), we can statically determine that
2148 (a * b) will have a numeric result (or else it will have thrown an exception), so the result
2149 will either be a JSNumberCell or a JSImmediate.
2151 This patch changes three areas of JSC:
2152 * The AST now tracks type information about the result of each node.
2153 * This information is consumed in bytecode compilation, and certain bytecode operations
2154 now carry the statically determined type information about their operands.
2155 * CTI uses the information in a number of fashions:
2156 * Where an operand to certain arithmetic operations is reusable, it will plant code
2157 to try to perform the operation in JIT code & reuse the cell, where appropriate.
2158 * Where it can be statically determined that an operand can only be numeric (typically
2159 the result of another arithmetic operation) the code will not redundantly check that
2160 the JSCell is a JSNumberCell.
2161 * Where either of the operands to an add are non-numeric do not plant an optimized
2162 arithmetic code path, just call straight out to the C function.
2164 +6% Sunspider (10% progression on 3D, 16% progression on math, 60% progression on access-nbody),
2165 +1% v8-tests (improvements in raytrace & crypto)
2167 * VM/CTI.cpp: Add optimized code generation with reuse of temporary JSNumberCells.
2169 * kjs/JSNumberCell.h:
2170 * masm/X86Assembler.h:
2172 * VM/CodeBlock.cpp: Add type information to specific bytecodes.
2173 * VM/CodeGenerator.cpp:
2174 * VM/CodeGenerator.h:
2177 * kjs/nodes.cpp: Track static type information for nodes.
2179 * kjs/ResultDescriptor.h: (Added)
2180 * JavaScriptCore.xcodeproj/project.pbxproj:
2182 2008-09-26 Yichao Yin <yichao.yin@torchmobile.com.cn>
2184 Reviewed by George Staikos, Maciej Stachowiak.
2186 Add utility functions needed for upcoming WML code.
2189 (WTF::isASCIIPrintable):
2191 2008-09-26 Geoffrey Garen <ggaren@apple.com>
2193 Reviewed by Darin Adler.
2195 Reverted the part of r36614 that used static data because static data
2198 2008-09-26 Geoffrey Garen <ggaren@apple.com>
2200 Reviewed by Maciej Stachowiak.
2202 Removed dynamic check for whether the callee needs an activation object.
2203 Replaced with callee code to create the activation object.
2205 0.5% speedup on SunSpider.
2206 No change on v8 benchmark. (Might be a speedup, but it's in range of the
2209 0.7% speedup on v8 benchmark in bytecode.
2210 1.3% speedup on empty call benchmark in bytecode.
2213 (JSC::CTI::privateCompileMainPass): Added support for op_init_activation,
2214 the new opcode that specifies that the callee's initialization should
2215 create an activation object.
2216 (JSC::CTI::privateCompile): Removed previous code that did a similar
2217 thing in an ad-hoc way.
2220 (JSC::CodeBlock::dump): Added a case for dumping op_init_activation.
2222 * VM/CodeGenerator.cpp:
2223 (JSC::CodeGenerator::generate): Added fixup code to change op_init to
2224 op_init_activation if necessary. (With a better parser, we would know
2225 which to use from the beginning.)
2228 (JSC::Instruction::Instruction):
2229 (WTF::): Faster traits for the instruction vector. An earlier version
2230 of this patch relied on inserting at the beginning of the vector, and
2231 depended on this change for speed.
2234 (JSC::Machine::execute): Removed clients of setScopeChain, the old
2235 abstraction for dynamically checking for whether an activation object
2236 needed to be created.
2237 (JSC::Machine::privateExecute): ditto
2239 (JSC::Machine::cti_op_push_activation): Renamed this function from
2240 cti_vm_updateScopeChain, and made it faster by removing the call to
2244 * VM/Opcode.h: Declared op_init_activation.
2246 2008-09-24 Geoffrey Garen <ggaren@apple.com>
2248 Reviewed by Maciej Stachowiak.
2250 Move most of the return code back into the callee, now that the callee
2251 doesn't have to calculate anything dynamically.
2253 11.5% speedup on empty function call benchmark.
2255 SunSpider says 0.3% faster. SunSpider --v8 says no change.
2258 (JSC::CTI::compileOpCall):
2259 (JSC::CTI::privateCompileMainPass):
2260 (JSC::CTI::privateCompileSlowCases):
2262 2008-09-24 Sam Weinig <sam@webkit.org>
2264 Reviewed by Maciej Stachowiak.
2266 Remove staticFunctionGetter. There is only one remaining user of
2267 staticFunctionGetter and it can be converted to use setUpStaticFunctionSlot.
2269 * JavaScriptCore.exp:
2273 2008-09-24 Maciej Stachowiak <mjs@apple.com>
2275 Reviewed by Oliver Hunt.
2277 - inline JIT fast case of op_neq
2278 - remove extra level of function call indirection from slow cases of eq and neq
2280 1% speedup on Richards
2283 (JSC::CTI::privateCompileMainPass):
2284 (JSC::CTI::privateCompileSlowCases):
2286 (JSC::Machine::privateExecute):
2287 (JSC::Machine::cti_op_eq):
2288 (JSC::Machine::cti_op_neq):
2289 * kjs/operations.cpp:
2291 (JSC::equalSlowCase):
2293 (JSC::equalSlowCaseInline):
2295 2008-09-24 Sam Weinig <sam@webkit.org>
2297 Reviewed by Darin Adler.
2299 Fix for https://bugs.webkit.org/show_bug.cgi?id=21080
2300 <rdar://problem/6243534>
2301 Crash below Function.apply when using a runtime array as the argument list
2303 Test: plugins/bindings-array-apply-crash.html
2305 * kjs/FunctionPrototype.cpp:
2306 (JSC::functionProtoFuncApply): Revert to the slow case if the object inherits from
2307 JSArray (via ClassInfo) but is not a JSArray.
2309 2008-09-24 Kevin McCullough <kmccullough@apple.com>
2314 (JSC::statementListEmitCode):
2316 2008-09-24 Kevin McCullough <kmccullough@apple.com>
2320 Bug 21031: Breakpoints in the condition of loops only breaks the first
2322 - Now when setting breakpoints in the condition of a loop (for, while,
2323 for in, and do while) will successfully break each time throught the
2325 - For 'for' loops we need a little more complicated behavior that cannot
2326 be accomplished without some more significant changes:
2327 https://bugs.webkit.org/show_bug.cgi?id=21073
2330 (JSC::statementListEmitCode): We don't want to blindly emit a debug hook
2331 at the first line of loops, instead let the loop emit the debug hooks.
2332 (JSC::DoWhileNode::emitCode):
2333 (JSC::WhileNode::emitCode):
2334 (JSC::ForNode::emitCode):
2335 (JSC::ForInNode::emitCode):
2337 (JSC::StatementNode::):
2338 (JSC::DoWhileNode::):
2342 2008-09-24 Geoffrey Garen <ggaren@apple.com>
2344 Reviewed by Darin Adler.
2346 Fixed <rdar://problem/5605532> Need a SPI for telling JS the size of
2347 the objects it retains
2349 * API/tests/testapi.c: Test the new SPI a little.
2351 * API/JSSPI.cpp: Add the new SPI.
2352 * API/JSSPI.h: Add the new SPI.
2353 * JavaScriptCore.exp: Add the new SPI.
2354 * JavaScriptCore.xcodeproj/project.pbxproj: Add the new SPI.
2356 2008-09-24 Geoffrey Garen <ggaren@apple.com>
2358 Reviewed by Darin Adler.
2360 * API/JSBase.h: Filled in some missing function names.
2362 2008-09-24 Geoffrey Garen <ggaren@apple.com>
2364 Reviewed by Cameron Zwarich.
2366 Fixed https://bugs.webkit.org/show_bug.cgi?id=21057
2367 Crash in RegisterID::deref() running fast/canvas/canvas-putImageData.html
2369 * VM/CodeGenerator.h: Changed declaration order to ensure the
2370 m_lastConstant, which is a RefPtr that points into m_calleeRegisters,
2371 has its destructor called before the destructor for m_calleeRegisters.
2373 2008-09-24 Darin Adler <darin@apple.com>
2375 Reviewed by Sam Weinig.
2377 - https://bugs.webkit.org/show_bug.cgi?id=21047
2378 speed up ret_activation with inlining
2380 About 1% on v8-raytrace.
2382 * JavaScriptCore.exp: Removed JSVariableObject::setRegisters.
2384 * kjs/JSActivation.cpp: Moved copyRegisters to the header to make it inline.
2385 * kjs/JSActivation.h:
2386 (JSC::JSActivation::copyRegisters): Moved here. Also removed the registerArraySize
2387 argument to setRegisters, since the object doesn't need to store the number of
2390 * kjs/JSGlobalObject.cpp:
2391 (JSC::JSGlobalObject::reset): Removed unnecessary clearing left over from when we
2392 used this on objects that weren't brand new. These days, this function is really
2393 just part of the constructor.
2395 * kjs/JSGlobalObject.h: Added registerArraySize to JSGlobalObjectData, since
2396 JSVariableObjectData no longer needs it. Added a setRegisters override here
2397 that handles storing the size.
2399 * kjs/JSStaticScopeObject.h: Removed code to set registerArraySize, since it
2402 * kjs/JSVariableObject.cpp: Moved copyRegisterArray and setRegisters to the
2403 header to make them inline.
2404 * kjs/JSVariableObject.h: Removed registerArraySize from JSVariableObjectData,
2405 since it was only used for the global object.
2406 (JSC::JSVariableObject::copyRegisterArray): Moved here ot make it inline.
2407 (JSC::JSVariableObject::setRegisters): Moved here to make it inline. Also
2408 removed the code to set registerArraySize and changed an if statement into
2409 an assert to save an unnnecessary branch.
2411 2008-09-24 Maciej Stachowiak <mjs@apple.com>
2413 Reviewed by Oliver Hunt.
2415 - inline PropertyMap::getOffset to speed up polymorphic lookups
2417 ~1.5% speedup on v8 benchmark
2418 no effect on SunSpider
2420 * JavaScriptCore.exp:
2421 * kjs/PropertyMap.cpp:
2422 * kjs/PropertyMap.h:
2423 (JSC::PropertyMap::getOffset):
2425 2008-09-24 Jan Michael Alonzo <jmalonzo@webkit.org>
2427 Reviewed by Alp Toker.
2429 https://bugs.webkit.org/show_bug.cgi?id=20992
2430 Build fails on GTK+ Mac OS
2432 * wtf/ThreadingGtk.cpp: Remove platform ifdef as suggested by
2434 (WTF::initializeThreading):
2436 2008-09-23 Oliver Hunt <oliver@apple.com>
2438 Reviewed by Maciej Stachowiak.
2440 Bug 19968: Slow Script at www.huffingtonpost.com
2441 <https://bugs.webkit.org/show_bug.cgi?id=19968>
2443 Finally found the cause of this accursed issue. It is triggered
2444 by synchronous creation of a new global object from JS. The new
2445 global object resets the timer state in this execution group's
2446 Machine, taking timerCheckCount to 0. Then when JS returns the
2447 timerCheckCount is decremented making it non-zero. The next time
2448 we execute JS we will start the timeout counter, however the non-zero
2449 timeoutCheckCount means we don't reset the timer information. This
2450 means that the timeout check is now checking the cumulative time
2451 since the creation of the global object rather than the time since
2452 JS was last entered. At this point the slow script dialog is guaranteed
2453 to eventually be displayed incorrectly unless a page is loaded
2454 asynchronously (which will reset everything into a sane state).
2456 The fix for this is rather trivial -- the JSGlobalObject constructor
2457 should not be resetting the machine timer state.
2460 (JSC::Machine::Machine):
2461 Now that we can't rely on the GlobalObject initialising the timeout
2462 state, we do it in the Machine constructor.
2465 (JSC::Machine::stopTimeoutCheck):
2466 Add assertions to guard against this happening.
2468 * kjs/JSGlobalObject.cpp:
2469 (JSC::JSGlobalObject::init):
2470 Don't reset the timeout state.
2472 2008-09-23 Geoffrey Garen <ggaren@apple.com>
2474 Reviewed by Oliver Hunt.
2476 Fixed https://bugs.webkit.org/show_bug.cgi?id=21038 | <rdar://problem/6240812>
2477 Uncaught exceptions in regex replace callbacks crash webkit
2479 This was a combination of two problems:
2481 (1) the replace function would continue execution after an exception
2484 (2) In some cases, the Machine would return 0 in the case of an exception,
2485 despite the fact that a few clients dereference the Machine's return
2486 value without first checking for an exception.
2489 (JSC::Machine::execute):
2491 ^ Return jsNull() instead of 0 in the case of an exception, since some
2492 clients depend on using our return value.
2494 ^ ASSERT that execution does not continue after an exception has been
2495 thrown, to help catch problems like this in the future.
2497 * kjs/StringPrototype.cpp:
2498 (JSC::stringProtoFuncReplace):
2500 ^ Stop execution if an exception has been thrown.
2502 2008-09-23 Geoffrey Garen <ggaren@apple.com>
2504 Try to fix the windows build.
2507 (JSC::CTI::compileOpCall):
2508 (JSC::CTI::privateCompileMainPass):
2510 2008-09-23 Alp Toker <alp@nuanti.com>
2516 2008-09-23 Geoffrey Garen <ggaren@apple.com>
2518 Reviewed by Darin Adler.
2520 * wtf/Platform.h: Removed duplicate #if.
2522 2008-09-23 Geoffrey Garen <ggaren@apple.com>
2524 Reviewed by Darin Adler.
2526 Changed the layout of the call frame from
2528 { header, parameters, locals | constants, temporaries }
2532 { parameters, header | locals, constants, temporaries }
2534 This simplifies function entry+exit, and enables a number of future
2537 13.5% speedup on empty call benchmark for bytecode; 23.6% speedup on
2538 empty call benchmark for CTI.
2540 SunSpider says no change. SunSpider --v8 says 1% faster.
2544 Added a bit of abstraction for calculating whether a register is a
2545 constant, since this patch changes that calculation:
2546 (JSC::CTI::isConstant):
2547 (JSC::CTI::getConstant):
2548 (JSC::CTI::emitGetArg):
2549 (JSC::CTI::emitGetPutArg):
2550 (JSC::CTI::getConstantImmediateNumericArg):
2552 Updated for changes to callframe header location:
2553 (JSC::CTI::emitPutToCallFrameHeader):
2554 (JSC::CTI::emitGetFromCallFrameHeader):
2555 (JSC::CTI::printOpcodeOperandTypes):
2557 Renamed to spite Oliver:
2558 (JSC::CTI::emitInitRegister):
2560 Added an abstraction for emitting a call through a register, so that
2561 calls through registers generate exception info, too:
2562 (JSC::CTI::emitCall):
2564 Updated to match the new callframe header layout, and to support calls
2565 through registers, which have no destination address:
2566 (JSC::CTI::compileOpCall):
2567 (JSC::CTI::privateCompileMainPass):
2568 (JSC::CTI::privateCompileSlowCases):
2569 (JSC::CTI::privateCompile):
2574 (JSC::CallRecord::CallRecord):
2578 Updated for new register layout:
2579 (JSC::registerName):
2580 (JSC::CodeBlock::dump):
2584 Updated CodeBlock to track slightly different information about the
2585 register frame, and tweaked the style of an ASSERT_NOT_REACHED.
2586 (JSC::CodeBlock::CodeBlock):
2587 (JSC::CodeBlock::getStubInfo):
2589 * VM/CodeGenerator.cpp:
2591 Added some abstraction around constant register allocation, since this
2592 patch changes it, changed codegen to account for the new callframe
2593 layout, and added abstraction around register fetching code
2594 that used to assume that all local registers lived at negative indices,
2595 since vars now live at positive indices:
2596 (JSC::CodeGenerator::generate):
2597 (JSC::CodeGenerator::addVar):
2598 (JSC::CodeGenerator::addGlobalVar):
2599 (JSC::CodeGenerator::allocateConstants):
2600 (JSC::CodeGenerator::CodeGenerator):
2601 (JSC::CodeGenerator::addParameter):
2602 (JSC::CodeGenerator::registerFor):
2603 (JSC::CodeGenerator::constRegisterFor):
2604 (JSC::CodeGenerator::newRegister):
2605 (JSC::CodeGenerator::newTemporary):
2606 (JSC::CodeGenerator::highestUsedRegister):
2607 (JSC::CodeGenerator::addConstant):
2609 ASSERT that our caller referenced the registers it passed to us.
2610 Otherwise, we might overwrite them with parameters:
2611 (JSC::CodeGenerator::emitCall):
2612 (JSC::CodeGenerator::emitConstruct):
2614 * VM/CodeGenerator.h:
2616 Added some abstraction for getting a RegisterID for a given index,
2617 since the rules are a little weird:
2618 (JSC::CodeGenerator::registerFor):
2622 Utility function to transform a machine return PC to a virtual machine
2623 return VPC, for the sake of stack unwinding, since both PCs are stored
2624 in the same location now:
2627 Tweaked to account for new call frame:
2628 (JSC::Machine::initializeCallFrame):
2630 Tweaked to account for registerOffset supplied by caller:
2631 (JSC::slideRegisterWindowForCall):
2633 Tweaked to account for new register layout:
2634 (JSC::scopeChainForCall):
2635 (JSC::Machine::callEval):
2636 (JSC::Machine::dumpRegisters):
2637 (JSC::Machine::unwindCallFrame):
2638 (JSC::Machine::execute):
2640 Changed op_call and op_construct to implement the new calling convention:
2641 (JSC::Machine::privateExecute):
2643 Tweaked to account for the new register layout:
2644 (JSC::Machine::retrieveArguments):
2645 (JSC::Machine::retrieveCaller):
2646 (JSC::Machine::retrieveLastCaller):
2647 (JSC::Machine::callFrame):
2648 (JSC::Machine::getArgumentsData):
2650 Changed CTI call helpers to implement the new calling convention:
2651 (JSC::Machine::cti_op_call_JSFunction):
2652 (JSC::Machine::cti_op_call_NotJSFunction):
2653 (JSC::Machine::cti_op_ret_activation):
2654 (JSC::Machine::cti_op_ret_profiler):
2655 (JSC::Machine::cti_op_construct_JSConstruct):
2656 (JSC::Machine::cti_op_construct_NotJSConstruct):
2657 (JSC::Machine::cti_op_call_eval):
2663 Renamed op_initialise_locals to op_init, because this opcode
2664 doesn't initialize all locals, and it doesn't initialize only locals.
2665 Also, to spite Oliver.
2667 * VM/RegisterFile.h:
2669 New call frame enumeration values:
2670 (JSC::RegisterFile::):
2672 Simplified the calculation of whether a RegisterID is a temporary,
2673 since we can no longer assume that all positive non-constant registers
2676 (JSC::RegisterID::RegisterID):
2677 (JSC::RegisterID::setTemporary):
2678 (JSC::RegisterID::isTemporary):
2680 Renamed firstArgumentIndex to firstParameterIndex because the assumption
2681 that this variable pertained to the actual arguments supplied by the
2682 caller caused me to write some buggy code:
2683 * kjs/Arguments.cpp:
2684 (JSC::ArgumentsData::ArgumentsData):
2685 (JSC::Arguments::Arguments):
2686 (JSC::Arguments::fillArgList):
2687 (JSC::Arguments::getOwnPropertySlot):
2688 (JSC::Arguments::put):
2690 Updated for new call frame layout:
2691 * kjs/DebuggerCallFrame.cpp:
2692 (JSC::DebuggerCallFrame::functionName):
2693 (JSC::DebuggerCallFrame::type):
2694 * kjs/DebuggerCallFrame.h:
2696 Changed the activation object to account for the fact that a call frame
2697 header now sits between parameters and local variables. This change
2698 requires all variable objects to do their own marking, since they
2699 now use their register storage differently:
2700 * kjs/JSActivation.cpp:
2701 (JSC::JSActivation::mark):
2702 (JSC::JSActivation::copyRegisters):
2703 (JSC::JSActivation::createArgumentsObject):
2704 * kjs/JSActivation.h:
2706 Updated global object to use the new interfaces required by the change
2707 to JSActivation above:
2708 * kjs/JSGlobalObject.cpp:
2709 (JSC::JSGlobalObject::reset):
2710 (JSC::JSGlobalObject::mark):
2711 (JSC::JSGlobalObject::copyGlobalsFrom):
2712 (JSC::JSGlobalObject::copyGlobalsTo):
2713 * kjs/JSGlobalObject.h:
2714 (JSC::JSGlobalObject::addStaticGlobals):
2716 Updated static scope object to use the new interfaces required by the
2717 change to JSActivation above:
2718 * kjs/JSStaticScopeObject.cpp:
2719 (JSC::JSStaticScopeObject::mark):
2720 (JSC::JSStaticScopeObject::~JSStaticScopeObject):
2721 * kjs/JSStaticScopeObject.h:
2722 (JSC::JSStaticScopeObject::JSStaticScopeObject):
2723 (JSC::JSStaticScopeObject::d):
2725 Updated variable object to use the new interfaces required by the
2726 change to JSActivation above:
2727 * kjs/JSVariableObject.cpp:
2728 (JSC::JSVariableObject::copyRegisterArray):
2729 (JSC::JSVariableObject::setRegisters):
2730 * kjs/JSVariableObject.h:
2732 Changed the bit twiddling in symbol table not to assume that all indices
2733 are negative, since they can be positive now:
2734 * kjs/SymbolTable.h:
2735 (JSC::SymbolTableEntry::SymbolTableEntry):
2736 (JSC::SymbolTableEntry::isNull):
2737 (JSC::SymbolTableEntry::getIndex):
2738 (JSC::SymbolTableEntry::getAttributes):
2739 (JSC::SymbolTableEntry::setAttributes):
2740 (JSC::SymbolTableEntry::isReadOnly):
2741 (JSC::SymbolTableEntry::pack):
2742 (JSC::SymbolTableEntry::isValidIndex):
2744 Changed call and construct nodes to ref their functions and/or bases,
2745 so that emitCall/emitConstruct doesn't overwrite them with parameters.
2746 Also, updated for rename to registerFor:
2748 (JSC::ResolveNode::emitCode):
2749 (JSC::NewExprNode::emitCode):
2750 (JSC::EvalFunctionCallNode::emitCode):
2751 (JSC::FunctionCallValueNode::emitCode):
2752 (JSC::FunctionCallResolveNode::emitCode):
2753 (JSC::FunctionCallBracketNode::emitCode):
2754 (JSC::FunctionCallDotNode::emitCode):
2755 (JSC::PostfixResolveNode::emitCode):
2756 (JSC::DeleteResolveNode::emitCode):
2757 (JSC::TypeOfResolveNode::emitCode):
2758 (JSC::PrefixResolveNode::emitCode):
2759 (JSC::ReadModifyResolveNode::emitCode):
2760 (JSC::AssignResolveNode::emitCode):
2761 (JSC::ConstDeclNode::emitCodeSingle):
2762 (JSC::ForInNode::emitCode):
2764 Added abstraction for getting exception info out of a call through a
2766 * masm/X86Assembler.h:
2767 (JSC::X86Assembler::emitCall):
2769 Removed duplicate #if:
2772 2008-09-23 Kevin McCullough <kmccullough@apple.com>
2776 Bug 21030: The JS debugger breaks on the do of a do-while not the while
2777 (where the conditional statement is)
2778 https://bugs.webkit.org/show_bug.cgi?id=21030
2779 Now the statementListEmitCode detects if a do-while node is being
2780 emited and emits the debug hook on the last line instead of the first.
2782 This change had no effect on sunspider.
2785 (JSC::statementListEmitCode):
2787 (JSC::StatementNode::isDoWhile):
2788 (JSC::DoWhileNode::isDoWhile):
2790 2008-09-23 Maciej Stachowiak <mjs@apple.com>
2792 Reviewed by Camron Zwarich.
2794 - inline the fast case of instanceof
2795 https://bugs.webkit.org/show_bug.cgi?id=20818
2797 ~2% speedup on EarleyBoyer test.
2800 (JSC::CTI::privateCompileMainPass):
2801 (JSC::CTI::privateCompileSlowCases):
2803 (JSC::Machine::cti_op_instanceof):
2805 2008-09-23 Maciej Stachowiak <mjs@apple.com>
2807 Reviewed by Cameron Zwarich.
2809 - add forgotten slow case logic for !==
2812 (JSC::CTI::privateCompileSlowCases):
2814 2008-09-23 Maciej Stachowiak <mjs@apple.com>
2816 Reviewed by Cameron Zwarich.
2818 - inline the fast cases of !==, same as for ===
2820 2.9% speedup on EarleyBoyer benchmark
2823 (JSC::CTI::compileOpStrictEq): Factored stricteq codegen into this function,
2824 and parameterized so it can do the reverse version as well.
2825 (JSC::CTI::privateCompileMainPass): Use the above for stricteq and nstricteq.
2827 (JSC::CTI::): Declare above stuff.
2829 (JSC::Machine::cti_op_nstricteq): Removed fast cases, now handled inline.
2831 2008-09-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2833 Reviewed by Oliver Hunt.
2835 Bug 20989: Aguments constructor should put 'callee' and 'length' properties in a more efficient way
2836 <https://bugs.webkit.org/show_bug.cgi?id=20989>
2838 Make special cases for the 'callee' and 'length' properties in the
2841 This is somewhere between a 7.8% speedup and a 10% speedup on the V8
2842 Raytrace benchmark, depending on whether it is run alone or with the
2843 other V8 benchmarks.
2845 * kjs/Arguments.cpp:
2846 (JSC::ArgumentsData::ArgumentsData):
2847 (JSC::Arguments::Arguments):
2848 (JSC::Arguments::mark):
2849 (JSC::Arguments::getOwnPropertySlot):
2850 (JSC::Arguments::put):
2851 (JSC::Arguments::deleteProperty):
2853 2008-09-23 Maciej Stachowiak <mjs@apple.com>
2857 - speed up instanceof some more
2858 https://bugs.webkit.org/show_bug.cgi?id=20818
2860 ~2% speedup on EarleyBoyer
2862 The idea here is to record in the StructureID whether the class
2863 needs a special hasInstance or if it can use the normal logic from
2866 Based on this I inlined the real work directly into
2867 cti_op_instanceof and put the fastest checks up front and the
2868 error handling at the end (so it should be fairly straightforward
2869 to split off the beginning to be inlined if desired).
2871 I only did this for CTI, not the bytecode interpreter.
2873 * API/JSCallbackObject.h:
2874 (JSC::JSCallbackObject::createStructureID):
2877 (JSC::Machine::cti_op_instanceof):
2878 * kjs/JSImmediate.h:
2879 (JSC::JSImmediate::isAnyImmediate):
2881 (JSC::TypeInfo::overridesHasInstance):
2882 (JSC::TypeInfo::flags):
2884 2008-09-22 Darin Adler <darin@apple.com>
2886 Reviewed by Sam Weinig.
2888 - https://bugs.webkit.org/show_bug.cgi?id=21019
2889 make FunctionBodyNode::ref/deref fast
2891 Speeds up v8-raytrace by 7.2%.
2894 (JSC::FunctionBodyNode::FunctionBodyNode): Initialize m_refCount to 0.
2896 (JSC::FunctionBodyNode::ref): Call base class ref once, and thereafter use
2898 (JSC::FunctionBodyNode::deref): Ditto, but the deref side.
2900 2008-09-22 Darin Adler <darin@apple.com>
2902 Pointed out by Sam Weinig.
2904 * kjs/Arguments.cpp:
2905 (JSC::Arguments::fillArgList): Fix bad copy and paste. Oops!
2907 2008-09-22 Darin Adler <darin@apple.com>
2909 Reviewed by Cameron Zwarich.
2911 - https://bugs.webkit.org/show_bug.cgi?id=20983
2912 ArgumentsData should have some room to allocate some extra arguments inline
2914 Speeds up v8-raytrace by 5%.
2916 * kjs/Arguments.cpp:
2917 (JSC::ArgumentsData::ArgumentsData): Use a fixed buffer if there are 4 or fewer
2919 (JSC::Arguments::Arguments): Use a fixed buffer if there are 4 or fewer
2921 (JSC::Arguments::~Arguments): Delete the buffer if necessary.
2922 (JSC::Arguments::mark): Update since extraArguments are now Register.
2923 (JSC::Arguments::fillArgList): Added special case for the only case that's
2924 actually used in the practice, when there are no parameters. There are some
2925 other special cases in there too, but that's the only one that matters.
2926 (JSC::Arguments::getOwnPropertySlot): Updated to use setValueSlot since there's
2927 no operation to get you at the JSValue* inside a Register as a "slot".
2929 2008-09-22 Sam Weinig <sam@webkit.org>
2931 Reviewed by Maciej Stachowiak.
2933 Patch for https://bugs.webkit.org/show_bug.cgi?id=21014
2934 Speed up for..in by using StructureID to avoid calls to hasProperty
2936 Speeds up fasta by 8%.
2938 * VM/JSPropertyNameIterator.cpp:
2939 (JSC::JSPropertyNameIterator::invalidate):
2940 * VM/JSPropertyNameIterator.h:
2941 (JSC::JSPropertyNameIterator::next):
2942 * kjs/PropertyNameArray.h:
2943 (JSC::PropertyNameArrayData::begin):
2944 (JSC::PropertyNameArrayData::end):
2945 (JSC::PropertyNameArrayData::setCachedStructureID):
2946 (JSC::PropertyNameArrayData::cachedStructureID):
2947 * kjs/StructureID.cpp:
2948 (JSC::StructureID::getEnumerablePropertyNames):
2949 (JSC::structureIDChainsAreEqual):
2950 * kjs/StructureID.h:
2952 2008-09-22 Kelvin Sherlock <ksherlock@gmail.com>
2954 Updated and tweaked by Sam Weinig.
2956 Reviewed by Geoffrey Garen.
2958 Bug 20020: Proposed enhancement to JavaScriptCore API
2959 <https://bugs.webkit.org/show_bug.cgi?id=20020>
2961 Add JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError, and JSObjectMakeRegExp
2962 functions to create JavaScript Array, Date, Error, and RegExp objects, respectively.
2964 * API/JSObjectRef.cpp: The functions
2965 * API/JSObjectRef.h: Function prototype and documentation
2966 * JavaScriptCore.exp: Added functions to exported function list
2967 * API/tests/testapi.c: Added basic functionality tests.
2969 * kjs/DateConstructor.cpp:
2970 Replaced static JSObject* constructDate(ExecState* exec, JSObject*, const ArgList& args)
2971 with JSObject* constructDate(ExecState* exec, const ArgList& args).
2972 Added static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) function
2974 * kjs/DateConstructor.h:
2975 added prototype for JSObject* constructDate(ExecState* exec, const ArgList& args)
2977 * kjs/ErrorConstructor.cpp:
2978 removed static qualifier from ErrorInstance* constructError(ExecState* exec, const ArgList& args)
2980 * kjs/ErrorConstructor.h:
2981 added prototype for ErrorInstance* constructError(ExecState* exec, const ArgList& args)
2983 * kjs/RegExpConstructor.cpp:
2984 removed static qualifier from JSObject* constructRegExp(ExecState* exec, const ArgList& args)
2986 * kjs/RegExpConstructor.h:
2987 added prototype for JSObject* constructRegExp(ExecState* exec, const ArgList& args)
2989 2008-09-22 Matt Lilek <webkit@mattlilek.com>
2991 Not reviewed, Windows build fix.
2993 * kjs/Arguments.cpp:
2994 * kjs/FunctionPrototype.cpp:
2996 2008-09-22 Sam Weinig <sam@webkit.org>
2998 Reviewed by Darin Adler.
3000 Patch for https://bugs.webkit.org/show_bug.cgi?id=20982
3001 Speed up the apply method of functions by special-casing array and 'arguments' objects
3003 1% speedup on v8-raytrace.
3005 Test: fast/js/function-apply.html
3007 * kjs/Arguments.cpp:
3008 (JSC::Arguments::fillArgList):
3010 * kjs/FunctionPrototype.cpp:
3011 (JSC::functionProtoFuncApply):
3013 (JSC::JSArray::fillArgList):
3016 2008-09-22 Darin Adler <darin@apple.com>
3018 Reviewed by Sam Weinig.
3020 - https://bugs.webkit.org/show_bug.cgi?id=20993
3021 Array.push/pop need optimized cases for JSArray
3023 3% or so speedup on DeltaBlue benchmark.
3025 * kjs/ArrayPrototype.cpp:
3026 (JSC::arrayProtoFuncPop): Call JSArray::pop when appropriate.
3027 (JSC::arrayProtoFuncPush): Call JSArray::push when appropriate.
3030 (JSC::JSArray::putSlowCase): Set m_fastAccessCutoff when appropriate, getting
3031 us into the fast code path.
3032 (JSC::JSArray::pop): Added.
3033 (JSC::JSArray::push): Added.
3034 * kjs/JSArray.h: Added push and pop.
3036 * kjs/operations.cpp:
3037 (JSC::throwOutOfMemoryError): Don't inline this. Helps us avoid PIC branches.
3039 2008-09-22 Maciej Stachowiak <mjs@apple.com>
3041 Reviewed by Cameron Zwarich.
3043 - speed up instanceof operator by replacing implementsHasInstance method with a TypeInfo flag
3045 Partial work towards <https://bugs.webkit.org/show_bug.cgi?id=20818>
3047 2.2% speedup on EarleyBoyer benchmark.
3049 * API/JSCallbackConstructor.cpp:
3050 * API/JSCallbackConstructor.h:
3051 (JSC::JSCallbackConstructor::createStructureID):
3052 * API/JSCallbackFunction.cpp:
3053 * API/JSCallbackFunction.h:
3054 (JSC::JSCallbackFunction::createStructureID):
3055 * API/JSCallbackObject.h:
3056 (JSC::JSCallbackObject::createStructureID):
3057 * API/JSCallbackObjectFunctions.h:
3058 (JSC::::hasInstance):
3059 * API/JSValueRef.cpp:
3060 (JSValueIsInstanceOfConstructor):
3061 * JavaScriptCore.exp:
3063 (JSC::Machine::privateExecute):
3064 (JSC::Machine::cti_op_instanceof):
3065 * kjs/InternalFunction.cpp:
3066 * kjs/InternalFunction.h:
3067 (JSC::InternalFunction::createStructureID):
3071 (JSC::TypeInfo::implementsHasInstance):
3073 2008-09-22 Maciej Stachowiak <mjs@apple.com>
3075 Reviewed by Dave Hyatt.
3077 Based on initial work by Darin Adler.
3079 - replace masqueradesAsUndefined virtual method with a flag in TypeInfo
3080 - use this to JIT inline code for eq_null and neq_null
3081 https://bugs.webkit.org/show_bug.cgi?id=20823
3083 0.5% speedup on SunSpider
3084 ~4% speedup on Richards benchmark
3087 (JSC::CTI::privateCompileMainPass):
3089 (JSC::jsTypeStringForValue):
3090 (JSC::jsIsObjectType):
3091 (JSC::Machine::privateExecute):
3092 (JSC::Machine::cti_op_is_undefined):
3096 * kjs/StringObjectThatMasqueradesAsUndefined.h:
3097 (JSC::StringObjectThatMasqueradesAsUndefined::create):
3098 (JSC::StringObjectThatMasqueradesAsUndefined::createStructureID):
3099 * kjs/StructureID.h:
3100 (JSC::StructureID::mutableTypeInfo):
3102 (JSC::TypeInfo::TypeInfo):
3103 (JSC::TypeInfo::masqueradesAsUndefined):
3104 * kjs/operations.cpp:
3106 * masm/X86Assembler.h:
3107 (JSC::X86Assembler::):
3108 (JSC::X86Assembler::setne_r):
3109 (JSC::X86Assembler::setnz_r):
3110 (JSC::X86Assembler::testl_i32m):
3112 2008-09-22 Tor Arne Vestbø <tavestbo@trolltech.com>
3116 Initialize QCoreApplication in kjs binary/Shell.cpp
3118 This allows us to use QCoreApplication::instance() to
3119 get the main thread in ThreadingQt.cpp
3123 * wtf/ThreadingQt.cpp:
3124 (WTF::initializeThreading):
3126 2008-09-21 Darin Adler <darin@apple.com>
3128 - blind attempt to fix non-all-in-one builds
3130 * kjs/JSGlobalObject.cpp: Added includes of Arguments.h and RegExpObject.h.
3132 2008-09-21 Darin Adler <darin@apple.com>
3136 * kjs/StructureID.cpp:
3137 (JSC::StructureID::addPropertyTransition): Use typeInfo().type() instead of m_type.
3138 (JSC::StructureID::createCachedPrototypeChain): Ditto.
3140 2008-09-21 Maciej Stachowiak <mjs@apple.com>
3142 Reviewed by Darin Adler.
3144 - introduce a TypeInfo class, for holding per-type (in the C++ class sense) date in StructureID
3145 https://bugs.webkit.org/show_bug.cgi?id=20981
3147 * JavaScriptCore.exp:
3148 * JavaScriptCore.xcodeproj/project.pbxproj:
3150 (JSC::CTI::privateCompileMainPass):
3151 (JSC::CTI::privateCompilePutByIdTransition):
3153 (JSC::jsIsObjectType):
3154 (JSC::Machine::Machine):
3155 * kjs/AllInOneFile.cpp:
3157 (JSC::JSCell::isObject):
3158 (JSC::JSCell::isString):
3159 * kjs/JSGlobalData.cpp:
3160 (JSC::JSGlobalData::JSGlobalData):
3161 * kjs/JSGlobalObject.cpp:
3162 (JSC::JSGlobalObject::reset):
3163 * kjs/JSGlobalObject.h:
3164 (JSC::StructureID::prototypeForLookup):
3165 * kjs/JSNumberCell.h:
3166 (JSC::JSNumberCell::createStructureID):
3168 (JSC::JSObject::createInheritorID):
3170 (JSC::JSObject::createStructureID):
3172 (JSC::JSString::createStructureID):
3173 * kjs/NativeErrorConstructor.cpp:
3174 (JSC::NativeErrorConstructor::NativeErrorConstructor):
3175 * kjs/RegExpConstructor.cpp:
3176 * kjs/RegExpMatchesArray.h: Added.
3177 (JSC::RegExpMatchesArray::getOwnPropertySlot):
3178 (JSC::RegExpMatchesArray::put):
3179 (JSC::RegExpMatchesArray::deleteProperty):
3180 (JSC::RegExpMatchesArray::getPropertyNames):
3181 * kjs/StructureID.cpp:
3182 (JSC::StructureID::StructureID):
3183 (JSC::StructureID::addPropertyTransition):
3184 (JSC::StructureID::toDictionaryTransition):
3185 (JSC::StructureID::changePrototypeTransition):
3186 (JSC::StructureID::getterSetterTransition):
3187 * kjs/StructureID.h:
3188 (JSC::StructureID::create):
3189 (JSC::StructureID::typeInfo):
3190 * kjs/TypeInfo.h: Added.
3191 (JSC::TypeInfo::TypeInfo):
3192 (JSC::TypeInfo::type):
3194 2008-09-21 Darin Adler <darin@apple.com>
3196 Reviewed by Cameron Zwarich.
3198 - fix crash logging into Gmail due to recent Arguments change
3200 * kjs/Arguments.cpp:
3201 (JSC::Arguments::Arguments): Fix window where mark() function could
3202 see d->extraArguments with uninitialized contents.
3203 (JSC::Arguments::mark): Check d->extraArguments for 0 to handle two
3204 cases: 1) Inside the constructor before it's initialized.
3205 2) numArguments <= numParameters.
3207 2008-09-21 Darin Adler <darin@apple.com>
3209 - fix loose end from the "duplicate constant values" patch
3211 * VM/CodeGenerator.cpp:
3212 (JSC::CodeGenerator::emitLoad): Add a special case for values the
3213 hash table can't handle.
3215 2008-09-21 Mark Rowe <mrowe@apple.com>
3217 Fix the non-AllInOneFile build.
3219 * kjs/Arguments.cpp: Add missing #include.
3221 2008-09-21 Darin Adler <darin@apple.com>
3223 Reviewed by Cameron Zwarich and Mark Rowe.
3225 - fix test failure caused by my recent IndexToNameMap patch
3227 * kjs/Arguments.cpp:
3228 (JSC::Arguments::deleteProperty): Added the accidentally-omitted
3229 check of the boolean result from toArrayIndex.
3231 2008-09-21 Darin Adler <darin@apple.com>
3233 Reviewed by Maciej Stachowiak.
3235 - https://bugs.webkit.org/show_bug.cgi?id=20975
3236 inline immediate-number case of ==
3238 * VM/CTI.h: Renamed emitJumpSlowCaseIfNotImm to
3239 emitJumpSlowCaseIfNotImmNum, since the old name was incorrect.
3241 * VM/CTI.cpp: Updated for new name.
3242 (JSC::CTI::privateCompileMainPass): Added op_eq.
3243 (JSC::CTI::privateCompileSlowCases): Added op_eq.
3246 (JSC::Machine::cti_op_eq): Removed fast case, since it's now
3249 2008-09-21 Peter Gal <galpter@inf.u-szeged.hu>
3251 Reviewed by Tim Hatcher and Eric Seidel.
3253 Fix the QT/Linux JavaScriptCore segmentation fault.
3254 https://bugs.webkit.org/show_bug.cgi?id=20914
3256 * wtf/ThreadingQt.cpp:
3257 (WTF::initializeThreading): Use currentThread() if
3258 platform is not a MAC (like in pre 36541 revisions)
3260 2008-09-21 Darin Adler <darin@apple.com>
3262 Reviewed by Sam Weinig.
3264 * kjs/debugger.h: Removed some unneeded includes and declarations.
3266 2008-09-21 Darin Adler <darin@apple.com>
3268 Reviewed by Sam Weinig.
3270 - https://bugs.webkit.org/show_bug.cgi?id=20972
3271 speed up Arguments further by eliminating the IndexToNameMap
3273 No change on SunSpider. 1.29x as fast on V8 Raytrace.
3275 * kjs/Arguments.cpp: Moved ArgumentsData in here. Eliminated the
3276 indexToNameMap and hadDeletes data members. Changed extraArguments into
3277 an OwnArrayPtr and added deletedArguments, another OwnArrayPtr.
3278 Replaced numExtraArguments with numParameters, since that's what's
3279 used more directly in hot code paths.
3280 (JSC::Arguments::Arguments): Pass in argument count instead of ArgList.
3281 Initialize ArgumentsData the new way.
3282 (JSC::Arguments::mark): Updated.
3283 (JSC::Arguments::getOwnPropertySlot): Overload for the integer form so
3284 we don't have to convert integers to identifiers just to get an argument.
3285 Integrated the deleted case with the fast case.
3286 (JSC::Arguments::put): Ditto.
3287 (JSC::Arguments::deleteProperty): Ditto.
3289 * kjs/Arguments.h: Minimized includes. Made everything private. Added
3290 overloads for the integral property name case. Eliminated mappedIndexSetter.
3291 Moved ArgumentsData into the .cpp file.
3293 * kjs/IndexToNameMap.cpp: Emptied out and prepared for deletion.
3294 * kjs/IndexToNameMap.h: Ditto.
3296 * kjs/JSActivation.cpp:
3297 (JSC::JSActivation::createArgumentsObject): Elminated ArgList.
3300 * JavaScriptCore.pri:
3301 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3302 * JavaScriptCore.xcodeproj/project.pbxproj:
3303 * JavaScriptCoreSources.bkl:
3304 * kjs/AllInOneFile.cpp:
3305 Removed IndexToNameMap.
3307 2008-09-21 Darin Adler <darin@apple.com>
3309 * VM/CodeGenerator.cpp:
3310 (JSC::CodeGenerator::emitLoad): One more tweak: Wrote this in a slightly
3313 2008-09-21 Judit Jasz <jasy@inf.u-szeged.hu>
3315 Reviewed and tweaked by Darin Adler.
3317 - https://bugs.webkit.org/show_bug.cgi?id=20645
3318 Elminate duplicate constant values in CodeBlocks.
3320 Seems to be a wash on SunSpider.
3322 * VM/CodeGenerator.cpp:
3323 (JSC::CodeGenerator::emitLoad): Use m_numberMap and m_stringMap to guarantee
3324 we emit the same JSValue* for identical numbers and strings.
3325 * VM/CodeGenerator.h: Added overload of emitLoad for const Identifier&.
3326 Add NumberMap and IdentifierStringMap types and m_numberMap and m_stringMap.
3328 (JSC::StringNode::emitCode): Call the new emitLoad and let it do the
3331 2008-09-21 Paul Pedriana <webkit@pedriana.com>
3333 Reviewed and tweaked by Darin Adler.
3335 - https://bugs.webkit.org/show_bug.cgi?id=16925
3336 Fixed lack of Vector buffer alignment for both GCC and MSVC.
3337 Since there's no portable way to do this, for now we don't support
3340 * wtf/Vector.h: Added WTF_ALIGH_ON, WTF_ALIGNED, AlignedBufferChar, and AlignedBuffer.
3341 Use AlignedBuffer insteadof an array of char in VectorBuffer.
3343 2008-09-21 Gabor Loki <loki@inf.u-szeged.hu>
3345 Reviewed by Darin Adler.
3347 - https://bugs.webkit.org/show_bug.cgi?id=19408
3348 Add lightweight constant folding to the parser for *, /, + (only for numbers), <<, >>, ~ operators.
3350 1.008x as fast on SunSpider.
3353 (makeNegateNode): Fold if expression is a number > 0.
3354 (makeBitwiseNotNode): Fold if expression is a number.
3355 (makeMultNode): Fold if expressions are both numbers.
3356 (makeDivNode): Fold if expressions are both numbers.
3357 (makeAddNode): Fold if expressions are both numbers.
3358 (makeLeftShiftNode): Fold if expressions are both numbers.
3359 (makeRightShiftNode): Fold if expressions are both numbers.
3361 2008-09-21 Maciej Stachowiak <mjs@apple.com>
3365 - speed up === operator by generating inline machine code for the fast paths
3366 https://bugs.webkit.org/show_bug.cgi?id=20820
3369 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumber):
3370 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumbers):
3371 (JSC::CTI::emitJumpSlowCaseIfNotImmediates):
3372 (JSC::CTI::emitTagAsBoolImmediate):
3373 (JSC::CTI::privateCompileMainPass):
3374 (JSC::CTI::privateCompileSlowCases):
3377 (JSC::Machine::cti_op_stricteq):
3378 * masm/X86Assembler.h:
3379 (JSC::X86Assembler::):
3380 (JSC::X86Assembler::sete_r):
3381 (JSC::X86Assembler::setz_r):
3382 (JSC::X86Assembler::movzbl_rr):
3383 (JSC::X86Assembler::emitUnlinkedJnz):
3385 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3387 Reviewed by Maciej Stachowiak.
3389 Free memory allocated for extra arguments in the destructor of the
3392 * kjs/Arguments.cpp:
3393 (JSC::Arguments::~Arguments):
3396 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3398 Reviewed by Maciej Stachowiak.
3400 Bug 20815: 'arguments' object creation is non-optimal
3401 <https://bugs.webkit.org/show_bug.cgi?id=20815>
3403 Fix our inefficient way of creating the arguments object by only
3404 creating named properties for each of the arguments after a use of the
3405 'delete' statement. This patch also speeds up access to the 'arguments'
3406 object slightly, but it still does not use the array fast path for
3407 indexed access that exists for many opcodes.
3409 This is about a 20% improvement on the V8 Raytrace benchmark, and a 1.5%
3410 improvement on the Earley-Boyer benchmark, which gives a 4% improvement
3413 * kjs/Arguments.cpp:
3414 (JSC::Arguments::Arguments):
3415 (JSC::Arguments::mark):
3416 (JSC::Arguments::getOwnPropertySlot):
3417 (JSC::Arguments::put):
3418 (JSC::Arguments::deleteProperty):
3420 (JSC::Arguments::ArgumentsData::ArgumentsData):
3421 * kjs/IndexToNameMap.h:
3422 (JSC::IndexToNameMap::size):
3423 * kjs/JSActivation.cpp:
3424 (JSC::JSActivation::createArgumentsObject):
3425 * kjs/JSActivation.h:
3426 (JSC::JSActivation::uncheckedSymbolTableGet):
3427 (JSC::JSActivation::uncheckedSymbolTableGetValue):
3428 (JSC::JSActivation::uncheckedSymbolTablePut):
3430 (JSC::JSFunction::numParameters):
3432 2008-09-20 Darin Adler <darin@apple.com>
3434 Reviewed by Mark Rowe.
3436 - fix crash seen on buildbot
3438 * kjs/JSGlobalObject.cpp:
3439 (JSC::JSGlobalObject::mark): Add back mark of arrayPrototype,
3440 deleted by accident in my recent check-in.
3442 2008-09-20 Maciej Stachowiak <mjs@apple.com>
3444 Not reviewed, build fix.
3446 - speculative fix for non-AllInOne builds
3450 2008-09-20 Maciej Stachowiak <mjs@apple.com>
3452 Reviewed by Darin Adler.
3454 - assorted optimizations to === and !== operators
3455 (work towards <https://bugs.webkit.org/show_bug.cgi?id=20820>)
3457 2.5% speedup on earley-boyer test
3460 (JSC::Machine::cti_op_stricteq): Use inline version of
3461 strictEqualSlowCase; remove unneeded exception check.
3462 (JSC::Machine::cti_op_nstricteq): ditto
3463 * kjs/operations.cpp:
3464 (JSC::strictEqual): Use strictEqualSlowCaseInline
3465 (JSC::strictEqualSlowCase): ditto
3467 (JSC::strictEqualSlowCaseInline): Version of strictEqualSlowCase that can be inlined,
3468 since the extra function call indirection is a lose for CTI.
3470 2008-09-20 Darin Adler <darin@apple.com>
3472 Reviewed by Maciej Stachowiak.
3474 - finish https://bugs.webkit.org/show_bug.cgi?id=20858
3475 make each distinct C++ class get a distinct JSC::Structure
3477 This also includes some optimizations that make the change an overall
3478 small speedup. Without those it was a bit of a slowdown.
3480 * API/JSCallbackConstructor.cpp:
3481 (JSC::JSCallbackConstructor::JSCallbackConstructor): Take a structure.
3482 * API/JSCallbackConstructor.h: Ditto.
3483 * API/JSCallbackFunction.cpp:
3484 (JSC::JSCallbackFunction::JSCallbackFunction): Pass a structure.
3485 * API/JSCallbackObject.h: Take a structure.
3486 * API/JSCallbackObjectFunctions.h:
3487 (JSC::JSCallbackObject::JSCallbackObject): Ditto.
3489 * API/JSClassRef.cpp:
3490 (OpaqueJSClass::prototype): Pass in a structure. Call setPrototype
3491 if there's a custom prototype involved.
3492 * API/JSObjectRef.cpp:
3493 (JSObjectMake): Ditto.
3494 (JSObjectMakeConstructor): Pass in a structure.
3496 * JavaScriptCore.exp: Updated.
3499 (JSC::jsLess): Added a special case for when both arguments are strings.
3500 This avoids converting both strings to with UString::toDouble.
3501 (JSC::jsLessEq): Ditto.
3502 (JSC::Machine::privateExecute): Pass in a structure.
3503 (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
3504 (JSC::Machine::cti_op_new_regexp): Ditto.
3505 (JSC::Machine::cti_op_is_string): Ditto.
3506 * VM/Machine.h: Made isJSString public so it can be used in the CTI.
3508 * kjs/Arguments.cpp:
3509 (JSC::Arguments::Arguments): Pass in a structure.
3511 * kjs/JSCell.h: Mark constructor explicit.
3513 * kjs/JSGlobalObject.cpp:
3514 (JSC::markIfNeeded): Added an overload for marking structures.
3515 (JSC::JSGlobalObject::reset): Eliminate code to set data members to
3516 zero. We now do that in the constructor, and we no longer use this
3517 anywhere except in the constructor. Added code to create structures.
3518 Pass structures rather than prototypes when creating objects.
3519 (JSC::JSGlobalObject::mark): Mark the structures.
3521 * kjs/JSGlobalObject.h: Removed unneeded class declarations.
3522 Added initializers for raw pointers in JSGlobalObjectData so
3523 everything starts with a 0. Added structure data and accessor
3526 * kjs/JSImmediate.cpp:
3527 (JSC::JSImmediate::nonInlineNaN): Added.
3528 * kjs/JSImmediate.h:
3529 (JSC::JSImmediate::toDouble): Rewrote to avoid PIC branches.
3531 * kjs/JSNumberCell.cpp:
3532 (JSC::jsNumberCell): Made non-inline to avoid PIC branches
3533 in functions that call this one.
3534 (JSC::jsNaN): Ditto.
3535 * kjs/JSNumberCell.h: Ditto.
3537 * kjs/JSObject.h: Removed constructor that takes a prototype.
3538 All callers now pass structures.
3540 * kjs/ArrayConstructor.cpp:
3541 (JSC::ArrayConstructor::ArrayConstructor):
3542 (JSC::constructArrayWithSizeQuirk):
3543 * kjs/ArrayConstructor.h:
3544 * kjs/ArrayPrototype.cpp:
3545 (JSC::ArrayPrototype::ArrayPrototype):
3546 * kjs/ArrayPrototype.h:
3547 * kjs/BooleanConstructor.cpp:
3548 (JSC::BooleanConstructor::BooleanConstructor):
3549 (JSC::constructBoolean):
3550 (JSC::constructBooleanFromImmediateBoolean):
3551 * kjs/BooleanConstructor.h:
3552 * kjs/BooleanObject.cpp:
3553 (JSC::BooleanObject::BooleanObject):
3554 * kjs/BooleanObject.h:
3555 * kjs/BooleanPrototype.cpp:
3556 (JSC::BooleanPrototype::BooleanPrototype):
3557 * kjs/BooleanPrototype.h:
3558 * kjs/DateConstructor.cpp:
3559 (JSC::DateConstructor::DateConstructor):
3560 (JSC::constructDate):
3561 * kjs/DateConstructor.h:
3562 * kjs/DateInstance.cpp:
3563 (JSC::DateInstance::DateInstance):
3564 * kjs/DateInstance.h:
3565 * kjs/DatePrototype.cpp:
3566 (JSC::DatePrototype::DatePrototype):
3567 * kjs/DatePrototype.h:
3568 * kjs/ErrorConstructor.cpp:
3569 (JSC::ErrorConstructor::ErrorConstructor):
3570 (JSC::constructError):
3571 * kjs/ErrorConstructor.h:
3572 * kjs/ErrorInstance.cpp: