1 2008-10-07 Oliver Hunt <oliver@apple.com>
3 Reviewed by Cameron Zwarich.
5 Switch CTI runtime calls to the fastcall calling convention
7 Basically this means that we get to store the argument for CTI
8 calls in the ECX register, which saves a register->memory write
9 and subsequent memory->register read.
11 This is a 1.7% progression in SunSpider and 2.4% on commandline
16 (JSC::CTI::privateCompilePutByIdTransition):
17 (JSC::CTI::privateCompilePatchGetArrayLength):
20 * masm/X86Assembler.h:
21 (JSC::X86Assembler::emitRestoreArgumentReference):
22 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
23 We need this to correctly reload ecx from inside certain property access
27 2008-10-07 Maciej Stachowiak <mjs@apple.com>
29 Reviewed by Mark Rowe.
31 - optimize away multiplication by constant 1.0
33 2.3% speedup on v8 RayTrace benchmark
35 Apparently it's not uncommon for JavaScript code to multiply by
36 constant 1.0 in the mistaken belief that this converts integer to
37 floating point and that there is any operational difference.
40 (JSC::CTI::privateCompileMainPass): Optimize to_jsnumber for
41 case where parameter is already number.
42 (JSC::CTI::privateCompileSlowCases): ditto
44 (JSC::Machine::privateExecute): ditto
46 (makeMultNode): Transform as follows:
47 +FOO * BAR ==> FOO * BAR
48 FOO * +BAR ==> FOO * BAR
51 (makeDivNode): Transform as follows:
52 +FOO / BAR ==> FOO / BAR
53 FOO / +BAR ==> FOO / BAR
54 (makeSubNode): Transform as follows:
55 +FOO - BAR ==> FOO - BAR
56 FOO - +BAR ==> FOO - BAR
58 (JSC::ExpressionNode::stripUnaryPlus): Helper for above
60 (JSC::UnaryPlusNode::stripUnaryPlus): ditto
62 2008-10-07 Maciej Stachowiak <mjs@apple.com>
64 Reviewed by Oliver Hunt.
66 - make constant folding code more consistent
68 Added a makeSubNode to match add, mult and div; use the makeFooNode functions always,
69 instead of allocating nodes directly in other places in the grammar.
73 2008-10-07 Sam Weinig <sam@webkit.org>
75 Reviewed by Cameron Zwarich.
77 Move hasGetterSetterProperties flag from PropertyMap to StructureID.
81 (JSC::JSObject::defineGetter):
82 (JSC::JSObject::defineSetter):
84 (JSC::JSObject::hasGetterSetterProperties):
85 (JSC::JSObject::getOwnPropertySlotForWrite):
86 (JSC::JSObject::getOwnPropertySlot):
88 * kjs/StructureID.cpp:
89 (JSC::StructureID::StructureID):
90 (JSC::StructureID::addPropertyTransition):
91 (JSC::StructureID::toDictionaryTransition):
92 (JSC::StructureID::changePrototypeTransition):
93 (JSC::StructureID::getterSetterTransition):
95 (JSC::StructureID::hasGetterSetterProperties):
96 (JSC::StructureID::setHasGetterSetterProperties):
98 2008-10-07 Sam Weinig <sam@webkit.org>
100 Reviewed by Cameron Zwarich.
102 Roll r37370 back in with bug fixes.
104 - PropertyMap::storageSize() should reflect the number of keys + deletedOffsets
105 and has nothing to do with the internal deletedSentinel count anymore.
107 2008-10-07 Gavin Barraclough <barraclough@apple.com>
109 Reviewed by Oliver Hunt.
111 Move callframe initialization into JIT code, again.
113 As a part of the restructuring the second result from functions is now
114 returned in edx, allowing the new value of 'r' to be returned via a
115 register, and stored to the stack from JIT code, too.
117 4.5% progression on v8-tests. (3% in their harness)
121 (JSC::CTI::emitCall):
122 (JSC::CTI::compileOpCall):
123 (JSC::CTI::privateCompileMainPass):
124 (JSC::CTI::privateCompileSlowCases):
125 (JSC::CTI::privateCompile):
127 (JSC::CallRecord::CallRecord):
129 (JSC::Machine::cti_op_call_JSFunction):
130 (JSC::Machine::cti_op_construct_JSConstruct):
131 (JSC::Machine::cti_op_resolve_func):
132 (JSC::Machine::cti_op_post_inc):
133 (JSC::Machine::cti_op_resolve_with_base):
134 (JSC::Machine::cti_op_post_dec):
139 2008-10-07 Mark Rowe <mrowe@apple.com>
141 Fix typo in method name.
146 2008-10-07 Cameron Zwarich <zwarich@apple.com>
148 Rubber-stamped by Mark Rowe.
152 2008-10-06 Sam Weinig <sam@webkit.org>
154 Reviewed by Cameron Zwarich.
156 Fix for https://bugs.webkit.org/show_bug.cgi?id=21415
157 Improve the division between PropertyStorageArray and PropertyMap
159 - Rework ProperyMap to store offsets in the value so that they don't
160 change when rehashing. This allows us not to have to keep the
161 PropertyStorageArray in sync and thus not have to pass it in.
162 - Rename PropertyMap::getOffset -> PropertyMap::get since put/remove
163 now also return offsets.
164 - A Vector of deleted offsets is now needed since the storage is out of
167 1% win on SunSpider. Wash on V8 suite.
169 * JavaScriptCore.exp:
171 (JSC::transitionWillNeedStorageRealloc):
173 (JSC::Machine::privateExecute):
174 Transition logic can be greatly simplified by the fact that
175 the storage capacity is always known, and is correct for the
178 (JSC::JSObject::put): Rename getOffset -> get.
179 (JSC::JSObject::deleteProperty): Ditto.
180 (JSC::JSObject::getPropertyAttributes): Ditto.
181 (JSC::JSObject::removeDirect): Use returned offset to
182 clear the value in the PropertyNameArray.
183 (JSC::JSObject::allocatePropertyStorage): Add assert.
185 (JSC::JSObject::getDirect): Rename getOffset -> get
186 (JSC::JSObject::getDirectLocation): Rename getOffset -> get
187 (JSC::JSObject::putDirect): Use propertyStorageCapacity to determine whether
188 or not to resize. Also, since put now returns an offset (and thus
189 addPropertyTransition does also) setting of the PropertyStorageArray is
191 (JSC::JSObject::transitionTo):
192 * kjs/PropertyMap.cpp:
193 (JSC::PropertyMap::checkConsistency): PropertyStorageArray is no longer
195 (JSC::PropertyMap::operator=): Copy the delete offsets vector.
196 (JSC::PropertyMap::put): Instead of setting the PropertyNameArray
197 explicitly, return the offset where the value should go.
198 (JSC::PropertyMap::remove): Instead of removing from the PropertyNameArray
199 explicitly, return the offset where the value should be removed.
200 (JSC::PropertyMap::get): Switch to using the stored offset, instead
202 (JSC::PropertyMap::insert):
203 (JSC::PropertyMap::expand): This is never called when m_table is null,
204 so remove that branch and add it as an assertion.
205 (JSC::PropertyMap::createTable): Consistency checks no longer take
207 (JSC::PropertyMap::rehash): No need to rehash the PropertyNameArray
208 now that it is completely out of band.
210 (JSC::PropertyMapEntry::PropertyMapEntry): Store offset into PropertyNameArray.
211 (JSC::PropertyMap::get): Switch to using the stored offset, instead
213 * kjs/StructureID.cpp:
214 (JSC::StructureID::StructureID): Initialize the propertyStorageCapacity to
215 JSObject::inlineStorageCapacity.
216 (JSC::StructureID::growPropertyStorageCapacity): Grow the storage capacity as
218 (JSC::StructureID::addPropertyTransition): Copy the storage capacity.
219 (JSC::StructureID::toDictionaryTransition): Ditto.
220 (JSC::StructureID::changePrototypeTransition): Ditto.
221 (JSC::StructureID::getterSetterTransition): Ditto.
223 (JSC::StructureID::propertyStorageCapacity): Add propertyStorageCapacity
224 which is the current capacity for the JSObjects PropertyStorageArray.
225 It starts at the JSObject::inlineStorageCapacity (currently 2), then
226 when it first needs to be resized moves to the JSObject::nonInlineBaseStorageCapacity
227 (currently 16), and after that doubles each time.
229 2008-10-06 Cameron Zwarich <zwarich@apple.com>
231 Reviewed by Oliver Hunt.
233 Bug 21396: Remove the OptionalCalleeActivation call frame slot
234 <https://bugs.webkit.org/show_bug.cgi?id=21396>
236 Remove the OptionalCalleeActivation call frame slot. We have to be
237 careful to store the activation object in a register, because objects
238 in the scope chain do not get marked.
240 This is a 0.3% speedup on both SunSpider and the V8 benchmark.
243 (JSC::CTI::privateCompileMainPass):
245 (JSC::CodeBlock::dump):
246 * VM/CodeGenerator.cpp:
247 (JSC::CodeGenerator::CodeGenerator):
248 (JSC::CodeGenerator::emitReturn):
249 * VM/CodeGenerator.h:
251 (JSC::Machine::dumpRegisters):
252 (JSC::Machine::unwindCallFrame):
253 (JSC::Machine::privateExecute):
254 (JSC::Machine::cti_op_call_JSFunction):
255 (JSC::Machine::cti_op_push_activation):
256 (JSC::Machine::cti_op_tear_off_activation):
257 (JSC::Machine::cti_op_construct_JSConstruct):
259 (JSC::Machine::initializeCallFrame):
261 (JSC::RegisterFile::):
263 2008-10-06 Tony Chang <tony@chromium.org>
265 Reviewed by Alexey Proskuryakov.
267 Chromium doesn't use pthreads on windows, so make its use conditional.
269 Also convert a WORD to a DWORD to avoid a compiler warning. This
270 matches the other methods around it.
272 * wtf/ThreadingWin.cpp:
273 (WTF::wtfThreadEntryPoint):
274 (WTF::ThreadCondition::broadcast):
276 2008-10-06 Mark Mentovai <mark@moxienet.com>
278 Reviewed by Tim Hatcher.
280 Allow ENABLE_DASHBOARD_SUPPORT and ENABLE_MAC_JAVA_BRIDGE to be
283 https://bugs.webkit.org/show_bug.cgi?id=21333
287 2008-10-06 Steve Falkenburg <sfalken@apple.com>
289 https://bugs.webkit.org/show_bug.cgi?id=21416
290 Pass 0 for size to VirtualAlloc, as documented by MSDN.
291 Identified by Application Verifier.
293 Reviewed by Darin Adler.
298 2008-10-06 Kevin McCullough <kmccullough@apple.com>
300 Reviewed by Tim Hatcheri and Oliver Hunt.
302 https://bugs.webkit.org/show_bug.cgi?id=21412
303 Bug 21412: Refactor user initiated profile count to be more stable
304 - Export UString::from for use with creating the profile title.
306 * JavaScriptCore.exp:
308 2008-10-06 Maciej Stachowiak <mjs@apple.com>
310 Not reviewed. Build fix.
312 - revert toBoolean changes (r37333 and r37335); need to make WebCore work with these
314 * API/JSValueRef.cpp:
317 * JavaScriptCore.exp:
319 (JSC::CodeBlock::dump):
321 (JSC::Machine::privateExecute):
322 (JSC::Machine::cti_op_loop_if_true):
323 (JSC::Machine::cti_op_not):
324 (JSC::Machine::cti_op_jtrue):
325 * kjs/ArrayPrototype.cpp:
326 (JSC::arrayProtoFuncFilter):
327 (JSC::arrayProtoFuncEvery):
328 (JSC::arrayProtoFuncSome):
329 * kjs/BooleanConstructor.cpp:
330 (JSC::constructBoolean):
331 (JSC::callBooleanConstructor):
332 * kjs/GetterSetter.h:
334 (JSC::JSValue::toBoolean):
335 * kjs/JSNumberCell.cpp:
336 (JSC::JSNumberCell::toBoolean):
337 * kjs/JSNumberCell.h:
339 (JSC::JSObject::toBoolean):
342 (JSC::JSString::toBoolean):
345 * kjs/RegExpConstructor.cpp:
346 (JSC::setRegExpConstructorMultiline):
347 * kjs/RegExpObject.cpp:
348 (JSC::RegExpObject::match):
349 * kjs/RegExpPrototype.cpp:
350 (JSC::regExpProtoFuncToString):
352 2008-10-06 Maciej Stachowiak <mjs@apple.com>
354 Reviewed by Sam Weinig.
356 - optimize op_jtrue, op_loop_if_true and op_not in various ways
357 https://bugs.webkit.org/show_bug.cgi?id=21404
359 1) Make JSValue::toBoolean nonvirtual and completely inline by
360 making use of the StructureID type field.
362 2) Make JSValue::toBoolean not take an ExecState; doesn't need it.
364 3) Make op_not, op_loop_if_true and op_jtrue not read the
365 ExecState (toBoolean doesn't need it any more) and not check
366 exceptions (toBoolean can't throw).
368 * API/JSValueRef.cpp:
370 * JavaScriptCore.exp:
372 (JSC::CodeBlock::dump):
374 (JSC::Machine::privateExecute):
375 (JSC::Machine::cti_op_loop_if_true):
376 (JSC::Machine::cti_op_not):
377 (JSC::Machine::cti_op_jtrue):
378 * kjs/ArrayPrototype.cpp:
379 (JSC::arrayProtoFuncFilter):
380 (JSC::arrayProtoFuncEvery):
381 (JSC::arrayProtoFuncSome):
382 * kjs/BooleanConstructor.cpp:
383 (JSC::constructBoolean):
384 (JSC::callBooleanConstructor):
385 * kjs/GetterSetter.h:
387 (JSC::JSValue::toBoolean):
388 * kjs/JSNumberCell.cpp:
389 * kjs/JSNumberCell.h:
390 (JSC::JSNumberCell::toBoolean):
393 (JSC::JSObject::toBoolean):
394 (JSC::JSCell::toBoolean):
397 (JSC::JSString::toBoolean):
399 * kjs/RegExpConstructor.cpp:
400 (JSC::setRegExpConstructorMultiline):
401 * kjs/RegExpObject.cpp:
402 (JSC::RegExpObject::match):
403 * kjs/RegExpPrototype.cpp:
404 (JSC::regExpProtoFuncToString):
406 2008-10-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
412 * JavaScriptCore.pri:
414 (JSC::highResUpTime):
416 2008-10-05 Cameron Zwarich <zwarich@apple.com>
418 Reviewed by Oliver Hunt.
420 Remove ScopeNode::containsClosures() now that it is unused.
423 (JSC::ScopeNode::containsClosures):
425 2008-10-05 Maciej Stachowiak <mjs@apple.com>
427 Reviewed by Cameron Zwarich.
429 - fix releas-only test failures caused by the fix to bug 21375
432 (JSC::Machine::unwindCallFrame): Update ExecState while unwinding call frames;
433 it now matters more to have a still-valid ExecState, since dynamicGlobalObject
434 will make use of the ExecState's scope chain.
437 2008-10-05 Cameron Zwarich <zwarich@apple.com>
439 Reviewed by Oliver Hunt.
441 Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
442 <https://bugs.webkit.org/show_bug.cgi?id=21364>
444 Use information from the parser to detect whether an activation is
445 needed or 'arguments' is used, and emit explicit instructions to tear
446 them off before op_ret. This allows a branch to be removed from op_ret
447 and simplifies some other code. This does cause a small change in the
448 behaviour of 'f.arguments'; it is no longer live when 'arguments' is not
449 mentioned in the lexical scope of the function.
451 It should now be easy to remove the OptionaCalleeActivation slot in the
452 call frame, but this will be done in a later patch.
455 (JSC::CTI::privateCompileMainPass):
457 (JSC::CodeBlock::dump):
458 * VM/CodeGenerator.cpp:
459 (JSC::CodeGenerator::emitReturn):
460 * VM/CodeGenerator.h:
462 (JSC::Machine::unwindCallFrame):
463 (JSC::Machine::privateExecute):
464 (JSC::Machine::retrieveArguments):
465 (JSC::Machine::cti_op_create_arguments):
466 (JSC::Machine::cti_op_tear_off_activation):
467 (JSC::Machine::cti_op_tear_off_arguments):
471 (JSC::Arguments::mark):
473 (JSC::Arguments::isTornOff):
474 (JSC::Arguments::Arguments):
475 (JSC::Arguments::copyRegisters):
476 (JSC::JSActivation::copyRegisters):
477 * kjs/JSActivation.cpp:
478 (JSC::JSActivation::argumentsGetter):
479 * kjs/JSActivation.h:
481 2008-10-05 Maciej Stachowiak <mjs@apple.com>
483 Reviewed by Oliver Hunt.
485 - fixed "REGRESSION (r37297): fast/js/deep-recursion-test takes too long and times out"
486 https://bugs.webkit.org/show_bug.cgi?id=21375
488 The problem is that dynamicGlobalObject had become O(N) in number
489 of call frames, but unwinding the stack for an exception called it
490 for every call frame, resulting in O(N^2) behavior for an
491 exception thrown from inside deep recursion.
493 Instead of doing it that way, stash the dynamic global object in JSGlobalData.
495 * JavaScriptCore.exp:
497 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Helper class to temporarily
498 store and later restore a dynamicGlobalObject in JSGlobalData.
499 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
500 (JSC::Machine::execute): In each version, establish a DynamicGlobalObjectScope.
501 For ProgramNode, always establish set new dynamicGlobalObject, for FunctionBody and Eval,
502 only if none is currently set.
505 * kjs/JSGlobalData.cpp:
506 (JSC::JSGlobalData::JSGlobalData): Ininitalize new dynamicGlobalObject field to 0.
507 * kjs/JSGlobalData.h:
508 * kjs/JSGlobalObject.h:
509 (JSC::ExecState::dynamicGlobalObject): Moved here from ExecState for benefit of inlining.
510 Return lexical global object if this is a globalExec(), otherwise look in JSGlobalData
511 for the one stashed there.
513 2008-10-05 Sam Weinig <sam@webkit.org>
515 Reviewed by Maciej Stachowiak.
517 Avoid an extra lookup when transitioning to an existing StructureID
518 by caching the offset of property that caused the transition.
520 1% win on V8 suite. Wash on SunSpider.
522 * kjs/PropertyMap.cpp:
523 (JSC::PropertyMap::put):
525 * kjs/StructureID.cpp:
526 (JSC::StructureID::StructureID):
527 (JSC::StructureID::addPropertyTransition):
529 (JSC::StructureID::setCachedTransistionOffset):
530 (JSC::StructureID::cachedTransistionOffset):
532 2008-10-05 Cameron Zwarich <zwarich@apple.com>
534 Reviewed by Maciej Stachowiak.
536 Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
537 <https://bugs.webkit.org/show_bug.cgi?id=21364>
539 This patch does not yet remove the branch, but it does a bit of refactoring
540 so that a CodeGenerator now knows whether the associated CodeBlock will need
541 a full scope before doing any code generation. This makes it possible to emit
542 explicit tear-off instructions before every op_ret.
545 (JSC::CodeBlock::CodeBlock):
546 * VM/CodeGenerator.cpp:
547 (JSC::CodeGenerator::generate):
548 (JSC::CodeGenerator::CodeGenerator):
549 (JSC::CodeGenerator::emitPushScope):
550 (JSC::CodeGenerator::emitPushNewScope):
552 (JSC::ScopeNode::needsActivation):
554 2008-10-05 Gavin Barraclough <barraclough@apple.com>
556 Reviewed by Cameron Zwarich.
558 Fix for bug #21387 - using SamplingTool with CTI.
560 (1) A repatch offset offset changes due to an additional instruction to update SamplingTool state.
561 (2) Fix an incusion order problem due to ExecState changes.
562 (3) Change to a MACHINE_SAMPLING macro, use of exec should now be accessing global data.
567 (JSC::SamplingTool::privateExecuteReturned):
570 2008-10-04 Mark Rowe <mrowe@apple.com>
572 Reviewed by Tim Hatcher.
574 Add a 'Check For Weak VTables' build phase to catch weak vtables as early as possible.
576 * JavaScriptCore.xcodeproj/project.pbxproj:
578 2008-10-04 Sam Weinig <sam@webkit.org>
580 Reviewed by Oliver Hunt.
582 Fix https://bugs.webkit.org/show_bug.cgi?id=21320
583 leaks of PropertyNameArrayData seen on buildbot
585 - Fix RefPtr cycle by making PropertyNameArrayData's pointer back
586 to the StructureID a weak pointer.
588 * kjs/PropertyNameArray.h:
589 (JSC::PropertyNameArrayData::setCachedStructureID):
590 (JSC::PropertyNameArrayData::cachedStructureID):
591 * kjs/StructureID.cpp:
592 (JSC::StructureID::getEnumerablePropertyNames):
593 (JSC::StructureID::clearEnumerationCache):
594 (JSC::StructureID::~StructureID):
596 2008-10-04 Darin Adler <darin@apple.com>
598 Reviewed by Cameron Zwarich.
600 - https://bugs.webkit.org/show_bug.cgi?id=21295
601 Bug 21295: Replace ExecState with a call frame Register pointer
603 10% faster on Richards; other v8 benchmarks faster too.
606 This does the minimum necessary to get the speedup. Next step in
607 cleaning this up is to replace ExecState with a CallFrame class,
608 and be more judicious about when to pass a call frame and when
609 to pass a global data pointer, global object pointer, or perhaps
610 something else entirely.
612 * VM/CTI.cpp: Remove the debug-only check of the exception in
613 ctiVMThrowTrampoline -- already checked in the code the trampoline
614 jumps to, so not all that useful. Removed the exec argument from
615 ctiTrampoline. Removed emitDebugExceptionCheck -- no longer needed.
616 (JSC::CTI::emitCall): Removed code to set ExecState::m_callFrame.
617 (JSC::CTI::privateCompileMainPass): Removed code in catch to extract
618 the exception from ExecState::m_exception; instead, the code that
619 jumps into catch will make sure the exception is already in eax.
620 * VM/CTI.h: Removed exec from the ctiTrampoline. Also removed the
621 non-helpful "volatile". Temporarily left ARG_exec in as a synonym
622 for ARG_r; I'll change that on a future cleanup pass when introducing
623 more use of the CallFrame type.
624 (JSC::CTI::execute): Removed the ExecState* argument.
626 * VM/ExceptionHelpers.cpp:
627 (JSC::InterruptedExecutionError::InterruptedExecutionError): Take
628 JSGlobalData* instead of ExecState*.
629 (JSC::createInterruptedExecutionException): Ditto.
630 * VM/ExceptionHelpers.h: Ditto. Also removed an unneeded include.
633 (JSC::slideRegisterWindowForCall): Removed the exec and
634 exceptionValue arguments. Changed to return 0 when there's a stack
635 overflow rather than using a separate exception argument to cut
636 down on memory accesses in the calling convention.
637 (JSC::Machine::unwindCallFrame): Removed the exec argument when
638 constructing a DebuggerCallFrame. Also removed code to set
639 ExecState::m_callFrame.
640 (JSC::Machine::throwException): Removed the exec argument when
641 construction a DebuggerCallFrame.
642 (JSC::Machine::execute): Updated to use the register instead of
643 ExecState and also removed various uses of ExecState.
644 (JSC::Machine::debug):
645 (JSC::Machine::privateExecute): Put globalData into a local
646 variable so it can be used throughout the interpreter. Changed
647 the VM_CHECK_EXCEPTION to get the exception in globalData instead
648 of through ExecState.
649 (JSC::Machine::retrieveLastCaller): Turn exec into a registers
650 pointer by calling registers() instead of by getting m_callFrame.
651 (JSC::Machine::callFrame): Ditto.
652 Tweaked exception macros. Made new versions for when you know
653 you have an exception. Get at global exception with ARG_globalData.
654 Got rid of the need to pass in the return value type.
655 (JSC::Machine::cti_op_add): Update to use new version of exception
657 (JSC::Machine::cti_op_pre_inc): Ditto.
658 (JSC::Machine::cti_timeout_check): Ditto.
659 (JSC::Machine::cti_op_instanceof): Ditto.
660 (JSC::Machine::cti_op_new_func): Ditto.
661 (JSC::Machine::cti_op_call_JSFunction): Optimized by using the
662 ARG values directly instead of through local variables -- this gets
663 rid of code that just shuffles things around in the stack frame.
664 Also get rid of ExecState and update for the new way exceptions are
665 handled in slideRegisterWindowForCall.
666 (JSC::Machine::cti_vm_compile): Update to make exec out of r since
667 they are both the same thing now.
668 (JSC::Machine::cti_op_call_NotJSFunction): Ditto.
669 (JSC::Machine::cti_op_init_arguments): Ditto.
670 (JSC::Machine::cti_op_resolve): Ditto.
671 (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
672 (JSC::Machine::cti_op_construct_NotJSConstruct): Ditto.
673 (JSC::Machine::cti_op_resolve_func): Ditto.
674 (JSC::Machine::cti_op_put_by_val): Ditto.
675 (JSC::Machine::cti_op_put_by_val_array): Ditto.
676 (JSC::Machine::cti_op_resolve_skip): Ditto.
677 (JSC::Machine::cti_op_resolve_global): Ditto.
678 (JSC::Machine::cti_op_post_inc): Ditto.
679 (JSC::Machine::cti_op_resolve_with_base): Ditto.
680 (JSC::Machine::cti_op_post_dec): Ditto.
681 (JSC::Machine::cti_op_call_eval): Ditto.
682 (JSC::Machine::cti_op_throw): Ditto. Also rearranged to return
683 the exception value as the return value so it can be used by
685 (JSC::Machine::cti_op_push_scope): Ditto.
686 (JSC::Machine::cti_op_in): Ditto.
687 (JSC::Machine::cti_op_del_by_val): Ditto.
688 (JSC::Machine::cti_vm_throw): Ditto. Also rearranged to return
689 the exception value as the return value so it can be used by
692 * kjs/DebuggerCallFrame.cpp:
693 (JSC::DebuggerCallFrame::functionName): Pass globalData.
694 (JSC::DebuggerCallFrame::evaluate): Eliminated code to make a
696 * kjs/DebuggerCallFrame.h: Removed ExecState argument from
699 * kjs/ExecState.h: Eliminated all data members and made ExecState
700 inherit privately from Register instead. Also added a typedef to
701 the future name for this class, which is CallFrame. It's just a
702 Register* that knows it's a pointer at a call frame. The new class
703 can't be constructed or copied. Changed all functions to use
704 the this pointer instead of m_callFrame. Changed exception-related
705 functions to access an exception in JSGlobalData. Removed functions
706 used by CTI to pass the return address to the throw machinery --
707 this is now done directly with a global in the global data.
709 * kjs/FunctionPrototype.cpp:
710 (JSC::functionProtoFuncToString): Pass globalData instead of exec.
712 * kjs/InternalFunction.cpp:
713 (JSC::InternalFunction::name): Take globalData instead of exec.
714 * kjs/InternalFunction.h: Ditto.
716 * kjs/JSGlobalData.cpp: Initialize the new exception global to 0.
717 * kjs/JSGlobalData.h: Declare two new globals. One for the current
718 exception and another for the return address used by CTI to
719 implement the throw operation.
721 * kjs/JSGlobalObject.cpp:
722 (JSC::JSGlobalObject::init): Removed code to set up globalExec,
723 which is now the same thing as globalCallFrame.
724 (JSC::JSGlobalObject::reset): Get globalExec from our globalExec
725 function so we don't have to repeat the logic twice.
726 (JSC::JSGlobalObject::mark): Removed code to mark the exception;
727 the exception is now stored in JSGlobalData and marked there.
728 (JSC::JSGlobalObject::globalExec): Return a pointer to the end
729 of the global call frame.
730 * kjs/JSGlobalObject.h: Removed the globalExec data member.
733 (JSC::JSObject::putDirectFunction): Pass globalData instead of exec.
736 (JSC::Heap::collect): Mark the global exception.
738 * profiler/ProfileGenerator.cpp:
739 (JSC::ProfileGenerator::addParentForConsoleStart): Pass globalData
740 instead of exec to createCallIdentifier.
742 * profiler/Profiler.cpp:
743 (JSC::Profiler::willExecute): Pass globalData instead of exec to
744 createCallIdentifier.
745 (JSC::Profiler::didExecute): Ditto.
746 (JSC::Profiler::createCallIdentifier): Take globalData instead of
748 (JSC::createCallIdentifierFromFunctionImp): Ditto.
749 * profiler/Profiler.h: Change interface to take a JSGlobalData
750 instead of an ExecState.
752 2008-10-04 Cameron Zwarich <zwarich@apple.com>
754 Reviewed by Darin Adler.
756 Bug 21369: Add opcode documentation for all undocumented opcodes
757 <https://bugs.webkit.org/show_bug.cgi?id=21369>
759 This patch adds opcode documentation for all undocumented opcodes, and
760 it also renames op_init_arguments to op_create_arguments.
763 (JSC::CTI::privateCompileMainPass):
765 (JSC::CodeBlock::dump):
766 * VM/CodeGenerator.cpp:
767 (JSC::CodeGenerator::CodeGenerator):
769 (JSC::Machine::privateExecute):
770 (JSC::Machine::cti_op_create_arguments):
774 2008-10-03 Maciej Stachowiak <mjs@apple.com>
776 Reviewed by Cameron Zwarich.
778 - "this" object in methods called on primitives should be wrapper object
779 https://bugs.webkit.org/show_bug.cgi?id=21362
781 I changed things so that functions which use "this" do a fast
782 version of toThisObject conversion if needed. Currently we miss
783 the conversion entirely, at least for primitive types. Using
784 TypeInfo and the primitive check, I made the fast case bail out
787 This is inexplicably an 1.007x SunSpider speedup (and a wash on V8 benchmarks).
789 Also renamed some opcodes for clarity:
792 init_activation ==> enter_with_activation
795 (JSC::CTI::privateCompileMainPass):
796 (JSC::CTI::privateCompileSlowCases):
798 (JSC::CodeBlock::dump):
799 * VM/CodeGenerator.cpp:
800 (JSC::CodeGenerator::generate):
801 (JSC::CodeGenerator::CodeGenerator):
803 (JSC::Machine::privateExecute):
804 (JSC::Machine::cti_op_convert_this):
807 * kjs/JSActivation.cpp:
808 (JSC::JSActivation::JSActivation):
809 * kjs/JSActivation.h:
810 (JSC::JSActivation::createStructureID):
812 (JSC::JSValue::needsThisConversion):
813 * kjs/JSGlobalData.cpp:
814 (JSC::JSGlobalData::JSGlobalData):
815 * kjs/JSGlobalData.h:
816 * kjs/JSNumberCell.h:
817 (JSC::JSNumberCell::createStructureID):
818 * kjs/JSStaticScopeObject.h:
819 (JSC::JSStaticScopeObject::JSStaticScopeObject):
820 (JSC::JSStaticScopeObject::createStructureID):
822 (JSC::JSString::createStructureID):
825 (JSC::TypeInfo::needsThisConversion):
827 (JSC::ScopeNode::usesThis):
829 2008-10-03 Cameron Zwarich <zwarich@apple.com>
831 Reviewed by Maciej Stachowiak.
833 Bug 21356: The size of the RegisterFile differs depending on 32-bit / 64-bit and Debug / Release
834 <https://bugs.webkit.org/show_bug.cgi?id=21356>
836 The RegisterFile decreases in size (measured in terms of numbers of
837 Registers) as the size of a Register increases. This causes
839 js1_5/Regress/regress-159334.js
841 to fail in 64-bit debug builds. This fix makes the RegisterFile on all
842 platforms the same size that it is in 32-bit Release builds.
845 (JSC::RegisterFile::RegisterFile):
847 2008-10-03 Maciej Stachowiak <mjs@apple.com>
849 Reviewed by Cameron Zwarich.
851 - Some code cleanup to how we handle code features.
853 1) Rename FeatureInfo typedef to CodeFeatures.
854 2) Rename NodeFeatureInfo template to NodeInfo.
855 3) Keep CodeFeature bitmask in ScopeNode instead of trying to break it out into individual bools.
856 4) Rename misleadingly named "needsClosure" method to "containsClosures", which better describes the meaning
858 5) Make setUsersArguments() not take an argument since it only goes one way.
860 * JavaScriptCore.exp:
862 (JSC::CodeBlock::CodeBlock):
865 (JSC::Parser::didFinishParsing):
867 (JSC::Parser::parse):
870 (JSC::ScopeNode::ScopeNode):
871 (JSC::ProgramNode::ProgramNode):
872 (JSC::ProgramNode::create):
873 (JSC::EvalNode::EvalNode):
874 (JSC::EvalNode::create):
875 (JSC::FunctionBodyNode::FunctionBodyNode):
876 (JSC::FunctionBodyNode::create):
878 (JSC::ScopeNode::usesEval):
879 (JSC::ScopeNode::containsClosures):
880 (JSC::ScopeNode::usesArguments):
881 (JSC::ScopeNode::setUsesArguments):
883 2008-10-03 Cameron Zwarich <zwarich@apple.com>
885 Reviewed by Maciej Stachowiak.
887 Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
888 <https://bugs.webkit.org/show_bug.cgi?id=21343>
890 A fix was landed for this issue in r37253, and the ChangeLog assumes
891 that it is a compiler bug, but it turns out that it is a subtle issue
892 with mixing signed and unsigned 32-bit values in a 64-bit environment.
893 In order to properly fix this bug, we should convert our signed offsets
894 into the register file to use ptrdiff_t.
896 This may not be the only instance of this issue, but I will land this
897 fix first and look for more later.
900 (JSC::Machine::getArgumentsData):
903 (JSC::Arguments::getOwnPropertySlot):
905 (JSC::Arguments::init):
907 2008-10-03 Darin Adler <darin@apple.com>
909 * VM/CTI.cpp: Another Windows build fix. Change the args of ctiTrampoline.
911 * kjs/JSNumberCell.h: A build fix for newer versions of gcc. Added
912 declarations of JSGlobalData overloads of jsNumberCell.
914 2008-10-03 Darin Adler <darin@apple.com>
916 - try to fix Windows build
918 * kjs/ScopeChain.h: Add forward declaration of JSGlobalData.
920 2008-10-03 Darin Adler <darin@apple.com>
922 Reviewed by Geoff Garen.
924 - next step of https://bugs.webkit.org/show_bug.cgi?id=21295
925 Turn ExecState into a call frame pointer.
927 Remove m_globalObject and m_globalData from ExecState.
929 SunSpider says this is a wash (slightly faster but not statistically
930 significant); which is good enough since it's a preparation step and
931 not supposed to be a spedup.
933 * API/JSCallbackFunction.cpp:
934 (JSC::JSCallbackFunction::JSCallbackFunction):
935 * kjs/ArrayConstructor.cpp:
936 (JSC::ArrayConstructor::ArrayConstructor):
937 * kjs/BooleanConstructor.cpp:
938 (JSC::BooleanConstructor::BooleanConstructor):
939 * kjs/DateConstructor.cpp:
940 (JSC::DateConstructor::DateConstructor):
941 * kjs/ErrorConstructor.cpp:
942 (JSC::ErrorConstructor::ErrorConstructor):
943 * kjs/FunctionPrototype.cpp:
944 (JSC::FunctionPrototype::FunctionPrototype):
945 * kjs/JSFunction.cpp:
946 (JSC::JSFunction::JSFunction):
947 * kjs/NativeErrorConstructor.cpp:
948 (JSC::NativeErrorConstructor::NativeErrorConstructor):
949 * kjs/NumberConstructor.cpp:
950 (JSC::NumberConstructor::NumberConstructor):
951 * kjs/ObjectConstructor.cpp:
952 (JSC::ObjectConstructor::ObjectConstructor):
953 * kjs/PrototypeFunction.cpp:
954 (JSC::PrototypeFunction::PrototypeFunction):
955 * kjs/RegExpConstructor.cpp:
956 (JSC::RegExpConstructor::RegExpConstructor):
957 * kjs/StringConstructor.cpp:
958 (JSC::StringConstructor::StringConstructor):
959 Pass JSGlobalData* instead of ExecState* to the InternalFunction
962 * API/OpaqueJSString.cpp: Added now-needed include.
964 * JavaScriptCore.exp: Updated.
967 (JSC::CTI::emitSlowScriptCheck): Changed to use ARGS_globalData
968 instead of ARGS_exec.
970 * VM/CTI.h: Added a new argument to the CTI, the global data pointer.
971 While it's possible to get to the global data pointer using the
972 ExecState pointer, it's slow enough that it's better to just keep
973 it around in the CTI arguments.
975 * VM/CodeBlock.h: Moved the CodeType enum here from ExecState.h.
978 (JSC::Machine::execute): Pass fewer arguments when constructing
979 ExecState, and pass the global data pointer when invoking CTI.
980 (JSC::Machine::firstCallFrame): Added. Used to get the dynamic global
981 object, which is in the scope chain of the first call frame.
982 (JSC::Machine::cti_op_add): Use globalData instead of exec when
983 possible, to keep fast cases fast, since it's now more expensive to
984 get to it through the exec pointer.
985 (JSC::Machine::cti_timeout_check): Ditto.
986 (JSC::Machine::cti_op_put_by_id_second): Ditto.
987 (JSC::Machine::cti_op_get_by_id_second): Ditto.
988 (JSC::Machine::cti_op_mul): Ditto.
989 (JSC::Machine::cti_vm_compile): Ditto.
990 (JSC::Machine::cti_op_get_by_val): Ditto.
991 (JSC::Machine::cti_op_sub): Ditto.
992 (JSC::Machine::cti_op_put_by_val): Ditto.
993 (JSC::Machine::cti_op_put_by_val_array): Ditto.
994 (JSC::Machine::cti_op_negate): Ditto.
995 (JSC::Machine::cti_op_div): Ditto.
996 (JSC::Machine::cti_op_pre_dec): Ditto.
997 (JSC::Machine::cti_op_post_inc): Ditto.
998 (JSC::Machine::cti_op_lshift): Ditto.
999 (JSC::Machine::cti_op_bitand): Ditto.
1000 (JSC::Machine::cti_op_rshift): Ditto.
1001 (JSC::Machine::cti_op_bitnot): Ditto.
1002 (JSC::Machine::cti_op_mod): Ditto.
1003 (JSC::Machine::cti_op_post_dec): Ditto.
1004 (JSC::Machine::cti_op_urshift): Ditto.
1005 (JSC::Machine::cti_op_bitxor): Ditto.
1006 (JSC::Machine::cti_op_bitor): Ditto.
1007 (JSC::Machine::cti_op_call_eval): Ditto.
1008 (JSC::Machine::cti_op_throw): Ditto.
1009 (JSC::Machine::cti_op_is_string): Ditto.
1010 (JSC::Machine::cti_op_debug): Ditto.
1011 (JSC::Machine::cti_vm_throw): Ditto.
1013 * VM/Machine.h: Added firstCallFrame.
1015 * kjs/DebuggerCallFrame.cpp:
1016 (JSC::DebuggerCallFrame::evaluate): Pass fewer arguments when
1017 constructing ExecState.
1019 * kjs/ExecState.cpp: Deleted contents. Later we'll remove the
1022 * kjs/ExecState.h: Removed m_globalObject and m_globalData.
1023 Moved CodeType into another header.
1024 (JSC::ExecState::ExecState): Take only a single argument, a
1026 (JSC::ExecState::dynamicGlobalObject): Get the object from
1027 the first call frame since it's no longer stored.
1028 (JSC::ExecState::globalData): Get the global data from the
1029 scope chain, since we no longer store a pointer to it here.
1030 (JSC::ExecState::identifierTable): Ditto.
1031 (JSC::ExecState::propertyNames): Ditto.
1032 (JSC::ExecState::emptyList): Ditto.
1033 (JSC::ExecState::lexer): Ditto.
1034 (JSC::ExecState::parser): Ditto.
1035 (JSC::ExecState::machine): Ditto.
1036 (JSC::ExecState::arrayTable): Ditto.
1037 (JSC::ExecState::dateTable): Ditto.
1038 (JSC::ExecState::mathTable): Ditto.
1039 (JSC::ExecState::numberTable): Ditto.
1040 (JSC::ExecState::regExpTable): Ditto.
1041 (JSC::ExecState::regExpConstructorTable): Ditto.
1042 (JSC::ExecState::stringTable): Ditto.
1043 (JSC::ExecState::heap): Ditto.
1045 * kjs/FunctionConstructor.cpp:
1046 (JSC::FunctionConstructor::FunctionConstructor): Pass
1047 JSGlobalData* instead of ExecState* to the InternalFunction
1049 (JSC::constructFunction): Pass the global data pointer when
1050 constructing a new scope chain.
1052 * kjs/InternalFunction.cpp:
1053 (JSC::InternalFunction::InternalFunction): Take a JSGlobalData*
1054 instead of an ExecState*. Later we can change more places to
1055 work this way -- it's more efficient to take the type you need
1056 since the caller might already have it.
1057 * kjs/InternalFunction.h: Ditto.
1060 (JSC::JSCell::operator new): Added an overload that takes a
1061 JSGlobalData* so you can construct without an ExecState*.
1063 * kjs/JSGlobalObject.cpp:
1064 (JSC::JSGlobalObject::init): Moved creation of the global scope
1065 chain in here, since it now requires a pointer to the global data.
1066 Moved the initialization of the call frame in here since it requires
1067 the global scope chain node. Removed the extra argument to ExecState
1068 when creating the global ExecState*.
1069 * kjs/JSGlobalObject.h: Removed initialization of globalScopeChain
1070 and the call frame from the JSGlobalObjectData constructor. Added
1071 a thisValue argument to the init function.
1073 * kjs/JSNumberCell.cpp: Added versions of jsNumberCell that take
1074 JSGlobalData* rather than ExecState*.
1075 * kjs/JSNumberCell.h:
1076 (JSC::JSNumberCell::operator new): Added a version that takes
1078 (JSC::JSNumberCell::JSNumberCell): Ditto.
1079 (JSC::jsNumber): Ditto.
1081 (JSC::jsString): Ditto.
1082 (JSC::jsSubstring): Ditto.
1083 (JSC::jsOwnedString): Ditto.
1085 (JSC::JSString::JSString): Changed to take JSGlobalData*.
1086 (JSC::jsEmptyString): Added a version that takes JSGlobalData*.
1087 (JSC::jsSingleCharacterString): Ditto.
1088 (JSC::jsSingleCharacterSubstring): Ditto.
1089 (JSC::jsNontrivialString): Ditto.
1090 (JSC::JSString::getIndex): Ditto.
1091 (JSC::jsString): Ditto.
1092 (JSC::jsSubstring): Ditto.
1093 (JSC::jsOwnedString): Ditto.
1095 * kjs/ScopeChain.h: Added a globalData pointer to each node.
1096 (JSC::ScopeChainNode::ScopeChainNode): Initialize the globalData
1098 (JSC::ScopeChainNode::push): Set the global data pointer in the
1100 (JSC::ScopeChain::ScopeChain): Take a globalData argument.
1102 * kjs/SmallStrings.cpp:
1103 (JSC::SmallStrings::createEmptyString): Take JSGlobalData* instead of
1105 (JSC::SmallStrings::createSingleCharacterString): Ditto.
1106 * kjs/SmallStrings.h:
1107 (JSC::SmallStrings::emptyString): Ditto.
1108 (JSC::SmallStrings::singleCharacterString): Ditto.
1110 2008-10-03 Cameron Zwarich <zwarich@apple.com>
1112 Reviewed by Geoff Garen.
1114 Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
1115 <https://bugs.webkit.org/show_bug.cgi?id=21343>
1117 Add a workaround for a bug in GCC, which affects GCC 4.0, GCC 4.2, and
1118 llvm-gcc 4.2. I put it in an #ifdef because it was a slight regression
1119 on SunSpider in 32-bit, although that might be entirely random.
1121 * kjs/Arguments.cpp:
1122 (JSC::Arguments::getOwnPropertySlot):
1124 2008-10-03 Darin Adler <darin@apple.com>
1126 Rubber stamped by Alexey Proskuryakov.
1128 * kjs/Shell.cpp: (main): Don't delete JSGlobalData. Later, we need to change
1129 this tool to use public JavaScriptCore API instead.
1131 2008-10-03 Darin Adler <darin@apple.com>
1133 Suggested by Alexey Proskuryakov.
1135 * kjs/JSGlobalData.cpp:
1136 (JSC::JSGlobalData::~JSGlobalData): Remove call to heap.destroy() because
1137 it's too late to ref the JSGlobalData object once it's already being
1138 destroyed. In practice this is not a problem because WebCore's JSGlobalData
1139 is never destroyed and JSGlobalContextRelease takes care of calling
1140 heap.destroy() in advance.
1142 2008-10-02 Oliver Hunt <oliver@apple.com>
1144 Reviewed by Maciej Stachowiak.
1146 Replace SSE3 check with an SSE2 check, and implement SSE2 check on windows.
1148 5.6% win on SunSpider on windows.
1151 (JSC::isSSE2Present):
1152 (JSC::CTI::compileBinaryArithOp):
1153 (JSC::CTI::compileBinaryArithOpSlowCase):
1155 2008-10-03 Maciej Stachowiak <mjs@apple.com>
1157 Rubber stamped by Cameron Zwarich.
1159 - fix mistaken change of | to || which caused a big perf regression on EarleyBoyer
1163 2008-10-02 Darin Adler <darin@apple.com>
1165 Reviewed by Geoff Garen.
1167 - https://bugs.webkit.org/show_bug.cgi?id=21321
1168 Bug 21321: speed up JavaScriptCore by inlining Heap in JSGlobalData
1170 1.019x as fast on SunSpider.
1173 (JSEvaluateScript): Use heap. instead of heap-> to work with the heap.
1174 (JSCheckScriptSyntax): Ditto.
1175 (JSGarbageCollect): Ditto.
1176 (JSReportExtraMemoryCost): Ditto.
1177 * API/JSContextRef.cpp:
1178 (JSGlobalContextRetain): Ditto.
1179 (JSGlobalContextRelease): Destroy the heap with the destroy function instead
1180 of the delete operator.
1181 (JSContextGetGlobalObject): Use heap. instead of heap-> to work with the heap.
1182 * API/JSObjectRef.cpp:
1183 (JSObjectMake): Use heap. instead of heap-> to work with the heap.
1184 (JSObjectMakeFunctionWithCallback): Ditto.
1185 (JSObjectMakeConstructor): Ditto.
1186 (JSObjectMakeFunction): Ditto.
1187 (JSObjectMakeArray): Ditto.
1188 (JSObjectMakeDate): Ditto.
1189 (JSObjectMakeError): Ditto.
1190 (JSObjectMakeRegExp): Ditto.
1191 (JSObjectHasProperty): Ditto.
1192 (JSObjectGetProperty): Ditto.
1193 (JSObjectSetProperty): Ditto.
1194 (JSObjectGetPropertyAtIndex): Ditto.
1195 (JSObjectSetPropertyAtIndex): Ditto.
1196 (JSObjectDeleteProperty): Ditto.
1197 (JSObjectCallAsFunction): Ditto.
1198 (JSObjectCallAsConstructor): Ditto.
1199 (JSObjectCopyPropertyNames): Ditto.
1200 (JSPropertyNameAccumulatorAddName): Ditto.
1201 * API/JSValueRef.cpp:
1202 (JSValueIsEqual): Ditto.
1203 (JSValueIsInstanceOfConstructor): Ditto.
1204 (JSValueMakeNumber): Ditto.
1205 (JSValueMakeString): Ditto.
1206 (JSValueToNumber): Ditto.
1207 (JSValueToStringCopy): Ditto.
1208 (JSValueToObject): Ditto.
1209 (JSValueProtect): Ditto.
1210 (JSValueUnprotect): Ditto.
1213 (JSC::ExecState::heap): Update to use the & operator.
1215 * kjs/JSGlobalData.cpp:
1216 (JSC::JSGlobalData::JSGlobalData): Update to initialize a heap member
1217 instead of calling new to make a heap.
1218 (JSC::JSGlobalData::~JSGlobalData): Destroy the heap with the destroy
1219 function instead of the delete operator.
1220 * kjs/JSGlobalData.h: Change from Heap* to a Heap.
1221 * kjs/JSGlobalObject.cpp:
1222 (JSC::JSGlobalObject::mark): Use the & operator here.
1223 (JSC::JSGlobalObject::operator new): Use heap. instead of heap-> to work
1226 2008-10-02 Cameron Zwarich <zwarich@apple.com>
1228 Reviewed by Geoff Garen.
1230 Bug 21317: Replace RegisterFile size and capacity information with Register pointers
1231 <https://bugs.webkit.org/show_bug.cgi?id=21317>
1233 This is a 2.3% speedup on the V8 DeltaBlue benchmark, a 3.3% speedup on
1234 the V8 Raytrace benchmark, and a 1.0% speedup on SunSpider.
1237 (JSC::slideRegisterWindowForCall):
1238 (JSC::Machine::callEval):
1239 (JSC::Machine::execute):
1240 (JSC::Machine::privateExecute):
1241 (JSC::Machine::cti_op_call_JSFunction):
1242 (JSC::Machine::cti_op_construct_JSConstruct):
1243 * VM/RegisterFile.cpp:
1244 (JSC::RegisterFile::~RegisterFile):
1245 * VM/RegisterFile.h:
1246 (JSC::RegisterFile::RegisterFile):
1247 (JSC::RegisterFile::start):
1248 (JSC::RegisterFile::end):
1249 (JSC::RegisterFile::size):
1250 (JSC::RegisterFile::shrink):
1251 (JSC::RegisterFile::grow):
1252 (JSC::RegisterFile::lastGlobal):
1253 (JSC::RegisterFile::markGlobals):
1254 (JSC::RegisterFile::markCallFrames):
1255 * kjs/JSGlobalObject.cpp:
1256 (JSC::JSGlobalObject::copyGlobalsTo):
1258 2008-10-02 Cameron Zwarich <zwarich@apple.com>
1260 Rubber-stamped by Darin Adler.
1262 Change bitwise operations introduced in r37166 to boolean operations. We
1263 only use bitwise operations over boolean operations for increasing
1264 performance in extremely hot code, but that does not apply to anything
1269 2008-10-02 Gavin Barraclough <barraclough@apple.com>
1271 Reviewed by Darin Adler.
1273 Fix for bug #21232 - should reset m_isPendingDash on flush,
1274 and should allow '\-' as beginning or end of a range (though
1275 not to specifiy a range itself).
1278 * wrec/CharacterClassConstructor.cpp:
1279 (JSC::CharacterClassConstructor::put):
1280 (JSC::CharacterClassConstructor::flush):
1281 * wrec/CharacterClassConstructor.h:
1282 (JSC::CharacterClassConstructor::flushBeforeEscapedHyphen):
1284 (JSC::WRECGenerator::generateDisjunction):
1285 (JSC::WRECParser::parseCharacterClass):
1286 (JSC::WRECParser::parseDisjunction):
1289 2008-10-02 Darin Adler <darin@apple.com>
1291 Reviewed by Sam Weinig.
1293 - remove the "static" from declarations in a header file, since we
1294 don't want them to have internal linkage
1296 * VM/Machine.h: Remove the static keyword from the constant and the
1297 three inline functions that Geoff just moved here.
1299 2008-10-02 Geoffrey Garen <ggaren@apple.com>
1301 Reviewed by Sam Weinig.
1303 Fixed https://bugs.webkit.org/show_bug.cgi?id=21283.
1304 Profiler Crashes When Started
1308 (JSC::makeHostCallFramePointer):
1309 (JSC::isHostCallFrame):
1310 (JSC::stripHostCallFrameBit): Moved some things to the header so
1311 JSGlobalObject could use them.
1313 * kjs/JSGlobalObject.h:
1314 (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Call the
1315 new makeHostCallFramePointer API, since 0 no longer indicates a host
1318 2008-10-02 Alexey Proskuryakov <ap@webkit.org>
1320 Reviewed by Darin Adler.
1322 https://bugs.webkit.org/show_bug.cgi?id=21304
1323 Stop using a static wrapper map for WebCore JS bindings
1325 * kjs/JSGlobalData.cpp:
1326 (JSC::JSGlobalData::JSGlobalData):
1327 (JSC::JSGlobalData::~JSGlobalData):
1328 (JSC::JSGlobalData::ClientData::~ClientData):
1329 * kjs/JSGlobalData.h:
1330 Added a client data member to JSGlobalData. WebCore will use it to store bindings-related
1333 * JavaScriptCore.exp: Export virtual ClientData destructor.
1335 2008-10-02 Geoffrey Garen <ggaren@apple.com>
1339 Try to fix Qt build.
1343 2008-10-01 Geoffrey Garen <ggaren@apple.com>
1345 Reviewed by Darin Adler and Cameron Zwarich.
1347 Preliminary step toward dynamic recompilation: Standardized and
1348 simplified the parsing interface.
1350 The main goal in this patch is to make it easy to ask for a duplicate
1351 compilation, and get back a duplicate result -- same source URL, same
1352 debugger / profiler ID, same toString behavior, etc.
1354 The basic unit of compilation and evaluation is now SourceCode, which
1355 encompasses a SourceProvider, a range in that provider, and a starting
1358 A SourceProvider now encompasses a source URL, and *is* a source ID,
1359 since a pointer is a unique identifier.
1363 (JSCheckScriptSyntax): Provide a SourceCode to the Interpreter, since
1364 other APIs are no longer supported.
1367 (JSC::EvalCodeCache::get): Provide a SourceCode to the Interpreter, since
1368 other APIs are no longer supported.
1369 (JSC::CodeBlock::CodeBlock): ASSERT something that used to be ASSERTed
1370 by our caller -- this is a better bottleneck.
1372 * VM/CodeGenerator.cpp:
1373 (JSC::CodeGenerator::CodeGenerator): Updated for the fact that
1374 FunctionBodyNode's parameters are no longer a WTF::Vector.
1376 * kjs/Arguments.cpp:
1377 (JSC::Arguments::Arguments): ditto
1379 * kjs/DebuggerCallFrame.cpp:
1380 (JSC::DebuggerCallFrame::evaluate): Provide a SourceCode to the Parser,
1381 since other APIs are no longer supported.
1383 * kjs/FunctionConstructor.cpp:
1384 (JSC::constructFunction): Provide a SourceCode to the Parser, since
1385 other APIs are no longer supported. Adopt FunctionBodyNode's new
1386 "finishParsing" API.
1388 * kjs/JSFunction.cpp:
1389 (JSC::JSFunction::lengthGetter):
1390 (JSC::JSFunction::getParameterName): Updated for the fact that
1391 FunctionBodyNode's parameters are no longer a wtf::Vector.
1393 * kjs/JSFunction.h: Nixed some cruft.
1395 * kjs/JSGlobalObjectFunctions.cpp:
1396 (JSC::globalFuncEval): Provide a SourceCode to the Parser, since
1397 other APIs are no longer supported.
1400 (JSC::Parser::parse): Require a SourceCode argument, instead of a bunch
1401 of broken out parameters. Stop tracking sourceId as an integer, since we
1402 use the SourceProvider pointer for this now. Don't clamp the
1403 startingLineNumber, since SourceCode does that now.
1406 (JSC::Parser::parse): Standardized the parsing interface to require a
1412 (prettyPrintScript):
1414 (runInteractive): Provide a SourceCode to the Interpreter, since
1415 other APIs are no longer supported.
1417 * kjs/SourceProvider.h:
1418 (JSC::SourceProvider::SourceProvider):
1419 (JSC::SourceProvider::url):
1420 (JSC::SourceProvider::asId):
1421 (JSC::UStringSourceProvider::create):
1422 (JSC::UStringSourceProvider::UStringSourceProvider): Added new
1423 responsibilities described above.
1425 * kjs/SourceRange.h:
1426 (JSC::SourceCode::SourceCode):
1427 (JSC::SourceCode::toString):
1428 (JSC::SourceCode::provider):
1429 (JSC::SourceCode::firstLine):
1430 (JSC::SourceCode::data):
1431 (JSC::SourceCode::length): Added new responsibilities described above.
1432 Renamed SourceRange to SourceCode, based on review feedback. Added
1433 a makeSource function for convenience.
1435 * kjs/debugger.h: Provide a SourceCode to the client, since other APIs
1436 are no longer supported.
1438 * kjs/grammar.y: Provide startingLineNumber when creating a SourceCode.
1440 * kjs/debugger.h: Treat sourceId as intptr_t to avoid loss of precision
1443 * kjs/interpreter.cpp:
1444 (JSC::Interpreter::checkSyntax):
1445 (JSC::Interpreter::evaluate):
1446 * kjs/interpreter.h: Require a SourceCode instead of broken out arguments.
1449 (JSC::Lexer::setCode):
1451 (JSC::Lexer::sourceRange): Fold together the SourceProvider and line number
1452 into a SourceCode. Fixed a bug where the Lexer would accidentally keep
1453 alive the last SourceProvider forever.
1456 (JSC::ScopeNode::ScopeNode):
1457 (JSC::ProgramNode::ProgramNode):
1458 (JSC::ProgramNode::create):
1459 (JSC::EvalNode::EvalNode):
1460 (JSC::EvalNode::generateCode):
1461 (JSC::EvalNode::create):
1462 (JSC::FunctionBodyNode::FunctionBodyNode):
1463 (JSC::FunctionBodyNode::finishParsing):
1464 (JSC::FunctionBodyNode::create):
1465 (JSC::FunctionBodyNode::generateCode):
1466 (JSC::ProgramNode::generateCode):
1467 (JSC::FunctionBodyNode::paramString):
1470 (JSC::ScopeNode::sourceId):
1471 (JSC::FunctionBodyNode::):
1472 (JSC::FunctionBodyNode::parameterCount):
1473 (JSC::FuncExprNode::):
1474 (JSC::FuncDeclNode::): Store a SourceCode in all ScopeNodes, since
1475 SourceCode is now responsible for tracking URL, ID, etc. Streamlined
1476 some ad hoc FunctionBodyNode fixups into a "finishParsing" function, to
1477 help make clear what you need to do in order to finish parsing a
1481 (WTF::::releaseBuffer): Don't ASSERT that releaseBuffer() is only called
1482 when buffer is not 0, since FunctionBodyNode is more than happy
1483 to get back a 0 buffer, and other functions like RefPtr::release() allow
1486 2008-10-01 Cameron Zwarich <zwarich@apple.com>
1488 Reviewed by Maciej Stachowiak.
1490 Bug 21289: REGRESSION (r37160): Inspector crashes on load
1491 <https://bugs.webkit.org/show_bug.cgi?id=21289>
1493 The code in Arguments::mark() in r37160 was wrong. It marks indices in
1494 d->registers, but that makes no sense (they are local variables, not
1495 arguments). It should mark those indices in d->registerArray instead.
1497 This patch also changes Arguments::copyRegisters() to use d->numParameters
1498 instead of recomputing it.
1500 * kjs/Arguments.cpp:
1501 (JSC::Arguments::mark):
1503 (JSC::Arguments::copyRegisters):
1505 2008-09-30 Darin Adler <darin@apple.com>
1507 Reviewed by Eric Seidel.
1509 - https://bugs.webkit.org/show_bug.cgi?id=21214
1510 work on getting rid of ExecState
1512 Eliminate some unneeded uses of dynamicGlobalObject.
1514 * API/JSClassRef.cpp:
1515 (OpaqueJSClass::contextData): Changed to use a map in the global data instead
1516 of on the global object. Also fixed to use only a single hash table lookup.
1518 * API/JSObjectRef.cpp:
1519 (JSObjectMakeConstructor): Use lexicalGlobalObject rather than dynamicGlobalObject
1520 to get the object prototype.
1522 * kjs/ArrayPrototype.cpp:
1523 (JSC::arrayProtoFuncToString): Use arrayVisitedElements set in global data rather
1524 than in the global object.
1525 (JSC::arrayProtoFuncToLocaleString): Ditto.
1526 (JSC::arrayProtoFuncJoin): Ditto.
1528 * kjs/JSGlobalData.cpp:
1529 (JSC::JSGlobalData::JSGlobalData): Don't initialize opaqueJSClassData, since
1530 it's no longer a pointer.
1531 (JSC::JSGlobalData::~JSGlobalData): We still need to delete all the values, but
1532 we don't need to delete the map since it's no longer a pointer.
1534 * kjs/JSGlobalData.h: Made opaqueJSClassData a map instead of a pointer to a map.
1535 Also added arrayVisitedElements.
1537 * kjs/JSGlobalObject.h: Removed arrayVisitedElements.
1540 (functionRun): Use lexicalGlobalObject instead of dynamicGlobalObject.
1541 (functionLoad): Ditto.
1543 2008-10-01 Cameron Zwarich <zwarich@apple.com>
1547 Speculative Windows build fix.
1551 2008-10-01 Cameron Zwarich <zwarich@apple.com>
1553 Reviewed by Darin Adler.
1555 Bug 21123: using "arguments" in a function should not force creation of an activation object
1556 <https://bugs.webkit.org/show_bug.cgi?id=21123>
1558 Make the 'arguments' object not require a JSActivation. We store the
1559 'arguments' object in the OptionalCalleeArguments call frame slot. We
1560 need to be able to get the original 'arguments' object to tear it off
1561 when returning from a function, but 'arguments' may be assigned to in a
1564 Therefore, we use the OptionalCalleeArguments slot when we want to get
1565 the original activation or we know that 'arguments' was not assigned a
1566 different value. When 'arguments' may have been assigned a new value,
1567 we use a new local variable that is initialized with 'arguments'. Since
1568 a function parameter named 'arguments' may overwrite the value of
1569 'arguments', we also need to be careful to look up 'arguments' in the
1570 symbol table, so we get the parameter named 'arguments' instead of the
1571 local variable that we have added for holding the 'arguments' object.
1573 This is a 19.1% win on the V8 Raytrace benchmark using the SunSpider
1574 harness, and a 20.7% win using the V8 harness. This amounts to a 6.5%
1575 total speedup on the V8 benchmark suite using the V8 harness.
1578 (JSC::CTI::privateCompileMainPass):
1580 * VM/CodeGenerator.cpp:
1581 (JSC::CodeGenerator::CodeGenerator):
1583 (JSC::Machine::unwindCallFrame):
1584 (JSC::Machine::privateExecute):
1585 (JSC::Machine::retrieveArguments):
1586 (JSC::Machine::cti_op_init_arguments):
1587 (JSC::Machine::cti_op_ret_activation_arguments):
1589 * VM/RegisterFile.h:
1590 (JSC::RegisterFile::):
1591 * kjs/Arguments.cpp:
1592 (JSC::Arguments::mark):
1593 (JSC::Arguments::fillArgList):
1594 (JSC::Arguments::getOwnPropertySlot):
1595 (JSC::Arguments::put):
1597 (JSC::Arguments::setRegisters):
1598 (JSC::Arguments::init):
1599 (JSC::Arguments::Arguments):
1600 (JSC::Arguments::copyRegisters):
1601 (JSC::JSActivation::copyRegisters):
1602 * kjs/JSActivation.cpp:
1603 (JSC::JSActivation::argumentsGetter):
1604 * kjs/JSActivation.h:
1605 (JSC::JSActivation::JSActivationData::JSActivationData):
1608 (JSC::ScopeNode::setUsesArguments):
1609 * masm/X86Assembler.h:
1610 (JSC::X86Assembler::):
1611 (JSC::X86Assembler::orl_mr):
1613 2008-10-01 Kevin McCullough <kmccullough@apple.com>
1615 Rubberstamped by Geoff Garen.
1617 Remove BreakpointCheckStatement because it's not used anymore.
1618 No effect on sunspider or the jsc tests.
1623 2008-09-30 Oliver Hunt <oliver@apple.com>
1625 Reviewed by Geoff Garen.
1627 Improve performance of CTI on windows.
1629 Currently on platforms where the compiler doesn't allow us to safely
1630 index relative to the address of a parameter we need to actually
1631 provide a pointer to CTI runtime call arguments. This patch improves
1632 performance in this case by making the CTI logic for restoring this
1633 parameter much less conservative by only resetting it before we actually
1634 make a call, rather than between each and every SF bytecode we generate
1637 This results in a 3.6% progression on the v8 benchmark when compiled with MSVC.
1640 (JSC::CTI::emitCall):
1641 (JSC::CTI::compileOpCall):
1642 (JSC::CTI::privateCompileMainPass):
1643 (JSC::CTI::privateCompileSlowCases):
1644 (JSC::CTI::privateCompilePutByIdTransition):
1646 * masm/X86Assembler.h:
1649 2008-09-30 Maciej Stachowiak <mjs@apple.com>
1651 Reviewed by Oliver Hunt.
1653 - track uses of "this", "with" and "catch" in the parser
1655 Knowing this up front will be useful for future optimizations.
1657 Perf and correctness remain the same.
1662 2008-09-30 Sam Weinig <sam@webkit.org>
1664 Reviewed by Mark Rowe.
1666 Add WebKitAvailability macros for JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError,
1667 and JSObjectMakeRegExp
1669 * API/JSObjectRef.h:
1671 2008-09-30 Darin Adler <darin@apple.com>
1673 Reviewed by Geoff Garen.
1675 - https://bugs.webkit.org/show_bug.cgi?id=21214
1676 work on getting rid of ExecState
1678 Replaced the m_prev field of ExecState with a bit in the
1679 call frame pointer to indicate "host" call frames.
1682 (JSC::makeHostCallFramePointer): Added. Sets low bit.
1683 (JSC::isHostCallFrame): Added. Checks low bit.
1684 (JSC::stripHostCallFrameBit): Added. Clears low bit.
1685 (JSC::Machine::unwindCallFrame): Replaced null check that was
1686 formerly used to detect host call frames with an isHostCallFrame check.
1687 (JSC::Machine::execute): Pass in a host call frame pointer rather than
1688 always passing 0 when starting execution from the host. This allows us
1689 to follow the entire call frame pointer chain when desired, or to stop
1690 at the host calls when that's desired.
1691 (JSC::Machine::privateExecute): Replaced null check that was
1692 formerly used to detect host call frames with an isHostCallFrame check.
1693 (JSC::Machine::retrieveCaller): Ditto.
1694 (JSC::Machine::retrieveLastCaller): Ditto.
1695 (JSC::Machine::callFrame): Removed the code to walk up m_prev pointers
1696 and replaced it with code that uses the caller pointer and uses the
1697 stripHostCallFrameBit function.
1699 * kjs/ExecState.cpp: Removed m_prev.
1700 * kjs/ExecState.h: Ditto.
1702 2008-09-30 Cameron Zwarich <zwarich@apple.com>
1704 Reviewed by Geoff Garen.
1706 Move all detection of 'arguments' in a lexical scope to the parser, in
1707 preparation for fixing
1709 Bug 21123: using "arguments" in a function should not force creation of an activation object
1710 <https://bugs.webkit.org/show_bug.cgi?id=21123>
1712 * VM/CodeGenerator.cpp:
1713 (JSC::CodeGenerator::CodeGenerator):
1717 2008-09-30 Geoffrey Garen <ggaren@apple.com>
1722 (runWithScripts): Fixed indentation.
1724 2008-09-30 Mark Rowe <mrowe@apple.com>
1726 Rubber-stamped by Sam Weinig.
1728 Build fix. Move InternalFunction::classInfo implementation into the .cpp
1729 file to prevent the vtable for InternalFunction being generated as a weak symbol.
1730 Has no effect on SunSpider.
1732 * kjs/InternalFunction.cpp:
1733 (JSC::InternalFunction::classInfo):
1734 * kjs/InternalFunction.h:
1736 2008-09-29 Maciej Stachowiak <mjs@apple.com>
1738 Reviewed by Darin Adler.
1740 - optimize appending a number to a string
1741 https://bugs.webkit.org/show_bug.cgi?id=21203
1743 It's pretty common in real-world code (and on some of the v8
1744 benchmarks) to append a number to a string, so I made this one of
1745 the fast cases, and also added support to UString to do it
1746 directly without allocating a temporary UString.
1748 ~1% speedup on v8 benchmark.
1751 (JSC::jsAddSlowCase): Make this NEVER_INLINE because somehow otherwise
1752 the change is a regression.
1753 (JSC::jsAdd): Handle number + string special case.
1754 (JSC::Machine::cti_op_add): Integrate much of the logic of jsAdd to
1755 avoid exception check in the str + str, num + num and str + num cases.
1757 (JSC::expandedSize): Make this a non-member function, since it needs to be
1758 called in non-member functions but not outside this file.
1759 (JSC::expandCapacity): Ditto.
1760 (JSC::UString::expandCapacity): Call the non-member version.
1761 (JSC::createRep): Helper to make a rep from a char*.
1762 (JSC::UString::UString): Use above helper.
1763 (JSC::concatenate): Guts of concatenating constructor for cases where first
1764 item is a UString::Rep, and second is a UChar* and length, or a char*.
1765 (JSC::UString::append): Implement for cases where first item is a UString::Rep,
1766 and second is an int or double. Sadly duplicates logic of UString::from(int)
1767 and UString::from(double).
1770 2008-09-29 Darin Adler <darin@apple.com>
1772 Reviewed by Sam Weinig.
1774 - https://bugs.webkit.org/show_bug.cgi?id=21214
1775 work on getting rid of ExecState
1777 * JavaScriptCore.exp: Updated since JSGlobalObject::init
1778 no longer takes a parameter.
1781 (JSC::Machine::execute): Removed m_registerFile argument
1782 for ExecState constructors.
1784 * kjs/DebuggerCallFrame.cpp:
1785 (JSC::DebuggerCallFrame::evaluate): Removed globalThisValue
1786 argument for ExecState constructor.
1788 * kjs/ExecState.cpp:
1789 (JSC::ExecState::ExecState): Removed globalThisValue and
1790 registerFile arguments to constructors.
1792 * kjs/ExecState.h: Removed m_globalThisValue and
1793 m_registerFile data members.
1795 * kjs/JSGlobalObject.cpp:
1796 (JSC::JSGlobalObject::init): Removed globalThisValue
1797 argument for ExecState constructor.
1799 * kjs/JSGlobalObject.h:
1800 (JSC::JSGlobalObject::JSGlobalObject): Got rid of parameter
1801 for the init function.
1803 2008-09-29 Geoffrey Garen <ggaren@apple.com>
1805 Rubber-stamped by Cameron Zwarich.
1807 Fixed https://bugs.webkit.org/show_bug.cgi?id=21225
1808 Machine::retrieveLastCaller should check for a NULL codeBlock
1810 In order to crash, you would need to call retrieveCaller in a situation
1811 where you had two host call frames in a row in the register file. I
1812 don't know how to make that happen, or if it's even possible, so I don't
1813 have a test case -- but better safe than sorry!
1816 (JSC::Machine::retrieveLastCaller):
1818 2008-09-29 Geoffrey Garen <ggaren@apple.com>
1820 Reviewed by Cameron Zwarich.
1822 Store the callee ScopeChain, not the caller ScopeChain, in the call frame
1823 header. Nix the "scopeChain" local variable and ExecState::m_scopeChain, and
1824 access the callee ScopeChain through the call frame header instead.
1826 Profit: call + return are simpler, because they don't have to update the
1827 "scopeChain" local variable, or ExecState::m_scopeChain.
1829 Because CTI keeps "r" in a register, reading the callee ScopeChain relative
1830 to "r" can be very fast, in any cases we care to optimize.
1832 0% speedup on empty function call benchmark. (5.5% speedup in bytecode.)
1833 0% speedup on SunSpider. (7.5% speedup on controlflow-recursive.)
1834 2% speedup on SunSpider --v8.
1835 2% speedup on v8 benchmark.
1837 * VM/CTI.cpp: Changed scope chain access to read the scope chain from
1838 the call frame header. Sped up op_ret by changing it not to fuss with
1839 the "scopeChain" local variable or ExecState::m_scopeChain.
1841 * VM/CTI.h: Updated CTI trampolines not to take a ScopeChainNode*
1842 argument, since that's stored in the call frame header now.
1844 * VM/Machine.cpp: Access "scopeChain" and "codeBlock" through new helper
1845 functions that read from the call frame header. Updated functions operating
1846 on ExecState::m_callFrame to account for / take advantage of the fact that
1847 Exec:m_callFrame is now never NULL.
1849 Fixed a bug in op_construct, where it would use the caller's default
1850 object prototype, rather than the callee's, when constructing a new object.
1852 * VM/Machine.h: Made some helper functions available. Removed
1853 ScopeChainNode* arguments to a lot of functions, since the ScopeChainNode*
1854 is now stored in the call frame header.
1856 * VM/RegisterFile.h: Renamed "CallerScopeChain" to "ScopeChain", since
1857 that's what it is now.
1859 * kjs/DebuggerCallFrame.cpp: Updated for change to ExecState signature.
1861 * kjs/ExecState.cpp:
1862 * kjs/ExecState.h: Nixed ExecState::m_callFrame, along with the unused
1863 isGlobalObject function.
1865 * kjs/JSGlobalObject.cpp:
1866 * kjs/JSGlobalObject.h: Gave the global object a fake call frame in
1867 which to store the global scope chain, since our code now assumes that
1868 it can always read the scope chain out of the ExecState's call frame.
1870 2008-09-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1872 Reviewed by Sam Weinig.
1874 Remove the isActivationObject() virtual method on JSObject and use
1875 StructureID information instead. This should be slightly faster, but
1876 isActivationObject() is only used in assertions and unwinding the stack
1881 (JSC::Machine::unwindCallFrame):
1882 (JSC::Machine::privateExecute):
1883 (JSC::Machine::cti_op_ret_activation):
1884 * kjs/JSActivation.cpp:
1885 * kjs/JSActivation.h:
1888 2008-09-29 Peter Gal <galpeter@inf.u-szeged.hu>
1890 Reviewed and tweaked by Darin Adler.
1892 Fix build for non-all-in-one platforms.
1894 * kjs/StringPrototype.cpp: Added missing ASCIICType.h include.
1896 2008-09-29 Bradley T. Hughes <bradley.hughes@nokia.com>
1898 Reviewed by Simon Hausmann.
1900 Fix compilation with icpc
1906 2008-09-29 Thiago Macieira <thiago.macieira@nokia.com>
1908 Reviewed by Simon Hausmann.
1910 Changed copyright from Trolltech ASA to Nokia.
1912 Nokia acquired Trolltech ASA, assets were transferred on September 26th 2008.
1915 * wtf/qt/MainThreadQt.cpp:
1917 2008-09-29 Simon Hausmann <hausmann@webkit.org>
1919 Reviewed by Lars Knoll.
1921 Don't accidentially install libJavaScriptCore.a for the build inside
1924 * JavaScriptCore.pro:
1926 2008-09-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1928 Reviewed by Maciej Stachowiak.
1930 Bug 21200: Allow direct access to 'arguments' without using op_resolve
1931 <https://bugs.webkit.org/show_bug.cgi?id=21200>
1933 Allow fast access to the 'arguments' object by adding an extra slot to
1934 the callframe to store it.
1936 This is a 3.0% speedup on the V8 Raytrace benchmark.
1938 * JavaScriptCore.exp:
1940 (JSC::CTI::privateCompileMainPass):
1942 (JSC::CodeBlock::dump):
1943 * VM/CodeGenerator.cpp:
1944 (JSC::CodeGenerator::CodeGenerator):
1945 (JSC::CodeGenerator::registerFor):
1946 * VM/CodeGenerator.h:
1947 (JSC::CodeGenerator::registerFor):
1949 (JSC::Machine::initializeCallFrame):
1950 (JSC::Machine::dumpRegisters):
1951 (JSC::Machine::privateExecute):
1952 (JSC::Machine::retrieveArguments):
1953 (JSC::Machine::cti_op_call_JSFunction):
1954 (JSC::Machine::cti_op_create_arguments):
1955 (JSC::Machine::cti_op_construct_JSConstruct):
1958 * VM/RegisterFile.h:
1959 (JSC::RegisterFile::):
1960 * kjs/JSActivation.cpp:
1961 (JSC::JSActivation::mark):
1962 (JSC::JSActivation::argumentsGetter):
1963 * kjs/JSActivation.h:
1964 (JSC::JSActivation::JSActivationData::JSActivationData):
1967 (JSC::Parser::didFinishParsing):
1969 (JSC::Parser::parse):
1972 (JSC::ScopeNode::ScopeNode):
1973 (JSC::ProgramNode::ProgramNode):
1974 (JSC::ProgramNode::create):
1975 (JSC::EvalNode::EvalNode):
1976 (JSC::EvalNode::create):
1977 (JSC::FunctionBodyNode::FunctionBodyNode):
1978 (JSC::FunctionBodyNode::create):
1980 (JSC::ScopeNode::usesArguments):
1982 2008-09-28 Mark Rowe <mrowe@apple.com>
1984 Reviewed by Sam Weinig.
1986 Add an ASCII fast-path to toLowerCase and toUpperCase.
1988 The fast path speeds up the common case of an ASCII-only string by up to 60% while adding a less than 5% penalty
1989 to the less common non-ASCII case.
1991 This also removes stringProtoFuncToLocaleLowerCase and stringProtoFuncToLocaleUpperCase, which were identical
1992 to the non-locale variants of the functions. toLocaleLowerCase and toLocaleUpperCase now use the non-locale
1993 variants of the functions directly.
1995 * kjs/StringPrototype.cpp:
1996 (JSC::stringProtoFuncToLowerCase):
1997 (JSC::stringProtoFuncToUpperCase):
1999 2008-09-28 Mark Rowe <mrowe@apple.com>
2001 Reviewed by Cameron Zwarich.
2003 Speed up parseInt and parseFloat.
2005 Repeatedly indexing into a UString is slow, so retrieve a pointer into the underlying buffer once up front
2006 and use that instead. This is a 7% win on a parseInt/parseFloat micro-benchmark.
2008 * kjs/JSGlobalObjectFunctions.cpp:
2012 2008-09-28 Simon Hausmann <hausmann@webkit.org>
2014 Reviewed by David Hyatt.
2016 In Qt's initializeThreading re-use an existing thread identifier for the main
2017 thread if it exists.
2019 currentThread() implicitly creates new identifiers and it could be that
2020 it is called before initializeThreading().
2022 * wtf/ThreadingQt.cpp:
2023 (WTF::initializeThreading):
2025 2008-09-27 Keishi Hattori <casey.hattori@gmail.com>
2027 Added Machine::retrieveCaller to the export list.
2029 Reviewed by Kevin McCullough and Tim Hatcher.
2031 * JavaScriptCore.exp: Added Machine::retrieveCaller.
2033 2008-09-27 Anders Carlsson <andersca@apple.com>
2040 2008-09-27 Geoffrey Garen <ggaren@apple.com>
2042 Reviewed by Cameron Zwarich.
2044 https://bugs.webkit.org/show_bug.cgi?id=21175
2046 Store the callee CodeBlock, not the caller CodeBlock, in the call frame
2047 header. Nix the "codeBlock" local variable, and access the callee
2048 CodeBlock through the call frame header instead.
2050 Profit: call + return are simpler, because they don't have to update the
2051 "codeBlock" local variable.
2053 Because CTI keeps "r" in a register, reading the callee CodeBlock relative
2054 to "r" can be very fast, in any cases we care to optimize. Presently,
2055 no such cases seem important.
2057 Also, stop writing "dst" to the call frame header. CTI doesn't use it.
2059 21.6% speedup on empty function call benchmark.
2060 3.8% speedup on SunSpider --v8.
2061 2.1% speedup on v8 benchmark.
2062 0.7% speedup on SunSpider (6% speedup on controlflow-recursive).
2064 Small regression in bytecode, because currently every op_ret reads the
2065 callee CodeBlock to check needsFullScopeChain, and bytecode does not
2066 keep "r" in a register. On-balance, this is probably OK, since CTI is
2067 our high-performance execution model. Also, this should go away once
2068 we make needsFullScopeChain statically determinable at parse time.
2071 (JSC::CTI::compileOpCall): The speedup!
2072 (JSC::CTI::privateCompileSlowCases): ditto
2075 (JSC::): Fixed up magic trampoline constants to account for the nixed
2076 "codeBlock" argument.
2077 (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock"
2078 argument, since codeBlock is now stored in the call frame header.
2080 * VM/Machine.cpp: Read the callee CodeBlock from the register file. Use
2081 a NULL CallerRegisters in the call frame header to signal a built-in
2082 caller, since CodeBlock is now never NULL.
2084 * VM/Machine.h: Made some stand-alone functions Machine member functions
2085 so they could call the private codeBlock() accessor in the Register
2086 class, of which Machine is a friend. Renamed "CallerCodeBlock" to
2087 "CodeBlock", since it's no longer the caller's CodeBlock.
2089 * VM/RegisterFile.h: Marked some methods const to accommodate a
2090 const RegisterFile* being passed around in Machine.cpp.
2092 2008-09-26 Jan Michael Alonzo <jmalonzo@webkit.org>
2094 Gtk build fix. Not reviewed.
2096 Narrow-down the target of the JavaScriptCore .lut.h generator so
2097 it won't try to create the WebCore .lut.hs.
2101 2008-09-26 Matt Lilek <webkit@mattlilek.com>
2103 Reviewed by Tim Hatcher.
2105 Update FEATURE_DEFINES after ENABLE_CROSS_DOCUMENT_MESSAGING was removed.
2107 * Configurations/JavaScriptCore.xcconfig:
2109 2008-09-26 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2111 Rubber-stamped by Anders Carlson.
2113 Change the name 'sc' to 'scopeChainNode' in a few places.
2116 (JSC::EvalNode::generateCode):
2117 (JSC::FunctionBodyNode::generateCode):
2118 (JSC::ProgramNode::generateCode):
2120 2008-09-26 Sam Weinig <sam@webkit.org>
2122 Reviewed by Darin Adler.
2124 Patch for https://bugs.webkit.org/show_bug.cgi?id=21152
2125 Speedup static property get/put
2127 Convert getting/setting static property values to use static functions
2128 instead of storing an integer and switching in getValueProperty/putValueProperty.
2131 (JSC::JSObject::deleteProperty):
2132 (JSC::JSObject::getPropertyAttributes):
2133 * kjs/MathObject.cpp:
2134 (JSC::MathObject::getOwnPropertySlot):
2135 * kjs/NumberConstructor.cpp:
2136 (JSC::numberConstructorNaNValue):
2137 (JSC::numberConstructorNegInfinity):
2138 (JSC::numberConstructorPosInfinity):
2139 (JSC::numberConstructorMaxValue):
2140 (JSC::numberConstructorMinValue):
2141 * kjs/PropertySlot.h:
2142 (JSC::PropertySlot::):
2143 * kjs/RegExpConstructor.cpp:
2144 (JSC::regExpConstructorDollar1):
2145 (JSC::regExpConstructorDollar2):
2146 (JSC::regExpConstructorDollar3):
2147 (JSC::regExpConstructorDollar4):
2148 (JSC::regExpConstructorDollar5):
2149 (JSC::regExpConstructorDollar6):
2150 (JSC::regExpConstructorDollar7):
2151 (JSC::regExpConstructorDollar8):
2152 (JSC::regExpConstructorDollar9):
2153 (JSC::regExpConstructorInput):
2154 (JSC::regExpConstructorMultiline):
2155 (JSC::regExpConstructorLastMatch):
2156 (JSC::regExpConstructorLastParen):
2157 (JSC::regExpConstructorLeftContext):
2158 (JSC::regExpConstructorRightContext):
2159 (JSC::setRegExpConstructorInput):
2160 (JSC::setRegExpConstructorMultiline):
2161 (JSC::RegExpConstructor::setInput):
2162 (JSC::RegExpConstructor::setMultiline):
2163 (JSC::RegExpConstructor::multiline):
2164 * kjs/RegExpConstructor.h:
2165 * kjs/RegExpObject.cpp:
2166 (JSC::regExpObjectGlobal):
2167 (JSC::regExpObjectIgnoreCase):
2168 (JSC::regExpObjectMultiline):
2169 (JSC::regExpObjectSource):
2170 (JSC::regExpObjectLastIndex):
2171 (JSC::setRegExpObjectLastIndex):
2172 * kjs/RegExpObject.h:
2173 (JSC::RegExpObject::setLastIndex):
2174 (JSC::RegExpObject::lastIndex):
2175 (JSC::RegExpObject::RegExpObjectData::RegExpObjectData):
2176 * kjs/StructureID.cpp:
2177 (JSC::StructureID::getEnumerablePropertyNames):
2178 * kjs/create_hash_table:
2182 (JSC::HashTable::createTable):
2183 (JSC::HashTable::deleteTable):
2184 (JSC::setUpStaticFunctionSlot):
2186 (JSC::HashEntry::initialize):
2187 (JSC::HashEntry::setKey):
2188 (JSC::HashEntry::key):
2189 (JSC::HashEntry::attributes):
2190 (JSC::HashEntry::function):
2191 (JSC::HashEntry::functionLength):
2192 (JSC::HashEntry::propertyGetter):
2193 (JSC::HashEntry::propertyPutter):
2194 (JSC::HashEntry::lexerValue):
2196 (JSC::HashTable::entry):
2197 (JSC::getStaticPropertySlot):
2198 (JSC::getStaticValueSlot):
2201 2008-09-26 Gavin Barraclough <barraclough@apple.com>
2203 Reviewed by Maciej Stachowiak & Oliver Hunt.
2205 Add support for reusing temporary JSNumberCells. This change is based on the observation
2206 that if the result of certain operations is a JSNumberCell and is consumed by a subsequent
2207 operation that would produce a JSNumberCell, we can reuse the object rather than allocating
2208 a fresh one. E.g. given the expression ((a * b) * c), we can statically determine that
2209 (a * b) will have a numeric result (or else it will have thrown an exception), so the result
2210 will either be a JSNumberCell or a JSImmediate.
2212 This patch changes three areas of JSC:
2213 * The AST now tracks type information about the result of each node.
2214 * This information is consumed in bytecode compilation, and certain bytecode operations
2215 now carry the statically determined type information about their operands.
2216 * CTI uses the information in a number of fashions:
2217 * Where an operand to certain arithmetic operations is reusable, it will plant code
2218 to try to perform the operation in JIT code & reuse the cell, where appropriate.
2219 * Where it can be statically determined that an operand can only be numeric (typically
2220 the result of another arithmetic operation) the code will not redundantly check that
2221 the JSCell is a JSNumberCell.
2222 * Where either of the operands to an add are non-numeric do not plant an optimized
2223 arithmetic code path, just call straight out to the C function.
2225 +6% Sunspider (10% progression on 3D, 16% progression on math, 60% progression on access-nbody),
2226 +1% v8-tests (improvements in raytrace & crypto)
2228 * VM/CTI.cpp: Add optimized code generation with reuse of temporary JSNumberCells.
2230 * kjs/JSNumberCell.h:
2231 * masm/X86Assembler.h:
2233 * VM/CodeBlock.cpp: Add type information to specific bytecodes.
2234 * VM/CodeGenerator.cpp:
2235 * VM/CodeGenerator.h:
2238 * kjs/nodes.cpp: Track static type information for nodes.
2240 * kjs/ResultDescriptor.h: (Added)
2241 * JavaScriptCore.xcodeproj/project.pbxproj:
2243 2008-09-26 Yichao Yin <yichao.yin@torchmobile.com.cn>
2245 Reviewed by George Staikos, Maciej Stachowiak.
2247 Add utility functions needed for upcoming WML code.
2250 (WTF::isASCIIPrintable):
2252 2008-09-26 Geoffrey Garen <ggaren@apple.com>
2254 Reviewed by Darin Adler.
2256 Reverted the part of r36614 that used static data because static data
2259 2008-09-26 Geoffrey Garen <ggaren@apple.com>
2261 Reviewed by Maciej Stachowiak.
2263 Removed dynamic check for whether the callee needs an activation object.
2264 Replaced with callee code to create the activation object.
2266 0.5% speedup on SunSpider.
2267 No change on v8 benchmark. (Might be a speedup, but it's in range of the
2270 0.7% speedup on v8 benchmark in bytecode.
2271 1.3% speedup on empty call benchmark in bytecode.
2274 (JSC::CTI::privateCompileMainPass): Added support for op_init_activation,
2275 the new opcode that specifies that the callee's initialization should
2276 create an activation object.
2277 (JSC::CTI::privateCompile): Removed previous code that did a similar
2278 thing in an ad-hoc way.
2281 (JSC::CodeBlock::dump): Added a case for dumping op_init_activation.
2283 * VM/CodeGenerator.cpp:
2284 (JSC::CodeGenerator::generate): Added fixup code to change op_init to
2285 op_init_activation if necessary. (With a better parser, we would know
2286 which to use from the beginning.)
2289 (JSC::Instruction::Instruction):
2290 (WTF::): Faster traits for the instruction vector. An earlier version
2291 of this patch relied on inserting at the beginning of the vector, and
2292 depended on this change for speed.
2295 (JSC::Machine::execute): Removed clients of setScopeChain, the old
2296 abstraction for dynamically checking for whether an activation object
2297 needed to be created.
2298 (JSC::Machine::privateExecute): ditto
2300 (JSC::Machine::cti_op_push_activation): Renamed this function from
2301 cti_vm_updateScopeChain, and made it faster by removing the call to
2305 * VM/Opcode.h: Declared op_init_activation.
2307 2008-09-24 Geoffrey Garen <ggaren@apple.com>
2309 Reviewed by Maciej Stachowiak.
2311 Move most of the return code back into the callee, now that the callee
2312 doesn't have to calculate anything dynamically.
2314 11.5% speedup on empty function call benchmark.
2316 SunSpider says 0.3% faster. SunSpider --v8 says no change.
2319 (JSC::CTI::compileOpCall):
2320 (JSC::CTI::privateCompileMainPass):
2321 (JSC::CTI::privateCompileSlowCases):
2323 2008-09-24 Sam Weinig <sam@webkit.org>
2325 Reviewed by Maciej Stachowiak.
2327 Remove staticFunctionGetter. There is only one remaining user of
2328 staticFunctionGetter and it can be converted to use setUpStaticFunctionSlot.
2330 * JavaScriptCore.exp:
2334 2008-09-24 Maciej Stachowiak <mjs@apple.com>
2336 Reviewed by Oliver Hunt.
2338 - inline JIT fast case of op_neq
2339 - remove extra level of function call indirection from slow cases of eq and neq
2341 1% speedup on Richards
2344 (JSC::CTI::privateCompileMainPass):
2345 (JSC::CTI::privateCompileSlowCases):
2347 (JSC::Machine::privateExecute):
2348 (JSC::Machine::cti_op_eq):
2349 (JSC::Machine::cti_op_neq):
2350 * kjs/operations.cpp:
2352 (JSC::equalSlowCase):
2354 (JSC::equalSlowCaseInline):
2356 2008-09-24 Sam Weinig <sam@webkit.org>
2358 Reviewed by Darin Adler.
2360 Fix for https://bugs.webkit.org/show_bug.cgi?id=21080
2361 <rdar://problem/6243534>
2362 Crash below Function.apply when using a runtime array as the argument list
2364 Test: plugins/bindings-array-apply-crash.html
2366 * kjs/FunctionPrototype.cpp:
2367 (JSC::functionProtoFuncApply): Revert to the slow case if the object inherits from
2368 JSArray (via ClassInfo) but is not a JSArray.
2370 2008-09-24 Kevin McCullough <kmccullough@apple.com>
2375 (JSC::statementListEmitCode):
2377 2008-09-24 Kevin McCullough <kmccullough@apple.com>
2381 Bug 21031: Breakpoints in the condition of loops only breaks the first
2383 - Now when setting breakpoints in the condition of a loop (for, while,
2384 for in, and do while) will successfully break each time throught the
2386 - For 'for' loops we need a little more complicated behavior that cannot
2387 be accomplished without some more significant changes:
2388 https://bugs.webkit.org/show_bug.cgi?id=21073
2391 (JSC::statementListEmitCode): We don't want to blindly emit a debug hook
2392 at the first line of loops, instead let the loop emit the debug hooks.
2393 (JSC::DoWhileNode::emitCode):
2394 (JSC::WhileNode::emitCode):
2395 (JSC::ForNode::emitCode):
2396 (JSC::ForInNode::emitCode):
2398 (JSC::StatementNode::):
2399 (JSC::DoWhileNode::):
2403 2008-09-24 Geoffrey Garen <ggaren@apple.com>
2405 Reviewed by Darin Adler.
2407 Fixed <rdar://problem/5605532> Need a SPI for telling JS the size of
2408 the objects it retains
2410 * API/tests/testapi.c: Test the new SPI a little.
2412 * API/JSSPI.cpp: Add the new SPI.
2413 * API/JSSPI.h: Add the new SPI.
2414 * JavaScriptCore.exp: Add the new SPI.
2415 * JavaScriptCore.xcodeproj/project.pbxproj: Add the new SPI.
2417 2008-09-24 Geoffrey Garen <ggaren@apple.com>
2419 Reviewed by Darin Adler.
2421 * API/JSBase.h: Filled in some missing function names.
2423 2008-09-24 Geoffrey Garen <ggaren@apple.com>
2425 Reviewed by Cameron Zwarich.
2427 Fixed https://bugs.webkit.org/show_bug.cgi?id=21057
2428 Crash in RegisterID::deref() running fast/canvas/canvas-putImageData.html
2430 * VM/CodeGenerator.h: Changed declaration order to ensure the
2431 m_lastConstant, which is a RefPtr that points into m_calleeRegisters,
2432 has its destructor called before the destructor for m_calleeRegisters.
2434 2008-09-24 Darin Adler <darin@apple.com>
2436 Reviewed by Sam Weinig.
2438 - https://bugs.webkit.org/show_bug.cgi?id=21047
2439 speed up ret_activation with inlining
2441 About 1% on v8-raytrace.
2443 * JavaScriptCore.exp: Removed JSVariableObject::setRegisters.
2445 * kjs/JSActivation.cpp: Moved copyRegisters to the header to make it inline.
2446 * kjs/JSActivation.h:
2447 (JSC::JSActivation::copyRegisters): Moved here. Also removed the registerArraySize
2448 argument to setRegisters, since the object doesn't need to store the number of
2451 * kjs/JSGlobalObject.cpp:
2452 (JSC::JSGlobalObject::reset): Removed unnecessary clearing left over from when we
2453 used this on objects that weren't brand new. These days, this function is really
2454 just part of the constructor.
2456 * kjs/JSGlobalObject.h: Added registerArraySize to JSGlobalObjectData, since
2457 JSVariableObjectData no longer needs it. Added a setRegisters override here
2458 that handles storing the size.
2460 * kjs/JSStaticScopeObject.h: Removed code to set registerArraySize, since it
2463 * kjs/JSVariableObject.cpp: Moved copyRegisterArray and setRegisters to the
2464 header to make them inline.
2465 * kjs/JSVariableObject.h: Removed registerArraySize from JSVariableObjectData,
2466 since it was only used for the global object.
2467 (JSC::JSVariableObject::copyRegisterArray): Moved here ot make it inline.
2468 (JSC::JSVariableObject::setRegisters): Moved here to make it inline. Also
2469 removed the code to set registerArraySize and changed an if statement into
2470 an assert to save an unnnecessary branch.
2472 2008-09-24 Maciej Stachowiak <mjs@apple.com>
2474 Reviewed by Oliver Hunt.
2476 - inline PropertyMap::getOffset to speed up polymorphic lookups
2478 ~1.5% speedup on v8 benchmark
2479 no effect on SunSpider
2481 * JavaScriptCore.exp:
2482 * kjs/PropertyMap.cpp:
2483 * kjs/PropertyMap.h:
2484 (JSC::PropertyMap::getOffset):
2486 2008-09-24 Jan Michael Alonzo <jmalonzo@webkit.org>
2488 Reviewed by Alp Toker.
2490 https://bugs.webkit.org/show_bug.cgi?id=20992
2491 Build fails on GTK+ Mac OS
2493 * wtf/ThreadingGtk.cpp: Remove platform ifdef as suggested by
2495 (WTF::initializeThreading):
2497 2008-09-23 Oliver Hunt <oliver@apple.com>
2499 Reviewed by Maciej Stachowiak.
2501 Bug 19968: Slow Script at www.huffingtonpost.com
2502 <https://bugs.webkit.org/show_bug.cgi?id=19968>
2504 Finally found the cause of this accursed issue. It is triggered
2505 by synchronous creation of a new global object from JS. The new
2506 global object resets the timer state in this execution group's
2507 Machine, taking timerCheckCount to 0. Then when JS returns the
2508 timerCheckCount is decremented making it non-zero. The next time
2509 we execute JS we will start the timeout counter, however the non-zero
2510 timeoutCheckCount means we don't reset the timer information. This
2511 means that the timeout check is now checking the cumulative time
2512 since the creation of the global object rather than the time since
2513 JS was last entered. At this point the slow script dialog is guaranteed
2514 to eventually be displayed incorrectly unless a page is loaded
2515 asynchronously (which will reset everything into a sane state).
2517 The fix for this is rather trivial -- the JSGlobalObject constructor
2518 should not be resetting the machine timer state.
2521 (JSC::Machine::Machine):
2522 Now that we can't rely on the GlobalObject initialising the timeout
2523 state, we do it in the Machine constructor.
2526 (JSC::Machine::stopTimeoutCheck):
2527 Add assertions to guard against this happening.
2529 * kjs/JSGlobalObject.cpp:
2530 (JSC::JSGlobalObject::init):
2531 Don't reset the timeout state.
2533 2008-09-23 Geoffrey Garen <ggaren@apple.com>
2535 Reviewed by Oliver Hunt.
2537 Fixed https://bugs.webkit.org/show_bug.cgi?id=21038 | <rdar://problem/6240812>
2538 Uncaught exceptions in regex replace callbacks crash webkit
2540 This was a combination of two problems:
2542 (1) the replace function would continue execution after an exception
2545 (2) In some cases, the Machine would return 0 in the case of an exception,
2546 despite the fact that a few clients dereference the Machine's return
2547 value without first checking for an exception.
2550 (JSC::Machine::execute):
2552 ^ Return jsNull() instead of 0 in the case of an exception, since some
2553 clients depend on using our return value.
2555 ^ ASSERT that execution does not continue after an exception has been
2556 thrown, to help catch problems like this in the future.
2558 * kjs/StringPrototype.cpp:
2559 (JSC::stringProtoFuncReplace):
2561 ^ Stop execution if an exception has been thrown.
2563 2008-09-23 Geoffrey Garen <ggaren@apple.com>
2565 Try to fix the windows build.
2568 (JSC::CTI::compileOpCall):
2569 (JSC::CTI::privateCompileMainPass):
2571 2008-09-23 Alp Toker <alp@nuanti.com>
2577 2008-09-23 Geoffrey Garen <ggaren@apple.com>
2579 Reviewed by Darin Adler.
2581 * wtf/Platform.h: Removed duplicate #if.
2583 2008-09-23 Geoffrey Garen <ggaren@apple.com>
2585 Reviewed by Darin Adler.
2587 Changed the layout of the call frame from
2589 { header, parameters, locals | constants, temporaries }
2593 { parameters, header | locals, constants, temporaries }
2595 This simplifies function entry+exit, and enables a number of future
2598 13.5% speedup on empty call benchmark for bytecode; 23.6% speedup on
2599 empty call benchmark for CTI.
2601 SunSpider says no change. SunSpider --v8 says 1% faster.
2605 Added a bit of abstraction for calculating whether a register is a
2606 constant, since this patch changes that calculation:
2607 (JSC::CTI::isConstant):
2608 (JSC::CTI::getConstant):
2609 (JSC::CTI::emitGetArg):
2610 (JSC::CTI::emitGetPutArg):
2611 (JSC::CTI::getConstantImmediateNumericArg):
2613 Updated for changes to callframe header location:
2614 (JSC::CTI::emitPutToCallFrameHeader):
2615 (JSC::CTI::emitGetFromCallFrameHeader):
2616 (JSC::CTI::printOpcodeOperandTypes):
2618 Renamed to spite Oliver:
2619 (JSC::CTI::emitInitRegister):
2621 Added an abstraction for emitting a call through a register, so that
2622 calls through registers generate exception info, too:
2623 (JSC::CTI::emitCall):
2625 Updated to match the new callframe header layout, and to support calls
2626 through registers, which have no destination address:
2627 (JSC::CTI::compileOpCall):
2628 (JSC::CTI::privateCompileMainPass):
2629 (JSC::CTI::privateCompileSlowCases):
2630 (JSC::CTI::privateCompile):
2635 (JSC::CallRecord::CallRecord):
2639 Updated for new register layout:
2640 (JSC::registerName):
2641 (JSC::CodeBlock::dump):
2645 Updated CodeBlock to track slightly different information about the
2646 register frame, and tweaked the style of an ASSERT_NOT_REACHED.
2647 (JSC::CodeBlock::CodeBlock):
2648 (JSC::CodeBlock::getStubInfo):
2650 * VM/CodeGenerator.cpp:
2652 Added some abstraction around constant register allocation, since this
2653 patch changes it, changed codegen to account for the new callframe
2654 layout, and added abstraction around register fetching code
2655 that used to assume that all local registers lived at negative indices,
2656 since vars now live at positive indices:
2657 (JSC::CodeGenerator::generate):
2658 (JSC::CodeGenerator::addVar):
2659 (JSC::CodeGenerator::addGlobalVar):
2660 (JSC::CodeGenerator::allocateConstants):
2661 (JSC::CodeGenerator::CodeGenerator):
2662 (JSC::CodeGenerator::addParameter):
2663 (JSC::CodeGenerator::registerFor):
2664 (JSC::CodeGenerator::constRegisterFor):
2665 (JSC::CodeGenerator::newRegister):
2666 (JSC::CodeGenerator::newTemporary):
2667 (JSC::CodeGenerator::highestUsedRegister):
2668 (JSC::CodeGenerator::addConstant):
2670 ASSERT that our caller referenced the registers it passed to us.
2671 Otherwise, we might overwrite them with parameters:
2672 (JSC::CodeGenerator::emitCall):
2673 (JSC::CodeGenerator::emitConstruct):
2675 * VM/CodeGenerator.h:
2677 Added some abstraction for getting a RegisterID for a given index,
2678 since the rules are a little weird:
2679 (JSC::CodeGenerator::registerFor):
2683 Utility function to transform a machine return PC to a virtual machine
2684 return VPC, for the sake of stack unwinding, since both PCs are stored
2685 in the same location now:
2688 Tweaked to account for new call frame:
2689 (JSC::Machine::initializeCallFrame):
2691 Tweaked to account for registerOffset supplied by caller:
2692 (JSC::slideRegisterWindowForCall):
2694 Tweaked to account for new register layout:
2695 (JSC::scopeChainForCall):
2696 (JSC::Machine::callEval):
2697 (JSC::Machine::dumpRegisters):
2698 (JSC::Machine::unwindCallFrame):
2699 (JSC::Machine::execute):
2701 Changed op_call and op_construct to implement the new calling convention:
2702 (JSC::Machine::privateExecute):
2704 Tweaked to account for the new register layout:
2705 (JSC::Machine::retrieveArguments):
2706 (JSC::Machine::retrieveCaller):
2707 (JSC::Machine::retrieveLastCaller):
2708 (JSC::Machine::callFrame):
2709 (JSC::Machine::getArgumentsData):
2711 Changed CTI call helpers to implement the new calling convention:
2712 (JSC::Machine::cti_op_call_JSFunction):
2713 (JSC::Machine::cti_op_call_NotJSFunction):
2714 (JSC::Machine::cti_op_ret_activation):
2715 (JSC::Machine::cti_op_ret_profiler):
2716 (JSC::Machine::cti_op_construct_JSConstruct):
2717 (JSC::Machine::cti_op_construct_NotJSConstruct):
2718 (JSC::Machine::cti_op_call_eval):
2724 Renamed op_initialise_locals to op_init, because this opcode
2725 doesn't initialize all locals, and it doesn't initialize only locals.
2726 Also, to spite Oliver.
2728 * VM/RegisterFile.h:
2730 New call frame enumeration values:
2731 (JSC::RegisterFile::):
2733 Simplified the calculation of whether a RegisterID is a temporary,
2734 since we can no longer assume that all positive non-constant registers
2737 (JSC::RegisterID::RegisterID):
2738 (JSC::RegisterID::setTemporary):
2739 (JSC::RegisterID::isTemporary):
2741 Renamed firstArgumentIndex to firstParameterIndex because the assumption
2742 that this variable pertained to the actual arguments supplied by the
2743 caller caused me to write some buggy code:
2744 * kjs/Arguments.cpp:
2745 (JSC::ArgumentsData::ArgumentsData):
2746 (JSC::Arguments::Arguments):
2747 (JSC::Arguments::fillArgList):
2748 (JSC::Arguments::getOwnPropertySlot):
2749 (JSC::Arguments::put):
2751 Updated for new call frame layout:
2752 * kjs/DebuggerCallFrame.cpp:
2753 (JSC::DebuggerCallFrame::functionName):
2754 (JSC::DebuggerCallFrame::type):
2755 * kjs/DebuggerCallFrame.h:
2757 Changed the activation object to account for the fact that a call frame
2758 header now sits between parameters and local variables. This change
2759 requires all variable objects to do their own marking, since they
2760 now use their register storage differently:
2761 * kjs/JSActivation.cpp:
2762 (JSC::JSActivation::mark):
2763 (JSC::JSActivation::copyRegisters):
2764 (JSC::JSActivation::createArgumentsObject):
2765 * kjs/JSActivation.h:
2767 Updated global object to use the new interfaces required by the change
2768 to JSActivation above:
2769 * kjs/JSGlobalObject.cpp:
2770 (JSC::JSGlobalObject::reset):
2771 (JSC::JSGlobalObject::mark):
2772 (JSC::JSGlobalObject::copyGlobalsFrom):
2773 (JSC::JSGlobalObject::copyGlobalsTo):
2774 * kjs/JSGlobalObject.h:
2775 (JSC::JSGlobalObject::addStaticGlobals):
2777 Updated static scope object to use the new interfaces required by the
2778 change to JSActivation above:
2779 * kjs/JSStaticScopeObject.cpp:
2780 (JSC::JSStaticScopeObject::mark):
2781 (JSC::JSStaticScopeObject::~JSStaticScopeObject):
2782 * kjs/JSStaticScopeObject.h:
2783 (JSC::JSStaticScopeObject::JSStaticScopeObject):
2784 (JSC::JSStaticScopeObject::d):
2786 Updated variable object to use the new interfaces required by the
2787 change to JSActivation above:
2788 * kjs/JSVariableObject.cpp:
2789 (JSC::JSVariableObject::copyRegisterArray):
2790 (JSC::JSVariableObject::setRegisters):
2791 * kjs/JSVariableObject.h:
2793 Changed the bit twiddling in symbol table not to assume that all indices
2794 are negative, since they can be positive now:
2795 * kjs/SymbolTable.h:
2796 (JSC::SymbolTableEntry::SymbolTableEntry):
2797 (JSC::SymbolTableEntry::isNull):
2798 (JSC::SymbolTableEntry::getIndex):
2799 (JSC::SymbolTableEntry::getAttributes):
2800 (JSC::SymbolTableEntry::setAttributes):
2801 (JSC::SymbolTableEntry::isReadOnly):
2802 (JSC::SymbolTableEntry::pack):
2803 (JSC::SymbolTableEntry::isValidIndex):
2805 Changed call and construct nodes to ref their functions and/or bases,
2806 so that emitCall/emitConstruct doesn't overwrite them with parameters.
2807 Also, updated for rename to registerFor:
2809 (JSC::ResolveNode::emitCode):
2810 (JSC::NewExprNode::emitCode):
2811 (JSC::EvalFunctionCallNode::emitCode):
2812 (JSC::FunctionCallValueNode::emitCode):
2813 (JSC::FunctionCallResolveNode::emitCode):
2814 (JSC::FunctionCallBracketNode::emitCode):
2815 (JSC::FunctionCallDotNode::emitCode):
2816 (JSC::PostfixResolveNode::emitCode):
2817 (JSC::DeleteResolveNode::emitCode):
2818 (JSC::TypeOfResolveNode::emitCode):
2819 (JSC::PrefixResolveNode::emitCode):
2820 (JSC::ReadModifyResolveNode::emitCode):
2821 (JSC::AssignResolveNode::emitCode):
2822 (JSC::ConstDeclNode::emitCodeSingle):
2823 (JSC::ForInNode::emitCode):
2825 Added abstraction for getting exception info out of a call through a
2827 * masm/X86Assembler.h:
2828 (JSC::X86Assembler::emitCall):
2830 Removed duplicate #if:
2833 2008-09-23 Kevin McCullough <kmccullough@apple.com>
2837 Bug 21030: The JS debugger breaks on the do of a do-while not the while
2838 (where the conditional statement is)
2839 https://bugs.webkit.org/show_bug.cgi?id=21030
2840 Now the statementListEmitCode detects if a do-while node is being
2841 emited and emits the debug hook on the last line instead of the first.
2843 This change had no effect on sunspider.
2846 (JSC::statementListEmitCode):
2848 (JSC::StatementNode::isDoWhile):
2849 (JSC::DoWhileNode::isDoWhile):
2851 2008-09-23 Maciej Stachowiak <mjs@apple.com>
2853 Reviewed by Camron Zwarich.
2855 - inline the fast case of instanceof
2856 https://bugs.webkit.org/show_bug.cgi?id=20818
2858 ~2% speedup on EarleyBoyer test.
2861 (JSC::CTI::privateCompileMainPass):
2862 (JSC::CTI::privateCompileSlowCases):
2864 (JSC::Machine::cti_op_instanceof):
2866 2008-09-23 Maciej Stachowiak <mjs@apple.com>
2868 Reviewed by Cameron Zwarich.
2870 - add forgotten slow case logic for !==
2873 (JSC::CTI::privateCompileSlowCases):
2875 2008-09-23 Maciej Stachowiak <mjs@apple.com>
2877 Reviewed by Cameron Zwarich.
2879 - inline the fast cases of !==, same as for ===
2881 2.9% speedup on EarleyBoyer benchmark
2884 (JSC::CTI::compileOpStrictEq): Factored stricteq codegen into this function,
2885 and parameterized so it can do the reverse version as well.
2886 (JSC::CTI::privateCompileMainPass): Use the above for stricteq and nstricteq.
2888 (JSC::CTI::): Declare above stuff.
2890 (JSC::Machine::cti_op_nstricteq): Removed fast cases, now handled inline.
2892 2008-09-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2894 Reviewed by Oliver Hunt.
2896 Bug 20989: Aguments constructor should put 'callee' and 'length' properties in a more efficient way
2897 <https://bugs.webkit.org/show_bug.cgi?id=20989>
2899 Make special cases for the 'callee' and 'length' properties in the
2902 This is somewhere between a 7.8% speedup and a 10% speedup on the V8
2903 Raytrace benchmark, depending on whether it is run alone or with the
2904 other V8 benchmarks.
2906 * kjs/Arguments.cpp:
2907 (JSC::ArgumentsData::ArgumentsData):
2908 (JSC::Arguments::Arguments):
2909 (JSC::Arguments::mark):
2910 (JSC::Arguments::getOwnPropertySlot):
2911 (JSC::Arguments::put):
2912 (JSC::Arguments::deleteProperty):
2914 2008-09-23 Maciej Stachowiak <mjs@apple.com>
2918 - speed up instanceof some more
2919 https://bugs.webkit.org/show_bug.cgi?id=20818
2921 ~2% speedup on EarleyBoyer
2923 The idea here is to record in the StructureID whether the class
2924 needs a special hasInstance or if it can use the normal logic from
2927 Based on this I inlined the real work directly into
2928 cti_op_instanceof and put the fastest checks up front and the
2929 error handling at the end (so it should be fairly straightforward
2930 to split off the beginning to be inlined if desired).
2932 I only did this for CTI, not the bytecode interpreter.
2934 * API/JSCallbackObject.h:
2935 (JSC::JSCallbackObject::createStructureID):
2938 (JSC::Machine::cti_op_instanceof):
2939 * kjs/JSImmediate.h:
2940 (JSC::JSImmediate::isAnyImmediate):
2942 (JSC::TypeInfo::overridesHasInstance):
2943 (JSC::TypeInfo::flags):
2945 2008-09-22 Darin Adler <darin@apple.com>
2947 Reviewed by Sam Weinig.
2949 - https://bugs.webkit.org/show_bug.cgi?id=21019
2950 make FunctionBodyNode::ref/deref fast
2952 Speeds up v8-raytrace by 7.2%.
2955 (JSC::FunctionBodyNode::FunctionBodyNode): Initialize m_refCount to 0.
2957 (JSC::FunctionBodyNode::ref): Call base class ref once, and thereafter use
2959 (JSC::FunctionBodyNode::deref): Ditto, but the deref side.
2961 2008-09-22 Darin Adler <darin@apple.com>
2963 Pointed out by Sam Weinig.
2965 * kjs/Arguments.cpp:
2966 (JSC::Arguments::fillArgList): Fix bad copy and paste. Oops!
2968 2008-09-22 Darin Adler <darin@apple.com>
2970 Reviewed by Cameron Zwarich.
2972 - https://bugs.webkit.org/show_bug.cgi?id=20983
2973 ArgumentsData should have some room to allocate some extra arguments inline
2975 Speeds up v8-raytrace by 5%.
2977 * kjs/Arguments.cpp:
2978 (JSC::ArgumentsData::ArgumentsData): Use a fixed buffer if there are 4 or fewer
2980 (JSC::Arguments::Arguments): Use a fixed buffer if there are 4 or fewer
2982 (JSC::Arguments::~Arguments): Delete the buffer if necessary.
2983 (JSC::Arguments::mark): Update since extraArguments are now Register.
2984 (JSC::Arguments::fillArgList): Added special case for the only case that's
2985 actually used in the practice, when there are no parameters. There are some
2986 other special cases in there too, but that's the only one that matters.
2987 (JSC::Arguments::getOwnPropertySlot): Updated to use setValueSlot since there's
2988 no operation to get you at the JSValue* inside a Register as a "slot".
2990 2008-09-22 Sam Weinig <sam@webkit.org>
2992 Reviewed by Maciej Stachowiak.
2994 Patch for https://bugs.webkit.org/show_bug.cgi?id=21014
2995 Speed up for..in by using StructureID to avoid calls to hasProperty
2997 Speeds up fasta by 8%.
2999 * VM/JSPropertyNameIterator.cpp:
3000 (JSC::JSPropertyNameIterator::invalidate):
3001 * VM/JSPropertyNameIterator.h:
3002 (JSC::JSPropertyNameIterator::next):
3003 * kjs/PropertyNameArray.h:
3004 (JSC::PropertyNameArrayData::begin):
3005 (JSC::PropertyNameArrayData::end):
3006 (JSC::PropertyNameArrayData::setCachedStructureID):
3007 (JSC::PropertyNameArrayData::cachedStructureID):
3008 * kjs/StructureID.cpp:
3009 (JSC::StructureID::getEnumerablePropertyNames):
3010 (JSC::structureIDChainsAreEqual):
3011 * kjs/StructureID.h:
3013 2008-09-22 Kelvin Sherlock <ksherlock@gmail.com>
3015 Updated and tweaked by Sam Weinig.
3017 Reviewed by Geoffrey Garen.
3019 Bug 20020: Proposed enhancement to JavaScriptCore API
3020 <https://bugs.webkit.org/show_bug.cgi?id=20020>
3022 Add JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError, and JSObjectMakeRegExp
3023 functions to create JavaScript Array, Date, Error, and RegExp objects, respectively.
3025 * API/JSObjectRef.cpp: The functions
3026 * API/JSObjectRef.h: Function prototype and documentation
3027 * JavaScriptCore.exp: Added functions to exported function list
3028 * API/tests/testapi.c: Added basic functionality tests.
3030 * kjs/DateConstructor.cpp:
3031 Replaced static JSObject* constructDate(ExecState* exec, JSObject*, const ArgList& args)
3032 with JSObject* constructDate(ExecState* exec, const ArgList& args).
3033 Added static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) function
3035 * kjs/DateConstructor.h:
3036 added prototype for JSObject* constructDate(ExecState* exec, const ArgList& args)
3038 * kjs/ErrorConstructor.cpp:
3039 removed static qualifier from ErrorInstance* constructError(ExecState* exec, const ArgList& args)
3041 * kjs/ErrorConstructor.h:
3042 added prototype for ErrorInstance* constructError(ExecState* exec, const ArgList& args)
3044 * kjs/RegExpConstructor.cpp:
3045 removed static qualifier from JSObject* constructRegExp(ExecState* exec, const ArgList& args)
3047 * kjs/RegExpConstructor.h:
3048 added prototype for JSObject* constructRegExp(ExecState* exec, const ArgList& args)
3050 2008-09-22 Matt Lilek <webkit@mattlilek.com>
3052 Not reviewed, Windows build fix.
3054 * kjs/Arguments.cpp:
3055 * kjs/FunctionPrototype.cpp:
3057 2008-09-22 Sam Weinig <sam@webkit.org>
3059 Reviewed by Darin Adler.
3061 Patch for https://bugs.webkit.org/show_bug.cgi?id=20982
3062 Speed up the apply method of functions by special-casing array and 'arguments' objects
3064 1% speedup on v8-raytrace.
3066 Test: fast/js/function-apply.html
3068 * kjs/Arguments.cpp:
3069 (JSC::Arguments::fillArgList):
3071 * kjs/FunctionPrototype.cpp:
3072 (JSC::functionProtoFuncApply):
3074 (JSC::JSArray::fillArgList):
3077 2008-09-22 Darin Adler <darin@apple.com>
3079 Reviewed by Sam Weinig.
3081 - https://bugs.webkit.org/show_bug.cgi?id=20993
3082 Array.push/pop need optimized cases for JSArray
3084 3% or so speedup on DeltaBlue benchmark.
3086 * kjs/ArrayPrototype.cpp:
3087 (JSC::arrayProtoFuncPop): Call JSArray::pop when appropriate.
3088 (JSC::arrayProtoFuncPush): Call JSArray::push when appropriate.
3091 (JSC::JSArray::putSlowCase): Set m_fastAccessCutoff when appropriate, getting
3092 us into the fast code path.
3093 (JSC::JSArray::pop): Added.
3094 (JSC::JSArray::push): Added.
3095 * kjs/JSArray.h: Added push and pop.
3097 * kjs/operations.cpp:
3098 (JSC::throwOutOfMemoryError): Don't inline this. Helps us avoid PIC branches.
3100 2008-09-22 Maciej Stachowiak <mjs@apple.com>
3102 Reviewed by Cameron Zwarich.
3104 - speed up instanceof operator by replacing implementsHasInstance method with a TypeInfo flag
3106 Partial work towards <https://bugs.webkit.org/show_bug.cgi?id=20818>
3108 2.2% speedup on EarleyBoyer benchmark.
3110 * API/JSCallbackConstructor.cpp:
3111 * API/JSCallbackConstructor.h:
3112 (JSC::JSCallbackConstructor::createStructureID):
3113 * API/JSCallbackFunction.cpp:
3114 * API/JSCallbackFunction.h:
3115 (JSC::JSCallbackFunction::createStructureID):
3116 * API/JSCallbackObject.h:
3117 (JSC::JSCallbackObject::createStructureID):
3118 * API/JSCallbackObjectFunctions.h:
3119 (JSC::::hasInstance):
3120 * API/JSValueRef.cpp:
3121 (JSValueIsInstanceOfConstructor):
3122 * JavaScriptCore.exp:
3124 (JSC::Machine::privateExecute):
3125 (JSC::Machine::cti_op_instanceof):
3126 * kjs/InternalFunction.cpp:
3127 * kjs/InternalFunction.h:
3128 (JSC::InternalFunction::createStructureID):
3132 (JSC::TypeInfo::implementsHasInstance):
3134 2008-09-22 Maciej Stachowiak <mjs@apple.com>
3136 Reviewed by Dave Hyatt.
3138 Based on initial work by Darin Adler.
3140 - replace masqueradesAsUndefined virtual method with a flag in TypeInfo
3141 - use this to JIT inline code for eq_null and neq_null
3142 https://bugs.webkit.org/show_bug.cgi?id=20823
3144 0.5% speedup on SunSpider
3145 ~4% speedup on Richards benchmark
3148 (JSC::CTI::privateCompileMainPass):
3150 (JSC::jsTypeStringForValue):
3151 (JSC::jsIsObjectType):
3152 (JSC::Machine::privateExecute):
3153 (JSC::Machine::cti_op_is_undefined):
3157 * kjs/StringObjectThatMasqueradesAsUndefined.h:
3158 (JSC::StringObjectThatMasqueradesAsUndefined::create):
3159 (JSC::StringObjectThatMasqueradesAsUndefined::createStructureID):
3160 * kjs/StructureID.h:
3161 (JSC::StructureID::mutableTypeInfo):
3163 (JSC::TypeInfo::TypeInfo):
3164 (JSC::TypeInfo::masqueradesAsUndefined):
3165 * kjs/operations.cpp:
3167 * masm/X86Assembler.h:
3168 (JSC::X86Assembler::):
3169 (JSC::X86Assembler::setne_r):
3170 (JSC::X86Assembler::setnz_r):
3171 (JSC::X86Assembler::testl_i32m):
3173 2008-09-22 Tor Arne Vestbø <tavestbo@trolltech.com>
3177 Initialize QCoreApplication in kjs binary/Shell.cpp
3179 This allows us to use QCoreApplication::instance() to
3180 get the main thread in ThreadingQt.cpp
3184 * wtf/ThreadingQt.cpp:
3185 (WTF::initializeThreading):
3187 2008-09-21 Darin Adler <darin@apple.com>
3189 - blind attempt to fix non-all-in-one builds
3191 * kjs/JSGlobalObject.cpp: Added includes of Arguments.h and RegExpObject.h.
3193 2008-09-21 Darin Adler <darin@apple.com>
3197 * kjs/StructureID.cpp:
3198 (JSC::StructureID::addPropertyTransition): Use typeInfo().type() instead of m_type.
3199 (JSC::StructureID::createCachedPrototypeChain): Ditto.
3201 2008-09-21 Maciej Stachowiak <mjs@apple.com>
3203 Reviewed by Darin Adler.
3205 - introduce a TypeInfo class, for holding per-type (in the C++ class sense) date in StructureID
3206 https://bugs.webkit.org/show_bug.cgi?id=20981
3208 * JavaScriptCore.exp:
3209 * JavaScriptCore.xcodeproj/project.pbxproj:
3211 (JSC::CTI::privateCompileMainPass):
3212 (JSC::CTI::privateCompilePutByIdTransition):
3214 (JSC::jsIsObjectType):
3215 (JSC::Machine::Machine):
3216 * kjs/AllInOneFile.cpp:
3218 (JSC::JSCell::isObject):
3219 (JSC::JSCell::isString):
3220 * kjs/JSGlobalData.cpp:
3221 (JSC::JSGlobalData::JSGlobalData):
3222 * kjs/JSGlobalObject.cpp:
3223 (JSC::JSGlobalObject::reset):
3224 * kjs/JSGlobalObject.h:
3225 (JSC::StructureID::prototypeForLookup):
3226 * kjs/JSNumberCell.h:
3227 (JSC::JSNumberCell::createStructureID):
3229 (JSC::JSObject::createInheritorID):
3231 (JSC::JSObject::createStructureID):
3233 (JSC::JSString::createStructureID):
3234 * kjs/NativeErrorConstructor.cpp:
3235 (JSC::NativeErrorConstructor::NativeErrorConstructor):
3236 * kjs/RegExpConstructor.cpp:
3237 * kjs/RegExpMatchesArray.h: Added.
3238 (JSC::RegExpMatchesArray::getOwnPropertySlot):
3239 (JSC::RegExpMatchesArray::put):
3240 (JSC::RegExpMatchesArray::deleteProperty):
3241 (JSC::RegExpMatchesArray::getPropertyNames):
3242 * kjs/StructureID.cpp:
3243 (JSC::StructureID::StructureID):
3244 (JSC::StructureID::addPropertyTransition):
3245 (JSC::StructureID::toDictionaryTransition):
3246 (JSC::StructureID::changePrototypeTransition):
3247 (JSC::StructureID::getterSetterTransition):
3248 * kjs/StructureID.h:
3249 (JSC::StructureID::create):
3250 (JSC::StructureID::typeInfo):
3251 * kjs/TypeInfo.h: Added.
3252 (JSC::TypeInfo::TypeInfo):
3253 (JSC::TypeInfo::type):
3255 2008-09-21 Darin Adler <darin@apple.com>
3257 Reviewed by Cameron Zwarich.
3259 - fix crash logging into Gmail due to recent Arguments change
3261 * kjs/Arguments.cpp:
3262 (JSC::Arguments::Arguments): Fix window where mark() function could
3263 see d->extraArguments with uninitialized contents.
3264 (JSC::Arguments::mark): Check d->extraArguments for 0 to handle two
3265 cases: 1) Inside the constructor before it's initialized.
3266 2) numArguments <= numParameters.
3268 2008-09-21 Darin Adler <darin@apple.com>
3270 - fix loose end from the "duplicate constant values" patch
3272 * VM/CodeGenerator.cpp:
3273 (JSC::CodeGenerator::emitLoad): Add a special case for values the
3274 hash table can't handle.
3276 2008-09-21 Mark Rowe <mrowe@apple.com>
3278 Fix the non-AllInOneFile build.
3280 * kjs/Arguments.cpp: Add missing #include.
3282 2008-09-21 Darin Adler <darin@apple.com>
3284 Reviewed by Cameron Zwarich and Mark Rowe.
3286 - fix test failure caused by my recent IndexToNameMap patch
3288 * kjs/Arguments.cpp:
3289 (JSC::Arguments::deleteProperty): Added the accidentally-omitted
3290 check of the boolean result from toArrayIndex.
3292 2008-09-21 Darin Adler <darin@apple.com>
3294 Reviewed by Maciej Stachowiak.
3296 - https://bugs.webkit.org/show_bug.cgi?id=20975
3297 inline immediate-number case of ==
3299 * VM/CTI.h: Renamed emitJumpSlowCaseIfNotImm to
3300 emitJumpSlowCaseIfNotImmNum, since the old name was incorrect.
3302 * VM/CTI.cpp: Updated for new name.
3303 (JSC::CTI::privateCompileMainPass): Added op_eq.
3304 (JSC::CTI::privateCompileSlowCases): Added op_eq.
3307 (JSC::Machine::cti_op_eq): Removed fast case, since it's now
3310 2008-09-21 Peter Gal <galpter@inf.u-szeged.hu>
3312 Reviewed by Tim Hatcher and Eric Seidel.
3314 Fix the QT/Linux JavaScriptCore segmentation fault.
3315 https://bugs.webkit.org/show_bug.cgi?id=20914
3317 * wtf/ThreadingQt.cpp:
3318 (WTF::initializeThreading): Use currentThread() if
3319 platform is not a MAC (like in pre 36541 revisions)
3321 2008-09-21 Darin Adler <darin@apple.com>
3323 Reviewed by Sam Weinig.
3325 * kjs/debugger.h: Removed some unneeded includes and declarations.
3327 2008-09-21 Darin Adler <darin@apple.com>
3329 Reviewed by Sam Weinig.
3331 - https://bugs.webkit.org/show_bug.cgi?id=20972
3332 speed up Arguments further by eliminating the IndexToNameMap
3334 No change on SunSpider. 1.29x as fast on V8 Raytrace.
3336 * kjs/Arguments.cpp: Moved ArgumentsData in here. Eliminated the
3337 indexToNameMap and hadDeletes data members. Changed extraArguments into
3338 an OwnArrayPtr and added deletedArguments, another OwnArrayPtr.
3339 Replaced numExtraArguments with numParameters, since that's what's
3340 used more directly in hot code paths.
3341 (JSC::Arguments::Arguments): Pass in argument count instead of ArgList.
3342 Initialize ArgumentsData the new way.
3343 (JSC::Arguments::mark): Updated.
3344 (JSC::Arguments::getOwnPropertySlot): Overload for the integer form so
3345 we don't have to convert integers to identifiers just to get an argument.
3346 Integrated the deleted case with the fast case.
3347 (JSC::Arguments::put): Ditto.
3348 (JSC::Arguments::deleteProperty): Ditto.
3350 * kjs/Arguments.h: Minimized includes. Made everything private. Added
3351 overloads for the integral property name case. Eliminated mappedIndexSetter.
3352 Moved ArgumentsData into the .cpp file.
3354 * kjs/IndexToNameMap.cpp: Emptied out and prepared for deletion.
3355 * kjs/IndexToNameMap.h: Ditto.
3357 * kjs/JSActivation.cpp:
3358 (JSC::JSActivation::createArgumentsObject): Elminated ArgList.
3361 * JavaScriptCore.pri:
3362 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3363 * JavaScriptCore.xcodeproj/project.pbxproj:
3364 * JavaScriptCoreSources.bkl:
3365 * kjs/AllInOneFile.cpp:
3366 Removed IndexToNameMap.
3368 2008-09-21 Darin Adler <darin@apple.com>
3370 * VM/CodeGenerator.cpp:
3371 (JSC::CodeGenerator::emitLoad): One more tweak: Wrote this in a slightly
3374 2008-09-21 Judit Jasz <jasy@inf.u-szeged.hu>
3376 Reviewed and tweaked by Darin Adler.
3378 - https://bugs.webkit.org/show_bug.cgi?id=20645
3379 Elminate duplicate constant values in CodeBlocks.
3381 Seems to be a wash on SunSpider.
3383 * VM/CodeGenerator.cpp:
3384 (JSC::CodeGenerator::emitLoad): Use m_numberMap and m_stringMap to guarantee
3385 we emit the same JSValue* for identical numbers and strings.
3386 * VM/CodeGenerator.h: Added overload of emitLoad for const Identifier&.
3387 Add NumberMap and IdentifierStringMap types and m_numberMap and m_stringMap.
3389 (JSC::StringNode::emitCode): Call the new emitLoad and let it do the
3392 2008-09-21 Paul Pedriana <webkit@pedriana.com>
3394 Reviewed and tweaked by Darin Adler.
3396 - https://bugs.webkit.org/show_bug.cgi?id=16925
3397 Fixed lack of Vector buffer alignment for both GCC and MSVC.
3398 Since there's no portable way to do this, for now we don't support
3401 * wtf/Vector.h: Added WTF_ALIGH_ON, WTF_ALIGNED, AlignedBufferChar, and AlignedBuffer.
3402 Use AlignedBuffer insteadof an array of char in VectorBuffer.
3404 2008-09-21 Gabor Loki <loki@inf.u-szeged.hu>
3406 Reviewed by Darin Adler.
3408 - https://bugs.webkit.org/show_bug.cgi?id=19408
3409 Add lightweight constant folding to the parser for *, /, + (only for numbers), <<, >>, ~ operators.
3411 1.008x as fast on SunSpider.
3414 (makeNegateNode): Fold if expression is a number > 0.
3415 (makeBitwiseNotNode): Fold if expression is a number.
3416 (makeMultNode): Fold if expressions are both numbers.
3417 (makeDivNode): Fold if expressions are both numbers.
3418 (makeAddNode): Fold if expressions are both numbers.
3419 (makeLeftShiftNode): Fold if expressions are both numbers.
3420 (makeRightShiftNode): Fold if expressions are both numbers.
3422 2008-09-21 Maciej Stachowiak <mjs@apple.com>
3426 - speed up === operator by generating inline machine code for the fast paths
3427 https://bugs.webkit.org/show_bug.cgi?id=20820
3430 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumber):
3431 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumbers):
3432 (JSC::CTI::emitJumpSlowCaseIfNotImmediates):
3433 (JSC::CTI::emitTagAsBoolImmediate):
3434 (JSC::CTI::privateCompileMainPass):
3435 (JSC::CTI::privateCompileSlowCases):
3438 (JSC::Machine::cti_op_stricteq):
3439 * masm/X86Assembler.h:
3440 (JSC::X86Assembler::):
3441 (JSC::X86Assembler::sete_r):
3442 (JSC::X86Assembler::setz_r):
3443 (JSC::X86Assembler::movzbl_rr):
3444 (JSC::X86Assembler::emitUnlinkedJnz):
3446 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3448 Reviewed by Maciej Stachowiak.
3450 Free memory allocated for extra arguments in the destructor of the
3453 * kjs/Arguments.cpp:
3454 (JSC::Arguments::~Arguments):
3457 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3459 Reviewed by Maciej Stachowiak.
3461 Bug 20815: 'arguments' object creation is non-optimal
3462 <https://bugs.webkit.org/show_bug.cgi?id=20815>
3464 Fix our inefficient way of creating the arguments object by only
3465 creating named properties for each of the arguments after a use of the
3466 'delete' statement. This patch also speeds up access to the 'arguments'
3467 object slightly, but it still does not use the array fast path for
3468 indexed access that exists for many opcodes.
3470 This is about a 20% improvement on the V8 Raytrace benchmark, and a 1.5%
3471 improvement on the Earley-Boyer benchmark, which gives a 4% improvement
3474 * kjs/Arguments.cpp:
3475 (JSC::Arguments::Arguments):
3476 (JSC::Arguments::mark):
3477 (JSC::Arguments::getOwnPropertySlot):
3478 (JSC::Arguments::put):
3479 (JSC::Arguments::deleteProperty):
3481 (JSC::Arguments::ArgumentsData::ArgumentsData):
3482 * kjs/IndexToNameMap.h:
3483 (JSC::IndexToNameMap::size):
3484 * kjs/JSActivation.cpp:
3485 (JSC::JSActivation::createArgumentsObject):
3486 * kjs/JSActivation.h:
3487 (JSC::JSActivation::uncheckedSymbolTableGet):
3488 (JSC::JSActivation::uncheckedSymbolTableGetValue):
3489 (JSC::JSActivation::uncheckedSymbolTablePut):
3491 (JSC::JSFunction::numParameters):
3493 2008-09-20 Darin Adler <darin@apple.com>
3495 Reviewed by Mark Rowe.
3497 - fix crash seen on buildbot
3499 * kjs/JSGlobalObject.cpp:
3500 (JSC::JSGlobalObject::mark): Add back mark of arrayPrototype,