1 2008-10-02 Darin Adler <darin@apple.com>
3 Reviewed by Geoff Garen.
5 - https://bugs.webkit.org/show_bug.cgi?id=21321
6 Bug 21321: speed up JavaScriptCore by inlining Heap in JSGlobalData
8 1.019x as fast on SunSpider.
11 (JSEvaluateScript): Use heap. instead of heap-> to work with the heap.
12 (JSCheckScriptSyntax): Ditto.
13 (JSGarbageCollect): Ditto.
14 (JSReportExtraMemoryCost): Ditto.
15 * API/JSContextRef.cpp:
16 (JSGlobalContextRetain): Ditto.
17 (JSGlobalContextRelease): Destroy the heap with the destroy function instead
18 of the delete operator.
19 (JSContextGetGlobalObject): Use heap. instead of heap-> to work with the heap.
20 * API/JSObjectRef.cpp:
21 (JSObjectMake): Use heap. instead of heap-> to work with the heap.
22 (JSObjectMakeFunctionWithCallback): Ditto.
23 (JSObjectMakeConstructor): Ditto.
24 (JSObjectMakeFunction): Ditto.
25 (JSObjectMakeArray): Ditto.
26 (JSObjectMakeDate): Ditto.
27 (JSObjectMakeError): Ditto.
28 (JSObjectMakeRegExp): Ditto.
29 (JSObjectHasProperty): Ditto.
30 (JSObjectGetProperty): Ditto.
31 (JSObjectSetProperty): Ditto.
32 (JSObjectGetPropertyAtIndex): Ditto.
33 (JSObjectSetPropertyAtIndex): Ditto.
34 (JSObjectDeleteProperty): Ditto.
35 (JSObjectCallAsFunction): Ditto.
36 (JSObjectCallAsConstructor): Ditto.
37 (JSObjectCopyPropertyNames): Ditto.
38 (JSPropertyNameAccumulatorAddName): Ditto.
40 (JSValueIsEqual): Ditto.
41 (JSValueIsInstanceOfConstructor): Ditto.
42 (JSValueMakeNumber): Ditto.
43 (JSValueMakeString): Ditto.
44 (JSValueToNumber): Ditto.
45 (JSValueToStringCopy): Ditto.
46 (JSValueToObject): Ditto.
47 (JSValueProtect): Ditto.
48 (JSValueUnprotect): Ditto.
51 (JSC::ExecState::heap): Update to use the & operator.
53 * kjs/JSGlobalData.cpp:
54 (JSC::JSGlobalData::JSGlobalData): Update to initialize a heap member
55 instead of calling new to make a heap.
56 (JSC::JSGlobalData::~JSGlobalData): Destroy the heap with the destroy
57 function instead of the delete operator.
58 * kjs/JSGlobalData.h: Change from Heap* to a Heap.
59 * kjs/JSGlobalObject.cpp:
60 (JSC::JSGlobalObject::mark): Use the & operator here.
61 (JSC::JSGlobalObject::operator new): Use heap. instead of heap-> to work
64 2008-10-02 Cameron Zwarich <zwarich@apple.com>
66 Reviewed by Geoff Garen.
68 Bug 21317: Replace RegisterFile size and capacity information with Register pointers
69 <https://bugs.webkit.org/show_bug.cgi?id=21317>
71 This is a 2.3% speedup on the V8 DeltaBlue benchmark, a 3.3% speedup on
72 the V8 Raytrace benchmark, and a 1.0% speedup on SunSpider.
75 (JSC::slideRegisterWindowForCall):
76 (JSC::Machine::callEval):
77 (JSC::Machine::execute):
78 (JSC::Machine::privateExecute):
79 (JSC::Machine::cti_op_call_JSFunction):
80 (JSC::Machine::cti_op_construct_JSConstruct):
81 * VM/RegisterFile.cpp:
82 (JSC::RegisterFile::~RegisterFile):
84 (JSC::RegisterFile::RegisterFile):
85 (JSC::RegisterFile::start):
86 (JSC::RegisterFile::end):
87 (JSC::RegisterFile::size):
88 (JSC::RegisterFile::shrink):
89 (JSC::RegisterFile::grow):
90 (JSC::RegisterFile::lastGlobal):
91 (JSC::RegisterFile::markGlobals):
92 (JSC::RegisterFile::markCallFrames):
93 * kjs/JSGlobalObject.cpp:
94 (JSC::JSGlobalObject::copyGlobalsTo):
96 2008-10-02 Cameron Zwarich <zwarich@apple.com>
98 Rubber-stamped by Darin Adler.
100 Change bitwise operations introduced in r37166 to boolean operations. We
101 only use bitwise operations over boolean operations for increasing
102 performance in extremely hot code, but that does not apply to anything
107 2008-10-02 Gavin Barraclough <barraclough@apple.com>
109 Reviewed by Darin Adler.
111 Fix for bug #21232 - should reset m_isPendingDash on flush,
112 and should allow '\-' as beginning or end of a range (though
113 not to specifiy a range itself).
116 * wrec/CharacterClassConstructor.cpp:
117 (JSC::CharacterClassConstructor::put):
118 (JSC::CharacterClassConstructor::flush):
119 * wrec/CharacterClassConstructor.h:
120 (JSC::CharacterClassConstructor::flushBeforeEscapedHyphen):
122 (JSC::WRECGenerator::generateDisjunction):
123 (JSC::WRECParser::parseCharacterClass):
124 (JSC::WRECParser::parseDisjunction):
127 2008-10-02 Darin Adler <darin@apple.com>
129 Reviewed by Sam Weinig.
131 - remove the "static" from declarations in a header file, since we
132 don't want them to have internal linkage
134 * VM/Machine.h: Remove the static keyword from the constant and the
135 three inline functions that Geoff just moved here.
137 2008-10-02 Geoffrey Garen <ggaren@apple.com>
139 Reviewed by Sam Weinig.
141 Fixed https://bugs.webkit.org/show_bug.cgi?id=21283.
142 Profiler Crashes When Started
146 (JSC::makeHostCallFramePointer):
147 (JSC::isHostCallFrame):
148 (JSC::stripHostCallFrameBit): Moved some things to the header so
149 JSGlobalObject could use them.
151 * kjs/JSGlobalObject.h:
152 (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Call the
153 new makeHostCallFramePointer API, since 0 no longer indicates a host
156 2008-10-02 Alexey Proskuryakov <ap@webkit.org>
158 Reviewed by Darin Adler.
160 https://bugs.webkit.org/show_bug.cgi?id=21304
161 Stop using a static wrapper map for WebCore JS bindings
163 * kjs/JSGlobalData.cpp:
164 (JSC::JSGlobalData::JSGlobalData):
165 (JSC::JSGlobalData::~JSGlobalData):
166 (JSC::JSGlobalData::ClientData::~ClientData):
167 * kjs/JSGlobalData.h:
168 Added a client data member to JSGlobalData. WebCore will use it to store bindings-related
171 * JavaScriptCore.exp: Export virtual ClientData destructor.
173 2008-10-02 Geoffrey Garen <ggaren@apple.com>
181 2008-10-01 Geoffrey Garen <ggaren@apple.com>
183 Reviewed by Darin Adler and Cameron Zwarich.
185 Preliminary step toward dynamic recompilation: Standardized and
186 simplified the parsing interface.
188 The main goal in this patch is to make it easy to ask for a duplicate
189 compilation, and get back a duplicate result -- same source URL, same
190 debugger / profiler ID, same toString behavior, etc.
192 The basic unit of compilation and evaluation is now SourceCode, which
193 encompasses a SourceProvider, a range in that provider, and a starting
196 A SourceProvider now encompasses a source URL, and *is* a source ID,
197 since a pointer is a unique identifier.
201 (JSCheckScriptSyntax): Provide a SourceCode to the Interpreter, since
202 other APIs are no longer supported.
205 (JSC::EvalCodeCache::get): Provide a SourceCode to the Interpreter, since
206 other APIs are no longer supported.
207 (JSC::CodeBlock::CodeBlock): ASSERT something that used to be ASSERTed
208 by our caller -- this is a better bottleneck.
210 * VM/CodeGenerator.cpp:
211 (JSC::CodeGenerator::CodeGenerator): Updated for the fact that
212 FunctionBodyNode's parameters are no longer a WTF::Vector.
215 (JSC::Arguments::Arguments): ditto
217 * kjs/DebuggerCallFrame.cpp:
218 (JSC::DebuggerCallFrame::evaluate): Provide a SourceCode to the Parser,
219 since other APIs are no longer supported.
221 * kjs/FunctionConstructor.cpp:
222 (JSC::constructFunction): Provide a SourceCode to the Parser, since
223 other APIs are no longer supported. Adopt FunctionBodyNode's new
226 * kjs/JSFunction.cpp:
227 (JSC::JSFunction::lengthGetter):
228 (JSC::JSFunction::getParameterName): Updated for the fact that
229 FunctionBodyNode's parameters are no longer a wtf::Vector.
231 * kjs/JSFunction.h: Nixed some cruft.
233 * kjs/JSGlobalObjectFunctions.cpp:
234 (JSC::globalFuncEval): Provide a SourceCode to the Parser, since
235 other APIs are no longer supported.
238 (JSC::Parser::parse): Require a SourceCode argument, instead of a bunch
239 of broken out parameters. Stop tracking sourceId as an integer, since we
240 use the SourceProvider pointer for this now. Don't clamp the
241 startingLineNumber, since SourceCode does that now.
244 (JSC::Parser::parse): Standardized the parsing interface to require a
252 (runInteractive): Provide a SourceCode to the Interpreter, since
253 other APIs are no longer supported.
255 * kjs/SourceProvider.h:
256 (JSC::SourceProvider::SourceProvider):
257 (JSC::SourceProvider::url):
258 (JSC::SourceProvider::asId):
259 (JSC::UStringSourceProvider::create):
260 (JSC::UStringSourceProvider::UStringSourceProvider): Added new
261 responsibilities described above.
264 (JSC::SourceCode::SourceCode):
265 (JSC::SourceCode::toString):
266 (JSC::SourceCode::provider):
267 (JSC::SourceCode::firstLine):
268 (JSC::SourceCode::data):
269 (JSC::SourceCode::length): Added new responsibilities described above.
270 Renamed SourceRange to SourceCode, based on review feedback. Added
271 a makeSource function for convenience.
273 * kjs/debugger.h: Provide a SourceCode to the client, since other APIs
274 are no longer supported.
276 * kjs/grammar.y: Provide startingLineNumber when creating a SourceCode.
278 * kjs/debugger.h: Treat sourceId as intptr_t to avoid loss of precision
281 * kjs/interpreter.cpp:
282 (JSC::Interpreter::checkSyntax):
283 (JSC::Interpreter::evaluate):
284 * kjs/interpreter.h: Require a SourceCode instead of broken out arguments.
287 (JSC::Lexer::setCode):
289 (JSC::Lexer::sourceRange): Fold together the SourceProvider and line number
290 into a SourceCode. Fixed a bug where the Lexer would accidentally keep
291 alive the last SourceProvider forever.
294 (JSC::ScopeNode::ScopeNode):
295 (JSC::ProgramNode::ProgramNode):
296 (JSC::ProgramNode::create):
297 (JSC::EvalNode::EvalNode):
298 (JSC::EvalNode::generateCode):
299 (JSC::EvalNode::create):
300 (JSC::FunctionBodyNode::FunctionBodyNode):
301 (JSC::FunctionBodyNode::finishParsing):
302 (JSC::FunctionBodyNode::create):
303 (JSC::FunctionBodyNode::generateCode):
304 (JSC::ProgramNode::generateCode):
305 (JSC::FunctionBodyNode::paramString):
308 (JSC::ScopeNode::sourceId):
309 (JSC::FunctionBodyNode::):
310 (JSC::FunctionBodyNode::parameterCount):
311 (JSC::FuncExprNode::):
312 (JSC::FuncDeclNode::): Store a SourceCode in all ScopeNodes, since
313 SourceCode is now responsible for tracking URL, ID, etc. Streamlined
314 some ad hoc FunctionBodyNode fixups into a "finishParsing" function, to
315 help make clear what you need to do in order to finish parsing a
319 (WTF::::releaseBuffer): Don't ASSERT that releaseBuffer() is only called
320 when buffer is not 0, since FunctionBodyNode is more than happy
321 to get back a 0 buffer, and other functions like RefPtr::release() allow
324 2008-10-01 Cameron Zwarich <zwarich@apple.com>
326 Reviewed by Maciej Stachowiak.
328 Bug 21289: REGRESSION (r37160): Inspector crashes on load
329 <https://bugs.webkit.org/show_bug.cgi?id=21289>
331 The code in Arguments::mark() in r37160 was wrong. It marks indices in
332 d->registers, but that makes no sense (they are local variables, not
333 arguments). It should mark those indices in d->registerArray instead.
335 This patch also changes Arguments::copyRegisters() to use d->numParameters
336 instead of recomputing it.
339 (JSC::Arguments::mark):
341 (JSC::Arguments::copyRegisters):
343 2008-09-30 Darin Adler <darin@apple.com>
345 Reviewed by Eric Seidel.
347 - https://bugs.webkit.org/show_bug.cgi?id=21214
348 work on getting rid of ExecState
350 Eliminate some unneeded uses of dynamicGlobalObject.
352 * API/JSClassRef.cpp:
353 (OpaqueJSClass::contextData): Changed to use a map in the global data instead
354 of on the global object. Also fixed to use only a single hash table lookup.
356 * API/JSObjectRef.cpp:
357 (JSObjectMakeConstructor): Use lexicalGlobalObject rather than dynamicGlobalObject
358 to get the object prototype.
360 * kjs/ArrayPrototype.cpp:
361 (JSC::arrayProtoFuncToString): Use arrayVisitedElements set in global data rather
362 than in the global object.
363 (JSC::arrayProtoFuncToLocaleString): Ditto.
364 (JSC::arrayProtoFuncJoin): Ditto.
366 * kjs/JSGlobalData.cpp:
367 (JSC::JSGlobalData::JSGlobalData): Don't initialize opaqueJSClassData, since
368 it's no longer a pointer.
369 (JSC::JSGlobalData::~JSGlobalData): We still need to delete all the values, but
370 we don't need to delete the map since it's no longer a pointer.
372 * kjs/JSGlobalData.h: Made opaqueJSClassData a map instead of a pointer to a map.
373 Also added arrayVisitedElements.
375 * kjs/JSGlobalObject.h: Removed arrayVisitedElements.
378 (functionRun): Use lexicalGlobalObject instead of dynamicGlobalObject.
379 (functionLoad): Ditto.
381 2008-10-01 Cameron Zwarich <zwarich@apple.com>
385 Speculative Windows build fix.
389 2008-10-01 Cameron Zwarich <zwarich@apple.com>
391 Reviewed by Darin Adler.
393 Bug 21123: using "arguments" in a function should not force creation of an activation object
394 <https://bugs.webkit.org/show_bug.cgi?id=21123>
396 Make the 'arguments' object not require a JSActivation. We store the
397 'arguments' object in the OptionalCalleeArguments call frame slot. We
398 need to be able to get the original 'arguments' object to tear it off
399 when returning from a function, but 'arguments' may be assigned to in a
402 Therefore, we use the OptionalCalleeArguments slot when we want to get
403 the original activation or we know that 'arguments' was not assigned a
404 different value. When 'arguments' may have been assigned a new value,
405 we use a new local variable that is initialized with 'arguments'. Since
406 a function parameter named 'arguments' may overwrite the value of
407 'arguments', we also need to be careful to look up 'arguments' in the
408 symbol table, so we get the parameter named 'arguments' instead of the
409 local variable that we have added for holding the 'arguments' object.
411 This is a 19.1% win on the V8 Raytrace benchmark using the SunSpider
412 harness, and a 20.7% win using the V8 harness. This amounts to a 6.5%
413 total speedup on the V8 benchmark suite using the V8 harness.
416 (JSC::CTI::privateCompileMainPass):
418 * VM/CodeGenerator.cpp:
419 (JSC::CodeGenerator::CodeGenerator):
421 (JSC::Machine::unwindCallFrame):
422 (JSC::Machine::privateExecute):
423 (JSC::Machine::retrieveArguments):
424 (JSC::Machine::cti_op_init_arguments):
425 (JSC::Machine::cti_op_ret_activation_arguments):
428 (JSC::RegisterFile::):
430 (JSC::Arguments::mark):
431 (JSC::Arguments::fillArgList):
432 (JSC::Arguments::getOwnPropertySlot):
433 (JSC::Arguments::put):
435 (JSC::Arguments::setRegisters):
436 (JSC::Arguments::init):
437 (JSC::Arguments::Arguments):
438 (JSC::Arguments::copyRegisters):
439 (JSC::JSActivation::copyRegisters):
440 * kjs/JSActivation.cpp:
441 (JSC::JSActivation::argumentsGetter):
442 * kjs/JSActivation.h:
443 (JSC::JSActivation::JSActivationData::JSActivationData):
446 (JSC::ScopeNode::setUsesArguments):
447 * masm/X86Assembler.h:
448 (JSC::X86Assembler::):
449 (JSC::X86Assembler::orl_mr):
451 2008-10-01 Kevin McCullough <kmccullough@apple.com>
453 Rubberstamped by Geoff Garen.
455 Remove BreakpointCheckStatement because it's not used anymore.
456 No effect on sunspider or the jsc tests.
461 2008-09-30 Oliver Hunt <oliver@apple.com>
463 Reviewed by Geoff Garen.
465 Improve performance of CTI on windows.
467 Currently on platforms where the compiler doesn't allow us to safely
468 index relative to the address of a parameter we need to actually
469 provide a pointer to CTI runtime call arguments. This patch improves
470 performance in this case by making the CTI logic for restoring this
471 parameter much less conservative by only resetting it before we actually
472 make a call, rather than between each and every SF bytecode we generate
475 This results in a 3.6% progression on the v8 benchmark when compiled with MSVC.
478 (JSC::CTI::emitCall):
479 (JSC::CTI::compileOpCall):
480 (JSC::CTI::privateCompileMainPass):
481 (JSC::CTI::privateCompileSlowCases):
482 (JSC::CTI::privateCompilePutByIdTransition):
484 * masm/X86Assembler.h:
487 2008-09-30 Maciej Stachowiak <mjs@apple.com>
489 Reviewed by Oliver Hunt.
491 - track uses of "this", "with" and "catch" in the parser
493 Knowing this up front will be useful for future optimizations.
495 Perf and correctness remain the same.
500 2008-09-30 Sam Weinig <sam@webkit.org>
502 Reviewed by Mark Rowe.
504 Add WebKitAvailability macros for JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError,
505 and JSObjectMakeRegExp
509 2008-09-30 Darin Adler <darin@apple.com>
511 Reviewed by Geoff Garen.
513 - https://bugs.webkit.org/show_bug.cgi?id=21214
514 work on getting rid of ExecState
516 Replaced the m_prev field of ExecState with a bit in the
517 call frame pointer to indicate "host" call frames.
520 (JSC::makeHostCallFramePointer): Added. Sets low bit.
521 (JSC::isHostCallFrame): Added. Checks low bit.
522 (JSC::stripHostCallFrameBit): Added. Clears low bit.
523 (JSC::Machine::unwindCallFrame): Replaced null check that was
524 formerly used to detect host call frames with an isHostCallFrame check.
525 (JSC::Machine::execute): Pass in a host call frame pointer rather than
526 always passing 0 when starting execution from the host. This allows us
527 to follow the entire call frame pointer chain when desired, or to stop
528 at the host calls when that's desired.
529 (JSC::Machine::privateExecute): Replaced null check that was
530 formerly used to detect host call frames with an isHostCallFrame check.
531 (JSC::Machine::retrieveCaller): Ditto.
532 (JSC::Machine::retrieveLastCaller): Ditto.
533 (JSC::Machine::callFrame): Removed the code to walk up m_prev pointers
534 and replaced it with code that uses the caller pointer and uses the
535 stripHostCallFrameBit function.
537 * kjs/ExecState.cpp: Removed m_prev.
538 * kjs/ExecState.h: Ditto.
540 2008-09-30 Cameron Zwarich <zwarich@apple.com>
542 Reviewed by Geoff Garen.
544 Move all detection of 'arguments' in a lexical scope to the parser, in
545 preparation for fixing
547 Bug 21123: using "arguments" in a function should not force creation of an activation object
548 <https://bugs.webkit.org/show_bug.cgi?id=21123>
550 * VM/CodeGenerator.cpp:
551 (JSC::CodeGenerator::CodeGenerator):
555 2008-09-30 Geoffrey Garen <ggaren@apple.com>
560 (runWithScripts): Fixed indentation.
562 2008-09-30 Mark Rowe <mrowe@apple.com>
564 Rubber-stamped by Sam Weinig.
566 Build fix. Move InternalFunction::classInfo implementation into the .cpp
567 file to prevent the vtable for InternalFunction being generated as a weak symbol.
568 Has no effect on SunSpider.
570 * kjs/InternalFunction.cpp:
571 (JSC::InternalFunction::classInfo):
572 * kjs/InternalFunction.h:
574 2008-09-29 Maciej Stachowiak <mjs@apple.com>
576 Reviewed by Darin Adler.
578 - optimize appending a number to a string
579 https://bugs.webkit.org/show_bug.cgi?id=21203
581 It's pretty common in real-world code (and on some of the v8
582 benchmarks) to append a number to a string, so I made this one of
583 the fast cases, and also added support to UString to do it
584 directly without allocating a temporary UString.
586 ~1% speedup on v8 benchmark.
589 (JSC::jsAddSlowCase): Make this NEVER_INLINE because somehow otherwise
590 the change is a regression.
591 (JSC::jsAdd): Handle number + string special case.
592 (JSC::Machine::cti_op_add): Integrate much of the logic of jsAdd to
593 avoid exception check in the str + str, num + num and str + num cases.
595 (JSC::expandedSize): Make this a non-member function, since it needs to be
596 called in non-member functions but not outside this file.
597 (JSC::expandCapacity): Ditto.
598 (JSC::UString::expandCapacity): Call the non-member version.
599 (JSC::createRep): Helper to make a rep from a char*.
600 (JSC::UString::UString): Use above helper.
601 (JSC::concatenate): Guts of concatenating constructor for cases where first
602 item is a UString::Rep, and second is a UChar* and length, or a char*.
603 (JSC::UString::append): Implement for cases where first item is a UString::Rep,
604 and second is an int or double. Sadly duplicates logic of UString::from(int)
605 and UString::from(double).
608 2008-09-29 Darin Adler <darin@apple.com>
610 Reviewed by Sam Weinig.
612 - https://bugs.webkit.org/show_bug.cgi?id=21214
613 work on getting rid of ExecState
615 * JavaScriptCore.exp: Updated since JSGlobalObject::init
616 no longer takes a parameter.
619 (JSC::Machine::execute): Removed m_registerFile argument
620 for ExecState constructors.
622 * kjs/DebuggerCallFrame.cpp:
623 (JSC::DebuggerCallFrame::evaluate): Removed globalThisValue
624 argument for ExecState constructor.
627 (JSC::ExecState::ExecState): Removed globalThisValue and
628 registerFile arguments to constructors.
630 * kjs/ExecState.h: Removed m_globalThisValue and
631 m_registerFile data members.
633 * kjs/JSGlobalObject.cpp:
634 (JSC::JSGlobalObject::init): Removed globalThisValue
635 argument for ExecState constructor.
637 * kjs/JSGlobalObject.h:
638 (JSC::JSGlobalObject::JSGlobalObject): Got rid of parameter
639 for the init function.
641 2008-09-29 Geoffrey Garen <ggaren@apple.com>
643 Rubber-stamped by Cameron Zwarich.
645 Fixed https://bugs.webkit.org/show_bug.cgi?id=21225
646 Machine::retrieveLastCaller should check for a NULL codeBlock
648 In order to crash, you would need to call retrieveCaller in a situation
649 where you had two host call frames in a row in the register file. I
650 don't know how to make that happen, or if it's even possible, so I don't
651 have a test case -- but better safe than sorry!
654 (JSC::Machine::retrieveLastCaller):
656 2008-09-29 Geoffrey Garen <ggaren@apple.com>
658 Reviewed by Cameron Zwarich.
660 Store the callee ScopeChain, not the caller ScopeChain, in the call frame
661 header. Nix the "scopeChain" local variable and ExecState::m_scopeChain, and
662 access the callee ScopeChain through the call frame header instead.
664 Profit: call + return are simpler, because they don't have to update the
665 "scopeChain" local variable, or ExecState::m_scopeChain.
667 Because CTI keeps "r" in a register, reading the callee ScopeChain relative
668 to "r" can be very fast, in any cases we care to optimize.
670 0% speedup on empty function call benchmark. (5.5% speedup in bytecode.)
671 0% speedup on SunSpider. (7.5% speedup on controlflow-recursive.)
672 2% speedup on SunSpider --v8.
673 2% speedup on v8 benchmark.
675 * VM/CTI.cpp: Changed scope chain access to read the scope chain from
676 the call frame header. Sped up op_ret by changing it not to fuss with
677 the "scopeChain" local variable or ExecState::m_scopeChain.
679 * VM/CTI.h: Updated CTI trampolines not to take a ScopeChainNode*
680 argument, since that's stored in the call frame header now.
682 * VM/Machine.cpp: Access "scopeChain" and "codeBlock" through new helper
683 functions that read from the call frame header. Updated functions operating
684 on ExecState::m_callFrame to account for / take advantage of the fact that
685 Exec:m_callFrame is now never NULL.
687 Fixed a bug in op_construct, where it would use the caller's default
688 object prototype, rather than the callee's, when constructing a new object.
690 * VM/Machine.h: Made some helper functions available. Removed
691 ScopeChainNode* arguments to a lot of functions, since the ScopeChainNode*
692 is now stored in the call frame header.
694 * VM/RegisterFile.h: Renamed "CallerScopeChain" to "ScopeChain", since
695 that's what it is now.
697 * kjs/DebuggerCallFrame.cpp: Updated for change to ExecState signature.
700 * kjs/ExecState.h: Nixed ExecState::m_callFrame, along with the unused
701 isGlobalObject function.
703 * kjs/JSGlobalObject.cpp:
704 * kjs/JSGlobalObject.h: Gave the global object a fake call frame in
705 which to store the global scope chain, since our code now assumes that
706 it can always read the scope chain out of the ExecState's call frame.
708 2008-09-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
710 Reviewed by Sam Weinig.
712 Remove the isActivationObject() virtual method on JSObject and use
713 StructureID information instead. This should be slightly faster, but
714 isActivationObject() is only used in assertions and unwinding the stack
719 (JSC::Machine::unwindCallFrame):
720 (JSC::Machine::privateExecute):
721 (JSC::Machine::cti_op_ret_activation):
722 * kjs/JSActivation.cpp:
723 * kjs/JSActivation.h:
726 2008-09-29 Peter Gal <galpeter@inf.u-szeged.hu>
728 Reviewed and tweaked by Darin Adler.
730 Fix build for non-all-in-one platforms.
732 * kjs/StringPrototype.cpp: Added missing ASCIICType.h include.
734 2008-09-29 Bradley T. Hughes <bradley.hughes@nokia.com>
736 Reviewed by Simon Hausmann.
738 Fix compilation with icpc
744 2008-09-29 Thiago Macieira <thiago.macieira@nokia.com>
746 Reviewed by Simon Hausmann.
748 Changed copyright from Trolltech ASA to Nokia.
750 Nokia acquired Trolltech ASA, assets were transferred on September 26th 2008.
753 * wtf/qt/MainThreadQt.cpp:
755 2008-09-29 Simon Hausmann <hausmann@webkit.org>
757 Reviewed by Lars Knoll.
759 Don't accidentially install libJavaScriptCore.a for the build inside
762 * JavaScriptCore.pro:
764 2008-09-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
766 Reviewed by Maciej Stachowiak.
768 Bug 21200: Allow direct access to 'arguments' without using op_resolve
769 <https://bugs.webkit.org/show_bug.cgi?id=21200>
771 Allow fast access to the 'arguments' object by adding an extra slot to
772 the callframe to store it.
774 This is a 3.0% speedup on the V8 Raytrace benchmark.
776 * JavaScriptCore.exp:
778 (JSC::CTI::privateCompileMainPass):
780 (JSC::CodeBlock::dump):
781 * VM/CodeGenerator.cpp:
782 (JSC::CodeGenerator::CodeGenerator):
783 (JSC::CodeGenerator::registerFor):
784 * VM/CodeGenerator.h:
785 (JSC::CodeGenerator::registerFor):
787 (JSC::Machine::initializeCallFrame):
788 (JSC::Machine::dumpRegisters):
789 (JSC::Machine::privateExecute):
790 (JSC::Machine::retrieveArguments):
791 (JSC::Machine::cti_op_call_JSFunction):
792 (JSC::Machine::cti_op_create_arguments):
793 (JSC::Machine::cti_op_construct_JSConstruct):
797 (JSC::RegisterFile::):
798 * kjs/JSActivation.cpp:
799 (JSC::JSActivation::mark):
800 (JSC::JSActivation::argumentsGetter):
801 * kjs/JSActivation.h:
802 (JSC::JSActivation::JSActivationData::JSActivationData):
805 (JSC::Parser::didFinishParsing):
807 (JSC::Parser::parse):
810 (JSC::ScopeNode::ScopeNode):
811 (JSC::ProgramNode::ProgramNode):
812 (JSC::ProgramNode::create):
813 (JSC::EvalNode::EvalNode):
814 (JSC::EvalNode::create):
815 (JSC::FunctionBodyNode::FunctionBodyNode):
816 (JSC::FunctionBodyNode::create):
818 (JSC::ScopeNode::usesArguments):
820 2008-09-28 Mark Rowe <mrowe@apple.com>
822 Reviewed by Sam Weinig.
824 Add an ASCII fast-path to toLowerCase and toUpperCase.
826 The fast path speeds up the common case of an ASCII-only string by up to 60% while adding a less than 5% penalty
827 to the less common non-ASCII case.
829 This also removes stringProtoFuncToLocaleLowerCase and stringProtoFuncToLocaleUpperCase, which were identical
830 to the non-locale variants of the functions. toLocaleLowerCase and toLocaleUpperCase now use the non-locale
831 variants of the functions directly.
833 * kjs/StringPrototype.cpp:
834 (JSC::stringProtoFuncToLowerCase):
835 (JSC::stringProtoFuncToUpperCase):
837 2008-09-28 Mark Rowe <mrowe@apple.com>
839 Reviewed by Cameron Zwarich.
841 Speed up parseInt and parseFloat.
843 Repeatedly indexing into a UString is slow, so retrieve a pointer into the underlying buffer once up front
844 and use that instead. This is a 7% win on a parseInt/parseFloat micro-benchmark.
846 * kjs/JSGlobalObjectFunctions.cpp:
850 2008-09-28 Simon Hausmann <hausmann@webkit.org>
852 Reviewed by David Hyatt.
854 In Qt's initializeThreading re-use an existing thread identifier for the main
857 currentThread() implicitly creates new identifiers and it could be that
858 it is called before initializeThreading().
860 * wtf/ThreadingQt.cpp:
861 (WTF::initializeThreading):
863 2008-09-27 Keishi Hattori <casey.hattori@gmail.com>
865 Added Machine::retrieveCaller to the export list.
867 Reviewed by Kevin McCullough and Tim Hatcher.
869 * JavaScriptCore.exp: Added Machine::retrieveCaller.
871 2008-09-27 Anders Carlsson <andersca@apple.com>
878 2008-09-27 Geoffrey Garen <ggaren@apple.com>
880 Reviewed by Cameron Zwarich.
882 https://bugs.webkit.org/show_bug.cgi?id=21175
884 Store the callee CodeBlock, not the caller CodeBlock, in the call frame
885 header. Nix the "codeBlock" local variable, and access the callee
886 CodeBlock through the call frame header instead.
888 Profit: call + return are simpler, because they don't have to update the
889 "codeBlock" local variable.
891 Because CTI keeps "r" in a register, reading the callee CodeBlock relative
892 to "r" can be very fast, in any cases we care to optimize. Presently,
893 no such cases seem important.
895 Also, stop writing "dst" to the call frame header. CTI doesn't use it.
897 21.6% speedup on empty function call benchmark.
898 3.8% speedup on SunSpider --v8.
899 2.1% speedup on v8 benchmark.
900 0.7% speedup on SunSpider (6% speedup on controlflow-recursive).
902 Small regression in bytecode, because currently every op_ret reads the
903 callee CodeBlock to check needsFullScopeChain, and bytecode does not
904 keep "r" in a register. On-balance, this is probably OK, since CTI is
905 our high-performance execution model. Also, this should go away once
906 we make needsFullScopeChain statically determinable at parse time.
909 (JSC::CTI::compileOpCall): The speedup!
910 (JSC::CTI::privateCompileSlowCases): ditto
913 (JSC::): Fixed up magic trampoline constants to account for the nixed
914 "codeBlock" argument.
915 (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock"
916 argument, since codeBlock is now stored in the call frame header.
918 * VM/Machine.cpp: Read the callee CodeBlock from the register file. Use
919 a NULL CallerRegisters in the call frame header to signal a built-in
920 caller, since CodeBlock is now never NULL.
922 * VM/Machine.h: Made some stand-alone functions Machine member functions
923 so they could call the private codeBlock() accessor in the Register
924 class, of which Machine is a friend. Renamed "CallerCodeBlock" to
925 "CodeBlock", since it's no longer the caller's CodeBlock.
927 * VM/RegisterFile.h: Marked some methods const to accommodate a
928 const RegisterFile* being passed around in Machine.cpp.
930 2008-09-26 Jan Michael Alonzo <jmalonzo@webkit.org>
932 Gtk build fix. Not reviewed.
934 Narrow-down the target of the JavaScriptCore .lut.h generator so
935 it won't try to create the WebCore .lut.hs.
939 2008-09-26 Matt Lilek <webkit@mattlilek.com>
941 Reviewed by Tim Hatcher.
943 Update FEATURE_DEFINES after ENABLE_CROSS_DOCUMENT_MESSAGING was removed.
945 * Configurations/JavaScriptCore.xcconfig:
947 2008-09-26 Cameron Zwarich <cwzwarich@uwaterloo.ca>
949 Rubber-stamped by Anders Carlson.
951 Change the name 'sc' to 'scopeChainNode' in a few places.
954 (JSC::EvalNode::generateCode):
955 (JSC::FunctionBodyNode::generateCode):
956 (JSC::ProgramNode::generateCode):
958 2008-09-26 Sam Weinig <sam@webkit.org>
960 Reviewed by Darin Adler.
962 Patch for https://bugs.webkit.org/show_bug.cgi?id=21152
963 Speedup static property get/put
965 Convert getting/setting static property values to use static functions
966 instead of storing an integer and switching in getValueProperty/putValueProperty.
969 (JSC::JSObject::deleteProperty):
970 (JSC::JSObject::getPropertyAttributes):
971 * kjs/MathObject.cpp:
972 (JSC::MathObject::getOwnPropertySlot):
973 * kjs/NumberConstructor.cpp:
974 (JSC::numberConstructorNaNValue):
975 (JSC::numberConstructorNegInfinity):
976 (JSC::numberConstructorPosInfinity):
977 (JSC::numberConstructorMaxValue):
978 (JSC::numberConstructorMinValue):
979 * kjs/PropertySlot.h:
980 (JSC::PropertySlot::):
981 * kjs/RegExpConstructor.cpp:
982 (JSC::regExpConstructorDollar1):
983 (JSC::regExpConstructorDollar2):
984 (JSC::regExpConstructorDollar3):
985 (JSC::regExpConstructorDollar4):
986 (JSC::regExpConstructorDollar5):
987 (JSC::regExpConstructorDollar6):
988 (JSC::regExpConstructorDollar7):
989 (JSC::regExpConstructorDollar8):
990 (JSC::regExpConstructorDollar9):
991 (JSC::regExpConstructorInput):
992 (JSC::regExpConstructorMultiline):
993 (JSC::regExpConstructorLastMatch):
994 (JSC::regExpConstructorLastParen):
995 (JSC::regExpConstructorLeftContext):
996 (JSC::regExpConstructorRightContext):
997 (JSC::setRegExpConstructorInput):
998 (JSC::setRegExpConstructorMultiline):
999 (JSC::RegExpConstructor::setInput):
1000 (JSC::RegExpConstructor::setMultiline):
1001 (JSC::RegExpConstructor::multiline):
1002 * kjs/RegExpConstructor.h:
1003 * kjs/RegExpObject.cpp:
1004 (JSC::regExpObjectGlobal):
1005 (JSC::regExpObjectIgnoreCase):
1006 (JSC::regExpObjectMultiline):
1007 (JSC::regExpObjectSource):
1008 (JSC::regExpObjectLastIndex):
1009 (JSC::setRegExpObjectLastIndex):
1010 * kjs/RegExpObject.h:
1011 (JSC::RegExpObject::setLastIndex):
1012 (JSC::RegExpObject::lastIndex):
1013 (JSC::RegExpObject::RegExpObjectData::RegExpObjectData):
1014 * kjs/StructureID.cpp:
1015 (JSC::StructureID::getEnumerablePropertyNames):
1016 * kjs/create_hash_table:
1020 (JSC::HashTable::createTable):
1021 (JSC::HashTable::deleteTable):
1022 (JSC::setUpStaticFunctionSlot):
1024 (JSC::HashEntry::initialize):
1025 (JSC::HashEntry::setKey):
1026 (JSC::HashEntry::key):
1027 (JSC::HashEntry::attributes):
1028 (JSC::HashEntry::function):
1029 (JSC::HashEntry::functionLength):
1030 (JSC::HashEntry::propertyGetter):
1031 (JSC::HashEntry::propertyPutter):
1032 (JSC::HashEntry::lexerValue):
1034 (JSC::HashTable::entry):
1035 (JSC::getStaticPropertySlot):
1036 (JSC::getStaticValueSlot):
1039 2008-09-26 Gavin Barraclough <barraclough@apple.com>
1041 Reviewed by Maciej Stachowiak & Oliver Hunt.
1043 Add support for reusing temporary JSNumberCells. This change is based on the observation
1044 that if the result of certain operations is a JSNumberCell and is consumed by a subsequent
1045 operation that would produce a JSNumberCell, we can reuse the object rather than allocating
1046 a fresh one. E.g. given the expression ((a * b) * c), we can statically determine that
1047 (a * b) will have a numeric result (or else it will have thrown an exception), so the result
1048 will either be a JSNumberCell or a JSImmediate.
1050 This patch changes three areas of JSC:
1051 * The AST now tracks type information about the result of each node.
1052 * This information is consumed in bytecode compilation, and certain bytecode operations
1053 now carry the statically determined type information about their operands.
1054 * CTI uses the information in a number of fashions:
1055 * Where an operand to certain arithmetic operations is reusable, it will plant code
1056 to try to perform the operation in JIT code & reuse the cell, where appropriate.
1057 * Where it can be statically determined that an operand can only be numeric (typically
1058 the result of another arithmetic operation) the code will not redundantly check that
1059 the JSCell is a JSNumberCell.
1060 * Where either of the operands to an add are non-numeric do not plant an optimized
1061 arithmetic code path, just call straight out to the C function.
1063 +6% Sunspider (10% progression on 3D, 16% progression on math, 60% progression on access-nbody),
1064 +1% v8-tests (improvements in raytrace & crypto)
1066 * VM/CTI.cpp: Add optimized code generation with reuse of temporary JSNumberCells.
1068 * kjs/JSNumberCell.h:
1069 * masm/X86Assembler.h:
1071 * VM/CodeBlock.cpp: Add type information to specific bytecodes.
1072 * VM/CodeGenerator.cpp:
1073 * VM/CodeGenerator.h:
1076 * kjs/nodes.cpp: Track static type information for nodes.
1078 * kjs/ResultDescriptor.h: (Added)
1079 * JavaScriptCore.xcodeproj/project.pbxproj:
1081 2008-09-26 Yichao Yin <yichao.yin@torchmobile.com.cn>
1083 Reviewed by George Staikos, Maciej Stachowiak.
1085 Add utility functions needed for upcoming WML code.
1088 (WTF::isASCIIPrintable):
1090 2008-09-26 Geoffrey Garen <ggaren@apple.com>
1092 Reviewed by Darin Adler.
1094 Reverted the part of r36614 that used static data because static data
1097 2008-09-26 Geoffrey Garen <ggaren@apple.com>
1099 Reviewed by Maciej Stachowiak.
1101 Removed dynamic check for whether the callee needs an activation object.
1102 Replaced with callee code to create the activation object.
1104 0.5% speedup on SunSpider.
1105 No change on v8 benchmark. (Might be a speedup, but it's in range of the
1108 0.7% speedup on v8 benchmark in bytecode.
1109 1.3% speedup on empty call benchmark in bytecode.
1112 (JSC::CTI::privateCompileMainPass): Added support for op_init_activation,
1113 the new opcode that specifies that the callee's initialization should
1114 create an activation object.
1115 (JSC::CTI::privateCompile): Removed previous code that did a similar
1116 thing in an ad-hoc way.
1119 (JSC::CodeBlock::dump): Added a case for dumping op_init_activation.
1121 * VM/CodeGenerator.cpp:
1122 (JSC::CodeGenerator::generate): Added fixup code to change op_init to
1123 op_init_activation if necessary. (With a better parser, we would know
1124 which to use from the beginning.)
1127 (JSC::Instruction::Instruction):
1128 (WTF::): Faster traits for the instruction vector. An earlier version
1129 of this patch relied on inserting at the beginning of the vector, and
1130 depended on this change for speed.
1133 (JSC::Machine::execute): Removed clients of setScopeChain, the old
1134 abstraction for dynamically checking for whether an activation object
1135 needed to be created.
1136 (JSC::Machine::privateExecute): ditto
1138 (JSC::Machine::cti_op_push_activation): Renamed this function from
1139 cti_vm_updateScopeChain, and made it faster by removing the call to
1143 * VM/Opcode.h: Declared op_init_activation.
1145 2008-09-24 Geoffrey Garen <ggaren@apple.com>
1147 Reviewed by Maciej Stachowiak.
1149 Move most of the return code back into the callee, now that the callee
1150 doesn't have to calculate anything dynamically.
1152 11.5% speedup on empty function call benchmark.
1154 SunSpider says 0.3% faster. SunSpider --v8 says no change.
1157 (JSC::CTI::compileOpCall):
1158 (JSC::CTI::privateCompileMainPass):
1159 (JSC::CTI::privateCompileSlowCases):
1161 2008-09-24 Sam Weinig <sam@webkit.org>
1163 Reviewed by Maciej Stachowiak.
1165 Remove staticFunctionGetter. There is only one remaining user of
1166 staticFunctionGetter and it can be converted to use setUpStaticFunctionSlot.
1168 * JavaScriptCore.exp:
1172 2008-09-24 Maciej Stachowiak <mjs@apple.com>
1174 Reviewed by Oliver Hunt.
1176 - inline JIT fast case of op_neq
1177 - remove extra level of function call indirection from slow cases of eq and neq
1179 1% speedup on Richards
1182 (JSC::CTI::privateCompileMainPass):
1183 (JSC::CTI::privateCompileSlowCases):
1185 (JSC::Machine::privateExecute):
1186 (JSC::Machine::cti_op_eq):
1187 (JSC::Machine::cti_op_neq):
1188 * kjs/operations.cpp:
1190 (JSC::equalSlowCase):
1192 (JSC::equalSlowCaseInline):
1194 2008-09-24 Sam Weinig <sam@webkit.org>
1196 Reviewed by Darin Adler.
1198 Fix for https://bugs.webkit.org/show_bug.cgi?id=21080
1199 <rdar://problem/6243534>
1200 Crash below Function.apply when using a runtime array as the argument list
1202 Test: plugins/bindings-array-apply-crash.html
1204 * kjs/FunctionPrototype.cpp:
1205 (JSC::functionProtoFuncApply): Revert to the slow case if the object inherits from
1206 JSArray (via ClassInfo) but is not a JSArray.
1208 2008-09-24 Kevin McCullough <kmccullough@apple.com>
1213 (JSC::statementListEmitCode):
1215 2008-09-24 Kevin McCullough <kmccullough@apple.com>
1219 Bug 21031: Breakpoints in the condition of loops only breaks the first
1221 - Now when setting breakpoints in the condition of a loop (for, while,
1222 for in, and do while) will successfully break each time throught the
1224 - For 'for' loops we need a little more complicated behavior that cannot
1225 be accomplished without some more significant changes:
1226 https://bugs.webkit.org/show_bug.cgi?id=21073
1229 (JSC::statementListEmitCode): We don't want to blindly emit a debug hook
1230 at the first line of loops, instead let the loop emit the debug hooks.
1231 (JSC::DoWhileNode::emitCode):
1232 (JSC::WhileNode::emitCode):
1233 (JSC::ForNode::emitCode):
1234 (JSC::ForInNode::emitCode):
1236 (JSC::StatementNode::):
1237 (JSC::DoWhileNode::):
1241 2008-09-24 Geoffrey Garen <ggaren@apple.com>
1243 Reviewed by Darin Adler.
1245 Fixed <rdar://problem/5605532> Need a SPI for telling JS the size of
1246 the objects it retains
1248 * API/tests/testapi.c: Test the new SPI a little.
1250 * API/JSSPI.cpp: Add the new SPI.
1251 * API/JSSPI.h: Add the new SPI.
1252 * JavaScriptCore.exp: Add the new SPI.
1253 * JavaScriptCore.xcodeproj/project.pbxproj: Add the new SPI.
1255 2008-09-24 Geoffrey Garen <ggaren@apple.com>
1257 Reviewed by Darin Adler.
1259 * API/JSBase.h: Filled in some missing function names.
1261 2008-09-24 Geoffrey Garen <ggaren@apple.com>
1263 Reviewed by Cameron Zwarich.
1265 Fixed https://bugs.webkit.org/show_bug.cgi?id=21057
1266 Crash in RegisterID::deref() running fast/canvas/canvas-putImageData.html
1268 * VM/CodeGenerator.h: Changed declaration order to ensure the
1269 m_lastConstant, which is a RefPtr that points into m_calleeRegisters,
1270 has its destructor called before the destructor for m_calleeRegisters.
1272 2008-09-24 Darin Adler <darin@apple.com>
1274 Reviewed by Sam Weinig.
1276 - https://bugs.webkit.org/show_bug.cgi?id=21047
1277 speed up ret_activation with inlining
1279 About 1% on v8-raytrace.
1281 * JavaScriptCore.exp: Removed JSVariableObject::setRegisters.
1283 * kjs/JSActivation.cpp: Moved copyRegisters to the header to make it inline.
1284 * kjs/JSActivation.h:
1285 (JSC::JSActivation::copyRegisters): Moved here. Also removed the registerArraySize
1286 argument to setRegisters, since the object doesn't need to store the number of
1289 * kjs/JSGlobalObject.cpp:
1290 (JSC::JSGlobalObject::reset): Removed unnecessary clearing left over from when we
1291 used this on objects that weren't brand new. These days, this function is really
1292 just part of the constructor.
1294 * kjs/JSGlobalObject.h: Added registerArraySize to JSGlobalObjectData, since
1295 JSVariableObjectData no longer needs it. Added a setRegisters override here
1296 that handles storing the size.
1298 * kjs/JSStaticScopeObject.h: Removed code to set registerArraySize, since it
1301 * kjs/JSVariableObject.cpp: Moved copyRegisterArray and setRegisters to the
1302 header to make them inline.
1303 * kjs/JSVariableObject.h: Removed registerArraySize from JSVariableObjectData,
1304 since it was only used for the global object.
1305 (JSC::JSVariableObject::copyRegisterArray): Moved here ot make it inline.
1306 (JSC::JSVariableObject::setRegisters): Moved here to make it inline. Also
1307 removed the code to set registerArraySize and changed an if statement into
1308 an assert to save an unnnecessary branch.
1310 2008-09-24 Maciej Stachowiak <mjs@apple.com>
1312 Reviewed by Oliver Hunt.
1314 - inline PropertyMap::getOffset to speed up polymorphic lookups
1316 ~1.5% speedup on v8 benchmark
1317 no effect on SunSpider
1319 * JavaScriptCore.exp:
1320 * kjs/PropertyMap.cpp:
1321 * kjs/PropertyMap.h:
1322 (JSC::PropertyMap::getOffset):
1324 2008-09-24 Jan Michael Alonzo <jmalonzo@webkit.org>
1326 Reviewed by Alp Toker.
1328 https://bugs.webkit.org/show_bug.cgi?id=20992
1329 Build fails on GTK+ Mac OS
1331 * wtf/ThreadingGtk.cpp: Remove platform ifdef as suggested by
1333 (WTF::initializeThreading):
1335 2008-09-23 Oliver Hunt <oliver@apple.com>
1337 Reviewed by Maciej Stachowiak.
1339 Bug 19968: Slow Script at www.huffingtonpost.com
1340 <https://bugs.webkit.org/show_bug.cgi?id=19968>
1342 Finally found the cause of this accursed issue. It is triggered
1343 by synchronous creation of a new global object from JS. The new
1344 global object resets the timer state in this execution group's
1345 Machine, taking timerCheckCount to 0. Then when JS returns the
1346 timerCheckCount is decremented making it non-zero. The next time
1347 we execute JS we will start the timeout counter, however the non-zero
1348 timeoutCheckCount means we don't reset the timer information. This
1349 means that the timeout check is now checking the cumulative time
1350 since the creation of the global object rather than the time since
1351 JS was last entered. At this point the slow script dialog is guaranteed
1352 to eventually be displayed incorrectly unless a page is loaded
1353 asynchronously (which will reset everything into a sane state).
1355 The fix for this is rather trivial -- the JSGlobalObject constructor
1356 should not be resetting the machine timer state.
1359 (JSC::Machine::Machine):
1360 Now that we can't rely on the GlobalObject initialising the timeout
1361 state, we do it in the Machine constructor.
1364 (JSC::Machine::stopTimeoutCheck):
1365 Add assertions to guard against this happening.
1367 * kjs/JSGlobalObject.cpp:
1368 (JSC::JSGlobalObject::init):
1369 Don't reset the timeout state.
1371 2008-09-23 Geoffrey Garen <ggaren@apple.com>
1373 Reviewed by Oliver Hunt.
1375 Fixed https://bugs.webkit.org/show_bug.cgi?id=21038 | <rdar://problem/6240812>
1376 Uncaught exceptions in regex replace callbacks crash webkit
1378 This was a combination of two problems:
1380 (1) the replace function would continue execution after an exception
1383 (2) In some cases, the Machine would return 0 in the case of an exception,
1384 despite the fact that a few clients dereference the Machine's return
1385 value without first checking for an exception.
1388 (JSC::Machine::execute):
1390 ^ Return jsNull() instead of 0 in the case of an exception, since some
1391 clients depend on using our return value.
1393 ^ ASSERT that execution does not continue after an exception has been
1394 thrown, to help catch problems like this in the future.
1396 * kjs/StringPrototype.cpp:
1397 (JSC::stringProtoFuncReplace):
1399 ^ Stop execution if an exception has been thrown.
1401 2008-09-23 Geoffrey Garen <ggaren@apple.com>
1403 Try to fix the windows build.
1406 (JSC::CTI::compileOpCall):
1407 (JSC::CTI::privateCompileMainPass):
1409 2008-09-23 Alp Toker <alp@nuanti.com>
1415 2008-09-23 Geoffrey Garen <ggaren@apple.com>
1417 Reviewed by Darin Adler.
1419 * wtf/Platform.h: Removed duplicate #if.
1421 2008-09-23 Geoffrey Garen <ggaren@apple.com>
1423 Reviewed by Darin Adler.
1425 Changed the layout of the call frame from
1427 { header, parameters, locals | constants, temporaries }
1431 { parameters, header | locals, constants, temporaries }
1433 This simplifies function entry+exit, and enables a number of future
1436 13.5% speedup on empty call benchmark for bytecode; 23.6% speedup on
1437 empty call benchmark for CTI.
1439 SunSpider says no change. SunSpider --v8 says 1% faster.
1443 Added a bit of abstraction for calculating whether a register is a
1444 constant, since this patch changes that calculation:
1445 (JSC::CTI::isConstant):
1446 (JSC::CTI::getConstant):
1447 (JSC::CTI::emitGetArg):
1448 (JSC::CTI::emitGetPutArg):
1449 (JSC::CTI::getConstantImmediateNumericArg):
1451 Updated for changes to callframe header location:
1452 (JSC::CTI::emitPutToCallFrameHeader):
1453 (JSC::CTI::emitGetFromCallFrameHeader):
1454 (JSC::CTI::printOpcodeOperandTypes):
1456 Renamed to spite Oliver:
1457 (JSC::CTI::emitInitRegister):
1459 Added an abstraction for emitting a call through a register, so that
1460 calls through registers generate exception info, too:
1461 (JSC::CTI::emitCall):
1463 Updated to match the new callframe header layout, and to support calls
1464 through registers, which have no destination address:
1465 (JSC::CTI::compileOpCall):
1466 (JSC::CTI::privateCompileMainPass):
1467 (JSC::CTI::privateCompileSlowCases):
1468 (JSC::CTI::privateCompile):
1473 (JSC::CallRecord::CallRecord):
1477 Updated for new register layout:
1478 (JSC::registerName):
1479 (JSC::CodeBlock::dump):
1483 Updated CodeBlock to track slightly different information about the
1484 register frame, and tweaked the style of an ASSERT_NOT_REACHED.
1485 (JSC::CodeBlock::CodeBlock):
1486 (JSC::CodeBlock::getStubInfo):
1488 * VM/CodeGenerator.cpp:
1490 Added some abstraction around constant register allocation, since this
1491 patch changes it, changed codegen to account for the new callframe
1492 layout, and added abstraction around register fetching code
1493 that used to assume that all local registers lived at negative indices,
1494 since vars now live at positive indices:
1495 (JSC::CodeGenerator::generate):
1496 (JSC::CodeGenerator::addVar):
1497 (JSC::CodeGenerator::addGlobalVar):
1498 (JSC::CodeGenerator::allocateConstants):
1499 (JSC::CodeGenerator::CodeGenerator):
1500 (JSC::CodeGenerator::addParameter):
1501 (JSC::CodeGenerator::registerFor):
1502 (JSC::CodeGenerator::constRegisterFor):
1503 (JSC::CodeGenerator::newRegister):
1504 (JSC::CodeGenerator::newTemporary):
1505 (JSC::CodeGenerator::highestUsedRegister):
1506 (JSC::CodeGenerator::addConstant):
1508 ASSERT that our caller referenced the registers it passed to us.
1509 Otherwise, we might overwrite them with parameters:
1510 (JSC::CodeGenerator::emitCall):
1511 (JSC::CodeGenerator::emitConstruct):
1513 * VM/CodeGenerator.h:
1515 Added some abstraction for getting a RegisterID for a given index,
1516 since the rules are a little weird:
1517 (JSC::CodeGenerator::registerFor):
1521 Utility function to transform a machine return PC to a virtual machine
1522 return VPC, for the sake of stack unwinding, since both PCs are stored
1523 in the same location now:
1526 Tweaked to account for new call frame:
1527 (JSC::Machine::initializeCallFrame):
1529 Tweaked to account for registerOffset supplied by caller:
1530 (JSC::slideRegisterWindowForCall):
1532 Tweaked to account for new register layout:
1533 (JSC::scopeChainForCall):
1534 (JSC::Machine::callEval):
1535 (JSC::Machine::dumpRegisters):
1536 (JSC::Machine::unwindCallFrame):
1537 (JSC::Machine::execute):
1539 Changed op_call and op_construct to implement the new calling convention:
1540 (JSC::Machine::privateExecute):
1542 Tweaked to account for the new register layout:
1543 (JSC::Machine::retrieveArguments):
1544 (JSC::Machine::retrieveCaller):
1545 (JSC::Machine::retrieveLastCaller):
1546 (JSC::Machine::callFrame):
1547 (JSC::Machine::getArgumentsData):
1549 Changed CTI call helpers to implement the new calling convention:
1550 (JSC::Machine::cti_op_call_JSFunction):
1551 (JSC::Machine::cti_op_call_NotJSFunction):
1552 (JSC::Machine::cti_op_ret_activation):
1553 (JSC::Machine::cti_op_ret_profiler):
1554 (JSC::Machine::cti_op_construct_JSConstruct):
1555 (JSC::Machine::cti_op_construct_NotJSConstruct):
1556 (JSC::Machine::cti_op_call_eval):
1562 Renamed op_initialise_locals to op_init, because this opcode
1563 doesn't initialize all locals, and it doesn't initialize only locals.
1564 Also, to spite Oliver.
1566 * VM/RegisterFile.h:
1568 New call frame enumeration values:
1569 (JSC::RegisterFile::):
1571 Simplified the calculation of whether a RegisterID is a temporary,
1572 since we can no longer assume that all positive non-constant registers
1575 (JSC::RegisterID::RegisterID):
1576 (JSC::RegisterID::setTemporary):
1577 (JSC::RegisterID::isTemporary):
1579 Renamed firstArgumentIndex to firstParameterIndex because the assumption
1580 that this variable pertained to the actual arguments supplied by the
1581 caller caused me to write some buggy code:
1582 * kjs/Arguments.cpp:
1583 (JSC::ArgumentsData::ArgumentsData):
1584 (JSC::Arguments::Arguments):
1585 (JSC::Arguments::fillArgList):
1586 (JSC::Arguments::getOwnPropertySlot):
1587 (JSC::Arguments::put):
1589 Updated for new call frame layout:
1590 * kjs/DebuggerCallFrame.cpp:
1591 (JSC::DebuggerCallFrame::functionName):
1592 (JSC::DebuggerCallFrame::type):
1593 * kjs/DebuggerCallFrame.h:
1595 Changed the activation object to account for the fact that a call frame
1596 header now sits between parameters and local variables. This change
1597 requires all variable objects to do their own marking, since they
1598 now use their register storage differently:
1599 * kjs/JSActivation.cpp:
1600 (JSC::JSActivation::mark):
1601 (JSC::JSActivation::copyRegisters):
1602 (JSC::JSActivation::createArgumentsObject):
1603 * kjs/JSActivation.h:
1605 Updated global object to use the new interfaces required by the change
1606 to JSActivation above:
1607 * kjs/JSGlobalObject.cpp:
1608 (JSC::JSGlobalObject::reset):
1609 (JSC::JSGlobalObject::mark):
1610 (JSC::JSGlobalObject::copyGlobalsFrom):
1611 (JSC::JSGlobalObject::copyGlobalsTo):
1612 * kjs/JSGlobalObject.h:
1613 (JSC::JSGlobalObject::addStaticGlobals):
1615 Updated static scope object to use the new interfaces required by the
1616 change to JSActivation above:
1617 * kjs/JSStaticScopeObject.cpp:
1618 (JSC::JSStaticScopeObject::mark):
1619 (JSC::JSStaticScopeObject::~JSStaticScopeObject):
1620 * kjs/JSStaticScopeObject.h:
1621 (JSC::JSStaticScopeObject::JSStaticScopeObject):
1622 (JSC::JSStaticScopeObject::d):
1624 Updated variable object to use the new interfaces required by the
1625 change to JSActivation above:
1626 * kjs/JSVariableObject.cpp:
1627 (JSC::JSVariableObject::copyRegisterArray):
1628 (JSC::JSVariableObject::setRegisters):
1629 * kjs/JSVariableObject.h:
1631 Changed the bit twiddling in symbol table not to assume that all indices
1632 are negative, since they can be positive now:
1633 * kjs/SymbolTable.h:
1634 (JSC::SymbolTableEntry::SymbolTableEntry):
1635 (JSC::SymbolTableEntry::isNull):
1636 (JSC::SymbolTableEntry::getIndex):
1637 (JSC::SymbolTableEntry::getAttributes):
1638 (JSC::SymbolTableEntry::setAttributes):
1639 (JSC::SymbolTableEntry::isReadOnly):
1640 (JSC::SymbolTableEntry::pack):
1641 (JSC::SymbolTableEntry::isValidIndex):
1643 Changed call and construct nodes to ref their functions and/or bases,
1644 so that emitCall/emitConstruct doesn't overwrite them with parameters.
1645 Also, updated for rename to registerFor:
1647 (JSC::ResolveNode::emitCode):
1648 (JSC::NewExprNode::emitCode):
1649 (JSC::EvalFunctionCallNode::emitCode):
1650 (JSC::FunctionCallValueNode::emitCode):
1651 (JSC::FunctionCallResolveNode::emitCode):
1652 (JSC::FunctionCallBracketNode::emitCode):
1653 (JSC::FunctionCallDotNode::emitCode):
1654 (JSC::PostfixResolveNode::emitCode):
1655 (JSC::DeleteResolveNode::emitCode):
1656 (JSC::TypeOfResolveNode::emitCode):
1657 (JSC::PrefixResolveNode::emitCode):
1658 (JSC::ReadModifyResolveNode::emitCode):
1659 (JSC::AssignResolveNode::emitCode):
1660 (JSC::ConstDeclNode::emitCodeSingle):
1661 (JSC::ForInNode::emitCode):
1663 Added abstraction for getting exception info out of a call through a
1665 * masm/X86Assembler.h:
1666 (JSC::X86Assembler::emitCall):
1668 Removed duplicate #if:
1671 2008-09-23 Kevin McCullough <kmccullough@apple.com>
1675 Bug 21030: The JS debugger breaks on the do of a do-while not the while
1676 (where the conditional statement is)
1677 https://bugs.webkit.org/show_bug.cgi?id=21030
1678 Now the statementListEmitCode detects if a do-while node is being
1679 emited and emits the debug hook on the last line instead of the first.
1681 This change had no effect on sunspider.
1684 (JSC::statementListEmitCode):
1686 (JSC::StatementNode::isDoWhile):
1687 (JSC::DoWhileNode::isDoWhile):
1689 2008-09-23 Maciej Stachowiak <mjs@apple.com>
1691 Reviewed by Camron Zwarich.
1693 - inline the fast case of instanceof
1694 https://bugs.webkit.org/show_bug.cgi?id=20818
1696 ~2% speedup on EarleyBoyer test.
1699 (JSC::CTI::privateCompileMainPass):
1700 (JSC::CTI::privateCompileSlowCases):
1702 (JSC::Machine::cti_op_instanceof):
1704 2008-09-23 Maciej Stachowiak <mjs@apple.com>
1706 Reviewed by Cameron Zwarich.
1708 - add forgotten slow case logic for !==
1711 (JSC::CTI::privateCompileSlowCases):
1713 2008-09-23 Maciej Stachowiak <mjs@apple.com>
1715 Reviewed by Cameron Zwarich.
1717 - inline the fast cases of !==, same as for ===
1719 2.9% speedup on EarleyBoyer benchmark
1722 (JSC::CTI::compileOpStrictEq): Factored stricteq codegen into this function,
1723 and parameterized so it can do the reverse version as well.
1724 (JSC::CTI::privateCompileMainPass): Use the above for stricteq and nstricteq.
1726 (JSC::CTI::): Declare above stuff.
1728 (JSC::Machine::cti_op_nstricteq): Removed fast cases, now handled inline.
1730 2008-09-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1732 Reviewed by Oliver Hunt.
1734 Bug 20989: Aguments constructor should put 'callee' and 'length' properties in a more efficient way
1735 <https://bugs.webkit.org/show_bug.cgi?id=20989>
1737 Make special cases for the 'callee' and 'length' properties in the
1740 This is somewhere between a 7.8% speedup and a 10% speedup on the V8
1741 Raytrace benchmark, depending on whether it is run alone or with the
1742 other V8 benchmarks.
1744 * kjs/Arguments.cpp:
1745 (JSC::ArgumentsData::ArgumentsData):
1746 (JSC::Arguments::Arguments):
1747 (JSC::Arguments::mark):
1748 (JSC::Arguments::getOwnPropertySlot):
1749 (JSC::Arguments::put):
1750 (JSC::Arguments::deleteProperty):
1752 2008-09-23 Maciej Stachowiak <mjs@apple.com>
1756 - speed up instanceof some more
1757 https://bugs.webkit.org/show_bug.cgi?id=20818
1759 ~2% speedup on EarleyBoyer
1761 The idea here is to record in the StructureID whether the class
1762 needs a special hasInstance or if it can use the normal logic from
1765 Based on this I inlined the real work directly into
1766 cti_op_instanceof and put the fastest checks up front and the
1767 error handling at the end (so it should be fairly straightforward
1768 to split off the beginning to be inlined if desired).
1770 I only did this for CTI, not the bytecode interpreter.
1772 * API/JSCallbackObject.h:
1773 (JSC::JSCallbackObject::createStructureID):
1776 (JSC::Machine::cti_op_instanceof):
1777 * kjs/JSImmediate.h:
1778 (JSC::JSImmediate::isAnyImmediate):
1780 (JSC::TypeInfo::overridesHasInstance):
1781 (JSC::TypeInfo::flags):
1783 2008-09-22 Darin Adler <darin@apple.com>
1785 Reviewed by Sam Weinig.
1787 - https://bugs.webkit.org/show_bug.cgi?id=21019
1788 make FunctionBodyNode::ref/deref fast
1790 Speeds up v8-raytrace by 7.2%.
1793 (JSC::FunctionBodyNode::FunctionBodyNode): Initialize m_refCount to 0.
1795 (JSC::FunctionBodyNode::ref): Call base class ref once, and thereafter use
1797 (JSC::FunctionBodyNode::deref): Ditto, but the deref side.
1799 2008-09-22 Darin Adler <darin@apple.com>
1801 Pointed out by Sam Weinig.
1803 * kjs/Arguments.cpp:
1804 (JSC::Arguments::fillArgList): Fix bad copy and paste. Oops!
1806 2008-09-22 Darin Adler <darin@apple.com>
1808 Reviewed by Cameron Zwarich.
1810 - https://bugs.webkit.org/show_bug.cgi?id=20983
1811 ArgumentsData should have some room to allocate some extra arguments inline
1813 Speeds up v8-raytrace by 5%.
1815 * kjs/Arguments.cpp:
1816 (JSC::ArgumentsData::ArgumentsData): Use a fixed buffer if there are 4 or fewer
1818 (JSC::Arguments::Arguments): Use a fixed buffer if there are 4 or fewer
1820 (JSC::Arguments::~Arguments): Delete the buffer if necessary.
1821 (JSC::Arguments::mark): Update since extraArguments are now Register.
1822 (JSC::Arguments::fillArgList): Added special case for the only case that's
1823 actually used in the practice, when there are no parameters. There are some
1824 other special cases in there too, but that's the only one that matters.
1825 (JSC::Arguments::getOwnPropertySlot): Updated to use setValueSlot since there's
1826 no operation to get you at the JSValue* inside a Register as a "slot".
1828 2008-09-22 Sam Weinig <sam@webkit.org>
1830 Reviewed by Maciej Stachowiak.
1832 Patch for https://bugs.webkit.org/show_bug.cgi?id=21014
1833 Speed up for..in by using StructureID to avoid calls to hasProperty
1835 Speeds up fasta by 8%.
1837 * VM/JSPropertyNameIterator.cpp:
1838 (JSC::JSPropertyNameIterator::invalidate):
1839 * VM/JSPropertyNameIterator.h:
1840 (JSC::JSPropertyNameIterator::next):
1841 * kjs/PropertyNameArray.h:
1842 (JSC::PropertyNameArrayData::begin):
1843 (JSC::PropertyNameArrayData::end):
1844 (JSC::PropertyNameArrayData::setCachedStructureID):
1845 (JSC::PropertyNameArrayData::cachedStructureID):
1846 * kjs/StructureID.cpp:
1847 (JSC::StructureID::getEnumerablePropertyNames):
1848 (JSC::structureIDChainsAreEqual):
1849 * kjs/StructureID.h:
1851 2008-09-22 Kelvin Sherlock <ksherlock@gmail.com>
1853 Updated and tweaked by Sam Weinig.
1855 Reviewed by Geoffrey Garen.
1857 Bug 20020: Proposed enhancement to JavaScriptCore API
1858 <https://bugs.webkit.org/show_bug.cgi?id=20020>
1860 Add JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError, and JSObjectMakeRegExp
1861 functions to create JavaScript Array, Date, Error, and RegExp objects, respectively.
1863 * API/JSObjectRef.cpp: The functions
1864 * API/JSObjectRef.h: Function prototype and documentation
1865 * JavaScriptCore.exp: Added functions to exported function list
1866 * API/tests/testapi.c: Added basic functionality tests.
1868 * kjs/DateConstructor.cpp:
1869 Replaced static JSObject* constructDate(ExecState* exec, JSObject*, const ArgList& args)
1870 with JSObject* constructDate(ExecState* exec, const ArgList& args).
1871 Added static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) function
1873 * kjs/DateConstructor.h:
1874 added prototype for JSObject* constructDate(ExecState* exec, const ArgList& args)
1876 * kjs/ErrorConstructor.cpp:
1877 removed static qualifier from ErrorInstance* constructError(ExecState* exec, const ArgList& args)
1879 * kjs/ErrorConstructor.h:
1880 added prototype for ErrorInstance* constructError(ExecState* exec, const ArgList& args)
1882 * kjs/RegExpConstructor.cpp:
1883 removed static qualifier from JSObject* constructRegExp(ExecState* exec, const ArgList& args)
1885 * kjs/RegExpConstructor.h:
1886 added prototype for JSObject* constructRegExp(ExecState* exec, const ArgList& args)
1888 2008-09-22 Matt Lilek <webkit@mattlilek.com>
1890 Not reviewed, Windows build fix.
1892 * kjs/Arguments.cpp:
1893 * kjs/FunctionPrototype.cpp:
1895 2008-09-22 Sam Weinig <sam@webkit.org>
1897 Reviewed by Darin Adler.
1899 Patch for https://bugs.webkit.org/show_bug.cgi?id=20982
1900 Speed up the apply method of functions by special-casing array and 'arguments' objects
1902 1% speedup on v8-raytrace.
1904 Test: fast/js/function-apply.html
1906 * kjs/Arguments.cpp:
1907 (JSC::Arguments::fillArgList):
1909 * kjs/FunctionPrototype.cpp:
1910 (JSC::functionProtoFuncApply):
1912 (JSC::JSArray::fillArgList):
1915 2008-09-22 Darin Adler <darin@apple.com>
1917 Reviewed by Sam Weinig.
1919 - https://bugs.webkit.org/show_bug.cgi?id=20993
1920 Array.push/pop need optimized cases for JSArray
1922 3% or so speedup on DeltaBlue benchmark.
1924 * kjs/ArrayPrototype.cpp:
1925 (JSC::arrayProtoFuncPop): Call JSArray::pop when appropriate.
1926 (JSC::arrayProtoFuncPush): Call JSArray::push when appropriate.
1929 (JSC::JSArray::putSlowCase): Set m_fastAccessCutoff when appropriate, getting
1930 us into the fast code path.
1931 (JSC::JSArray::pop): Added.
1932 (JSC::JSArray::push): Added.
1933 * kjs/JSArray.h: Added push and pop.
1935 * kjs/operations.cpp:
1936 (JSC::throwOutOfMemoryError): Don't inline this. Helps us avoid PIC branches.
1938 2008-09-22 Maciej Stachowiak <mjs@apple.com>
1940 Reviewed by Cameron Zwarich.
1942 - speed up instanceof operator by replacing implementsHasInstance method with a TypeInfo flag
1944 Partial work towards <https://bugs.webkit.org/show_bug.cgi?id=20818>
1946 2.2% speedup on EarleyBoyer benchmark.
1948 * API/JSCallbackConstructor.cpp:
1949 * API/JSCallbackConstructor.h:
1950 (JSC::JSCallbackConstructor::createStructureID):
1951 * API/JSCallbackFunction.cpp:
1952 * API/JSCallbackFunction.h:
1953 (JSC::JSCallbackFunction::createStructureID):
1954 * API/JSCallbackObject.h:
1955 (JSC::JSCallbackObject::createStructureID):
1956 * API/JSCallbackObjectFunctions.h:
1957 (JSC::::hasInstance):
1958 * API/JSValueRef.cpp:
1959 (JSValueIsInstanceOfConstructor):
1960 * JavaScriptCore.exp:
1962 (JSC::Machine::privateExecute):
1963 (JSC::Machine::cti_op_instanceof):
1964 * kjs/InternalFunction.cpp:
1965 * kjs/InternalFunction.h:
1966 (JSC::InternalFunction::createStructureID):
1970 (JSC::TypeInfo::implementsHasInstance):
1972 2008-09-22 Maciej Stachowiak <mjs@apple.com>
1974 Reviewed by Dave Hyatt.
1976 Based on initial work by Darin Adler.
1978 - replace masqueradesAsUndefined virtual method with a flag in TypeInfo
1979 - use this to JIT inline code for eq_null and neq_null
1980 https://bugs.webkit.org/show_bug.cgi?id=20823
1982 0.5% speedup on SunSpider
1983 ~4% speedup on Richards benchmark
1986 (JSC::CTI::privateCompileMainPass):
1988 (JSC::jsTypeStringForValue):
1989 (JSC::jsIsObjectType):
1990 (JSC::Machine::privateExecute):
1991 (JSC::Machine::cti_op_is_undefined):
1995 * kjs/StringObjectThatMasqueradesAsUndefined.h:
1996 (JSC::StringObjectThatMasqueradesAsUndefined::create):
1997 (JSC::StringObjectThatMasqueradesAsUndefined::createStructureID):
1998 * kjs/StructureID.h:
1999 (JSC::StructureID::mutableTypeInfo):
2001 (JSC::TypeInfo::TypeInfo):
2002 (JSC::TypeInfo::masqueradesAsUndefined):
2003 * kjs/operations.cpp:
2005 * masm/X86Assembler.h:
2006 (JSC::X86Assembler::):
2007 (JSC::X86Assembler::setne_r):
2008 (JSC::X86Assembler::setnz_r):
2009 (JSC::X86Assembler::testl_i32m):
2011 2008-09-22 Tor Arne Vestbø <tavestbo@trolltech.com>
2015 Initialize QCoreApplication in kjs binary/Shell.cpp
2017 This allows us to use QCoreApplication::instance() to
2018 get the main thread in ThreadingQt.cpp
2022 * wtf/ThreadingQt.cpp:
2023 (WTF::initializeThreading):
2025 2008-09-21 Darin Adler <darin@apple.com>
2027 - blind attempt to fix non-all-in-one builds
2029 * kjs/JSGlobalObject.cpp: Added includes of Arguments.h and RegExpObject.h.
2031 2008-09-21 Darin Adler <darin@apple.com>
2035 * kjs/StructureID.cpp:
2036 (JSC::StructureID::addPropertyTransition): Use typeInfo().type() instead of m_type.
2037 (JSC::StructureID::createCachedPrototypeChain): Ditto.
2039 2008-09-21 Maciej Stachowiak <mjs@apple.com>
2041 Reviewed by Darin Adler.
2043 - introduce a TypeInfo class, for holding per-type (in the C++ class sense) date in StructureID
2044 https://bugs.webkit.org/show_bug.cgi?id=20981
2046 * JavaScriptCore.exp:
2047 * JavaScriptCore.xcodeproj/project.pbxproj:
2049 (JSC::CTI::privateCompileMainPass):
2050 (JSC::CTI::privateCompilePutByIdTransition):
2052 (JSC::jsIsObjectType):
2053 (JSC::Machine::Machine):
2054 * kjs/AllInOneFile.cpp:
2056 (JSC::JSCell::isObject):
2057 (JSC::JSCell::isString):
2058 * kjs/JSGlobalData.cpp:
2059 (JSC::JSGlobalData::JSGlobalData):
2060 * kjs/JSGlobalObject.cpp:
2061 (JSC::JSGlobalObject::reset):
2062 * kjs/JSGlobalObject.h:
2063 (JSC::StructureID::prototypeForLookup):
2064 * kjs/JSNumberCell.h:
2065 (JSC::JSNumberCell::createStructureID):
2067 (JSC::JSObject::createInheritorID):
2069 (JSC::JSObject::createStructureID):
2071 (JSC::JSString::createStructureID):
2072 * kjs/NativeErrorConstructor.cpp:
2073 (JSC::NativeErrorConstructor::NativeErrorConstructor):
2074 * kjs/RegExpConstructor.cpp:
2075 * kjs/RegExpMatchesArray.h: Added.
2076 (JSC::RegExpMatchesArray::getOwnPropertySlot):
2077 (JSC::RegExpMatchesArray::put):
2078 (JSC::RegExpMatchesArray::deleteProperty):
2079 (JSC::RegExpMatchesArray::getPropertyNames):
2080 * kjs/StructureID.cpp:
2081 (JSC::StructureID::StructureID):
2082 (JSC::StructureID::addPropertyTransition):
2083 (JSC::StructureID::toDictionaryTransition):
2084 (JSC::StructureID::changePrototypeTransition):
2085 (JSC::StructureID::getterSetterTransition):
2086 * kjs/StructureID.h:
2087 (JSC::StructureID::create):
2088 (JSC::StructureID::typeInfo):
2089 * kjs/TypeInfo.h: Added.
2090 (JSC::TypeInfo::TypeInfo):
2091 (JSC::TypeInfo::type):
2093 2008-09-21 Darin Adler <darin@apple.com>
2095 Reviewed by Cameron Zwarich.
2097 - fix crash logging into Gmail due to recent Arguments change
2099 * kjs/Arguments.cpp:
2100 (JSC::Arguments::Arguments): Fix window where mark() function could
2101 see d->extraArguments with uninitialized contents.
2102 (JSC::Arguments::mark): Check d->extraArguments for 0 to handle two
2103 cases: 1) Inside the constructor before it's initialized.
2104 2) numArguments <= numParameters.
2106 2008-09-21 Darin Adler <darin@apple.com>
2108 - fix loose end from the "duplicate constant values" patch
2110 * VM/CodeGenerator.cpp:
2111 (JSC::CodeGenerator::emitLoad): Add a special case for values the
2112 hash table can't handle.
2114 2008-09-21 Mark Rowe <mrowe@apple.com>
2116 Fix the non-AllInOneFile build.
2118 * kjs/Arguments.cpp: Add missing #include.
2120 2008-09-21 Darin Adler <darin@apple.com>
2122 Reviewed by Cameron Zwarich and Mark Rowe.
2124 - fix test failure caused by my recent IndexToNameMap patch
2126 * kjs/Arguments.cpp:
2127 (JSC::Arguments::deleteProperty): Added the accidentally-omitted
2128 check of the boolean result from toArrayIndex.
2130 2008-09-21 Darin Adler <darin@apple.com>
2132 Reviewed by Maciej Stachowiak.
2134 - https://bugs.webkit.org/show_bug.cgi?id=20975
2135 inline immediate-number case of ==
2137 * VM/CTI.h: Renamed emitJumpSlowCaseIfNotImm to
2138 emitJumpSlowCaseIfNotImmNum, since the old name was incorrect.
2140 * VM/CTI.cpp: Updated for new name.
2141 (JSC::CTI::privateCompileMainPass): Added op_eq.
2142 (JSC::CTI::privateCompileSlowCases): Added op_eq.
2145 (JSC::Machine::cti_op_eq): Removed fast case, since it's now
2148 2008-09-21 Peter Gal <galpter@inf.u-szeged.hu>
2150 Reviewed by Tim Hatcher and Eric Seidel.
2152 Fix the QT/Linux JavaScriptCore segmentation fault.
2153 https://bugs.webkit.org/show_bug.cgi?id=20914
2155 * wtf/ThreadingQt.cpp:
2156 (WTF::initializeThreading): Use currentThread() if
2157 platform is not a MAC (like in pre 36541 revisions)
2159 2008-09-21 Darin Adler <darin@apple.com>
2161 Reviewed by Sam Weinig.
2163 * kjs/debugger.h: Removed some unneeded includes and declarations.
2165 2008-09-21 Darin Adler <darin@apple.com>
2167 Reviewed by Sam Weinig.
2169 - https://bugs.webkit.org/show_bug.cgi?id=20972
2170 speed up Arguments further by eliminating the IndexToNameMap
2172 No change on SunSpider. 1.29x as fast on V8 Raytrace.
2174 * kjs/Arguments.cpp: Moved ArgumentsData in here. Eliminated the
2175 indexToNameMap and hadDeletes data members. Changed extraArguments into
2176 an OwnArrayPtr and added deletedArguments, another OwnArrayPtr.
2177 Replaced numExtraArguments with numParameters, since that's what's
2178 used more directly in hot code paths.
2179 (JSC::Arguments::Arguments): Pass in argument count instead of ArgList.
2180 Initialize ArgumentsData the new way.
2181 (JSC::Arguments::mark): Updated.
2182 (JSC::Arguments::getOwnPropertySlot): Overload for the integer form so
2183 we don't have to convert integers to identifiers just to get an argument.
2184 Integrated the deleted case with the fast case.
2185 (JSC::Arguments::put): Ditto.
2186 (JSC::Arguments::deleteProperty): Ditto.
2188 * kjs/Arguments.h: Minimized includes. Made everything private. Added
2189 overloads for the integral property name case. Eliminated mappedIndexSetter.
2190 Moved ArgumentsData into the .cpp file.
2192 * kjs/IndexToNameMap.cpp: Emptied out and prepared for deletion.
2193 * kjs/IndexToNameMap.h: Ditto.
2195 * kjs/JSActivation.cpp:
2196 (JSC::JSActivation::createArgumentsObject): Elminated ArgList.
2199 * JavaScriptCore.pri:
2200 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2201 * JavaScriptCore.xcodeproj/project.pbxproj:
2202 * JavaScriptCoreSources.bkl:
2203 * kjs/AllInOneFile.cpp:
2204 Removed IndexToNameMap.
2206 2008-09-21 Darin Adler <darin@apple.com>
2208 * VM/CodeGenerator.cpp:
2209 (JSC::CodeGenerator::emitLoad): One more tweak: Wrote this in a slightly
2212 2008-09-21 Judit Jasz <jasy@inf.u-szeged.hu>
2214 Reviewed and tweaked by Darin Adler.
2216 - https://bugs.webkit.org/show_bug.cgi?id=20645
2217 Elminate duplicate constant values in CodeBlocks.
2219 Seems to be a wash on SunSpider.
2221 * VM/CodeGenerator.cpp:
2222 (JSC::CodeGenerator::emitLoad): Use m_numberMap and m_stringMap to guarantee
2223 we emit the same JSValue* for identical numbers and strings.
2224 * VM/CodeGenerator.h: Added overload of emitLoad for const Identifier&.
2225 Add NumberMap and IdentifierStringMap types and m_numberMap and m_stringMap.
2227 (JSC::StringNode::emitCode): Call the new emitLoad and let it do the
2230 2008-09-21 Paul Pedriana <webkit@pedriana.com>
2232 Reviewed and tweaked by Darin Adler.
2234 - https://bugs.webkit.org/show_bug.cgi?id=16925
2235 Fixed lack of Vector buffer alignment for both GCC and MSVC.
2236 Since there's no portable way to do this, for now we don't support
2239 * wtf/Vector.h: Added WTF_ALIGH_ON, WTF_ALIGNED, AlignedBufferChar, and AlignedBuffer.
2240 Use AlignedBuffer insteadof an array of char in VectorBuffer.
2242 2008-09-21 Gabor Loki <loki@inf.u-szeged.hu>
2244 Reviewed by Darin Adler.
2246 - https://bugs.webkit.org/show_bug.cgi?id=19408
2247 Add lightweight constant folding to the parser for *, /, + (only for numbers), <<, >>, ~ operators.
2249 1.008x as fast on SunSpider.
2252 (makeNegateNode): Fold if expression is a number > 0.
2253 (makeBitwiseNotNode): Fold if expression is a number.
2254 (makeMultNode): Fold if expressions are both numbers.
2255 (makeDivNode): Fold if expressions are both numbers.
2256 (makeAddNode): Fold if expressions are both numbers.
2257 (makeLeftShiftNode): Fold if expressions are both numbers.
2258 (makeRightShiftNode): Fold if expressions are both numbers.
2260 2008-09-21 Maciej Stachowiak <mjs@apple.com>
2264 - speed up === operator by generating inline machine code for the fast paths
2265 https://bugs.webkit.org/show_bug.cgi?id=20820
2268 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumber):
2269 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumbers):
2270 (JSC::CTI::emitJumpSlowCaseIfNotImmediates):
2271 (JSC::CTI::emitTagAsBoolImmediate):
2272 (JSC::CTI::privateCompileMainPass):
2273 (JSC::CTI::privateCompileSlowCases):
2276 (JSC::Machine::cti_op_stricteq):
2277 * masm/X86Assembler.h:
2278 (JSC::X86Assembler::):
2279 (JSC::X86Assembler::sete_r):
2280 (JSC::X86Assembler::setz_r):
2281 (JSC::X86Assembler::movzbl_rr):
2282 (JSC::X86Assembler::emitUnlinkedJnz):
2284 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2286 Reviewed by Maciej Stachowiak.
2288 Free memory allocated for extra arguments in the destructor of the
2291 * kjs/Arguments.cpp:
2292 (JSC::Arguments::~Arguments):
2295 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2297 Reviewed by Maciej Stachowiak.
2299 Bug 20815: 'arguments' object creation is non-optimal
2300 <https://bugs.webkit.org/show_bug.cgi?id=20815>
2302 Fix our inefficient way of creating the arguments object by only
2303 creating named properties for each of the arguments after a use of the
2304 'delete' statement. This patch also speeds up access to the 'arguments'
2305 object slightly, but it still does not use the array fast path for
2306 indexed access that exists for many opcodes.
2308 This is about a 20% improvement on the V8 Raytrace benchmark, and a 1.5%
2309 improvement on the Earley-Boyer benchmark, which gives a 4% improvement
2312 * kjs/Arguments.cpp:
2313 (JSC::Arguments::Arguments):
2314 (JSC::Arguments::mark):
2315 (JSC::Arguments::getOwnPropertySlot):
2316 (JSC::Arguments::put):
2317 (JSC::Arguments::deleteProperty):
2319 (JSC::Arguments::ArgumentsData::ArgumentsData):
2320 * kjs/IndexToNameMap.h:
2321 (JSC::IndexToNameMap::size):
2322 * kjs/JSActivation.cpp:
2323 (JSC::JSActivation::createArgumentsObject):
2324 * kjs/JSActivation.h:
2325 (JSC::JSActivation::uncheckedSymbolTableGet):
2326 (JSC::JSActivation::uncheckedSymbolTableGetValue):
2327 (JSC::JSActivation::uncheckedSymbolTablePut):
2329 (JSC::JSFunction::numParameters):
2331 2008-09-20 Darin Adler <darin@apple.com>
2333 Reviewed by Mark Rowe.
2335 - fix crash seen on buildbot
2337 * kjs/JSGlobalObject.cpp:
2338 (JSC::JSGlobalObject::mark): Add back mark of arrayPrototype,
2339 deleted by accident in my recent check-in.
2341 2008-09-20 Maciej Stachowiak <mjs@apple.com>
2343 Not reviewed, build fix.
2345 - speculative fix for non-AllInOne builds
2349 2008-09-20 Maciej Stachowiak <mjs@apple.com>
2351 Reviewed by Darin Adler.
2353 - assorted optimizations to === and !== operators
2354 (work towards <https://bugs.webkit.org/show_bug.cgi?id=20820>)
2356 2.5% speedup on earley-boyer test
2359 (JSC::Machine::cti_op_stricteq): Use inline version of
2360 strictEqualSlowCase; remove unneeded exception check.
2361 (JSC::Machine::cti_op_nstricteq): ditto
2362 * kjs/operations.cpp:
2363 (JSC::strictEqual): Use strictEqualSlowCaseInline
2364 (JSC::strictEqualSlowCase): ditto
2366 (JSC::strictEqualSlowCaseInline): Version of strictEqualSlowCase that can be inlined,
2367 since the extra function call indirection is a lose for CTI.
2369 2008-09-20 Darin Adler <darin@apple.com>
2371 Reviewed by Maciej Stachowiak.
2373 - finish https://bugs.webkit.org/show_bug.cgi?id=20858
2374 make each distinct C++ class get a distinct JSC::Structure
2376 This also includes some optimizations that make the change an overall
2377 small speedup. Without those it was a bit of a slowdown.
2379 * API/JSCallbackConstructor.cpp:
2380 (JSC::JSCallbackConstructor::JSCallbackConstructor): Take a structure.
2381 * API/JSCallbackConstructor.h: Ditto.
2382 * API/JSCallbackFunction.cpp:
2383 (JSC::JSCallbackFunction::JSCallbackFunction): Pass a structure.
2384 * API/JSCallbackObject.h: Take a structure.
2385 * API/JSCallbackObjectFunctions.h:
2386 (JSC::JSCallbackObject::JSCallbackObject): Ditto.
2388 * API/JSClassRef.cpp:
2389 (OpaqueJSClass::prototype): Pass in a structure. Call setPrototype
2390 if there's a custom prototype involved.
2391 * API/JSObjectRef.cpp:
2392 (JSObjectMake): Ditto.
2393 (JSObjectMakeConstructor): Pass in a structure.
2395 * JavaScriptCore.exp: Updated.
2398 (JSC::jsLess): Added a special case for when both arguments are strings.
2399 This avoids converting both strings to with UString::toDouble.
2400 (JSC::jsLessEq): Ditto.
2401 (JSC::Machine::privateExecute): Pass in a structure.
2402 (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
2403 (JSC::Machine::cti_op_new_regexp): Ditto.
2404 (JSC::Machine::cti_op_is_string): Ditto.
2405 * VM/Machine.h: Made isJSString public so it can be used in the CTI.
2407 * kjs/Arguments.cpp:
2408 (JSC::Arguments::Arguments): Pass in a structure.
2410 * kjs/JSCell.h: Mark constructor explicit.
2412 * kjs/JSGlobalObject.cpp:
2413 (JSC::markIfNeeded): Added an overload for marking structures.
2414 (JSC::JSGlobalObject::reset): Eliminate code to set data members to
2415 zero. We now do that in the constructor, and we no longer use this
2416 anywhere except in the constructor. Added code to create structures.
2417 Pass structures rather than prototypes when creating objects.
2418 (JSC::JSGlobalObject::mark): Mark the structures.
2420 * kjs/JSGlobalObject.h: Removed unneeded class declarations.
2421 Added initializers for raw pointers in JSGlobalObjectData so
2422 everything starts with a 0. Added structure data and accessor
2425 * kjs/JSImmediate.cpp:
2426 (JSC::JSImmediate::nonInlineNaN): Added.
2427 * kjs/JSImmediate.h:
2428 (JSC::JSImmediate::toDouble): Rewrote to avoid PIC branches.
2430 * kjs/JSNumberCell.cpp:
2431 (JSC::jsNumberCell): Made non-inline to avoid PIC branches
2432 in functions that call this one.
2433 (JSC::jsNaN): Ditto.
2434 * kjs/JSNumberCell.h: Ditto.
2436 * kjs/JSObject.h: Removed constructor that takes a prototype.
2437 All callers now pass structures.
2439 * kjs/ArrayConstructor.cpp:
2440 (JSC::ArrayConstructor::ArrayConstructor):
2441 (JSC::constructArrayWithSizeQuirk):
2442 * kjs/ArrayConstructor.h:
2443 * kjs/ArrayPrototype.cpp:
2444 (JSC::ArrayPrototype::ArrayPrototype):
2445 * kjs/ArrayPrototype.h:
2446 * kjs/BooleanConstructor.cpp:
2447 (JSC::BooleanConstructor::BooleanConstructor):
2448 (JSC::constructBoolean):
2449 (JSC::constructBooleanFromImmediateBoolean):
2450 * kjs/BooleanConstructor.h:
2451 * kjs/BooleanObject.cpp:
2452 (JSC::BooleanObject::BooleanObject):
2453 * kjs/BooleanObject.h:
2454 * kjs/BooleanPrototype.cpp:
2455 (JSC::BooleanPrototype::BooleanPrototype):
2456 * kjs/BooleanPrototype.h:
2457 * kjs/DateConstructor.cpp:
2458 (JSC::DateConstructor::DateConstructor):
2459 (JSC::constructDate):
2460 * kjs/DateConstructor.h:
2461 * kjs/DateInstance.cpp:
2462 (JSC::DateInstance::DateInstance):
2463 * kjs/DateInstance.h:
2464 * kjs/DatePrototype.cpp:
2465 (JSC::DatePrototype::DatePrototype):
2466 * kjs/DatePrototype.h:
2467 * kjs/ErrorConstructor.cpp:
2468 (JSC::ErrorConstructor::ErrorConstructor):
2469 (JSC::constructError):
2470 * kjs/ErrorConstructor.h:
2471 * kjs/ErrorInstance.cpp:
2472 (JSC::ErrorInstance::ErrorInstance):
2473 * kjs/ErrorInstance.h:
2474 * kjs/ErrorPrototype.cpp:
2475 (JSC::ErrorPrototype::ErrorPrototype):
2476 * kjs/ErrorPrototype.h:
2477 * kjs/FunctionConstructor.cpp:
2478 (JSC::FunctionConstructor::FunctionConstructor):
2479 * kjs/FunctionConstructor.h:
2480 * kjs/FunctionPrototype.cpp:
2481 (JSC::FunctionPrototype::FunctionPrototype):
2482 (JSC::FunctionPrototype::addFunctionProperties):
2483 * kjs/FunctionPrototype.h:
2484 * kjs/GlobalEvalFunction.cpp:
2485 (JSC::GlobalEvalFunction::GlobalEvalFunction):
2486 * kjs/GlobalEvalFunction.h:
2487 * kjs/InternalFunction.cpp:
2488 (JSC::InternalFunction::InternalFunction):
2489 * kjs/InternalFunction.h:
2490 (JSC::InternalFunction::InternalFunction):
2492 (JSC::JSArray::JSArray):
2493 (JSC::constructEmptyArray):
2494 (JSC::constructArray):
2496 * kjs/JSFunction.cpp:
2497 (JSC::JSFunction::JSFunction):
2498 (JSC::JSFunction::construct):
2500 (JSC::constructEmptyObject):
2502 (JSC::StringObject::create):
2503 * kjs/JSWrapperObject.h:
2504 * kjs/MathObject.cpp:
2505 (JSC::MathObject::MathObject):
2507 * kjs/NativeErrorConstructor.cpp:
2508 (JSC::NativeErrorConstructor::NativeErrorConstructor):
2509 (JSC::NativeErrorConstructor::construct):
2510 * kjs/NativeErrorConstructor.h:
2511 * kjs/NativeErrorPrototype.cpp:
2512 (JSC::NativeErrorPrototype::NativeErrorPrototype):
2513 * kjs/NativeErrorPrototype.h:
2514 * kjs/NumberConstructor.cpp:
2515 (JSC::NumberConstructor::NumberConstructor):
2516 (JSC::constructWithNumberConstructor):
2517 * kjs/NumberConstructor.h:
2518 * kjs/NumberObject.cpp:
2519 (JSC::NumberObject::NumberObject):
2520 (JSC::constructNumber):
2521 (JSC::constructNumberFromImmediateNumber):
2522 * kjs/NumberObject.h:
2523 * kjs/NumberPrototype.cpp:
2524 (JSC::NumberPrototype::NumberPrototype):
2525 * kjs/NumberPrototype.h:
2526 * kjs/ObjectConstructor.cpp:
2527 (JSC::ObjectConstructor::ObjectConstructor):
2528 (JSC::constructObject):
2529 * kjs/ObjectConstructor.h:
2530 * kjs/ObjectPrototype.cpp:
2531 (JSC::ObjectPrototype::ObjectPrototype):
2532 * kjs/ObjectPrototype.h:
2533 * kjs/PrototypeFunction.cpp:
2534 (JSC::PrototypeFunction::PrototypeFunction):
2535 * kjs/PrototypeFunction.h:
2536 * kjs/RegExpConstructor.cpp:
2537 (JSC::RegExpConstructor::RegExpConstructor):
2538 (JSC::RegExpMatchesArray::RegExpMatchesArray):
2539 (JSC::constructRegExp):
2540 * kjs/RegExpConstructor.h:
2541 * kjs/RegExpObject.cpp:
2542 (JSC::RegExpObject::RegExpObject):
2543 * kjs/RegExpObject.h:
2544 * kjs/RegExpPrototype.cpp:
2545 (JSC::RegExpPrototype::RegExpPrototype):
2546 * kjs/RegExpPrototype.h:
2548 (GlobalObject::GlobalObject):
2549 * kjs/StringConstructor.cpp:
2550 (JSC::StringConstructor::StringConstructor):
2551 (JSC::constructWithStringConstructor):
2552 * kjs/StringConstructor.h:
2553 * kjs/StringObject.cpp:
2554 (JSC::StringObject::StringObject):
2555 * kjs/StringObject.h:
2556 * kjs/StringObjectThatMasqueradesAsUndefined.h:
2557 (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
2558 * kjs/StringPrototype.cpp:
2559 (JSC::StringPrototype::StringPrototype):
2560 * kjs/StringPrototype.h:
2561 Take and pass structures.
2563 2008-09-19 Alp Toker <alp@nuanti.com>
2565 Build fix for the 'gold' linker and recent binutils. New behaviour
2566 requires that we link to used libraries explicitly.
2570 2008-09-19 Sam Weinig <sam@webkit.org>
2572 Roll r36694 back in. It did not cause the crash.
2574 * JavaScriptCore.exp:
2575 * VM/JSPropertyNameIterator.cpp:
2576 (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
2577 (JSC::JSPropertyNameIterator::invalidate):
2578 * VM/JSPropertyNameIterator.h:
2579 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
2580 (JSC::JSPropertyNameIterator::create):
2582 (JSC::JSObject::getPropertyNames):
2583 * kjs/PropertyMap.cpp:
2584 (JSC::PropertyMap::getEnumerablePropertyNames):
2585 * kjs/PropertyMap.h:
2586 * kjs/PropertyNameArray.cpp:
2587 (JSC::PropertyNameArray::add):
2588 * kjs/PropertyNameArray.h:
2589 (JSC::PropertyNameArrayData::create):
2590 (JSC::PropertyNameArrayData::propertyNameVector):
2591 (JSC::PropertyNameArrayData::setCachedPrototypeChain):
2592 (JSC::PropertyNameArrayData::cachedPrototypeChain):
2593 (JSC::PropertyNameArrayData::begin):
2594 (JSC::PropertyNameArrayData::end):
2595 (JSC::PropertyNameArrayData::PropertyNameArrayData):
2596 (JSC::PropertyNameArray::PropertyNameArray):
2597 (JSC::PropertyNameArray::addKnownUnique):
2598 (JSC::PropertyNameArray::size):
2599 (JSC::PropertyNameArray::operator[]):
2600 (JSC::PropertyNameArray::begin):
2601 (JSC::PropertyNameArray::end):
2602 (JSC::PropertyNameArray::setData):
2603 (JSC::PropertyNameArray::data):
2604 (JSC::PropertyNameArray::releaseData):
2605 * kjs/StructureID.cpp:
2606 (JSC::structureIDChainsAreEqual):
2607 (JSC::StructureID::getEnumerablePropertyNames):
2608 (JSC::StructureID::clearEnumerationCache):
2609 (JSC::StructureID::createCachedPrototypeChain):
2610 * kjs/StructureID.h:
2612 2008-09-19 Sam Weinig <sam@webkit.org>
2616 * JavaScriptCore.exp:
2617 * VM/JSPropertyNameIterator.cpp:
2618 (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
2619 (JSC::JSPropertyNameIterator::invalidate):
2620 * VM/JSPropertyNameIterator.h:
2621 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
2622 (JSC::JSPropertyNameIterator::create):
2624 (JSC::JSObject::getPropertyNames):
2625 * kjs/PropertyMap.cpp:
2626 (JSC::PropertyMap::getEnumerablePropertyNames):
2627 * kjs/PropertyMap.h:
2628 * kjs/PropertyNameArray.cpp:
2629 (JSC::PropertyNameArray::add):
2630 * kjs/PropertyNameArray.h:
2631 (JSC::PropertyNameArray::PropertyNameArray):
2632 (JSC::PropertyNameArray::addKnownUnique):
2633 (JSC::PropertyNameArray::begin):
2634 (JSC::PropertyNameArray::end):
2635 (JSC::PropertyNameArray::size):
2636 (JSC::PropertyNameArray::operator[]):
2637 (JSC::PropertyNameArray::releaseIdentifiers):
2638 * kjs/StructureID.cpp:
2639 (JSC::StructureID::getEnumerablePropertyNames):
2640 * kjs/StructureID.h:
2641 (JSC::StructureID::clearEnumerationCache):
2643 2008-09-19 Oliver Hunt <oliver@apple.com>
2645 Reviewed by Maciej Stachowiak.
2647 Improve peformance of local variable initialisation.
2649 Pull local and constant initialisation out of slideRegisterWindowForCall
2650 and into its own opcode. This allows the JIT to generate the initialisation
2651 code for a function directly into the instruction stream and so avoids a few
2652 branches on function entry.
2654 Results a 1% progression in SunSpider, particularly in a number of the bitop
2655 tests where the called functions are very fast.
2658 (JSC::CTI::emitInitialiseRegister):
2659 (JSC::CTI::privateCompileMainPass):
2662 (JSC::CodeBlock::dump):
2663 * VM/CodeGenerator.cpp:
2664 (JSC::CodeGenerator::CodeGenerator):
2666 (JSC::slideRegisterWindowForCall):
2667 (JSC::Machine::privateExecute):
2670 2008-09-19 Sam Weinig <sam@webkit.org>
2672 Reviewed by Darin Adler.
2674 Patch for https://bugs.webkit.org/show_bug.cgi?id=20928
2675 Speed up JS property enumeration by caching entire PropertyNameArray
2677 1.3% speedup on Sunspider, 30% on string-fasta.
2679 * JavaScriptCore.exp:
2680 * VM/JSPropertyNameIterator.cpp:
2681 (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
2682 (JSC::JSPropertyNameIterator::invalidate):
2683 * VM/JSPropertyNameIterator.h:
2684 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
2685 (JSC::JSPropertyNameIterator::create):
2687 (JSC::JSObject::getPropertyNames):
2688 * kjs/PropertyMap.cpp:
2689 (JSC::PropertyMap::getEnumerablePropertyNames):
2690 * kjs/PropertyMap.h:
2691 * kjs/PropertyNameArray.cpp:
2692 (JSC::PropertyNameArray::add):
2693 * kjs/PropertyNameArray.h:
2694 (JSC::PropertyNameArrayData::create):
2695 (JSC::PropertyNameArrayData::propertyNameVector):
2696 (JSC::PropertyNameArrayData::setCachedPrototypeChain):
2697 (JSC::PropertyNameArrayData::cachedPrototypeChain):
2698 (JSC::PropertyNameArrayData::begin):
2699 (JSC::PropertyNameArrayData::end):
2700 (JSC::PropertyNameArrayData::PropertyNameArrayData):
2701 (JSC::PropertyNameArray::PropertyNameArray):
2702 (JSC::PropertyNameArray::addKnownUnique):
2703 (JSC::PropertyNameArray::size):
2704 (JSC::PropertyNameArray::operator[]):
2705 (JSC::PropertyNameArray::begin):
2706 (JSC::PropertyNameArray::end):
2707 (JSC::PropertyNameArray::setData):
2708 (JSC::PropertyNameArray::data):
2709 (JSC::PropertyNameArray::releaseData):
2710 * kjs/ScopeChain.cpp:
2711 (JSC::ScopeChainNode::print):
2712 * kjs/StructureID.cpp:
2713 (JSC::structureIDChainsAreEqual):
2714 (JSC::StructureID::getEnumerablePropertyNames):
2715 (JSC::StructureID::clearEnumerationCache):
2716 (JSC::StructureID::createCachedPrototypeChain):
2717 * kjs/StructureID.h:
2719 2008-09-19 Holger Hans Peter Freyther <zecke@selfish.org>
2721 Reviewed by Maciej Stachowiak.
2723 Fix a mismatched new[]/delete in JSObject::allocatePropertyStorage
2726 (JSC::JSObject::allocatePropertyStorage): Spotted by valgrind.
2728 2008-09-19 Darin Adler <darin@apple.com>
2730 Reviewed by Sam Weinig.
2732 - part 2 of https://bugs.webkit.org/show_bug.cgi?id=20858
2733 make each distinct C++ class get a distinct JSC::Structure
2735 * JavaScriptCore.exp: Exported constructEmptyObject for use in WebCore.
2737 * kjs/JSGlobalObject.h: Changed the protected constructor to take a
2738 structure instead of a prototype.
2740 * kjs/JSVariableObject.h: Removed constructor that takes a prototype.
2742 2008-09-19 Julien Chaffraix <jchaffraix@pleyo.com>
2744 Reviewed by Alexey Proskuryakov.
2746 Use the template hoisting technique on the RefCounted class. This reduces the code bloat due to
2747 non-template methods' code been copied for each instance of the template.
2748 The patch splits RefCounted between a base class that holds non-template methods and attributes
2749 and the template RefCounted class that keeps the same functionnality.
2751 On my Linux with gcc 4.3 for the Gtk port, this is:
2752 - a ~600KB save on libwebkit.so in release.
2753 - a ~1.6MB save on libwebkit.so in debug.
2755 It is a wash on Sunspider and a small win on Dromaeo (not sure it is relevant).
2756 On the whole, it should be a small win as we reduce the compiled code size and the only
2757 new function call should be inlined by the compiler.
2760 (WTF::RefCountedBase::ref): Copied from RefCounted.
2761 (WTF::RefCountedBase::hasOneRef): Ditto.
2762 (WTF::RefCountedBase::refCount): Ditto.
2763 (WTF::RefCountedBase::RefCountedBase): Ditto.
2764 (WTF::RefCountedBase::~RefCountedBase): Ditto.
2765 (WTF::RefCountedBase::derefBase): Tweaked from the RefCounted version to remove
2767 (WTF::RefCounted::RefCounted):
2768 (WTF::RefCounted::deref): Small wrapper around RefCountedBase::derefBase().
2769 (WTF::RefCounted::~RefCounted): Keep private destructor.
2771 2008-09-18 Darin Adler <darin@apple.com>
2773 Reviewed by Maciej Stachowiak.
2775 - part 1 of https://bugs.webkit.org/show_bug.cgi?id=20858
2776 make each distinct C++ class get a distinct JSC::Structure
2778 * kjs/lookup.h: Removed things here that were used only in WebCore:
2779 cacheGlobalObject, JSC_DEFINE_PROTOTYPE, JSC_DEFINE_PROTOTYPE_WITH_PROTOTYPE,
2780 and JSC_IMPLEMENT_PROTOTYPE.
2782 2008-09-18 Darin Adler <darin@apple.com>
2784 Reviewed by Maciej Stachowiak.
2786 - https://bugs.webkit.org/show_bug.cgi?id=20927
2787 simplify/streamline the code to turn strings into identifiers while parsing
2789 * kjs/grammar.y: Get rid of string from the union, and use ident for STRING as
2793 (JSC::Lexer::lex): Use makeIdentifier instead of makeUString for String.
2794 * kjs/lexer.h: Remove makeUString.
2796 * kjs/nodes.h: Changed StringNode to hold an Identifier instead of UString.
2798 * VM/CodeGenerator.cpp:
2799 (JSC::keyForCharacterSwitch): Updated since StringNode now holds an Identifier.
2800 (JSC::prepareJumpTableForStringSwitch): Ditto.
2802 (JSC::StringNode::emitCode): Ditto. The comment from here is now in the lexer.
2803 (JSC::processClauseList): Ditto.
2804 * kjs/nodes2string.cpp:
2805 (JSC::StringNode::streamTo): Ditto.
2807 2008-09-18 Sam Weinig <sam@webkit.org>
2812 (JSC::Instruction::Instruction):
2814 2008-09-18 Oliver Hunt <oliver@apple.com>
2816 Reviewed by Maciej Stachowiak.
2818 Bug 20911: REGRESSION(r36480?): Reproducible assertion failure below derefStructureIDs 64-bit JavaScriptCore
2819 <https://bugs.webkit.org/show_bug.cgi?id=20911>
2821 The problem was simply caused by the int constructor for Instruction
2822 failing to initialise the full struct in 64bit builds.
2825 (JSC::Instruction::Instruction):
2827 2008-09-18 Darin Adler <darin@apple.com>
2831 * wtf/RefCountedLeakCounter.cpp: Removed stray "static".
2833 2008-09-18 Darin Adler <darin@apple.com>
2835 Reviewed by Sam Weinig.
2837 * kjs/JSGlobalObject.h: Tiny style guideline tweak.
2839 2008-09-18 Darin Adler <darin@apple.com>
2841 Reviewed by Sam Weinig.
2843 - fix https://bugs.webkit.org/show_bug.cgi?id=20925
2844 LEAK messages appear every time I quit
2846 * JavaScriptCore.exp: Updated, and also added an export
2847 needed for future WebCore use of JSC::StructureID.
2849 * wtf/RefCountedLeakCounter.cpp:
2850 (WTF::RefCountedLeakCounter::suppressMessages): Added.
2851 (WTF::RefCountedLeakCounter::cancelMessageSuppression): Added.
2852 (WTF::RefCountedLeakCounter::RefCountedLeakCounter): Tweaked a bit.
2853 (WTF::RefCountedLeakCounter::~RefCountedLeakCounter): Added code to
2854 log the reason there was no leak checking done.
2855 (WTF::RefCountedLeakCounter::increment): Tweaked a bit.
2856 (WTF::RefCountedLeakCounter::decrement): Ditto.
2858 * wtf/RefCountedLeakCounter.h: Replaced setLogLeakMessages with two
2859 new functions, suppressMessages and cancelMessageSuppression. Also
2860 added m_ prefixes to the data member names.
2862 2008-09-18 Holger Hans Peter Freyther <zecke@selfish.org>
2864 Reviewed by Mark Rowe.
2866 https://bugs.webkit.org/show_bug.cgi?id=20437
2868 Add a proper #define to define which XML Parser implementation to use. Client
2869 code can use #if USE(QXMLSTREAM) to decide if the Qt XML StreamReader
2870 implementation is going to be used.
2874 2008-09-18 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2876 Reviewed by Maciej Stachowiak.
2878 Make a Unicode non-breaking space count as a whitespace character in
2879 PCRE. This change was already made in WREC, and it fixes one of the
2880 Mozilla JS tests. Since it is now fixed in PCRE as well, we can check
2881 in a new set of expected test results.
2883 * pcre/pcre_internal.h:
2885 * tests/mozilla/expected.html:
2887 2008-09-18 Stephanie Lewis <slewis@apple.com>
2889 Reviewed by Mark Rowe and Maciej Stachowiak.
2891 add an option use arch to specify which architecture to run.
2893 * tests/mozilla/jsDriver.pl:
2895 2008-09-17 Oliver Hunt <oliver@apple.com>
2897 Correctly restore argument reference prior to SFX runtime calls.
2899 Reviewed by Steve Falkenburg.
2902 (JSC::CTI::privateCompileSlowCases):
2903 (JSC::CTI::privateCompile):
2905 2008-09-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2907 Reviewed by Maciej Stachowiak.
2909 Bug 20876: REGRESSION (r36417, r36427): fast/js/exception-expression-offset.html fails
2910 <https://bugs.webkit.org/show_bug.cgi?id=20876>
2912 r36417 and r36427 caused an get_by_id opcode to be emitted before the
2913 instanceof and construct opcodes, in order to enable inline caching of
2914 the prototype property. Unfortunately, this regressed some tests dealing
2915 with exceptions thrown by 'instanceof' and the 'new' operator. We fix
2916 these problems by detecting whether an "is not an object" exception is
2917 thrown before op_instanceof or op_construct, and emit the proper
2918 exception in those cases.
2920 * VM/CodeGenerator.cpp:
2921 (JSC::CodeGenerator::emitConstruct):
2922 * VM/CodeGenerator.h:
2923 * VM/ExceptionHelpers.cpp:
2924 (JSC::createInvalidParamError):
2925 (JSC::createNotAConstructorError):
2926 (JSC::createNotAnObjectError):
2927 * VM/ExceptionHelpers.h:
2929 (JSC::Machine::getOpcode):
2930 (JSC::Machine::privateExecute):
2933 (JSC::NewExprNode::emitCode):
2934 (JSC::InstanceOfNode::emitCode):
2936 2008-09-17 Gavin Barraclough <barraclough@apple.com>
2938 Reviewed by Oliver Hunt.
2940 JIT generation cti_op_construct_verify.
2942 Quarter to half percent progression on v8-tests.
2943 Roughly not change on SunSpider (possible minor progression).
2946 (JSC::CTI::privateCompileMainPass):
2950 2008-09-15 Steve Falkenburg <sfalken@apple.com>
2952 Improve timer accuracy for JavaScript Date object on Windows.
2954 Use a combination of ftime and QueryPerformanceCounter.
2955 ftime returns the information we want, but doesn't have sufficient resolution.
2956 QueryPerformanceCounter has high resolution, but is only usable to measure time intervals.
2957 To combine them, we call ftime and QueryPerformanceCounter initially. Later calls will use
2958 QueryPerformanceCounter by itself, adding the delta to the saved ftime. We re-sync to
2959 correct for drift if the low-res and high-res elapsed time between calls differs by more
2960 than twice the low-resolution timer resolution.
2962 QueryPerformanceCounter may be inaccurate due to a problems with:
2963 - some PCI bridge chipsets (http://support.microsoft.com/kb/274323)
2964 - BIOS bugs (http://support.microsoft.com/kb/895980/)
2965 - BIOS/HAL bugs on multiprocessor/multicore systems (http://msdn.microsoft.com/en-us/library/ms644904.aspx)
2967 Reviewed by Darin Adler.
2970 (JSC::highResUpTime):
2971 (JSC::lowResUTCTime):
2972 (JSC::qpcAvailable):
2973 (JSC::getCurrentUTCTimeWithMicroseconds):
2975 2008-09-17 Gavin Barraclough <barraclough@apple.com>
2977 Reviewed by Geoff Garen.
2979 Implement JIT generation of CallFrame initialization, for op_call.
2981 1% sunspider 2.5% v8-tests.
2984 (JSC::CTI::compileOpCall):
2986 (JSC::Machine::cti_op_call_JSFunction):
2987 (JSC::Machine::cti_op_call_NotJSFunction):
2989 2008-09-17 Gavin Barraclough <barraclough@apple.com>
2991 Reviewed by Geoff Garen.
2993 Optimizations for op_call in CTI. Move check for (ctiCode == 0) into JIT code,
2994 move copying of scopeChain for CodeBlocks that needFullScopeChain into head of
2995 functions, instead of checking prior to making the call.
2997 3% on v8-tests (4% on richards, 6% in delta-blue)
3000 (JSC::CTI::compileOpCall):
3001 (JSC::CTI::privateCompileSlowCases):
3002 (JSC::CTI::privateCompile):
3004 (JSC::Machine::execute):
3005 (JSC::Machine::cti_op_call_JSFunction):
3006 (JSC::Machine::cti_vm_compile):
3007 (JSC::Machine::cti_vm_updateScopeChain):
3008 (JSC::Machine::cti_op_construct_JSConstruct):
3011 2008-09-17 Tor Arne Vestbø <tavestbo@trolltech.com>
3013 Fix the QtWebKit/Mac build
3015 * wtf/ThreadingQt.cpp:
3016 (WTF::initializeThreading): use QCoreApplication to get the main thread
3018 2008-09-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3020 Reviewed by Maciej Stachowiak.
3022 Bug 20857: REGRESSION (r36427): ASSERTION FAILED: m_refCount >= 0 in RegisterID::deref()
3023 <https://bugs.webkit.org/show_bug.cgi?id=20857>
3025 Fix a problem stemming from the slightly unsafe behaviour of the
3026 CodeGenerator::finalDestination() method by putting the "func" argument
3027 of the emitConstruct() method in a RefPtr in its caller. Also, add an
3028 assertion guaranteeing that this is always the case.
3030 CodeGenerator::finalDestination() is still incorrect and can cause
3031 problems with a different allocator; see bug 20340 for more details.
3033 * VM/CodeGenerator.cpp:
3034 (JSC::CodeGenerator::emitConstruct):
3036 (JSC::NewExprNode::emitCode):
3038 2008-09-16 Alice Liu <alice.liu@apple.com>
3043 (JSC::CTI::privateCompileMainPass):
3045 2008-09-16 Gavin Barraclough <barraclough@apple.com>
3047 Reviewed by Geoff Garen.
3049 CTI code generation for op_ret. The majority of the work
3050 (updating variables on the stack & on exec) can be performed
3051 directly in generated code.
3053 We still need to check, & to call out to C-code to handle
3054 activation records, profiling, and full scope chains.
3056 +1.5% Sunspider, +5/6% v8 tests.
3059 (JSC::CTI::emitPutCTIParam):
3060 (JSC::CTI::compileOpCall):
3061 (JSC::CTI::privateCompileMainPass):
3064 (JSC::Machine::cti_op_ret_activation):
3065 (JSC::Machine::cti_op_ret_profiler):
3066 (JSC::Machine::cti_op_ret_scopeChain):
3069 2008-09-16 Dimitri Glazkov <dglazkov@chromium.org>
3071 Fix the Windows build.
3073 Add some extra parentheses to stop MSVC from complaining so much.
3076 (JSC::Machine::privateExecute):
3077 (JSC::Machine::cti_op_stricteq):
3078 (JSC::Machine::cti_op_nstricteq):
3079 * kjs/operations.cpp:
3082 2008-09-15 Maciej Stachowiak <mjs@apple.com>
3084 Reviewed by Cameron Zwarich.
3086 - speed up the === and !== operators by choosing the fast cases better
3088 No effect on SunSpider but speeds up the V8 EarlyBoyer benchmark about 4%.
3091 (JSC::Machine::privateExecute):
3092 (JSC::Machine::cti_op_stricteq):
3093 (JSC::Machine::cti_op_nstricteq):
3094 * kjs/JSImmediate.h:
3095 (JSC::JSImmediate::areBothImmediate):
3096 * kjs/operations.cpp:
3098 (JSC::strictEqualSlowCase):
3101 2008-09-15 Oliver Hunt <oliver@apple.com>
3105 Coding style cleanup.
3108 (JSC::Machine::privateExecute):
3110 2008-09-15 Oliver Hunt <oliver@apple.com>
3112 Reviewed by Cameron Zwarich.
3114 Bug 20874: op_resolve does not do any form of caching
3115 <https://bugs.webkit.org/show_bug.cgi?id=20874>
3117 This patch adds an op_resolve_global opcode to handle (and cache)
3118 property lookup we can statically determine must occur on the global
3121 3% progression on sunspider, 3.2x improvement to bitops-bitwise-and, and
3122 10% in math-partial-sums
3125 (JSC::CTI::privateCompileMainPass):
3128 (JSC::CodeBlock::dump):
3129 * VM/CodeGenerator.cpp:
3130 (JSC::CodeGenerator::findScopedProperty):
3131 (JSC::CodeGenerator::emitResolve):
3133 (JSC::resolveGlobal):
3134 (JSC::Machine::privateExecute):
3135 (JSC::Machine::cti_op_resolve_global):
3139 2008-09-15 Sam Weinig <sam@webkit.org>
3141 Roll out r36462. It broke document.all.
3144 (JSC::CTI::privateCompileMainPass):
3145 (JSC::CTI::privateCompileSlowCases):
3148 (JSC::Machine::Machine):
3149 (JSC::Machine::cti_op_eq_null):
3150 (JSC::Machine::cti_op_neq_null):
3152 (JSC::Machine::isJSString):
3154 * kjs/JSWrapperObject.h:
3155 * kjs/StringObject.h:
3156 * kjs/StringObjectThatMasqueradesAsUndefined.h:
3158 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3160 Reviewed by Maciej Stachowiak.
3162 Bug 20863: ASSERTION FAILED: addressOffset < instructions.size() in CodeBlock::getHandlerForVPC
3163 <https://bugs.webkit.org/show_bug.cgi?id=20863>
3165 r36427 changed the number of arguments to op_construct without changing
3166 the argument index for the vPC in the call to initializeCallFrame() in
3167 the CTI case. This caused a JSC test failure. Correcting the argument
3168 index fixes the test failure.
3171 (JSC::Machine::cti_op_construct_JSConstruct):
3173 2008-09-15 Mark Rowe <mrowe@apple.com>
3179 2008-09-15 Geoffrey Garen <ggaren@apple.com>
3181 Reviewed by Maciej Stachowiak.
3183 Fixed a typo in op_get_by_id_chain that caused it to miss every time
3186 Also, a little cleanup.
3189 (JSC::Machine::privateExecute): Set up baseObject before entering the
3190 loop, so we compare against the right values.
3192 2008-09-15 Geoffrey Garen <ggaren@apple.com>
3194 Reviewed by Sam Weinig.
3196 Removed the CalledAsConstructor flag from the call frame header. Now,
3197 we use an explicit opcode at the call site to fix up constructor results.
3199 SunSpider says 0.4% faster.
3201 cti_op_construct_verify is an out-of-line function call for now, but we
3202 can fix that once StructureID holds type information like isObject.
3205 (JSC::CTI::privateCompileMainPass): Codegen for the new opcode.
3208 (JSC::CodeBlock::dump):
3210 * VM/CodeGenerator.cpp: Codegen for the new opcode. Also...
3211 (JSC::CodeGenerator::emitCall): ... don't test for known non-zero value.
3212 (JSC::CodeGenerator::emitConstruct): ... ditto.
3214 * VM/Machine.cpp: No more CalledAsConstructor
3215 (JSC::Machine::privateExecute): Implementation for the new opcode.
3216 (JSC::Machine::cti_op_ret): The speedup: no need to check whether we were
3217 called as a constructor.
3218 (JSC::Machine::cti_op_construct_verify): Implementation for the new opcode.
3221 * VM/Opcode.h: Declare new opcode.
3223 * VM/RegisterFile.h:
3224 (JSC::RegisterFile::): No more CalledAsConstructor
3226 2008-09-15 Gavin Barraclough <barraclough@apple.com>
3228 Reviewed by Geoff Garen.
3230 Inline code generation of eq_null/neq_null for CTI. Uses vptr checking for
3231 StringObjectsThatAreMasqueradingAsBeingUndefined. In the long run, the
3232 masquerading may be handled differently (through the StructureIDs - see bug
3238 (JSC::CTI::emitJumpSlowCaseIfIsJSCell):
3239 (JSC::CTI::privateCompileMainPass):
3240 (JSC::CTI::privateCompileSlowCases):
3243 (JSC::Machine::Machine):
3244 (JSC::Machine::cti_op_eq_null):
3245 (JSC::Machine::cti_op_neq_null):
3247 (JSC::Machine::doesMasqueradesAsUndefined):
3248 * kjs/JSWrapperObject.h:
3249 (JSC::JSWrapperObject::):
3250 (JSC::JSWrapperObject::JSWrapperObject):
3251 * kjs/StringObject.h:
3252 (JSC::StringObject::StringObject):
3253 * kjs/StringObjectThatMasqueradesAsUndefined.h:
3254 (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
3256 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3258 Rubber-stamped by Oliver Hunt.
3260 r36427 broke CodeBlock::dump() by changing the number of arguments to
3261 op_construct without changing the code that prints it. This patch fixes
3262 it by printing the additional argument.
3264 * JavaScriptCore.xcodeproj/project.pbxproj:
3266 (JSC::CodeBlock::dump):
3268 2008-09-15 Adam Roben <aroben@apple.com>
3272 * kjs/StructureID.cpp: Removed a stray semicolon.
3274 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3276 Reviewed by Maciej Stachowiak.
3278 Fix a crash in fast/js/exception-expression-offset.html caused by not
3279 updating all mentions of the length of op_construct in r36427.
3282 (JSC::Machine::cti_op_construct_NotJSConstruct):
3284 2008-09-15 Maciej Stachowiak <mjs@apple.com>
3286 Reviewed by Cameron Zwarich.
3288 - fix layout test failure introduced by fix for 20849
3290 (The failing test was fast/js/delete-then-put.html)
3293 (JSC::JSObject::removeDirect): Clear enumeration cache
3294 in the dictionary case.
3296 (JSC::JSObject::putDirect): Ditto.
3297 * kjs/StructureID.h:
3298 (JSC::StructureID::clearEnumerationCache): Inline to handle the
3301 2008-09-15 Maciej Stachowiak <mjs@apple.com>
3303 Reviewed by Cameron Zwarich.
3305 - fix JSC test failures introduced by fix for 20849
3307 * kjs/PropertyMap.cpp:
3308 (JSC::PropertyMap::getEnumerablePropertyNames): Use the correct count.
3310 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3312 Reviewed by Maciej Stachowiak.
3314 Bug 20851: REGRESSION (r36410): fast/js/kde/GlobalObject.html fails
3315 <https://bugs.webkit.org/show_bug.cgi?id=20851>
3317 r36410 introduced an optimization for parseInt() that is incorrect when
3318 its argument is larger than the range of a 32-bit integer. If the
3319 argument is a number that is not an immediate integer, then the correct
3320 behaviour is to return the floor of its value, unless it is an infinite
3321 value, in which case the correct behaviour is to return 0.
3323 * kjs/JSGlobalObjectFunctions.cpp:
3324 (JSC::globalFuncParseInt):
3326 2008-09-15 Sam Weinig <sam@webkit.org>
3328 Reviewed by Maciej Stachowiak.
3330 Patch for https://bugs.webkit.org/show_bug.cgi?id=20849
3331 Cache property names for getEnumerablePropertyNames in the StructureID.
3333 ~0.5% speedup on Sunspider overall (9.7% speedup on string-fasta). ~1% speedup
3334 on the v8 test suite.
3337 (JSC::JSObject::getPropertyNames):
3338 * kjs/PropertyMap.cpp:
3339 (JSC::PropertyMap::getEnumerablePropertyNames):
3340 * kjs/PropertyMap.h:
3341 * kjs/StructureID.cpp:
3342 (JSC::StructureID::StructureID):
3343 (JSC::StructureID::getEnumerablePropertyNames):
3344 * kjs/StructureID.h:
3346 2008-09-14 Maciej Stachowiak <mjs@apple.com>
3348 Reviewed by Cameron Zwarich.
3350 - speed up JS construction by extracting "prototype" lookup so PIC applies.
3352 ~0.5% speedup on SunSpider
3353 Speeds up some of the V8 tests as well, most notably earley-boyer.
3356 (JSC::CTI::compileOpCall): Account for extra arg for prototype.
3357 (JSC::CTI::privateCompileMainPass): Account for increased size of op_construct.
3358 * VM/CodeGenerator.cpp:
3359 (JSC::CodeGenerator::emitConstruct): Emit separate lookup to get prototype property.
3361 (JSC::Machine::privateExecute): Expect prototype arg in op_construct.
3362 (JSC::Machine::cti_op_construct_JSConstruct): ditto
3363 (JSC::Machine::cti_op_construct_NotJSConstruct): ditto
3365 2008-09-10 Alexey Proskuryakov <ap@webkit.org>
3367 Reviewed by Eric Seidel.
3369 Add a protected destructor for RefCounted.
3371 It is wrong to call its destructor directly, because (1) this should be taken care of by
3372 deref(), and (2) many classes that use RefCounted have non-virtual destructors.
3374 No change in behavior.
3376 * wtf/RefCounted.h: (WTF::RefCounted::~RefCounted):
3378 2008-09-14 Gavin Barraclough <barraclough@apple.com>
3380 Reviewed by Sam Weinig.
3382 Accelerated property accesses.
3384 Inline more of the array access code into the JIT code for get/put_by_val.
3385 Accelerate get/put_by_id by speculatively inlining a disable direct access
3386 into the hot path of the code, and repatch this with the correct StructureID
3387 and property map offset once these are known. In the case of accesses to the
3388 prototype and reading the array-length a trampoline is genertaed, and the
3389 branch to the slow-case is relinked to jump to this.
3391 By repatching, we mean rewriting the x86 instruction stream. Instructions are
3392 only modified in a simple fasion - altering immediate operands, memory access
3393 deisplacements, and branch offsets.
3395 For regular get_by_id/put_by_id accesses to an object, a StructureID in an
3396 instruction's immediate operant is updateded, and a memory access operation's
3397 displacement is updated to access the correct field on the object. In the case
3398 of more complex accesses (array length and get_by_id_prototype) the offset on
3399 the branch to slow-case is updated, to now jump to a trampoline.
3401 +2.8% sunspider, +13% v8-tests
3404 (JSC::CTI::emitCall):
3405 (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
3407 (JSC::CTI::privateCompileMainPass):
3408 (JSC::CTI::privateCompileSlowCases):
3409 (JSC::CTI::privateCompile):
3410 (JSC::CTI::privateCompileGetByIdSelf):
3411 (JSC::CTI::privateCompileGetByIdProto):
3412 (JSC::CTI::privateCompileGetByIdChain):
3413 (JSC::CTI::privateCompilePutByIdReplace):
3414 (JSC::CTI::privateCompilePutByIdTransition):
3415 (JSC::CTI::privateCompileArrayLengthTrampoline):
3416 (JSC::CTI::privateCompileStringLengthTrampoline):
3417 (JSC::CTI::patchGetByIdSelf):
3418 (JSC::CTI::patchPutByIdReplace):
3419 (JSC::CTI::privateCompilePatchGetArrayLength):
3420 (JSC::CTI::privateCompilePatchGetStringLength):
3422 (JSC::CTI::compileGetByIdSelf):
3423 (JSC::CTI::compileGetByIdProto):
3424 (JSC::CTI::compileGetByIdChain):
3425 (JSC::CTI::compilePutByIdReplace):
3426 (JSC::CTI::compilePutByIdTransition):
3427 (JSC::CTI::compileArrayLengthTrampoline):
3428 (JSC::CTI::compileStringLengthTrampoline):
3429 (JSC::CTI::compilePatchGetArrayLength):
3430 (JSC::CTI::compilePatchGetStringLength):
3432 (JSC::CodeBlock::dump):
3433 (JSC::CodeBlock::~CodeBlock):
3435 (JSC::StructureStubInfo::StructureStubInfo):
3436 (JSC::CodeBlock::getStubInfo):
3438 (JSC::Machine::tryCTICachePutByID):
3439 (JSC::Machine::tryCTICacheGetByID):
3440 (JSC::Machine::cti_op_put_by_val_array):
3442 * masm/X86Assembler.h:
3443 (JSC::X86Assembler::):
3444 (JSC::X86Assembler::cmpl_i8m):
3445 (JSC::X86Assembler::emitUnlinkedJa):
3446 (JSC::X86Assembler::getRelocatedAddress):
3447 (JSC::X86Assembler::getDifferenceBetweenLabels):
3448 (JSC::X86Assembler::emitModRm_opmsib):
3450 2008-09-14 Maciej Stachowiak <mjs@apple.com>
3452 Reviewed by Cameron Zwarich.
3454 - split the "prototype" lookup for hasInstance into opcode stream so it can be cached
3456 ~5% speedup on v8 earley-boyer test
3458 * API/JSCallbackObject.h: Add a parameter for the pre-looked-up prototype.
3459 * API/JSCallbackObjectFunctions.h:
3460 (JSC::::hasInstance): Ditto.
3461 * API/JSValueRef.cpp:
3462 (JSValueIsInstanceOfConstructor): Look up and pass in prototype.
3463 * JavaScriptCore.exp:
3465 (JSC::CTI::privateCompileMainPass): Pass along prototype.
3467 (JSC::CodeBlock::dump): Print third arg.
3468 * VM/CodeGenerator.cpp:
3469 (JSC::CodeGenerator::emitInstanceOf): Implement this, now that there
3470 is a third argument.
3471 * VM/CodeGenerator.h:
3473 (JSC::Machine::privateExecute): Pass along the prototype.
3474 (JSC::Machine::cti_op_instanceof): ditto
3476 (JSC::JSObject::hasInstance): Expect to get a pre-looked-up prototype.
3479 (JSC::InstanceOfNode::emitCode): Emit a get_by_id of the prototype
3480 property and pass that register to instanceof.
3483 2008-09-14 Gavin Barraclough <barraclough@apple.com>
3485 Reviewed by Sam Weinig.
3487 Remove unnecessary virtual function call from cti_op_call_JSFunction -
3488 ~5% on richards, ~2.5% on v8-tests, ~0.5% on sunspider.
3491 (JSC::Machine::cti_op_call_JSFunction):
3493 2008-09-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3495 Reviewed by Maciej Stachowiak.
3497 Bug 20827: the 'typeof' operator is slow
3498 <https://bugs.webkit.org/show_bug.cgi?id=20827>
3500 Optimize the 'typeof' operator when its result is compared to a constant
3503 This is a 5.5% speedup on the V8 Earley-Boyer test.
3506 (JSC::CTI::privateCompileMainPass):
3508 (JSC::CodeBlock::dump):
3509 * VM/CodeGenerator.cpp:
3510 (JSC::CodeGenerator::emitEqualityOp):
3511 * VM/CodeGenerator.h:
3513 (JSC::jsIsObjectType):
3514 (JSC::jsIsFunctionType):
3515 (JSC::Machine::privateExecute):
3516 (JSC::Machine::cti_op_is_undefined):
3517 (JSC::Machine::cti_op_is_boolean):
3518 (JSC::Machine::cti_op_is_number):
3519 (JSC::Machine::cti_op_is_string):
3520 (JSC::Machine::cti_op_is_object):
3521 (JSC::Machine::cti_op_is_function):
3525 (JSC::BinaryOpNode::emitCode):
3526 (JSC::EqualNode::emitCode):
3527 (JSC::StrictEqualNode::emitCode):
3530 2008-09-14 Sam Weinig <sam@webkit.org>
3532 Reviewed by Cameron Zwarich.
3534 Patch for https://bugs.webkit.org/show_bug.cgi?id=20844
3535 Speed up parseInt for numbers
3537 Sunspider reports this as 1.029x as fast overall and 1.37x as fast on string-unpack-code.
3538 No change on the v8 suite.
3540 * kjs/JSGlobalObjectFunctions.cpp:
3541 (JSC::globalFuncParseInt): Don't convert numbers to strings just to
3542 convert them back to numbers.
3544 2008-09-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3546 Reviewed by Oliver Hunt.
3548 Bug 20816: op_lesseq should be optimized
3549 <https://bugs.webkit.org/show_bug.cgi?id=20816>
3551 Add a loop_if_lesseq opcode that is similar to the loop_if_less opcode.
3553 This is a 9.4% speedup on the V8 Crypto benchmark.
3556 (JSC::CTI::privateCompileMainPass):
3557 (JSC::CTI::privateCompileSlowCases):
3559 (JSC::CodeBlock::dump):
3560 * VM/CodeGenerator.cpp:
3561 (JSC::CodeGenerator::emitJumpIfTrue):
3563 (JSC::Machine::privateExecute):
3564 (JSC::Machine::cti_op_loop_if_lesseq):
3568 2008-09-14 Sam Weinig <sam@webkit.org>
3570 Reviewed by Cameron Zwarich.
3572 Cleanup Sampling code.
3575 (JSC::CTI::emitCall):
3576 (JSC::CTI::privateCompileMainPass):
3578 (JSC::CTI::execute):
3579 * VM/SamplingTool.cpp:
3581 (JSC::SamplingTool::run):
3582 (JSC::SamplingTool::dump):
3583 * VM/SamplingTool.h:
3584 (JSC::SamplingTool::callingHostFunction):
3586 2008-09-13 Oliver Hunt <oliver@apple.com>
3588 Reviewed by Cameron Zwarich.
3590 Bug 20821: Cache property transitions to speed up object initialization
3591 https://bugs.webkit.org/show_bug.cgi?id=20821
3593 Implement a transition cache to improve the performance of new properties
3594 being added to objects. This is extremely beneficial in constructors and
3595 shows up as a 34% improvement on access-binary-trees in SunSpider (0.8%
3599 (JSC::CTI::privateCompileMainPass):
3601 (JSC::transitionWillNeedStorageRealloc):
3602 (JSC::CTI::privateCompilePutByIdTransition):
3604 (JSC::CTI::compilePutByIdTransition):
3606 (JSC::printPutByIdOp):
3607 (JSC::CodeBlock::printStructureIDs):
3608 (JSC::CodeBlock::dump):
3609 (JSC::CodeBlock::derefStructureIDs):
3610 (JSC::CodeBlock::refStructureIDs):
3611 * VM/CodeGenerator.cpp:
3612 (JSC::CodeGenerator::emitPutById):
3614 (JSC::cachePrototypeChain):
3615 (JSC::Machine::tryCachePutByID):
3616 (JSC::Machine::tryCacheGetByID):
3617 (JSC::Machine::privateExecute):
3618 (JSC::Machine::tryCTICachePutByID):
3619 (JSC::Machine::tryCTICacheGetByID):
3623 (JSC::JSObject::putDirect):
3624 (JSC::JSObject::transitionTo):
3625 * kjs/PutPropertySlot.h:
3626 (JSC::PutPropertySlot::PutPropertySlot):
3627 (JSC::PutPropertySlot::wasTransition):
3628 (JSC::PutPropertySlot::setWasTransition):
3629 * kjs/StructureID.cpp:
3630 (JSC::StructureID::transitionTo):
3631 (JSC::StructureIDChain::StructureIDChain):
3632 * kjs/StructureID.h:
3633 (JSC::StructureID::previousID):
3634 (JSC::StructureID::setCachedPrototypeChain):
3635 (JSC::StructureID::cachedPrototypeChain):
3636 (JSC::StructureID::propertyMap):
3637 * masm/X86Assembler.h:
3638 (JSC::X86Assembler::addl_i8m):
3639 (JSC::X86Assembler::subl_i8m):
3641 2008-09-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3643 Reviewed by Maciej Stachowiak.
3645 Bug 20819: JSValue::isObject() is slow
3646 <https://bugs.webkit.org/show_bug.cgi?id=20819>
3648 Optimize JSCell::isObject() and JSCell::isString() by making them
3649 non-virtual calls that rely on the StructureID type information.
3651 This is a 0.7% speedup on SunSpider and a 1.0% speedup on the V8
3654 * JavaScriptCore.exp:
3657 (JSC::JSCell::isObject):
3658 (JSC::JSCell::isString):
3663 (JSC::JSString::JSString):
3664 * kjs/StructureID.h:
3665 (JSC::StructureID::type):
3667 2008-09-11 Stephanie Lewis <slewis@apple.com>
3669 Reviewed by Oliver Hunt.
3671 Turn off PGO Optimization on CTI.cpp -> <rdar://problem/6207709>. Fixes
3672 crash on CNN and on Dromaeo.
3673 Fix Missing close tag in vcproj.
3675 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3677 2008-09-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3681 Correct an SVN problem with the last commit and actually add the new
3684 * wrec/CharacterClassConstructor.cpp: Added.
3686 (JSC::getCharacterClassNewline):
3687 (JSC::getCharacterClassDigits):
3688 (JSC::getCharacterClassSpaces):
3689 (JSC::getCharacterClassWordchar):
3690 (JSC::getCharacterClassNondigits):
3691 (JSC::getCharacterClassNonspaces):
3692 (JSC::getCharacterClassNonwordchar):
3693 (JSC::CharacterClassConstructor::addSorted):
3694 (JSC::CharacterClassConstructor::addSortedRange):
3695 (JSC::CharacterClassConstructor::put):
3696 (JSC::CharacterClassConstructor::flush):
3697 (JSC::CharacterClassConstructor::append):
3698 * wrec/CharacterClassConstructor.h: Added.
3699 (JSC::CharacterClassConstructor::CharacterClassConstructor):
3700 (JSC::CharacterClassConstructor::isUpsideDown):
3701 (JSC::CharacterClassConstructor::charClass):
3703 2008-09-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3705 Reviewed by Maciej Stachowiak.
3707 Bug 20788: Split CharacterClassConstructor into its own file
3708 <https://bugs.webkit.org/show_bug.cgi?id=20788>
3710 Split CharacterClassConstructor into its own file and clean up some
3713 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3714 * JavaScriptCore.xcodeproj/project.pbxproj:
3715 * wrec/CharacterClassConstructor.cpp: Added.
3717 (JSC::getCharacterClassNewline):
3718 (JSC::getCharacterClassDigits):
3719 (JSC::getCharacterClassSpaces):
3720 (JSC::getCharacterClassWordchar):
3721 (JSC::getCharacterClassNondigits):
3722 (JSC::getCharacterClassNonspaces):
3723 (JSC::getCharacterClassNonwordchar):
3724 (JSC::CharacterClassConstructor::addSorted):
3725 (JSC::CharacterClassConstructor::addSortedRange):
3726 (JSC::CharacterClassConstructor::put):
3727 (JSC::CharacterClassConstructor::flush):
3728 (JSC::CharacterClassConstructor::append):
3729 * wrec/CharacterClassConstructor.h: Added.
3730 (JSC::CharacterClassConstructor::CharacterClassConstructor):
3731 (JSC::CharacterClassConstructor::isUpsideDown):
3732 (JSC::CharacterClassConstructor::charClass):
3734 (JSC::WRECParser::parseCharacterClass):
3736 2008-09-10 Simon Hausmann <hausmann@webkit.org>
3738 Not reviewed but trivial one-liner for yet unused macro.
3740 Changed PLATFORM(WINCE) to PLATFORM(WIN_CE) as requested by Mark.
3742 (part of https://bugs.webkit.org/show_bug.cgi?id=20746)
3746 2008-09-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3748 Rubber-stamped by Oliver Hunt.
3750 Fix a typo by renaming the overloaded orl_rr that takes an immediate to
3754 (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
3755 * masm/X86Assembler.h:
3756 (JSC::X86Assembler::orl_i32r):
3758 (JSC::WRECGenerator::generatePatternCharacter):
3759 (JSC::WRECGenerator::generateCharacterClassInverted):
3761 2008-09-10 Sam Weinig <sam@webkit.org>
3763 Reviewed by Geoff Garen.
3765 Add inline property storage for JSObject.
3767 1.2% progression on Sunspider. .5% progression on the v8 test suite.
3769 * JavaScriptCore.exp:
3771 (JSC::CTI::privateCompileGetByIdProto):
3772 (JSC::CTI::privateCompileGetByIdChain):
3774 (JSC::JSObject::mark): There is no reason to check storageSize now that
3776 (JSC::JSObject::allocatePropertyStorage): Allocates/reallocates heap storage.
3778 (JSC::JSObject::offsetForLocation): m_propertyStorage is not an OwnArrayPtr
3779 now so there is no reason to .get()
3780 (JSC::JSObject::usingInlineStorage):
3781 (JSC::JSObject::JSObject): Start with m_propertyStorage pointing to the
3783 (JSC::JSObject::~JSObject): Free the heap storage if not using the inline
3785 (JSC::JSObject::putDirect): Switch to the heap storage only when we know
3786 we know that we are about to add a property that will overflow the inline
3788 * kjs/PropertyMap.cpp:
3789 (JSC::PropertyMap::createTable): Don't allocate the propertyStorage, that is
3790 now handled by JSObject.
3791 (JSC::PropertyMap::rehash): PropertyStorage is not a OwnArrayPtr anymore.
3792 * kjs/PropertyMap.h:
3793 (JSC::PropertyMap::storageSize): Rename from markingCount.
3794 * kjs/StructureID.cpp:
3795 (JSC::StructureID::addPropertyTransition): Don't resize the property storage
3796 if we are using inline storage.
3797 * kjs/StructureID.h:
3799 2008-09-10 Oliver Hunt <oliver@apple.com>
3801 Reviewed by Geoff Garen.
3803 Inline immediate number version of op_mul.
3805 Renamed mull_rr to imull_rr as that's what it's
3806 actually doing, and added imull_i32r for the constant
3807 case immediate multiply.
3809 1.1% improvement to SunSpider.
3812 (JSC::CTI::privateCompileMainPass):
3813 (JSC::CTI::privateCompileSlowCases):
3814 * masm/X86Assembler.h:
3815 (JSC::X86Assembler::):
3816 (JSC::X86Assembler::imull_rr):
3817 (JSC::X86Assembler::imull_i32r):
3819 2008-09-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3825 * JavaScriptCore.xcodeproj/project.pbxproj:
3827 2008-09-09 Oliver Hunt <oliver@apple.com>
3829 Reviewed by Maciej Stachowiak.
3831 Add optimised access to known properties on the global object.
3833 Improve cross scope access to the global object by emitting
3834 code to access it directly rather than by walking the scope chain.
3836 This is a 0.8% win in SunSpider and a 1.7% win in the v8 benchmarks.
3839 (JSC::CTI::privateCompileMainPass):
3840 (JSC::CTI::emitGetVariableObjectRegister):
3841 (JSC::CTI::emitPutVariableObjectRegister):
3844 (JSC::CodeBlock::dump):
3845 * VM/CodeGenerator.cpp:
3846 (JSC::CodeGenerator::findScopedProperty):
3847 (JSC::CodeGenerator::emitResolve):
3848 (JSC::CodeGenerator::emitGetScopedVar):
3849 (JSC::CodeGenerator::emitPutScopedVar):
3850 * VM/CodeGenerator.h:
3852 (JSC::Machine::privateExecute):
3855 (JSC::FunctionCallResolveNode::emitCode):
3856 (JSC::PostfixResolveNode::emitCode):
3857 (JSC::PrefixResolveNode::emitCode):
3858 (JSC::ReadModifyResolveNode::emitCode):
3859 (JSC::AssignResolveNode::emitCode):
3861 2008-09-10 Maciej Stachowiak <mjs@apple.com>
3865 - enable polymorphic inline caching of properties of primitives
3867 1.012x speedup on SunSpider.
3869 We create special structure IDs for JSString and
3870 JSNumberCell. Unlike normal structure IDs, these cannot hold the
3871 true prototype. Due to JS autoboxing semantics, the prototype used
3872 when looking up string or number properties depends on the lexical
3873 global object of the call site, not the creation site. Thus we
3874 enable StructureIDs to handle this quirk for primitives.
3876 Everything else should be straightforward.
3879 (JSC::CTI::privateCompileGetByIdProto):
3880 (JSC::CTI::privateCompileGetByIdChain):
3882 (JSC::CTI::compileGetByIdProto):
3883 (JSC::CTI::compileGetByIdChain):
3884 * VM/JSPropertyNameIterator.h:
3885 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
3887 (JSC::Machine::Machine):
3888 (JSC::cachePrototypeChain):
3889 (JSC::Machine::tryCachePutByID):
3890 (JSC::Machine::tryCacheGetByID):
3891 (JSC::Machine::privateExecute):
3892 (JSC::Machine::tryCTICachePutByID):
3893 (JSC::Machine::tryCTICacheGetByID):
3894 * kjs/GetterSetter.h:
3895 (JSC::GetterSetter::GetterSetter):
3897 * kjs/JSGlobalData.cpp:
3898 (JSC::JSGlobalData::JSGlobalData):
3899 * kjs/JSGlobalData.h:
3900 * kjs/JSGlobalObject.h:
3901 (JSC::StructureID::prototypeForLookup):
3902 * kjs/JSNumberCell.h:
3903 (JSC::JSNumberCell::JSNumberCell):
3904 (JSC::jsNumberCell):
3906 (JSC::JSObject::prototype):
3910 (JSC::jsOwnedString):
3912 (JSC::JSString::JSString):
3914 (JSC::jsSingleCharacterString):
3915 (JSC::jsSingleCharacterSubstring):
3916 (JSC::jsNontrivialString):
3917 * kjs/SmallStrings.cpp:
3918 (JSC::SmallStrings::createEmptyString):
3919 (JSC::SmallStrings::createSingleCharacterString):
3920 * kjs/StructureID.cpp:
3921 (JSC::StructureID::StructureID):
3922 (JSC::StructureID::addPropertyTransition):
3923 (JSC::StructureID::getterSetterTransition):
3924 (JSC::StructureIDChain::StructureIDChain):
3925 * kjs/StructureID.h:
3926 (JSC::StructureID::create):
3927 (JSC::StructureID::storedPrototype):
3929 2008-09-09 Joerg Bornemann <joerg.bornemann@trolltech.com>
3931 Reviewed by Sam Weinig.
3933 https://bugs.webkit.org/show_bug.cgi?id=20746
3935 Added WINCE platform macro.
3939 2008-09-09 Sam Weinig <sam@webkit.org>
3941 Reviewed by Mark Rowe.
3943 Remove unnecessary override of getOffset.
3945 Sunspider reports this as a .6% progression.
3947 * JavaScriptCore.exp:
3949 (JSC::JSObject::getDirectLocation):
3950 (JSC::JSObject::getOwnPropertySlotForWrite):
3951 (JSC::JSObject::putDirect):
3952 * kjs/PropertyMap.cpp:
3953 * kjs/PropertyMap.h:
3955 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3957 Reviewed by Maciej Stachowiak.
3959 Bug 20759: Remove MacroAssembler
3960 <https://bugs.webkit.org/show_bug.cgi?id=20759>
3962 Remove MacroAssembler and move its functionality to X86Assembler.
3964 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3965 * JavaScriptCore.xcodeproj/project.pbxproj:
3967 (JSC::CTI::emitGetArg):
3968 (JSC::CTI::emitGetPutArg):
3969 (JSC::CTI::emitPutArg):
3970 (JSC::CTI::emitPutCTIParam):
3971 (JSC::CTI::emitGetCTIParam):
3972 (JSC::CTI::emitPutToCallFrameHeader):
3973 (JSC::CTI::emitGetFromCallFrameHeader):
3974 (JSC::CTI::emitPutResult):
3975 (JSC::CTI::emitDebugExceptionCheck):
3976 (JSC::CTI::emitJumpSlowCaseIfNotImm):
3977 (JSC::CTI::emitJumpSlowCaseIfNotImms):
3978 (JSC::CTI::emitFastArithDeTagImmediate):
3979 (JSC::CTI::emitFastArithReTagImmediate):
3980 (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
3981 (JSC::CTI::emitFastArithImmToInt):
3982 (JSC::CTI::emitFastArithIntToImmOrSlowCase):
3983 (JSC::CTI::emitFastArithIntToImmNoCheck):
3984 (JSC::CTI::compileOpCall):
3985 (JSC::CTI::emitSlowScriptCheck):
3986 (JSC::CTI::privateCompileMainPass):
3987 (JSC::CTI::privateCompileSlowCases):
3988 (JSC::CTI::privateCompile):
3989 (JSC::CTI::privateCompileGetByIdSelf):
3990 (JSC::CTI::privateCompileGetByIdProto):
3991 (JSC::CTI::privateCompileGetByIdChain):
3992 (JSC::CTI::privateCompilePutByIdReplace):
3993 (JSC::CTI::privateArrayLengthTrampoline):
3994 (JSC::CTI::privateStringLengthTrampoline):
3995 (JSC::CTI::compileRegExp):
3997 (JSC::CallRecord::CallRecord):
3998 (JSC::JmpTable::JmpTable):
3999 (JSC::SlowCaseEntry::SlowCaseEntry):
4000 (JSC::CTI::JSRInfo::JSRInfo):
4001 * masm/MacroAssembler.h: Removed.
4002 * masm/MacroAssemblerWin.cpp: Removed.
4003 * masm/X86Assembler.h:
4004 (JSC::X86Assembler::emitConvertToFastCall):
4005 (JSC::X86Assembler::emitRestoreArgumentReference):
4007 (JSC::WRECGenerator::WRECGenerator):
4008 (JSC::WRECParser::WRECParser):
4010 2008-09-09 Sam Weinig <sam@webkit.org>
4012 Reviewed by Cameron Zwarich.
4014 Don't waste the first item in the PropertyStorage.
4016 - Fix typo (makingCount -> markingCount)
4017 - Remove undefined method declaration.
4019 No change on Sunspider.
4022 (JSC::JSObject::mark):
4023 * kjs/PropertyMap.cpp:
4024 (JSC::PropertyMap::put):
4025 (JSC::PropertyMap::remove):
4026 (JSC::PropertyMap::getOffset):
4027 (JSC::PropertyMap::insert):
4028 (JSC::PropertyMap::rehash):
4029 (JSC::PropertyMap::resizePropertyStorage):
4030 (JSC::PropertyMap::checkConsistency):
4031 * kjs/PropertyMap.h:
4032 (JSC::PropertyMap::markingCount): Fix typo.
4034 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4038 Speculative Windows build fix.
4040 * masm/MacroAssemblerWin.cpp:
4041 (JSC::MacroAssembler::emitConvertToFastCall):
4042 (JSC::MacroAssembler::emitRestoreArgumentReference):
4044 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4046 Reviewed by Maciej Stachowiak.
4048 Bug 20755: Create an X86 namespace for register names and other things
4049 <https://bugs.webkit.org/show_bug.cgi?id=20755>
4051 Create an X86 namespace to put X86 register names. Perhaps I will move
4052 opcode names here later as well.
4055 (JSC::CTI::emitGetArg):
4056 (JSC::CTI::emitGetPutArg):
4057 (JSC::CTI::emitPutArg):
4058 (JSC::CTI::emitPutArgConstant):
4059 (JSC::CTI::emitPutCTIParam):
4060 (JSC::CTI::emitGetCTIParam):
4061 (JSC::CTI::emitPutToCallFrameHeader):
4062 (JSC::CTI::emitGetFromCallFrameHeader):
4063 (JSC::CTI::emitPutResult):
4064 (JSC::CTI::emitDebugExceptionCheck):
4065 (JSC::CTI::emitJumpSlowCaseIfNotImms):
4066 (JSC::CTI::compileOpCall):
4067 (JSC::CTI::emitSlowScriptCheck):
4068 (JSC::CTI::privateCompileMainPass):
4069 (JSC::CTI::privateCompileSlowCases):
4070 (JSC::CTI::privateCompile):
4071 (JSC::CTI::privateCompileGetByIdSelf):
4072 (JSC::CTI::privateCompileGetByIdProto):
4073 (JSC::CTI::privateCompileGetByIdChain):
4074 (JSC::CTI::privateCompilePutByIdReplace):
4075 (JSC::CTI::privateArrayLengthTrampoline):
4076 (JSC::CTI::privateStringLengthTrampoline):
4077 (JSC::CTI::compileRegExp):
4079 * masm/X86Assembler.h:
4081 (JSC::X86Assembler::emitModRm_rm):
4082 (JSC::X86Assembler::emitModRm_rm_Unchecked):
4083 (JSC::X86Assembler::emitModRm_rmsib):
4085 (JSC::WRECGenerator::generateNonGreedyQuantifier):
4086 (JSC::WRECGenerator::generateGreedyQuantifier):
4087 (JSC::WRECGenerator::generateParentheses):
4088 (JSC::WRECGenerator::generateBackreference):
4089 (JSC::WRECGenerator::gernerateDisjunction):
4092 2008-09-09 Sam Weinig <sam@webkit.org>
4094 Reviewed by Geoffrey Garen.
4096 Remove unnecessary friend declaration.
4098 * kjs/PropertyMap.h:
4100 2008-09-09 Sam Weinig <sam@webkit.org>
4102 Reviewed by Geoffrey Garen.
4104 Replace uses of PropertyMap::get and PropertyMap::getLocation with
4105 PropertyMap::getOffset.
4107 Sunspider reports this as a .6% improvement.
4109 * JavaScriptCore.exp:
4111 (JSC::JSObject::put):
4112 (JSC::JSObject::deleteProperty):
4113 (JSC::JSObject::getPropertyAttributes):
4115 (JSC::JSObject::getDirect):
4116 (JSC::JSObject::getDirectLocation):
4117 (JSC::JSObject::locationForOffset):
4118 * kjs/PropertyMap.cpp:
4119 (JSC::PropertyMap::remove):
4120 (JSC::PropertyMap::getOffset):
4121 * kjs/PropertyMap.h:
4123 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4125 Reviewed by Sam Weinig.
4127 Bug 20754: Remove emit prefix from assembler opcode methods
4128 <https://bugs.webkit.org/show_bug.cgi?id=20754>
4131 (JSC::CTI::emitGetArg):
4132 (JSC::CTI::emitGetPutArg):
4133 (JSC::CTI::emitPutArg):
4134 (JSC::CTI::emitPutArgConstant):
4135 (JSC::CTI::emitPutCTIParam):
4136 (JSC::CTI::emitGetCTIParam):
4137 (JSC::CTI::emitPutToCallFrameHeader):
4138 (JSC::CTI::emitGetFromCallFrameHeader):
4139 (JSC::CTI::emitPutResult):
4140 (JSC::CTI::emitDebugExceptionCheck):
4141 (JSC::CTI::emitCall):
4142 (JSC::CTI::emitJumpSlowCaseIfNotImm):
4143 (JSC::CTI::emitJumpSlowCaseIfNotImms):
4144 (JSC::CTI::emitFastArithDeTagImmediate):
4145 (JSC::CTI::emitFastArithReTagImmediate):
4146 (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
4147 (JSC::CTI::emitFastArithImmToInt):
4148 (JSC::CTI::emitFastArithIntToImmOrSlowCase):
4149 (JSC::CTI::emitFastArithIntToImmNoCheck):
4150 (JSC::CTI::compileOpCall):
4151 (JSC::CTI::emitSlowScriptCheck):
4152 (JSC::CTI::privateCompileMainPass):
4153 (JSC::CTI::privateCompileSlowCases):
4154 (JSC::CTI::privateCompile):
4155 (JSC::CTI::privateCompileGetByIdSelf):
4156 (JSC::CTI::privateCompileGetByIdProto):
4157 (JSC::CTI::privateCompileGetByIdChain):
4158 (JSC::CTI::privateCompilePutByIdReplace):
4159 (JSC::CTI::privateArrayLengthTrampoline):
4160 (JSC::CTI::privateStringLengthTrampoline):
4161 (JSC::CTI::compileRegExp):
4162 * masm/MacroAssemblerWin.cpp:
4163 (JSC::MacroAssembler::emitConvertToFastCall):
4164 (JSC::MacroAssembler::emitRestoreArgumentReference):
4165 * masm/X86Assembler.h:
4166 (JSC::X86Assembler::pushl_r):
4167 (JSC::X86Assembler::pushl_m):
4168 (JSC::X86Assembler::popl_r):
4169 (JSC::X86Assembler::popl_m):
4170 (JSC::X86Assembler::movl_rr):
4171 (JSC::X86Assembler::addl_rr):
4172 (JSC::X86Assembler::addl_i8r):
4173 (JSC::X86Assembler::addl_i32r):
4174 (JSC::X86Assembler::addl_mr):
4175 (JSC::X86Assembler::andl_rr):
4176 (JSC::X86Assembler::andl_i32r):
4177 (JSC::X86Assembler::cmpl_i8r):
4178 (JSC::X86Assembler::cmpl_rr):
4179 (JSC::X86Assembler::cmpl_rm):
4180 (JSC::X86Assembler::cmpl_i32r):
4181 (JSC::X86Assembler::cmpl_i32m):
4182 (JSC::X86Assembler::cmpw_rm):
4183 (JSC::X86Assembler::orl_rr):
4184 (JSC::X86Assembler::subl_rr):
4185 (JSC::X86Assembler::subl_i8r):
4186 (JSC::X86Assembler::subl_i32r):
4187 (JSC::X86Assembler::subl_mr):
4188 (JSC::X86Assembler::testl_i32r):
4189 (JSC::X86Assembler::testl_rr):
4190 (JSC::X86Assembler::xorl_i8r):
4191 (JSC::X86Assembler::xorl_rr):
4192 (JSC::X86Assembler::sarl_i8r):
4193 (JSC::X86Assembler::sarl_CLr):
4194 (JSC::X86Assembler::shl_i8r):
4195 (JSC::X86Assembler::shll_CLr):
4196 (JSC::X86Assembler::mull_rr):
4197 (JSC::X86Assembler::idivl_r):
4198 (JSC::X86Assembler::cdq):
4199 (JSC::X86Assembler::movl_mr):
4200 (JSC::X86Assembler::movzwl_mr):
4201 (JSC::X86Assembler::movl_rm):
4202 (JSC::X86Assembler::movl_i32r):
4203 (JSC::X86Assembler::movl_i32m):
4204 (JSC::X86Assembler::leal_mr):
4205 (JSC::X86Assembler::ret):
4206 (JSC::X86Assembler::jmp_r):
4207 (JSC::X86Assembler::jmp_m):
4208 (JSC::X86Assembler::call_r):
4210 (JSC::WRECGenerator::generateBacktrack1):
4211 (JSC::WRECGenerator::generateBacktrackBackreference):
4212 (JSC::WRECGenerator::generateBackreferenceQuantifier):
4213 (JSC::WRECGenerator::generateNonGreedyQuantifier):
4214 (JSC::WRECGenerator::generateGreedyQuantifier):
4215 (JSC::WRECGenerator::generatePatternCharacter):
4216 (JSC::WRECGenerator::generateCharacterClassInvertedRange):
4217 (JSC::WRECGenerator::generateCharacterClassInverted):
4218 (JSC::WRECGenerator::generateCharacterClass):
4219 (JSC::WRECGenerator::generateParentheses):
4220 (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
4221 (JSC::WRECGenerator::generateAssertionBOL):
4222 (JSC::WRECGenerator::generateAssertionEOL):
4223 (JSC::WRECGenerator::generateAssertionWordBoundary):
4224 (JSC::WRECGenerator::generateBackreference):
4225 (JSC::WRECGenerator::gernerateDisjunction):
4227 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
4229 Reviewed by Maciej Stachowiak.
4231 Clean up the WREC code some more.
4234 (JSC::CTI::compileRegExp):
4236 (JSC::getCharacterClassNewline):
4237 (JSC::getCharacterClassDigits):
4238 (JSC::getCharacterClassSpaces):
4239 (JSC::getCharacterClassWordchar):
4240 (JSC::getCharacterClassNondigits):
4241 (JSC::getCharacterClassNonspaces):
4242 (JSC::getCharacterClassNonwordchar):
4243 (JSC::WRECGenerator::generateBacktrack1):
4244 (JSC::WRECGenerator::generateBacktrackBackreference):
4245 (JSC::WRECGenerator::generateBackreferenceQuantifier):
4246 (JSC::WRECGenerator::generateNonGreedyQuantifier):
4247 (JSC::WRECGenerator::generateGreedyQuantifier):
4248 (JSC::WRECGenerator::generatePatternCharacter):
4249 (JSC::WRECGenerator::generateCharacterClassInvertedRange):
4250 (JSC::WRECGenerator::generateCharacterClassInverted):
4251 (JSC::WRECGenerator::generateCharacterClass):
4252 (JSC::WRECGenerator::generateParentheses):
4253 (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
4254 (JSC::WRECGenerator::generateAssertionBOL):
4255 (JSC::WRECGenerator::generateAssertionEOL):
4256 (JSC::WRECGenerator::generateAssertionWordBoundary):
4257 (JSC::WRECGenerator::generateBackreference):
4258 (JSC::WRECGenerator::gernerateDisjunction):
4259 (JSC::WRECParser::parseCharacterClass):
4260 (JSC::WRECParser::parseEscape):
4261 (JSC::WRECParser::parseTerm):
4264 2008-09-09 Mark Rowe <mrowe@apple.com>
4266 Build fix, rubber-stamped by Anders Carlsson.
4268 Silence spurious build warnings about missing format attributes on functions in Assertions.cpp.