1 2008-10-07 Sam Weinig <sam@webkit.org>
3 Reviewed by Cameron Zwarich.
5 Move hasGetterSetterProperties flag from PropertyMap to StructureID.
9 (JSC::JSObject::defineGetter):
10 (JSC::JSObject::defineSetter):
12 (JSC::JSObject::hasGetterSetterProperties):
13 (JSC::JSObject::getOwnPropertySlotForWrite):
14 (JSC::JSObject::getOwnPropertySlot):
16 * kjs/StructureID.cpp:
17 (JSC::StructureID::StructureID):
18 (JSC::StructureID::addPropertyTransition):
19 (JSC::StructureID::toDictionaryTransition):
20 (JSC::StructureID::changePrototypeTransition):
21 (JSC::StructureID::getterSetterTransition):
23 (JSC::StructureID::hasGetterSetterProperties):
24 (JSC::StructureID::setHasGetterSetterProperties):
26 2008-10-07 Sam Weinig <sam@webkit.org>
28 Reviewed by Cameron Zwarich.
30 Roll r37370 back in with bug fixes.
32 - PropertyMap::storageSize() should reflect the number of keys + deletedOffsets
33 and has nothing to do with the internal deletedSentinel count anymore.
35 2008-10-07 Gavin Barraclough <barraclough@apple.com>
37 Reviewed by Oliver Hunt.
39 Move callframe initialization into JIT code, again.
41 As a part of the restructuring the second result from functions is now
42 returned in edx, allowing the new value of 'r' to be returned via a
43 register, and stored to the stack from JIT code, too.
45 4.5% progression on v8-tests. (3% in their harness)
50 (JSC::CTI::compileOpCall):
51 (JSC::CTI::privateCompileMainPass):
52 (JSC::CTI::privateCompileSlowCases):
53 (JSC::CTI::privateCompile):
55 (JSC::CallRecord::CallRecord):
57 (JSC::Machine::cti_op_call_JSFunction):
58 (JSC::Machine::cti_op_construct_JSConstruct):
59 (JSC::Machine::cti_op_resolve_func):
60 (JSC::Machine::cti_op_post_inc):
61 (JSC::Machine::cti_op_resolve_with_base):
62 (JSC::Machine::cti_op_post_dec):
67 2008-10-07 Mark Rowe <mrowe@apple.com>
69 Fix typo in method name.
74 2008-10-07 Cameron Zwarich <zwarich@apple.com>
76 Rubber-stamped by Mark Rowe.
80 2008-10-06 Sam Weinig <sam@webkit.org>
82 Reviewed by Cameron Zwarich.
84 Fix for https://bugs.webkit.org/show_bug.cgi?id=21415
85 Improve the division between PropertyStorageArray and PropertyMap
87 - Rework ProperyMap to store offsets in the value so that they don't
88 change when rehashing. This allows us not to have to keep the
89 PropertyStorageArray in sync and thus not have to pass it in.
90 - Rename PropertyMap::getOffset -> PropertyMap::get since put/remove
91 now also return offsets.
92 - A Vector of deleted offsets is now needed since the storage is out of
95 1% win on SunSpider. Wash on V8 suite.
99 (JSC::transitionWillNeedStorageRealloc):
101 (JSC::Machine::privateExecute):
102 Transition logic can be greatly simplified by the fact that
103 the storage capacity is always known, and is correct for the
106 (JSC::JSObject::put): Rename getOffset -> get.
107 (JSC::JSObject::deleteProperty): Ditto.
108 (JSC::JSObject::getPropertyAttributes): Ditto.
109 (JSC::JSObject::removeDirect): Use returned offset to
110 clear the value in the PropertyNameArray.
111 (JSC::JSObject::allocatePropertyStorage): Add assert.
113 (JSC::JSObject::getDirect): Rename getOffset -> get
114 (JSC::JSObject::getDirectLocation): Rename getOffset -> get
115 (JSC::JSObject::putDirect): Use propertyStorageCapacity to determine whether
116 or not to resize. Also, since put now returns an offset (and thus
117 addPropertyTransition does also) setting of the PropertyStorageArray is
119 (JSC::JSObject::transitionTo):
120 * kjs/PropertyMap.cpp:
121 (JSC::PropertyMap::checkConsistency): PropertyStorageArray is no longer
123 (JSC::PropertyMap::operator=): Copy the delete offsets vector.
124 (JSC::PropertyMap::put): Instead of setting the PropertyNameArray
125 explicitly, return the offset where the value should go.
126 (JSC::PropertyMap::remove): Instead of removing from the PropertyNameArray
127 explicitly, return the offset where the value should be removed.
128 (JSC::PropertyMap::get): Switch to using the stored offset, instead
130 (JSC::PropertyMap::insert):
131 (JSC::PropertyMap::expand): This is never called when m_table is null,
132 so remove that branch and add it as an assertion.
133 (JSC::PropertyMap::createTable): Consistency checks no longer take
135 (JSC::PropertyMap::rehash): No need to rehash the PropertyNameArray
136 now that it is completely out of band.
138 (JSC::PropertyMapEntry::PropertyMapEntry): Store offset into PropertyNameArray.
139 (JSC::PropertyMap::get): Switch to using the stored offset, instead
141 * kjs/StructureID.cpp:
142 (JSC::StructureID::StructureID): Initialize the propertyStorageCapacity to
143 JSObject::inlineStorageCapacity.
144 (JSC::StructureID::growPropertyStorageCapacity): Grow the storage capacity as
146 (JSC::StructureID::addPropertyTransition): Copy the storage capacity.
147 (JSC::StructureID::toDictionaryTransition): Ditto.
148 (JSC::StructureID::changePrototypeTransition): Ditto.
149 (JSC::StructureID::getterSetterTransition): Ditto.
151 (JSC::StructureID::propertyStorageCapacity): Add propertyStorageCapacity
152 which is the current capacity for the JSObjects PropertyStorageArray.
153 It starts at the JSObject::inlineStorageCapacity (currently 2), then
154 when it first needs to be resized moves to the JSObject::nonInlineBaseStorageCapacity
155 (currently 16), and after that doubles each time.
157 2008-10-06 Cameron Zwarich <zwarich@apple.com>
159 Reviewed by Oliver Hunt.
161 Bug 21396: Remove the OptionalCalleeActivation call frame slot
162 <https://bugs.webkit.org/show_bug.cgi?id=21396>
164 Remove the OptionalCalleeActivation call frame slot. We have to be
165 careful to store the activation object in a register, because objects
166 in the scope chain do not get marked.
168 This is a 0.3% speedup on both SunSpider and the V8 benchmark.
171 (JSC::CTI::privateCompileMainPass):
173 (JSC::CodeBlock::dump):
174 * VM/CodeGenerator.cpp:
175 (JSC::CodeGenerator::CodeGenerator):
176 (JSC::CodeGenerator::emitReturn):
177 * VM/CodeGenerator.h:
179 (JSC::Machine::dumpRegisters):
180 (JSC::Machine::unwindCallFrame):
181 (JSC::Machine::privateExecute):
182 (JSC::Machine::cti_op_call_JSFunction):
183 (JSC::Machine::cti_op_push_activation):
184 (JSC::Machine::cti_op_tear_off_activation):
185 (JSC::Machine::cti_op_construct_JSConstruct):
187 (JSC::Machine::initializeCallFrame):
189 (JSC::RegisterFile::):
191 2008-10-06 Tony Chang <tony@chromium.org>
193 Reviewed by Alexey Proskuryakov.
195 Chromium doesn't use pthreads on windows, so make its use conditional.
197 Also convert a WORD to a DWORD to avoid a compiler warning. This
198 matches the other methods around it.
200 * wtf/ThreadingWin.cpp:
201 (WTF::wtfThreadEntryPoint):
202 (WTF::ThreadCondition::broadcast):
204 2008-10-06 Mark Mentovai <mark@moxienet.com>
206 Reviewed by Tim Hatcher.
208 Allow ENABLE_DASHBOARD_SUPPORT and ENABLE_MAC_JAVA_BRIDGE to be
211 https://bugs.webkit.org/show_bug.cgi?id=21333
215 2008-10-06 Steve Falkenburg <sfalken@apple.com>
217 https://bugs.webkit.org/show_bug.cgi?id=21416
218 Pass 0 for size to VirtualAlloc, as documented by MSDN.
219 Identified by Application Verifier.
221 Reviewed by Darin Adler.
226 2008-10-06 Kevin McCullough <kmccullough@apple.com>
228 Reviewed by Tim Hatcheri and Oliver Hunt.
230 https://bugs.webkit.org/show_bug.cgi?id=21412
231 Bug 21412: Refactor user initiated profile count to be more stable
232 - Export UString::from for use with creating the profile title.
234 * JavaScriptCore.exp:
236 2008-10-06 Maciej Stachowiak <mjs@apple.com>
238 Not reviewed. Build fix.
240 - revert toBoolean changes (r37333 and r37335); need to make WebCore work with these
242 * API/JSValueRef.cpp:
245 * JavaScriptCore.exp:
247 (JSC::CodeBlock::dump):
249 (JSC::Machine::privateExecute):
250 (JSC::Machine::cti_op_loop_if_true):
251 (JSC::Machine::cti_op_not):
252 (JSC::Machine::cti_op_jtrue):
253 * kjs/ArrayPrototype.cpp:
254 (JSC::arrayProtoFuncFilter):
255 (JSC::arrayProtoFuncEvery):
256 (JSC::arrayProtoFuncSome):
257 * kjs/BooleanConstructor.cpp:
258 (JSC::constructBoolean):
259 (JSC::callBooleanConstructor):
260 * kjs/GetterSetter.h:
262 (JSC::JSValue::toBoolean):
263 * kjs/JSNumberCell.cpp:
264 (JSC::JSNumberCell::toBoolean):
265 * kjs/JSNumberCell.h:
267 (JSC::JSObject::toBoolean):
270 (JSC::JSString::toBoolean):
273 * kjs/RegExpConstructor.cpp:
274 (JSC::setRegExpConstructorMultiline):
275 * kjs/RegExpObject.cpp:
276 (JSC::RegExpObject::match):
277 * kjs/RegExpPrototype.cpp:
278 (JSC::regExpProtoFuncToString):
280 2008-10-06 Maciej Stachowiak <mjs@apple.com>
282 Reviewed by Sam Weinig.
284 - optimize op_jtrue, op_loop_if_true and op_not in various ways
285 https://bugs.webkit.org/show_bug.cgi?id=21404
287 1) Make JSValue::toBoolean nonvirtual and completely inline by
288 making use of the StructureID type field.
290 2) Make JSValue::toBoolean not take an ExecState; doesn't need it.
292 3) Make op_not, op_loop_if_true and op_jtrue not read the
293 ExecState (toBoolean doesn't need it any more) and not check
294 exceptions (toBoolean can't throw).
296 * API/JSValueRef.cpp:
298 * JavaScriptCore.exp:
300 (JSC::CodeBlock::dump):
302 (JSC::Machine::privateExecute):
303 (JSC::Machine::cti_op_loop_if_true):
304 (JSC::Machine::cti_op_not):
305 (JSC::Machine::cti_op_jtrue):
306 * kjs/ArrayPrototype.cpp:
307 (JSC::arrayProtoFuncFilter):
308 (JSC::arrayProtoFuncEvery):
309 (JSC::arrayProtoFuncSome):
310 * kjs/BooleanConstructor.cpp:
311 (JSC::constructBoolean):
312 (JSC::callBooleanConstructor):
313 * kjs/GetterSetter.h:
315 (JSC::JSValue::toBoolean):
316 * kjs/JSNumberCell.cpp:
317 * kjs/JSNumberCell.h:
318 (JSC::JSNumberCell::toBoolean):
321 (JSC::JSObject::toBoolean):
322 (JSC::JSCell::toBoolean):
325 (JSC::JSString::toBoolean):
327 * kjs/RegExpConstructor.cpp:
328 (JSC::setRegExpConstructorMultiline):
329 * kjs/RegExpObject.cpp:
330 (JSC::RegExpObject::match):
331 * kjs/RegExpPrototype.cpp:
332 (JSC::regExpProtoFuncToString):
334 2008-10-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
340 * JavaScriptCore.pri:
342 (JSC::highResUpTime):
344 2008-10-05 Cameron Zwarich <zwarich@apple.com>
346 Reviewed by Oliver Hunt.
348 Remove ScopeNode::containsClosures() now that it is unused.
351 (JSC::ScopeNode::containsClosures):
353 2008-10-05 Maciej Stachowiak <mjs@apple.com>
355 Reviewed by Cameron Zwarich.
357 - fix releas-only test failures caused by the fix to bug 21375
360 (JSC::Machine::unwindCallFrame): Update ExecState while unwinding call frames;
361 it now matters more to have a still-valid ExecState, since dynamicGlobalObject
362 will make use of the ExecState's scope chain.
365 2008-10-05 Cameron Zwarich <zwarich@apple.com>
367 Reviewed by Oliver Hunt.
369 Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
370 <https://bugs.webkit.org/show_bug.cgi?id=21364>
372 Use information from the parser to detect whether an activation is
373 needed or 'arguments' is used, and emit explicit instructions to tear
374 them off before op_ret. This allows a branch to be removed from op_ret
375 and simplifies some other code. This does cause a small change in the
376 behaviour of 'f.arguments'; it is no longer live when 'arguments' is not
377 mentioned in the lexical scope of the function.
379 It should now be easy to remove the OptionaCalleeActivation slot in the
380 call frame, but this will be done in a later patch.
383 (JSC::CTI::privateCompileMainPass):
385 (JSC::CodeBlock::dump):
386 * VM/CodeGenerator.cpp:
387 (JSC::CodeGenerator::emitReturn):
388 * VM/CodeGenerator.h:
390 (JSC::Machine::unwindCallFrame):
391 (JSC::Machine::privateExecute):
392 (JSC::Machine::retrieveArguments):
393 (JSC::Machine::cti_op_create_arguments):
394 (JSC::Machine::cti_op_tear_off_activation):
395 (JSC::Machine::cti_op_tear_off_arguments):
399 (JSC::Arguments::mark):
401 (JSC::Arguments::isTornOff):
402 (JSC::Arguments::Arguments):
403 (JSC::Arguments::copyRegisters):
404 (JSC::JSActivation::copyRegisters):
405 * kjs/JSActivation.cpp:
406 (JSC::JSActivation::argumentsGetter):
407 * kjs/JSActivation.h:
409 2008-10-05 Maciej Stachowiak <mjs@apple.com>
411 Reviewed by Oliver Hunt.
413 - fixed "REGRESSION (r37297): fast/js/deep-recursion-test takes too long and times out"
414 https://bugs.webkit.org/show_bug.cgi?id=21375
416 The problem is that dynamicGlobalObject had become O(N) in number
417 of call frames, but unwinding the stack for an exception called it
418 for every call frame, resulting in O(N^2) behavior for an
419 exception thrown from inside deep recursion.
421 Instead of doing it that way, stash the dynamic global object in JSGlobalData.
423 * JavaScriptCore.exp:
425 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Helper class to temporarily
426 store and later restore a dynamicGlobalObject in JSGlobalData.
427 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
428 (JSC::Machine::execute): In each version, establish a DynamicGlobalObjectScope.
429 For ProgramNode, always establish set new dynamicGlobalObject, for FunctionBody and Eval,
430 only if none is currently set.
433 * kjs/JSGlobalData.cpp:
434 (JSC::JSGlobalData::JSGlobalData): Ininitalize new dynamicGlobalObject field to 0.
435 * kjs/JSGlobalData.h:
436 * kjs/JSGlobalObject.h:
437 (JSC::ExecState::dynamicGlobalObject): Moved here from ExecState for benefit of inlining.
438 Return lexical global object if this is a globalExec(), otherwise look in JSGlobalData
439 for the one stashed there.
441 2008-10-05 Sam Weinig <sam@webkit.org>
443 Reviewed by Maciej Stachowiak.
445 Avoid an extra lookup when transitioning to an existing StructureID
446 by caching the offset of property that caused the transition.
448 1% win on V8 suite. Wash on SunSpider.
450 * kjs/PropertyMap.cpp:
451 (JSC::PropertyMap::put):
453 * kjs/StructureID.cpp:
454 (JSC::StructureID::StructureID):
455 (JSC::StructureID::addPropertyTransition):
457 (JSC::StructureID::setCachedTransistionOffset):
458 (JSC::StructureID::cachedTransistionOffset):
460 2008-10-05 Cameron Zwarich <zwarich@apple.com>
462 Reviewed by Maciej Stachowiak.
464 Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
465 <https://bugs.webkit.org/show_bug.cgi?id=21364>
467 This patch does not yet remove the branch, but it does a bit of refactoring
468 so that a CodeGenerator now knows whether the associated CodeBlock will need
469 a full scope before doing any code generation. This makes it possible to emit
470 explicit tear-off instructions before every op_ret.
473 (JSC::CodeBlock::CodeBlock):
474 * VM/CodeGenerator.cpp:
475 (JSC::CodeGenerator::generate):
476 (JSC::CodeGenerator::CodeGenerator):
477 (JSC::CodeGenerator::emitPushScope):
478 (JSC::CodeGenerator::emitPushNewScope):
480 (JSC::ScopeNode::needsActivation):
482 2008-10-05 Gavin Barraclough <barraclough@apple.com>
484 Reviewed by Cameron Zwarich.
486 Fix for bug #21387 - using SamplingTool with CTI.
488 (1) A repatch offset offset changes due to an additional instruction to update SamplingTool state.
489 (2) Fix an incusion order problem due to ExecState changes.
490 (3) Change to a MACHINE_SAMPLING macro, use of exec should now be accessing global data.
495 (JSC::SamplingTool::privateExecuteReturned):
498 2008-10-04 Mark Rowe <mrowe@apple.com>
500 Reviewed by Tim Hatcher.
502 Add a 'Check For Weak VTables' build phase to catch weak vtables as early as possible.
504 * JavaScriptCore.xcodeproj/project.pbxproj:
506 2008-10-04 Sam Weinig <sam@webkit.org>
508 Reviewed by Oliver Hunt.
510 Fix https://bugs.webkit.org/show_bug.cgi?id=21320
511 leaks of PropertyNameArrayData seen on buildbot
513 - Fix RefPtr cycle by making PropertyNameArrayData's pointer back
514 to the StructureID a weak pointer.
516 * kjs/PropertyNameArray.h:
517 (JSC::PropertyNameArrayData::setCachedStructureID):
518 (JSC::PropertyNameArrayData::cachedStructureID):
519 * kjs/StructureID.cpp:
520 (JSC::StructureID::getEnumerablePropertyNames):
521 (JSC::StructureID::clearEnumerationCache):
522 (JSC::StructureID::~StructureID):
524 2008-10-04 Darin Adler <darin@apple.com>
526 Reviewed by Cameron Zwarich.
528 - https://bugs.webkit.org/show_bug.cgi?id=21295
529 Bug 21295: Replace ExecState with a call frame Register pointer
531 10% faster on Richards; other v8 benchmarks faster too.
534 This does the minimum necessary to get the speedup. Next step in
535 cleaning this up is to replace ExecState with a CallFrame class,
536 and be more judicious about when to pass a call frame and when
537 to pass a global data pointer, global object pointer, or perhaps
538 something else entirely.
540 * VM/CTI.cpp: Remove the debug-only check of the exception in
541 ctiVMThrowTrampoline -- already checked in the code the trampoline
542 jumps to, so not all that useful. Removed the exec argument from
543 ctiTrampoline. Removed emitDebugExceptionCheck -- no longer needed.
544 (JSC::CTI::emitCall): Removed code to set ExecState::m_callFrame.
545 (JSC::CTI::privateCompileMainPass): Removed code in catch to extract
546 the exception from ExecState::m_exception; instead, the code that
547 jumps into catch will make sure the exception is already in eax.
548 * VM/CTI.h: Removed exec from the ctiTrampoline. Also removed the
549 non-helpful "volatile". Temporarily left ARG_exec in as a synonym
550 for ARG_r; I'll change that on a future cleanup pass when introducing
551 more use of the CallFrame type.
552 (JSC::CTI::execute): Removed the ExecState* argument.
554 * VM/ExceptionHelpers.cpp:
555 (JSC::InterruptedExecutionError::InterruptedExecutionError): Take
556 JSGlobalData* instead of ExecState*.
557 (JSC::createInterruptedExecutionException): Ditto.
558 * VM/ExceptionHelpers.h: Ditto. Also removed an unneeded include.
561 (JSC::slideRegisterWindowForCall): Removed the exec and
562 exceptionValue arguments. Changed to return 0 when there's a stack
563 overflow rather than using a separate exception argument to cut
564 down on memory accesses in the calling convention.
565 (JSC::Machine::unwindCallFrame): Removed the exec argument when
566 constructing a DebuggerCallFrame. Also removed code to set
567 ExecState::m_callFrame.
568 (JSC::Machine::throwException): Removed the exec argument when
569 construction a DebuggerCallFrame.
570 (JSC::Machine::execute): Updated to use the register instead of
571 ExecState and also removed various uses of ExecState.
572 (JSC::Machine::debug):
573 (JSC::Machine::privateExecute): Put globalData into a local
574 variable so it can be used throughout the interpreter. Changed
575 the VM_CHECK_EXCEPTION to get the exception in globalData instead
576 of through ExecState.
577 (JSC::Machine::retrieveLastCaller): Turn exec into a registers
578 pointer by calling registers() instead of by getting m_callFrame.
579 (JSC::Machine::callFrame): Ditto.
580 Tweaked exception macros. Made new versions for when you know
581 you have an exception. Get at global exception with ARG_globalData.
582 Got rid of the need to pass in the return value type.
583 (JSC::Machine::cti_op_add): Update to use new version of exception
585 (JSC::Machine::cti_op_pre_inc): Ditto.
586 (JSC::Machine::cti_timeout_check): Ditto.
587 (JSC::Machine::cti_op_instanceof): Ditto.
588 (JSC::Machine::cti_op_new_func): Ditto.
589 (JSC::Machine::cti_op_call_JSFunction): Optimized by using the
590 ARG values directly instead of through local variables -- this gets
591 rid of code that just shuffles things around in the stack frame.
592 Also get rid of ExecState and update for the new way exceptions are
593 handled in slideRegisterWindowForCall.
594 (JSC::Machine::cti_vm_compile): Update to make exec out of r since
595 they are both the same thing now.
596 (JSC::Machine::cti_op_call_NotJSFunction): Ditto.
597 (JSC::Machine::cti_op_init_arguments): Ditto.
598 (JSC::Machine::cti_op_resolve): Ditto.
599 (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
600 (JSC::Machine::cti_op_construct_NotJSConstruct): Ditto.
601 (JSC::Machine::cti_op_resolve_func): Ditto.
602 (JSC::Machine::cti_op_put_by_val): Ditto.
603 (JSC::Machine::cti_op_put_by_val_array): Ditto.
604 (JSC::Machine::cti_op_resolve_skip): Ditto.
605 (JSC::Machine::cti_op_resolve_global): Ditto.
606 (JSC::Machine::cti_op_post_inc): Ditto.
607 (JSC::Machine::cti_op_resolve_with_base): Ditto.
608 (JSC::Machine::cti_op_post_dec): Ditto.
609 (JSC::Machine::cti_op_call_eval): Ditto.
610 (JSC::Machine::cti_op_throw): Ditto. Also rearranged to return
611 the exception value as the return value so it can be used by
613 (JSC::Machine::cti_op_push_scope): Ditto.
614 (JSC::Machine::cti_op_in): Ditto.
615 (JSC::Machine::cti_op_del_by_val): Ditto.
616 (JSC::Machine::cti_vm_throw): Ditto. Also rearranged to return
617 the exception value as the return value so it can be used by
620 * kjs/DebuggerCallFrame.cpp:
621 (JSC::DebuggerCallFrame::functionName): Pass globalData.
622 (JSC::DebuggerCallFrame::evaluate): Eliminated code to make a
624 * kjs/DebuggerCallFrame.h: Removed ExecState argument from
627 * kjs/ExecState.h: Eliminated all data members and made ExecState
628 inherit privately from Register instead. Also added a typedef to
629 the future name for this class, which is CallFrame. It's just a
630 Register* that knows it's a pointer at a call frame. The new class
631 can't be constructed or copied. Changed all functions to use
632 the this pointer instead of m_callFrame. Changed exception-related
633 functions to access an exception in JSGlobalData. Removed functions
634 used by CTI to pass the return address to the throw machinery --
635 this is now done directly with a global in the global data.
637 * kjs/FunctionPrototype.cpp:
638 (JSC::functionProtoFuncToString): Pass globalData instead of exec.
640 * kjs/InternalFunction.cpp:
641 (JSC::InternalFunction::name): Take globalData instead of exec.
642 * kjs/InternalFunction.h: Ditto.
644 * kjs/JSGlobalData.cpp: Initialize the new exception global to 0.
645 * kjs/JSGlobalData.h: Declare two new globals. One for the current
646 exception and another for the return address used by CTI to
647 implement the throw operation.
649 * kjs/JSGlobalObject.cpp:
650 (JSC::JSGlobalObject::init): Removed code to set up globalExec,
651 which is now the same thing as globalCallFrame.
652 (JSC::JSGlobalObject::reset): Get globalExec from our globalExec
653 function so we don't have to repeat the logic twice.
654 (JSC::JSGlobalObject::mark): Removed code to mark the exception;
655 the exception is now stored in JSGlobalData and marked there.
656 (JSC::JSGlobalObject::globalExec): Return a pointer to the end
657 of the global call frame.
658 * kjs/JSGlobalObject.h: Removed the globalExec data member.
661 (JSC::JSObject::putDirectFunction): Pass globalData instead of exec.
664 (JSC::Heap::collect): Mark the global exception.
666 * profiler/ProfileGenerator.cpp:
667 (JSC::ProfileGenerator::addParentForConsoleStart): Pass globalData
668 instead of exec to createCallIdentifier.
670 * profiler/Profiler.cpp:
671 (JSC::Profiler::willExecute): Pass globalData instead of exec to
672 createCallIdentifier.
673 (JSC::Profiler::didExecute): Ditto.
674 (JSC::Profiler::createCallIdentifier): Take globalData instead of
676 (JSC::createCallIdentifierFromFunctionImp): Ditto.
677 * profiler/Profiler.h: Change interface to take a JSGlobalData
678 instead of an ExecState.
680 2008-10-04 Cameron Zwarich <zwarich@apple.com>
682 Reviewed by Darin Adler.
684 Bug 21369: Add opcode documentation for all undocumented opcodes
685 <https://bugs.webkit.org/show_bug.cgi?id=21369>
687 This patch adds opcode documentation for all undocumented opcodes, and
688 it also renames op_init_arguments to op_create_arguments.
691 (JSC::CTI::privateCompileMainPass):
693 (JSC::CodeBlock::dump):
694 * VM/CodeGenerator.cpp:
695 (JSC::CodeGenerator::CodeGenerator):
697 (JSC::Machine::privateExecute):
698 (JSC::Machine::cti_op_create_arguments):
702 2008-10-03 Maciej Stachowiak <mjs@apple.com>
704 Reviewed by Cameron Zwarich.
706 - "this" object in methods called on primitives should be wrapper object
707 https://bugs.webkit.org/show_bug.cgi?id=21362
709 I changed things so that functions which use "this" do a fast
710 version of toThisObject conversion if needed. Currently we miss
711 the conversion entirely, at least for primitive types. Using
712 TypeInfo and the primitive check, I made the fast case bail out
715 This is inexplicably an 1.007x SunSpider speedup (and a wash on V8 benchmarks).
717 Also renamed some opcodes for clarity:
720 init_activation ==> enter_with_activation
723 (JSC::CTI::privateCompileMainPass):
724 (JSC::CTI::privateCompileSlowCases):
726 (JSC::CodeBlock::dump):
727 * VM/CodeGenerator.cpp:
728 (JSC::CodeGenerator::generate):
729 (JSC::CodeGenerator::CodeGenerator):
731 (JSC::Machine::privateExecute):
732 (JSC::Machine::cti_op_convert_this):
735 * kjs/JSActivation.cpp:
736 (JSC::JSActivation::JSActivation):
737 * kjs/JSActivation.h:
738 (JSC::JSActivation::createStructureID):
740 (JSC::JSValue::needsThisConversion):
741 * kjs/JSGlobalData.cpp:
742 (JSC::JSGlobalData::JSGlobalData):
743 * kjs/JSGlobalData.h:
744 * kjs/JSNumberCell.h:
745 (JSC::JSNumberCell::createStructureID):
746 * kjs/JSStaticScopeObject.h:
747 (JSC::JSStaticScopeObject::JSStaticScopeObject):
748 (JSC::JSStaticScopeObject::createStructureID):
750 (JSC::JSString::createStructureID):
753 (JSC::TypeInfo::needsThisConversion):
755 (JSC::ScopeNode::usesThis):
757 2008-10-03 Cameron Zwarich <zwarich@apple.com>
759 Reviewed by Maciej Stachowiak.
761 Bug 21356: The size of the RegisterFile differs depending on 32-bit / 64-bit and Debug / Release
762 <https://bugs.webkit.org/show_bug.cgi?id=21356>
764 The RegisterFile decreases in size (measured in terms of numbers of
765 Registers) as the size of a Register increases. This causes
767 js1_5/Regress/regress-159334.js
769 to fail in 64-bit debug builds. This fix makes the RegisterFile on all
770 platforms the same size that it is in 32-bit Release builds.
773 (JSC::RegisterFile::RegisterFile):
775 2008-10-03 Maciej Stachowiak <mjs@apple.com>
777 Reviewed by Cameron Zwarich.
779 - Some code cleanup to how we handle code features.
781 1) Rename FeatureInfo typedef to CodeFeatures.
782 2) Rename NodeFeatureInfo template to NodeInfo.
783 3) Keep CodeFeature bitmask in ScopeNode instead of trying to break it out into individual bools.
784 4) Rename misleadingly named "needsClosure" method to "containsClosures", which better describes the meaning
786 5) Make setUsersArguments() not take an argument since it only goes one way.
788 * JavaScriptCore.exp:
790 (JSC::CodeBlock::CodeBlock):
793 (JSC::Parser::didFinishParsing):
795 (JSC::Parser::parse):
798 (JSC::ScopeNode::ScopeNode):
799 (JSC::ProgramNode::ProgramNode):
800 (JSC::ProgramNode::create):
801 (JSC::EvalNode::EvalNode):
802 (JSC::EvalNode::create):
803 (JSC::FunctionBodyNode::FunctionBodyNode):
804 (JSC::FunctionBodyNode::create):
806 (JSC::ScopeNode::usesEval):
807 (JSC::ScopeNode::containsClosures):
808 (JSC::ScopeNode::usesArguments):
809 (JSC::ScopeNode::setUsesArguments):
811 2008-10-03 Cameron Zwarich <zwarich@apple.com>
813 Reviewed by Maciej Stachowiak.
815 Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
816 <https://bugs.webkit.org/show_bug.cgi?id=21343>
818 A fix was landed for this issue in r37253, and the ChangeLog assumes
819 that it is a compiler bug, but it turns out that it is a subtle issue
820 with mixing signed and unsigned 32-bit values in a 64-bit environment.
821 In order to properly fix this bug, we should convert our signed offsets
822 into the register file to use ptrdiff_t.
824 This may not be the only instance of this issue, but I will land this
825 fix first and look for more later.
828 (JSC::Machine::getArgumentsData):
831 (JSC::Arguments::getOwnPropertySlot):
833 (JSC::Arguments::init):
835 2008-10-03 Darin Adler <darin@apple.com>
837 * VM/CTI.cpp: Another Windows build fix. Change the args of ctiTrampoline.
839 * kjs/JSNumberCell.h: A build fix for newer versions of gcc. Added
840 declarations of JSGlobalData overloads of jsNumberCell.
842 2008-10-03 Darin Adler <darin@apple.com>
844 - try to fix Windows build
846 * kjs/ScopeChain.h: Add forward declaration of JSGlobalData.
848 2008-10-03 Darin Adler <darin@apple.com>
850 Reviewed by Geoff Garen.
852 - next step of https://bugs.webkit.org/show_bug.cgi?id=21295
853 Turn ExecState into a call frame pointer.
855 Remove m_globalObject and m_globalData from ExecState.
857 SunSpider says this is a wash (slightly faster but not statistically
858 significant); which is good enough since it's a preparation step and
859 not supposed to be a spedup.
861 * API/JSCallbackFunction.cpp:
862 (JSC::JSCallbackFunction::JSCallbackFunction):
863 * kjs/ArrayConstructor.cpp:
864 (JSC::ArrayConstructor::ArrayConstructor):
865 * kjs/BooleanConstructor.cpp:
866 (JSC::BooleanConstructor::BooleanConstructor):
867 * kjs/DateConstructor.cpp:
868 (JSC::DateConstructor::DateConstructor):
869 * kjs/ErrorConstructor.cpp:
870 (JSC::ErrorConstructor::ErrorConstructor):
871 * kjs/FunctionPrototype.cpp:
872 (JSC::FunctionPrototype::FunctionPrototype):
873 * kjs/JSFunction.cpp:
874 (JSC::JSFunction::JSFunction):
875 * kjs/NativeErrorConstructor.cpp:
876 (JSC::NativeErrorConstructor::NativeErrorConstructor):
877 * kjs/NumberConstructor.cpp:
878 (JSC::NumberConstructor::NumberConstructor):
879 * kjs/ObjectConstructor.cpp:
880 (JSC::ObjectConstructor::ObjectConstructor):
881 * kjs/PrototypeFunction.cpp:
882 (JSC::PrototypeFunction::PrototypeFunction):
883 * kjs/RegExpConstructor.cpp:
884 (JSC::RegExpConstructor::RegExpConstructor):
885 * kjs/StringConstructor.cpp:
886 (JSC::StringConstructor::StringConstructor):
887 Pass JSGlobalData* instead of ExecState* to the InternalFunction
890 * API/OpaqueJSString.cpp: Added now-needed include.
892 * JavaScriptCore.exp: Updated.
895 (JSC::CTI::emitSlowScriptCheck): Changed to use ARGS_globalData
896 instead of ARGS_exec.
898 * VM/CTI.h: Added a new argument to the CTI, the global data pointer.
899 While it's possible to get to the global data pointer using the
900 ExecState pointer, it's slow enough that it's better to just keep
901 it around in the CTI arguments.
903 * VM/CodeBlock.h: Moved the CodeType enum here from ExecState.h.
906 (JSC::Machine::execute): Pass fewer arguments when constructing
907 ExecState, and pass the global data pointer when invoking CTI.
908 (JSC::Machine::firstCallFrame): Added. Used to get the dynamic global
909 object, which is in the scope chain of the first call frame.
910 (JSC::Machine::cti_op_add): Use globalData instead of exec when
911 possible, to keep fast cases fast, since it's now more expensive to
912 get to it through the exec pointer.
913 (JSC::Machine::cti_timeout_check): Ditto.
914 (JSC::Machine::cti_op_put_by_id_second): Ditto.
915 (JSC::Machine::cti_op_get_by_id_second): Ditto.
916 (JSC::Machine::cti_op_mul): Ditto.
917 (JSC::Machine::cti_vm_compile): Ditto.
918 (JSC::Machine::cti_op_get_by_val): Ditto.
919 (JSC::Machine::cti_op_sub): Ditto.
920 (JSC::Machine::cti_op_put_by_val): Ditto.
921 (JSC::Machine::cti_op_put_by_val_array): Ditto.
922 (JSC::Machine::cti_op_negate): Ditto.
923 (JSC::Machine::cti_op_div): Ditto.
924 (JSC::Machine::cti_op_pre_dec): Ditto.
925 (JSC::Machine::cti_op_post_inc): Ditto.
926 (JSC::Machine::cti_op_lshift): Ditto.
927 (JSC::Machine::cti_op_bitand): Ditto.
928 (JSC::Machine::cti_op_rshift): Ditto.
929 (JSC::Machine::cti_op_bitnot): Ditto.
930 (JSC::Machine::cti_op_mod): Ditto.
931 (JSC::Machine::cti_op_post_dec): Ditto.
932 (JSC::Machine::cti_op_urshift): Ditto.
933 (JSC::Machine::cti_op_bitxor): Ditto.
934 (JSC::Machine::cti_op_bitor): Ditto.
935 (JSC::Machine::cti_op_call_eval): Ditto.
936 (JSC::Machine::cti_op_throw): Ditto.
937 (JSC::Machine::cti_op_is_string): Ditto.
938 (JSC::Machine::cti_op_debug): Ditto.
939 (JSC::Machine::cti_vm_throw): Ditto.
941 * VM/Machine.h: Added firstCallFrame.
943 * kjs/DebuggerCallFrame.cpp:
944 (JSC::DebuggerCallFrame::evaluate): Pass fewer arguments when
945 constructing ExecState.
947 * kjs/ExecState.cpp: Deleted contents. Later we'll remove the
950 * kjs/ExecState.h: Removed m_globalObject and m_globalData.
951 Moved CodeType into another header.
952 (JSC::ExecState::ExecState): Take only a single argument, a
954 (JSC::ExecState::dynamicGlobalObject): Get the object from
955 the first call frame since it's no longer stored.
956 (JSC::ExecState::globalData): Get the global data from the
957 scope chain, since we no longer store a pointer to it here.
958 (JSC::ExecState::identifierTable): Ditto.
959 (JSC::ExecState::propertyNames): Ditto.
960 (JSC::ExecState::emptyList): Ditto.
961 (JSC::ExecState::lexer): Ditto.
962 (JSC::ExecState::parser): Ditto.
963 (JSC::ExecState::machine): Ditto.
964 (JSC::ExecState::arrayTable): Ditto.
965 (JSC::ExecState::dateTable): Ditto.
966 (JSC::ExecState::mathTable): Ditto.
967 (JSC::ExecState::numberTable): Ditto.
968 (JSC::ExecState::regExpTable): Ditto.
969 (JSC::ExecState::regExpConstructorTable): Ditto.
970 (JSC::ExecState::stringTable): Ditto.
971 (JSC::ExecState::heap): Ditto.
973 * kjs/FunctionConstructor.cpp:
974 (JSC::FunctionConstructor::FunctionConstructor): Pass
975 JSGlobalData* instead of ExecState* to the InternalFunction
977 (JSC::constructFunction): Pass the global data pointer when
978 constructing a new scope chain.
980 * kjs/InternalFunction.cpp:
981 (JSC::InternalFunction::InternalFunction): Take a JSGlobalData*
982 instead of an ExecState*. Later we can change more places to
983 work this way -- it's more efficient to take the type you need
984 since the caller might already have it.
985 * kjs/InternalFunction.h: Ditto.
988 (JSC::JSCell::operator new): Added an overload that takes a
989 JSGlobalData* so you can construct without an ExecState*.
991 * kjs/JSGlobalObject.cpp:
992 (JSC::JSGlobalObject::init): Moved creation of the global scope
993 chain in here, since it now requires a pointer to the global data.
994 Moved the initialization of the call frame in here since it requires
995 the global scope chain node. Removed the extra argument to ExecState
996 when creating the global ExecState*.
997 * kjs/JSGlobalObject.h: Removed initialization of globalScopeChain
998 and the call frame from the JSGlobalObjectData constructor. Added
999 a thisValue argument to the init function.
1001 * kjs/JSNumberCell.cpp: Added versions of jsNumberCell that take
1002 JSGlobalData* rather than ExecState*.
1003 * kjs/JSNumberCell.h:
1004 (JSC::JSNumberCell::operator new): Added a version that takes
1006 (JSC::JSNumberCell::JSNumberCell): Ditto.
1007 (JSC::jsNumber): Ditto.
1009 (JSC::jsString): Ditto.
1010 (JSC::jsSubstring): Ditto.
1011 (JSC::jsOwnedString): Ditto.
1013 (JSC::JSString::JSString): Changed to take JSGlobalData*.
1014 (JSC::jsEmptyString): Added a version that takes JSGlobalData*.
1015 (JSC::jsSingleCharacterString): Ditto.
1016 (JSC::jsSingleCharacterSubstring): Ditto.
1017 (JSC::jsNontrivialString): Ditto.
1018 (JSC::JSString::getIndex): Ditto.
1019 (JSC::jsString): Ditto.
1020 (JSC::jsSubstring): Ditto.
1021 (JSC::jsOwnedString): Ditto.
1023 * kjs/ScopeChain.h: Added a globalData pointer to each node.
1024 (JSC::ScopeChainNode::ScopeChainNode): Initialize the globalData
1026 (JSC::ScopeChainNode::push): Set the global data pointer in the
1028 (JSC::ScopeChain::ScopeChain): Take a globalData argument.
1030 * kjs/SmallStrings.cpp:
1031 (JSC::SmallStrings::createEmptyString): Take JSGlobalData* instead of
1033 (JSC::SmallStrings::createSingleCharacterString): Ditto.
1034 * kjs/SmallStrings.h:
1035 (JSC::SmallStrings::emptyString): Ditto.
1036 (JSC::SmallStrings::singleCharacterString): Ditto.
1038 2008-10-03 Cameron Zwarich <zwarich@apple.com>
1040 Reviewed by Geoff Garen.
1042 Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
1043 <https://bugs.webkit.org/show_bug.cgi?id=21343>
1045 Add a workaround for a bug in GCC, which affects GCC 4.0, GCC 4.2, and
1046 llvm-gcc 4.2. I put it in an #ifdef because it was a slight regression
1047 on SunSpider in 32-bit, although that might be entirely random.
1049 * kjs/Arguments.cpp:
1050 (JSC::Arguments::getOwnPropertySlot):
1052 2008-10-03 Darin Adler <darin@apple.com>
1054 Rubber stamped by Alexey Proskuryakov.
1056 * kjs/Shell.cpp: (main): Don't delete JSGlobalData. Later, we need to change
1057 this tool to use public JavaScriptCore API instead.
1059 2008-10-03 Darin Adler <darin@apple.com>
1061 Suggested by Alexey Proskuryakov.
1063 * kjs/JSGlobalData.cpp:
1064 (JSC::JSGlobalData::~JSGlobalData): Remove call to heap.destroy() because
1065 it's too late to ref the JSGlobalData object once it's already being
1066 destroyed. In practice this is not a problem because WebCore's JSGlobalData
1067 is never destroyed and JSGlobalContextRelease takes care of calling
1068 heap.destroy() in advance.
1070 2008-10-02 Oliver Hunt <oliver@apple.com>
1072 Reviewed by Maciej Stachowiak.
1074 Replace SSE3 check with an SSE2 check, and implement SSE2 check on windows.
1076 5.6% win on SunSpider on windows.
1079 (JSC::isSSE2Present):
1080 (JSC::CTI::compileBinaryArithOp):
1081 (JSC::CTI::compileBinaryArithOpSlowCase):
1083 2008-10-03 Maciej Stachowiak <mjs@apple.com>
1085 Rubber stamped by Cameron Zwarich.
1087 - fix mistaken change of | to || which caused a big perf regression on EarleyBoyer
1091 2008-10-02 Darin Adler <darin@apple.com>
1093 Reviewed by Geoff Garen.
1095 - https://bugs.webkit.org/show_bug.cgi?id=21321
1096 Bug 21321: speed up JavaScriptCore by inlining Heap in JSGlobalData
1098 1.019x as fast on SunSpider.
1101 (JSEvaluateScript): Use heap. instead of heap-> to work with the heap.
1102 (JSCheckScriptSyntax): Ditto.
1103 (JSGarbageCollect): Ditto.
1104 (JSReportExtraMemoryCost): Ditto.
1105 * API/JSContextRef.cpp:
1106 (JSGlobalContextRetain): Ditto.
1107 (JSGlobalContextRelease): Destroy the heap with the destroy function instead
1108 of the delete operator.
1109 (JSContextGetGlobalObject): Use heap. instead of heap-> to work with the heap.
1110 * API/JSObjectRef.cpp:
1111 (JSObjectMake): Use heap. instead of heap-> to work with the heap.
1112 (JSObjectMakeFunctionWithCallback): Ditto.
1113 (JSObjectMakeConstructor): Ditto.
1114 (JSObjectMakeFunction): Ditto.
1115 (JSObjectMakeArray): Ditto.
1116 (JSObjectMakeDate): Ditto.
1117 (JSObjectMakeError): Ditto.
1118 (JSObjectMakeRegExp): Ditto.
1119 (JSObjectHasProperty): Ditto.
1120 (JSObjectGetProperty): Ditto.
1121 (JSObjectSetProperty): Ditto.
1122 (JSObjectGetPropertyAtIndex): Ditto.
1123 (JSObjectSetPropertyAtIndex): Ditto.
1124 (JSObjectDeleteProperty): Ditto.
1125 (JSObjectCallAsFunction): Ditto.
1126 (JSObjectCallAsConstructor): Ditto.
1127 (JSObjectCopyPropertyNames): Ditto.
1128 (JSPropertyNameAccumulatorAddName): Ditto.
1129 * API/JSValueRef.cpp:
1130 (JSValueIsEqual): Ditto.
1131 (JSValueIsInstanceOfConstructor): Ditto.
1132 (JSValueMakeNumber): Ditto.
1133 (JSValueMakeString): Ditto.
1134 (JSValueToNumber): Ditto.
1135 (JSValueToStringCopy): Ditto.
1136 (JSValueToObject): Ditto.
1137 (JSValueProtect): Ditto.
1138 (JSValueUnprotect): Ditto.
1141 (JSC::ExecState::heap): Update to use the & operator.
1143 * kjs/JSGlobalData.cpp:
1144 (JSC::JSGlobalData::JSGlobalData): Update to initialize a heap member
1145 instead of calling new to make a heap.
1146 (JSC::JSGlobalData::~JSGlobalData): Destroy the heap with the destroy
1147 function instead of the delete operator.
1148 * kjs/JSGlobalData.h: Change from Heap* to a Heap.
1149 * kjs/JSGlobalObject.cpp:
1150 (JSC::JSGlobalObject::mark): Use the & operator here.
1151 (JSC::JSGlobalObject::operator new): Use heap. instead of heap-> to work
1154 2008-10-02 Cameron Zwarich <zwarich@apple.com>
1156 Reviewed by Geoff Garen.
1158 Bug 21317: Replace RegisterFile size and capacity information with Register pointers
1159 <https://bugs.webkit.org/show_bug.cgi?id=21317>
1161 This is a 2.3% speedup on the V8 DeltaBlue benchmark, a 3.3% speedup on
1162 the V8 Raytrace benchmark, and a 1.0% speedup on SunSpider.
1165 (JSC::slideRegisterWindowForCall):
1166 (JSC::Machine::callEval):
1167 (JSC::Machine::execute):
1168 (JSC::Machine::privateExecute):
1169 (JSC::Machine::cti_op_call_JSFunction):
1170 (JSC::Machine::cti_op_construct_JSConstruct):
1171 * VM/RegisterFile.cpp:
1172 (JSC::RegisterFile::~RegisterFile):
1173 * VM/RegisterFile.h:
1174 (JSC::RegisterFile::RegisterFile):
1175 (JSC::RegisterFile::start):
1176 (JSC::RegisterFile::end):
1177 (JSC::RegisterFile::size):
1178 (JSC::RegisterFile::shrink):
1179 (JSC::RegisterFile::grow):
1180 (JSC::RegisterFile::lastGlobal):
1181 (JSC::RegisterFile::markGlobals):
1182 (JSC::RegisterFile::markCallFrames):
1183 * kjs/JSGlobalObject.cpp:
1184 (JSC::JSGlobalObject::copyGlobalsTo):
1186 2008-10-02 Cameron Zwarich <zwarich@apple.com>
1188 Rubber-stamped by Darin Adler.
1190 Change bitwise operations introduced in r37166 to boolean operations. We
1191 only use bitwise operations over boolean operations for increasing
1192 performance in extremely hot code, but that does not apply to anything
1197 2008-10-02 Gavin Barraclough <barraclough@apple.com>
1199 Reviewed by Darin Adler.
1201 Fix for bug #21232 - should reset m_isPendingDash on flush,
1202 and should allow '\-' as beginning or end of a range (though
1203 not to specifiy a range itself).
1206 * wrec/CharacterClassConstructor.cpp:
1207 (JSC::CharacterClassConstructor::put):
1208 (JSC::CharacterClassConstructor::flush):
1209 * wrec/CharacterClassConstructor.h:
1210 (JSC::CharacterClassConstructor::flushBeforeEscapedHyphen):
1212 (JSC::WRECGenerator::generateDisjunction):
1213 (JSC::WRECParser::parseCharacterClass):
1214 (JSC::WRECParser::parseDisjunction):
1217 2008-10-02 Darin Adler <darin@apple.com>
1219 Reviewed by Sam Weinig.
1221 - remove the "static" from declarations in a header file, since we
1222 don't want them to have internal linkage
1224 * VM/Machine.h: Remove the static keyword from the constant and the
1225 three inline functions that Geoff just moved here.
1227 2008-10-02 Geoffrey Garen <ggaren@apple.com>
1229 Reviewed by Sam Weinig.
1231 Fixed https://bugs.webkit.org/show_bug.cgi?id=21283.
1232 Profiler Crashes When Started
1236 (JSC::makeHostCallFramePointer):
1237 (JSC::isHostCallFrame):
1238 (JSC::stripHostCallFrameBit): Moved some things to the header so
1239 JSGlobalObject could use them.
1241 * kjs/JSGlobalObject.h:
1242 (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Call the
1243 new makeHostCallFramePointer API, since 0 no longer indicates a host
1246 2008-10-02 Alexey Proskuryakov <ap@webkit.org>
1248 Reviewed by Darin Adler.
1250 https://bugs.webkit.org/show_bug.cgi?id=21304
1251 Stop using a static wrapper map for WebCore JS bindings
1253 * kjs/JSGlobalData.cpp:
1254 (JSC::JSGlobalData::JSGlobalData):
1255 (JSC::JSGlobalData::~JSGlobalData):
1256 (JSC::JSGlobalData::ClientData::~ClientData):
1257 * kjs/JSGlobalData.h:
1258 Added a client data member to JSGlobalData. WebCore will use it to store bindings-related
1261 * JavaScriptCore.exp: Export virtual ClientData destructor.
1263 2008-10-02 Geoffrey Garen <ggaren@apple.com>
1267 Try to fix Qt build.
1271 2008-10-01 Geoffrey Garen <ggaren@apple.com>
1273 Reviewed by Darin Adler and Cameron Zwarich.
1275 Preliminary step toward dynamic recompilation: Standardized and
1276 simplified the parsing interface.
1278 The main goal in this patch is to make it easy to ask for a duplicate
1279 compilation, and get back a duplicate result -- same source URL, same
1280 debugger / profiler ID, same toString behavior, etc.
1282 The basic unit of compilation and evaluation is now SourceCode, which
1283 encompasses a SourceProvider, a range in that provider, and a starting
1286 A SourceProvider now encompasses a source URL, and *is* a source ID,
1287 since a pointer is a unique identifier.
1291 (JSCheckScriptSyntax): Provide a SourceCode to the Interpreter, since
1292 other APIs are no longer supported.
1295 (JSC::EvalCodeCache::get): Provide a SourceCode to the Interpreter, since
1296 other APIs are no longer supported.
1297 (JSC::CodeBlock::CodeBlock): ASSERT something that used to be ASSERTed
1298 by our caller -- this is a better bottleneck.
1300 * VM/CodeGenerator.cpp:
1301 (JSC::CodeGenerator::CodeGenerator): Updated for the fact that
1302 FunctionBodyNode's parameters are no longer a WTF::Vector.
1304 * kjs/Arguments.cpp:
1305 (JSC::Arguments::Arguments): ditto
1307 * kjs/DebuggerCallFrame.cpp:
1308 (JSC::DebuggerCallFrame::evaluate): Provide a SourceCode to the Parser,
1309 since other APIs are no longer supported.
1311 * kjs/FunctionConstructor.cpp:
1312 (JSC::constructFunction): Provide a SourceCode to the Parser, since
1313 other APIs are no longer supported. Adopt FunctionBodyNode's new
1314 "finishParsing" API.
1316 * kjs/JSFunction.cpp:
1317 (JSC::JSFunction::lengthGetter):
1318 (JSC::JSFunction::getParameterName): Updated for the fact that
1319 FunctionBodyNode's parameters are no longer a wtf::Vector.
1321 * kjs/JSFunction.h: Nixed some cruft.
1323 * kjs/JSGlobalObjectFunctions.cpp:
1324 (JSC::globalFuncEval): Provide a SourceCode to the Parser, since
1325 other APIs are no longer supported.
1328 (JSC::Parser::parse): Require a SourceCode argument, instead of a bunch
1329 of broken out parameters. Stop tracking sourceId as an integer, since we
1330 use the SourceProvider pointer for this now. Don't clamp the
1331 startingLineNumber, since SourceCode does that now.
1334 (JSC::Parser::parse): Standardized the parsing interface to require a
1340 (prettyPrintScript):
1342 (runInteractive): Provide a SourceCode to the Interpreter, since
1343 other APIs are no longer supported.
1345 * kjs/SourceProvider.h:
1346 (JSC::SourceProvider::SourceProvider):
1347 (JSC::SourceProvider::url):
1348 (JSC::SourceProvider::asId):
1349 (JSC::UStringSourceProvider::create):
1350 (JSC::UStringSourceProvider::UStringSourceProvider): Added new
1351 responsibilities described above.
1353 * kjs/SourceRange.h:
1354 (JSC::SourceCode::SourceCode):
1355 (JSC::SourceCode::toString):
1356 (JSC::SourceCode::provider):
1357 (JSC::SourceCode::firstLine):
1358 (JSC::SourceCode::data):
1359 (JSC::SourceCode::length): Added new responsibilities described above.
1360 Renamed SourceRange to SourceCode, based on review feedback. Added
1361 a makeSource function for convenience.
1363 * kjs/debugger.h: Provide a SourceCode to the client, since other APIs
1364 are no longer supported.
1366 * kjs/grammar.y: Provide startingLineNumber when creating a SourceCode.
1368 * kjs/debugger.h: Treat sourceId as intptr_t to avoid loss of precision
1371 * kjs/interpreter.cpp:
1372 (JSC::Interpreter::checkSyntax):
1373 (JSC::Interpreter::evaluate):
1374 * kjs/interpreter.h: Require a SourceCode instead of broken out arguments.
1377 (JSC::Lexer::setCode):
1379 (JSC::Lexer::sourceRange): Fold together the SourceProvider and line number
1380 into a SourceCode. Fixed a bug where the Lexer would accidentally keep
1381 alive the last SourceProvider forever.
1384 (JSC::ScopeNode::ScopeNode):
1385 (JSC::ProgramNode::ProgramNode):
1386 (JSC::ProgramNode::create):
1387 (JSC::EvalNode::EvalNode):
1388 (JSC::EvalNode::generateCode):
1389 (JSC::EvalNode::create):
1390 (JSC::FunctionBodyNode::FunctionBodyNode):
1391 (JSC::FunctionBodyNode::finishParsing):
1392 (JSC::FunctionBodyNode::create):
1393 (JSC::FunctionBodyNode::generateCode):
1394 (JSC::ProgramNode::generateCode):
1395 (JSC::FunctionBodyNode::paramString):
1398 (JSC::ScopeNode::sourceId):
1399 (JSC::FunctionBodyNode::):
1400 (JSC::FunctionBodyNode::parameterCount):
1401 (JSC::FuncExprNode::):
1402 (JSC::FuncDeclNode::): Store a SourceCode in all ScopeNodes, since
1403 SourceCode is now responsible for tracking URL, ID, etc. Streamlined
1404 some ad hoc FunctionBodyNode fixups into a "finishParsing" function, to
1405 help make clear what you need to do in order to finish parsing a
1409 (WTF::::releaseBuffer): Don't ASSERT that releaseBuffer() is only called
1410 when buffer is not 0, since FunctionBodyNode is more than happy
1411 to get back a 0 buffer, and other functions like RefPtr::release() allow
1414 2008-10-01 Cameron Zwarich <zwarich@apple.com>
1416 Reviewed by Maciej Stachowiak.
1418 Bug 21289: REGRESSION (r37160): Inspector crashes on load
1419 <https://bugs.webkit.org/show_bug.cgi?id=21289>
1421 The code in Arguments::mark() in r37160 was wrong. It marks indices in
1422 d->registers, but that makes no sense (they are local variables, not
1423 arguments). It should mark those indices in d->registerArray instead.
1425 This patch also changes Arguments::copyRegisters() to use d->numParameters
1426 instead of recomputing it.
1428 * kjs/Arguments.cpp:
1429 (JSC::Arguments::mark):
1431 (JSC::Arguments::copyRegisters):
1433 2008-09-30 Darin Adler <darin@apple.com>
1435 Reviewed by Eric Seidel.
1437 - https://bugs.webkit.org/show_bug.cgi?id=21214
1438 work on getting rid of ExecState
1440 Eliminate some unneeded uses of dynamicGlobalObject.
1442 * API/JSClassRef.cpp:
1443 (OpaqueJSClass::contextData): Changed to use a map in the global data instead
1444 of on the global object. Also fixed to use only a single hash table lookup.
1446 * API/JSObjectRef.cpp:
1447 (JSObjectMakeConstructor): Use lexicalGlobalObject rather than dynamicGlobalObject
1448 to get the object prototype.
1450 * kjs/ArrayPrototype.cpp:
1451 (JSC::arrayProtoFuncToString): Use arrayVisitedElements set in global data rather
1452 than in the global object.
1453 (JSC::arrayProtoFuncToLocaleString): Ditto.
1454 (JSC::arrayProtoFuncJoin): Ditto.
1456 * kjs/JSGlobalData.cpp:
1457 (JSC::JSGlobalData::JSGlobalData): Don't initialize opaqueJSClassData, since
1458 it's no longer a pointer.
1459 (JSC::JSGlobalData::~JSGlobalData): We still need to delete all the values, but
1460 we don't need to delete the map since it's no longer a pointer.
1462 * kjs/JSGlobalData.h: Made opaqueJSClassData a map instead of a pointer to a map.
1463 Also added arrayVisitedElements.
1465 * kjs/JSGlobalObject.h: Removed arrayVisitedElements.
1468 (functionRun): Use lexicalGlobalObject instead of dynamicGlobalObject.
1469 (functionLoad): Ditto.
1471 2008-10-01 Cameron Zwarich <zwarich@apple.com>
1475 Speculative Windows build fix.
1479 2008-10-01 Cameron Zwarich <zwarich@apple.com>
1481 Reviewed by Darin Adler.
1483 Bug 21123: using "arguments" in a function should not force creation of an activation object
1484 <https://bugs.webkit.org/show_bug.cgi?id=21123>
1486 Make the 'arguments' object not require a JSActivation. We store the
1487 'arguments' object in the OptionalCalleeArguments call frame slot. We
1488 need to be able to get the original 'arguments' object to tear it off
1489 when returning from a function, but 'arguments' may be assigned to in a
1492 Therefore, we use the OptionalCalleeArguments slot when we want to get
1493 the original activation or we know that 'arguments' was not assigned a
1494 different value. When 'arguments' may have been assigned a new value,
1495 we use a new local variable that is initialized with 'arguments'. Since
1496 a function parameter named 'arguments' may overwrite the value of
1497 'arguments', we also need to be careful to look up 'arguments' in the
1498 symbol table, so we get the parameter named 'arguments' instead of the
1499 local variable that we have added for holding the 'arguments' object.
1501 This is a 19.1% win on the V8 Raytrace benchmark using the SunSpider
1502 harness, and a 20.7% win using the V8 harness. This amounts to a 6.5%
1503 total speedup on the V8 benchmark suite using the V8 harness.
1506 (JSC::CTI::privateCompileMainPass):
1508 * VM/CodeGenerator.cpp:
1509 (JSC::CodeGenerator::CodeGenerator):
1511 (JSC::Machine::unwindCallFrame):
1512 (JSC::Machine::privateExecute):
1513 (JSC::Machine::retrieveArguments):
1514 (JSC::Machine::cti_op_init_arguments):
1515 (JSC::Machine::cti_op_ret_activation_arguments):
1517 * VM/RegisterFile.h:
1518 (JSC::RegisterFile::):
1519 * kjs/Arguments.cpp:
1520 (JSC::Arguments::mark):
1521 (JSC::Arguments::fillArgList):
1522 (JSC::Arguments::getOwnPropertySlot):
1523 (JSC::Arguments::put):
1525 (JSC::Arguments::setRegisters):
1526 (JSC::Arguments::init):
1527 (JSC::Arguments::Arguments):
1528 (JSC::Arguments::copyRegisters):
1529 (JSC::JSActivation::copyRegisters):
1530 * kjs/JSActivation.cpp:
1531 (JSC::JSActivation::argumentsGetter):
1532 * kjs/JSActivation.h:
1533 (JSC::JSActivation::JSActivationData::JSActivationData):
1536 (JSC::ScopeNode::setUsesArguments):
1537 * masm/X86Assembler.h:
1538 (JSC::X86Assembler::):
1539 (JSC::X86Assembler::orl_mr):
1541 2008-10-01 Kevin McCullough <kmccullough@apple.com>
1543 Rubberstamped by Geoff Garen.
1545 Remove BreakpointCheckStatement because it's not used anymore.
1546 No effect on sunspider or the jsc tests.
1551 2008-09-30 Oliver Hunt <oliver@apple.com>
1553 Reviewed by Geoff Garen.
1555 Improve performance of CTI on windows.
1557 Currently on platforms where the compiler doesn't allow us to safely
1558 index relative to the address of a parameter we need to actually
1559 provide a pointer to CTI runtime call arguments. This patch improves
1560 performance in this case by making the CTI logic for restoring this
1561 parameter much less conservative by only resetting it before we actually
1562 make a call, rather than between each and every SF bytecode we generate
1565 This results in a 3.6% progression on the v8 benchmark when compiled with MSVC.
1568 (JSC::CTI::emitCall):
1569 (JSC::CTI::compileOpCall):
1570 (JSC::CTI::privateCompileMainPass):
1571 (JSC::CTI::privateCompileSlowCases):
1572 (JSC::CTI::privateCompilePutByIdTransition):
1574 * masm/X86Assembler.h:
1577 2008-09-30 Maciej Stachowiak <mjs@apple.com>
1579 Reviewed by Oliver Hunt.
1581 - track uses of "this", "with" and "catch" in the parser
1583 Knowing this up front will be useful for future optimizations.
1585 Perf and correctness remain the same.
1590 2008-09-30 Sam Weinig <sam@webkit.org>
1592 Reviewed by Mark Rowe.
1594 Add WebKitAvailability macros for JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError,
1595 and JSObjectMakeRegExp
1597 * API/JSObjectRef.h:
1599 2008-09-30 Darin Adler <darin@apple.com>
1601 Reviewed by Geoff Garen.
1603 - https://bugs.webkit.org/show_bug.cgi?id=21214
1604 work on getting rid of ExecState
1606 Replaced the m_prev field of ExecState with a bit in the
1607 call frame pointer to indicate "host" call frames.
1610 (JSC::makeHostCallFramePointer): Added. Sets low bit.
1611 (JSC::isHostCallFrame): Added. Checks low bit.
1612 (JSC::stripHostCallFrameBit): Added. Clears low bit.
1613 (JSC::Machine::unwindCallFrame): Replaced null check that was
1614 formerly used to detect host call frames with an isHostCallFrame check.
1615 (JSC::Machine::execute): Pass in a host call frame pointer rather than
1616 always passing 0 when starting execution from the host. This allows us
1617 to follow the entire call frame pointer chain when desired, or to stop
1618 at the host calls when that's desired.
1619 (JSC::Machine::privateExecute): Replaced null check that was
1620 formerly used to detect host call frames with an isHostCallFrame check.
1621 (JSC::Machine::retrieveCaller): Ditto.
1622 (JSC::Machine::retrieveLastCaller): Ditto.
1623 (JSC::Machine::callFrame): Removed the code to walk up m_prev pointers
1624 and replaced it with code that uses the caller pointer and uses the
1625 stripHostCallFrameBit function.
1627 * kjs/ExecState.cpp: Removed m_prev.
1628 * kjs/ExecState.h: Ditto.
1630 2008-09-30 Cameron Zwarich <zwarich@apple.com>
1632 Reviewed by Geoff Garen.
1634 Move all detection of 'arguments' in a lexical scope to the parser, in
1635 preparation for fixing
1637 Bug 21123: using "arguments" in a function should not force creation of an activation object
1638 <https://bugs.webkit.org/show_bug.cgi?id=21123>
1640 * VM/CodeGenerator.cpp:
1641 (JSC::CodeGenerator::CodeGenerator):
1645 2008-09-30 Geoffrey Garen <ggaren@apple.com>
1650 (runWithScripts): Fixed indentation.
1652 2008-09-30 Mark Rowe <mrowe@apple.com>
1654 Rubber-stamped by Sam Weinig.
1656 Build fix. Move InternalFunction::classInfo implementation into the .cpp
1657 file to prevent the vtable for InternalFunction being generated as a weak symbol.
1658 Has no effect on SunSpider.
1660 * kjs/InternalFunction.cpp:
1661 (JSC::InternalFunction::classInfo):
1662 * kjs/InternalFunction.h:
1664 2008-09-29 Maciej Stachowiak <mjs@apple.com>
1666 Reviewed by Darin Adler.
1668 - optimize appending a number to a string
1669 https://bugs.webkit.org/show_bug.cgi?id=21203
1671 It's pretty common in real-world code (and on some of the v8
1672 benchmarks) to append a number to a string, so I made this one of
1673 the fast cases, and also added support to UString to do it
1674 directly without allocating a temporary UString.
1676 ~1% speedup on v8 benchmark.
1679 (JSC::jsAddSlowCase): Make this NEVER_INLINE because somehow otherwise
1680 the change is a regression.
1681 (JSC::jsAdd): Handle number + string special case.
1682 (JSC::Machine::cti_op_add): Integrate much of the logic of jsAdd to
1683 avoid exception check in the str + str, num + num and str + num cases.
1685 (JSC::expandedSize): Make this a non-member function, since it needs to be
1686 called in non-member functions but not outside this file.
1687 (JSC::expandCapacity): Ditto.
1688 (JSC::UString::expandCapacity): Call the non-member version.
1689 (JSC::createRep): Helper to make a rep from a char*.
1690 (JSC::UString::UString): Use above helper.
1691 (JSC::concatenate): Guts of concatenating constructor for cases where first
1692 item is a UString::Rep, and second is a UChar* and length, or a char*.
1693 (JSC::UString::append): Implement for cases where first item is a UString::Rep,
1694 and second is an int or double. Sadly duplicates logic of UString::from(int)
1695 and UString::from(double).
1698 2008-09-29 Darin Adler <darin@apple.com>
1700 Reviewed by Sam Weinig.
1702 - https://bugs.webkit.org/show_bug.cgi?id=21214
1703 work on getting rid of ExecState
1705 * JavaScriptCore.exp: Updated since JSGlobalObject::init
1706 no longer takes a parameter.
1709 (JSC::Machine::execute): Removed m_registerFile argument
1710 for ExecState constructors.
1712 * kjs/DebuggerCallFrame.cpp:
1713 (JSC::DebuggerCallFrame::evaluate): Removed globalThisValue
1714 argument for ExecState constructor.
1716 * kjs/ExecState.cpp:
1717 (JSC::ExecState::ExecState): Removed globalThisValue and
1718 registerFile arguments to constructors.
1720 * kjs/ExecState.h: Removed m_globalThisValue and
1721 m_registerFile data members.
1723 * kjs/JSGlobalObject.cpp:
1724 (JSC::JSGlobalObject::init): Removed globalThisValue
1725 argument for ExecState constructor.
1727 * kjs/JSGlobalObject.h:
1728 (JSC::JSGlobalObject::JSGlobalObject): Got rid of parameter
1729 for the init function.
1731 2008-09-29 Geoffrey Garen <ggaren@apple.com>
1733 Rubber-stamped by Cameron Zwarich.
1735 Fixed https://bugs.webkit.org/show_bug.cgi?id=21225
1736 Machine::retrieveLastCaller should check for a NULL codeBlock
1738 In order to crash, you would need to call retrieveCaller in a situation
1739 where you had two host call frames in a row in the register file. I
1740 don't know how to make that happen, or if it's even possible, so I don't
1741 have a test case -- but better safe than sorry!
1744 (JSC::Machine::retrieveLastCaller):
1746 2008-09-29 Geoffrey Garen <ggaren@apple.com>
1748 Reviewed by Cameron Zwarich.
1750 Store the callee ScopeChain, not the caller ScopeChain, in the call frame
1751 header. Nix the "scopeChain" local variable and ExecState::m_scopeChain, and
1752 access the callee ScopeChain through the call frame header instead.
1754 Profit: call + return are simpler, because they don't have to update the
1755 "scopeChain" local variable, or ExecState::m_scopeChain.
1757 Because CTI keeps "r" in a register, reading the callee ScopeChain relative
1758 to "r" can be very fast, in any cases we care to optimize.
1760 0% speedup on empty function call benchmark. (5.5% speedup in bytecode.)
1761 0% speedup on SunSpider. (7.5% speedup on controlflow-recursive.)
1762 2% speedup on SunSpider --v8.
1763 2% speedup on v8 benchmark.
1765 * VM/CTI.cpp: Changed scope chain access to read the scope chain from
1766 the call frame header. Sped up op_ret by changing it not to fuss with
1767 the "scopeChain" local variable or ExecState::m_scopeChain.
1769 * VM/CTI.h: Updated CTI trampolines not to take a ScopeChainNode*
1770 argument, since that's stored in the call frame header now.
1772 * VM/Machine.cpp: Access "scopeChain" and "codeBlock" through new helper
1773 functions that read from the call frame header. Updated functions operating
1774 on ExecState::m_callFrame to account for / take advantage of the fact that
1775 Exec:m_callFrame is now never NULL.
1777 Fixed a bug in op_construct, where it would use the caller's default
1778 object prototype, rather than the callee's, when constructing a new object.
1780 * VM/Machine.h: Made some helper functions available. Removed
1781 ScopeChainNode* arguments to a lot of functions, since the ScopeChainNode*
1782 is now stored in the call frame header.
1784 * VM/RegisterFile.h: Renamed "CallerScopeChain" to "ScopeChain", since
1785 that's what it is now.
1787 * kjs/DebuggerCallFrame.cpp: Updated for change to ExecState signature.
1789 * kjs/ExecState.cpp:
1790 * kjs/ExecState.h: Nixed ExecState::m_callFrame, along with the unused
1791 isGlobalObject function.
1793 * kjs/JSGlobalObject.cpp:
1794 * kjs/JSGlobalObject.h: Gave the global object a fake call frame in
1795 which to store the global scope chain, since our code now assumes that
1796 it can always read the scope chain out of the ExecState's call frame.
1798 2008-09-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1800 Reviewed by Sam Weinig.
1802 Remove the isActivationObject() virtual method on JSObject and use
1803 StructureID information instead. This should be slightly faster, but
1804 isActivationObject() is only used in assertions and unwinding the stack
1809 (JSC::Machine::unwindCallFrame):
1810 (JSC::Machine::privateExecute):
1811 (JSC::Machine::cti_op_ret_activation):
1812 * kjs/JSActivation.cpp:
1813 * kjs/JSActivation.h:
1816 2008-09-29 Peter Gal <galpeter@inf.u-szeged.hu>
1818 Reviewed and tweaked by Darin Adler.
1820 Fix build for non-all-in-one platforms.
1822 * kjs/StringPrototype.cpp: Added missing ASCIICType.h include.
1824 2008-09-29 Bradley T. Hughes <bradley.hughes@nokia.com>
1826 Reviewed by Simon Hausmann.
1828 Fix compilation with icpc
1834 2008-09-29 Thiago Macieira <thiago.macieira@nokia.com>
1836 Reviewed by Simon Hausmann.
1838 Changed copyright from Trolltech ASA to Nokia.
1840 Nokia acquired Trolltech ASA, assets were transferred on September 26th 2008.
1843 * wtf/qt/MainThreadQt.cpp:
1845 2008-09-29 Simon Hausmann <hausmann@webkit.org>
1847 Reviewed by Lars Knoll.
1849 Don't accidentially install libJavaScriptCore.a for the build inside
1852 * JavaScriptCore.pro:
1854 2008-09-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1856 Reviewed by Maciej Stachowiak.
1858 Bug 21200: Allow direct access to 'arguments' without using op_resolve
1859 <https://bugs.webkit.org/show_bug.cgi?id=21200>
1861 Allow fast access to the 'arguments' object by adding an extra slot to
1862 the callframe to store it.
1864 This is a 3.0% speedup on the V8 Raytrace benchmark.
1866 * JavaScriptCore.exp:
1868 (JSC::CTI::privateCompileMainPass):
1870 (JSC::CodeBlock::dump):
1871 * VM/CodeGenerator.cpp:
1872 (JSC::CodeGenerator::CodeGenerator):
1873 (JSC::CodeGenerator::registerFor):
1874 * VM/CodeGenerator.h:
1875 (JSC::CodeGenerator::registerFor):
1877 (JSC::Machine::initializeCallFrame):
1878 (JSC::Machine::dumpRegisters):
1879 (JSC::Machine::privateExecute):
1880 (JSC::Machine::retrieveArguments):
1881 (JSC::Machine::cti_op_call_JSFunction):
1882 (JSC::Machine::cti_op_create_arguments):
1883 (JSC::Machine::cti_op_construct_JSConstruct):
1886 * VM/RegisterFile.h:
1887 (JSC::RegisterFile::):
1888 * kjs/JSActivation.cpp:
1889 (JSC::JSActivation::mark):
1890 (JSC::JSActivation::argumentsGetter):
1891 * kjs/JSActivation.h:
1892 (JSC::JSActivation::JSActivationData::JSActivationData):
1895 (JSC::Parser::didFinishParsing):
1897 (JSC::Parser::parse):
1900 (JSC::ScopeNode::ScopeNode):
1901 (JSC::ProgramNode::ProgramNode):
1902 (JSC::ProgramNode::create):
1903 (JSC::EvalNode::EvalNode):
1904 (JSC::EvalNode::create):
1905 (JSC::FunctionBodyNode::FunctionBodyNode):
1906 (JSC::FunctionBodyNode::create):
1908 (JSC::ScopeNode::usesArguments):
1910 2008-09-28 Mark Rowe <mrowe@apple.com>
1912 Reviewed by Sam Weinig.
1914 Add an ASCII fast-path to toLowerCase and toUpperCase.
1916 The fast path speeds up the common case of an ASCII-only string by up to 60% while adding a less than 5% penalty
1917 to the less common non-ASCII case.
1919 This also removes stringProtoFuncToLocaleLowerCase and stringProtoFuncToLocaleUpperCase, which were identical
1920 to the non-locale variants of the functions. toLocaleLowerCase and toLocaleUpperCase now use the non-locale
1921 variants of the functions directly.
1923 * kjs/StringPrototype.cpp:
1924 (JSC::stringProtoFuncToLowerCase):
1925 (JSC::stringProtoFuncToUpperCase):
1927 2008-09-28 Mark Rowe <mrowe@apple.com>
1929 Reviewed by Cameron Zwarich.
1931 Speed up parseInt and parseFloat.
1933 Repeatedly indexing into a UString is slow, so retrieve a pointer into the underlying buffer once up front
1934 and use that instead. This is a 7% win on a parseInt/parseFloat micro-benchmark.
1936 * kjs/JSGlobalObjectFunctions.cpp:
1940 2008-09-28 Simon Hausmann <hausmann@webkit.org>
1942 Reviewed by David Hyatt.
1944 In Qt's initializeThreading re-use an existing thread identifier for the main
1945 thread if it exists.
1947 currentThread() implicitly creates new identifiers and it could be that
1948 it is called before initializeThreading().
1950 * wtf/ThreadingQt.cpp:
1951 (WTF::initializeThreading):
1953 2008-09-27 Keishi Hattori <casey.hattori@gmail.com>
1955 Added Machine::retrieveCaller to the export list.
1957 Reviewed by Kevin McCullough and Tim Hatcher.
1959 * JavaScriptCore.exp: Added Machine::retrieveCaller.
1961 2008-09-27 Anders Carlsson <andersca@apple.com>
1968 2008-09-27 Geoffrey Garen <ggaren@apple.com>
1970 Reviewed by Cameron Zwarich.
1972 https://bugs.webkit.org/show_bug.cgi?id=21175
1974 Store the callee CodeBlock, not the caller CodeBlock, in the call frame
1975 header. Nix the "codeBlock" local variable, and access the callee
1976 CodeBlock through the call frame header instead.
1978 Profit: call + return are simpler, because they don't have to update the
1979 "codeBlock" local variable.
1981 Because CTI keeps "r" in a register, reading the callee CodeBlock relative
1982 to "r" can be very fast, in any cases we care to optimize. Presently,
1983 no such cases seem important.
1985 Also, stop writing "dst" to the call frame header. CTI doesn't use it.
1987 21.6% speedup on empty function call benchmark.
1988 3.8% speedup on SunSpider --v8.
1989 2.1% speedup on v8 benchmark.
1990 0.7% speedup on SunSpider (6% speedup on controlflow-recursive).
1992 Small regression in bytecode, because currently every op_ret reads the
1993 callee CodeBlock to check needsFullScopeChain, and bytecode does not
1994 keep "r" in a register. On-balance, this is probably OK, since CTI is
1995 our high-performance execution model. Also, this should go away once
1996 we make needsFullScopeChain statically determinable at parse time.
1999 (JSC::CTI::compileOpCall): The speedup!
2000 (JSC::CTI::privateCompileSlowCases): ditto
2003 (JSC::): Fixed up magic trampoline constants to account for the nixed
2004 "codeBlock" argument.
2005 (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock"
2006 argument, since codeBlock is now stored in the call frame header.
2008 * VM/Machine.cpp: Read the callee CodeBlock from the register file. Use
2009 a NULL CallerRegisters in the call frame header to signal a built-in
2010 caller, since CodeBlock is now never NULL.
2012 * VM/Machine.h: Made some stand-alone functions Machine member functions
2013 so they could call the private codeBlock() accessor in the Register
2014 class, of which Machine is a friend. Renamed "CallerCodeBlock" to
2015 "CodeBlock", since it's no longer the caller's CodeBlock.
2017 * VM/RegisterFile.h: Marked some methods const to accommodate a
2018 const RegisterFile* being passed around in Machine.cpp.
2020 2008-09-26 Jan Michael Alonzo <jmalonzo@webkit.org>
2022 Gtk build fix. Not reviewed.
2024 Narrow-down the target of the JavaScriptCore .lut.h generator so
2025 it won't try to create the WebCore .lut.hs.
2029 2008-09-26 Matt Lilek <webkit@mattlilek.com>
2031 Reviewed by Tim Hatcher.
2033 Update FEATURE_DEFINES after ENABLE_CROSS_DOCUMENT_MESSAGING was removed.
2035 * Configurations/JavaScriptCore.xcconfig:
2037 2008-09-26 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2039 Rubber-stamped by Anders Carlson.
2041 Change the name 'sc' to 'scopeChainNode' in a few places.
2044 (JSC::EvalNode::generateCode):
2045 (JSC::FunctionBodyNode::generateCode):
2046 (JSC::ProgramNode::generateCode):
2048 2008-09-26 Sam Weinig <sam@webkit.org>
2050 Reviewed by Darin Adler.
2052 Patch for https://bugs.webkit.org/show_bug.cgi?id=21152
2053 Speedup static property get/put
2055 Convert getting/setting static property values to use static functions
2056 instead of storing an integer and switching in getValueProperty/putValueProperty.
2059 (JSC::JSObject::deleteProperty):
2060 (JSC::JSObject::getPropertyAttributes):
2061 * kjs/MathObject.cpp:
2062 (JSC::MathObject::getOwnPropertySlot):
2063 * kjs/NumberConstructor.cpp:
2064 (JSC::numberConstructorNaNValue):
2065 (JSC::numberConstructorNegInfinity):
2066 (JSC::numberConstructorPosInfinity):
2067 (JSC::numberConstructorMaxValue):
2068 (JSC::numberConstructorMinValue):
2069 * kjs/PropertySlot.h:
2070 (JSC::PropertySlot::):
2071 * kjs/RegExpConstructor.cpp:
2072 (JSC::regExpConstructorDollar1):
2073 (JSC::regExpConstructorDollar2):
2074 (JSC::regExpConstructorDollar3):
2075 (JSC::regExpConstructorDollar4):
2076 (JSC::regExpConstructorDollar5):
2077 (JSC::regExpConstructorDollar6):
2078 (JSC::regExpConstructorDollar7):
2079 (JSC::regExpConstructorDollar8):
2080 (JSC::regExpConstructorDollar9):
2081 (JSC::regExpConstructorInput):
2082 (JSC::regExpConstructorMultiline):
2083 (JSC::regExpConstructorLastMatch):
2084 (JSC::regExpConstructorLastParen):
2085 (JSC::regExpConstructorLeftContext):
2086 (JSC::regExpConstructorRightContext):
2087 (JSC::setRegExpConstructorInput):
2088 (JSC::setRegExpConstructorMultiline):
2089 (JSC::RegExpConstructor::setInput):
2090 (JSC::RegExpConstructor::setMultiline):
2091 (JSC::RegExpConstructor::multiline):
2092 * kjs/RegExpConstructor.h:
2093 * kjs/RegExpObject.cpp:
2094 (JSC::regExpObjectGlobal):
2095 (JSC::regExpObjectIgnoreCase):
2096 (JSC::regExpObjectMultiline):
2097 (JSC::regExpObjectSource):
2098 (JSC::regExpObjectLastIndex):
2099 (JSC::setRegExpObjectLastIndex):
2100 * kjs/RegExpObject.h:
2101 (JSC::RegExpObject::setLastIndex):
2102 (JSC::RegExpObject::lastIndex):
2103 (JSC::RegExpObject::RegExpObjectData::RegExpObjectData):
2104 * kjs/StructureID.cpp:
2105 (JSC::StructureID::getEnumerablePropertyNames):
2106 * kjs/create_hash_table:
2110 (JSC::HashTable::createTable):
2111 (JSC::HashTable::deleteTable):
2112 (JSC::setUpStaticFunctionSlot):
2114 (JSC::HashEntry::initialize):
2115 (JSC::HashEntry::setKey):
2116 (JSC::HashEntry::key):
2117 (JSC::HashEntry::attributes):
2118 (JSC::HashEntry::function):
2119 (JSC::HashEntry::functionLength):
2120 (JSC::HashEntry::propertyGetter):
2121 (JSC::HashEntry::propertyPutter):
2122 (JSC::HashEntry::lexerValue):
2124 (JSC::HashTable::entry):
2125 (JSC::getStaticPropertySlot):
2126 (JSC::getStaticValueSlot):
2129 2008-09-26 Gavin Barraclough <barraclough@apple.com>
2131 Reviewed by Maciej Stachowiak & Oliver Hunt.
2133 Add support for reusing temporary JSNumberCells. This change is based on the observation
2134 that if the result of certain operations is a JSNumberCell and is consumed by a subsequent
2135 operation that would produce a JSNumberCell, we can reuse the object rather than allocating
2136 a fresh one. E.g. given the expression ((a * b) * c), we can statically determine that
2137 (a * b) will have a numeric result (or else it will have thrown an exception), so the result
2138 will either be a JSNumberCell or a JSImmediate.
2140 This patch changes three areas of JSC:
2141 * The AST now tracks type information about the result of each node.
2142 * This information is consumed in bytecode compilation, and certain bytecode operations
2143 now carry the statically determined type information about their operands.
2144 * CTI uses the information in a number of fashions:
2145 * Where an operand to certain arithmetic operations is reusable, it will plant code
2146 to try to perform the operation in JIT code & reuse the cell, where appropriate.
2147 * Where it can be statically determined that an operand can only be numeric (typically
2148 the result of another arithmetic operation) the code will not redundantly check that
2149 the JSCell is a JSNumberCell.
2150 * Where either of the operands to an add are non-numeric do not plant an optimized
2151 arithmetic code path, just call straight out to the C function.
2153 +6% Sunspider (10% progression on 3D, 16% progression on math, 60% progression on access-nbody),
2154 +1% v8-tests (improvements in raytrace & crypto)
2156 * VM/CTI.cpp: Add optimized code generation with reuse of temporary JSNumberCells.
2158 * kjs/JSNumberCell.h:
2159 * masm/X86Assembler.h:
2161 * VM/CodeBlock.cpp: Add type information to specific bytecodes.
2162 * VM/CodeGenerator.cpp:
2163 * VM/CodeGenerator.h:
2166 * kjs/nodes.cpp: Track static type information for nodes.
2168 * kjs/ResultDescriptor.h: (Added)
2169 * JavaScriptCore.xcodeproj/project.pbxproj:
2171 2008-09-26 Yichao Yin <yichao.yin@torchmobile.com.cn>
2173 Reviewed by George Staikos, Maciej Stachowiak.
2175 Add utility functions needed for upcoming WML code.
2178 (WTF::isASCIIPrintable):
2180 2008-09-26 Geoffrey Garen <ggaren@apple.com>
2182 Reviewed by Darin Adler.
2184 Reverted the part of r36614 that used static data because static data
2187 2008-09-26 Geoffrey Garen <ggaren@apple.com>
2189 Reviewed by Maciej Stachowiak.
2191 Removed dynamic check for whether the callee needs an activation object.
2192 Replaced with callee code to create the activation object.
2194 0.5% speedup on SunSpider.
2195 No change on v8 benchmark. (Might be a speedup, but it's in range of the
2198 0.7% speedup on v8 benchmark in bytecode.
2199 1.3% speedup on empty call benchmark in bytecode.
2202 (JSC::CTI::privateCompileMainPass): Added support for op_init_activation,
2203 the new opcode that specifies that the callee's initialization should
2204 create an activation object.
2205 (JSC::CTI::privateCompile): Removed previous code that did a similar
2206 thing in an ad-hoc way.
2209 (JSC::CodeBlock::dump): Added a case for dumping op_init_activation.
2211 * VM/CodeGenerator.cpp:
2212 (JSC::CodeGenerator::generate): Added fixup code to change op_init to
2213 op_init_activation if necessary. (With a better parser, we would know
2214 which to use from the beginning.)
2217 (JSC::Instruction::Instruction):
2218 (WTF::): Faster traits for the instruction vector. An earlier version
2219 of this patch relied on inserting at the beginning of the vector, and
2220 depended on this change for speed.
2223 (JSC::Machine::execute): Removed clients of setScopeChain, the old
2224 abstraction for dynamically checking for whether an activation object
2225 needed to be created.
2226 (JSC::Machine::privateExecute): ditto
2228 (JSC::Machine::cti_op_push_activation): Renamed this function from
2229 cti_vm_updateScopeChain, and made it faster by removing the call to
2233 * VM/Opcode.h: Declared op_init_activation.
2235 2008-09-24 Geoffrey Garen <ggaren@apple.com>
2237 Reviewed by Maciej Stachowiak.
2239 Move most of the return code back into the callee, now that the callee
2240 doesn't have to calculate anything dynamically.
2242 11.5% speedup on empty function call benchmark.
2244 SunSpider says 0.3% faster. SunSpider --v8 says no change.
2247 (JSC::CTI::compileOpCall):
2248 (JSC::CTI::privateCompileMainPass):
2249 (JSC::CTI::privateCompileSlowCases):
2251 2008-09-24 Sam Weinig <sam@webkit.org>
2253 Reviewed by Maciej Stachowiak.
2255 Remove staticFunctionGetter. There is only one remaining user of
2256 staticFunctionGetter and it can be converted to use setUpStaticFunctionSlot.
2258 * JavaScriptCore.exp:
2262 2008-09-24 Maciej Stachowiak <mjs@apple.com>
2264 Reviewed by Oliver Hunt.
2266 - inline JIT fast case of op_neq
2267 - remove extra level of function call indirection from slow cases of eq and neq
2269 1% speedup on Richards
2272 (JSC::CTI::privateCompileMainPass):
2273 (JSC::CTI::privateCompileSlowCases):
2275 (JSC::Machine::privateExecute):
2276 (JSC::Machine::cti_op_eq):
2277 (JSC::Machine::cti_op_neq):
2278 * kjs/operations.cpp:
2280 (JSC::equalSlowCase):
2282 (JSC::equalSlowCaseInline):
2284 2008-09-24 Sam Weinig <sam@webkit.org>
2286 Reviewed by Darin Adler.
2288 Fix for https://bugs.webkit.org/show_bug.cgi?id=21080
2289 <rdar://problem/6243534>
2290 Crash below Function.apply when using a runtime array as the argument list
2292 Test: plugins/bindings-array-apply-crash.html
2294 * kjs/FunctionPrototype.cpp:
2295 (JSC::functionProtoFuncApply): Revert to the slow case if the object inherits from
2296 JSArray (via ClassInfo) but is not a JSArray.
2298 2008-09-24 Kevin McCullough <kmccullough@apple.com>
2303 (JSC::statementListEmitCode):
2305 2008-09-24 Kevin McCullough <kmccullough@apple.com>
2309 Bug 21031: Breakpoints in the condition of loops only breaks the first
2311 - Now when setting breakpoints in the condition of a loop (for, while,
2312 for in, and do while) will successfully break each time throught the
2314 - For 'for' loops we need a little more complicated behavior that cannot
2315 be accomplished without some more significant changes:
2316 https://bugs.webkit.org/show_bug.cgi?id=21073
2319 (JSC::statementListEmitCode): We don't want to blindly emit a debug hook
2320 at the first line of loops, instead let the loop emit the debug hooks.
2321 (JSC::DoWhileNode::emitCode):
2322 (JSC::WhileNode::emitCode):
2323 (JSC::ForNode::emitCode):
2324 (JSC::ForInNode::emitCode):
2326 (JSC::StatementNode::):
2327 (JSC::DoWhileNode::):
2331 2008-09-24 Geoffrey Garen <ggaren@apple.com>
2333 Reviewed by Darin Adler.
2335 Fixed <rdar://problem/5605532> Need a SPI for telling JS the size of
2336 the objects it retains
2338 * API/tests/testapi.c: Test the new SPI a little.
2340 * API/JSSPI.cpp: Add the new SPI.
2341 * API/JSSPI.h: Add the new SPI.
2342 * JavaScriptCore.exp: Add the new SPI.
2343 * JavaScriptCore.xcodeproj/project.pbxproj: Add the new SPI.
2345 2008-09-24 Geoffrey Garen <ggaren@apple.com>
2347 Reviewed by Darin Adler.
2349 * API/JSBase.h: Filled in some missing function names.
2351 2008-09-24 Geoffrey Garen <ggaren@apple.com>
2353 Reviewed by Cameron Zwarich.
2355 Fixed https://bugs.webkit.org/show_bug.cgi?id=21057
2356 Crash in RegisterID::deref() running fast/canvas/canvas-putImageData.html
2358 * VM/CodeGenerator.h: Changed declaration order to ensure the
2359 m_lastConstant, which is a RefPtr that points into m_calleeRegisters,
2360 has its destructor called before the destructor for m_calleeRegisters.
2362 2008-09-24 Darin Adler <darin@apple.com>
2364 Reviewed by Sam Weinig.
2366 - https://bugs.webkit.org/show_bug.cgi?id=21047
2367 speed up ret_activation with inlining
2369 About 1% on v8-raytrace.
2371 * JavaScriptCore.exp: Removed JSVariableObject::setRegisters.
2373 * kjs/JSActivation.cpp: Moved copyRegisters to the header to make it inline.
2374 * kjs/JSActivation.h:
2375 (JSC::JSActivation::copyRegisters): Moved here. Also removed the registerArraySize
2376 argument to setRegisters, since the object doesn't need to store the number of
2379 * kjs/JSGlobalObject.cpp:
2380 (JSC::JSGlobalObject::reset): Removed unnecessary clearing left over from when we
2381 used this on objects that weren't brand new. These days, this function is really
2382 just part of the constructor.
2384 * kjs/JSGlobalObject.h: Added registerArraySize to JSGlobalObjectData, since
2385 JSVariableObjectData no longer needs it. Added a setRegisters override here
2386 that handles storing the size.
2388 * kjs/JSStaticScopeObject.h: Removed code to set registerArraySize, since it
2391 * kjs/JSVariableObject.cpp: Moved copyRegisterArray and setRegisters to the
2392 header to make them inline.
2393 * kjs/JSVariableObject.h: Removed registerArraySize from JSVariableObjectData,
2394 since it was only used for the global object.
2395 (JSC::JSVariableObject::copyRegisterArray): Moved here ot make it inline.
2396 (JSC::JSVariableObject::setRegisters): Moved here to make it inline. Also
2397 removed the code to set registerArraySize and changed an if statement into
2398 an assert to save an unnnecessary branch.
2400 2008-09-24 Maciej Stachowiak <mjs@apple.com>
2402 Reviewed by Oliver Hunt.
2404 - inline PropertyMap::getOffset to speed up polymorphic lookups
2406 ~1.5% speedup on v8 benchmark
2407 no effect on SunSpider
2409 * JavaScriptCore.exp:
2410 * kjs/PropertyMap.cpp:
2411 * kjs/PropertyMap.h:
2412 (JSC::PropertyMap::getOffset):
2414 2008-09-24 Jan Michael Alonzo <jmalonzo@webkit.org>
2416 Reviewed by Alp Toker.
2418 https://bugs.webkit.org/show_bug.cgi?id=20992
2419 Build fails on GTK+ Mac OS
2421 * wtf/ThreadingGtk.cpp: Remove platform ifdef as suggested by
2423 (WTF::initializeThreading):
2425 2008-09-23 Oliver Hunt <oliver@apple.com>
2427 Reviewed by Maciej Stachowiak.
2429 Bug 19968: Slow Script at www.huffingtonpost.com
2430 <https://bugs.webkit.org/show_bug.cgi?id=19968>
2432 Finally found the cause of this accursed issue. It is triggered
2433 by synchronous creation of a new global object from JS. The new
2434 global object resets the timer state in this execution group's
2435 Machine, taking timerCheckCount to 0. Then when JS returns the
2436 timerCheckCount is decremented making it non-zero. The next time
2437 we execute JS we will start the timeout counter, however the non-zero
2438 timeoutCheckCount means we don't reset the timer information. This
2439 means that the timeout check is now checking the cumulative time
2440 since the creation of the global object rather than the time since
2441 JS was last entered. At this point the slow script dialog is guaranteed
2442 to eventually be displayed incorrectly unless a page is loaded
2443 asynchronously (which will reset everything into a sane state).
2445 The fix for this is rather trivial -- the JSGlobalObject constructor
2446 should not be resetting the machine timer state.
2449 (JSC::Machine::Machine):
2450 Now that we can't rely on the GlobalObject initialising the timeout
2451 state, we do it in the Machine constructor.
2454 (JSC::Machine::stopTimeoutCheck):
2455 Add assertions to guard against this happening.
2457 * kjs/JSGlobalObject.cpp:
2458 (JSC::JSGlobalObject::init):
2459 Don't reset the timeout state.
2461 2008-09-23 Geoffrey Garen <ggaren@apple.com>
2463 Reviewed by Oliver Hunt.
2465 Fixed https://bugs.webkit.org/show_bug.cgi?id=21038 | <rdar://problem/6240812>
2466 Uncaught exceptions in regex replace callbacks crash webkit
2468 This was a combination of two problems:
2470 (1) the replace function would continue execution after an exception
2473 (2) In some cases, the Machine would return 0 in the case of an exception,
2474 despite the fact that a few clients dereference the Machine's return
2475 value without first checking for an exception.
2478 (JSC::Machine::execute):
2480 ^ Return jsNull() instead of 0 in the case of an exception, since some
2481 clients depend on using our return value.
2483 ^ ASSERT that execution does not continue after an exception has been
2484 thrown, to help catch problems like this in the future.
2486 * kjs/StringPrototype.cpp:
2487 (JSC::stringProtoFuncReplace):
2489 ^ Stop execution if an exception has been thrown.
2491 2008-09-23 Geoffrey Garen <ggaren@apple.com>
2493 Try to fix the windows build.
2496 (JSC::CTI::compileOpCall):
2497 (JSC::CTI::privateCompileMainPass):
2499 2008-09-23 Alp Toker <alp@nuanti.com>
2505 2008-09-23 Geoffrey Garen <ggaren@apple.com>
2507 Reviewed by Darin Adler.
2509 * wtf/Platform.h: Removed duplicate #if.
2511 2008-09-23 Geoffrey Garen <ggaren@apple.com>
2513 Reviewed by Darin Adler.
2515 Changed the layout of the call frame from
2517 { header, parameters, locals | constants, temporaries }
2521 { parameters, header | locals, constants, temporaries }
2523 This simplifies function entry+exit, and enables a number of future
2526 13.5% speedup on empty call benchmark for bytecode; 23.6% speedup on
2527 empty call benchmark for CTI.
2529 SunSpider says no change. SunSpider --v8 says 1% faster.
2533 Added a bit of abstraction for calculating whether a register is a
2534 constant, since this patch changes that calculation:
2535 (JSC::CTI::isConstant):
2536 (JSC::CTI::getConstant):
2537 (JSC::CTI::emitGetArg):
2538 (JSC::CTI::emitGetPutArg):
2539 (JSC::CTI::getConstantImmediateNumericArg):
2541 Updated for changes to callframe header location:
2542 (JSC::CTI::emitPutToCallFrameHeader):
2543 (JSC::CTI::emitGetFromCallFrameHeader):
2544 (JSC::CTI::printOpcodeOperandTypes):
2546 Renamed to spite Oliver:
2547 (JSC::CTI::emitInitRegister):
2549 Added an abstraction for emitting a call through a register, so that
2550 calls through registers generate exception info, too:
2551 (JSC::CTI::emitCall):
2553 Updated to match the new callframe header layout, and to support calls
2554 through registers, which have no destination address:
2555 (JSC::CTI::compileOpCall):
2556 (JSC::CTI::privateCompileMainPass):
2557 (JSC::CTI::privateCompileSlowCases):
2558 (JSC::CTI::privateCompile):
2563 (JSC::CallRecord::CallRecord):
2567 Updated for new register layout:
2568 (JSC::registerName):
2569 (JSC::CodeBlock::dump):
2573 Updated CodeBlock to track slightly different information about the
2574 register frame, and tweaked the style of an ASSERT_NOT_REACHED.
2575 (JSC::CodeBlock::CodeBlock):
2576 (JSC::CodeBlock::getStubInfo):
2578 * VM/CodeGenerator.cpp:
2580 Added some abstraction around constant register allocation, since this
2581 patch changes it, changed codegen to account for the new callframe
2582 layout, and added abstraction around register fetching code
2583 that used to assume that all local registers lived at negative indices,
2584 since vars now live at positive indices:
2585 (JSC::CodeGenerator::generate):
2586 (JSC::CodeGenerator::addVar):
2587 (JSC::CodeGenerator::addGlobalVar):
2588 (JSC::CodeGenerator::allocateConstants):
2589 (JSC::CodeGenerator::CodeGenerator):
2590 (JSC::CodeGenerator::addParameter):
2591 (JSC::CodeGenerator::registerFor):
2592 (JSC::CodeGenerator::constRegisterFor):
2593 (JSC::CodeGenerator::newRegister):
2594 (JSC::CodeGenerator::newTemporary):
2595 (JSC::CodeGenerator::highestUsedRegister):
2596 (JSC::CodeGenerator::addConstant):
2598 ASSERT that our caller referenced the registers it passed to us.
2599 Otherwise, we might overwrite them with parameters:
2600 (JSC::CodeGenerator::emitCall):
2601 (JSC::CodeGenerator::emitConstruct):
2603 * VM/CodeGenerator.h:
2605 Added some abstraction for getting a RegisterID for a given index,
2606 since the rules are a little weird:
2607 (JSC::CodeGenerator::registerFor):
2611 Utility function to transform a machine return PC to a virtual machine
2612 return VPC, for the sake of stack unwinding, since both PCs are stored
2613 in the same location now:
2616 Tweaked to account for new call frame:
2617 (JSC::Machine::initializeCallFrame):
2619 Tweaked to account for registerOffset supplied by caller:
2620 (JSC::slideRegisterWindowForCall):
2622 Tweaked to account for new register layout:
2623 (JSC::scopeChainForCall):
2624 (JSC::Machine::callEval):
2625 (JSC::Machine::dumpRegisters):
2626 (JSC::Machine::unwindCallFrame):
2627 (JSC::Machine::execute):
2629 Changed op_call and op_construct to implement the new calling convention:
2630 (JSC::Machine::privateExecute):
2632 Tweaked to account for the new register layout:
2633 (JSC::Machine::retrieveArguments):
2634 (JSC::Machine::retrieveCaller):
2635 (JSC::Machine::retrieveLastCaller):
2636 (JSC::Machine::callFrame):
2637 (JSC::Machine::getArgumentsData):
2639 Changed CTI call helpers to implement the new calling convention:
2640 (JSC::Machine::cti_op_call_JSFunction):
2641 (JSC::Machine::cti_op_call_NotJSFunction):
2642 (JSC::Machine::cti_op_ret_activation):
2643 (JSC::Machine::cti_op_ret_profiler):
2644 (JSC::Machine::cti_op_construct_JSConstruct):
2645 (JSC::Machine::cti_op_construct_NotJSConstruct):
2646 (JSC::Machine::cti_op_call_eval):
2652 Renamed op_initialise_locals to op_init, because this opcode
2653 doesn't initialize all locals, and it doesn't initialize only locals.
2654 Also, to spite Oliver.
2656 * VM/RegisterFile.h:
2658 New call frame enumeration values:
2659 (JSC::RegisterFile::):
2661 Simplified the calculation of whether a RegisterID is a temporary,
2662 since we can no longer assume that all positive non-constant registers
2665 (JSC::RegisterID::RegisterID):
2666 (JSC::RegisterID::setTemporary):
2667 (JSC::RegisterID::isTemporary):
2669 Renamed firstArgumentIndex to firstParameterIndex because the assumption
2670 that this variable pertained to the actual arguments supplied by the
2671 caller caused me to write some buggy code:
2672 * kjs/Arguments.cpp:
2673 (JSC::ArgumentsData::ArgumentsData):
2674 (JSC::Arguments::Arguments):
2675 (JSC::Arguments::fillArgList):
2676 (JSC::Arguments::getOwnPropertySlot):
2677 (JSC::Arguments::put):
2679 Updated for new call frame layout:
2680 * kjs/DebuggerCallFrame.cpp:
2681 (JSC::DebuggerCallFrame::functionName):
2682 (JSC::DebuggerCallFrame::type):
2683 * kjs/DebuggerCallFrame.h:
2685 Changed the activation object to account for the fact that a call frame
2686 header now sits between parameters and local variables. This change
2687 requires all variable objects to do their own marking, since they
2688 now use their register storage differently:
2689 * kjs/JSActivation.cpp:
2690 (JSC::JSActivation::mark):
2691 (JSC::JSActivation::copyRegisters):
2692 (JSC::JSActivation::createArgumentsObject):
2693 * kjs/JSActivation.h:
2695 Updated global object to use the new interfaces required by the change
2696 to JSActivation above:
2697 * kjs/JSGlobalObject.cpp:
2698 (JSC::JSGlobalObject::reset):
2699 (JSC::JSGlobalObject::mark):
2700 (JSC::JSGlobalObject::copyGlobalsFrom):
2701 (JSC::JSGlobalObject::copyGlobalsTo):
2702 * kjs/JSGlobalObject.h:
2703 (JSC::JSGlobalObject::addStaticGlobals):
2705 Updated static scope object to use the new interfaces required by the
2706 change to JSActivation above:
2707 * kjs/JSStaticScopeObject.cpp:
2708 (JSC::JSStaticScopeObject::mark):
2709 (JSC::JSStaticScopeObject::~JSStaticScopeObject):
2710 * kjs/JSStaticScopeObject.h:
2711 (JSC::JSStaticScopeObject::JSStaticScopeObject):
2712 (JSC::JSStaticScopeObject::d):
2714 Updated variable object to use the new interfaces required by the
2715 change to JSActivation above:
2716 * kjs/JSVariableObject.cpp:
2717 (JSC::JSVariableObject::copyRegisterArray):
2718 (JSC::JSVariableObject::setRegisters):
2719 * kjs/JSVariableObject.h:
2721 Changed the bit twiddling in symbol table not to assume that all indices
2722 are negative, since they can be positive now:
2723 * kjs/SymbolTable.h:
2724 (JSC::SymbolTableEntry::SymbolTableEntry):
2725 (JSC::SymbolTableEntry::isNull):
2726 (JSC::SymbolTableEntry::getIndex):
2727 (JSC::SymbolTableEntry::getAttributes):
2728 (JSC::SymbolTableEntry::setAttributes):
2729 (JSC::SymbolTableEntry::isReadOnly):
2730 (JSC::SymbolTableEntry::pack):
2731 (JSC::SymbolTableEntry::isValidIndex):
2733 Changed call and construct nodes to ref their functions and/or bases,
2734 so that emitCall/emitConstruct doesn't overwrite them with parameters.
2735 Also, updated for rename to registerFor:
2737 (JSC::ResolveNode::emitCode):
2738 (JSC::NewExprNode::emitCode):
2739 (JSC::EvalFunctionCallNode::emitCode):
2740 (JSC::FunctionCallValueNode::emitCode):
2741 (JSC::FunctionCallResolveNode::emitCode):
2742 (JSC::FunctionCallBracketNode::emitCode):
2743 (JSC::FunctionCallDotNode::emitCode):
2744 (JSC::PostfixResolveNode::emitCode):
2745 (JSC::DeleteResolveNode::emitCode):
2746 (JSC::TypeOfResolveNode::emitCode):
2747 (JSC::PrefixResolveNode::emitCode):
2748 (JSC::ReadModifyResolveNode::emitCode):
2749 (JSC::AssignResolveNode::emitCode):
2750 (JSC::ConstDeclNode::emitCodeSingle):
2751 (JSC::ForInNode::emitCode):
2753 Added abstraction for getting exception info out of a call through a
2755 * masm/X86Assembler.h:
2756 (JSC::X86Assembler::emitCall):
2758 Removed duplicate #if:
2761 2008-09-23 Kevin McCullough <kmccullough@apple.com>
2765 Bug 21030: The JS debugger breaks on the do of a do-while not the while
2766 (where the conditional statement is)
2767 https://bugs.webkit.org/show_bug.cgi?id=21030
2768 Now the statementListEmitCode detects if a do-while node is being
2769 emited and emits the debug hook on the last line instead of the first.
2771 This change had no effect on sunspider.
2774 (JSC::statementListEmitCode):
2776 (JSC::StatementNode::isDoWhile):
2777 (JSC::DoWhileNode::isDoWhile):
2779 2008-09-23 Maciej Stachowiak <mjs@apple.com>
2781 Reviewed by Camron Zwarich.
2783 - inline the fast case of instanceof
2784 https://bugs.webkit.org/show_bug.cgi?id=20818
2786 ~2% speedup on EarleyBoyer test.
2789 (JSC::CTI::privateCompileMainPass):
2790 (JSC::CTI::privateCompileSlowCases):
2792 (JSC::Machine::cti_op_instanceof):
2794 2008-09-23 Maciej Stachowiak <mjs@apple.com>
2796 Reviewed by Cameron Zwarich.
2798 - add forgotten slow case logic for !==
2801 (JSC::CTI::privateCompileSlowCases):
2803 2008-09-23 Maciej Stachowiak <mjs@apple.com>
2805 Reviewed by Cameron Zwarich.
2807 - inline the fast cases of !==, same as for ===
2809 2.9% speedup on EarleyBoyer benchmark
2812 (JSC::CTI::compileOpStrictEq): Factored stricteq codegen into this function,
2813 and parameterized so it can do the reverse version as well.
2814 (JSC::CTI::privateCompileMainPass): Use the above for stricteq and nstricteq.
2816 (JSC::CTI::): Declare above stuff.
2818 (JSC::Machine::cti_op_nstricteq): Removed fast cases, now handled inline.
2820 2008-09-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2822 Reviewed by Oliver Hunt.
2824 Bug 20989: Aguments constructor should put 'callee' and 'length' properties in a more efficient way
2825 <https://bugs.webkit.org/show_bug.cgi?id=20989>
2827 Make special cases for the 'callee' and 'length' properties in the
2830 This is somewhere between a 7.8% speedup and a 10% speedup on the V8
2831 Raytrace benchmark, depending on whether it is run alone or with the
2832 other V8 benchmarks.
2834 * kjs/Arguments.cpp:
2835 (JSC::ArgumentsData::ArgumentsData):
2836 (JSC::Arguments::Arguments):
2837 (JSC::Arguments::mark):
2838 (JSC::Arguments::getOwnPropertySlot):
2839 (JSC::Arguments::put):
2840 (JSC::Arguments::deleteProperty):
2842 2008-09-23 Maciej Stachowiak <mjs@apple.com>
2846 - speed up instanceof some more
2847 https://bugs.webkit.org/show_bug.cgi?id=20818
2849 ~2% speedup on EarleyBoyer
2851 The idea here is to record in the StructureID whether the class
2852 needs a special hasInstance or if it can use the normal logic from
2855 Based on this I inlined the real work directly into
2856 cti_op_instanceof and put the fastest checks up front and the
2857 error handling at the end (so it should be fairly straightforward
2858 to split off the beginning to be inlined if desired).
2860 I only did this for CTI, not the bytecode interpreter.
2862 * API/JSCallbackObject.h:
2863 (JSC::JSCallbackObject::createStructureID):
2866 (JSC::Machine::cti_op_instanceof):
2867 * kjs/JSImmediate.h:
2868 (JSC::JSImmediate::isAnyImmediate):
2870 (JSC::TypeInfo::overridesHasInstance):
2871 (JSC::TypeInfo::flags):
2873 2008-09-22 Darin Adler <darin@apple.com>
2875 Reviewed by Sam Weinig.
2877 - https://bugs.webkit.org/show_bug.cgi?id=21019
2878 make FunctionBodyNode::ref/deref fast
2880 Speeds up v8-raytrace by 7.2%.
2883 (JSC::FunctionBodyNode::FunctionBodyNode): Initialize m_refCount to 0.
2885 (JSC::FunctionBodyNode::ref): Call base class ref once, and thereafter use
2887 (JSC::FunctionBodyNode::deref): Ditto, but the deref side.
2889 2008-09-22 Darin Adler <darin@apple.com>
2891 Pointed out by Sam Weinig.
2893 * kjs/Arguments.cpp:
2894 (JSC::Arguments::fillArgList): Fix bad copy and paste. Oops!
2896 2008-09-22 Darin Adler <darin@apple.com>
2898 Reviewed by Cameron Zwarich.
2900 - https://bugs.webkit.org/show_bug.cgi?id=20983
2901 ArgumentsData should have some room to allocate some extra arguments inline
2903 Speeds up v8-raytrace by 5%.
2905 * kjs/Arguments.cpp:
2906 (JSC::ArgumentsData::ArgumentsData): Use a fixed buffer if there are 4 or fewer
2908 (JSC::Arguments::Arguments): Use a fixed buffer if there are 4 or fewer
2910 (JSC::Arguments::~Arguments): Delete the buffer if necessary.
2911 (JSC::Arguments::mark): Update since extraArguments are now Register.
2912 (JSC::Arguments::fillArgList): Added special case for the only case that's
2913 actually used in the practice, when there are no parameters. There are some
2914 other special cases in there too, but that's the only one that matters.
2915 (JSC::Arguments::getOwnPropertySlot): Updated to use setValueSlot since there's
2916 no operation to get you at the JSValue* inside a Register as a "slot".
2918 2008-09-22 Sam Weinig <sam@webkit.org>
2920 Reviewed by Maciej Stachowiak.
2922 Patch for https://bugs.webkit.org/show_bug.cgi?id=21014
2923 Speed up for..in by using StructureID to avoid calls to hasProperty
2925 Speeds up fasta by 8%.
2927 * VM/JSPropertyNameIterator.cpp:
2928 (JSC::JSPropertyNameIterator::invalidate):
2929 * VM/JSPropertyNameIterator.h:
2930 (JSC::JSPropertyNameIterator::next):
2931 * kjs/PropertyNameArray.h:
2932 (JSC::PropertyNameArrayData::begin):
2933 (JSC::PropertyNameArrayData::end):
2934 (JSC::PropertyNameArrayData::setCachedStructureID):
2935 (JSC::PropertyNameArrayData::cachedStructureID):
2936 * kjs/StructureID.cpp:
2937 (JSC::StructureID::getEnumerablePropertyNames):
2938 (JSC::structureIDChainsAreEqual):
2939 * kjs/StructureID.h:
2941 2008-09-22 Kelvin Sherlock <ksherlock@gmail.com>
2943 Updated and tweaked by Sam Weinig.
2945 Reviewed by Geoffrey Garen.
2947 Bug 20020: Proposed enhancement to JavaScriptCore API
2948 <https://bugs.webkit.org/show_bug.cgi?id=20020>
2950 Add JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError, and JSObjectMakeRegExp
2951 functions to create JavaScript Array, Date, Error, and RegExp objects, respectively.
2953 * API/JSObjectRef.cpp: The functions
2954 * API/JSObjectRef.h: Function prototype and documentation
2955 * JavaScriptCore.exp: Added functions to exported function list
2956 * API/tests/testapi.c: Added basic functionality tests.
2958 * kjs/DateConstructor.cpp:
2959 Replaced static JSObject* constructDate(ExecState* exec, JSObject*, const ArgList& args)
2960 with JSObject* constructDate(ExecState* exec, const ArgList& args).
2961 Added static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) function
2963 * kjs/DateConstructor.h:
2964 added prototype for JSObject* constructDate(ExecState* exec, const ArgList& args)
2966 * kjs/ErrorConstructor.cpp:
2967 removed static qualifier from ErrorInstance* constructError(ExecState* exec, const ArgList& args)
2969 * kjs/ErrorConstructor.h:
2970 added prototype for ErrorInstance* constructError(ExecState* exec, const ArgList& args)
2972 * kjs/RegExpConstructor.cpp:
2973 removed static qualifier from JSObject* constructRegExp(ExecState* exec, const ArgList& args)
2975 * kjs/RegExpConstructor.h:
2976 added prototype for JSObject* constructRegExp(ExecState* exec, const ArgList& args)
2978 2008-09-22 Matt Lilek <webkit@mattlilek.com>
2980 Not reviewed, Windows build fix.
2982 * kjs/Arguments.cpp:
2983 * kjs/FunctionPrototype.cpp:
2985 2008-09-22 Sam Weinig <sam@webkit.org>
2987 Reviewed by Darin Adler.
2989 Patch for https://bugs.webkit.org/show_bug.cgi?id=20982
2990 Speed up the apply method of functions by special-casing array and 'arguments' objects
2992 1% speedup on v8-raytrace.
2994 Test: fast/js/function-apply.html
2996 * kjs/Arguments.cpp:
2997 (JSC::Arguments::fillArgList):
2999 * kjs/FunctionPrototype.cpp:
3000 (JSC::functionProtoFuncApply):
3002 (JSC::JSArray::fillArgList):
3005 2008-09-22 Darin Adler <darin@apple.com>
3007 Reviewed by Sam Weinig.
3009 - https://bugs.webkit.org/show_bug.cgi?id=20993
3010 Array.push/pop need optimized cases for JSArray
3012 3% or so speedup on DeltaBlue benchmark.
3014 * kjs/ArrayPrototype.cpp:
3015 (JSC::arrayProtoFuncPop): Call JSArray::pop when appropriate.
3016 (JSC::arrayProtoFuncPush): Call JSArray::push when appropriate.
3019 (JSC::JSArray::putSlowCase): Set m_fastAccessCutoff when appropriate, getting
3020 us into the fast code path.
3021 (JSC::JSArray::pop): Added.
3022 (JSC::JSArray::push): Added.
3023 * kjs/JSArray.h: Added push and pop.
3025 * kjs/operations.cpp:
3026 (JSC::throwOutOfMemoryError): Don't inline this. Helps us avoid PIC branches.
3028 2008-09-22 Maciej Stachowiak <mjs@apple.com>
3030 Reviewed by Cameron Zwarich.
3032 - speed up instanceof operator by replacing implementsHasInstance method with a TypeInfo flag
3034 Partial work towards <https://bugs.webkit.org/show_bug.cgi?id=20818>
3036 2.2% speedup on EarleyBoyer benchmark.
3038 * API/JSCallbackConstructor.cpp:
3039 * API/JSCallbackConstructor.h:
3040 (JSC::JSCallbackConstructor::createStructureID):
3041 * API/JSCallbackFunction.cpp:
3042 * API/JSCallbackFunction.h:
3043 (JSC::JSCallbackFunction::createStructureID):
3044 * API/JSCallbackObject.h:
3045 (JSC::JSCallbackObject::createStructureID):
3046 * API/JSCallbackObjectFunctions.h:
3047 (JSC::::hasInstance):
3048 * API/JSValueRef.cpp:
3049 (JSValueIsInstanceOfConstructor):
3050 * JavaScriptCore.exp:
3052 (JSC::Machine::privateExecute):
3053 (JSC::Machine::cti_op_instanceof):
3054 * kjs/InternalFunction.cpp:
3055 * kjs/InternalFunction.h:
3056 (JSC::InternalFunction::createStructureID):
3060 (JSC::TypeInfo::implementsHasInstance):
3062 2008-09-22 Maciej Stachowiak <mjs@apple.com>
3064 Reviewed by Dave Hyatt.
3066 Based on initial work by Darin Adler.
3068 - replace masqueradesAsUndefined virtual method with a flag in TypeInfo
3069 - use this to JIT inline code for eq_null and neq_null
3070 https://bugs.webkit.org/show_bug.cgi?id=20823
3072 0.5% speedup on SunSpider
3073 ~4% speedup on Richards benchmark
3076 (JSC::CTI::privateCompileMainPass):
3078 (JSC::jsTypeStringForValue):
3079 (JSC::jsIsObjectType):
3080 (JSC::Machine::privateExecute):
3081 (JSC::Machine::cti_op_is_undefined):
3085 * kjs/StringObjectThatMasqueradesAsUndefined.h:
3086 (JSC::StringObjectThatMasqueradesAsUndefined::create):
3087 (JSC::StringObjectThatMasqueradesAsUndefined::createStructureID):
3088 * kjs/StructureID.h:
3089 (JSC::StructureID::mutableTypeInfo):
3091 (JSC::TypeInfo::TypeInfo):
3092 (JSC::TypeInfo::masqueradesAsUndefined):
3093 * kjs/operations.cpp:
3095 * masm/X86Assembler.h:
3096 (JSC::X86Assembler::):
3097 (JSC::X86Assembler::setne_r):
3098 (JSC::X86Assembler::setnz_r):
3099 (JSC::X86Assembler::testl_i32m):
3101 2008-09-22 Tor Arne Vestbø <tavestbo@trolltech.com>
3105 Initialize QCoreApplication in kjs binary/Shell.cpp
3107 This allows us to use QCoreApplication::instance() to
3108 get the main thread in ThreadingQt.cpp
3112 * wtf/ThreadingQt.cpp:
3113 (WTF::initializeThreading):
3115 2008-09-21 Darin Adler <darin@apple.com>
3117 - blind attempt to fix non-all-in-one builds
3119 * kjs/JSGlobalObject.cpp: Added includes of Arguments.h and RegExpObject.h.
3121 2008-09-21 Darin Adler <darin@apple.com>
3125 * kjs/StructureID.cpp:
3126 (JSC::StructureID::addPropertyTransition): Use typeInfo().type() instead of m_type.
3127 (JSC::StructureID::createCachedPrototypeChain): Ditto.
3129 2008-09-21 Maciej Stachowiak <mjs@apple.com>
3131 Reviewed by Darin Adler.
3133 - introduce a TypeInfo class, for holding per-type (in the C++ class sense) date in StructureID
3134 https://bugs.webkit.org/show_bug.cgi?id=20981
3136 * JavaScriptCore.exp:
3137 * JavaScriptCore.xcodeproj/project.pbxproj:
3139 (JSC::CTI::privateCompileMainPass):
3140 (JSC::CTI::privateCompilePutByIdTransition):
3142 (JSC::jsIsObjectType):
3143 (JSC::Machine::Machine):
3144 * kjs/AllInOneFile.cpp:
3146 (JSC::JSCell::isObject):
3147 (JSC::JSCell::isString):
3148 * kjs/JSGlobalData.cpp:
3149 (JSC::JSGlobalData::JSGlobalData):
3150 * kjs/JSGlobalObject.cpp:
3151 (JSC::JSGlobalObject::reset):
3152 * kjs/JSGlobalObject.h:
3153 (JSC::StructureID::prototypeForLookup):
3154 * kjs/JSNumberCell.h:
3155 (JSC::JSNumberCell::createStructureID):
3157 (JSC::JSObject::createInheritorID):
3159 (JSC::JSObject::createStructureID):
3161 (JSC::JSString::createStructureID):
3162 * kjs/NativeErrorConstructor.cpp:
3163 (JSC::NativeErrorConstructor::NativeErrorConstructor):
3164 * kjs/RegExpConstructor.cpp:
3165 * kjs/RegExpMatchesArray.h: Added.
3166 (JSC::RegExpMatchesArray::getOwnPropertySlot):
3167 (JSC::RegExpMatchesArray::put):
3168 (JSC::RegExpMatchesArray::deleteProperty):
3169 (JSC::RegExpMatchesArray::getPropertyNames):
3170 * kjs/StructureID.cpp:
3171 (JSC::StructureID::StructureID):
3172 (JSC::StructureID::addPropertyTransition):
3173 (JSC::StructureID::toDictionaryTransition):
3174 (JSC::StructureID::changePrototypeTransition):
3175 (JSC::StructureID::getterSetterTransition):
3176 * kjs/StructureID.h:
3177 (JSC::StructureID::create):
3178 (JSC::StructureID::typeInfo):
3179 * kjs/TypeInfo.h: Added.
3180 (JSC::TypeInfo::TypeInfo):
3181 (JSC::TypeInfo::type):
3183 2008-09-21 Darin Adler <darin@apple.com>
3185 Reviewed by Cameron Zwarich.
3187 - fix crash logging into Gmail due to recent Arguments change
3189 * kjs/Arguments.cpp:
3190 (JSC::Arguments::Arguments): Fix window where mark() function could
3191 see d->extraArguments with uninitialized contents.
3192 (JSC::Arguments::mark): Check d->extraArguments for 0 to handle two
3193 cases: 1) Inside the constructor before it's initialized.
3194 2) numArguments <= numParameters.
3196 2008-09-21 Darin Adler <darin@apple.com>
3198 - fix loose end from the "duplicate constant values" patch
3200 * VM/CodeGenerator.cpp:
3201 (JSC::CodeGenerator::emitLoad): Add a special case for values the
3202 hash table can't handle.
3204 2008-09-21 Mark Rowe <mrowe@apple.com>
3206 Fix the non-AllInOneFile build.
3208 * kjs/Arguments.cpp: Add missing #include.
3210 2008-09-21 Darin Adler <darin@apple.com>
3212 Reviewed by Cameron Zwarich and Mark Rowe.
3214 - fix test failure caused by my recent IndexToNameMap patch
3216 * kjs/Arguments.cpp:
3217 (JSC::Arguments::deleteProperty): Added the accidentally-omitted
3218 check of the boolean result from toArrayIndex.
3220 2008-09-21 Darin Adler <darin@apple.com>
3222 Reviewed by Maciej Stachowiak.
3224 - https://bugs.webkit.org/show_bug.cgi?id=20975
3225 inline immediate-number case of ==
3227 * VM/CTI.h: Renamed emitJumpSlowCaseIfNotImm to
3228 emitJumpSlowCaseIfNotImmNum, since the old name was incorrect.
3230 * VM/CTI.cpp: Updated for new name.
3231 (JSC::CTI::privateCompileMainPass): Added op_eq.
3232 (JSC::CTI::privateCompileSlowCases): Added op_eq.
3235 (JSC::Machine::cti_op_eq): Removed fast case, since it's now
3238 2008-09-21 Peter Gal <galpter@inf.u-szeged.hu>
3240 Reviewed by Tim Hatcher and Eric Seidel.
3242 Fix the QT/Linux JavaScriptCore segmentation fault.
3243 https://bugs.webkit.org/show_bug.cgi?id=20914
3245 * wtf/ThreadingQt.cpp:
3246 (WTF::initializeThreading): Use currentThread() if
3247 platform is not a MAC (like in pre 36541 revisions)
3249 2008-09-21 Darin Adler <darin@apple.com>
3251 Reviewed by Sam Weinig.
3253 * kjs/debugger.h: Removed some unneeded includes and declarations.
3255 2008-09-21 Darin Adler <darin@apple.com>
3257 Reviewed by Sam Weinig.
3259 - https://bugs.webkit.org/show_bug.cgi?id=20972
3260 speed up Arguments further by eliminating the IndexToNameMap
3262 No change on SunSpider. 1.29x as fast on V8 Raytrace.
3264 * kjs/Arguments.cpp: Moved ArgumentsData in here. Eliminated the
3265 indexToNameMap and hadDeletes data members. Changed extraArguments into
3266 an OwnArrayPtr and added deletedArguments, another OwnArrayPtr.
3267 Replaced numExtraArguments with numParameters, since that's what's
3268 used more directly in hot code paths.
3269 (JSC::Arguments::Arguments): Pass in argument count instead of ArgList.
3270 Initialize ArgumentsData the new way.
3271 (JSC::Arguments::mark): Updated.
3272 (JSC::Arguments::getOwnPropertySlot): Overload for the integer form so
3273 we don't have to convert integers to identifiers just to get an argument.
3274 Integrated the deleted case with the fast case.
3275 (JSC::Arguments::put): Ditto.
3276 (JSC::Arguments::deleteProperty): Ditto.
3278 * kjs/Arguments.h: Minimized includes. Made everything private. Added
3279 overloads for the integral property name case. Eliminated mappedIndexSetter.
3280 Moved ArgumentsData into the .cpp file.
3282 * kjs/IndexToNameMap.cpp: Emptied out and prepared for deletion.
3283 * kjs/IndexToNameMap.h: Ditto.
3285 * kjs/JSActivation.cpp:
3286 (JSC::JSActivation::createArgumentsObject): Elminated ArgList.
3289 * JavaScriptCore.pri:
3290 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3291 * JavaScriptCore.xcodeproj/project.pbxproj:
3292 * JavaScriptCoreSources.bkl:
3293 * kjs/AllInOneFile.cpp:
3294 Removed IndexToNameMap.
3296 2008-09-21 Darin Adler <darin@apple.com>
3298 * VM/CodeGenerator.cpp:
3299 (JSC::CodeGenerator::emitLoad): One more tweak: Wrote this in a slightly
3302 2008-09-21 Judit Jasz <jasy@inf.u-szeged.hu>
3304 Reviewed and tweaked by Darin Adler.
3306 - https://bugs.webkit.org/show_bug.cgi?id=20645
3307 Elminate duplicate constant values in CodeBlocks.
3309 Seems to be a wash on SunSpider.
3311 * VM/CodeGenerator.cpp:
3312 (JSC::CodeGenerator::emitLoad): Use m_numberMap and m_stringMap to guarantee
3313 we emit the same JSValue* for identical numbers and strings.
3314 * VM/CodeGenerator.h: Added overload of emitLoad for const Identifier&.
3315 Add NumberMap and IdentifierStringMap types and m_numberMap and m_stringMap.
3317 (JSC::StringNode::emitCode): Call the new emitLoad and let it do the
3320 2008-09-21 Paul Pedriana <webkit@pedriana.com>
3322 Reviewed and tweaked by Darin Adler.
3324 - https://bugs.webkit.org/show_bug.cgi?id=16925
3325 Fixed lack of Vector buffer alignment for both GCC and MSVC.
3326 Since there's no portable way to do this, for now we don't support
3329 * wtf/Vector.h: Added WTF_ALIGH_ON, WTF_ALIGNED, AlignedBufferChar, and AlignedBuffer.
3330 Use AlignedBuffer insteadof an array of char in VectorBuffer.
3332 2008-09-21 Gabor Loki <loki@inf.u-szeged.hu>
3334 Reviewed by Darin Adler.
3336 - https://bugs.webkit.org/show_bug.cgi?id=19408
3337 Add lightweight constant folding to the parser for *, /, + (only for numbers), <<, >>, ~ operators.
3339 1.008x as fast on SunSpider.
3342 (makeNegateNode): Fold if expression is a number > 0.
3343 (makeBitwiseNotNode): Fold if expression is a number.
3344 (makeMultNode): Fold if expressions are both numbers.
3345 (makeDivNode): Fold if expressions are both numbers.
3346 (makeAddNode): Fold if expressions are both numbers.
3347 (makeLeftShiftNode): Fold if expressions are both numbers.
3348 (makeRightShiftNode): Fold if expressions are both numbers.
3350 2008-09-21 Maciej Stachowiak <mjs@apple.com>
3354 - speed up === operator by generating inline machine code for the fast paths
3355 https://bugs.webkit.org/show_bug.cgi?id=20820
3358 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumber):
3359 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumbers):
3360 (JSC::CTI::emitJumpSlowCaseIfNotImmediates):
3361 (JSC::CTI::emitTagAsBoolImmediate):
3362 (JSC::CTI::privateCompileMainPass):
3363 (JSC::CTI::privateCompileSlowCases):
3366 (JSC::Machine::cti_op_stricteq):
3367 * masm/X86Assembler.h:
3368 (JSC::X86Assembler::):
3369 (JSC::X86Assembler::sete_r):
3370 (JSC::X86Assembler::setz_r):
3371 (JSC::X86Assembler::movzbl_rr):
3372 (JSC::X86Assembler::emitUnlinkedJnz):
3374 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3376 Reviewed by Maciej Stachowiak.
3378 Free memory allocated for extra arguments in the destructor of the
3381 * kjs/Arguments.cpp:
3382 (JSC::Arguments::~Arguments):
3385 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3387 Reviewed by Maciej Stachowiak.
3389 Bug 20815: 'arguments' object creation is non-optimal
3390 <https://bugs.webkit.org/show_bug.cgi?id=20815>
3392 Fix our inefficient way of creating the arguments object by only
3393 creating named properties for each of the arguments after a use of the
3394 'delete' statement. This patch also speeds up access to the 'arguments'
3395 object slightly, but it still does not use the array fast path for
3396 indexed access that exists for many opcodes.
3398 This is about a 20% improvement on the V8 Raytrace benchmark, and a 1.5%
3399 improvement on the Earley-Boyer benchmark, which gives a 4% improvement
3402 * kjs/Arguments.cpp:
3403 (JSC::Arguments::Arguments):
3404 (JSC::Arguments::mark):
3405 (JSC::Arguments::getOwnPropertySlot):
3406 (JSC::Arguments::put):
3407 (JSC::Arguments::deleteProperty):
3409 (JSC::Arguments::ArgumentsData::ArgumentsData):
3410 * kjs/IndexToNameMap.h:
3411 (JSC::IndexToNameMap::size):
3412 * kjs/JSActivation.cpp:
3413 (JSC::JSActivation::createArgumentsObject):
3414 * kjs/JSActivation.h:
3415 (JSC::JSActivation::uncheckedSymbolTableGet):
3416 (JSC::JSActivation::uncheckedSymbolTableGetValue):
3417 (JSC::JSActivation::uncheckedSymbolTablePut):
3419 (JSC::JSFunction::numParameters):
3421 2008-09-20 Darin Adler <darin@apple.com>
3423 Reviewed by Mark Rowe.
3425 - fix crash seen on buildbot
3427 * kjs/JSGlobalObject.cpp:
3428 (JSC::JSGlobalObject::mark): Add back mark of arrayPrototype,
3429 deleted by accident in my recent check-in.
3431 2008-09-20 Maciej Stachowiak <mjs@apple.com>
3433 Not reviewed, build fix.
3435 - speculative fix for non-AllInOne builds
3439 2008-09-20 Maciej Stachowiak <mjs@apple.com>
3441 Reviewed by Darin Adler.
3443 - assorted optimizations to === and !== operators
3444 (work towards <https://bugs.webkit.org/show_bug.cgi?id=20820>)
3446 2.5% speedup on earley-boyer test
3449 (JSC::Machine::cti_op_stricteq): Use inline version of
3450 strictEqualSlowCase; remove unneeded exception check.
3451 (JSC::Machine::cti_op_nstricteq): ditto
3452 * kjs/operations.cpp:
3453 (JSC::strictEqual): Use strictEqualSlowCaseInline
3454 (JSC::strictEqualSlowCase): ditto
3456 (JSC::strictEqualSlowCaseInline): Version of strictEqualSlowCase that can be inlined,
3457 since the extra function call indirection is a lose for CTI.
3459 2008-09-20 Darin Adler <darin@apple.com>
3461 Reviewed by Maciej Stachowiak.
3463 - finish https://bugs.webkit.org/show_bug.cgi?id=20858
3464 make each distinct C++ class get a distinct JSC::Structure
3466 This also includes some optimizations that make the change an overall
3467 small speedup. Without those it was a bit of a slowdown.
3469 * API/JSCallbackConstructor.cpp:
3470 (JSC::JSCallbackConstructor::JSCallbackConstructor): Take a structure.
3471 * API/JSCallbackConstructor.h: Ditto.
3472 * API/JSCallbackFunction.cpp:
3473 (JSC::JSCallbackFunction::JSCallbackFunction): Pass a structure.
3474 * API/JSCallbackObject.h: Take a structure.
3475 * API/JSCallbackObjectFunctions.h:
3476 (JSC::JSCallbackObject::JSCallbackObject): Ditto.
3478 * API/JSClassRef.cpp:
3479 (OpaqueJSClass::prototype): Pass in a structure. Call setPrototype
3480 if there's a custom prototype involved.
3481 * API/JSObjectRef.cpp:
3482 (JSObjectMake): Ditto.
3483 (JSObjectMakeConstructor): Pass in a structure.
3485 * JavaScriptCore.exp: Updated.
3488 (JSC::jsLess): Added a special case for when both arguments are strings.
3489 This avoids converting both strings to with UString::toDouble.
3490 (JSC::jsLessEq): Ditto.
3491 (JSC::Machine::privateExecute): Pass in a structure.
3492 (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
3493 (JSC::Machine::cti_op_new_regexp): Ditto.
3494 (JSC::Machine::cti_op_is_string): Ditto.
3495 * VM/Machine.h: Made isJSString public so it can be used in the CTI.
3497 * kjs/Arguments.cpp:
3498 (JSC::Arguments::Arguments): Pass in a structure.
3500 * kjs/JSCell.h: Mark constructor explicit.
3502 * kjs/JSGlobalObject.cpp:
3503 (JSC::markIfNeeded): Added an overload for marking structures.
3504 (JSC::JSGlobalObject::reset): Eliminate code to set data members to
3505 zero. We now do that in the constructor, and we no longer use this
3506 anywhere except in the constructor. Added code to create structures.
3507 Pass structures rather than prototypes when creating objects.
3508 (JSC::JSGlobalObject::mark): Mark the structures.
3510 * kjs/JSGlobalObject.h: Removed unneeded class declarations.
3511 Added initializers for raw pointers in JSGlobalObjectData so
3512 everything starts with a 0. Added structure data and accessor
3515 * kjs/JSImmediate.cpp:
3516 (JSC::JSImmediate::nonInlineNaN): Added.
3517 * kjs/JSImmediate.h:
3518 (JSC::JSImmediate::toDouble): Rewrote to avoid PIC branches.
3520 * kjs/JSNumberCell.cpp:
3521 (JSC::jsNumberCell): Made non-inline to avoid PIC branches
3522 in functions that call this one.
3523 (JSC::jsNaN): Ditto.
3524 * kjs/JSNumberCell.h: Ditto.
3526 * kjs/JSObject.h: Removed constructor that takes a prototype.
3527 All callers now pass structures.
3529 * kjs/ArrayConstructor.cpp:
3530 (JSC::ArrayConstructor::ArrayConstructor):
3531 (JSC::constructArrayWithSizeQuirk):
3532 * kjs/ArrayConstructor.h:
3533 * kjs/ArrayPrototype.cpp:
3534 (JSC::ArrayPrototype::ArrayPrototype):
3535 * kjs/ArrayPrototype.h:
3536 * kjs/BooleanConstructor.cpp:
3537 (JSC::BooleanConstructor::BooleanConstructor):
3538 (JSC::constructBoolean):
3539 (JSC::constructBooleanFromImmediateBoolean):
3540 * kjs/BooleanConstructor.h:
3541 * kjs/BooleanObject.cpp:
3542 (JSC::BooleanObject::BooleanObject):
3543 * kjs/BooleanObject.h:
3544 * kjs/BooleanPrototype.cpp:
3545 (JSC::BooleanPrototype::BooleanPrototype):
3546 * kjs/BooleanPrototype.h:
3547 * kjs/DateConstructor.cpp:
3548 (JSC::DateConstructor::DateConstructor):
3549 (JSC::constructDate):
3550 * kjs/DateConstructor.h:
3551 * kjs/DateInstance.cpp:
3552 (JSC::DateInstance::DateInstance):
3553 * kjs/DateInstance.h:
3554 * kjs/DatePrototype.cpp:
3555 (JSC::DatePrototype::DatePrototype):
3556 * kjs/DatePrototype.h:
3557 * kjs/ErrorConstructor.cpp:
3558 (JSC::ErrorConstructor::ErrorConstructor):
3559 (JSC::constructError):
3560 * kjs/ErrorConstructor.h:
3561 * kjs/ErrorInstance.cpp:
3562 (JSC::ErrorInstance::ErrorInstance):
3563 * kjs/ErrorInstance.h:
3564 * kjs/ErrorPrototype.cpp:
3565 (JSC::ErrorPrototype::ErrorPrototype):
3566 * kjs/ErrorPrototype.h:
3567 * kjs/FunctionConstructor.cpp:
3568 (JSC::FunctionConstructor::FunctionConstructor):
3569 * kjs/FunctionConstructor.h:
3570 * kjs/FunctionPrototype.cpp:
3571 (JSC::FunctionPrototype::FunctionPrototype):
3572 (JSC::FunctionPrototype::addFunctionProperties):