1 2008-10-03 Maciej Stachowiak <mjs@apple.com>
3 Rubber stamped by Cameron Zwarich.
5 - fix mistaken change of | to || which caused a big perf regression on EarleyBoyer
9 2008-10-02 Darin Adler <darin@apple.com>
11 Reviewed by Geoff Garen.
13 - https://bugs.webkit.org/show_bug.cgi?id=21321
14 Bug 21321: speed up JavaScriptCore by inlining Heap in JSGlobalData
16 1.019x as fast on SunSpider.
19 (JSEvaluateScript): Use heap. instead of heap-> to work with the heap.
20 (JSCheckScriptSyntax): Ditto.
21 (JSGarbageCollect): Ditto.
22 (JSReportExtraMemoryCost): Ditto.
23 * API/JSContextRef.cpp:
24 (JSGlobalContextRetain): Ditto.
25 (JSGlobalContextRelease): Destroy the heap with the destroy function instead
26 of the delete operator.
27 (JSContextGetGlobalObject): Use heap. instead of heap-> to work with the heap.
28 * API/JSObjectRef.cpp:
29 (JSObjectMake): Use heap. instead of heap-> to work with the heap.
30 (JSObjectMakeFunctionWithCallback): Ditto.
31 (JSObjectMakeConstructor): Ditto.
32 (JSObjectMakeFunction): Ditto.
33 (JSObjectMakeArray): Ditto.
34 (JSObjectMakeDate): Ditto.
35 (JSObjectMakeError): Ditto.
36 (JSObjectMakeRegExp): Ditto.
37 (JSObjectHasProperty): Ditto.
38 (JSObjectGetProperty): Ditto.
39 (JSObjectSetProperty): Ditto.
40 (JSObjectGetPropertyAtIndex): Ditto.
41 (JSObjectSetPropertyAtIndex): Ditto.
42 (JSObjectDeleteProperty): Ditto.
43 (JSObjectCallAsFunction): Ditto.
44 (JSObjectCallAsConstructor): Ditto.
45 (JSObjectCopyPropertyNames): Ditto.
46 (JSPropertyNameAccumulatorAddName): Ditto.
48 (JSValueIsEqual): Ditto.
49 (JSValueIsInstanceOfConstructor): Ditto.
50 (JSValueMakeNumber): Ditto.
51 (JSValueMakeString): Ditto.
52 (JSValueToNumber): Ditto.
53 (JSValueToStringCopy): Ditto.
54 (JSValueToObject): Ditto.
55 (JSValueProtect): Ditto.
56 (JSValueUnprotect): Ditto.
59 (JSC::ExecState::heap): Update to use the & operator.
61 * kjs/JSGlobalData.cpp:
62 (JSC::JSGlobalData::JSGlobalData): Update to initialize a heap member
63 instead of calling new to make a heap.
64 (JSC::JSGlobalData::~JSGlobalData): Destroy the heap with the destroy
65 function instead of the delete operator.
66 * kjs/JSGlobalData.h: Change from Heap* to a Heap.
67 * kjs/JSGlobalObject.cpp:
68 (JSC::JSGlobalObject::mark): Use the & operator here.
69 (JSC::JSGlobalObject::operator new): Use heap. instead of heap-> to work
72 2008-10-02 Cameron Zwarich <zwarich@apple.com>
74 Reviewed by Geoff Garen.
76 Bug 21317: Replace RegisterFile size and capacity information with Register pointers
77 <https://bugs.webkit.org/show_bug.cgi?id=21317>
79 This is a 2.3% speedup on the V8 DeltaBlue benchmark, a 3.3% speedup on
80 the V8 Raytrace benchmark, and a 1.0% speedup on SunSpider.
83 (JSC::slideRegisterWindowForCall):
84 (JSC::Machine::callEval):
85 (JSC::Machine::execute):
86 (JSC::Machine::privateExecute):
87 (JSC::Machine::cti_op_call_JSFunction):
88 (JSC::Machine::cti_op_construct_JSConstruct):
89 * VM/RegisterFile.cpp:
90 (JSC::RegisterFile::~RegisterFile):
92 (JSC::RegisterFile::RegisterFile):
93 (JSC::RegisterFile::start):
94 (JSC::RegisterFile::end):
95 (JSC::RegisterFile::size):
96 (JSC::RegisterFile::shrink):
97 (JSC::RegisterFile::grow):
98 (JSC::RegisterFile::lastGlobal):
99 (JSC::RegisterFile::markGlobals):
100 (JSC::RegisterFile::markCallFrames):
101 * kjs/JSGlobalObject.cpp:
102 (JSC::JSGlobalObject::copyGlobalsTo):
104 2008-10-02 Cameron Zwarich <zwarich@apple.com>
106 Rubber-stamped by Darin Adler.
108 Change bitwise operations introduced in r37166 to boolean operations. We
109 only use bitwise operations over boolean operations for increasing
110 performance in extremely hot code, but that does not apply to anything
115 2008-10-02 Gavin Barraclough <barraclough@apple.com>
117 Reviewed by Darin Adler.
119 Fix for bug #21232 - should reset m_isPendingDash on flush,
120 and should allow '\-' as beginning or end of a range (though
121 not to specifiy a range itself).
124 * wrec/CharacterClassConstructor.cpp:
125 (JSC::CharacterClassConstructor::put):
126 (JSC::CharacterClassConstructor::flush):
127 * wrec/CharacterClassConstructor.h:
128 (JSC::CharacterClassConstructor::flushBeforeEscapedHyphen):
130 (JSC::WRECGenerator::generateDisjunction):
131 (JSC::WRECParser::parseCharacterClass):
132 (JSC::WRECParser::parseDisjunction):
135 2008-10-02 Darin Adler <darin@apple.com>
137 Reviewed by Sam Weinig.
139 - remove the "static" from declarations in a header file, since we
140 don't want them to have internal linkage
142 * VM/Machine.h: Remove the static keyword from the constant and the
143 three inline functions that Geoff just moved here.
145 2008-10-02 Geoffrey Garen <ggaren@apple.com>
147 Reviewed by Sam Weinig.
149 Fixed https://bugs.webkit.org/show_bug.cgi?id=21283.
150 Profiler Crashes When Started
154 (JSC::makeHostCallFramePointer):
155 (JSC::isHostCallFrame):
156 (JSC::stripHostCallFrameBit): Moved some things to the header so
157 JSGlobalObject could use them.
159 * kjs/JSGlobalObject.h:
160 (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Call the
161 new makeHostCallFramePointer API, since 0 no longer indicates a host
164 2008-10-02 Alexey Proskuryakov <ap@webkit.org>
166 Reviewed by Darin Adler.
168 https://bugs.webkit.org/show_bug.cgi?id=21304
169 Stop using a static wrapper map for WebCore JS bindings
171 * kjs/JSGlobalData.cpp:
172 (JSC::JSGlobalData::JSGlobalData):
173 (JSC::JSGlobalData::~JSGlobalData):
174 (JSC::JSGlobalData::ClientData::~ClientData):
175 * kjs/JSGlobalData.h:
176 Added a client data member to JSGlobalData. WebCore will use it to store bindings-related
179 * JavaScriptCore.exp: Export virtual ClientData destructor.
181 2008-10-02 Geoffrey Garen <ggaren@apple.com>
189 2008-10-01 Geoffrey Garen <ggaren@apple.com>
191 Reviewed by Darin Adler and Cameron Zwarich.
193 Preliminary step toward dynamic recompilation: Standardized and
194 simplified the parsing interface.
196 The main goal in this patch is to make it easy to ask for a duplicate
197 compilation, and get back a duplicate result -- same source URL, same
198 debugger / profiler ID, same toString behavior, etc.
200 The basic unit of compilation and evaluation is now SourceCode, which
201 encompasses a SourceProvider, a range in that provider, and a starting
204 A SourceProvider now encompasses a source URL, and *is* a source ID,
205 since a pointer is a unique identifier.
209 (JSCheckScriptSyntax): Provide a SourceCode to the Interpreter, since
210 other APIs are no longer supported.
213 (JSC::EvalCodeCache::get): Provide a SourceCode to the Interpreter, since
214 other APIs are no longer supported.
215 (JSC::CodeBlock::CodeBlock): ASSERT something that used to be ASSERTed
216 by our caller -- this is a better bottleneck.
218 * VM/CodeGenerator.cpp:
219 (JSC::CodeGenerator::CodeGenerator): Updated for the fact that
220 FunctionBodyNode's parameters are no longer a WTF::Vector.
223 (JSC::Arguments::Arguments): ditto
225 * kjs/DebuggerCallFrame.cpp:
226 (JSC::DebuggerCallFrame::evaluate): Provide a SourceCode to the Parser,
227 since other APIs are no longer supported.
229 * kjs/FunctionConstructor.cpp:
230 (JSC::constructFunction): Provide a SourceCode to the Parser, since
231 other APIs are no longer supported. Adopt FunctionBodyNode's new
234 * kjs/JSFunction.cpp:
235 (JSC::JSFunction::lengthGetter):
236 (JSC::JSFunction::getParameterName): Updated for the fact that
237 FunctionBodyNode's parameters are no longer a wtf::Vector.
239 * kjs/JSFunction.h: Nixed some cruft.
241 * kjs/JSGlobalObjectFunctions.cpp:
242 (JSC::globalFuncEval): Provide a SourceCode to the Parser, since
243 other APIs are no longer supported.
246 (JSC::Parser::parse): Require a SourceCode argument, instead of a bunch
247 of broken out parameters. Stop tracking sourceId as an integer, since we
248 use the SourceProvider pointer for this now. Don't clamp the
249 startingLineNumber, since SourceCode does that now.
252 (JSC::Parser::parse): Standardized the parsing interface to require a
260 (runInteractive): Provide a SourceCode to the Interpreter, since
261 other APIs are no longer supported.
263 * kjs/SourceProvider.h:
264 (JSC::SourceProvider::SourceProvider):
265 (JSC::SourceProvider::url):
266 (JSC::SourceProvider::asId):
267 (JSC::UStringSourceProvider::create):
268 (JSC::UStringSourceProvider::UStringSourceProvider): Added new
269 responsibilities described above.
272 (JSC::SourceCode::SourceCode):
273 (JSC::SourceCode::toString):
274 (JSC::SourceCode::provider):
275 (JSC::SourceCode::firstLine):
276 (JSC::SourceCode::data):
277 (JSC::SourceCode::length): Added new responsibilities described above.
278 Renamed SourceRange to SourceCode, based on review feedback. Added
279 a makeSource function for convenience.
281 * kjs/debugger.h: Provide a SourceCode to the client, since other APIs
282 are no longer supported.
284 * kjs/grammar.y: Provide startingLineNumber when creating a SourceCode.
286 * kjs/debugger.h: Treat sourceId as intptr_t to avoid loss of precision
289 * kjs/interpreter.cpp:
290 (JSC::Interpreter::checkSyntax):
291 (JSC::Interpreter::evaluate):
292 * kjs/interpreter.h: Require a SourceCode instead of broken out arguments.
295 (JSC::Lexer::setCode):
297 (JSC::Lexer::sourceRange): Fold together the SourceProvider and line number
298 into a SourceCode. Fixed a bug where the Lexer would accidentally keep
299 alive the last SourceProvider forever.
302 (JSC::ScopeNode::ScopeNode):
303 (JSC::ProgramNode::ProgramNode):
304 (JSC::ProgramNode::create):
305 (JSC::EvalNode::EvalNode):
306 (JSC::EvalNode::generateCode):
307 (JSC::EvalNode::create):
308 (JSC::FunctionBodyNode::FunctionBodyNode):
309 (JSC::FunctionBodyNode::finishParsing):
310 (JSC::FunctionBodyNode::create):
311 (JSC::FunctionBodyNode::generateCode):
312 (JSC::ProgramNode::generateCode):
313 (JSC::FunctionBodyNode::paramString):
316 (JSC::ScopeNode::sourceId):
317 (JSC::FunctionBodyNode::):
318 (JSC::FunctionBodyNode::parameterCount):
319 (JSC::FuncExprNode::):
320 (JSC::FuncDeclNode::): Store a SourceCode in all ScopeNodes, since
321 SourceCode is now responsible for tracking URL, ID, etc. Streamlined
322 some ad hoc FunctionBodyNode fixups into a "finishParsing" function, to
323 help make clear what you need to do in order to finish parsing a
327 (WTF::::releaseBuffer): Don't ASSERT that releaseBuffer() is only called
328 when buffer is not 0, since FunctionBodyNode is more than happy
329 to get back a 0 buffer, and other functions like RefPtr::release() allow
332 2008-10-01 Cameron Zwarich <zwarich@apple.com>
334 Reviewed by Maciej Stachowiak.
336 Bug 21289: REGRESSION (r37160): Inspector crashes on load
337 <https://bugs.webkit.org/show_bug.cgi?id=21289>
339 The code in Arguments::mark() in r37160 was wrong. It marks indices in
340 d->registers, but that makes no sense (they are local variables, not
341 arguments). It should mark those indices in d->registerArray instead.
343 This patch also changes Arguments::copyRegisters() to use d->numParameters
344 instead of recomputing it.
347 (JSC::Arguments::mark):
349 (JSC::Arguments::copyRegisters):
351 2008-09-30 Darin Adler <darin@apple.com>
353 Reviewed by Eric Seidel.
355 - https://bugs.webkit.org/show_bug.cgi?id=21214
356 work on getting rid of ExecState
358 Eliminate some unneeded uses of dynamicGlobalObject.
360 * API/JSClassRef.cpp:
361 (OpaqueJSClass::contextData): Changed to use a map in the global data instead
362 of on the global object. Also fixed to use only a single hash table lookup.
364 * API/JSObjectRef.cpp:
365 (JSObjectMakeConstructor): Use lexicalGlobalObject rather than dynamicGlobalObject
366 to get the object prototype.
368 * kjs/ArrayPrototype.cpp:
369 (JSC::arrayProtoFuncToString): Use arrayVisitedElements set in global data rather
370 than in the global object.
371 (JSC::arrayProtoFuncToLocaleString): Ditto.
372 (JSC::arrayProtoFuncJoin): Ditto.
374 * kjs/JSGlobalData.cpp:
375 (JSC::JSGlobalData::JSGlobalData): Don't initialize opaqueJSClassData, since
376 it's no longer a pointer.
377 (JSC::JSGlobalData::~JSGlobalData): We still need to delete all the values, but
378 we don't need to delete the map since it's no longer a pointer.
380 * kjs/JSGlobalData.h: Made opaqueJSClassData a map instead of a pointer to a map.
381 Also added arrayVisitedElements.
383 * kjs/JSGlobalObject.h: Removed arrayVisitedElements.
386 (functionRun): Use lexicalGlobalObject instead of dynamicGlobalObject.
387 (functionLoad): Ditto.
389 2008-10-01 Cameron Zwarich <zwarich@apple.com>
393 Speculative Windows build fix.
397 2008-10-01 Cameron Zwarich <zwarich@apple.com>
399 Reviewed by Darin Adler.
401 Bug 21123: using "arguments" in a function should not force creation of an activation object
402 <https://bugs.webkit.org/show_bug.cgi?id=21123>
404 Make the 'arguments' object not require a JSActivation. We store the
405 'arguments' object in the OptionalCalleeArguments call frame slot. We
406 need to be able to get the original 'arguments' object to tear it off
407 when returning from a function, but 'arguments' may be assigned to in a
410 Therefore, we use the OptionalCalleeArguments slot when we want to get
411 the original activation or we know that 'arguments' was not assigned a
412 different value. When 'arguments' may have been assigned a new value,
413 we use a new local variable that is initialized with 'arguments'. Since
414 a function parameter named 'arguments' may overwrite the value of
415 'arguments', we also need to be careful to look up 'arguments' in the
416 symbol table, so we get the parameter named 'arguments' instead of the
417 local variable that we have added for holding the 'arguments' object.
419 This is a 19.1% win on the V8 Raytrace benchmark using the SunSpider
420 harness, and a 20.7% win using the V8 harness. This amounts to a 6.5%
421 total speedup on the V8 benchmark suite using the V8 harness.
424 (JSC::CTI::privateCompileMainPass):
426 * VM/CodeGenerator.cpp:
427 (JSC::CodeGenerator::CodeGenerator):
429 (JSC::Machine::unwindCallFrame):
430 (JSC::Machine::privateExecute):
431 (JSC::Machine::retrieveArguments):
432 (JSC::Machine::cti_op_init_arguments):
433 (JSC::Machine::cti_op_ret_activation_arguments):
436 (JSC::RegisterFile::):
438 (JSC::Arguments::mark):
439 (JSC::Arguments::fillArgList):
440 (JSC::Arguments::getOwnPropertySlot):
441 (JSC::Arguments::put):
443 (JSC::Arguments::setRegisters):
444 (JSC::Arguments::init):
445 (JSC::Arguments::Arguments):
446 (JSC::Arguments::copyRegisters):
447 (JSC::JSActivation::copyRegisters):
448 * kjs/JSActivation.cpp:
449 (JSC::JSActivation::argumentsGetter):
450 * kjs/JSActivation.h:
451 (JSC::JSActivation::JSActivationData::JSActivationData):
454 (JSC::ScopeNode::setUsesArguments):
455 * masm/X86Assembler.h:
456 (JSC::X86Assembler::):
457 (JSC::X86Assembler::orl_mr):
459 2008-10-01 Kevin McCullough <kmccullough@apple.com>
461 Rubberstamped by Geoff Garen.
463 Remove BreakpointCheckStatement because it's not used anymore.
464 No effect on sunspider or the jsc tests.
469 2008-09-30 Oliver Hunt <oliver@apple.com>
471 Reviewed by Geoff Garen.
473 Improve performance of CTI on windows.
475 Currently on platforms where the compiler doesn't allow us to safely
476 index relative to the address of a parameter we need to actually
477 provide a pointer to CTI runtime call arguments. This patch improves
478 performance in this case by making the CTI logic for restoring this
479 parameter much less conservative by only resetting it before we actually
480 make a call, rather than between each and every SF bytecode we generate
483 This results in a 3.6% progression on the v8 benchmark when compiled with MSVC.
486 (JSC::CTI::emitCall):
487 (JSC::CTI::compileOpCall):
488 (JSC::CTI::privateCompileMainPass):
489 (JSC::CTI::privateCompileSlowCases):
490 (JSC::CTI::privateCompilePutByIdTransition):
492 * masm/X86Assembler.h:
495 2008-09-30 Maciej Stachowiak <mjs@apple.com>
497 Reviewed by Oliver Hunt.
499 - track uses of "this", "with" and "catch" in the parser
501 Knowing this up front will be useful for future optimizations.
503 Perf and correctness remain the same.
508 2008-09-30 Sam Weinig <sam@webkit.org>
510 Reviewed by Mark Rowe.
512 Add WebKitAvailability macros for JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError,
513 and JSObjectMakeRegExp
517 2008-09-30 Darin Adler <darin@apple.com>
519 Reviewed by Geoff Garen.
521 - https://bugs.webkit.org/show_bug.cgi?id=21214
522 work on getting rid of ExecState
524 Replaced the m_prev field of ExecState with a bit in the
525 call frame pointer to indicate "host" call frames.
528 (JSC::makeHostCallFramePointer): Added. Sets low bit.
529 (JSC::isHostCallFrame): Added. Checks low bit.
530 (JSC::stripHostCallFrameBit): Added. Clears low bit.
531 (JSC::Machine::unwindCallFrame): Replaced null check that was
532 formerly used to detect host call frames with an isHostCallFrame check.
533 (JSC::Machine::execute): Pass in a host call frame pointer rather than
534 always passing 0 when starting execution from the host. This allows us
535 to follow the entire call frame pointer chain when desired, or to stop
536 at the host calls when that's desired.
537 (JSC::Machine::privateExecute): Replaced null check that was
538 formerly used to detect host call frames with an isHostCallFrame check.
539 (JSC::Machine::retrieveCaller): Ditto.
540 (JSC::Machine::retrieveLastCaller): Ditto.
541 (JSC::Machine::callFrame): Removed the code to walk up m_prev pointers
542 and replaced it with code that uses the caller pointer and uses the
543 stripHostCallFrameBit function.
545 * kjs/ExecState.cpp: Removed m_prev.
546 * kjs/ExecState.h: Ditto.
548 2008-09-30 Cameron Zwarich <zwarich@apple.com>
550 Reviewed by Geoff Garen.
552 Move all detection of 'arguments' in a lexical scope to the parser, in
553 preparation for fixing
555 Bug 21123: using "arguments" in a function should not force creation of an activation object
556 <https://bugs.webkit.org/show_bug.cgi?id=21123>
558 * VM/CodeGenerator.cpp:
559 (JSC::CodeGenerator::CodeGenerator):
563 2008-09-30 Geoffrey Garen <ggaren@apple.com>
568 (runWithScripts): Fixed indentation.
570 2008-09-30 Mark Rowe <mrowe@apple.com>
572 Rubber-stamped by Sam Weinig.
574 Build fix. Move InternalFunction::classInfo implementation into the .cpp
575 file to prevent the vtable for InternalFunction being generated as a weak symbol.
576 Has no effect on SunSpider.
578 * kjs/InternalFunction.cpp:
579 (JSC::InternalFunction::classInfo):
580 * kjs/InternalFunction.h:
582 2008-09-29 Maciej Stachowiak <mjs@apple.com>
584 Reviewed by Darin Adler.
586 - optimize appending a number to a string
587 https://bugs.webkit.org/show_bug.cgi?id=21203
589 It's pretty common in real-world code (and on some of the v8
590 benchmarks) to append a number to a string, so I made this one of
591 the fast cases, and also added support to UString to do it
592 directly without allocating a temporary UString.
594 ~1% speedup on v8 benchmark.
597 (JSC::jsAddSlowCase): Make this NEVER_INLINE because somehow otherwise
598 the change is a regression.
599 (JSC::jsAdd): Handle number + string special case.
600 (JSC::Machine::cti_op_add): Integrate much of the logic of jsAdd to
601 avoid exception check in the str + str, num + num and str + num cases.
603 (JSC::expandedSize): Make this a non-member function, since it needs to be
604 called in non-member functions but not outside this file.
605 (JSC::expandCapacity): Ditto.
606 (JSC::UString::expandCapacity): Call the non-member version.
607 (JSC::createRep): Helper to make a rep from a char*.
608 (JSC::UString::UString): Use above helper.
609 (JSC::concatenate): Guts of concatenating constructor for cases where first
610 item is a UString::Rep, and second is a UChar* and length, or a char*.
611 (JSC::UString::append): Implement for cases where first item is a UString::Rep,
612 and second is an int or double. Sadly duplicates logic of UString::from(int)
613 and UString::from(double).
616 2008-09-29 Darin Adler <darin@apple.com>
618 Reviewed by Sam Weinig.
620 - https://bugs.webkit.org/show_bug.cgi?id=21214
621 work on getting rid of ExecState
623 * JavaScriptCore.exp: Updated since JSGlobalObject::init
624 no longer takes a parameter.
627 (JSC::Machine::execute): Removed m_registerFile argument
628 for ExecState constructors.
630 * kjs/DebuggerCallFrame.cpp:
631 (JSC::DebuggerCallFrame::evaluate): Removed globalThisValue
632 argument for ExecState constructor.
635 (JSC::ExecState::ExecState): Removed globalThisValue and
636 registerFile arguments to constructors.
638 * kjs/ExecState.h: Removed m_globalThisValue and
639 m_registerFile data members.
641 * kjs/JSGlobalObject.cpp:
642 (JSC::JSGlobalObject::init): Removed globalThisValue
643 argument for ExecState constructor.
645 * kjs/JSGlobalObject.h:
646 (JSC::JSGlobalObject::JSGlobalObject): Got rid of parameter
647 for the init function.
649 2008-09-29 Geoffrey Garen <ggaren@apple.com>
651 Rubber-stamped by Cameron Zwarich.
653 Fixed https://bugs.webkit.org/show_bug.cgi?id=21225
654 Machine::retrieveLastCaller should check for a NULL codeBlock
656 In order to crash, you would need to call retrieveCaller in a situation
657 where you had two host call frames in a row in the register file. I
658 don't know how to make that happen, or if it's even possible, so I don't
659 have a test case -- but better safe than sorry!
662 (JSC::Machine::retrieveLastCaller):
664 2008-09-29 Geoffrey Garen <ggaren@apple.com>
666 Reviewed by Cameron Zwarich.
668 Store the callee ScopeChain, not the caller ScopeChain, in the call frame
669 header. Nix the "scopeChain" local variable and ExecState::m_scopeChain, and
670 access the callee ScopeChain through the call frame header instead.
672 Profit: call + return are simpler, because they don't have to update the
673 "scopeChain" local variable, or ExecState::m_scopeChain.
675 Because CTI keeps "r" in a register, reading the callee ScopeChain relative
676 to "r" can be very fast, in any cases we care to optimize.
678 0% speedup on empty function call benchmark. (5.5% speedup in bytecode.)
679 0% speedup on SunSpider. (7.5% speedup on controlflow-recursive.)
680 2% speedup on SunSpider --v8.
681 2% speedup on v8 benchmark.
683 * VM/CTI.cpp: Changed scope chain access to read the scope chain from
684 the call frame header. Sped up op_ret by changing it not to fuss with
685 the "scopeChain" local variable or ExecState::m_scopeChain.
687 * VM/CTI.h: Updated CTI trampolines not to take a ScopeChainNode*
688 argument, since that's stored in the call frame header now.
690 * VM/Machine.cpp: Access "scopeChain" and "codeBlock" through new helper
691 functions that read from the call frame header. Updated functions operating
692 on ExecState::m_callFrame to account for / take advantage of the fact that
693 Exec:m_callFrame is now never NULL.
695 Fixed a bug in op_construct, where it would use the caller's default
696 object prototype, rather than the callee's, when constructing a new object.
698 * VM/Machine.h: Made some helper functions available. Removed
699 ScopeChainNode* arguments to a lot of functions, since the ScopeChainNode*
700 is now stored in the call frame header.
702 * VM/RegisterFile.h: Renamed "CallerScopeChain" to "ScopeChain", since
703 that's what it is now.
705 * kjs/DebuggerCallFrame.cpp: Updated for change to ExecState signature.
708 * kjs/ExecState.h: Nixed ExecState::m_callFrame, along with the unused
709 isGlobalObject function.
711 * kjs/JSGlobalObject.cpp:
712 * kjs/JSGlobalObject.h: Gave the global object a fake call frame in
713 which to store the global scope chain, since our code now assumes that
714 it can always read the scope chain out of the ExecState's call frame.
716 2008-09-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
718 Reviewed by Sam Weinig.
720 Remove the isActivationObject() virtual method on JSObject and use
721 StructureID information instead. This should be slightly faster, but
722 isActivationObject() is only used in assertions and unwinding the stack
727 (JSC::Machine::unwindCallFrame):
728 (JSC::Machine::privateExecute):
729 (JSC::Machine::cti_op_ret_activation):
730 * kjs/JSActivation.cpp:
731 * kjs/JSActivation.h:
734 2008-09-29 Peter Gal <galpeter@inf.u-szeged.hu>
736 Reviewed and tweaked by Darin Adler.
738 Fix build for non-all-in-one platforms.
740 * kjs/StringPrototype.cpp: Added missing ASCIICType.h include.
742 2008-09-29 Bradley T. Hughes <bradley.hughes@nokia.com>
744 Reviewed by Simon Hausmann.
746 Fix compilation with icpc
752 2008-09-29 Thiago Macieira <thiago.macieira@nokia.com>
754 Reviewed by Simon Hausmann.
756 Changed copyright from Trolltech ASA to Nokia.
758 Nokia acquired Trolltech ASA, assets were transferred on September 26th 2008.
761 * wtf/qt/MainThreadQt.cpp:
763 2008-09-29 Simon Hausmann <hausmann@webkit.org>
765 Reviewed by Lars Knoll.
767 Don't accidentially install libJavaScriptCore.a for the build inside
770 * JavaScriptCore.pro:
772 2008-09-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
774 Reviewed by Maciej Stachowiak.
776 Bug 21200: Allow direct access to 'arguments' without using op_resolve
777 <https://bugs.webkit.org/show_bug.cgi?id=21200>
779 Allow fast access to the 'arguments' object by adding an extra slot to
780 the callframe to store it.
782 This is a 3.0% speedup on the V8 Raytrace benchmark.
784 * JavaScriptCore.exp:
786 (JSC::CTI::privateCompileMainPass):
788 (JSC::CodeBlock::dump):
789 * VM/CodeGenerator.cpp:
790 (JSC::CodeGenerator::CodeGenerator):
791 (JSC::CodeGenerator::registerFor):
792 * VM/CodeGenerator.h:
793 (JSC::CodeGenerator::registerFor):
795 (JSC::Machine::initializeCallFrame):
796 (JSC::Machine::dumpRegisters):
797 (JSC::Machine::privateExecute):
798 (JSC::Machine::retrieveArguments):
799 (JSC::Machine::cti_op_call_JSFunction):
800 (JSC::Machine::cti_op_create_arguments):
801 (JSC::Machine::cti_op_construct_JSConstruct):
805 (JSC::RegisterFile::):
806 * kjs/JSActivation.cpp:
807 (JSC::JSActivation::mark):
808 (JSC::JSActivation::argumentsGetter):
809 * kjs/JSActivation.h:
810 (JSC::JSActivation::JSActivationData::JSActivationData):
813 (JSC::Parser::didFinishParsing):
815 (JSC::Parser::parse):
818 (JSC::ScopeNode::ScopeNode):
819 (JSC::ProgramNode::ProgramNode):
820 (JSC::ProgramNode::create):
821 (JSC::EvalNode::EvalNode):
822 (JSC::EvalNode::create):
823 (JSC::FunctionBodyNode::FunctionBodyNode):
824 (JSC::FunctionBodyNode::create):
826 (JSC::ScopeNode::usesArguments):
828 2008-09-28 Mark Rowe <mrowe@apple.com>
830 Reviewed by Sam Weinig.
832 Add an ASCII fast-path to toLowerCase and toUpperCase.
834 The fast path speeds up the common case of an ASCII-only string by up to 60% while adding a less than 5% penalty
835 to the less common non-ASCII case.
837 This also removes stringProtoFuncToLocaleLowerCase and stringProtoFuncToLocaleUpperCase, which were identical
838 to the non-locale variants of the functions. toLocaleLowerCase and toLocaleUpperCase now use the non-locale
839 variants of the functions directly.
841 * kjs/StringPrototype.cpp:
842 (JSC::stringProtoFuncToLowerCase):
843 (JSC::stringProtoFuncToUpperCase):
845 2008-09-28 Mark Rowe <mrowe@apple.com>
847 Reviewed by Cameron Zwarich.
849 Speed up parseInt and parseFloat.
851 Repeatedly indexing into a UString is slow, so retrieve a pointer into the underlying buffer once up front
852 and use that instead. This is a 7% win on a parseInt/parseFloat micro-benchmark.
854 * kjs/JSGlobalObjectFunctions.cpp:
858 2008-09-28 Simon Hausmann <hausmann@webkit.org>
860 Reviewed by David Hyatt.
862 In Qt's initializeThreading re-use an existing thread identifier for the main
865 currentThread() implicitly creates new identifiers and it could be that
866 it is called before initializeThreading().
868 * wtf/ThreadingQt.cpp:
869 (WTF::initializeThreading):
871 2008-09-27 Keishi Hattori <casey.hattori@gmail.com>
873 Added Machine::retrieveCaller to the export list.
875 Reviewed by Kevin McCullough and Tim Hatcher.
877 * JavaScriptCore.exp: Added Machine::retrieveCaller.
879 2008-09-27 Anders Carlsson <andersca@apple.com>
886 2008-09-27 Geoffrey Garen <ggaren@apple.com>
888 Reviewed by Cameron Zwarich.
890 https://bugs.webkit.org/show_bug.cgi?id=21175
892 Store the callee CodeBlock, not the caller CodeBlock, in the call frame
893 header. Nix the "codeBlock" local variable, and access the callee
894 CodeBlock through the call frame header instead.
896 Profit: call + return are simpler, because they don't have to update the
897 "codeBlock" local variable.
899 Because CTI keeps "r" in a register, reading the callee CodeBlock relative
900 to "r" can be very fast, in any cases we care to optimize. Presently,
901 no such cases seem important.
903 Also, stop writing "dst" to the call frame header. CTI doesn't use it.
905 21.6% speedup on empty function call benchmark.
906 3.8% speedup on SunSpider --v8.
907 2.1% speedup on v8 benchmark.
908 0.7% speedup on SunSpider (6% speedup on controlflow-recursive).
910 Small regression in bytecode, because currently every op_ret reads the
911 callee CodeBlock to check needsFullScopeChain, and bytecode does not
912 keep "r" in a register. On-balance, this is probably OK, since CTI is
913 our high-performance execution model. Also, this should go away once
914 we make needsFullScopeChain statically determinable at parse time.
917 (JSC::CTI::compileOpCall): The speedup!
918 (JSC::CTI::privateCompileSlowCases): ditto
921 (JSC::): Fixed up magic trampoline constants to account for the nixed
922 "codeBlock" argument.
923 (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock"
924 argument, since codeBlock is now stored in the call frame header.
926 * VM/Machine.cpp: Read the callee CodeBlock from the register file. Use
927 a NULL CallerRegisters in the call frame header to signal a built-in
928 caller, since CodeBlock is now never NULL.
930 * VM/Machine.h: Made some stand-alone functions Machine member functions
931 so they could call the private codeBlock() accessor in the Register
932 class, of which Machine is a friend. Renamed "CallerCodeBlock" to
933 "CodeBlock", since it's no longer the caller's CodeBlock.
935 * VM/RegisterFile.h: Marked some methods const to accommodate a
936 const RegisterFile* being passed around in Machine.cpp.
938 2008-09-26 Jan Michael Alonzo <jmalonzo@webkit.org>
940 Gtk build fix. Not reviewed.
942 Narrow-down the target of the JavaScriptCore .lut.h generator so
943 it won't try to create the WebCore .lut.hs.
947 2008-09-26 Matt Lilek <webkit@mattlilek.com>
949 Reviewed by Tim Hatcher.
951 Update FEATURE_DEFINES after ENABLE_CROSS_DOCUMENT_MESSAGING was removed.
953 * Configurations/JavaScriptCore.xcconfig:
955 2008-09-26 Cameron Zwarich <cwzwarich@uwaterloo.ca>
957 Rubber-stamped by Anders Carlson.
959 Change the name 'sc' to 'scopeChainNode' in a few places.
962 (JSC::EvalNode::generateCode):
963 (JSC::FunctionBodyNode::generateCode):
964 (JSC::ProgramNode::generateCode):
966 2008-09-26 Sam Weinig <sam@webkit.org>
968 Reviewed by Darin Adler.
970 Patch for https://bugs.webkit.org/show_bug.cgi?id=21152
971 Speedup static property get/put
973 Convert getting/setting static property values to use static functions
974 instead of storing an integer and switching in getValueProperty/putValueProperty.
977 (JSC::JSObject::deleteProperty):
978 (JSC::JSObject::getPropertyAttributes):
979 * kjs/MathObject.cpp:
980 (JSC::MathObject::getOwnPropertySlot):
981 * kjs/NumberConstructor.cpp:
982 (JSC::numberConstructorNaNValue):
983 (JSC::numberConstructorNegInfinity):
984 (JSC::numberConstructorPosInfinity):
985 (JSC::numberConstructorMaxValue):
986 (JSC::numberConstructorMinValue):
987 * kjs/PropertySlot.h:
988 (JSC::PropertySlot::):
989 * kjs/RegExpConstructor.cpp:
990 (JSC::regExpConstructorDollar1):
991 (JSC::regExpConstructorDollar2):
992 (JSC::regExpConstructorDollar3):
993 (JSC::regExpConstructorDollar4):
994 (JSC::regExpConstructorDollar5):
995 (JSC::regExpConstructorDollar6):
996 (JSC::regExpConstructorDollar7):
997 (JSC::regExpConstructorDollar8):
998 (JSC::regExpConstructorDollar9):
999 (JSC::regExpConstructorInput):
1000 (JSC::regExpConstructorMultiline):
1001 (JSC::regExpConstructorLastMatch):
1002 (JSC::regExpConstructorLastParen):
1003 (JSC::regExpConstructorLeftContext):
1004 (JSC::regExpConstructorRightContext):
1005 (JSC::setRegExpConstructorInput):
1006 (JSC::setRegExpConstructorMultiline):
1007 (JSC::RegExpConstructor::setInput):
1008 (JSC::RegExpConstructor::setMultiline):
1009 (JSC::RegExpConstructor::multiline):
1010 * kjs/RegExpConstructor.h:
1011 * kjs/RegExpObject.cpp:
1012 (JSC::regExpObjectGlobal):
1013 (JSC::regExpObjectIgnoreCase):
1014 (JSC::regExpObjectMultiline):
1015 (JSC::regExpObjectSource):
1016 (JSC::regExpObjectLastIndex):
1017 (JSC::setRegExpObjectLastIndex):
1018 * kjs/RegExpObject.h:
1019 (JSC::RegExpObject::setLastIndex):
1020 (JSC::RegExpObject::lastIndex):
1021 (JSC::RegExpObject::RegExpObjectData::RegExpObjectData):
1022 * kjs/StructureID.cpp:
1023 (JSC::StructureID::getEnumerablePropertyNames):
1024 * kjs/create_hash_table:
1028 (JSC::HashTable::createTable):
1029 (JSC::HashTable::deleteTable):
1030 (JSC::setUpStaticFunctionSlot):
1032 (JSC::HashEntry::initialize):
1033 (JSC::HashEntry::setKey):
1034 (JSC::HashEntry::key):
1035 (JSC::HashEntry::attributes):
1036 (JSC::HashEntry::function):
1037 (JSC::HashEntry::functionLength):
1038 (JSC::HashEntry::propertyGetter):
1039 (JSC::HashEntry::propertyPutter):
1040 (JSC::HashEntry::lexerValue):
1042 (JSC::HashTable::entry):
1043 (JSC::getStaticPropertySlot):
1044 (JSC::getStaticValueSlot):
1047 2008-09-26 Gavin Barraclough <barraclough@apple.com>
1049 Reviewed by Maciej Stachowiak & Oliver Hunt.
1051 Add support for reusing temporary JSNumberCells. This change is based on the observation
1052 that if the result of certain operations is a JSNumberCell and is consumed by a subsequent
1053 operation that would produce a JSNumberCell, we can reuse the object rather than allocating
1054 a fresh one. E.g. given the expression ((a * b) * c), we can statically determine that
1055 (a * b) will have a numeric result (or else it will have thrown an exception), so the result
1056 will either be a JSNumberCell or a JSImmediate.
1058 This patch changes three areas of JSC:
1059 * The AST now tracks type information about the result of each node.
1060 * This information is consumed in bytecode compilation, and certain bytecode operations
1061 now carry the statically determined type information about their operands.
1062 * CTI uses the information in a number of fashions:
1063 * Where an operand to certain arithmetic operations is reusable, it will plant code
1064 to try to perform the operation in JIT code & reuse the cell, where appropriate.
1065 * Where it can be statically determined that an operand can only be numeric (typically
1066 the result of another arithmetic operation) the code will not redundantly check that
1067 the JSCell is a JSNumberCell.
1068 * Where either of the operands to an add are non-numeric do not plant an optimized
1069 arithmetic code path, just call straight out to the C function.
1071 +6% Sunspider (10% progression on 3D, 16% progression on math, 60% progression on access-nbody),
1072 +1% v8-tests (improvements in raytrace & crypto)
1074 * VM/CTI.cpp: Add optimized code generation with reuse of temporary JSNumberCells.
1076 * kjs/JSNumberCell.h:
1077 * masm/X86Assembler.h:
1079 * VM/CodeBlock.cpp: Add type information to specific bytecodes.
1080 * VM/CodeGenerator.cpp:
1081 * VM/CodeGenerator.h:
1084 * kjs/nodes.cpp: Track static type information for nodes.
1086 * kjs/ResultDescriptor.h: (Added)
1087 * JavaScriptCore.xcodeproj/project.pbxproj:
1089 2008-09-26 Yichao Yin <yichao.yin@torchmobile.com.cn>
1091 Reviewed by George Staikos, Maciej Stachowiak.
1093 Add utility functions needed for upcoming WML code.
1096 (WTF::isASCIIPrintable):
1098 2008-09-26 Geoffrey Garen <ggaren@apple.com>
1100 Reviewed by Darin Adler.
1102 Reverted the part of r36614 that used static data because static data
1105 2008-09-26 Geoffrey Garen <ggaren@apple.com>
1107 Reviewed by Maciej Stachowiak.
1109 Removed dynamic check for whether the callee needs an activation object.
1110 Replaced with callee code to create the activation object.
1112 0.5% speedup on SunSpider.
1113 No change on v8 benchmark. (Might be a speedup, but it's in range of the
1116 0.7% speedup on v8 benchmark in bytecode.
1117 1.3% speedup on empty call benchmark in bytecode.
1120 (JSC::CTI::privateCompileMainPass): Added support for op_init_activation,
1121 the new opcode that specifies that the callee's initialization should
1122 create an activation object.
1123 (JSC::CTI::privateCompile): Removed previous code that did a similar
1124 thing in an ad-hoc way.
1127 (JSC::CodeBlock::dump): Added a case for dumping op_init_activation.
1129 * VM/CodeGenerator.cpp:
1130 (JSC::CodeGenerator::generate): Added fixup code to change op_init to
1131 op_init_activation if necessary. (With a better parser, we would know
1132 which to use from the beginning.)
1135 (JSC::Instruction::Instruction):
1136 (WTF::): Faster traits for the instruction vector. An earlier version
1137 of this patch relied on inserting at the beginning of the vector, and
1138 depended on this change for speed.
1141 (JSC::Machine::execute): Removed clients of setScopeChain, the old
1142 abstraction for dynamically checking for whether an activation object
1143 needed to be created.
1144 (JSC::Machine::privateExecute): ditto
1146 (JSC::Machine::cti_op_push_activation): Renamed this function from
1147 cti_vm_updateScopeChain, and made it faster by removing the call to
1151 * VM/Opcode.h: Declared op_init_activation.
1153 2008-09-24 Geoffrey Garen <ggaren@apple.com>
1155 Reviewed by Maciej Stachowiak.
1157 Move most of the return code back into the callee, now that the callee
1158 doesn't have to calculate anything dynamically.
1160 11.5% speedup on empty function call benchmark.
1162 SunSpider says 0.3% faster. SunSpider --v8 says no change.
1165 (JSC::CTI::compileOpCall):
1166 (JSC::CTI::privateCompileMainPass):
1167 (JSC::CTI::privateCompileSlowCases):
1169 2008-09-24 Sam Weinig <sam@webkit.org>
1171 Reviewed by Maciej Stachowiak.
1173 Remove staticFunctionGetter. There is only one remaining user of
1174 staticFunctionGetter and it can be converted to use setUpStaticFunctionSlot.
1176 * JavaScriptCore.exp:
1180 2008-09-24 Maciej Stachowiak <mjs@apple.com>
1182 Reviewed by Oliver Hunt.
1184 - inline JIT fast case of op_neq
1185 - remove extra level of function call indirection from slow cases of eq and neq
1187 1% speedup on Richards
1190 (JSC::CTI::privateCompileMainPass):
1191 (JSC::CTI::privateCompileSlowCases):
1193 (JSC::Machine::privateExecute):
1194 (JSC::Machine::cti_op_eq):
1195 (JSC::Machine::cti_op_neq):
1196 * kjs/operations.cpp:
1198 (JSC::equalSlowCase):
1200 (JSC::equalSlowCaseInline):
1202 2008-09-24 Sam Weinig <sam@webkit.org>
1204 Reviewed by Darin Adler.
1206 Fix for https://bugs.webkit.org/show_bug.cgi?id=21080
1207 <rdar://problem/6243534>
1208 Crash below Function.apply when using a runtime array as the argument list
1210 Test: plugins/bindings-array-apply-crash.html
1212 * kjs/FunctionPrototype.cpp:
1213 (JSC::functionProtoFuncApply): Revert to the slow case if the object inherits from
1214 JSArray (via ClassInfo) but is not a JSArray.
1216 2008-09-24 Kevin McCullough <kmccullough@apple.com>
1221 (JSC::statementListEmitCode):
1223 2008-09-24 Kevin McCullough <kmccullough@apple.com>
1227 Bug 21031: Breakpoints in the condition of loops only breaks the first
1229 - Now when setting breakpoints in the condition of a loop (for, while,
1230 for in, and do while) will successfully break each time throught the
1232 - For 'for' loops we need a little more complicated behavior that cannot
1233 be accomplished without some more significant changes:
1234 https://bugs.webkit.org/show_bug.cgi?id=21073
1237 (JSC::statementListEmitCode): We don't want to blindly emit a debug hook
1238 at the first line of loops, instead let the loop emit the debug hooks.
1239 (JSC::DoWhileNode::emitCode):
1240 (JSC::WhileNode::emitCode):
1241 (JSC::ForNode::emitCode):
1242 (JSC::ForInNode::emitCode):
1244 (JSC::StatementNode::):
1245 (JSC::DoWhileNode::):
1249 2008-09-24 Geoffrey Garen <ggaren@apple.com>
1251 Reviewed by Darin Adler.
1253 Fixed <rdar://problem/5605532> Need a SPI for telling JS the size of
1254 the objects it retains
1256 * API/tests/testapi.c: Test the new SPI a little.
1258 * API/JSSPI.cpp: Add the new SPI.
1259 * API/JSSPI.h: Add the new SPI.
1260 * JavaScriptCore.exp: Add the new SPI.
1261 * JavaScriptCore.xcodeproj/project.pbxproj: Add the new SPI.
1263 2008-09-24 Geoffrey Garen <ggaren@apple.com>
1265 Reviewed by Darin Adler.
1267 * API/JSBase.h: Filled in some missing function names.
1269 2008-09-24 Geoffrey Garen <ggaren@apple.com>
1271 Reviewed by Cameron Zwarich.
1273 Fixed https://bugs.webkit.org/show_bug.cgi?id=21057
1274 Crash in RegisterID::deref() running fast/canvas/canvas-putImageData.html
1276 * VM/CodeGenerator.h: Changed declaration order to ensure the
1277 m_lastConstant, which is a RefPtr that points into m_calleeRegisters,
1278 has its destructor called before the destructor for m_calleeRegisters.
1280 2008-09-24 Darin Adler <darin@apple.com>
1282 Reviewed by Sam Weinig.
1284 - https://bugs.webkit.org/show_bug.cgi?id=21047
1285 speed up ret_activation with inlining
1287 About 1% on v8-raytrace.
1289 * JavaScriptCore.exp: Removed JSVariableObject::setRegisters.
1291 * kjs/JSActivation.cpp: Moved copyRegisters to the header to make it inline.
1292 * kjs/JSActivation.h:
1293 (JSC::JSActivation::copyRegisters): Moved here. Also removed the registerArraySize
1294 argument to setRegisters, since the object doesn't need to store the number of
1297 * kjs/JSGlobalObject.cpp:
1298 (JSC::JSGlobalObject::reset): Removed unnecessary clearing left over from when we
1299 used this on objects that weren't brand new. These days, this function is really
1300 just part of the constructor.
1302 * kjs/JSGlobalObject.h: Added registerArraySize to JSGlobalObjectData, since
1303 JSVariableObjectData no longer needs it. Added a setRegisters override here
1304 that handles storing the size.
1306 * kjs/JSStaticScopeObject.h: Removed code to set registerArraySize, since it
1309 * kjs/JSVariableObject.cpp: Moved copyRegisterArray and setRegisters to the
1310 header to make them inline.
1311 * kjs/JSVariableObject.h: Removed registerArraySize from JSVariableObjectData,
1312 since it was only used for the global object.
1313 (JSC::JSVariableObject::copyRegisterArray): Moved here ot make it inline.
1314 (JSC::JSVariableObject::setRegisters): Moved here to make it inline. Also
1315 removed the code to set registerArraySize and changed an if statement into
1316 an assert to save an unnnecessary branch.
1318 2008-09-24 Maciej Stachowiak <mjs@apple.com>
1320 Reviewed by Oliver Hunt.
1322 - inline PropertyMap::getOffset to speed up polymorphic lookups
1324 ~1.5% speedup on v8 benchmark
1325 no effect on SunSpider
1327 * JavaScriptCore.exp:
1328 * kjs/PropertyMap.cpp:
1329 * kjs/PropertyMap.h:
1330 (JSC::PropertyMap::getOffset):
1332 2008-09-24 Jan Michael Alonzo <jmalonzo@webkit.org>
1334 Reviewed by Alp Toker.
1336 https://bugs.webkit.org/show_bug.cgi?id=20992
1337 Build fails on GTK+ Mac OS
1339 * wtf/ThreadingGtk.cpp: Remove platform ifdef as suggested by
1341 (WTF::initializeThreading):
1343 2008-09-23 Oliver Hunt <oliver@apple.com>
1345 Reviewed by Maciej Stachowiak.
1347 Bug 19968: Slow Script at www.huffingtonpost.com
1348 <https://bugs.webkit.org/show_bug.cgi?id=19968>
1350 Finally found the cause of this accursed issue. It is triggered
1351 by synchronous creation of a new global object from JS. The new
1352 global object resets the timer state in this execution group's
1353 Machine, taking timerCheckCount to 0. Then when JS returns the
1354 timerCheckCount is decremented making it non-zero. The next time
1355 we execute JS we will start the timeout counter, however the non-zero
1356 timeoutCheckCount means we don't reset the timer information. This
1357 means that the timeout check is now checking the cumulative time
1358 since the creation of the global object rather than the time since
1359 JS was last entered. At this point the slow script dialog is guaranteed
1360 to eventually be displayed incorrectly unless a page is loaded
1361 asynchronously (which will reset everything into a sane state).
1363 The fix for this is rather trivial -- the JSGlobalObject constructor
1364 should not be resetting the machine timer state.
1367 (JSC::Machine::Machine):
1368 Now that we can't rely on the GlobalObject initialising the timeout
1369 state, we do it in the Machine constructor.
1372 (JSC::Machine::stopTimeoutCheck):
1373 Add assertions to guard against this happening.
1375 * kjs/JSGlobalObject.cpp:
1376 (JSC::JSGlobalObject::init):
1377 Don't reset the timeout state.
1379 2008-09-23 Geoffrey Garen <ggaren@apple.com>
1381 Reviewed by Oliver Hunt.
1383 Fixed https://bugs.webkit.org/show_bug.cgi?id=21038 | <rdar://problem/6240812>
1384 Uncaught exceptions in regex replace callbacks crash webkit
1386 This was a combination of two problems:
1388 (1) the replace function would continue execution after an exception
1391 (2) In some cases, the Machine would return 0 in the case of an exception,
1392 despite the fact that a few clients dereference the Machine's return
1393 value without first checking for an exception.
1396 (JSC::Machine::execute):
1398 ^ Return jsNull() instead of 0 in the case of an exception, since some
1399 clients depend on using our return value.
1401 ^ ASSERT that execution does not continue after an exception has been
1402 thrown, to help catch problems like this in the future.
1404 * kjs/StringPrototype.cpp:
1405 (JSC::stringProtoFuncReplace):
1407 ^ Stop execution if an exception has been thrown.
1409 2008-09-23 Geoffrey Garen <ggaren@apple.com>
1411 Try to fix the windows build.
1414 (JSC::CTI::compileOpCall):
1415 (JSC::CTI::privateCompileMainPass):
1417 2008-09-23 Alp Toker <alp@nuanti.com>
1423 2008-09-23 Geoffrey Garen <ggaren@apple.com>
1425 Reviewed by Darin Adler.
1427 * wtf/Platform.h: Removed duplicate #if.
1429 2008-09-23 Geoffrey Garen <ggaren@apple.com>
1431 Reviewed by Darin Adler.
1433 Changed the layout of the call frame from
1435 { header, parameters, locals | constants, temporaries }
1439 { parameters, header | locals, constants, temporaries }
1441 This simplifies function entry+exit, and enables a number of future
1444 13.5% speedup on empty call benchmark for bytecode; 23.6% speedup on
1445 empty call benchmark for CTI.
1447 SunSpider says no change. SunSpider --v8 says 1% faster.
1451 Added a bit of abstraction for calculating whether a register is a
1452 constant, since this patch changes that calculation:
1453 (JSC::CTI::isConstant):
1454 (JSC::CTI::getConstant):
1455 (JSC::CTI::emitGetArg):
1456 (JSC::CTI::emitGetPutArg):
1457 (JSC::CTI::getConstantImmediateNumericArg):
1459 Updated for changes to callframe header location:
1460 (JSC::CTI::emitPutToCallFrameHeader):
1461 (JSC::CTI::emitGetFromCallFrameHeader):
1462 (JSC::CTI::printOpcodeOperandTypes):
1464 Renamed to spite Oliver:
1465 (JSC::CTI::emitInitRegister):
1467 Added an abstraction for emitting a call through a register, so that
1468 calls through registers generate exception info, too:
1469 (JSC::CTI::emitCall):
1471 Updated to match the new callframe header layout, and to support calls
1472 through registers, which have no destination address:
1473 (JSC::CTI::compileOpCall):
1474 (JSC::CTI::privateCompileMainPass):
1475 (JSC::CTI::privateCompileSlowCases):
1476 (JSC::CTI::privateCompile):
1481 (JSC::CallRecord::CallRecord):
1485 Updated for new register layout:
1486 (JSC::registerName):
1487 (JSC::CodeBlock::dump):
1491 Updated CodeBlock to track slightly different information about the
1492 register frame, and tweaked the style of an ASSERT_NOT_REACHED.
1493 (JSC::CodeBlock::CodeBlock):
1494 (JSC::CodeBlock::getStubInfo):
1496 * VM/CodeGenerator.cpp:
1498 Added some abstraction around constant register allocation, since this
1499 patch changes it, changed codegen to account for the new callframe
1500 layout, and added abstraction around register fetching code
1501 that used to assume that all local registers lived at negative indices,
1502 since vars now live at positive indices:
1503 (JSC::CodeGenerator::generate):
1504 (JSC::CodeGenerator::addVar):
1505 (JSC::CodeGenerator::addGlobalVar):
1506 (JSC::CodeGenerator::allocateConstants):
1507 (JSC::CodeGenerator::CodeGenerator):
1508 (JSC::CodeGenerator::addParameter):
1509 (JSC::CodeGenerator::registerFor):
1510 (JSC::CodeGenerator::constRegisterFor):
1511 (JSC::CodeGenerator::newRegister):
1512 (JSC::CodeGenerator::newTemporary):
1513 (JSC::CodeGenerator::highestUsedRegister):
1514 (JSC::CodeGenerator::addConstant):
1516 ASSERT that our caller referenced the registers it passed to us.
1517 Otherwise, we might overwrite them with parameters:
1518 (JSC::CodeGenerator::emitCall):
1519 (JSC::CodeGenerator::emitConstruct):
1521 * VM/CodeGenerator.h:
1523 Added some abstraction for getting a RegisterID for a given index,
1524 since the rules are a little weird:
1525 (JSC::CodeGenerator::registerFor):
1529 Utility function to transform a machine return PC to a virtual machine
1530 return VPC, for the sake of stack unwinding, since both PCs are stored
1531 in the same location now:
1534 Tweaked to account for new call frame:
1535 (JSC::Machine::initializeCallFrame):
1537 Tweaked to account for registerOffset supplied by caller:
1538 (JSC::slideRegisterWindowForCall):
1540 Tweaked to account for new register layout:
1541 (JSC::scopeChainForCall):
1542 (JSC::Machine::callEval):
1543 (JSC::Machine::dumpRegisters):
1544 (JSC::Machine::unwindCallFrame):
1545 (JSC::Machine::execute):
1547 Changed op_call and op_construct to implement the new calling convention:
1548 (JSC::Machine::privateExecute):
1550 Tweaked to account for the new register layout:
1551 (JSC::Machine::retrieveArguments):
1552 (JSC::Machine::retrieveCaller):
1553 (JSC::Machine::retrieveLastCaller):
1554 (JSC::Machine::callFrame):
1555 (JSC::Machine::getArgumentsData):
1557 Changed CTI call helpers to implement the new calling convention:
1558 (JSC::Machine::cti_op_call_JSFunction):
1559 (JSC::Machine::cti_op_call_NotJSFunction):
1560 (JSC::Machine::cti_op_ret_activation):
1561 (JSC::Machine::cti_op_ret_profiler):
1562 (JSC::Machine::cti_op_construct_JSConstruct):
1563 (JSC::Machine::cti_op_construct_NotJSConstruct):
1564 (JSC::Machine::cti_op_call_eval):
1570 Renamed op_initialise_locals to op_init, because this opcode
1571 doesn't initialize all locals, and it doesn't initialize only locals.
1572 Also, to spite Oliver.
1574 * VM/RegisterFile.h:
1576 New call frame enumeration values:
1577 (JSC::RegisterFile::):
1579 Simplified the calculation of whether a RegisterID is a temporary,
1580 since we can no longer assume that all positive non-constant registers
1583 (JSC::RegisterID::RegisterID):
1584 (JSC::RegisterID::setTemporary):
1585 (JSC::RegisterID::isTemporary):
1587 Renamed firstArgumentIndex to firstParameterIndex because the assumption
1588 that this variable pertained to the actual arguments supplied by the
1589 caller caused me to write some buggy code:
1590 * kjs/Arguments.cpp:
1591 (JSC::ArgumentsData::ArgumentsData):
1592 (JSC::Arguments::Arguments):
1593 (JSC::Arguments::fillArgList):
1594 (JSC::Arguments::getOwnPropertySlot):
1595 (JSC::Arguments::put):
1597 Updated for new call frame layout:
1598 * kjs/DebuggerCallFrame.cpp:
1599 (JSC::DebuggerCallFrame::functionName):
1600 (JSC::DebuggerCallFrame::type):
1601 * kjs/DebuggerCallFrame.h:
1603 Changed the activation object to account for the fact that a call frame
1604 header now sits between parameters and local variables. This change
1605 requires all variable objects to do their own marking, since they
1606 now use their register storage differently:
1607 * kjs/JSActivation.cpp:
1608 (JSC::JSActivation::mark):
1609 (JSC::JSActivation::copyRegisters):
1610 (JSC::JSActivation::createArgumentsObject):
1611 * kjs/JSActivation.h:
1613 Updated global object to use the new interfaces required by the change
1614 to JSActivation above:
1615 * kjs/JSGlobalObject.cpp:
1616 (JSC::JSGlobalObject::reset):
1617 (JSC::JSGlobalObject::mark):
1618 (JSC::JSGlobalObject::copyGlobalsFrom):
1619 (JSC::JSGlobalObject::copyGlobalsTo):
1620 * kjs/JSGlobalObject.h:
1621 (JSC::JSGlobalObject::addStaticGlobals):
1623 Updated static scope object to use the new interfaces required by the
1624 change to JSActivation above:
1625 * kjs/JSStaticScopeObject.cpp:
1626 (JSC::JSStaticScopeObject::mark):
1627 (JSC::JSStaticScopeObject::~JSStaticScopeObject):
1628 * kjs/JSStaticScopeObject.h:
1629 (JSC::JSStaticScopeObject::JSStaticScopeObject):
1630 (JSC::JSStaticScopeObject::d):
1632 Updated variable object to use the new interfaces required by the
1633 change to JSActivation above:
1634 * kjs/JSVariableObject.cpp:
1635 (JSC::JSVariableObject::copyRegisterArray):
1636 (JSC::JSVariableObject::setRegisters):
1637 * kjs/JSVariableObject.h:
1639 Changed the bit twiddling in symbol table not to assume that all indices
1640 are negative, since they can be positive now:
1641 * kjs/SymbolTable.h:
1642 (JSC::SymbolTableEntry::SymbolTableEntry):
1643 (JSC::SymbolTableEntry::isNull):
1644 (JSC::SymbolTableEntry::getIndex):
1645 (JSC::SymbolTableEntry::getAttributes):
1646 (JSC::SymbolTableEntry::setAttributes):
1647 (JSC::SymbolTableEntry::isReadOnly):
1648 (JSC::SymbolTableEntry::pack):
1649 (JSC::SymbolTableEntry::isValidIndex):
1651 Changed call and construct nodes to ref their functions and/or bases,
1652 so that emitCall/emitConstruct doesn't overwrite them with parameters.
1653 Also, updated for rename to registerFor:
1655 (JSC::ResolveNode::emitCode):
1656 (JSC::NewExprNode::emitCode):
1657 (JSC::EvalFunctionCallNode::emitCode):
1658 (JSC::FunctionCallValueNode::emitCode):
1659 (JSC::FunctionCallResolveNode::emitCode):
1660 (JSC::FunctionCallBracketNode::emitCode):
1661 (JSC::FunctionCallDotNode::emitCode):
1662 (JSC::PostfixResolveNode::emitCode):
1663 (JSC::DeleteResolveNode::emitCode):
1664 (JSC::TypeOfResolveNode::emitCode):
1665 (JSC::PrefixResolveNode::emitCode):
1666 (JSC::ReadModifyResolveNode::emitCode):
1667 (JSC::AssignResolveNode::emitCode):
1668 (JSC::ConstDeclNode::emitCodeSingle):
1669 (JSC::ForInNode::emitCode):
1671 Added abstraction for getting exception info out of a call through a
1673 * masm/X86Assembler.h:
1674 (JSC::X86Assembler::emitCall):
1676 Removed duplicate #if:
1679 2008-09-23 Kevin McCullough <kmccullough@apple.com>
1683 Bug 21030: The JS debugger breaks on the do of a do-while not the while
1684 (where the conditional statement is)
1685 https://bugs.webkit.org/show_bug.cgi?id=21030
1686 Now the statementListEmitCode detects if a do-while node is being
1687 emited and emits the debug hook on the last line instead of the first.
1689 This change had no effect on sunspider.
1692 (JSC::statementListEmitCode):
1694 (JSC::StatementNode::isDoWhile):
1695 (JSC::DoWhileNode::isDoWhile):
1697 2008-09-23 Maciej Stachowiak <mjs@apple.com>
1699 Reviewed by Camron Zwarich.
1701 - inline the fast case of instanceof
1702 https://bugs.webkit.org/show_bug.cgi?id=20818
1704 ~2% speedup on EarleyBoyer test.
1707 (JSC::CTI::privateCompileMainPass):
1708 (JSC::CTI::privateCompileSlowCases):
1710 (JSC::Machine::cti_op_instanceof):
1712 2008-09-23 Maciej Stachowiak <mjs@apple.com>
1714 Reviewed by Cameron Zwarich.
1716 - add forgotten slow case logic for !==
1719 (JSC::CTI::privateCompileSlowCases):
1721 2008-09-23 Maciej Stachowiak <mjs@apple.com>
1723 Reviewed by Cameron Zwarich.
1725 - inline the fast cases of !==, same as for ===
1727 2.9% speedup on EarleyBoyer benchmark
1730 (JSC::CTI::compileOpStrictEq): Factored stricteq codegen into this function,
1731 and parameterized so it can do the reverse version as well.
1732 (JSC::CTI::privateCompileMainPass): Use the above for stricteq and nstricteq.
1734 (JSC::CTI::): Declare above stuff.
1736 (JSC::Machine::cti_op_nstricteq): Removed fast cases, now handled inline.
1738 2008-09-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1740 Reviewed by Oliver Hunt.
1742 Bug 20989: Aguments constructor should put 'callee' and 'length' properties in a more efficient way
1743 <https://bugs.webkit.org/show_bug.cgi?id=20989>
1745 Make special cases for the 'callee' and 'length' properties in the
1748 This is somewhere between a 7.8% speedup and a 10% speedup on the V8
1749 Raytrace benchmark, depending on whether it is run alone or with the
1750 other V8 benchmarks.
1752 * kjs/Arguments.cpp:
1753 (JSC::ArgumentsData::ArgumentsData):
1754 (JSC::Arguments::Arguments):
1755 (JSC::Arguments::mark):
1756 (JSC::Arguments::getOwnPropertySlot):
1757 (JSC::Arguments::put):
1758 (JSC::Arguments::deleteProperty):
1760 2008-09-23 Maciej Stachowiak <mjs@apple.com>
1764 - speed up instanceof some more
1765 https://bugs.webkit.org/show_bug.cgi?id=20818
1767 ~2% speedup on EarleyBoyer
1769 The idea here is to record in the StructureID whether the class
1770 needs a special hasInstance or if it can use the normal logic from
1773 Based on this I inlined the real work directly into
1774 cti_op_instanceof and put the fastest checks up front and the
1775 error handling at the end (so it should be fairly straightforward
1776 to split off the beginning to be inlined if desired).
1778 I only did this for CTI, not the bytecode interpreter.
1780 * API/JSCallbackObject.h:
1781 (JSC::JSCallbackObject::createStructureID):
1784 (JSC::Machine::cti_op_instanceof):
1785 * kjs/JSImmediate.h:
1786 (JSC::JSImmediate::isAnyImmediate):
1788 (JSC::TypeInfo::overridesHasInstance):
1789 (JSC::TypeInfo::flags):
1791 2008-09-22 Darin Adler <darin@apple.com>
1793 Reviewed by Sam Weinig.
1795 - https://bugs.webkit.org/show_bug.cgi?id=21019
1796 make FunctionBodyNode::ref/deref fast
1798 Speeds up v8-raytrace by 7.2%.
1801 (JSC::FunctionBodyNode::FunctionBodyNode): Initialize m_refCount to 0.
1803 (JSC::FunctionBodyNode::ref): Call base class ref once, and thereafter use
1805 (JSC::FunctionBodyNode::deref): Ditto, but the deref side.
1807 2008-09-22 Darin Adler <darin@apple.com>
1809 Pointed out by Sam Weinig.
1811 * kjs/Arguments.cpp:
1812 (JSC::Arguments::fillArgList): Fix bad copy and paste. Oops!
1814 2008-09-22 Darin Adler <darin@apple.com>
1816 Reviewed by Cameron Zwarich.
1818 - https://bugs.webkit.org/show_bug.cgi?id=20983
1819 ArgumentsData should have some room to allocate some extra arguments inline
1821 Speeds up v8-raytrace by 5%.
1823 * kjs/Arguments.cpp:
1824 (JSC::ArgumentsData::ArgumentsData): Use a fixed buffer if there are 4 or fewer
1826 (JSC::Arguments::Arguments): Use a fixed buffer if there are 4 or fewer
1828 (JSC::Arguments::~Arguments): Delete the buffer if necessary.
1829 (JSC::Arguments::mark): Update since extraArguments are now Register.
1830 (JSC::Arguments::fillArgList): Added special case for the only case that's
1831 actually used in the practice, when there are no parameters. There are some
1832 other special cases in there too, but that's the only one that matters.
1833 (JSC::Arguments::getOwnPropertySlot): Updated to use setValueSlot since there's
1834 no operation to get you at the JSValue* inside a Register as a "slot".
1836 2008-09-22 Sam Weinig <sam@webkit.org>
1838 Reviewed by Maciej Stachowiak.
1840 Patch for https://bugs.webkit.org/show_bug.cgi?id=21014
1841 Speed up for..in by using StructureID to avoid calls to hasProperty
1843 Speeds up fasta by 8%.
1845 * VM/JSPropertyNameIterator.cpp:
1846 (JSC::JSPropertyNameIterator::invalidate):
1847 * VM/JSPropertyNameIterator.h:
1848 (JSC::JSPropertyNameIterator::next):
1849 * kjs/PropertyNameArray.h:
1850 (JSC::PropertyNameArrayData::begin):
1851 (JSC::PropertyNameArrayData::end):
1852 (JSC::PropertyNameArrayData::setCachedStructureID):
1853 (JSC::PropertyNameArrayData::cachedStructureID):
1854 * kjs/StructureID.cpp:
1855 (JSC::StructureID::getEnumerablePropertyNames):
1856 (JSC::structureIDChainsAreEqual):
1857 * kjs/StructureID.h:
1859 2008-09-22 Kelvin Sherlock <ksherlock@gmail.com>
1861 Updated and tweaked by Sam Weinig.
1863 Reviewed by Geoffrey Garen.
1865 Bug 20020: Proposed enhancement to JavaScriptCore API
1866 <https://bugs.webkit.org/show_bug.cgi?id=20020>
1868 Add JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError, and JSObjectMakeRegExp
1869 functions to create JavaScript Array, Date, Error, and RegExp objects, respectively.
1871 * API/JSObjectRef.cpp: The functions
1872 * API/JSObjectRef.h: Function prototype and documentation
1873 * JavaScriptCore.exp: Added functions to exported function list
1874 * API/tests/testapi.c: Added basic functionality tests.
1876 * kjs/DateConstructor.cpp:
1877 Replaced static JSObject* constructDate(ExecState* exec, JSObject*, const ArgList& args)
1878 with JSObject* constructDate(ExecState* exec, const ArgList& args).
1879 Added static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) function
1881 * kjs/DateConstructor.h:
1882 added prototype for JSObject* constructDate(ExecState* exec, const ArgList& args)
1884 * kjs/ErrorConstructor.cpp:
1885 removed static qualifier from ErrorInstance* constructError(ExecState* exec, const ArgList& args)
1887 * kjs/ErrorConstructor.h:
1888 added prototype for ErrorInstance* constructError(ExecState* exec, const ArgList& args)
1890 * kjs/RegExpConstructor.cpp:
1891 removed static qualifier from JSObject* constructRegExp(ExecState* exec, const ArgList& args)
1893 * kjs/RegExpConstructor.h:
1894 added prototype for JSObject* constructRegExp(ExecState* exec, const ArgList& args)
1896 2008-09-22 Matt Lilek <webkit@mattlilek.com>
1898 Not reviewed, Windows build fix.
1900 * kjs/Arguments.cpp:
1901 * kjs/FunctionPrototype.cpp:
1903 2008-09-22 Sam Weinig <sam@webkit.org>
1905 Reviewed by Darin Adler.
1907 Patch for https://bugs.webkit.org/show_bug.cgi?id=20982
1908 Speed up the apply method of functions by special-casing array and 'arguments' objects
1910 1% speedup on v8-raytrace.
1912 Test: fast/js/function-apply.html
1914 * kjs/Arguments.cpp:
1915 (JSC::Arguments::fillArgList):
1917 * kjs/FunctionPrototype.cpp:
1918 (JSC::functionProtoFuncApply):
1920 (JSC::JSArray::fillArgList):
1923 2008-09-22 Darin Adler <darin@apple.com>
1925 Reviewed by Sam Weinig.
1927 - https://bugs.webkit.org/show_bug.cgi?id=20993
1928 Array.push/pop need optimized cases for JSArray
1930 3% or so speedup on DeltaBlue benchmark.
1932 * kjs/ArrayPrototype.cpp:
1933 (JSC::arrayProtoFuncPop): Call JSArray::pop when appropriate.
1934 (JSC::arrayProtoFuncPush): Call JSArray::push when appropriate.
1937 (JSC::JSArray::putSlowCase): Set m_fastAccessCutoff when appropriate, getting
1938 us into the fast code path.
1939 (JSC::JSArray::pop): Added.
1940 (JSC::JSArray::push): Added.
1941 * kjs/JSArray.h: Added push and pop.
1943 * kjs/operations.cpp:
1944 (JSC::throwOutOfMemoryError): Don't inline this. Helps us avoid PIC branches.
1946 2008-09-22 Maciej Stachowiak <mjs@apple.com>
1948 Reviewed by Cameron Zwarich.
1950 - speed up instanceof operator by replacing implementsHasInstance method with a TypeInfo flag
1952 Partial work towards <https://bugs.webkit.org/show_bug.cgi?id=20818>
1954 2.2% speedup on EarleyBoyer benchmark.
1956 * API/JSCallbackConstructor.cpp:
1957 * API/JSCallbackConstructor.h:
1958 (JSC::JSCallbackConstructor::createStructureID):
1959 * API/JSCallbackFunction.cpp:
1960 * API/JSCallbackFunction.h:
1961 (JSC::JSCallbackFunction::createStructureID):
1962 * API/JSCallbackObject.h:
1963 (JSC::JSCallbackObject::createStructureID):
1964 * API/JSCallbackObjectFunctions.h:
1965 (JSC::::hasInstance):
1966 * API/JSValueRef.cpp:
1967 (JSValueIsInstanceOfConstructor):
1968 * JavaScriptCore.exp:
1970 (JSC::Machine::privateExecute):
1971 (JSC::Machine::cti_op_instanceof):
1972 * kjs/InternalFunction.cpp:
1973 * kjs/InternalFunction.h:
1974 (JSC::InternalFunction::createStructureID):
1978 (JSC::TypeInfo::implementsHasInstance):
1980 2008-09-22 Maciej Stachowiak <mjs@apple.com>
1982 Reviewed by Dave Hyatt.
1984 Based on initial work by Darin Adler.
1986 - replace masqueradesAsUndefined virtual method with a flag in TypeInfo
1987 - use this to JIT inline code for eq_null and neq_null
1988 https://bugs.webkit.org/show_bug.cgi?id=20823
1990 0.5% speedup on SunSpider
1991 ~4% speedup on Richards benchmark
1994 (JSC::CTI::privateCompileMainPass):
1996 (JSC::jsTypeStringForValue):
1997 (JSC::jsIsObjectType):
1998 (JSC::Machine::privateExecute):
1999 (JSC::Machine::cti_op_is_undefined):
2003 * kjs/StringObjectThatMasqueradesAsUndefined.h:
2004 (JSC::StringObjectThatMasqueradesAsUndefined::create):
2005 (JSC::StringObjectThatMasqueradesAsUndefined::createStructureID):
2006 * kjs/StructureID.h:
2007 (JSC::StructureID::mutableTypeInfo):
2009 (JSC::TypeInfo::TypeInfo):
2010 (JSC::TypeInfo::masqueradesAsUndefined):
2011 * kjs/operations.cpp:
2013 * masm/X86Assembler.h:
2014 (JSC::X86Assembler::):
2015 (JSC::X86Assembler::setne_r):
2016 (JSC::X86Assembler::setnz_r):
2017 (JSC::X86Assembler::testl_i32m):
2019 2008-09-22 Tor Arne Vestbø <tavestbo@trolltech.com>
2023 Initialize QCoreApplication in kjs binary/Shell.cpp
2025 This allows us to use QCoreApplication::instance() to
2026 get the main thread in ThreadingQt.cpp
2030 * wtf/ThreadingQt.cpp:
2031 (WTF::initializeThreading):
2033 2008-09-21 Darin Adler <darin@apple.com>
2035 - blind attempt to fix non-all-in-one builds
2037 * kjs/JSGlobalObject.cpp: Added includes of Arguments.h and RegExpObject.h.
2039 2008-09-21 Darin Adler <darin@apple.com>
2043 * kjs/StructureID.cpp:
2044 (JSC::StructureID::addPropertyTransition): Use typeInfo().type() instead of m_type.
2045 (JSC::StructureID::createCachedPrototypeChain): Ditto.
2047 2008-09-21 Maciej Stachowiak <mjs@apple.com>
2049 Reviewed by Darin Adler.
2051 - introduce a TypeInfo class, for holding per-type (in the C++ class sense) date in StructureID
2052 https://bugs.webkit.org/show_bug.cgi?id=20981
2054 * JavaScriptCore.exp:
2055 * JavaScriptCore.xcodeproj/project.pbxproj:
2057 (JSC::CTI::privateCompileMainPass):
2058 (JSC::CTI::privateCompilePutByIdTransition):
2060 (JSC::jsIsObjectType):
2061 (JSC::Machine::Machine):
2062 * kjs/AllInOneFile.cpp:
2064 (JSC::JSCell::isObject):
2065 (JSC::JSCell::isString):
2066 * kjs/JSGlobalData.cpp:
2067 (JSC::JSGlobalData::JSGlobalData):
2068 * kjs/JSGlobalObject.cpp:
2069 (JSC::JSGlobalObject::reset):
2070 * kjs/JSGlobalObject.h:
2071 (JSC::StructureID::prototypeForLookup):
2072 * kjs/JSNumberCell.h:
2073 (JSC::JSNumberCell::createStructureID):
2075 (JSC::JSObject::createInheritorID):
2077 (JSC::JSObject::createStructureID):
2079 (JSC::JSString::createStructureID):
2080 * kjs/NativeErrorConstructor.cpp:
2081 (JSC::NativeErrorConstructor::NativeErrorConstructor):
2082 * kjs/RegExpConstructor.cpp:
2083 * kjs/RegExpMatchesArray.h: Added.
2084 (JSC::RegExpMatchesArray::getOwnPropertySlot):
2085 (JSC::RegExpMatchesArray::put):
2086 (JSC::RegExpMatchesArray::deleteProperty):
2087 (JSC::RegExpMatchesArray::getPropertyNames):
2088 * kjs/StructureID.cpp:
2089 (JSC::StructureID::StructureID):
2090 (JSC::StructureID::addPropertyTransition):
2091 (JSC::StructureID::toDictionaryTransition):
2092 (JSC::StructureID::changePrototypeTransition):
2093 (JSC::StructureID::getterSetterTransition):
2094 * kjs/StructureID.h:
2095 (JSC::StructureID::create):
2096 (JSC::StructureID::typeInfo):
2097 * kjs/TypeInfo.h: Added.
2098 (JSC::TypeInfo::TypeInfo):
2099 (JSC::TypeInfo::type):
2101 2008-09-21 Darin Adler <darin@apple.com>
2103 Reviewed by Cameron Zwarich.
2105 - fix crash logging into Gmail due to recent Arguments change
2107 * kjs/Arguments.cpp:
2108 (JSC::Arguments::Arguments): Fix window where mark() function could
2109 see d->extraArguments with uninitialized contents.
2110 (JSC::Arguments::mark): Check d->extraArguments for 0 to handle two
2111 cases: 1) Inside the constructor before it's initialized.
2112 2) numArguments <= numParameters.
2114 2008-09-21 Darin Adler <darin@apple.com>
2116 - fix loose end from the "duplicate constant values" patch
2118 * VM/CodeGenerator.cpp:
2119 (JSC::CodeGenerator::emitLoad): Add a special case for values the
2120 hash table can't handle.
2122 2008-09-21 Mark Rowe <mrowe@apple.com>
2124 Fix the non-AllInOneFile build.
2126 * kjs/Arguments.cpp: Add missing #include.
2128 2008-09-21 Darin Adler <darin@apple.com>
2130 Reviewed by Cameron Zwarich and Mark Rowe.
2132 - fix test failure caused by my recent IndexToNameMap patch
2134 * kjs/Arguments.cpp:
2135 (JSC::Arguments::deleteProperty): Added the accidentally-omitted
2136 check of the boolean result from toArrayIndex.
2138 2008-09-21 Darin Adler <darin@apple.com>
2140 Reviewed by Maciej Stachowiak.
2142 - https://bugs.webkit.org/show_bug.cgi?id=20975
2143 inline immediate-number case of ==
2145 * VM/CTI.h: Renamed emitJumpSlowCaseIfNotImm to
2146 emitJumpSlowCaseIfNotImmNum, since the old name was incorrect.
2148 * VM/CTI.cpp: Updated for new name.
2149 (JSC::CTI::privateCompileMainPass): Added op_eq.
2150 (JSC::CTI::privateCompileSlowCases): Added op_eq.
2153 (JSC::Machine::cti_op_eq): Removed fast case, since it's now
2156 2008-09-21 Peter Gal <galpter@inf.u-szeged.hu>
2158 Reviewed by Tim Hatcher and Eric Seidel.
2160 Fix the QT/Linux JavaScriptCore segmentation fault.
2161 https://bugs.webkit.org/show_bug.cgi?id=20914
2163 * wtf/ThreadingQt.cpp:
2164 (WTF::initializeThreading): Use currentThread() if
2165 platform is not a MAC (like in pre 36541 revisions)
2167 2008-09-21 Darin Adler <darin@apple.com>
2169 Reviewed by Sam Weinig.
2171 * kjs/debugger.h: Removed some unneeded includes and declarations.
2173 2008-09-21 Darin Adler <darin@apple.com>
2175 Reviewed by Sam Weinig.
2177 - https://bugs.webkit.org/show_bug.cgi?id=20972
2178 speed up Arguments further by eliminating the IndexToNameMap
2180 No change on SunSpider. 1.29x as fast on V8 Raytrace.
2182 * kjs/Arguments.cpp: Moved ArgumentsData in here. Eliminated the
2183 indexToNameMap and hadDeletes data members. Changed extraArguments into
2184 an OwnArrayPtr and added deletedArguments, another OwnArrayPtr.
2185 Replaced numExtraArguments with numParameters, since that's what's
2186 used more directly in hot code paths.
2187 (JSC::Arguments::Arguments): Pass in argument count instead of ArgList.
2188 Initialize ArgumentsData the new way.
2189 (JSC::Arguments::mark): Updated.
2190 (JSC::Arguments::getOwnPropertySlot): Overload for the integer form so
2191 we don't have to convert integers to identifiers just to get an argument.
2192 Integrated the deleted case with the fast case.
2193 (JSC::Arguments::put): Ditto.
2194 (JSC::Arguments::deleteProperty): Ditto.
2196 * kjs/Arguments.h: Minimized includes. Made everything private. Added
2197 overloads for the integral property name case. Eliminated mappedIndexSetter.
2198 Moved ArgumentsData into the .cpp file.
2200 * kjs/IndexToNameMap.cpp: Emptied out and prepared for deletion.
2201 * kjs/IndexToNameMap.h: Ditto.
2203 * kjs/JSActivation.cpp:
2204 (JSC::JSActivation::createArgumentsObject): Elminated ArgList.
2207 * JavaScriptCore.pri:
2208 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2209 * JavaScriptCore.xcodeproj/project.pbxproj:
2210 * JavaScriptCoreSources.bkl:
2211 * kjs/AllInOneFile.cpp:
2212 Removed IndexToNameMap.
2214 2008-09-21 Darin Adler <darin@apple.com>
2216 * VM/CodeGenerator.cpp:
2217 (JSC::CodeGenerator::emitLoad): One more tweak: Wrote this in a slightly
2220 2008-09-21 Judit Jasz <jasy@inf.u-szeged.hu>
2222 Reviewed and tweaked by Darin Adler.
2224 - https://bugs.webkit.org/show_bug.cgi?id=20645
2225 Elminate duplicate constant values in CodeBlocks.
2227 Seems to be a wash on SunSpider.
2229 * VM/CodeGenerator.cpp:
2230 (JSC::CodeGenerator::emitLoad): Use m_numberMap and m_stringMap to guarantee
2231 we emit the same JSValue* for identical numbers and strings.
2232 * VM/CodeGenerator.h: Added overload of emitLoad for const Identifier&.
2233 Add NumberMap and IdentifierStringMap types and m_numberMap and m_stringMap.
2235 (JSC::StringNode::emitCode): Call the new emitLoad and let it do the
2238 2008-09-21 Paul Pedriana <webkit@pedriana.com>
2240 Reviewed and tweaked by Darin Adler.
2242 - https://bugs.webkit.org/show_bug.cgi?id=16925
2243 Fixed lack of Vector buffer alignment for both GCC and MSVC.
2244 Since there's no portable way to do this, for now we don't support
2247 * wtf/Vector.h: Added WTF_ALIGH_ON, WTF_ALIGNED, AlignedBufferChar, and AlignedBuffer.
2248 Use AlignedBuffer insteadof an array of char in VectorBuffer.
2250 2008-09-21 Gabor Loki <loki@inf.u-szeged.hu>
2252 Reviewed by Darin Adler.
2254 - https://bugs.webkit.org/show_bug.cgi?id=19408
2255 Add lightweight constant folding to the parser for *, /, + (only for numbers), <<, >>, ~ operators.
2257 1.008x as fast on SunSpider.
2260 (makeNegateNode): Fold if expression is a number > 0.
2261 (makeBitwiseNotNode): Fold if expression is a number.
2262 (makeMultNode): Fold if expressions are both numbers.
2263 (makeDivNode): Fold if expressions are both numbers.
2264 (makeAddNode): Fold if expressions are both numbers.
2265 (makeLeftShiftNode): Fold if expressions are both numbers.
2266 (makeRightShiftNode): Fold if expressions are both numbers.
2268 2008-09-21 Maciej Stachowiak <mjs@apple.com>
2272 - speed up === operator by generating inline machine code for the fast paths
2273 https://bugs.webkit.org/show_bug.cgi?id=20820
2276 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumber):
2277 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumbers):
2278 (JSC::CTI::emitJumpSlowCaseIfNotImmediates):
2279 (JSC::CTI::emitTagAsBoolImmediate):
2280 (JSC::CTI::privateCompileMainPass):
2281 (JSC::CTI::privateCompileSlowCases):
2284 (JSC::Machine::cti_op_stricteq):
2285 * masm/X86Assembler.h:
2286 (JSC::X86Assembler::):
2287 (JSC::X86Assembler::sete_r):
2288 (JSC::X86Assembler::setz_r):
2289 (JSC::X86Assembler::movzbl_rr):
2290 (JSC::X86Assembler::emitUnlinkedJnz):
2292 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2294 Reviewed by Maciej Stachowiak.
2296 Free memory allocated for extra arguments in the destructor of the
2299 * kjs/Arguments.cpp:
2300 (JSC::Arguments::~Arguments):
2303 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2305 Reviewed by Maciej Stachowiak.
2307 Bug 20815: 'arguments' object creation is non-optimal
2308 <https://bugs.webkit.org/show_bug.cgi?id=20815>
2310 Fix our inefficient way of creating the arguments object by only
2311 creating named properties for each of the arguments after a use of the
2312 'delete' statement. This patch also speeds up access to the 'arguments'
2313 object slightly, but it still does not use the array fast path for
2314 indexed access that exists for many opcodes.
2316 This is about a 20% improvement on the V8 Raytrace benchmark, and a 1.5%
2317 improvement on the Earley-Boyer benchmark, which gives a 4% improvement
2320 * kjs/Arguments.cpp:
2321 (JSC::Arguments::Arguments):
2322 (JSC::Arguments::mark):
2323 (JSC::Arguments::getOwnPropertySlot):
2324 (JSC::Arguments::put):
2325 (JSC::Arguments::deleteProperty):
2327 (JSC::Arguments::ArgumentsData::ArgumentsData):
2328 * kjs/IndexToNameMap.h:
2329 (JSC::IndexToNameMap::size):
2330 * kjs/JSActivation.cpp:
2331 (JSC::JSActivation::createArgumentsObject):
2332 * kjs/JSActivation.h:
2333 (JSC::JSActivation::uncheckedSymbolTableGet):
2334 (JSC::JSActivation::uncheckedSymbolTableGetValue):
2335 (JSC::JSActivation::uncheckedSymbolTablePut):
2337 (JSC::JSFunction::numParameters):
2339 2008-09-20 Darin Adler <darin@apple.com>
2341 Reviewed by Mark Rowe.
2343 - fix crash seen on buildbot
2345 * kjs/JSGlobalObject.cpp:
2346 (JSC::JSGlobalObject::mark): Add back mark of arrayPrototype,
2347 deleted by accident in my recent check-in.
2349 2008-09-20 Maciej Stachowiak <mjs@apple.com>
2351 Not reviewed, build fix.
2353 - speculative fix for non-AllInOne builds
2357 2008-09-20 Maciej Stachowiak <mjs@apple.com>
2359 Reviewed by Darin Adler.
2361 - assorted optimizations to === and !== operators
2362 (work towards <https://bugs.webkit.org/show_bug.cgi?id=20820>)
2364 2.5% speedup on earley-boyer test
2367 (JSC::Machine::cti_op_stricteq): Use inline version of
2368 strictEqualSlowCase; remove unneeded exception check.
2369 (JSC::Machine::cti_op_nstricteq): ditto
2370 * kjs/operations.cpp:
2371 (JSC::strictEqual): Use strictEqualSlowCaseInline
2372 (JSC::strictEqualSlowCase): ditto
2374 (JSC::strictEqualSlowCaseInline): Version of strictEqualSlowCase that can be inlined,
2375 since the extra function call indirection is a lose for CTI.
2377 2008-09-20 Darin Adler <darin@apple.com>
2379 Reviewed by Maciej Stachowiak.
2381 - finish https://bugs.webkit.org/show_bug.cgi?id=20858
2382 make each distinct C++ class get a distinct JSC::Structure
2384 This also includes some optimizations that make the change an overall
2385 small speedup. Without those it was a bit of a slowdown.
2387 * API/JSCallbackConstructor.cpp:
2388 (JSC::JSCallbackConstructor::JSCallbackConstructor): Take a structure.
2389 * API/JSCallbackConstructor.h: Ditto.
2390 * API/JSCallbackFunction.cpp:
2391 (JSC::JSCallbackFunction::JSCallbackFunction): Pass a structure.
2392 * API/JSCallbackObject.h: Take a structure.
2393 * API/JSCallbackObjectFunctions.h:
2394 (JSC::JSCallbackObject::JSCallbackObject): Ditto.
2396 * API/JSClassRef.cpp:
2397 (OpaqueJSClass::prototype): Pass in a structure. Call setPrototype
2398 if there's a custom prototype involved.
2399 * API/JSObjectRef.cpp:
2400 (JSObjectMake): Ditto.
2401 (JSObjectMakeConstructor): Pass in a structure.
2403 * JavaScriptCore.exp: Updated.
2406 (JSC::jsLess): Added a special case for when both arguments are strings.
2407 This avoids converting both strings to with UString::toDouble.
2408 (JSC::jsLessEq): Ditto.
2409 (JSC::Machine::privateExecute): Pass in a structure.
2410 (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
2411 (JSC::Machine::cti_op_new_regexp): Ditto.
2412 (JSC::Machine::cti_op_is_string): Ditto.
2413 * VM/Machine.h: Made isJSString public so it can be used in the CTI.
2415 * kjs/Arguments.cpp:
2416 (JSC::Arguments::Arguments): Pass in a structure.
2418 * kjs/JSCell.h: Mark constructor explicit.
2420 * kjs/JSGlobalObject.cpp:
2421 (JSC::markIfNeeded): Added an overload for marking structures.
2422 (JSC::JSGlobalObject::reset): Eliminate code to set data members to
2423 zero. We now do that in the constructor, and we no longer use this
2424 anywhere except in the constructor. Added code to create structures.
2425 Pass structures rather than prototypes when creating objects.
2426 (JSC::JSGlobalObject::mark): Mark the structures.
2428 * kjs/JSGlobalObject.h: Removed unneeded class declarations.
2429 Added initializers for raw pointers in JSGlobalObjectData so
2430 everything starts with a 0. Added structure data and accessor
2433 * kjs/JSImmediate.cpp:
2434 (JSC::JSImmediate::nonInlineNaN): Added.
2435 * kjs/JSImmediate.h:
2436 (JSC::JSImmediate::toDouble): Rewrote to avoid PIC branches.
2438 * kjs/JSNumberCell.cpp:
2439 (JSC::jsNumberCell): Made non-inline to avoid PIC branches
2440 in functions that call this one.
2441 (JSC::jsNaN): Ditto.
2442 * kjs/JSNumberCell.h: Ditto.
2444 * kjs/JSObject.h: Removed constructor that takes a prototype.
2445 All callers now pass structures.
2447 * kjs/ArrayConstructor.cpp:
2448 (JSC::ArrayConstructor::ArrayConstructor):
2449 (JSC::constructArrayWithSizeQuirk):
2450 * kjs/ArrayConstructor.h:
2451 * kjs/ArrayPrototype.cpp:
2452 (JSC::ArrayPrototype::ArrayPrototype):
2453 * kjs/ArrayPrototype.h:
2454 * kjs/BooleanConstructor.cpp:
2455 (JSC::BooleanConstructor::BooleanConstructor):
2456 (JSC::constructBoolean):
2457 (JSC::constructBooleanFromImmediateBoolean):
2458 * kjs/BooleanConstructor.h:
2459 * kjs/BooleanObject.cpp:
2460 (JSC::BooleanObject::BooleanObject):
2461 * kjs/BooleanObject.h:
2462 * kjs/BooleanPrototype.cpp:
2463 (JSC::BooleanPrototype::BooleanPrototype):
2464 * kjs/BooleanPrototype.h:
2465 * kjs/DateConstructor.cpp:
2466 (JSC::DateConstructor::DateConstructor):
2467 (JSC::constructDate):
2468 * kjs/DateConstructor.h:
2469 * kjs/DateInstance.cpp:
2470 (JSC::DateInstance::DateInstance):
2471 * kjs/DateInstance.h:
2472 * kjs/DatePrototype.cpp:
2473 (JSC::DatePrototype::DatePrototype):
2474 * kjs/DatePrototype.h:
2475 * kjs/ErrorConstructor.cpp:
2476 (JSC::ErrorConstructor::ErrorConstructor):
2477 (JSC::constructError):
2478 * kjs/ErrorConstructor.h:
2479 * kjs/ErrorInstance.cpp:
2480 (JSC::ErrorInstance::ErrorInstance):
2481 * kjs/ErrorInstance.h:
2482 * kjs/ErrorPrototype.cpp:
2483 (JSC::ErrorPrototype::ErrorPrototype):
2484 * kjs/ErrorPrototype.h:
2485 * kjs/FunctionConstructor.cpp:
2486 (JSC::FunctionConstructor::FunctionConstructor):
2487 * kjs/FunctionConstructor.h:
2488 * kjs/FunctionPrototype.cpp:
2489 (JSC::FunctionPrototype::FunctionPrototype):
2490 (JSC::FunctionPrototype::addFunctionProperties):
2491 * kjs/FunctionPrototype.h:
2492 * kjs/GlobalEvalFunction.cpp:
2493 (JSC::GlobalEvalFunction::GlobalEvalFunction):
2494 * kjs/GlobalEvalFunction.h:
2495 * kjs/InternalFunction.cpp:
2496 (JSC::InternalFunction::InternalFunction):
2497 * kjs/InternalFunction.h:
2498 (JSC::InternalFunction::InternalFunction):
2500 (JSC::JSArray::JSArray):
2501 (JSC::constructEmptyArray):
2502 (JSC::constructArray):
2504 * kjs/JSFunction.cpp:
2505 (JSC::JSFunction::JSFunction):
2506 (JSC::JSFunction::construct):
2508 (JSC::constructEmptyObject):
2510 (JSC::StringObject::create):
2511 * kjs/JSWrapperObject.h:
2512 * kjs/MathObject.cpp:
2513 (JSC::MathObject::MathObject):
2515 * kjs/NativeErrorConstructor.cpp:
2516 (JSC::NativeErrorConstructor::NativeErrorConstructor):
2517 (JSC::NativeErrorConstructor::construct):
2518 * kjs/NativeErrorConstructor.h:
2519 * kjs/NativeErrorPrototype.cpp:
2520 (JSC::NativeErrorPrototype::NativeErrorPrototype):
2521 * kjs/NativeErrorPrototype.h:
2522 * kjs/NumberConstructor.cpp:
2523 (JSC::NumberConstructor::NumberConstructor):
2524 (JSC::constructWithNumberConstructor):
2525 * kjs/NumberConstructor.h:
2526 * kjs/NumberObject.cpp:
2527 (JSC::NumberObject::NumberObject):
2528 (JSC::constructNumber):
2529 (JSC::constructNumberFromImmediateNumber):
2530 * kjs/NumberObject.h:
2531 * kjs/NumberPrototype.cpp:
2532 (JSC::NumberPrototype::NumberPrototype):
2533 * kjs/NumberPrototype.h:
2534 * kjs/ObjectConstructor.cpp:
2535 (JSC::ObjectConstructor::ObjectConstructor):
2536 (JSC::constructObject):
2537 * kjs/ObjectConstructor.h:
2538 * kjs/ObjectPrototype.cpp:
2539 (JSC::ObjectPrototype::ObjectPrototype):
2540 * kjs/ObjectPrototype.h:
2541 * kjs/PrototypeFunction.cpp:
2542 (JSC::PrototypeFunction::PrototypeFunction):
2543 * kjs/PrototypeFunction.h:
2544 * kjs/RegExpConstructor.cpp:
2545 (JSC::RegExpConstructor::RegExpConstructor):
2546 (JSC::RegExpMatchesArray::RegExpMatchesArray):
2547 (JSC::constructRegExp):
2548 * kjs/RegExpConstructor.h:
2549 * kjs/RegExpObject.cpp:
2550 (JSC::RegExpObject::RegExpObject):
2551 * kjs/RegExpObject.h:
2552 * kjs/RegExpPrototype.cpp:
2553 (JSC::RegExpPrototype::RegExpPrototype):
2554 * kjs/RegExpPrototype.h:
2556 (GlobalObject::GlobalObject):
2557 * kjs/StringConstructor.cpp:
2558 (JSC::StringConstructor::StringConstructor):
2559 (JSC::constructWithStringConstructor):
2560 * kjs/StringConstructor.h:
2561 * kjs/StringObject.cpp:
2562 (JSC::StringObject::StringObject):
2563 * kjs/StringObject.h:
2564 * kjs/StringObjectThatMasqueradesAsUndefined.h:
2565 (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
2566 * kjs/StringPrototype.cpp:
2567 (JSC::StringPrototype::StringPrototype):
2568 * kjs/StringPrototype.h:
2569 Take and pass structures.
2571 2008-09-19 Alp Toker <alp@nuanti.com>
2573 Build fix for the 'gold' linker and recent binutils. New behaviour
2574 requires that we link to used libraries explicitly.
2578 2008-09-19 Sam Weinig <sam@webkit.org>
2580 Roll r36694 back in. It did not cause the crash.
2582 * JavaScriptCore.exp:
2583 * VM/JSPropertyNameIterator.cpp:
2584 (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
2585 (JSC::JSPropertyNameIterator::invalidate):
2586 * VM/JSPropertyNameIterator.h:
2587 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
2588 (JSC::JSPropertyNameIterator::create):
2590 (JSC::JSObject::getPropertyNames):
2591 * kjs/PropertyMap.cpp:
2592 (JSC::PropertyMap::getEnumerablePropertyNames):
2593 * kjs/PropertyMap.h:
2594 * kjs/PropertyNameArray.cpp:
2595 (JSC::PropertyNameArray::add):
2596 * kjs/PropertyNameArray.h:
2597 (JSC::PropertyNameArrayData::create):
2598 (JSC::PropertyNameArrayData::propertyNameVector):
2599 (JSC::PropertyNameArrayData::setCachedPrototypeChain):
2600 (JSC::PropertyNameArrayData::cachedPrototypeChain):
2601 (JSC::PropertyNameArrayData::begin):
2602 (JSC::PropertyNameArrayData::end):
2603 (JSC::PropertyNameArrayData::PropertyNameArrayData):
2604 (JSC::PropertyNameArray::PropertyNameArray):
2605 (JSC::PropertyNameArray::addKnownUnique):
2606 (JSC::PropertyNameArray::size):
2607 (JSC::PropertyNameArray::operator[]):
2608 (JSC::PropertyNameArray::begin):
2609 (JSC::PropertyNameArray::end):
2610 (JSC::PropertyNameArray::setData):
2611 (JSC::PropertyNameArray::data):
2612 (JSC::PropertyNameArray::releaseData):
2613 * kjs/StructureID.cpp:
2614 (JSC::structureIDChainsAreEqual):
2615 (JSC::StructureID::getEnumerablePropertyNames):
2616 (JSC::StructureID::clearEnumerationCache):
2617 (JSC::StructureID::createCachedPrototypeChain):
2618 * kjs/StructureID.h:
2620 2008-09-19 Sam Weinig <sam@webkit.org>
2624 * JavaScriptCore.exp:
2625 * VM/JSPropertyNameIterator.cpp:
2626 (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
2627 (JSC::JSPropertyNameIterator::invalidate):
2628 * VM/JSPropertyNameIterator.h:
2629 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
2630 (JSC::JSPropertyNameIterator::create):
2632 (JSC::JSObject::getPropertyNames):
2633 * kjs/PropertyMap.cpp:
2634 (JSC::PropertyMap::getEnumerablePropertyNames):
2635 * kjs/PropertyMap.h:
2636 * kjs/PropertyNameArray.cpp:
2637 (JSC::PropertyNameArray::add):
2638 * kjs/PropertyNameArray.h:
2639 (JSC::PropertyNameArray::PropertyNameArray):
2640 (JSC::PropertyNameArray::addKnownUnique):
2641 (JSC::PropertyNameArray::begin):
2642 (JSC::PropertyNameArray::end):
2643 (JSC::PropertyNameArray::size):
2644 (JSC::PropertyNameArray::operator[]):
2645 (JSC::PropertyNameArray::releaseIdentifiers):
2646 * kjs/StructureID.cpp:
2647 (JSC::StructureID::getEnumerablePropertyNames):
2648 * kjs/StructureID.h:
2649 (JSC::StructureID::clearEnumerationCache):
2651 2008-09-19 Oliver Hunt <oliver@apple.com>
2653 Reviewed by Maciej Stachowiak.
2655 Improve peformance of local variable initialisation.
2657 Pull local and constant initialisation out of slideRegisterWindowForCall
2658 and into its own opcode. This allows the JIT to generate the initialisation
2659 code for a function directly into the instruction stream and so avoids a few
2660 branches on function entry.
2662 Results a 1% progression in SunSpider, particularly in a number of the bitop
2663 tests where the called functions are very fast.
2666 (JSC::CTI::emitInitialiseRegister):
2667 (JSC::CTI::privateCompileMainPass):
2670 (JSC::CodeBlock::dump):
2671 * VM/CodeGenerator.cpp:
2672 (JSC::CodeGenerator::CodeGenerator):
2674 (JSC::slideRegisterWindowForCall):
2675 (JSC::Machine::privateExecute):
2678 2008-09-19 Sam Weinig <sam@webkit.org>
2680 Reviewed by Darin Adler.
2682 Patch for https://bugs.webkit.org/show_bug.cgi?id=20928
2683 Speed up JS property enumeration by caching entire PropertyNameArray
2685 1.3% speedup on Sunspider, 30% on string-fasta.
2687 * JavaScriptCore.exp:
2688 * VM/JSPropertyNameIterator.cpp:
2689 (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
2690 (JSC::JSPropertyNameIterator::invalidate):
2691 * VM/JSPropertyNameIterator.h:
2692 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
2693 (JSC::JSPropertyNameIterator::create):
2695 (JSC::JSObject::getPropertyNames):
2696 * kjs/PropertyMap.cpp:
2697 (JSC::PropertyMap::getEnumerablePropertyNames):
2698 * kjs/PropertyMap.h:
2699 * kjs/PropertyNameArray.cpp:
2700 (JSC::PropertyNameArray::add):
2701 * kjs/PropertyNameArray.h:
2702 (JSC::PropertyNameArrayData::create):
2703 (JSC::PropertyNameArrayData::propertyNameVector):
2704 (JSC::PropertyNameArrayData::setCachedPrototypeChain):
2705 (JSC::PropertyNameArrayData::cachedPrototypeChain):
2706 (JSC::PropertyNameArrayData::begin):
2707 (JSC::PropertyNameArrayData::end):
2708 (JSC::PropertyNameArrayData::PropertyNameArrayData):
2709 (JSC::PropertyNameArray::PropertyNameArray):
2710 (JSC::PropertyNameArray::addKnownUnique):
2711 (JSC::PropertyNameArray::size):
2712 (JSC::PropertyNameArray::operator[]):
2713 (JSC::PropertyNameArray::begin):
2714 (JSC::PropertyNameArray::end):
2715 (JSC::PropertyNameArray::setData):
2716 (JSC::PropertyNameArray::data):
2717 (JSC::PropertyNameArray::releaseData):
2718 * kjs/ScopeChain.cpp:
2719 (JSC::ScopeChainNode::print):
2720 * kjs/StructureID.cpp:
2721 (JSC::structureIDChainsAreEqual):
2722 (JSC::StructureID::getEnumerablePropertyNames):
2723 (JSC::StructureID::clearEnumerationCache):
2724 (JSC::StructureID::createCachedPrototypeChain):
2725 * kjs/StructureID.h:
2727 2008-09-19 Holger Hans Peter Freyther <zecke@selfish.org>
2729 Reviewed by Maciej Stachowiak.
2731 Fix a mismatched new[]/delete in JSObject::allocatePropertyStorage
2734 (JSC::JSObject::allocatePropertyStorage): Spotted by valgrind.
2736 2008-09-19 Darin Adler <darin@apple.com>
2738 Reviewed by Sam Weinig.
2740 - part 2 of https://bugs.webkit.org/show_bug.cgi?id=20858
2741 make each distinct C++ class get a distinct JSC::Structure
2743 * JavaScriptCore.exp: Exported constructEmptyObject for use in WebCore.
2745 * kjs/JSGlobalObject.h: Changed the protected constructor to take a
2746 structure instead of a prototype.
2748 * kjs/JSVariableObject.h: Removed constructor that takes a prototype.
2750 2008-09-19 Julien Chaffraix <jchaffraix@pleyo.com>
2752 Reviewed by Alexey Proskuryakov.
2754 Use the template hoisting technique on the RefCounted class. This reduces the code bloat due to
2755 non-template methods' code been copied for each instance of the template.
2756 The patch splits RefCounted between a base class that holds non-template methods and attributes
2757 and the template RefCounted class that keeps the same functionnality.
2759 On my Linux with gcc 4.3 for the Gtk port, this is:
2760 - a ~600KB save on libwebkit.so in release.
2761 - a ~1.6MB save on libwebkit.so in debug.
2763 It is a wash on Sunspider and a small win on Dromaeo (not sure it is relevant).
2764 On the whole, it should be a small win as we reduce the compiled code size and the only
2765 new function call should be inlined by the compiler.
2768 (WTF::RefCountedBase::ref): Copied from RefCounted.
2769 (WTF::RefCountedBase::hasOneRef): Ditto.
2770 (WTF::RefCountedBase::refCount): Ditto.
2771 (WTF::RefCountedBase::RefCountedBase): Ditto.
2772 (WTF::RefCountedBase::~RefCountedBase): Ditto.
2773 (WTF::RefCountedBase::derefBase): Tweaked from the RefCounted version to remove
2775 (WTF::RefCounted::RefCounted):
2776 (WTF::RefCounted::deref): Small wrapper around RefCountedBase::derefBase().
2777 (WTF::RefCounted::~RefCounted): Keep private destructor.
2779 2008-09-18 Darin Adler <darin@apple.com>
2781 Reviewed by Maciej Stachowiak.
2783 - part 1 of https://bugs.webkit.org/show_bug.cgi?id=20858
2784 make each distinct C++ class get a distinct JSC::Structure
2786 * kjs/lookup.h: Removed things here that were used only in WebCore:
2787 cacheGlobalObject, JSC_DEFINE_PROTOTYPE, JSC_DEFINE_PROTOTYPE_WITH_PROTOTYPE,
2788 and JSC_IMPLEMENT_PROTOTYPE.
2790 2008-09-18 Darin Adler <darin@apple.com>
2792 Reviewed by Maciej Stachowiak.
2794 - https://bugs.webkit.org/show_bug.cgi?id=20927
2795 simplify/streamline the code to turn strings into identifiers while parsing
2797 * kjs/grammar.y: Get rid of string from the union, and use ident for STRING as
2801 (JSC::Lexer::lex): Use makeIdentifier instead of makeUString for String.
2802 * kjs/lexer.h: Remove makeUString.
2804 * kjs/nodes.h: Changed StringNode to hold an Identifier instead of UString.
2806 * VM/CodeGenerator.cpp:
2807 (JSC::keyForCharacterSwitch): Updated since StringNode now holds an Identifier.
2808 (JSC::prepareJumpTableForStringSwitch): Ditto.
2810 (JSC::StringNode::emitCode): Ditto. The comment from here is now in the lexer.
2811 (JSC::processClauseList): Ditto.
2812 * kjs/nodes2string.cpp:
2813 (JSC::StringNode::streamTo): Ditto.
2815 2008-09-18 Sam Weinig <sam@webkit.org>
2820 (JSC::Instruction::Instruction):
2822 2008-09-18 Oliver Hunt <oliver@apple.com>
2824 Reviewed by Maciej Stachowiak.
2826 Bug 20911: REGRESSION(r36480?): Reproducible assertion failure below derefStructureIDs 64-bit JavaScriptCore
2827 <https://bugs.webkit.org/show_bug.cgi?id=20911>
2829 The problem was simply caused by the int constructor for Instruction
2830 failing to initialise the full struct in 64bit builds.
2833 (JSC::Instruction::Instruction):
2835 2008-09-18 Darin Adler <darin@apple.com>
2839 * wtf/RefCountedLeakCounter.cpp: Removed stray "static".
2841 2008-09-18 Darin Adler <darin@apple.com>
2843 Reviewed by Sam Weinig.
2845 * kjs/JSGlobalObject.h: Tiny style guideline tweak.
2847 2008-09-18 Darin Adler <darin@apple.com>
2849 Reviewed by Sam Weinig.
2851 - fix https://bugs.webkit.org/show_bug.cgi?id=20925
2852 LEAK messages appear every time I quit
2854 * JavaScriptCore.exp: Updated, and also added an export
2855 needed for future WebCore use of JSC::StructureID.
2857 * wtf/RefCountedLeakCounter.cpp:
2858 (WTF::RefCountedLeakCounter::suppressMessages): Added.
2859 (WTF::RefCountedLeakCounter::cancelMessageSuppression): Added.
2860 (WTF::RefCountedLeakCounter::RefCountedLeakCounter): Tweaked a bit.
2861 (WTF::RefCountedLeakCounter::~RefCountedLeakCounter): Added code to
2862 log the reason there was no leak checking done.
2863 (WTF::RefCountedLeakCounter::increment): Tweaked a bit.
2864 (WTF::RefCountedLeakCounter::decrement): Ditto.
2866 * wtf/RefCountedLeakCounter.h: Replaced setLogLeakMessages with two
2867 new functions, suppressMessages and cancelMessageSuppression. Also
2868 added m_ prefixes to the data member names.
2870 2008-09-18 Holger Hans Peter Freyther <zecke@selfish.org>
2872 Reviewed by Mark Rowe.
2874 https://bugs.webkit.org/show_bug.cgi?id=20437
2876 Add a proper #define to define which XML Parser implementation to use. Client
2877 code can use #if USE(QXMLSTREAM) to decide if the Qt XML StreamReader
2878 implementation is going to be used.
2882 2008-09-18 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2884 Reviewed by Maciej Stachowiak.
2886 Make a Unicode non-breaking space count as a whitespace character in
2887 PCRE. This change was already made in WREC, and it fixes one of the
2888 Mozilla JS tests. Since it is now fixed in PCRE as well, we can check
2889 in a new set of expected test results.
2891 * pcre/pcre_internal.h:
2893 * tests/mozilla/expected.html:
2895 2008-09-18 Stephanie Lewis <slewis@apple.com>
2897 Reviewed by Mark Rowe and Maciej Stachowiak.
2899 add an option use arch to specify which architecture to run.
2901 * tests/mozilla/jsDriver.pl:
2903 2008-09-17 Oliver Hunt <oliver@apple.com>
2905 Correctly restore argument reference prior to SFX runtime calls.
2907 Reviewed by Steve Falkenburg.
2910 (JSC::CTI::privateCompileSlowCases):
2911 (JSC::CTI::privateCompile):
2913 2008-09-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2915 Reviewed by Maciej Stachowiak.
2917 Bug 20876: REGRESSION (r36417, r36427): fast/js/exception-expression-offset.html fails
2918 <https://bugs.webkit.org/show_bug.cgi?id=20876>
2920 r36417 and r36427 caused an get_by_id opcode to be emitted before the
2921 instanceof and construct opcodes, in order to enable inline caching of
2922 the prototype property. Unfortunately, this regressed some tests dealing
2923 with exceptions thrown by 'instanceof' and the 'new' operator. We fix
2924 these problems by detecting whether an "is not an object" exception is
2925 thrown before op_instanceof or op_construct, and emit the proper
2926 exception in those cases.
2928 * VM/CodeGenerator.cpp:
2929 (JSC::CodeGenerator::emitConstruct):
2930 * VM/CodeGenerator.h:
2931 * VM/ExceptionHelpers.cpp:
2932 (JSC::createInvalidParamError):
2933 (JSC::createNotAConstructorError):
2934 (JSC::createNotAnObjectError):
2935 * VM/ExceptionHelpers.h:
2937 (JSC::Machine::getOpcode):
2938 (JSC::Machine::privateExecute):
2941 (JSC::NewExprNode::emitCode):
2942 (JSC::InstanceOfNode::emitCode):
2944 2008-09-17 Gavin Barraclough <barraclough@apple.com>
2946 Reviewed by Oliver Hunt.
2948 JIT generation cti_op_construct_verify.
2950 Quarter to half percent progression on v8-tests.
2951 Roughly not change on SunSpider (possible minor progression).
2954 (JSC::CTI::privateCompileMainPass):
2958 2008-09-15 Steve Falkenburg <sfalken@apple.com>
2960 Improve timer accuracy for JavaScript Date object on Windows.
2962 Use a combination of ftime and QueryPerformanceCounter.
2963 ftime returns the information we want, but doesn't have sufficient resolution.
2964 QueryPerformanceCounter has high resolution, but is only usable to measure time intervals.
2965 To combine them, we call ftime and QueryPerformanceCounter initially. Later calls will use
2966 QueryPerformanceCounter by itself, adding the delta to the saved ftime. We re-sync to
2967 correct for drift if the low-res and high-res elapsed time between calls differs by more
2968 than twice the low-resolution timer resolution.
2970 QueryPerformanceCounter may be inaccurate due to a problems with:
2971 - some PCI bridge chipsets (http://support.microsoft.com/kb/274323)
2972 - BIOS bugs (http://support.microsoft.com/kb/895980/)
2973 - BIOS/HAL bugs on multiprocessor/multicore systems (http://msdn.microsoft.com/en-us/library/ms644904.aspx)
2975 Reviewed by Darin Adler.
2978 (JSC::highResUpTime):
2979 (JSC::lowResUTCTime):
2980 (JSC::qpcAvailable):
2981 (JSC::getCurrentUTCTimeWithMicroseconds):
2983 2008-09-17 Gavin Barraclough <barraclough@apple.com>
2985 Reviewed by Geoff Garen.
2987 Implement JIT generation of CallFrame initialization, for op_call.
2989 1% sunspider 2.5% v8-tests.
2992 (JSC::CTI::compileOpCall):
2994 (JSC::Machine::cti_op_call_JSFunction):
2995 (JSC::Machine::cti_op_call_NotJSFunction):
2997 2008-09-17 Gavin Barraclough <barraclough@apple.com>
2999 Reviewed by Geoff Garen.
3001 Optimizations for op_call in CTI. Move check for (ctiCode == 0) into JIT code,
3002 move copying of scopeChain for CodeBlocks that needFullScopeChain into head of
3003 functions, instead of checking prior to making the call.
3005 3% on v8-tests (4% on richards, 6% in delta-blue)
3008 (JSC::CTI::compileOpCall):
3009 (JSC::CTI::privateCompileSlowCases):
3010 (JSC::CTI::privateCompile):
3012 (JSC::Machine::execute):
3013 (JSC::Machine::cti_op_call_JSFunction):
3014 (JSC::Machine::cti_vm_compile):
3015 (JSC::Machine::cti_vm_updateScopeChain):
3016 (JSC::Machine::cti_op_construct_JSConstruct):
3019 2008-09-17 Tor Arne Vestbø <tavestbo@trolltech.com>
3021 Fix the QtWebKit/Mac build
3023 * wtf/ThreadingQt.cpp:
3024 (WTF::initializeThreading): use QCoreApplication to get the main thread
3026 2008-09-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3028 Reviewed by Maciej Stachowiak.
3030 Bug 20857: REGRESSION (r36427): ASSERTION FAILED: m_refCount >= 0 in RegisterID::deref()
3031 <https://bugs.webkit.org/show_bug.cgi?id=20857>
3033 Fix a problem stemming from the slightly unsafe behaviour of the
3034 CodeGenerator::finalDestination() method by putting the "func" argument
3035 of the emitConstruct() method in a RefPtr in its caller. Also, add an
3036 assertion guaranteeing that this is always the case.
3038 CodeGenerator::finalDestination() is still incorrect and can cause
3039 problems with a different allocator; see bug 20340 for more details.
3041 * VM/CodeGenerator.cpp:
3042 (JSC::CodeGenerator::emitConstruct):
3044 (JSC::NewExprNode::emitCode):
3046 2008-09-16 Alice Liu <alice.liu@apple.com>
3051 (JSC::CTI::privateCompileMainPass):
3053 2008-09-16 Gavin Barraclough <barraclough@apple.com>
3055 Reviewed by Geoff Garen.
3057 CTI code generation for op_ret. The majority of the work
3058 (updating variables on the stack & on exec) can be performed
3059 directly in generated code.
3061 We still need to check, & to call out to C-code to handle
3062 activation records, profiling, and full scope chains.
3064 +1.5% Sunspider, +5/6% v8 tests.
3067 (JSC::CTI::emitPutCTIParam):
3068 (JSC::CTI::compileOpCall):
3069 (JSC::CTI::privateCompileMainPass):
3072 (JSC::Machine::cti_op_ret_activation):
3073 (JSC::Machine::cti_op_ret_profiler):
3074 (JSC::Machine::cti_op_ret_scopeChain):
3077 2008-09-16 Dimitri Glazkov <dglazkov@chromium.org>
3079 Fix the Windows build.
3081 Add some extra parentheses to stop MSVC from complaining so much.
3084 (JSC::Machine::privateExecute):
3085 (JSC::Machine::cti_op_stricteq):
3086 (JSC::Machine::cti_op_nstricteq):
3087 * kjs/operations.cpp:
3090 2008-09-15 Maciej Stachowiak <mjs@apple.com>
3092 Reviewed by Cameron Zwarich.
3094 - speed up the === and !== operators by choosing the fast cases better
3096 No effect on SunSpider but speeds up the V8 EarlyBoyer benchmark about 4%.
3099 (JSC::Machine::privateExecute):
3100 (JSC::Machine::cti_op_stricteq):
3101 (JSC::Machine::cti_op_nstricteq):
3102 * kjs/JSImmediate.h:
3103 (JSC::JSImmediate::areBothImmediate):
3104 * kjs/operations.cpp:
3106 (JSC::strictEqualSlowCase):
3109 2008-09-15 Oliver Hunt <oliver@apple.com>
3113 Coding style cleanup.
3116 (JSC::Machine::privateExecute):
3118 2008-09-15 Oliver Hunt <oliver@apple.com>
3120 Reviewed by Cameron Zwarich.
3122 Bug 20874: op_resolve does not do any form of caching
3123 <https://bugs.webkit.org/show_bug.cgi?id=20874>
3125 This patch adds an op_resolve_global opcode to handle (and cache)
3126 property lookup we can statically determine must occur on the global
3129 3% progression on sunspider, 3.2x improvement to bitops-bitwise-and, and
3130 10% in math-partial-sums
3133 (JSC::CTI::privateCompileMainPass):
3136 (JSC::CodeBlock::dump):
3137 * VM/CodeGenerator.cpp:
3138 (JSC::CodeGenerator::findScopedProperty):
3139 (JSC::CodeGenerator::emitResolve):
3141 (JSC::resolveGlobal):
3142 (JSC::Machine::privateExecute):
3143 (JSC::Machine::cti_op_resolve_global):
3147 2008-09-15 Sam Weinig <sam@webkit.org>
3149 Roll out r36462. It broke document.all.
3152 (JSC::CTI::privateCompileMainPass):
3153 (JSC::CTI::privateCompileSlowCases):
3156 (JSC::Machine::Machine):
3157 (JSC::Machine::cti_op_eq_null):
3158 (JSC::Machine::cti_op_neq_null):
3160 (JSC::Machine::isJSString):
3162 * kjs/JSWrapperObject.h:
3163 * kjs/StringObject.h:
3164 * kjs/StringObjectThatMasqueradesAsUndefined.h:
3166 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3168 Reviewed by Maciej Stachowiak.
3170 Bug 20863: ASSERTION FAILED: addressOffset < instructions.size() in CodeBlock::getHandlerForVPC
3171 <https://bugs.webkit.org/show_bug.cgi?id=20863>
3173 r36427 changed the number of arguments to op_construct without changing
3174 the argument index for the vPC in the call to initializeCallFrame() in
3175 the CTI case. This caused a JSC test failure. Correcting the argument
3176 index fixes the test failure.
3179 (JSC::Machine::cti_op_construct_JSConstruct):
3181 2008-09-15 Mark Rowe <mrowe@apple.com>
3187 2008-09-15 Geoffrey Garen <ggaren@apple.com>
3189 Reviewed by Maciej Stachowiak.
3191 Fixed a typo in op_get_by_id_chain that caused it to miss every time
3194 Also, a little cleanup.
3197 (JSC::Machine::privateExecute): Set up baseObject before entering the
3198 loop, so we compare against the right values.
3200 2008-09-15 Geoffrey Garen <ggaren@apple.com>
3202 Reviewed by Sam Weinig.
3204 Removed the CalledAsConstructor flag from the call frame header. Now,
3205 we use an explicit opcode at the call site to fix up constructor results.
3207 SunSpider says 0.4% faster.
3209 cti_op_construct_verify is an out-of-line function call for now, but we
3210 can fix that once StructureID holds type information like isObject.
3213 (JSC::CTI::privateCompileMainPass): Codegen for the new opcode.
3216 (JSC::CodeBlock::dump):
3218 * VM/CodeGenerator.cpp: Codegen for the new opcode. Also...
3219 (JSC::CodeGenerator::emitCall): ... don't test for known non-zero value.
3220 (JSC::CodeGenerator::emitConstruct): ... ditto.
3222 * VM/Machine.cpp: No more CalledAsConstructor
3223 (JSC::Machine::privateExecute): Implementation for the new opcode.
3224 (JSC::Machine::cti_op_ret): The speedup: no need to check whether we were
3225 called as a constructor.
3226 (JSC::Machine::cti_op_construct_verify): Implementation for the new opcode.
3229 * VM/Opcode.h: Declare new opcode.
3231 * VM/RegisterFile.h:
3232 (JSC::RegisterFile::): No more CalledAsConstructor
3234 2008-09-15 Gavin Barraclough <barraclough@apple.com>
3236 Reviewed by Geoff Garen.
3238 Inline code generation of eq_null/neq_null for CTI. Uses vptr checking for
3239 StringObjectsThatAreMasqueradingAsBeingUndefined. In the long run, the
3240 masquerading may be handled differently (through the StructureIDs - see bug
3246 (JSC::CTI::emitJumpSlowCaseIfIsJSCell):
3247 (JSC::CTI::privateCompileMainPass):
3248 (JSC::CTI::privateCompileSlowCases):
3251 (JSC::Machine::Machine):
3252 (JSC::Machine::cti_op_eq_null):
3253 (JSC::Machine::cti_op_neq_null):
3255 (JSC::Machine::doesMasqueradesAsUndefined):
3256 * kjs/JSWrapperObject.h:
3257 (JSC::JSWrapperObject::):
3258 (JSC::JSWrapperObject::JSWrapperObject):
3259 * kjs/StringObject.h:
3260 (JSC::StringObject::StringObject):
3261 * kjs/StringObjectThatMasqueradesAsUndefined.h:
3262 (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
3264 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3266 Rubber-stamped by Oliver Hunt.
3268 r36427 broke CodeBlock::dump() by changing the number of arguments to
3269 op_construct without changing the code that prints it. This patch fixes
3270 it by printing the additional argument.
3272 * JavaScriptCore.xcodeproj/project.pbxproj:
3274 (JSC::CodeBlock::dump):
3276 2008-09-15 Adam Roben <aroben@apple.com>
3280 * kjs/StructureID.cpp: Removed a stray semicolon.
3282 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3284 Reviewed by Maciej Stachowiak.
3286 Fix a crash in fast/js/exception-expression-offset.html caused by not
3287 updating all mentions of the length of op_construct in r36427.
3290 (JSC::Machine::cti_op_construct_NotJSConstruct):
3292 2008-09-15 Maciej Stachowiak <mjs@apple.com>
3294 Reviewed by Cameron Zwarich.
3296 - fix layout test failure introduced by fix for 20849
3298 (The failing test was fast/js/delete-then-put.html)
3301 (JSC::JSObject::removeDirect): Clear enumeration cache
3302 in the dictionary case.
3304 (JSC::JSObject::putDirect): Ditto.
3305 * kjs/StructureID.h:
3306 (JSC::StructureID::clearEnumerationCache): Inline to handle the
3309 2008-09-15 Maciej Stachowiak <mjs@apple.com>
3311 Reviewed by Cameron Zwarich.
3313 - fix JSC test failures introduced by fix for 20849
3315 * kjs/PropertyMap.cpp:
3316 (JSC::PropertyMap::getEnumerablePropertyNames): Use the correct count.
3318 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3320 Reviewed by Maciej Stachowiak.
3322 Bug 20851: REGRESSION (r36410): fast/js/kde/GlobalObject.html fails
3323 <https://bugs.webkit.org/show_bug.cgi?id=20851>
3325 r36410 introduced an optimization for parseInt() that is incorrect when
3326 its argument is larger than the range of a 32-bit integer. If the
3327 argument is a number that is not an immediate integer, then the correct
3328 behaviour is to return the floor of its value, unless it is an infinite
3329 value, in which case the correct behaviour is to return 0.
3331 * kjs/JSGlobalObjectFunctions.cpp:
3332 (JSC::globalFuncParseInt):
3334 2008-09-15 Sam Weinig <sam@webkit.org>
3336 Reviewed by Maciej Stachowiak.
3338 Patch for https://bugs.webkit.org/show_bug.cgi?id=20849
3339 Cache property names for getEnumerablePropertyNames in the StructureID.
3341 ~0.5% speedup on Sunspider overall (9.7% speedup on string-fasta). ~1% speedup
3342 on the v8 test suite.
3345 (JSC::JSObject::getPropertyNames):
3346 * kjs/PropertyMap.cpp:
3347 (JSC::PropertyMap::getEnumerablePropertyNames):
3348 * kjs/PropertyMap.h:
3349 * kjs/StructureID.cpp:
3350 (JSC::StructureID::StructureID):
3351 (JSC::StructureID::getEnumerablePropertyNames):
3352 * kjs/StructureID.h:
3354 2008-09-14 Maciej Stachowiak <mjs@apple.com>
3356 Reviewed by Cameron Zwarich.
3358 - speed up JS construction by extracting "prototype" lookup so PIC applies.
3360 ~0.5% speedup on SunSpider
3361 Speeds up some of the V8 tests as well, most notably earley-boyer.
3364 (JSC::CTI::compileOpCall): Account for extra arg for prototype.
3365 (JSC::CTI::privateCompileMainPass): Account for increased size of op_construct.
3366 * VM/CodeGenerator.cpp:
3367 (JSC::CodeGenerator::emitConstruct): Emit separate lookup to get prototype property.
3369 (JSC::Machine::privateExecute): Expect prototype arg in op_construct.
3370 (JSC::Machine::cti_op_construct_JSConstruct): ditto
3371 (JSC::Machine::cti_op_construct_NotJSConstruct): ditto
3373 2008-09-10 Alexey Proskuryakov <ap@webkit.org>
3375 Reviewed by Eric Seidel.
3377 Add a protected destructor for RefCounted.
3379 It is wrong to call its destructor directly, because (1) this should be taken care of by
3380 deref(), and (2) many classes that use RefCounted have non-virtual destructors.
3382 No change in behavior.
3384 * wtf/RefCounted.h: (WTF::RefCounted::~RefCounted):
3386 2008-09-14 Gavin Barraclough <barraclough@apple.com>
3388 Reviewed by Sam Weinig.
3390 Accelerated property accesses.
3392 Inline more of the array access code into the JIT code for get/put_by_val.
3393 Accelerate get/put_by_id by speculatively inlining a disable direct access
3394 into the hot path of the code, and repatch this with the correct StructureID
3395 and property map offset once these are known. In the case of accesses to the
3396 prototype and reading the array-length a trampoline is genertaed, and the
3397 branch to the slow-case is relinked to jump to this.
3399 By repatching, we mean rewriting the x86 instruction stream. Instructions are
3400 only modified in a simple fasion - altering immediate operands, memory access
3401 deisplacements, and branch offsets.
3403 For regular get_by_id/put_by_id accesses to an object, a StructureID in an
3404 instruction's immediate operant is updateded, and a memory access operation's
3405 displacement is updated to access the correct field on the object. In the case
3406 of more complex accesses (array length and get_by_id_prototype) the offset on
3407 the branch to slow-case is updated, to now jump to a trampoline.
3409 +2.8% sunspider, +13% v8-tests
3412 (JSC::CTI::emitCall):
3413 (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
3415 (JSC::CTI::privateCompileMainPass):
3416 (JSC::CTI::privateCompileSlowCases):
3417 (JSC::CTI::privateCompile):
3418 (JSC::CTI::privateCompileGetByIdSelf):
3419 (JSC::CTI::privateCompileGetByIdProto):
3420 (JSC::CTI::privateCompileGetByIdChain):
3421 (JSC::CTI::privateCompilePutByIdReplace):
3422 (JSC::CTI::privateCompilePutByIdTransition):
3423 (JSC::CTI::privateCompileArrayLengthTrampoline):
3424 (JSC::CTI::privateCompileStringLengthTrampoline):
3425 (JSC::CTI::patchGetByIdSelf):
3426 (JSC::CTI::patchPutByIdReplace):
3427 (JSC::CTI::privateCompilePatchGetArrayLength):
3428 (JSC::CTI::privateCompilePatchGetStringLength):
3430 (JSC::CTI::compileGetByIdSelf):
3431 (JSC::CTI::compileGetByIdProto):
3432 (JSC::CTI::compileGetByIdChain):
3433 (JSC::CTI::compilePutByIdReplace):
3434 (JSC::CTI::compilePutByIdTransition):
3435 (JSC::CTI::compileArrayLengthTrampoline):
3436 (JSC::CTI::compileStringLengthTrampoline):
3437 (JSC::CTI::compilePatchGetArrayLength):
3438 (JSC::CTI::compilePatchGetStringLength):
3440 (JSC::CodeBlock::dump):
3441 (JSC::CodeBlock::~CodeBlock):
3443 (JSC::StructureStubInfo::StructureStubInfo):
3444 (JSC::CodeBlock::getStubInfo):
3446 (JSC::Machine::tryCTICachePutByID):
3447 (JSC::Machine::tryCTICacheGetByID):
3448 (JSC::Machine::cti_op_put_by_val_array):
3450 * masm/X86Assembler.h:
3451 (JSC::X86Assembler::):
3452 (JSC::X86Assembler::cmpl_i8m):
3453 (JSC::X86Assembler::emitUnlinkedJa):
3454 (JSC::X86Assembler::getRelocatedAddress):
3455 (JSC::X86Assembler::getDifferenceBetweenLabels):
3456 (JSC::X86Assembler::emitModRm_opmsib):
3458 2008-09-14 Maciej Stachowiak <mjs@apple.com>
3460 Reviewed by Cameron Zwarich.
3462 - split the "prototype" lookup for hasInstance into opcode stream so it can be cached
3464 ~5% speedup on v8 earley-boyer test
3466 * API/JSCallbackObject.h: Add a parameter for the pre-looked-up prototype.
3467 * API/JSCallbackObjectFunctions.h:
3468 (JSC::::hasInstance): Ditto.
3469 * API/JSValueRef.cpp:
3470 (JSValueIsInstanceOfConstructor): Look up and pass in prototype.
3471 * JavaScriptCore.exp:
3473 (JSC::CTI::privateCompileMainPass): Pass along prototype.
3475 (JSC::CodeBlock::dump): Print third arg.
3476 * VM/CodeGenerator.cpp:
3477 (JSC::CodeGenerator::emitInstanceOf): Implement this, now that there
3478 is a third argument.
3479 * VM/CodeGenerator.h:
3481 (JSC::Machine::privateExecute): Pass along the prototype.
3482 (JSC::Machine::cti_op_instanceof): ditto
3484 (JSC::JSObject::hasInstance): Expect to get a pre-looked-up prototype.
3487 (JSC::InstanceOfNode::emitCode): Emit a get_by_id of the prototype
3488 property and pass that register to instanceof.
3491 2008-09-14 Gavin Barraclough <barraclough@apple.com>
3493 Reviewed by Sam Weinig.
3495 Remove unnecessary virtual function call from cti_op_call_JSFunction -
3496 ~5% on richards, ~2.5% on v8-tests, ~0.5% on sunspider.
3499 (JSC::Machine::cti_op_call_JSFunction):
3501 2008-09-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3503 Reviewed by Maciej Stachowiak.
3505 Bug 20827: the 'typeof' operator is slow
3506 <https://bugs.webkit.org/show_bug.cgi?id=20827>
3508 Optimize the 'typeof' operator when its result is compared to a constant
3511 This is a 5.5% speedup on the V8 Earley-Boyer test.
3514 (JSC::CTI::privateCompileMainPass):
3516 (JSC::CodeBlock::dump):
3517 * VM/CodeGenerator.cpp:
3518 (JSC::CodeGenerator::emitEqualityOp):
3519 * VM/CodeGenerator.h:
3521 (JSC::jsIsObjectType):
3522 (JSC::jsIsFunctionType):
3523 (JSC::Machine::privateExecute):
3524 (JSC::Machine::cti_op_is_undefined):
3525 (JSC::Machine::cti_op_is_boolean):
3526 (JSC::Machine::cti_op_is_number):
3527 (JSC::Machine::cti_op_is_string):
3528 (JSC::Machine::cti_op_is_object):
3529 (JSC::Machine::cti_op_is_function):
3533 (JSC::BinaryOpNode::emitCode):
3534 (JSC::EqualNode::emitCode):
3535 (JSC::StrictEqualNode::emitCode):
3538 2008-09-14 Sam Weinig <sam@webkit.org>
3540 Reviewed by Cameron Zwarich.
3542 Patch for https://bugs.webkit.org/show_bug.cgi?id=20844
3543 Speed up parseInt for numbers
3545 Sunspider reports this as 1.029x as fast overall and 1.37x as fast on string-unpack-code.
3546 No change on the v8 suite.
3548 * kjs/JSGlobalObjectFunctions.cpp:
3549 (JSC::globalFuncParseInt): Don't convert numbers to strings just to
3550 convert them back to numbers.
3552 2008-09-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3554 Reviewed by Oliver Hunt.
3556 Bug 20816: op_lesseq should be optimized
3557 <https://bugs.webkit.org/show_bug.cgi?id=20816>
3559 Add a loop_if_lesseq opcode that is similar to the loop_if_less opcode.
3561 This is a 9.4% speedup on the V8 Crypto benchmark.
3564 (JSC::CTI::privateCompileMainPass):
3565 (JSC::CTI::privateCompileSlowCases):
3567 (JSC::CodeBlock::dump):
3568 * VM/CodeGenerator.cpp:
3569 (JSC::CodeGenerator::emitJumpIfTrue):
3571 (JSC::Machine::privateExecute):
3572 (JSC::Machine::cti_op_loop_if_lesseq):
3576 2008-09-14 Sam Weinig <sam@webkit.org>
3578 Reviewed by Cameron Zwarich.
3580 Cleanup Sampling code.
3583 (JSC::CTI::emitCall):
3584 (JSC::CTI::privateCompileMainPass):
3586 (JSC::CTI::execute):
3587 * VM/SamplingTool.cpp:
3589 (JSC::SamplingTool::run):
3590 (JSC::SamplingTool::dump):
3591 * VM/SamplingTool.h:
3592 (JSC::SamplingTool::callingHostFunction):
3594 2008-09-13 Oliver Hunt <oliver@apple.com>
3596 Reviewed by Cameron Zwarich.
3598 Bug 20821: Cache property transitions to speed up object initialization
3599 https://bugs.webkit.org/show_bug.cgi?id=20821
3601 Implement a transition cache to improve the performance of new properties
3602 being added to objects. This is extremely beneficial in constructors and
3603 shows up as a 34% improvement on access-binary-trees in SunSpider (0.8%
3607 (JSC::CTI::privateCompileMainPass):