1 2008-09-23 Geoffrey Garen <ggaren@apple.com>
3 Reviewed by Oliver Hunt.
5 Fixed https://bugs.webkit.org/show_bug.cgi?id=21038 | <rdar://problem/6240812>
6 Uncaught exceptions in regex replace callbacks crash webkit
8 This was a combination of two problems:
10 (1) the replace function would continue execution after an exception
13 (2) In some cases, the Machine would return 0 in the case of an exception,
14 despite the fact that a few clients dereference the Machine's return
15 value without first checking for an exception.
18 (JSC::Machine::execute):
20 ^ Return jsNull() instead of 0 in the case of an exception, since some
21 clients depend on using our return value.
23 ^ ASSERT that execution does not continue after an exception has been
24 thrown, to help catch problems like this in the future.
26 * kjs/StringPrototype.cpp:
27 (JSC::stringProtoFuncReplace):
29 ^ Stop execution if an exception has been thrown.
31 2008-09-23 Geoffrey Garen <ggaren@apple.com>
33 Try to fix the windows build.
36 (JSC::CTI::compileOpCall):
37 (JSC::CTI::privateCompileMainPass):
39 2008-09-23 Alp Toker <alp@nuanti.com>
45 2008-09-23 Geoffrey Garen <ggaren@apple.com>
47 Reviewed by Darin Adler.
49 * wtf/Platform.h: Removed duplicate #if.
51 2008-09-23 Geoffrey Garen <ggaren@apple.com>
53 Reviewed by Darin Adler.
55 Changed the layout of the call frame from
57 { header, parameters, locals | constants, temporaries }
61 { parameters, header | locals, constants, temporaries }
63 This simplifies function entry+exit, and enables a number of future
66 13.5% speedup on empty call benchmark for bytecode; 23.6% speedup on
67 empty call benchmark for CTI.
69 SunSpider says no change. SunSpider --v8 says 1% faster.
73 Added a bit of abstraction for calculating whether a register is a
74 constant, since this patch changes that calculation:
75 (JSC::CTI::isConstant):
76 (JSC::CTI::getConstant):
77 (JSC::CTI::emitGetArg):
78 (JSC::CTI::emitGetPutArg):
79 (JSC::CTI::getConstantImmediateNumericArg):
81 Updated for changes to callframe header location:
82 (JSC::CTI::emitPutToCallFrameHeader):
83 (JSC::CTI::emitGetFromCallFrameHeader):
84 (JSC::CTI::printOpcodeOperandTypes):
86 Renamed to spite Oliver:
87 (JSC::CTI::emitInitRegister):
89 Added an abstraction for emitting a call through a register, so that
90 calls through registers generate exception info, too:
93 Updated to match the new callframe header layout, and to support calls
94 through registers, which have no destination address:
95 (JSC::CTI::compileOpCall):
96 (JSC::CTI::privateCompileMainPass):
97 (JSC::CTI::privateCompileSlowCases):
98 (JSC::CTI::privateCompile):
103 (JSC::CallRecord::CallRecord):
107 Updated for new register layout:
109 (JSC::CodeBlock::dump):
113 Updated CodeBlock to track slightly different information about the
114 register frame, and tweaked the style of an ASSERT_NOT_REACHED.
115 (JSC::CodeBlock::CodeBlock):
116 (JSC::CodeBlock::getStubInfo):
118 * VM/CodeGenerator.cpp:
120 Added some abstraction around constant register allocation, since this
121 patch changes it, changed codegen to account for the new callframe
122 layout, and added abstraction around register fetching code
123 that used to assume that all local registers lived at negative indices,
124 since vars now live at positive indices:
125 (JSC::CodeGenerator::generate):
126 (JSC::CodeGenerator::addVar):
127 (JSC::CodeGenerator::addGlobalVar):
128 (JSC::CodeGenerator::allocateConstants):
129 (JSC::CodeGenerator::CodeGenerator):
130 (JSC::CodeGenerator::addParameter):
131 (JSC::CodeGenerator::registerFor):
132 (JSC::CodeGenerator::constRegisterFor):
133 (JSC::CodeGenerator::newRegister):
134 (JSC::CodeGenerator::newTemporary):
135 (JSC::CodeGenerator::highestUsedRegister):
136 (JSC::CodeGenerator::addConstant):
138 ASSERT that our caller referenced the registers it passed to us.
139 Otherwise, we might overwrite them with parameters:
140 (JSC::CodeGenerator::emitCall):
141 (JSC::CodeGenerator::emitConstruct):
143 * VM/CodeGenerator.h:
145 Added some abstraction for getting a RegisterID for a given index,
146 since the rules are a little weird:
147 (JSC::CodeGenerator::registerFor):
151 Utility function to transform a machine return PC to a virtual machine
152 return VPC, for the sake of stack unwinding, since both PCs are stored
153 in the same location now:
156 Tweaked to account for new call frame:
157 (JSC::Machine::initializeCallFrame):
159 Tweaked to account for registerOffset supplied by caller:
160 (JSC::slideRegisterWindowForCall):
162 Tweaked to account for new register layout:
163 (JSC::scopeChainForCall):
164 (JSC::Machine::callEval):
165 (JSC::Machine::dumpRegisters):
166 (JSC::Machine::unwindCallFrame):
167 (JSC::Machine::execute):
169 Changed op_call and op_construct to implement the new calling convention:
170 (JSC::Machine::privateExecute):
172 Tweaked to account for the new register layout:
173 (JSC::Machine::retrieveArguments):
174 (JSC::Machine::retrieveCaller):
175 (JSC::Machine::retrieveLastCaller):
176 (JSC::Machine::callFrame):
177 (JSC::Machine::getArgumentsData):
179 Changed CTI call helpers to implement the new calling convention:
180 (JSC::Machine::cti_op_call_JSFunction):
181 (JSC::Machine::cti_op_call_NotJSFunction):
182 (JSC::Machine::cti_op_ret_activation):
183 (JSC::Machine::cti_op_ret_profiler):
184 (JSC::Machine::cti_op_construct_JSConstruct):
185 (JSC::Machine::cti_op_construct_NotJSConstruct):
186 (JSC::Machine::cti_op_call_eval):
192 Renamed op_initialise_locals to op_init, because this opcode
193 doesn't initialize all locals, and it doesn't initialize only locals.
194 Also, to spite Oliver.
198 New call frame enumeration values:
199 (JSC::RegisterFile::):
201 Simplified the calculation of whether a RegisterID is a temporary,
202 since we can no longer assume that all positive non-constant registers
205 (JSC::RegisterID::RegisterID):
206 (JSC::RegisterID::setTemporary):
207 (JSC::RegisterID::isTemporary):
209 Renamed firstArgumentIndex to firstParameterIndex because the assumption
210 that this variable pertained to the actual arguments supplied by the
211 caller caused me to write some buggy code:
213 (JSC::ArgumentsData::ArgumentsData):
214 (JSC::Arguments::Arguments):
215 (JSC::Arguments::fillArgList):
216 (JSC::Arguments::getOwnPropertySlot):
217 (JSC::Arguments::put):
219 Updated for new call frame layout:
220 * kjs/DebuggerCallFrame.cpp:
221 (JSC::DebuggerCallFrame::functionName):
222 (JSC::DebuggerCallFrame::type):
223 * kjs/DebuggerCallFrame.h:
225 Changed the activation object to account for the fact that a call frame
226 header now sits between parameters and local variables. This change
227 requires all variable objects to do their own marking, since they
228 now use their register storage differently:
229 * kjs/JSActivation.cpp:
230 (JSC::JSActivation::mark):
231 (JSC::JSActivation::copyRegisters):
232 (JSC::JSActivation::createArgumentsObject):
233 * kjs/JSActivation.h:
235 Updated global object to use the new interfaces required by the change
236 to JSActivation above:
237 * kjs/JSGlobalObject.cpp:
238 (JSC::JSGlobalObject::reset):
239 (JSC::JSGlobalObject::mark):
240 (JSC::JSGlobalObject::copyGlobalsFrom):
241 (JSC::JSGlobalObject::copyGlobalsTo):
242 * kjs/JSGlobalObject.h:
243 (JSC::JSGlobalObject::addStaticGlobals):
245 Updated static scope object to use the new interfaces required by the
246 change to JSActivation above:
247 * kjs/JSStaticScopeObject.cpp:
248 (JSC::JSStaticScopeObject::mark):
249 (JSC::JSStaticScopeObject::~JSStaticScopeObject):
250 * kjs/JSStaticScopeObject.h:
251 (JSC::JSStaticScopeObject::JSStaticScopeObject):
252 (JSC::JSStaticScopeObject::d):
254 Updated variable object to use the new interfaces required by the
255 change to JSActivation above:
256 * kjs/JSVariableObject.cpp:
257 (JSC::JSVariableObject::copyRegisterArray):
258 (JSC::JSVariableObject::setRegisters):
259 * kjs/JSVariableObject.h:
261 Changed the bit twiddling in symbol table not to assume that all indices
262 are negative, since they can be positive now:
264 (JSC::SymbolTableEntry::SymbolTableEntry):
265 (JSC::SymbolTableEntry::isNull):
266 (JSC::SymbolTableEntry::getIndex):
267 (JSC::SymbolTableEntry::getAttributes):
268 (JSC::SymbolTableEntry::setAttributes):
269 (JSC::SymbolTableEntry::isReadOnly):
270 (JSC::SymbolTableEntry::pack):
271 (JSC::SymbolTableEntry::isValidIndex):
273 Changed call and construct nodes to ref their functions and/or bases,
274 so that emitCall/emitConstruct doesn't overwrite them with parameters.
275 Also, updated for rename to registerFor:
277 (JSC::ResolveNode::emitCode):
278 (JSC::NewExprNode::emitCode):
279 (JSC::EvalFunctionCallNode::emitCode):
280 (JSC::FunctionCallValueNode::emitCode):
281 (JSC::FunctionCallResolveNode::emitCode):
282 (JSC::FunctionCallBracketNode::emitCode):
283 (JSC::FunctionCallDotNode::emitCode):
284 (JSC::PostfixResolveNode::emitCode):
285 (JSC::DeleteResolveNode::emitCode):
286 (JSC::TypeOfResolveNode::emitCode):
287 (JSC::PrefixResolveNode::emitCode):
288 (JSC::ReadModifyResolveNode::emitCode):
289 (JSC::AssignResolveNode::emitCode):
290 (JSC::ConstDeclNode::emitCodeSingle):
291 (JSC::ForInNode::emitCode):
293 Added abstraction for getting exception info out of a call through a
295 * masm/X86Assembler.h:
296 (JSC::X86Assembler::emitCall):
298 Removed duplicate #if:
301 2008-09-23 Kevin McCullough <kmccullough@apple.com>
305 Bug 21030: The JS debugger breaks on the do of a do-while not the while
306 (where the conditional statement is)
307 https://bugs.webkit.org/show_bug.cgi?id=21030
308 Now the statementListEmitCode detects if a do-while node is being
309 emited and emits the debug hook on the last line instead of the first.
311 This change had no effect on sunspider.
314 (JSC::statementListEmitCode):
316 (JSC::StatementNode::isDoWhile):
317 (JSC::DoWhileNode::isDoWhile):
319 2008-09-23 Maciej Stachowiak <mjs@apple.com>
321 Reviewed by Camron Zwarich.
323 - inline the fast case of instanceof
324 https://bugs.webkit.org/show_bug.cgi?id=20818
326 ~2% speedup on EarleyBoyer test.
329 (JSC::CTI::privateCompileMainPass):
330 (JSC::CTI::privateCompileSlowCases):
332 (JSC::Machine::cti_op_instanceof):
334 2008-09-23 Maciej Stachowiak <mjs@apple.com>
336 Reviewed by Cameron Zwarich.
338 - add forgotten slow case logic for !==
341 (JSC::CTI::privateCompileSlowCases):
343 2008-09-23 Maciej Stachowiak <mjs@apple.com>
345 Reviewed by Cameron Zwarich.
347 - inline the fast cases of !==, same as for ===
349 2.9% speedup on EarleyBoyer benchmark
352 (JSC::CTI::compileOpStrictEq): Factored stricteq codegen into this function,
353 and parameterized so it can do the reverse version as well.
354 (JSC::CTI::privateCompileMainPass): Use the above for stricteq and nstricteq.
356 (JSC::CTI::): Declare above stuff.
358 (JSC::Machine::cti_op_nstricteq): Removed fast cases, now handled inline.
360 2008-09-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
362 Reviewed by Oliver Hunt.
364 Bug 20989: Aguments constructor should put 'callee' and 'length' properties in a more efficient way
365 <https://bugs.webkit.org/show_bug.cgi?id=20989>
367 Make special cases for the 'callee' and 'length' properties in the
370 This is somewhere between a 7.8% speedup and a 10% speedup on the V8
371 Raytrace benchmark, depending on whether it is run alone or with the
375 (JSC::ArgumentsData::ArgumentsData):
376 (JSC::Arguments::Arguments):
377 (JSC::Arguments::mark):
378 (JSC::Arguments::getOwnPropertySlot):
379 (JSC::Arguments::put):
380 (JSC::Arguments::deleteProperty):
382 2008-09-23 Maciej Stachowiak <mjs@apple.com>
386 - speed up instanceof some more
387 https://bugs.webkit.org/show_bug.cgi?id=20818
389 ~2% speedup on EarleyBoyer
391 The idea here is to record in the StructureID whether the class
392 needs a special hasInstance or if it can use the normal logic from
395 Based on this I inlined the real work directly into
396 cti_op_instanceof and put the fastest checks up front and the
397 error handling at the end (so it should be fairly straightforward
398 to split off the beginning to be inlined if desired).
400 I only did this for CTI, not the bytecode interpreter.
402 * API/JSCallbackObject.h:
403 (JSC::JSCallbackObject::createStructureID):
406 (JSC::Machine::cti_op_instanceof):
408 (JSC::JSImmediate::isAnyImmediate):
410 (JSC::TypeInfo::overridesHasInstance):
411 (JSC::TypeInfo::flags):
413 2008-09-22 Darin Adler <darin@apple.com>
415 Reviewed by Sam Weinig.
417 - https://bugs.webkit.org/show_bug.cgi?id=21019
418 make FunctionBodyNode::ref/deref fast
420 Speeds up v8-raytrace by 7.2%.
423 (JSC::FunctionBodyNode::FunctionBodyNode): Initialize m_refCount to 0.
425 (JSC::FunctionBodyNode::ref): Call base class ref once, and thereafter use
427 (JSC::FunctionBodyNode::deref): Ditto, but the deref side.
429 2008-09-22 Darin Adler <darin@apple.com>
431 Pointed out by Sam Weinig.
434 (JSC::Arguments::fillArgList): Fix bad copy and paste. Oops!
436 2008-09-22 Darin Adler <darin@apple.com>
438 Reviewed by Cameron Zwarich.
440 - https://bugs.webkit.org/show_bug.cgi?id=20983
441 ArgumentsData should have some room to allocate some extra arguments inline
443 Speeds up v8-raytrace by 5%.
446 (JSC::ArgumentsData::ArgumentsData): Use a fixed buffer if there are 4 or fewer
448 (JSC::Arguments::Arguments): Use a fixed buffer if there are 4 or fewer
450 (JSC::Arguments::~Arguments): Delete the buffer if necessary.
451 (JSC::Arguments::mark): Update since extraArguments are now Register.
452 (JSC::Arguments::fillArgList): Added special case for the only case that's
453 actually used in the practice, when there are no parameters. There are some
454 other special cases in there too, but that's the only one that matters.
455 (JSC::Arguments::getOwnPropertySlot): Updated to use setValueSlot since there's
456 no operation to get you at the JSValue* inside a Register as a "slot".
458 2008-09-22 Sam Weinig <sam@webkit.org>
460 Reviewed by Maciej Stachowiak.
462 Patch for https://bugs.webkit.org/show_bug.cgi?id=21014
463 Speed up for..in by using StructureID to avoid calls to hasProperty
465 Speeds up fasta by 8%.
467 * VM/JSPropertyNameIterator.cpp:
468 (JSC::JSPropertyNameIterator::invalidate):
469 * VM/JSPropertyNameIterator.h:
470 (JSC::JSPropertyNameIterator::next):
471 * kjs/PropertyNameArray.h:
472 (JSC::PropertyNameArrayData::begin):
473 (JSC::PropertyNameArrayData::end):
474 (JSC::PropertyNameArrayData::setCachedStructureID):
475 (JSC::PropertyNameArrayData::cachedStructureID):
476 * kjs/StructureID.cpp:
477 (JSC::StructureID::getEnumerablePropertyNames):
478 (JSC::structureIDChainsAreEqual):
481 2008-09-22 Kelvin Sherlock <ksherlock@gmail.com>
483 Updated and tweaked by Sam Weinig.
485 Reviewed by Geoffrey Garen.
487 Bug 20020: Proposed enhancement to JavaScriptCore API
488 <https://bugs.webkit.org/show_bug.cgi?id=20020>
490 Add JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError, and JSObjectMakeRegExp
491 functions to create JavaScript Array, Date, Error, and RegExp objects, respectively.
493 * API/JSObjectRef.cpp: The functions
494 * API/JSObjectRef.h: Function prototype and documentation
495 * JavaScriptCore.exp: Added functions to exported function list
496 * API/tests/testapi.c: Added basic functionality tests.
498 * kjs/DateConstructor.cpp:
499 Replaced static JSObject* constructDate(ExecState* exec, JSObject*, const ArgList& args)
500 with JSObject* constructDate(ExecState* exec, const ArgList& args).
501 Added static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) function
503 * kjs/DateConstructor.h:
504 added prototype for JSObject* constructDate(ExecState* exec, const ArgList& args)
506 * kjs/ErrorConstructor.cpp:
507 removed static qualifier from ErrorInstance* constructError(ExecState* exec, const ArgList& args)
509 * kjs/ErrorConstructor.h:
510 added prototype for ErrorInstance* constructError(ExecState* exec, const ArgList& args)
512 * kjs/RegExpConstructor.cpp:
513 removed static qualifier from JSObject* constructRegExp(ExecState* exec, const ArgList& args)
515 * kjs/RegExpConstructor.h:
516 added prototype for JSObject* constructRegExp(ExecState* exec, const ArgList& args)
518 2008-09-22 Matt Lilek <webkit@mattlilek.com>
520 Not reviewed, Windows build fix.
523 * kjs/FunctionPrototype.cpp:
525 2008-09-22 Sam Weinig <sam@webkit.org>
527 Reviewed by Darin Adler.
529 Patch for https://bugs.webkit.org/show_bug.cgi?id=20982
530 Speed up the apply method of functions by special-casing array and 'arguments' objects
532 1% speedup on v8-raytrace.
534 Test: fast/js/function-apply.html
537 (JSC::Arguments::fillArgList):
539 * kjs/FunctionPrototype.cpp:
540 (JSC::functionProtoFuncApply):
542 (JSC::JSArray::fillArgList):
545 2008-09-22 Darin Adler <darin@apple.com>
547 Reviewed by Sam Weinig.
549 - https://bugs.webkit.org/show_bug.cgi?id=20993
550 Array.push/pop need optimized cases for JSArray
552 3% or so speedup on DeltaBlue benchmark.
554 * kjs/ArrayPrototype.cpp:
555 (JSC::arrayProtoFuncPop): Call JSArray::pop when appropriate.
556 (JSC::arrayProtoFuncPush): Call JSArray::push when appropriate.
559 (JSC::JSArray::putSlowCase): Set m_fastAccessCutoff when appropriate, getting
560 us into the fast code path.
561 (JSC::JSArray::pop): Added.
562 (JSC::JSArray::push): Added.
563 * kjs/JSArray.h: Added push and pop.
565 * kjs/operations.cpp:
566 (JSC::throwOutOfMemoryError): Don't inline this. Helps us avoid PIC branches.
568 2008-09-22 Maciej Stachowiak <mjs@apple.com>
570 Reviewed by Cameron Zwarich.
572 - speed up instanceof operator by replacing implementsHasInstance method with a TypeInfo flag
574 Partial work towards <https://bugs.webkit.org/show_bug.cgi?id=20818>
576 2.2% speedup on EarleyBoyer benchmark.
578 * API/JSCallbackConstructor.cpp:
579 * API/JSCallbackConstructor.h:
580 (JSC::JSCallbackConstructor::createStructureID):
581 * API/JSCallbackFunction.cpp:
582 * API/JSCallbackFunction.h:
583 (JSC::JSCallbackFunction::createStructureID):
584 * API/JSCallbackObject.h:
585 (JSC::JSCallbackObject::createStructureID):
586 * API/JSCallbackObjectFunctions.h:
587 (JSC::::hasInstance):
588 * API/JSValueRef.cpp:
589 (JSValueIsInstanceOfConstructor):
590 * JavaScriptCore.exp:
592 (JSC::Machine::privateExecute):
593 (JSC::Machine::cti_op_instanceof):
594 * kjs/InternalFunction.cpp:
595 * kjs/InternalFunction.h:
596 (JSC::InternalFunction::createStructureID):
600 (JSC::TypeInfo::implementsHasInstance):
602 2008-09-22 Maciej Stachowiak <mjs@apple.com>
604 Reviewed by Dave Hyatt.
606 Based on initial work by Darin Adler.
608 - replace masqueradesAsUndefined virtual method with a flag in TypeInfo
609 - use this to JIT inline code for eq_null and neq_null
610 https://bugs.webkit.org/show_bug.cgi?id=20823
612 0.5% speedup on SunSpider
613 ~4% speedup on Richards benchmark
616 (JSC::CTI::privateCompileMainPass):
618 (JSC::jsTypeStringForValue):
619 (JSC::jsIsObjectType):
620 (JSC::Machine::privateExecute):
621 (JSC::Machine::cti_op_is_undefined):
625 * kjs/StringObjectThatMasqueradesAsUndefined.h:
626 (JSC::StringObjectThatMasqueradesAsUndefined::create):
627 (JSC::StringObjectThatMasqueradesAsUndefined::createStructureID):
629 (JSC::StructureID::mutableTypeInfo):
631 (JSC::TypeInfo::TypeInfo):
632 (JSC::TypeInfo::masqueradesAsUndefined):
633 * kjs/operations.cpp:
635 * masm/X86Assembler.h:
636 (JSC::X86Assembler::):
637 (JSC::X86Assembler::setne_r):
638 (JSC::X86Assembler::setnz_r):
639 (JSC::X86Assembler::testl_i32m):
641 2008-09-22 Tor Arne Vestbø <tavestbo@trolltech.com>
645 Initialize QCoreApplication in kjs binary/Shell.cpp
647 This allows us to use QCoreApplication::instance() to
648 get the main thread in ThreadingQt.cpp
652 * wtf/ThreadingQt.cpp:
653 (WTF::initializeThreading):
655 2008-09-21 Darin Adler <darin@apple.com>
657 - blind attempt to fix non-all-in-one builds
659 * kjs/JSGlobalObject.cpp: Added includes of Arguments.h and RegExpObject.h.
661 2008-09-21 Darin Adler <darin@apple.com>
665 * kjs/StructureID.cpp:
666 (JSC::StructureID::addPropertyTransition): Use typeInfo().type() instead of m_type.
667 (JSC::StructureID::createCachedPrototypeChain): Ditto.
669 2008-09-21 Maciej Stachowiak <mjs@apple.com>
671 Reviewed by Darin Adler.
673 - introduce a TypeInfo class, for holding per-type (in the C++ class sense) date in StructureID
674 https://bugs.webkit.org/show_bug.cgi?id=20981
676 * JavaScriptCore.exp:
677 * JavaScriptCore.xcodeproj/project.pbxproj:
679 (JSC::CTI::privateCompileMainPass):
680 (JSC::CTI::privateCompilePutByIdTransition):
682 (JSC::jsIsObjectType):
683 (JSC::Machine::Machine):
684 * kjs/AllInOneFile.cpp:
686 (JSC::JSCell::isObject):
687 (JSC::JSCell::isString):
688 * kjs/JSGlobalData.cpp:
689 (JSC::JSGlobalData::JSGlobalData):
690 * kjs/JSGlobalObject.cpp:
691 (JSC::JSGlobalObject::reset):
692 * kjs/JSGlobalObject.h:
693 (JSC::StructureID::prototypeForLookup):
694 * kjs/JSNumberCell.h:
695 (JSC::JSNumberCell::createStructureID):
697 (JSC::JSObject::createInheritorID):
699 (JSC::JSObject::createStructureID):
701 (JSC::JSString::createStructureID):
702 * kjs/NativeErrorConstructor.cpp:
703 (JSC::NativeErrorConstructor::NativeErrorConstructor):
704 * kjs/RegExpConstructor.cpp:
705 * kjs/RegExpMatchesArray.h: Added.
706 (JSC::RegExpMatchesArray::getOwnPropertySlot):
707 (JSC::RegExpMatchesArray::put):
708 (JSC::RegExpMatchesArray::deleteProperty):
709 (JSC::RegExpMatchesArray::getPropertyNames):
710 * kjs/StructureID.cpp:
711 (JSC::StructureID::StructureID):
712 (JSC::StructureID::addPropertyTransition):
713 (JSC::StructureID::toDictionaryTransition):
714 (JSC::StructureID::changePrototypeTransition):
715 (JSC::StructureID::getterSetterTransition):
717 (JSC::StructureID::create):
718 (JSC::StructureID::typeInfo):
719 * kjs/TypeInfo.h: Added.
720 (JSC::TypeInfo::TypeInfo):
721 (JSC::TypeInfo::type):
723 2008-09-21 Darin Adler <darin@apple.com>
725 Reviewed by Cameron Zwarich.
727 - fix crash logging into Gmail due to recent Arguments change
730 (JSC::Arguments::Arguments): Fix window where mark() function could
731 see d->extraArguments with uninitialized contents.
732 (JSC::Arguments::mark): Check d->extraArguments for 0 to handle two
733 cases: 1) Inside the constructor before it's initialized.
734 2) numArguments <= numParameters.
736 2008-09-21 Darin Adler <darin@apple.com>
738 - fix loose end from the "duplicate constant values" patch
740 * VM/CodeGenerator.cpp:
741 (JSC::CodeGenerator::emitLoad): Add a special case for values the
742 hash table can't handle.
744 2008-09-21 Mark Rowe <mrowe@apple.com>
746 Fix the non-AllInOneFile build.
748 * kjs/Arguments.cpp: Add missing #include.
750 2008-09-21 Darin Adler <darin@apple.com>
752 Reviewed by Cameron Zwarich and Mark Rowe.
754 - fix test failure caused by my recent IndexToNameMap patch
757 (JSC::Arguments::deleteProperty): Added the accidentally-omitted
758 check of the boolean result from toArrayIndex.
760 2008-09-21 Darin Adler <darin@apple.com>
762 Reviewed by Maciej Stachowiak.
764 - https://bugs.webkit.org/show_bug.cgi?id=20975
765 inline immediate-number case of ==
767 * VM/CTI.h: Renamed emitJumpSlowCaseIfNotImm to
768 emitJumpSlowCaseIfNotImmNum, since the old name was incorrect.
770 * VM/CTI.cpp: Updated for new name.
771 (JSC::CTI::privateCompileMainPass): Added op_eq.
772 (JSC::CTI::privateCompileSlowCases): Added op_eq.
775 (JSC::Machine::cti_op_eq): Removed fast case, since it's now
778 2008-09-21 Peter Gal <galpter@inf.u-szeged.hu>
780 Reviewed by Tim Hatcher and Eric Seidel.
782 Fix the QT/Linux JavaScriptCore segmentation fault.
783 https://bugs.webkit.org/show_bug.cgi?id=20914
785 * wtf/ThreadingQt.cpp:
786 (WTF::initializeThreading): Use currentThread() if
787 platform is not a MAC (like in pre 36541 revisions)
789 2008-09-21 Darin Adler <darin@apple.com>
791 Reviewed by Sam Weinig.
793 * kjs/debugger.h: Removed some unneeded includes and declarations.
795 2008-09-21 Darin Adler <darin@apple.com>
797 Reviewed by Sam Weinig.
799 - https://bugs.webkit.org/show_bug.cgi?id=20972
800 speed up Arguments further by eliminating the IndexToNameMap
802 No change on SunSpider. 1.29x as fast on V8 Raytrace.
804 * kjs/Arguments.cpp: Moved ArgumentsData in here. Eliminated the
805 indexToNameMap and hadDeletes data members. Changed extraArguments into
806 an OwnArrayPtr and added deletedArguments, another OwnArrayPtr.
807 Replaced numExtraArguments with numParameters, since that's what's
808 used more directly in hot code paths.
809 (JSC::Arguments::Arguments): Pass in argument count instead of ArgList.
810 Initialize ArgumentsData the new way.
811 (JSC::Arguments::mark): Updated.
812 (JSC::Arguments::getOwnPropertySlot): Overload for the integer form so
813 we don't have to convert integers to identifiers just to get an argument.
814 Integrated the deleted case with the fast case.
815 (JSC::Arguments::put): Ditto.
816 (JSC::Arguments::deleteProperty): Ditto.
818 * kjs/Arguments.h: Minimized includes. Made everything private. Added
819 overloads for the integral property name case. Eliminated mappedIndexSetter.
820 Moved ArgumentsData into the .cpp file.
822 * kjs/IndexToNameMap.cpp: Emptied out and prepared for deletion.
823 * kjs/IndexToNameMap.h: Ditto.
825 * kjs/JSActivation.cpp:
826 (JSC::JSActivation::createArgumentsObject): Elminated ArgList.
829 * JavaScriptCore.pri:
830 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
831 * JavaScriptCore.xcodeproj/project.pbxproj:
832 * JavaScriptCoreSources.bkl:
833 * kjs/AllInOneFile.cpp:
834 Removed IndexToNameMap.
836 2008-09-21 Darin Adler <darin@apple.com>
838 * VM/CodeGenerator.cpp:
839 (JSC::CodeGenerator::emitLoad): One more tweak: Wrote this in a slightly
842 2008-09-21 Judit Jasz <jasy@inf.u-szeged.hu>
844 Reviewed and tweaked by Darin Adler.
846 - https://bugs.webkit.org/show_bug.cgi?id=20645
847 Elminate duplicate constant values in CodeBlocks.
849 Seems to be a wash on SunSpider.
851 * VM/CodeGenerator.cpp:
852 (JSC::CodeGenerator::emitLoad): Use m_numberMap and m_stringMap to guarantee
853 we emit the same JSValue* for identical numbers and strings.
854 * VM/CodeGenerator.h: Added overload of emitLoad for const Identifier&.
855 Add NumberMap and IdentifierStringMap types and m_numberMap and m_stringMap.
857 (JSC::StringNode::emitCode): Call the new emitLoad and let it do the
860 2008-09-21 Paul Pedriana <webkit@pedriana.com>
862 Reviewed and tweaked by Darin Adler.
864 - https://bugs.webkit.org/show_bug.cgi?id=16925
865 Fixed lack of Vector buffer alignment for both GCC and MSVC.
866 Since there's no portable way to do this, for now we don't support
869 * wtf/Vector.h: Added WTF_ALIGH_ON, WTF_ALIGNED, AlignedBufferChar, and AlignedBuffer.
870 Use AlignedBuffer insteadof an array of char in VectorBuffer.
872 2008-09-21 Gabor Loki <loki@inf.u-szeged.hu>
874 Reviewed by Darin Adler.
876 - https://bugs.webkit.org/show_bug.cgi?id=19408
877 Add lightweight constant folding to the parser for *, /, + (only for numbers), <<, >>, ~ operators.
879 1.008x as fast on SunSpider.
882 (makeNegateNode): Fold if expression is a number > 0.
883 (makeBitwiseNotNode): Fold if expression is a number.
884 (makeMultNode): Fold if expressions are both numbers.
885 (makeDivNode): Fold if expressions are both numbers.
886 (makeAddNode): Fold if expressions are both numbers.
887 (makeLeftShiftNode): Fold if expressions are both numbers.
888 (makeRightShiftNode): Fold if expressions are both numbers.
890 2008-09-21 Maciej Stachowiak <mjs@apple.com>
894 - speed up === operator by generating inline machine code for the fast paths
895 https://bugs.webkit.org/show_bug.cgi?id=20820
898 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumber):
899 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumbers):
900 (JSC::CTI::emitJumpSlowCaseIfNotImmediates):
901 (JSC::CTI::emitTagAsBoolImmediate):
902 (JSC::CTI::privateCompileMainPass):
903 (JSC::CTI::privateCompileSlowCases):
906 (JSC::Machine::cti_op_stricteq):
907 * masm/X86Assembler.h:
908 (JSC::X86Assembler::):
909 (JSC::X86Assembler::sete_r):
910 (JSC::X86Assembler::setz_r):
911 (JSC::X86Assembler::movzbl_rr):
912 (JSC::X86Assembler::emitUnlinkedJnz):
914 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
916 Reviewed by Maciej Stachowiak.
918 Free memory allocated for extra arguments in the destructor of the
922 (JSC::Arguments::~Arguments):
925 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
927 Reviewed by Maciej Stachowiak.
929 Bug 20815: 'arguments' object creation is non-optimal
930 <https://bugs.webkit.org/show_bug.cgi?id=20815>
932 Fix our inefficient way of creating the arguments object by only
933 creating named properties for each of the arguments after a use of the
934 'delete' statement. This patch also speeds up access to the 'arguments'
935 object slightly, but it still does not use the array fast path for
936 indexed access that exists for many opcodes.
938 This is about a 20% improvement on the V8 Raytrace benchmark, and a 1.5%
939 improvement on the Earley-Boyer benchmark, which gives a 4% improvement
943 (JSC::Arguments::Arguments):
944 (JSC::Arguments::mark):
945 (JSC::Arguments::getOwnPropertySlot):
946 (JSC::Arguments::put):
947 (JSC::Arguments::deleteProperty):
949 (JSC::Arguments::ArgumentsData::ArgumentsData):
950 * kjs/IndexToNameMap.h:
951 (JSC::IndexToNameMap::size):
952 * kjs/JSActivation.cpp:
953 (JSC::JSActivation::createArgumentsObject):
954 * kjs/JSActivation.h:
955 (JSC::JSActivation::uncheckedSymbolTableGet):
956 (JSC::JSActivation::uncheckedSymbolTableGetValue):
957 (JSC::JSActivation::uncheckedSymbolTablePut):
959 (JSC::JSFunction::numParameters):
961 2008-09-20 Darin Adler <darin@apple.com>
963 Reviewed by Mark Rowe.
965 - fix crash seen on buildbot
967 * kjs/JSGlobalObject.cpp:
968 (JSC::JSGlobalObject::mark): Add back mark of arrayPrototype,
969 deleted by accident in my recent check-in.
971 2008-09-20 Maciej Stachowiak <mjs@apple.com>
973 Not reviewed, build fix.
975 - speculative fix for non-AllInOne builds
979 2008-09-20 Maciej Stachowiak <mjs@apple.com>
981 Reviewed by Darin Adler.
983 - assorted optimizations to === and !== operators
984 (work towards <https://bugs.webkit.org/show_bug.cgi?id=20820>)
986 2.5% speedup on earley-boyer test
989 (JSC::Machine::cti_op_stricteq): Use inline version of
990 strictEqualSlowCase; remove unneeded exception check.
991 (JSC::Machine::cti_op_nstricteq): ditto
992 * kjs/operations.cpp:
993 (JSC::strictEqual): Use strictEqualSlowCaseInline
994 (JSC::strictEqualSlowCase): ditto
996 (JSC::strictEqualSlowCaseInline): Version of strictEqualSlowCase that can be inlined,
997 since the extra function call indirection is a lose for CTI.
999 2008-09-20 Darin Adler <darin@apple.com>
1001 Reviewed by Maciej Stachowiak.
1003 - finish https://bugs.webkit.org/show_bug.cgi?id=20858
1004 make each distinct C++ class get a distinct JSC::Structure
1006 This also includes some optimizations that make the change an overall
1007 small speedup. Without those it was a bit of a slowdown.
1009 * API/JSCallbackConstructor.cpp:
1010 (JSC::JSCallbackConstructor::JSCallbackConstructor): Take a structure.
1011 * API/JSCallbackConstructor.h: Ditto.
1012 * API/JSCallbackFunction.cpp:
1013 (JSC::JSCallbackFunction::JSCallbackFunction): Pass a structure.
1014 * API/JSCallbackObject.h: Take a structure.
1015 * API/JSCallbackObjectFunctions.h:
1016 (JSC::JSCallbackObject::JSCallbackObject): Ditto.
1018 * API/JSClassRef.cpp:
1019 (OpaqueJSClass::prototype): Pass in a structure. Call setPrototype
1020 if there's a custom prototype involved.
1021 * API/JSObjectRef.cpp:
1022 (JSObjectMake): Ditto.
1023 (JSObjectMakeConstructor): Pass in a structure.
1025 * JavaScriptCore.exp: Updated.
1028 (JSC::jsLess): Added a special case for when both arguments are strings.
1029 This avoids converting both strings to with UString::toDouble.
1030 (JSC::jsLessEq): Ditto.
1031 (JSC::Machine::privateExecute): Pass in a structure.
1032 (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
1033 (JSC::Machine::cti_op_new_regexp): Ditto.
1034 (JSC::Machine::cti_op_is_string): Ditto.
1035 * VM/Machine.h: Made isJSString public so it can be used in the CTI.
1037 * kjs/Arguments.cpp:
1038 (JSC::Arguments::Arguments): Pass in a structure.
1040 * kjs/JSCell.h: Mark constructor explicit.
1042 * kjs/JSGlobalObject.cpp:
1043 (JSC::markIfNeeded): Added an overload for marking structures.
1044 (JSC::JSGlobalObject::reset): Eliminate code to set data members to
1045 zero. We now do that in the constructor, and we no longer use this
1046 anywhere except in the constructor. Added code to create structures.
1047 Pass structures rather than prototypes when creating objects.
1048 (JSC::JSGlobalObject::mark): Mark the structures.
1050 * kjs/JSGlobalObject.h: Removed unneeded class declarations.
1051 Added initializers for raw pointers in JSGlobalObjectData so
1052 everything starts with a 0. Added structure data and accessor
1055 * kjs/JSImmediate.cpp:
1056 (JSC::JSImmediate::nonInlineNaN): Added.
1057 * kjs/JSImmediate.h:
1058 (JSC::JSImmediate::toDouble): Rewrote to avoid PIC branches.
1060 * kjs/JSNumberCell.cpp:
1061 (JSC::jsNumberCell): Made non-inline to avoid PIC branches
1062 in functions that call this one.
1063 (JSC::jsNaN): Ditto.
1064 * kjs/JSNumberCell.h: Ditto.
1066 * kjs/JSObject.h: Removed constructor that takes a prototype.
1067 All callers now pass structures.
1069 * kjs/ArrayConstructor.cpp:
1070 (JSC::ArrayConstructor::ArrayConstructor):
1071 (JSC::constructArrayWithSizeQuirk):
1072 * kjs/ArrayConstructor.h:
1073 * kjs/ArrayPrototype.cpp:
1074 (JSC::ArrayPrototype::ArrayPrototype):
1075 * kjs/ArrayPrototype.h:
1076 * kjs/BooleanConstructor.cpp:
1077 (JSC::BooleanConstructor::BooleanConstructor):
1078 (JSC::constructBoolean):
1079 (JSC::constructBooleanFromImmediateBoolean):
1080 * kjs/BooleanConstructor.h:
1081 * kjs/BooleanObject.cpp:
1082 (JSC::BooleanObject::BooleanObject):
1083 * kjs/BooleanObject.h:
1084 * kjs/BooleanPrototype.cpp:
1085 (JSC::BooleanPrototype::BooleanPrototype):
1086 * kjs/BooleanPrototype.h:
1087 * kjs/DateConstructor.cpp:
1088 (JSC::DateConstructor::DateConstructor):
1089 (JSC::constructDate):
1090 * kjs/DateConstructor.h:
1091 * kjs/DateInstance.cpp:
1092 (JSC::DateInstance::DateInstance):
1093 * kjs/DateInstance.h:
1094 * kjs/DatePrototype.cpp:
1095 (JSC::DatePrototype::DatePrototype):
1096 * kjs/DatePrototype.h:
1097 * kjs/ErrorConstructor.cpp:
1098 (JSC::ErrorConstructor::ErrorConstructor):
1099 (JSC::constructError):
1100 * kjs/ErrorConstructor.h:
1101 * kjs/ErrorInstance.cpp:
1102 (JSC::ErrorInstance::ErrorInstance):
1103 * kjs/ErrorInstance.h:
1104 * kjs/ErrorPrototype.cpp:
1105 (JSC::ErrorPrototype::ErrorPrototype):
1106 * kjs/ErrorPrototype.h:
1107 * kjs/FunctionConstructor.cpp:
1108 (JSC::FunctionConstructor::FunctionConstructor):
1109 * kjs/FunctionConstructor.h:
1110 * kjs/FunctionPrototype.cpp:
1111 (JSC::FunctionPrototype::FunctionPrototype):
1112 (JSC::FunctionPrototype::addFunctionProperties):
1113 * kjs/FunctionPrototype.h:
1114 * kjs/GlobalEvalFunction.cpp:
1115 (JSC::GlobalEvalFunction::GlobalEvalFunction):
1116 * kjs/GlobalEvalFunction.h:
1117 * kjs/InternalFunction.cpp:
1118 (JSC::InternalFunction::InternalFunction):
1119 * kjs/InternalFunction.h:
1120 (JSC::InternalFunction::InternalFunction):
1122 (JSC::JSArray::JSArray):
1123 (JSC::constructEmptyArray):
1124 (JSC::constructArray):
1126 * kjs/JSFunction.cpp:
1127 (JSC::JSFunction::JSFunction):
1128 (JSC::JSFunction::construct):
1130 (JSC::constructEmptyObject):
1132 (JSC::StringObject::create):
1133 * kjs/JSWrapperObject.h:
1134 * kjs/MathObject.cpp:
1135 (JSC::MathObject::MathObject):
1137 * kjs/NativeErrorConstructor.cpp:
1138 (JSC::NativeErrorConstructor::NativeErrorConstructor):
1139 (JSC::NativeErrorConstructor::construct):
1140 * kjs/NativeErrorConstructor.h:
1141 * kjs/NativeErrorPrototype.cpp:
1142 (JSC::NativeErrorPrototype::NativeErrorPrototype):
1143 * kjs/NativeErrorPrototype.h:
1144 * kjs/NumberConstructor.cpp:
1145 (JSC::NumberConstructor::NumberConstructor):
1146 (JSC::constructWithNumberConstructor):
1147 * kjs/NumberConstructor.h:
1148 * kjs/NumberObject.cpp:
1149 (JSC::NumberObject::NumberObject):
1150 (JSC::constructNumber):
1151 (JSC::constructNumberFromImmediateNumber):
1152 * kjs/NumberObject.h:
1153 * kjs/NumberPrototype.cpp:
1154 (JSC::NumberPrototype::NumberPrototype):
1155 * kjs/NumberPrototype.h:
1156 * kjs/ObjectConstructor.cpp:
1157 (JSC::ObjectConstructor::ObjectConstructor):
1158 (JSC::constructObject):
1159 * kjs/ObjectConstructor.h:
1160 * kjs/ObjectPrototype.cpp:
1161 (JSC::ObjectPrototype::ObjectPrototype):
1162 * kjs/ObjectPrototype.h:
1163 * kjs/PrototypeFunction.cpp:
1164 (JSC::PrototypeFunction::PrototypeFunction):
1165 * kjs/PrototypeFunction.h:
1166 * kjs/RegExpConstructor.cpp:
1167 (JSC::RegExpConstructor::RegExpConstructor):
1168 (JSC::RegExpMatchesArray::RegExpMatchesArray):
1169 (JSC::constructRegExp):
1170 * kjs/RegExpConstructor.h:
1171 * kjs/RegExpObject.cpp:
1172 (JSC::RegExpObject::RegExpObject):
1173 * kjs/RegExpObject.h:
1174 * kjs/RegExpPrototype.cpp:
1175 (JSC::RegExpPrototype::RegExpPrototype):
1176 * kjs/RegExpPrototype.h:
1178 (GlobalObject::GlobalObject):
1179 * kjs/StringConstructor.cpp:
1180 (JSC::StringConstructor::StringConstructor):
1181 (JSC::constructWithStringConstructor):
1182 * kjs/StringConstructor.h:
1183 * kjs/StringObject.cpp:
1184 (JSC::StringObject::StringObject):
1185 * kjs/StringObject.h:
1186 * kjs/StringObjectThatMasqueradesAsUndefined.h:
1187 (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
1188 * kjs/StringPrototype.cpp:
1189 (JSC::StringPrototype::StringPrototype):
1190 * kjs/StringPrototype.h:
1191 Take and pass structures.
1193 2008-09-19 Alp Toker <alp@nuanti.com>
1195 Build fix for the 'gold' linker and recent binutils. New behaviour
1196 requires that we link to used libraries explicitly.
1200 2008-09-19 Sam Weinig <sam@webkit.org>
1202 Roll r36694 back in. It did not cause the crash.
1204 * JavaScriptCore.exp:
1205 * VM/JSPropertyNameIterator.cpp:
1206 (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
1207 (JSC::JSPropertyNameIterator::invalidate):
1208 * VM/JSPropertyNameIterator.h:
1209 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
1210 (JSC::JSPropertyNameIterator::create):
1212 (JSC::JSObject::getPropertyNames):
1213 * kjs/PropertyMap.cpp:
1214 (JSC::PropertyMap::getEnumerablePropertyNames):
1215 * kjs/PropertyMap.h:
1216 * kjs/PropertyNameArray.cpp:
1217 (JSC::PropertyNameArray::add):
1218 * kjs/PropertyNameArray.h:
1219 (JSC::PropertyNameArrayData::create):
1220 (JSC::PropertyNameArrayData::propertyNameVector):
1221 (JSC::PropertyNameArrayData::setCachedPrototypeChain):
1222 (JSC::PropertyNameArrayData::cachedPrototypeChain):
1223 (JSC::PropertyNameArrayData::begin):
1224 (JSC::PropertyNameArrayData::end):
1225 (JSC::PropertyNameArrayData::PropertyNameArrayData):
1226 (JSC::PropertyNameArray::PropertyNameArray):
1227 (JSC::PropertyNameArray::addKnownUnique):
1228 (JSC::PropertyNameArray::size):
1229 (JSC::PropertyNameArray::operator[]):
1230 (JSC::PropertyNameArray::begin):
1231 (JSC::PropertyNameArray::end):
1232 (JSC::PropertyNameArray::setData):
1233 (JSC::PropertyNameArray::data):
1234 (JSC::PropertyNameArray::releaseData):
1235 * kjs/StructureID.cpp:
1236 (JSC::structureIDChainsAreEqual):
1237 (JSC::StructureID::getEnumerablePropertyNames):
1238 (JSC::StructureID::clearEnumerationCache):
1239 (JSC::StructureID::createCachedPrototypeChain):
1240 * kjs/StructureID.h:
1242 2008-09-19 Sam Weinig <sam@webkit.org>
1246 * JavaScriptCore.exp:
1247 * VM/JSPropertyNameIterator.cpp:
1248 (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
1249 (JSC::JSPropertyNameIterator::invalidate):
1250 * VM/JSPropertyNameIterator.h:
1251 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
1252 (JSC::JSPropertyNameIterator::create):
1254 (JSC::JSObject::getPropertyNames):
1255 * kjs/PropertyMap.cpp:
1256 (JSC::PropertyMap::getEnumerablePropertyNames):
1257 * kjs/PropertyMap.h:
1258 * kjs/PropertyNameArray.cpp:
1259 (JSC::PropertyNameArray::add):
1260 * kjs/PropertyNameArray.h:
1261 (JSC::PropertyNameArray::PropertyNameArray):
1262 (JSC::PropertyNameArray::addKnownUnique):
1263 (JSC::PropertyNameArray::begin):
1264 (JSC::PropertyNameArray::end):
1265 (JSC::PropertyNameArray::size):
1266 (JSC::PropertyNameArray::operator[]):
1267 (JSC::PropertyNameArray::releaseIdentifiers):
1268 * kjs/StructureID.cpp:
1269 (JSC::StructureID::getEnumerablePropertyNames):
1270 * kjs/StructureID.h:
1271 (JSC::StructureID::clearEnumerationCache):
1273 2008-09-19 Oliver Hunt <oliver@apple.com>
1275 Reviewed by Maciej Stachowiak.
1277 Improve peformance of local variable initialisation.
1279 Pull local and constant initialisation out of slideRegisterWindowForCall
1280 and into its own opcode. This allows the JIT to generate the initialisation
1281 code for a function directly into the instruction stream and so avoids a few
1282 branches on function entry.
1284 Results a 1% progression in SunSpider, particularly in a number of the bitop
1285 tests where the called functions are very fast.
1288 (JSC::CTI::emitInitialiseRegister):
1289 (JSC::CTI::privateCompileMainPass):
1292 (JSC::CodeBlock::dump):
1293 * VM/CodeGenerator.cpp:
1294 (JSC::CodeGenerator::CodeGenerator):
1296 (JSC::slideRegisterWindowForCall):
1297 (JSC::Machine::privateExecute):
1300 2008-09-19 Sam Weinig <sam@webkit.org>
1302 Reviewed by Darin Adler.
1304 Patch for https://bugs.webkit.org/show_bug.cgi?id=20928
1305 Speed up JS property enumeration by caching entire PropertyNameArray
1307 1.3% speedup on Sunspider, 30% on string-fasta.
1309 * JavaScriptCore.exp:
1310 * VM/JSPropertyNameIterator.cpp:
1311 (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
1312 (JSC::JSPropertyNameIterator::invalidate):
1313 * VM/JSPropertyNameIterator.h:
1314 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
1315 (JSC::JSPropertyNameIterator::create):
1317 (JSC::JSObject::getPropertyNames):
1318 * kjs/PropertyMap.cpp:
1319 (JSC::PropertyMap::getEnumerablePropertyNames):
1320 * kjs/PropertyMap.h:
1321 * kjs/PropertyNameArray.cpp:
1322 (JSC::PropertyNameArray::add):
1323 * kjs/PropertyNameArray.h:
1324 (JSC::PropertyNameArrayData::create):
1325 (JSC::PropertyNameArrayData::propertyNameVector):
1326 (JSC::PropertyNameArrayData::setCachedPrototypeChain):
1327 (JSC::PropertyNameArrayData::cachedPrototypeChain):
1328 (JSC::PropertyNameArrayData::begin):
1329 (JSC::PropertyNameArrayData::end):
1330 (JSC::PropertyNameArrayData::PropertyNameArrayData):
1331 (JSC::PropertyNameArray::PropertyNameArray):
1332 (JSC::PropertyNameArray::addKnownUnique):
1333 (JSC::PropertyNameArray::size):
1334 (JSC::PropertyNameArray::operator[]):
1335 (JSC::PropertyNameArray::begin):
1336 (JSC::PropertyNameArray::end):
1337 (JSC::PropertyNameArray::setData):
1338 (JSC::PropertyNameArray::data):
1339 (JSC::PropertyNameArray::releaseData):
1340 * kjs/ScopeChain.cpp:
1341 (JSC::ScopeChainNode::print):
1342 * kjs/StructureID.cpp:
1343 (JSC::structureIDChainsAreEqual):
1344 (JSC::StructureID::getEnumerablePropertyNames):
1345 (JSC::StructureID::clearEnumerationCache):
1346 (JSC::StructureID::createCachedPrototypeChain):
1347 * kjs/StructureID.h:
1349 2008-09-19 Holger Hans Peter Freyther <zecke@selfish.org>
1351 Reviewed by Maciej Stachowiak.
1353 Fix a mismatched new[]/delete in JSObject::allocatePropertyStorage
1356 (JSC::JSObject::allocatePropertyStorage): Spotted by valgrind.
1358 2008-09-19 Darin Adler <darin@apple.com>
1360 Reviewed by Sam Weinig.
1362 - part 2 of https://bugs.webkit.org/show_bug.cgi?id=20858
1363 make each distinct C++ class get a distinct JSC::Structure
1365 * JavaScriptCore.exp: Exported constructEmptyObject for use in WebCore.
1367 * kjs/JSGlobalObject.h: Changed the protected constructor to take a
1368 structure instead of a prototype.
1370 * kjs/JSVariableObject.h: Removed constructor that takes a prototype.
1372 2008-09-19 Julien Chaffraix <jchaffraix@pleyo.com>
1374 Reviewed by Alexey Proskuryakov.
1376 Use the template hoisting technique on the RefCounted class. This reduces the code bloat due to
1377 non-template methods' code been copied for each instance of the template.
1378 The patch splits RefCounted between a base class that holds non-template methods and attributes
1379 and the template RefCounted class that keeps the same functionnality.
1381 On my Linux with gcc 4.3 for the Gtk port, this is:
1382 - a ~600KB save on libwebkit.so in release.
1383 - a ~1.6MB save on libwebkit.so in debug.
1385 It is a wash on Sunspider and a small win on Dromaeo (not sure it is relevant).
1386 On the whole, it should be a small win as we reduce the compiled code size and the only
1387 new function call should be inlined by the compiler.
1390 (WTF::RefCountedBase::ref): Copied from RefCounted.
1391 (WTF::RefCountedBase::hasOneRef): Ditto.
1392 (WTF::RefCountedBase::refCount): Ditto.
1393 (WTF::RefCountedBase::RefCountedBase): Ditto.
1394 (WTF::RefCountedBase::~RefCountedBase): Ditto.
1395 (WTF::RefCountedBase::derefBase): Tweaked from the RefCounted version to remove
1397 (WTF::RefCounted::RefCounted):
1398 (WTF::RefCounted::deref): Small wrapper around RefCountedBase::derefBase().
1399 (WTF::RefCounted::~RefCounted): Keep private destructor.
1401 2008-09-18 Darin Adler <darin@apple.com>
1403 Reviewed by Maciej Stachowiak.
1405 - part 1 of https://bugs.webkit.org/show_bug.cgi?id=20858
1406 make each distinct C++ class get a distinct JSC::Structure
1408 * kjs/lookup.h: Removed things here that were used only in WebCore:
1409 cacheGlobalObject, JSC_DEFINE_PROTOTYPE, JSC_DEFINE_PROTOTYPE_WITH_PROTOTYPE,
1410 and JSC_IMPLEMENT_PROTOTYPE.
1412 2008-09-18 Darin Adler <darin@apple.com>
1414 Reviewed by Maciej Stachowiak.
1416 - https://bugs.webkit.org/show_bug.cgi?id=20927
1417 simplify/streamline the code to turn strings into identifiers while parsing
1419 * kjs/grammar.y: Get rid of string from the union, and use ident for STRING as
1423 (JSC::Lexer::lex): Use makeIdentifier instead of makeUString for String.
1424 * kjs/lexer.h: Remove makeUString.
1426 * kjs/nodes.h: Changed StringNode to hold an Identifier instead of UString.
1428 * VM/CodeGenerator.cpp:
1429 (JSC::keyForCharacterSwitch): Updated since StringNode now holds an Identifier.
1430 (JSC::prepareJumpTableForStringSwitch): Ditto.
1432 (JSC::StringNode::emitCode): Ditto. The comment from here is now in the lexer.
1433 (JSC::processClauseList): Ditto.
1434 * kjs/nodes2string.cpp:
1435 (JSC::StringNode::streamTo): Ditto.
1437 2008-09-18 Sam Weinig <sam@webkit.org>
1442 (JSC::Instruction::Instruction):
1444 2008-09-18 Oliver Hunt <oliver@apple.com>
1446 Reviewed by Maciej Stachowiak.
1448 Bug 20911: REGRESSION(r36480?): Reproducible assertion failure below derefStructureIDs 64-bit JavaScriptCore
1449 <https://bugs.webkit.org/show_bug.cgi?id=20911>
1451 The problem was simply caused by the int constructor for Instruction
1452 failing to initialise the full struct in 64bit builds.
1455 (JSC::Instruction::Instruction):
1457 2008-09-18 Darin Adler <darin@apple.com>
1461 * wtf/RefCountedLeakCounter.cpp: Removed stray "static".
1463 2008-09-18 Darin Adler <darin@apple.com>
1465 Reviewed by Sam Weinig.
1467 * kjs/JSGlobalObject.h: Tiny style guideline tweak.
1469 2008-09-18 Darin Adler <darin@apple.com>
1471 Reviewed by Sam Weinig.
1473 - fix https://bugs.webkit.org/show_bug.cgi?id=20925
1474 LEAK messages appear every time I quit
1476 * JavaScriptCore.exp: Updated, and also added an export
1477 needed for future WebCore use of JSC::StructureID.
1479 * wtf/RefCountedLeakCounter.cpp:
1480 (WTF::RefCountedLeakCounter::suppressMessages): Added.
1481 (WTF::RefCountedLeakCounter::cancelMessageSuppression): Added.
1482 (WTF::RefCountedLeakCounter::RefCountedLeakCounter): Tweaked a bit.
1483 (WTF::RefCountedLeakCounter::~RefCountedLeakCounter): Added code to
1484 log the reason there was no leak checking done.
1485 (WTF::RefCountedLeakCounter::increment): Tweaked a bit.
1486 (WTF::RefCountedLeakCounter::decrement): Ditto.
1488 * wtf/RefCountedLeakCounter.h: Replaced setLogLeakMessages with two
1489 new functions, suppressMessages and cancelMessageSuppression. Also
1490 added m_ prefixes to the data member names.
1492 2008-09-18 Holger Hans Peter Freyther <zecke@selfish.org>
1494 Reviewed by Mark Rowe.
1496 https://bugs.webkit.org/show_bug.cgi?id=20437
1498 Add a proper #define to define which XML Parser implementation to use. Client
1499 code can use #if USE(QXMLSTREAM) to decide if the Qt XML StreamReader
1500 implementation is going to be used.
1504 2008-09-18 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1506 Reviewed by Maciej Stachowiak.
1508 Make a Unicode non-breaking space count as a whitespace character in
1509 PCRE. This change was already made in WREC, and it fixes one of the
1510 Mozilla JS tests. Since it is now fixed in PCRE as well, we can check
1511 in a new set of expected test results.
1513 * pcre/pcre_internal.h:
1515 * tests/mozilla/expected.html:
1517 2008-09-18 Stephanie Lewis <slewis@apple.com>
1519 Reviewed by Mark Rowe and Maciej Stachowiak.
1521 add an option use arch to specify which architecture to run.
1523 * tests/mozilla/jsDriver.pl:
1525 2008-09-17 Oliver Hunt <oliver@apple.com>
1527 Correctly restore argument reference prior to SFX runtime calls.
1529 Reviewed by Steve Falkenburg.
1532 (JSC::CTI::privateCompileSlowCases):
1533 (JSC::CTI::privateCompile):
1535 2008-09-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1537 Reviewed by Maciej Stachowiak.
1539 Bug 20876: REGRESSION (r36417, r36427): fast/js/exception-expression-offset.html fails
1540 <https://bugs.webkit.org/show_bug.cgi?id=20876>
1542 r36417 and r36427 caused an get_by_id opcode to be emitted before the
1543 instanceof and construct opcodes, in order to enable inline caching of
1544 the prototype property. Unfortunately, this regressed some tests dealing
1545 with exceptions thrown by 'instanceof' and the 'new' operator. We fix
1546 these problems by detecting whether an "is not an object" exception is
1547 thrown before op_instanceof or op_construct, and emit the proper
1548 exception in those cases.
1550 * VM/CodeGenerator.cpp:
1551 (JSC::CodeGenerator::emitConstruct):
1552 * VM/CodeGenerator.h:
1553 * VM/ExceptionHelpers.cpp:
1554 (JSC::createInvalidParamError):
1555 (JSC::createNotAConstructorError):
1556 (JSC::createNotAnObjectError):
1557 * VM/ExceptionHelpers.h:
1559 (JSC::Machine::getOpcode):
1560 (JSC::Machine::privateExecute):
1563 (JSC::NewExprNode::emitCode):
1564 (JSC::InstanceOfNode::emitCode):
1566 2008-09-17 Gavin Barraclough <barraclough@apple.com>
1568 Reviewed by Oliver Hunt.
1570 JIT generation cti_op_construct_verify.
1572 Quarter to half percent progression on v8-tests.
1573 Roughly not change on SunSpider (possible minor progression).
1576 (JSC::CTI::privateCompileMainPass):
1580 2008-09-15 Steve Falkenburg <sfalken@apple.com>
1582 Improve timer accuracy for JavaScript Date object on Windows.
1584 Use a combination of ftime and QueryPerformanceCounter.
1585 ftime returns the information we want, but doesn't have sufficient resolution.
1586 QueryPerformanceCounter has high resolution, but is only usable to measure time intervals.
1587 To combine them, we call ftime and QueryPerformanceCounter initially. Later calls will use
1588 QueryPerformanceCounter by itself, adding the delta to the saved ftime. We re-sync to
1589 correct for drift if the low-res and high-res elapsed time between calls differs by more
1590 than twice the low-resolution timer resolution.
1592 QueryPerformanceCounter may be inaccurate due to a problems with:
1593 - some PCI bridge chipsets (http://support.microsoft.com/kb/274323)
1594 - BIOS bugs (http://support.microsoft.com/kb/895980/)
1595 - BIOS/HAL bugs on multiprocessor/multicore systems (http://msdn.microsoft.com/en-us/library/ms644904.aspx)
1597 Reviewed by Darin Adler.
1600 (JSC::highResUpTime):
1601 (JSC::lowResUTCTime):
1602 (JSC::qpcAvailable):
1603 (JSC::getCurrentUTCTimeWithMicroseconds):
1605 2008-09-17 Gavin Barraclough <barraclough@apple.com>
1607 Reviewed by Geoff Garen.
1609 Implement JIT generation of CallFrame initialization, for op_call.
1611 1% sunspider 2.5% v8-tests.
1614 (JSC::CTI::compileOpCall):
1616 (JSC::Machine::cti_op_call_JSFunction):
1617 (JSC::Machine::cti_op_call_NotJSFunction):
1619 2008-09-17 Gavin Barraclough <barraclough@apple.com>
1621 Reviewed by Geoff Garen.
1623 Optimizations for op_call in CTI. Move check for (ctiCode == 0) into JIT code,
1624 move copying of scopeChain for CodeBlocks that needFullScopeChain into head of
1625 functions, instead of checking prior to making the call.
1627 3% on v8-tests (4% on richards, 6% in delta-blue)
1630 (JSC::CTI::compileOpCall):
1631 (JSC::CTI::privateCompileSlowCases):
1632 (JSC::CTI::privateCompile):
1634 (JSC::Machine::execute):
1635 (JSC::Machine::cti_op_call_JSFunction):
1636 (JSC::Machine::cti_vm_compile):
1637 (JSC::Machine::cti_vm_updateScopeChain):
1638 (JSC::Machine::cti_op_construct_JSConstruct):
1641 2008-09-17 Tor Arne Vestbø <tavestbo@trolltech.com>
1643 Fix the QtWebKit/Mac build
1645 * wtf/ThreadingQt.cpp:
1646 (WTF::initializeThreading): use QCoreApplication to get the main thread
1648 2008-09-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1650 Reviewed by Maciej Stachowiak.
1652 Bug 20857: REGRESSION (r36427): ASSERTION FAILED: m_refCount >= 0 in RegisterID::deref()
1653 <https://bugs.webkit.org/show_bug.cgi?id=20857>
1655 Fix a problem stemming from the slightly unsafe behaviour of the
1656 CodeGenerator::finalDestination() method by putting the "func" argument
1657 of the emitConstruct() method in a RefPtr in its caller. Also, add an
1658 assertion guaranteeing that this is always the case.
1660 CodeGenerator::finalDestination() is still incorrect and can cause
1661 problems with a different allocator; see bug 20340 for more details.
1663 * VM/CodeGenerator.cpp:
1664 (JSC::CodeGenerator::emitConstruct):
1666 (JSC::NewExprNode::emitCode):
1668 2008-09-16 Alice Liu <alice.liu@apple.com>
1673 (JSC::CTI::privateCompileMainPass):
1675 2008-09-16 Gavin Barraclough <barraclough@apple.com>
1677 Reviewed by Geoff Garen.
1679 CTI code generation for op_ret. The majority of the work
1680 (updating variables on the stack & on exec) can be performed
1681 directly in generated code.
1683 We still need to check, & to call out to C-code to handle
1684 activation records, profiling, and full scope chains.
1686 +1.5% Sunspider, +5/6% v8 tests.
1689 (JSC::CTI::emitPutCTIParam):
1690 (JSC::CTI::compileOpCall):
1691 (JSC::CTI::privateCompileMainPass):
1694 (JSC::Machine::cti_op_ret_activation):
1695 (JSC::Machine::cti_op_ret_profiler):
1696 (JSC::Machine::cti_op_ret_scopeChain):
1699 2008-09-16 Dimitri Glazkov <dglazkov@chromium.org>
1701 Fix the Windows build.
1703 Add some extra parentheses to stop MSVC from complaining so much.
1706 (JSC::Machine::privateExecute):
1707 (JSC::Machine::cti_op_stricteq):
1708 (JSC::Machine::cti_op_nstricteq):
1709 * kjs/operations.cpp:
1712 2008-09-15 Maciej Stachowiak <mjs@apple.com>
1714 Reviewed by Cameron Zwarich.
1716 - speed up the === and !== operators by choosing the fast cases better
1718 No effect on SunSpider but speeds up the V8 EarlyBoyer benchmark about 4%.
1721 (JSC::Machine::privateExecute):
1722 (JSC::Machine::cti_op_stricteq):
1723 (JSC::Machine::cti_op_nstricteq):
1724 * kjs/JSImmediate.h:
1725 (JSC::JSImmediate::areBothImmediate):
1726 * kjs/operations.cpp:
1728 (JSC::strictEqualSlowCase):
1731 2008-09-15 Oliver Hunt <oliver@apple.com>
1735 Coding style cleanup.
1738 (JSC::Machine::privateExecute):
1740 2008-09-15 Oliver Hunt <oliver@apple.com>
1742 Reviewed by Cameron Zwarich.
1744 Bug 20874: op_resolve does not do any form of caching
1745 <https://bugs.webkit.org/show_bug.cgi?id=20874>
1747 This patch adds an op_resolve_global opcode to handle (and cache)
1748 property lookup we can statically determine must occur on the global
1751 3% progression on sunspider, 3.2x improvement to bitops-bitwise-and, and
1752 10% in math-partial-sums
1755 (JSC::CTI::privateCompileMainPass):
1758 (JSC::CodeBlock::dump):
1759 * VM/CodeGenerator.cpp:
1760 (JSC::CodeGenerator::findScopedProperty):
1761 (JSC::CodeGenerator::emitResolve):
1763 (JSC::resolveGlobal):
1764 (JSC::Machine::privateExecute):
1765 (JSC::Machine::cti_op_resolve_global):
1769 2008-09-15 Sam Weinig <sam@webkit.org>
1771 Roll out r36462. It broke document.all.
1774 (JSC::CTI::privateCompileMainPass):
1775 (JSC::CTI::privateCompileSlowCases):
1778 (JSC::Machine::Machine):
1779 (JSC::Machine::cti_op_eq_null):
1780 (JSC::Machine::cti_op_neq_null):
1782 (JSC::Machine::isJSString):
1784 * kjs/JSWrapperObject.h:
1785 * kjs/StringObject.h:
1786 * kjs/StringObjectThatMasqueradesAsUndefined.h:
1788 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1790 Reviewed by Maciej Stachowiak.
1792 Bug 20863: ASSERTION FAILED: addressOffset < instructions.size() in CodeBlock::getHandlerForVPC
1793 <https://bugs.webkit.org/show_bug.cgi?id=20863>
1795 r36427 changed the number of arguments to op_construct without changing
1796 the argument index for the vPC in the call to initializeCallFrame() in
1797 the CTI case. This caused a JSC test failure. Correcting the argument
1798 index fixes the test failure.
1801 (JSC::Machine::cti_op_construct_JSConstruct):
1803 2008-09-15 Mark Rowe <mrowe@apple.com>
1809 2008-09-15 Geoffrey Garen <ggaren@apple.com>
1811 Reviewed by Maciej Stachowiak.
1813 Fixed a typo in op_get_by_id_chain that caused it to miss every time
1816 Also, a little cleanup.
1819 (JSC::Machine::privateExecute): Set up baseObject before entering the
1820 loop, so we compare against the right values.
1822 2008-09-15 Geoffrey Garen <ggaren@apple.com>
1824 Reviewed by Sam Weinig.
1826 Removed the CalledAsConstructor flag from the call frame header. Now,
1827 we use an explicit opcode at the call site to fix up constructor results.
1829 SunSpider says 0.4% faster.
1831 cti_op_construct_verify is an out-of-line function call for now, but we
1832 can fix that once StructureID holds type information like isObject.
1835 (JSC::CTI::privateCompileMainPass): Codegen for the new opcode.
1838 (JSC::CodeBlock::dump):
1840 * VM/CodeGenerator.cpp: Codegen for the new opcode. Also...
1841 (JSC::CodeGenerator::emitCall): ... don't test for known non-zero value.
1842 (JSC::CodeGenerator::emitConstruct): ... ditto.
1844 * VM/Machine.cpp: No more CalledAsConstructor
1845 (JSC::Machine::privateExecute): Implementation for the new opcode.
1846 (JSC::Machine::cti_op_ret): The speedup: no need to check whether we were
1847 called as a constructor.
1848 (JSC::Machine::cti_op_construct_verify): Implementation for the new opcode.
1851 * VM/Opcode.h: Declare new opcode.
1853 * VM/RegisterFile.h:
1854 (JSC::RegisterFile::): No more CalledAsConstructor
1856 2008-09-15 Gavin Barraclough <barraclough@apple.com>
1858 Reviewed by Geoff Garen.
1860 Inline code generation of eq_null/neq_null for CTI. Uses vptr checking for
1861 StringObjectsThatAreMasqueradingAsBeingUndefined. In the long run, the
1862 masquerading may be handled differently (through the StructureIDs - see bug
1868 (JSC::CTI::emitJumpSlowCaseIfIsJSCell):
1869 (JSC::CTI::privateCompileMainPass):
1870 (JSC::CTI::privateCompileSlowCases):
1873 (JSC::Machine::Machine):
1874 (JSC::Machine::cti_op_eq_null):
1875 (JSC::Machine::cti_op_neq_null):
1877 (JSC::Machine::doesMasqueradesAsUndefined):
1878 * kjs/JSWrapperObject.h:
1879 (JSC::JSWrapperObject::):
1880 (JSC::JSWrapperObject::JSWrapperObject):
1881 * kjs/StringObject.h:
1882 (JSC::StringObject::StringObject):
1883 * kjs/StringObjectThatMasqueradesAsUndefined.h:
1884 (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
1886 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1888 Rubber-stamped by Oliver Hunt.
1890 r36427 broke CodeBlock::dump() by changing the number of arguments to
1891 op_construct without changing the code that prints it. This patch fixes
1892 it by printing the additional argument.
1894 * JavaScriptCore.xcodeproj/project.pbxproj:
1896 (JSC::CodeBlock::dump):
1898 2008-09-15 Adam Roben <aroben@apple.com>
1902 * kjs/StructureID.cpp: Removed a stray semicolon.
1904 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1906 Reviewed by Maciej Stachowiak.
1908 Fix a crash in fast/js/exception-expression-offset.html caused by not
1909 updating all mentions of the length of op_construct in r36427.
1912 (JSC::Machine::cti_op_construct_NotJSConstruct):
1914 2008-09-15 Maciej Stachowiak <mjs@apple.com>
1916 Reviewed by Cameron Zwarich.
1918 - fix layout test failure introduced by fix for 20849
1920 (The failing test was fast/js/delete-then-put.html)
1923 (JSC::JSObject::removeDirect): Clear enumeration cache
1924 in the dictionary case.
1926 (JSC::JSObject::putDirect): Ditto.
1927 * kjs/StructureID.h:
1928 (JSC::StructureID::clearEnumerationCache): Inline to handle the
1931 2008-09-15 Maciej Stachowiak <mjs@apple.com>
1933 Reviewed by Cameron Zwarich.
1935 - fix JSC test failures introduced by fix for 20849
1937 * kjs/PropertyMap.cpp:
1938 (JSC::PropertyMap::getEnumerablePropertyNames): Use the correct count.
1940 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1942 Reviewed by Maciej Stachowiak.
1944 Bug 20851: REGRESSION (r36410): fast/js/kde/GlobalObject.html fails
1945 <https://bugs.webkit.org/show_bug.cgi?id=20851>
1947 r36410 introduced an optimization for parseInt() that is incorrect when
1948 its argument is larger than the range of a 32-bit integer. If the
1949 argument is a number that is not an immediate integer, then the correct
1950 behaviour is to return the floor of its value, unless it is an infinite
1951 value, in which case the correct behaviour is to return 0.
1953 * kjs/JSGlobalObjectFunctions.cpp:
1954 (JSC::globalFuncParseInt):
1956 2008-09-15 Sam Weinig <sam@webkit.org>
1958 Reviewed by Maciej Stachowiak.
1960 Patch for https://bugs.webkit.org/show_bug.cgi?id=20849
1961 Cache property names for getEnumerablePropertyNames in the StructureID.
1963 ~0.5% speedup on Sunspider overall (9.7% speedup on string-fasta). ~1% speedup
1964 on the v8 test suite.
1967 (JSC::JSObject::getPropertyNames):
1968 * kjs/PropertyMap.cpp:
1969 (JSC::PropertyMap::getEnumerablePropertyNames):
1970 * kjs/PropertyMap.h:
1971 * kjs/StructureID.cpp:
1972 (JSC::StructureID::StructureID):
1973 (JSC::StructureID::getEnumerablePropertyNames):
1974 * kjs/StructureID.h:
1976 2008-09-14 Maciej Stachowiak <mjs@apple.com>
1978 Reviewed by Cameron Zwarich.
1980 - speed up JS construction by extracting "prototype" lookup so PIC applies.
1982 ~0.5% speedup on SunSpider
1983 Speeds up some of the V8 tests as well, most notably earley-boyer.
1986 (JSC::CTI::compileOpCall): Account for extra arg for prototype.
1987 (JSC::CTI::privateCompileMainPass): Account for increased size of op_construct.
1988 * VM/CodeGenerator.cpp:
1989 (JSC::CodeGenerator::emitConstruct): Emit separate lookup to get prototype property.
1991 (JSC::Machine::privateExecute): Expect prototype arg in op_construct.
1992 (JSC::Machine::cti_op_construct_JSConstruct): ditto
1993 (JSC::Machine::cti_op_construct_NotJSConstruct): ditto
1995 2008-09-10 Alexey Proskuryakov <ap@webkit.org>
1997 Reviewed by Eric Seidel.
1999 Add a protected destructor for RefCounted.
2001 It is wrong to call its destructor directly, because (1) this should be taken care of by
2002 deref(), and (2) many classes that use RefCounted have non-virtual destructors.
2004 No change in behavior.
2006 * wtf/RefCounted.h: (WTF::RefCounted::~RefCounted):
2008 2008-09-14 Gavin Barraclough <barraclough@apple.com>
2010 Reviewed by Sam Weinig.
2012 Accelerated property accesses.
2014 Inline more of the array access code into the JIT code for get/put_by_val.
2015 Accelerate get/put_by_id by speculatively inlining a disable direct access
2016 into the hot path of the code, and repatch this with the correct StructureID
2017 and property map offset once these are known. In the case of accesses to the
2018 prototype and reading the array-length a trampoline is genertaed, and the
2019 branch to the slow-case is relinked to jump to this.
2021 By repatching, we mean rewriting the x86 instruction stream. Instructions are
2022 only modified in a simple fasion - altering immediate operands, memory access
2023 deisplacements, and branch offsets.
2025 For regular get_by_id/put_by_id accesses to an object, a StructureID in an
2026 instruction's immediate operant is updateded, and a memory access operation's
2027 displacement is updated to access the correct field on the object. In the case
2028 of more complex accesses (array length and get_by_id_prototype) the offset on
2029 the branch to slow-case is updated, to now jump to a trampoline.
2031 +2.8% sunspider, +13% v8-tests
2034 (JSC::CTI::emitCall):
2035 (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
2037 (JSC::CTI::privateCompileMainPass):
2038 (JSC::CTI::privateCompileSlowCases):
2039 (JSC::CTI::privateCompile):
2040 (JSC::CTI::privateCompileGetByIdSelf):
2041 (JSC::CTI::privateCompileGetByIdProto):
2042 (JSC::CTI::privateCompileGetByIdChain):
2043 (JSC::CTI::privateCompilePutByIdReplace):
2044 (JSC::CTI::privateCompilePutByIdTransition):
2045 (JSC::CTI::privateCompileArrayLengthTrampoline):
2046 (JSC::CTI::privateCompileStringLengthTrampoline):
2047 (JSC::CTI::patchGetByIdSelf):
2048 (JSC::CTI::patchPutByIdReplace):
2049 (JSC::CTI::privateCompilePatchGetArrayLength):
2050 (JSC::CTI::privateCompilePatchGetStringLength):
2052 (JSC::CTI::compileGetByIdSelf):
2053 (JSC::CTI::compileGetByIdProto):
2054 (JSC::CTI::compileGetByIdChain):
2055 (JSC::CTI::compilePutByIdReplace):
2056 (JSC::CTI::compilePutByIdTransition):
2057 (JSC::CTI::compileArrayLengthTrampoline):
2058 (JSC::CTI::compileStringLengthTrampoline):
2059 (JSC::CTI::compilePatchGetArrayLength):
2060 (JSC::CTI::compilePatchGetStringLength):
2062 (JSC::CodeBlock::dump):
2063 (JSC::CodeBlock::~CodeBlock):
2065 (JSC::StructureStubInfo::StructureStubInfo):
2066 (JSC::CodeBlock::getStubInfo):
2068 (JSC::Machine::tryCTICachePutByID):
2069 (JSC::Machine::tryCTICacheGetByID):
2070 (JSC::Machine::cti_op_put_by_val_array):
2072 * masm/X86Assembler.h:
2073 (JSC::X86Assembler::):
2074 (JSC::X86Assembler::cmpl_i8m):
2075 (JSC::X86Assembler::emitUnlinkedJa):
2076 (JSC::X86Assembler::getRelocatedAddress):
2077 (JSC::X86Assembler::getDifferenceBetweenLabels):
2078 (JSC::X86Assembler::emitModRm_opmsib):
2080 2008-09-14 Maciej Stachowiak <mjs@apple.com>
2082 Reviewed by Cameron Zwarich.
2084 - split the "prototype" lookup for hasInstance into opcode stream so it can be cached
2086 ~5% speedup on v8 earley-boyer test
2088 * API/JSCallbackObject.h: Add a parameter for the pre-looked-up prototype.
2089 * API/JSCallbackObjectFunctions.h:
2090 (JSC::::hasInstance): Ditto.
2091 * API/JSValueRef.cpp:
2092 (JSValueIsInstanceOfConstructor): Look up and pass in prototype.
2093 * JavaScriptCore.exp:
2095 (JSC::CTI::privateCompileMainPass): Pass along prototype.
2097 (JSC::CodeBlock::dump): Print third arg.
2098 * VM/CodeGenerator.cpp:
2099 (JSC::CodeGenerator::emitInstanceOf): Implement this, now that there
2100 is a third argument.
2101 * VM/CodeGenerator.h:
2103 (JSC::Machine::privateExecute): Pass along the prototype.
2104 (JSC::Machine::cti_op_instanceof): ditto
2106 (JSC::JSObject::hasInstance): Expect to get a pre-looked-up prototype.
2109 (JSC::InstanceOfNode::emitCode): Emit a get_by_id of the prototype
2110 property and pass that register to instanceof.
2113 2008-09-14 Gavin Barraclough <barraclough@apple.com>
2115 Reviewed by Sam Weinig.
2117 Remove unnecessary virtual function call from cti_op_call_JSFunction -
2118 ~5% on richards, ~2.5% on v8-tests, ~0.5% on sunspider.
2121 (JSC::Machine::cti_op_call_JSFunction):
2123 2008-09-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2125 Reviewed by Maciej Stachowiak.
2127 Bug 20827: the 'typeof' operator is slow
2128 <https://bugs.webkit.org/show_bug.cgi?id=20827>
2130 Optimize the 'typeof' operator when its result is compared to a constant
2133 This is a 5.5% speedup on the V8 Earley-Boyer test.
2136 (JSC::CTI::privateCompileMainPass):
2138 (JSC::CodeBlock::dump):
2139 * VM/CodeGenerator.cpp:
2140 (JSC::CodeGenerator::emitEqualityOp):
2141 * VM/CodeGenerator.h:
2143 (JSC::jsIsObjectType):
2144 (JSC::jsIsFunctionType):
2145 (JSC::Machine::privateExecute):
2146 (JSC::Machine::cti_op_is_undefined):
2147 (JSC::Machine::cti_op_is_boolean):
2148 (JSC::Machine::cti_op_is_number):
2149 (JSC::Machine::cti_op_is_string):
2150 (JSC::Machine::cti_op_is_object):
2151 (JSC::Machine::cti_op_is_function):
2155 (JSC::BinaryOpNode::emitCode):
2156 (JSC::EqualNode::emitCode):
2157 (JSC::StrictEqualNode::emitCode):
2160 2008-09-14 Sam Weinig <sam@webkit.org>
2162 Reviewed by Cameron Zwarich.
2164 Patch for https://bugs.webkit.org/show_bug.cgi?id=20844
2165 Speed up parseInt for numbers
2167 Sunspider reports this as 1.029x as fast overall and 1.37x as fast on string-unpack-code.
2168 No change on the v8 suite.
2170 * kjs/JSGlobalObjectFunctions.cpp:
2171 (JSC::globalFuncParseInt): Don't convert numbers to strings just to
2172 convert them back to numbers.
2174 2008-09-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2176 Reviewed by Oliver Hunt.
2178 Bug 20816: op_lesseq should be optimized
2179 <https://bugs.webkit.org/show_bug.cgi?id=20816>
2181 Add a loop_if_lesseq opcode that is similar to the loop_if_less opcode.
2183 This is a 9.4% speedup on the V8 Crypto benchmark.
2186 (JSC::CTI::privateCompileMainPass):
2187 (JSC::CTI::privateCompileSlowCases):
2189 (JSC::CodeBlock::dump):
2190 * VM/CodeGenerator.cpp:
2191 (JSC::CodeGenerator::emitJumpIfTrue):
2193 (JSC::Machine::privateExecute):
2194 (JSC::Machine::cti_op_loop_if_lesseq):
2198 2008-09-14 Sam Weinig <sam@webkit.org>
2200 Reviewed by Cameron Zwarich.
2202 Cleanup Sampling code.
2205 (JSC::CTI::emitCall):
2206 (JSC::CTI::privateCompileMainPass):
2208 (JSC::CTI::execute):
2209 * VM/SamplingTool.cpp:
2211 (JSC::SamplingTool::run):
2212 (JSC::SamplingTool::dump):
2213 * VM/SamplingTool.h:
2214 (JSC::SamplingTool::callingHostFunction):
2216 2008-09-13 Oliver Hunt <oliver@apple.com>
2218 Reviewed by Cameron Zwarich.
2220 Bug 20821: Cache property transitions to speed up object initialization
2221 https://bugs.webkit.org/show_bug.cgi?id=20821
2223 Implement a transition cache to improve the performance of new properties
2224 being added to objects. This is extremely beneficial in constructors and
2225 shows up as a 34% improvement on access-binary-trees in SunSpider (0.8%
2229 (JSC::CTI::privateCompileMainPass):
2231 (JSC::transitionWillNeedStorageRealloc):
2232 (JSC::CTI::privateCompilePutByIdTransition):
2234 (JSC::CTI::compilePutByIdTransition):
2236 (JSC::printPutByIdOp):
2237 (JSC::CodeBlock::printStructureIDs):
2238 (JSC::CodeBlock::dump):
2239 (JSC::CodeBlock::derefStructureIDs):
2240 (JSC::CodeBlock::refStructureIDs):
2241 * VM/CodeGenerator.cpp:
2242 (JSC::CodeGenerator::emitPutById):
2244 (JSC::cachePrototypeChain):
2245 (JSC::Machine::tryCachePutByID):
2246 (JSC::Machine::tryCacheGetByID):
2247 (JSC::Machine::privateExecute):
2248 (JSC::Machine::tryCTICachePutByID):
2249 (JSC::Machine::tryCTICacheGetByID):
2253 (JSC::JSObject::putDirect):
2254 (JSC::JSObject::transitionTo):
2255 * kjs/PutPropertySlot.h:
2256 (JSC::PutPropertySlot::PutPropertySlot):
2257 (JSC::PutPropertySlot::wasTransition):
2258 (JSC::PutPropertySlot::setWasTransition):
2259 * kjs/StructureID.cpp:
2260 (JSC::StructureID::transitionTo):
2261 (JSC::StructureIDChain::StructureIDChain):
2262 * kjs/StructureID.h:
2263 (JSC::StructureID::previousID):
2264 (JSC::StructureID::setCachedPrototypeChain):
2265 (JSC::StructureID::cachedPrototypeChain):
2266 (JSC::StructureID::propertyMap):
2267 * masm/X86Assembler.h:
2268 (JSC::X86Assembler::addl_i8m):
2269 (JSC::X86Assembler::subl_i8m):
2271 2008-09-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2273 Reviewed by Maciej Stachowiak.
2275 Bug 20819: JSValue::isObject() is slow
2276 <https://bugs.webkit.org/show_bug.cgi?id=20819>
2278 Optimize JSCell::isObject() and JSCell::isString() by making them
2279 non-virtual calls that rely on the StructureID type information.
2281 This is a 0.7% speedup on SunSpider and a 1.0% speedup on the V8
2284 * JavaScriptCore.exp:
2287 (JSC::JSCell::isObject):
2288 (JSC::JSCell::isString):
2293 (JSC::JSString::JSString):
2294 * kjs/StructureID.h:
2295 (JSC::StructureID::type):
2297 2008-09-11 Stephanie Lewis <slewis@apple.com>
2299 Reviewed by Oliver Hunt.
2301 Turn off PGO Optimization on CTI.cpp -> <rdar://problem/6207709>. Fixes
2302 crash on CNN and on Dromaeo.
2303 Fix Missing close tag in vcproj.
2305 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2307 2008-09-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2311 Correct an SVN problem with the last commit and actually add the new
2314 * wrec/CharacterClassConstructor.cpp: Added.
2316 (JSC::getCharacterClassNewline):
2317 (JSC::getCharacterClassDigits):
2318 (JSC::getCharacterClassSpaces):
2319 (JSC::getCharacterClassWordchar):
2320 (JSC::getCharacterClassNondigits):
2321 (JSC::getCharacterClassNonspaces):
2322 (JSC::getCharacterClassNonwordchar):
2323 (JSC::CharacterClassConstructor::addSorted):
2324 (JSC::CharacterClassConstructor::addSortedRange):
2325 (JSC::CharacterClassConstructor::put):
2326 (JSC::CharacterClassConstructor::flush):
2327 (JSC::CharacterClassConstructor::append):
2328 * wrec/CharacterClassConstructor.h: Added.
2329 (JSC::CharacterClassConstructor::CharacterClassConstructor):
2330 (JSC::CharacterClassConstructor::isUpsideDown):
2331 (JSC::CharacterClassConstructor::charClass):
2333 2008-09-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2335 Reviewed by Maciej Stachowiak.
2337 Bug 20788: Split CharacterClassConstructor into its own file
2338 <https://bugs.webkit.org/show_bug.cgi?id=20788>
2340 Split CharacterClassConstructor into its own file and clean up some
2343 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2344 * JavaScriptCore.xcodeproj/project.pbxproj:
2345 * wrec/CharacterClassConstructor.cpp: Added.
2347 (JSC::getCharacterClassNewline):
2348 (JSC::getCharacterClassDigits):
2349 (JSC::getCharacterClassSpaces):
2350 (JSC::getCharacterClassWordchar):
2351 (JSC::getCharacterClassNondigits):
2352 (JSC::getCharacterClassNonspaces):
2353 (JSC::getCharacterClassNonwordchar):
2354 (JSC::CharacterClassConstructor::addSorted):
2355 (JSC::CharacterClassConstructor::addSortedRange):
2356 (JSC::CharacterClassConstructor::put):
2357 (JSC::CharacterClassConstructor::flush):
2358 (JSC::CharacterClassConstructor::append):
2359 * wrec/CharacterClassConstructor.h: Added.
2360 (JSC::CharacterClassConstructor::CharacterClassConstructor):
2361 (JSC::CharacterClassConstructor::isUpsideDown):
2362 (JSC::CharacterClassConstructor::charClass):
2364 (JSC::WRECParser::parseCharacterClass):
2366 2008-09-10 Simon Hausmann <hausmann@webkit.org>
2368 Not reviewed but trivial one-liner for yet unused macro.
2370 Changed PLATFORM(WINCE) to PLATFORM(WIN_CE) as requested by Mark.
2372 (part of https://bugs.webkit.org/show_bug.cgi?id=20746)
2376 2008-09-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2378 Rubber-stamped by Oliver Hunt.
2380 Fix a typo by renaming the overloaded orl_rr that takes an immediate to
2384 (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
2385 * masm/X86Assembler.h:
2386 (JSC::X86Assembler::orl_i32r):
2388 (JSC::WRECGenerator::generatePatternCharacter):
2389 (JSC::WRECGenerator::generateCharacterClassInverted):
2391 2008-09-10 Sam Weinig <sam@webkit.org>
2393 Reviewed by Geoff Garen.
2395 Add inline property storage for JSObject.
2397 1.2% progression on Sunspider. .5% progression on the v8 test suite.
2399 * JavaScriptCore.exp:
2401 (JSC::CTI::privateCompileGetByIdProto):
2402 (JSC::CTI::privateCompileGetByIdChain):
2404 (JSC::JSObject::mark): There is no reason to check storageSize now that
2406 (JSC::JSObject::allocatePropertyStorage): Allocates/reallocates heap storage.
2408 (JSC::JSObject::offsetForLocation): m_propertyStorage is not an OwnArrayPtr
2409 now so there is no reason to .get()
2410 (JSC::JSObject::usingInlineStorage):
2411 (JSC::JSObject::JSObject): Start with m_propertyStorage pointing to the
2413 (JSC::JSObject::~JSObject): Free the heap storage if not using the inline
2415 (JSC::JSObject::putDirect): Switch to the heap storage only when we know
2416 we know that we are about to add a property that will overflow the inline
2418 * kjs/PropertyMap.cpp:
2419 (JSC::PropertyMap::createTable): Don't allocate the propertyStorage, that is
2420 now handled by JSObject.
2421 (JSC::PropertyMap::rehash): PropertyStorage is not a OwnArrayPtr anymore.
2422 * kjs/PropertyMap.h:
2423 (JSC::PropertyMap::storageSize): Rename from markingCount.
2424 * kjs/StructureID.cpp:
2425 (JSC::StructureID::addPropertyTransition): Don't resize the property storage
2426 if we are using inline storage.
2427 * kjs/StructureID.h:
2429 2008-09-10 Oliver Hunt <oliver@apple.com>
2431 Reviewed by Geoff Garen.
2433 Inline immediate number version of op_mul.
2435 Renamed mull_rr to imull_rr as that's what it's
2436 actually doing, and added imull_i32r for the constant
2437 case immediate multiply.
2439 1.1% improvement to SunSpider.
2442 (JSC::CTI::privateCompileMainPass):
2443 (JSC::CTI::privateCompileSlowCases):
2444 * masm/X86Assembler.h:
2445 (JSC::X86Assembler::):
2446 (JSC::X86Assembler::imull_rr):
2447 (JSC::X86Assembler::imull_i32r):
2449 2008-09-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2455 * JavaScriptCore.xcodeproj/project.pbxproj:
2457 2008-09-09 Oliver Hunt <oliver@apple.com>
2459 Reviewed by Maciej Stachowiak.
2461 Add optimised access to known properties on the global object.
2463 Improve cross scope access to the global object by emitting
2464 code to access it directly rather than by walking the scope chain.
2466 This is a 0.8% win in SunSpider and a 1.7% win in the v8 benchmarks.
2469 (JSC::CTI::privateCompileMainPass):
2470 (JSC::CTI::emitGetVariableObjectRegister):
2471 (JSC::CTI::emitPutVariableObjectRegister):
2474 (JSC::CodeBlock::dump):
2475 * VM/CodeGenerator.cpp:
2476 (JSC::CodeGenerator::findScopedProperty):
2477 (JSC::CodeGenerator::emitResolve):
2478 (JSC::CodeGenerator::emitGetScopedVar):
2479 (JSC::CodeGenerator::emitPutScopedVar):
2480 * VM/CodeGenerator.h:
2482 (JSC::Machine::privateExecute):
2485 (JSC::FunctionCallResolveNode::emitCode):
2486 (JSC::PostfixResolveNode::emitCode):
2487 (JSC::PrefixResolveNode::emitCode):
2488 (JSC::ReadModifyResolveNode::emitCode):
2489 (JSC::AssignResolveNode::emitCode):
2491 2008-09-10 Maciej Stachowiak <mjs@apple.com>
2495 - enable polymorphic inline caching of properties of primitives
2497 1.012x speedup on SunSpider.
2499 We create special structure IDs for JSString and
2500 JSNumberCell. Unlike normal structure IDs, these cannot hold the
2501 true prototype. Due to JS autoboxing semantics, the prototype used
2502 when looking up string or number properties depends on the lexical
2503 global object of the call site, not the creation site. Thus we
2504 enable StructureIDs to handle this quirk for primitives.
2506 Everything else should be straightforward.
2509 (JSC::CTI::privateCompileGetByIdProto):
2510 (JSC::CTI::privateCompileGetByIdChain):
2512 (JSC::CTI::compileGetByIdProto):
2513 (JSC::CTI::compileGetByIdChain):
2514 * VM/JSPropertyNameIterator.h:
2515 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
2517 (JSC::Machine::Machine):
2518 (JSC::cachePrototypeChain):
2519 (JSC::Machine::tryCachePutByID):
2520 (JSC::Machine::tryCacheGetByID):
2521 (JSC::Machine::privateExecute):
2522 (JSC::Machine::tryCTICachePutByID):
2523 (JSC::Machine::tryCTICacheGetByID):
2524 * kjs/GetterSetter.h:
2525 (JSC::GetterSetter::GetterSetter):
2527 * kjs/JSGlobalData.cpp:
2528 (JSC::JSGlobalData::JSGlobalData):
2529 * kjs/JSGlobalData.h:
2530 * kjs/JSGlobalObject.h:
2531 (JSC::StructureID::prototypeForLookup):
2532 * kjs/JSNumberCell.h:
2533 (JSC::JSNumberCell::JSNumberCell):
2534 (JSC::jsNumberCell):
2536 (JSC::JSObject::prototype):
2540 (JSC::jsOwnedString):
2542 (JSC::JSString::JSString):
2544 (JSC::jsSingleCharacterString):
2545 (JSC::jsSingleCharacterSubstring):
2546 (JSC::jsNontrivialString):
2547 * kjs/SmallStrings.cpp:
2548 (JSC::SmallStrings::createEmptyString):
2549 (JSC::SmallStrings::createSingleCharacterString):
2550 * kjs/StructureID.cpp:
2551 (JSC::StructureID::StructureID):
2552 (JSC::StructureID::addPropertyTransition):
2553 (JSC::StructureID::getterSetterTransition):
2554 (JSC::StructureIDChain::StructureIDChain):
2555 * kjs/StructureID.h:
2556 (JSC::StructureID::create):
2557 (JSC::StructureID::storedPrototype):
2559 2008-09-09 Joerg Bornemann <joerg.bornemann@trolltech.com>
2561 Reviewed by Sam Weinig.
2563 https://bugs.webkit.org/show_bug.cgi?id=20746
2565 Added WINCE platform macro.
2569 2008-09-09 Sam Weinig <sam@webkit.org>
2571 Reviewed by Mark Rowe.
2573 Remove unnecessary override of getOffset.
2575 Sunspider reports this as a .6% progression.
2577 * JavaScriptCore.exp:
2579 (JSC::JSObject::getDirectLocation):
2580 (JSC::JSObject::getOwnPropertySlotForWrite):
2581 (JSC::JSObject::putDirect):
2582 * kjs/PropertyMap.cpp:
2583 * kjs/PropertyMap.h:
2585 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2587 Reviewed by Maciej Stachowiak.
2589 Bug 20759: Remove MacroAssembler
2590 <https://bugs.webkit.org/show_bug.cgi?id=20759>
2592 Remove MacroAssembler and move its functionality to X86Assembler.
2594 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2595 * JavaScriptCore.xcodeproj/project.pbxproj:
2597 (JSC::CTI::emitGetArg):
2598 (JSC::CTI::emitGetPutArg):
2599 (JSC::CTI::emitPutArg):
2600 (JSC::CTI::emitPutCTIParam):
2601 (JSC::CTI::emitGetCTIParam):
2602 (JSC::CTI::emitPutToCallFrameHeader):
2603 (JSC::CTI::emitGetFromCallFrameHeader):
2604 (JSC::CTI::emitPutResult):
2605 (JSC::CTI::emitDebugExceptionCheck):
2606 (JSC::CTI::emitJumpSlowCaseIfNotImm):
2607 (JSC::CTI::emitJumpSlowCaseIfNotImms):
2608 (JSC::CTI::emitFastArithDeTagImmediate):
2609 (JSC::CTI::emitFastArithReTagImmediate):
2610 (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
2611 (JSC::CTI::emitFastArithImmToInt):
2612 (JSC::CTI::emitFastArithIntToImmOrSlowCase):
2613 (JSC::CTI::emitFastArithIntToImmNoCheck):
2614 (JSC::CTI::compileOpCall):
2615 (JSC::CTI::emitSlowScriptCheck):
2616 (JSC::CTI::privateCompileMainPass):
2617 (JSC::CTI::privateCompileSlowCases):
2618 (JSC::CTI::privateCompile):
2619 (JSC::CTI::privateCompileGetByIdSelf):
2620 (JSC::CTI::privateCompileGetByIdProto):
2621 (JSC::CTI::privateCompileGetByIdChain):
2622 (JSC::CTI::privateCompilePutByIdReplace):
2623 (JSC::CTI::privateArrayLengthTrampoline):
2624 (JSC::CTI::privateStringLengthTrampoline):
2625 (JSC::CTI::compileRegExp):
2627 (JSC::CallRecord::CallRecord):
2628 (JSC::JmpTable::JmpTable):
2629 (JSC::SlowCaseEntry::SlowCaseEntry):
2630 (JSC::CTI::JSRInfo::JSRInfo):
2631 * masm/MacroAssembler.h: Removed.
2632 * masm/MacroAssemblerWin.cpp: Removed.
2633 * masm/X86Assembler.h:
2634 (JSC::X86Assembler::emitConvertToFastCall):
2635 (JSC::X86Assembler::emitRestoreArgumentReference):
2637 (JSC::WRECGenerator::WRECGenerator):
2638 (JSC::WRECParser::WRECParser):
2640 2008-09-09 Sam Weinig <sam@webkit.org>
2642 Reviewed by Cameron Zwarich.
2644 Don't waste the first item in the PropertyStorage.
2646 - Fix typo (makingCount -> markingCount)
2647 - Remove undefined method declaration.
2649 No change on Sunspider.
2652 (JSC::JSObject::mark):
2653 * kjs/PropertyMap.cpp:
2654 (JSC::PropertyMap::put):
2655 (JSC::PropertyMap::remove):
2656 (JSC::PropertyMap::getOffset):
2657 (JSC::PropertyMap::insert):
2658 (JSC::PropertyMap::rehash):
2659 (JSC::PropertyMap::resizePropertyStorage):
2660 (JSC::PropertyMap::checkConsistency):
2661 * kjs/PropertyMap.h:
2662 (JSC::PropertyMap::markingCount): Fix typo.
2664 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2668 Speculative Windows build fix.
2670 * masm/MacroAssemblerWin.cpp:
2671 (JSC::MacroAssembler::emitConvertToFastCall):
2672 (JSC::MacroAssembler::emitRestoreArgumentReference):
2674 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2676 Reviewed by Maciej Stachowiak.
2678 Bug 20755: Create an X86 namespace for register names and other things
2679 <https://bugs.webkit.org/show_bug.cgi?id=20755>
2681 Create an X86 namespace to put X86 register names. Perhaps I will move
2682 opcode names here later as well.
2685 (JSC::CTI::emitGetArg):
2686 (JSC::CTI::emitGetPutArg):
2687 (JSC::CTI::emitPutArg):
2688 (JSC::CTI::emitPutArgConstant):
2689 (JSC::CTI::emitPutCTIParam):
2690 (JSC::CTI::emitGetCTIParam):
2691 (JSC::CTI::emitPutToCallFrameHeader):
2692 (JSC::CTI::emitGetFromCallFrameHeader):
2693 (JSC::CTI::emitPutResult):
2694 (JSC::CTI::emitDebugExceptionCheck):
2695 (JSC::CTI::emitJumpSlowCaseIfNotImms):
2696 (JSC::CTI::compileOpCall):
2697 (JSC::CTI::emitSlowScriptCheck):
2698 (JSC::CTI::privateCompileMainPass):
2699 (JSC::CTI::privateCompileSlowCases):
2700 (JSC::CTI::privateCompile):
2701 (JSC::CTI::privateCompileGetByIdSelf):
2702 (JSC::CTI::privateCompileGetByIdProto):
2703 (JSC::CTI::privateCompileGetByIdChain):
2704 (JSC::CTI::privateCompilePutByIdReplace):
2705 (JSC::CTI::privateArrayLengthTrampoline):
2706 (JSC::CTI::privateStringLengthTrampoline):
2707 (JSC::CTI::compileRegExp):
2709 * masm/X86Assembler.h:
2711 (JSC::X86Assembler::emitModRm_rm):
2712 (JSC::X86Assembler::emitModRm_rm_Unchecked):
2713 (JSC::X86Assembler::emitModRm_rmsib):
2715 (JSC::WRECGenerator::generateNonGreedyQuantifier):
2716 (JSC::WRECGenerator::generateGreedyQuantifier):
2717 (JSC::WRECGenerator::generateParentheses):
2718 (JSC::WRECGenerator::generateBackreference):
2719 (JSC::WRECGenerator::gernerateDisjunction):
2722 2008-09-09 Sam Weinig <sam@webkit.org>
2724 Reviewed by Geoffrey Garen.
2726 Remove unnecessary friend declaration.
2728 * kjs/PropertyMap.h:
2730 2008-09-09 Sam Weinig <sam@webkit.org>
2732 Reviewed by Geoffrey Garen.
2734 Replace uses of PropertyMap::get and PropertyMap::getLocation with
2735 PropertyMap::getOffset.
2737 Sunspider reports this as a .6% improvement.
2739 * JavaScriptCore.exp:
2741 (JSC::JSObject::put):
2742 (JSC::JSObject::deleteProperty):
2743 (JSC::JSObject::getPropertyAttributes):
2745 (JSC::JSObject::getDirect):
2746 (JSC::JSObject::getDirectLocation):
2747 (JSC::JSObject::locationForOffset):
2748 * kjs/PropertyMap.cpp:
2749 (JSC::PropertyMap::remove):
2750 (JSC::PropertyMap::getOffset):
2751 * kjs/PropertyMap.h:
2753 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2755 Reviewed by Sam Weinig.
2757 Bug 20754: Remove emit prefix from assembler opcode methods
2758 <https://bugs.webkit.org/show_bug.cgi?id=20754>
2761 (JSC::CTI::emitGetArg):
2762 (JSC::CTI::emitGetPutArg):
2763 (JSC::CTI::emitPutArg):
2764 (JSC::CTI::emitPutArgConstant):
2765 (JSC::CTI::emitPutCTIParam):
2766 (JSC::CTI::emitGetCTIParam):
2767 (JSC::CTI::emitPutToCallFrameHeader):
2768 (JSC::CTI::emitGetFromCallFrameHeader):
2769 (JSC::CTI::emitPutResult):
2770 (JSC::CTI::emitDebugExceptionCheck):
2771 (JSC::CTI::emitCall):
2772 (JSC::CTI::emitJumpSlowCaseIfNotImm):
2773 (JSC::CTI::emitJumpSlowCaseIfNotImms):
2774 (JSC::CTI::emitFastArithDeTagImmediate):
2775 (JSC::CTI::emitFastArithReTagImmediate):
2776 (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
2777 (JSC::CTI::emitFastArithImmToInt):
2778 (JSC::CTI::emitFastArithIntToImmOrSlowCase):
2779 (JSC::CTI::emitFastArithIntToImmNoCheck):
2780 (JSC::CTI::compileOpCall):
2781 (JSC::CTI::emitSlowScriptCheck):
2782 (JSC::CTI::privateCompileMainPass):
2783 (JSC::CTI::privateCompileSlowCases):
2784 (JSC::CTI::privateCompile):
2785 (JSC::CTI::privateCompileGetByIdSelf):
2786 (JSC::CTI::privateCompileGetByIdProto):
2787 (JSC::CTI::privateCompileGetByIdChain):
2788 (JSC::CTI::privateCompilePutByIdReplace):
2789 (JSC::CTI::privateArrayLengthTrampoline):
2790 (JSC::CTI::privateStringLengthTrampoline):
2791 (JSC::CTI::compileRegExp):
2792 * masm/MacroAssemblerWin.cpp:
2793 (JSC::MacroAssembler::emitConvertToFastCall):
2794 (JSC::MacroAssembler::emitRestoreArgumentReference):
2795 * masm/X86Assembler.h:
2796 (JSC::X86Assembler::pushl_r):
2797 (JSC::X86Assembler::pushl_m):
2798 (JSC::X86Assembler::popl_r):
2799 (JSC::X86Assembler::popl_m):
2800 (JSC::X86Assembler::movl_rr):
2801 (JSC::X86Assembler::addl_rr):
2802 (JSC::X86Assembler::addl_i8r):
2803 (JSC::X86Assembler::addl_i32r):
2804 (JSC::X86Assembler::addl_mr):
2805 (JSC::X86Assembler::andl_rr):
2806 (JSC::X86Assembler::andl_i32r):
2807 (JSC::X86Assembler::cmpl_i8r):
2808 (JSC::X86Assembler::cmpl_rr):
2809 (JSC::X86Assembler::cmpl_rm):
2810 (JSC::X86Assembler::cmpl_i32r):
2811 (JSC::X86Assembler::cmpl_i32m):
2812 (JSC::X86Assembler::cmpw_rm):
2813 (JSC::X86Assembler::orl_rr):
2814 (JSC::X86Assembler::subl_rr):
2815 (JSC::X86Assembler::subl_i8r):
2816 (JSC::X86Assembler::subl_i32r):
2817 (JSC::X86Assembler::subl_mr):
2818 (JSC::X86Assembler::testl_i32r):
2819 (JSC::X86Assembler::testl_rr):
2820 (JSC::X86Assembler::xorl_i8r):
2821 (JSC::X86Assembler::xorl_rr):
2822 (JSC::X86Assembler::sarl_i8r):
2823 (JSC::X86Assembler::sarl_CLr):
2824 (JSC::X86Assembler::shl_i8r):
2825 (JSC::X86Assembler::shll_CLr):
2826 (JSC::X86Assembler::mull_rr):
2827 (JSC::X86Assembler::idivl_r):
2828 (JSC::X86Assembler::cdq):
2829 (JSC::X86Assembler::movl_mr):
2830 (JSC::X86Assembler::movzwl_mr):
2831 (JSC::X86Assembler::movl_rm):
2832 (JSC::X86Assembler::movl_i32r):
2833 (JSC::X86Assembler::movl_i32m):
2834 (JSC::X86Assembler::leal_mr):
2835 (JSC::X86Assembler::ret):
2836 (JSC::X86Assembler::jmp_r):
2837 (JSC::X86Assembler::jmp_m):
2838 (JSC::X86Assembler::call_r):
2840 (JSC::WRECGenerator::generateBacktrack1):
2841 (JSC::WRECGenerator::generateBacktrackBackreference):
2842 (JSC::WRECGenerator::generateBackreferenceQuantifier):
2843 (JSC::WRECGenerator::generateNonGreedyQuantifier):
2844 (JSC::WRECGenerator::generateGreedyQuantifier):
2845 (JSC::WRECGenerator::generatePatternCharacter):
2846 (JSC::WRECGenerator::generateCharacterClassInvertedRange):
2847 (JSC::WRECGenerator::generateCharacterClassInverted):
2848 (JSC::WRECGenerator::generateCharacterClass):
2849 (JSC::WRECGenerator::generateParentheses):
2850 (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
2851 (JSC::WRECGenerator::generateAssertionBOL):
2852 (JSC::WRECGenerator::generateAssertionEOL):
2853 (JSC::WRECGenerator::generateAssertionWordBoundary):
2854 (JSC::WRECGenerator::generateBackreference):
2855 (JSC::WRECGenerator::gernerateDisjunction):
2857 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2859 Reviewed by Maciej Stachowiak.
2861 Clean up the WREC code some more.
2864 (JSC::CTI::compileRegExp):
2866 (JSC::getCharacterClassNewline):
2867 (JSC::getCharacterClassDigits):
2868 (JSC::getCharacterClassSpaces):
2869 (JSC::getCharacterClassWordchar):
2870 (JSC::getCharacterClassNondigits):
2871 (JSC::getCharacterClassNonspaces):
2872 (JSC::getCharacterClassNonwordchar):
2873 (JSC::WRECGenerator::generateBacktrack1):
2874 (JSC::WRECGenerator::generateBacktrackBackreference):
2875 (JSC::WRECGenerator::generateBackreferenceQuantifier):
2876 (JSC::WRECGenerator::generateNonGreedyQuantifier):
2877 (JSC::WRECGenerator::generateGreedyQuantifier):
2878 (JSC::WRECGenerator::generatePatternCharacter):
2879 (JSC::WRECGenerator::generateCharacterClassInvertedRange):
2880 (JSC::WRECGenerator::generateCharacterClassInverted):
2881 (JSC::WRECGenerator::generateCharacterClass):
2882 (JSC::WRECGenerator::generateParentheses):
2883 (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
2884 (JSC::WRECGenerator::generateAssertionBOL):
2885 (JSC::WRECGenerator::generateAssertionEOL):
2886 (JSC::WRECGenerator::generateAssertionWordBoundary):
2887 (JSC::WRECGenerator::generateBackreference):
2888 (JSC::WRECGenerator::gernerateDisjunction):
2889 (JSC::WRECParser::parseCharacterClass):
2890 (JSC::WRECParser::parseEscape):
2891 (JSC::WRECParser::parseTerm):
2894 2008-09-09 Mark Rowe <mrowe@apple.com>
2896 Build fix, rubber-stamped by Anders Carlsson.
2898 Silence spurious build warnings about missing format attributes on functions in Assertions.cpp.
2900 * JavaScriptCore.xcodeproj/project.pbxproj:
2902 2008-09-09 Mark Rowe <mrowe@apple.com>
2904 Rubber-stamped by Oliver Hunt.
2906 Fix builds using the "debug" variant.
2908 This reverts r36130 and tweaks Identifier to export the same symbols for Debug
2909 and Release configurations.
2911 * Configurations/JavaScriptCore.xcconfig:
2912 * DerivedSources.make:
2913 * JavaScriptCore.Debug.exp: Removed.
2914 * JavaScriptCore.base.exp: Removed.
2915 * JavaScriptCore.exp: Added.
2916 * JavaScriptCore.xcodeproj/project.pbxproj:
2917 * kjs/identifier.cpp:
2918 (JSC::Identifier::addSlowCase): #ifdef the call to checkSameIdentifierTable so that
2919 there is no overhead in Release builds.
2920 (JSC::Identifier::checkSameIdentifierTable): Add empty functions for Release builds.
2922 (JSC::Identifier::add): #ifdef the calls to checkSameIdentifierTable so that there is
2923 no overhead in Release builds, and remove the inline definitions of checkSameIdentifierTable.
2925 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2927 Reviewed by Maciej Stachowiak.
2929 Clean up WREC a bit to bring it closer to our coding style guidelines.
2933 (JSC::getCharacterClass_newline):
2934 (JSC::getCharacterClass_d):
2935 (JSC::getCharacterClass_s):
2936 (JSC::getCharacterClass_w):
2937 (JSC::getCharacterClass_D):
2938 (JSC::getCharacterClass_S):
2939 (JSC::getCharacterClass_W):
2940 (JSC::CharacterClassConstructor::append):
2941 (JSC::WRECGenerator::generateNonGreedyQuantifier):
2942 (JSC::WRECGenerator::generateGreedyQuantifier):
2943 (JSC::WRECGenerator::generateCharacterClassInverted):
2944 (JSC::WRECParser::parseQuantifier):
2945 (JSC::WRECParser::parsePatternCharacterQualifier):
2946 (JSC::WRECParser::parseCharacterClassQuantifier):
2947 (JSC::WRECParser::parseBackreferenceQuantifier):
2949 (JSC::Quantifier::):
2950 (JSC::Quantifier::Quantifier):
2952 2008-09-09 Jungshik Shin <jungshik.shin@gmail.com>
2954 Reviewed by Alexey Proskuryakov.
2956 Try MIME charset names before trying IANA names
2957 ( https://bugs.webkit.org/show_bug.cgi?id=17537 )
2959 * wtf/StringExtras.h: (strcasecmp): Added.
2961 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2963 Reviewed by Mark Rowe.
2965 Bug 20719: REGRESSION (r36135-36244): Hangs, then crashes after several seconds
2966 <https://bugs.webkit.org/show_bug.cgi?id=20719>
2967 <rdar://problem/6205787>
2969 Fix a typo in the case-insensitive matching of character patterns.
2972 (JSC::WRECGenerator::generatePatternCharacter):
2974 2008-09-09 Maciej Stachowiak <mjs@apple.com>
2976 Reviewed by Sam Weinig.
2978 - allow polymorphic inline cache to handle Math object functions and possibly other similar things
2980 1.012x speedup on SunSpider.
2982 * kjs/MathObject.cpp:
2983 (JSC::MathObject::getOwnPropertySlot):
2985 (JSC::setUpStaticFunctionSlot):
2987 (JSC::getStaticPropertySlot):
2989 2008-09-08 Sam Weinig <sam@webkit.org>
2991 Reviewed by Maciej Stachowiak and Oliver Hunt.
2993 Split storage of properties out of the PropertyMap and into the JSObject
2994 to allow sharing PropertyMap on the StructureID. In order to get this
2995 function correctly, the StructureID's transition mappings were changed to
2996 transition based on property name and attribute pairs, instead of just
2999 - Removes the single property optimization now that the PropertyMap is shared.
3000 This will be replaced by in-lining some values on the JSObject.
3002 This is a wash on Sunspider and a 6.7% win on the v8 test suite.
3004 * JavaScriptCore.base.exp:
3006 (JSC::CTI::privateCompileGetByIdSelf): Get the storage directly off the JSObject.
3007 (JSC::CTI::privateCompileGetByIdProto): Ditto.
3008 (JSC::CTI::privateCompileGetByIdChain): Ditto.
3009 (JSC::CTI::privateCompilePutByIdReplace): Ditto.
3011 (JSC::JSObject::mark): Mark the PropertyStorage.
3012 (JSC::JSObject::put): Update to get the propertyMap of the StructureID.
3013 (JSC::JSObject::deleteProperty): Ditto.
3014 (JSC::JSObject::defineGetter): Return early if the property is already a getter/setter.
3015 (JSC::JSObject::defineSetter): Ditto.
3016 (JSC::JSObject::getPropertyAttributes): Update to get the propertyMap of the StructureID
3017 (JSC::JSObject::getPropertyNames): Ditto.
3018 (JSC::JSObject::removeDirect): Ditto.
3019 * kjs/JSObject.h: Remove PropertyMap and add PropertyStorage.
3020 (JSC::JSObject::propertyStorage): return the PropertyStorage.
3021 (JSC::JSObject::getDirect): Update to get the propertyMap of the StructureID.
3022 (JSC::JSObject::getDirectLocation): Ditto.
3023 (JSC::JSObject::offsetForLocation): Compute location directly.
3024 (JSC::JSObject::hasCustomProperties): Update to get the propertyMap of the StructureID.
3025 (JSC::JSObject::hasGetterSetterProperties): Ditto.
3026 (JSC::JSObject::getDirectOffset): Get by indexing into PropertyStorage.
3027 (JSC::JSObject::putDirectOffset): Put by indexing into PropertyStorage.
3028 (JSC::JSObject::getOwnPropertySlotForWrite): Update to get the propertyMap of the StructureID.
3029 (JSC::JSObject::getOwnPropertySlot): Ditto.
3030 (JSC::JSObject::putDirect): Move putting into the StructureID unless the property already exists.
3031 * kjs/PropertyMap.cpp: Use the propertyStorage as the storage for the JSValues.
3032 (JSC::PropertyMap::checkConsistency):
3033 (JSC::PropertyMap::operator=):
3034 (JSC::PropertyMap::~PropertyMap):
3035 (JSC::PropertyMap::get):
3036 (JSC::PropertyMap::getLocation):
3037 (JSC::PropertyMap::put):
3038 (JSC::PropertyMap::getOffset):
3039 (JSC::PropertyMap::insert):
3040 (JSC::PropertyMap::expand):
3041 (JSC::PropertyMap::rehash):
3042 (JSC::PropertyMap::createTable):
3043 (JSC::PropertyMap::resizePropertyStorage): Resize the storage to match the size of the map
3044 (JSC::PropertyMap::remove):
3045 (JSC::PropertyMap::getEnumerablePropertyNames):
3046 * kjs/PropertyMap.h:
3047 (JSC::PropertyMapEntry::PropertyMapEntry):
3048 (JSC::PropertyMap::isEmpty):
3049 (JSC::PropertyMap::size):
3050 (JSC::PropertyMap::makingCount):
3051 (JSC::PropertyMap::PropertyMap):
3053 * kjs/StructureID.cpp:
3054 (JSC::StructureID::addPropertyTransition): Transitions now are based off the property name
3056 (JSC::StructureID::toDictionaryTransition): Copy the map.
3057 (JSC::StructureID::changePrototypeTransition): Copy the map.
3058 (JSC::StructureID::getterSetterTransition): Copy the map.
3059 (JSC::StructureID::~StructureID):
3060 * kjs/StructureID.h:
3061 (JSC::TransitionTableHash::hash): Custom hash for transition map.
3062 (JSC::TransitionTableHash::equal): Ditto.
3063 (JSC::TransitionTableHashTraits::emptyValue): Custom traits for transition map
3064 (JSC::TransitionTableHashTraits::constructDeletedValue): Ditto.
3065 (JSC::TransitionTableHashTraits::isDeletedValue): Ditto.
3066 (JSC::StructureID::propertyMap): Added.
3068 2008-09-08 Oliver Hunt <oliver@apple.com>
3070 Reviewed by Mark Rowe.
3072 Bug 20694: Slow Script error pops up when running Dromaeo tests
3074 Correct error in timeout logic where execution tick count would
3075 be reset to incorrect value due to incorrect offset and indirection.
3076 Codegen for the slow script dialog was factored out into a separate
3077 method (emitSlowScriptCheck) rather than having multiple copies of
3078 the same code. Also added calls to generate slow script checks
3079 for loop_if_less and loop_if_true opcodes.
3082 (JSC::CTI::emitSlowScriptCheck):
3083 (JSC::CTI::privateCompileMainPass):
3084 (JSC::CTI::privateCompileSlowCases):
3087 2008-09-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3089 Reviewed by Maciej Stachowiak.
3091 Remove references to the removed WRECompiler class.
3096 2008-09-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3098 Rubber-stamped by Mark Rowe.
3100 Fix the build with CTI enabled but WREC disabled.
3105 2008-09-08 Dan Bernstein <mitz@apple.com>
3110 (JSC::StatementNode::):
3113 2008-09-08 Kevin McCullough <kmccullough@apple.com>
3117 <rdar://problem/6134407> Breakpoints in for loops, while loops or
3118 conditions without curly braces don't break. (19306)
3119 -Statement Lists already emit debug hooks but conditionals without
3120 brackets are not lists.
3123 (KJS::IfNode::emitCode):
3124 (KJS::IfElseNode::emitCode):
3125 (KJS::DoWhileNode::emitCode):
3126 (KJS::WhileNode::emitCode):
3127 (KJS::ForNode::emitCode):
3128 (KJS::ForInNode::emitCode):
3130 (KJS::StatementNode::):
3133 2008-09-08 Maciej Stachowiak <mjs@apple.com>
3135 Reviewed by Anders Carlsson.
3137 - Cache the code generated for eval to speed up SunSpider and web sites
3138 https://bugs.webkit.org/show_bug.cgi?id=20718
3141 2.29x on date-format-tofte
3143 Lots of real sites seem to get many hits on this cache as well,
3144 including GMail, Google Spreadsheets, Slate and Digg (the last of
3145 these gets over 100 hits on initial page load).
3148 (JSC::EvalCodeCache::get):
3150 (JSC::Machine::callEval):
3151 (JSC::Machine::privateExecute):
3152 (JSC::Machine::cti_op_call_eval):
3155 2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3157 Reviewed by Oliver Hunt.
3159 Bug 20711: Change KJS prefix on preprocessor macros to JSC
3160 <https://bugs.webkit.org/show_bug.cgi?id=20711>
3162 * kjs/CommonIdentifiers.cpp:
3163 (JSC::CommonIdentifiers::CommonIdentifiers):
3164 * kjs/CommonIdentifiers.h:
3165 * kjs/PropertySlot.h:
3166 (JSC::PropertySlot::getValue):
3167 (JSC::PropertySlot::putValue):
3168 (JSC::PropertySlot::setValueSlot):
3169 (JSC::PropertySlot::setValue):
3170 (JSC::PropertySlot::setRegisterSlot):
3175 (JSC::ExpressionNode::):
3176 (JSC::StatementNode::):
3178 (JSC::BooleanNode::):
3179 (JSC::NumberNode::):
3180 (JSC::ImmediateNumberNode::):
3181 (JSC::StringNode::):
3182 (JSC::RegExpNode::):
3184 (JSC::ResolveNode::):
3185 (JSC::ElementNode::):
3187 (JSC::PropertyNode::):
3188 (JSC::PropertyListNode::):
3189 (JSC::ObjectLiteralNode::):
3190 (JSC::BracketAccessorNode::):
3191 (JSC::DotAccessorNode::):
3192 (JSC::ArgumentListNode::):
3193 (JSC::ArgumentsNode::):
3194 (JSC::NewExprNode::):
3195 (JSC::EvalFunctionCallNode::):
3196 (JSC::FunctionCallValueNode::):
3197 (JSC::FunctionCallResolveNode::):
3198 (JSC::FunctionCallBracketNode::):
3199 (JSC::FunctionCallDotNode::):
3200 (JSC::PrePostResolveNode::):
3201 (JSC::PostfixResolveNode::):
3202 (JSC::PostfixBracketNode::):
3203 (JSC::PostfixDotNode::):
3204 (JSC::PostfixErrorNode::):
3205 (JSC::DeleteResolveNode::):
3206 (JSC::DeleteBracketNode::):
3207 (JSC::DeleteDotNode::):
3208 (JSC::DeleteValueNode::):
3210 (JSC::TypeOfResolveNode::):
3211 (JSC::TypeOfValueNode::):
3212 (JSC::PrefixResolveNode::):
3213 (JSC::PrefixBracketNode::):
3214 (JSC::PrefixDotNode::):
3215 (JSC::PrefixErrorNode::):
3216 (JSC::UnaryPlusNode::):
3217 (JSC::NegateNode::):
3218 (JSC::BitwiseNotNode::):
3219 (JSC::LogicalNotNode::):
3225 (JSC::LeftShiftNode::):
3226 (JSC::RightShiftNode::):
3227 (JSC::UnsignedRightShiftNode::):
3229 (JSC::GreaterNode::):
3230 (JSC::LessEqNode::):
3231 (JSC::GreaterEqNode::):
3232 (JSC::ThrowableBinaryOpNode::):
3233 (JSC::InstanceOfNode::):
3236 (JSC::NotEqualNode::):
3237 (JSC::StrictEqualNode::):
3238 (JSC::NotStrictEqualNode::):
3239 (JSC::BitAndNode::):
3241 (JSC::BitXOrNode::):
3242 (JSC::LogicalOpNode::):
3243 (JSC::ConditionalNode::):
3244 (JSC::ReadModifyResolveNode::):
3245 (JSC::AssignResolveNode::):
3246 (JSC::ReadModifyBracketNode::):
3247 (JSC::AssignBracketNode::):
3248 (JSC::AssignDotNode::):
3249 (JSC::ReadModifyDotNode::):
3250 (JSC::AssignErrorNode::):
3252 (JSC::VarDeclCommaNode::):
3253 (JSC::ConstDeclNode::):
3254 (JSC::ConstStatementNode::):
3255 (JSC::EmptyStatementNode::):
3256 (JSC::DebuggerStatementNode::):
3257 (JSC::ExprStatementNode::):
3258 (JSC::VarStatementNode::):
3260 (JSC::IfElseNode::):
3261 (JSC::DoWhileNode::):
3264 (JSC::ContinueNode::):
3266 (JSC::ReturnNode::):
3271 (JSC::ParameterNode::):
3273 (JSC::ProgramNode::):
3275 (JSC::FunctionBodyNode::):
3276 (JSC::FuncExprNode::):
3277 (JSC::FuncDeclNode::):
3278 (JSC::CaseClauseNode::):
3279 (JSC::ClauseListNode::):
3280 (JSC::CaseBlockNode::):
3281 (JSC::SwitchNode::):
3283 2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3285 Reviewed by Maciej Stachowiak.
3287 Bug 20704: Replace the KJS namespace
3288 <https://bugs.webkit.org/show_bug.cgi?id=20704>
3290 Rename the KJS namespace to JSC. There are still some uses of KJS in
3291 preprocessor macros and comments, but these will also be changed some
3292 time in the near future.
3299 * API/JSCallbackConstructor.cpp:
3300 * API/JSCallbackConstructor.h:
3301 * API/JSCallbackFunction.cpp:
3302 * API/JSCallbackFunction.h:
3303 * API/JSCallbackObject.cpp:
3304 * API/JSCallbackObject.h:
3305 * API/JSCallbackObjectFunctions.h:
3306 * API/JSClassRef.cpp:
3307 (OpaqueJSClass::staticValues):
3308 (OpaqueJSClass::staticFunctions):
3310 * API/JSContextRef.cpp:
3311 * API/JSObjectRef.cpp:
3312 * API/JSProfilerPrivate.cpp:
3313 * API/JSStringRef.cpp:
3314 * API/JSValueRef.cpp:
3316 * API/OpaqueJSString.cpp:
3317 * API/OpaqueJSString.h:
3318 * JavaScriptCore.Debug.exp:
3319 * JavaScriptCore.base.exp:
3325 * VM/CodeGenerator.cpp:
3326 * VM/CodeGenerator.h:
3327 * VM/ExceptionHelpers.cpp:
3328 * VM/ExceptionHelpers.h:
3330 * VM/JSPropertyNameIterator.cpp:
3331 * VM/JSPropertyNameIterator.h:
3339 * VM/RegisterFile.cpp:
3340 * VM/RegisterFile.h:
3343 * VM/SamplingTool.cpp:
3344 * VM/SamplingTool.h:
3345 * VM/SegmentedVector.h:
3348 * kjs/Arguments.cpp:
3350 * kjs/ArrayConstructor.cpp:
3351 * kjs/ArrayConstructor.h:
3352 * kjs/ArrayPrototype.cpp:
3353 * kjs/ArrayPrototype.h:
3354 * kjs/BatchedTransitionOptimizer.h:
3355 * kjs/BooleanConstructor.cpp:
3356 * kjs/BooleanConstructor.h:
3357 * kjs/BooleanObject.cpp:
3358 * kjs/BooleanObject.h:
3359 * kjs/BooleanPrototype.cpp:
3360 * kjs/BooleanPrototype.h:
3364 * kjs/CommonIdentifiers.cpp:
3365 * kjs/CommonIdentifiers.h:
3366 * kjs/ConstructData.cpp:
3367 * kjs/ConstructData.h:
3368 * kjs/DateConstructor.cpp:
3369 * kjs/DateConstructor.h:
3370 * kjs/DateInstance.cpp:
3371 (JSC::DateInstance::msToGregorianDateTime):
3372 * kjs/DateInstance.h:
3375 * kjs/DatePrototype.cpp:
3376 * kjs/DatePrototype.h:
3377 * kjs/DebuggerCallFrame.cpp:
3378 * kjs/DebuggerCallFrame.h:
3381 * kjs/ErrorConstructor.cpp:
3382 * kjs/ErrorConstructor.h:
3383 * kjs/ErrorInstance.cpp:
3384 * kjs/ErrorInstance.h:
3385 * kjs/ErrorPrototype.cpp:
3386 * kjs/ErrorPrototype.h:
3387 * kjs/ExecState.cpp:
3389 * kjs/FunctionConstructor.cpp:
3390 * kjs/FunctionConstructor.h:
3391 * kjs/FunctionPrototype.cpp:
3392 * kjs/FunctionPrototype.h:
3393 * kjs/GetterSetter.cpp:
3394 * kjs/GetterSetter.h:
3395 * kjs/GlobalEvalFunction.cpp:
3396 * kjs/GlobalEvalFunction.h:
3397 * kjs/IndexToNameMap.cpp:
3398 * kjs/IndexToNameMap.h:
3399 * kjs/InitializeThreading.cpp:
3400 * kjs/InitializeThreading.h:
3401 * kjs/InternalFunction.cpp:
3402 * kjs/InternalFunction.h:
3403 (JSC::InternalFunction::InternalFunction):
3404 * kjs/JSActivation.cpp:
3405 * kjs/JSActivation.h:
3410 * kjs/JSFunction.cpp:
3412 (JSC::JSFunction::JSFunction):
3413 * kjs/JSGlobalData.cpp:
3414 (JSC::JSGlobalData::JSGlobalData):
3415 * kjs/JSGlobalData.h:
3416 * kjs/JSGlobalObject.cpp:
3417 * kjs/JSGlobalObject.h:
3418 * kjs/JSGlobalObjectFunctions.cpp:
3419 * kjs/JSGlobalObjectFunctions.h:
3420 * kjs/JSImmediate.cpp:
3421 * kjs/JSImmediate.h:
3424 * kjs/JSNotAnObject.cpp:
3425 * kjs/JSNotAnObject.h:
3426 * kjs/JSNumberCell.cpp:
3427 * kjs/JSNumberCell.h:
3430 * kjs/JSStaticScopeObject.cpp:
3431 * kjs/JSStaticScopeObject.h:
3437 * kjs/JSVariableObject.cpp:
3438 * kjs/JSVariableObject.h:
3439 * kjs/JSWrapperObject.cpp:
3440 * kjs/JSWrapperObject.h:
3441 * kjs/LabelStack.cpp:
3443 * kjs/MathObject.cpp:
3445 * kjs/NativeErrorConstructor.cpp:
3446 * kjs/NativeErrorConstructor.h:
3447 * kjs/NativeErrorPrototype.cpp:
3448 * kjs/NativeErrorPrototype.h:
3450 * kjs/NumberConstructor.cpp:
3451 * kjs/NumberConstructor.h:
3452 * kjs/NumberObject.cpp:
3453 * kjs/NumberObject.h:
3454 * kjs/NumberPrototype.cpp:
3455 * kjs/NumberPrototype.h:
3456 * kjs/ObjectConstructor.cpp:
3457 * kjs/ObjectConstructor.h:
3458 * kjs/ObjectPrototype.cpp:
3459 * kjs/ObjectPrototype.h:
3462 * kjs/PropertyMap.cpp:
3463 (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger):
3464 * kjs/PropertyMap.h:
3465 * kjs/PropertyNameArray.cpp:
3466 * kjs/PropertyNameArray.h:
3467 * kjs/PropertySlot.cpp:
3468 * kjs/PropertySlot.h:
3469 * kjs/PrototypeFunction.cpp:
3470 * kjs/PrototypeFunction.h:
3471 * kjs/PutPropertySlot.h:
3472 * kjs/RegExpConstructor.cpp:
3473 * kjs/RegExpConstructor.h:
3474 * kjs/RegExpObject.cpp:
3475 * kjs/RegExpObject.h:
3476 * kjs/RegExpPrototype.cpp:
3477 * kjs/RegExpPrototype.h:
3478 * kjs/ScopeChain.cpp:
3480 * kjs/ScopeChainMark.h:
3483 * kjs/SmallStrings.cpp:
3484 * kjs/SmallStrings.h:
3485 * kjs/SourceProvider.h:
3486 * kjs/SourceRange.h:
3487 * kjs/StringConstructor.cpp:
3488 * kjs/StringConstructor.h:
3489 * kjs/StringObject.cpp:
3490 * kjs/StringObject.h:
3491 * kjs/StringObjectThatMasqueradesAsUndefined.h:
3492 * kjs/StringPrototype.cpp:
3493 * kjs/StringPrototype.h:
3494 * kjs/StructureID.cpp:
3495 * kjs/StructureID.h:
3496 * kjs/SymbolTable.h:
3497 * kjs/collector.cpp:
3500 * kjs/create_hash_table:
3506 * kjs/identifier.cpp:
3508 (JSC::Identifier::equal):
3509 * kjs/interpreter.cpp:
3510 * kjs/interpreter.h:
3512 (JSC::Lexer::Lexer):
3513 (JSC::Lexer::clear):
3514 (JSC::Lexer::makeIdentifier):
3520 * kjs/nodes2string.cpp:
3521 * kjs/operations.cpp:
3529 (JSC::IdentifierRepHash::hash):
3531 * masm/MacroAssembler.h:
3532 * masm/MacroAssemblerWin.cpp:
3533 * masm/X86Assembler.h:
3534 * pcre/pcre_exec.cpp:
3535 * profiler/CallIdentifier.h:
3537 * profiler/HeavyProfile.cpp:
3538 * profiler/HeavyProfile.h:
3539 * profiler/Profile.cpp:
3540 * profiler/Profile.h:
3541 * profiler/ProfileGenerator.cpp:
3542 * profiler/ProfileGenerator.h:
3543 * profiler/ProfileNode.cpp:
3544 * profiler/ProfileNode.h:
3545 * profiler/Profiler.cpp:
3546 * profiler/Profiler.h:
3547 * profiler/TreeProfile.cpp:
3548 * profiler/TreeProfile.h:
3553 2008-09-07 Maciej Stachowiak <mjs@apple.com>
3555 Reviewed by Dan Bernstein.
3557 - rename IA32MacroAssembler class to X86Assembler
3559 We otherwise call the platform X86, and also, I don't see any macros.
3561 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3562 * JavaScriptCore.xcodeproj/project.pbxproj:
3563 * masm/IA32MacroAsm.h: Removed.
3564 * masm/MacroAssembler.h:
3565 (KJS::MacroAssembler::MacroAssembler):
3566 * masm/MacroAssemblerWin.cpp:
3567 (KJS::MacroAssembler::emitRestoreArgumentReference):
3568 * masm/X86Assembler.h: Copied from masm/IA32MacroAsm.h.
3569 (KJS::X86Assembler::X86Assembler):
3571 (KJS::WRECGenerator::generateNonGreedyQuantifier):
3572 (KJS::WRECGenerator::generateGreedyQuantifier):
3573 (KJS::WRECGenerator::generateParentheses):
3574 (KJS::WRECGenerator::generateBackreference):
3575 (KJS::WRECGenerator::gernerateDisjunction):
3578 2008-09-07 Cameron Zwarich <cwzwarich@webkit.org>
3582 Visual C++ seems to have some odd casting rules, so just convert the
3583 offending cast back to a C-style cast for now.
3585 * kjs/collector.cpp:
3586 (KJS::otherThreadStackPointer):
3588 2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3590 Reviewed by Mark Rowe.
3592 Attempt to fix the Windows build by using a const_cast to cast regs.Esp
3593 to a uintptr_t instead of a reinterpret_cast.
3595 * kjs/collector.cpp:
3596 (KJS::otherThreadStackPointer):
3598 2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3600 Reviewed by Sam Weinig.
3602 Remove C-style casts from kjs/collector.cpp.
3604 * kjs/collector.cpp:
3605 (KJS::Heap::heapAllocate):
3606 (KJS::currentThreadStackBase):
3607 (KJS::Heap::markConservatively):
3608 (KJS::otherThreadStackPointer):
3609 (KJS::Heap::markOtherThreadConservatively):
3612 2008-09-07 Mark Rowe <mrowe@apple.com>
3614 Build fix for the debug variant.
3616 * DerivedSources.make: Also use the .Debug.exp exports file when building the debug variant.
3618 2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3620 Reviewed by Timothy Hatcher.
3622 Remove C-style casts from the CTI code.
3625 (KJS::CTI::emitGetArg):
3626 (KJS::CTI::emitGetPutArg):
3627 (KJS::ctiRepatchCallByReturnAddress):
3628 (KJS::CTI::compileOpCall):
3629 (KJS::CTI::privateCompileMainPass):
3630 (KJS::CTI::privateCompileGetByIdSelf):
3631 (KJS::CTI::privateCompileGetByIdProto):
3632 (KJS::CTI::privateCompileGetByIdChain):
3633 (KJS::CTI::privateCompilePutByIdReplace):
3634 (KJS::CTI::privateArrayLengthTrampoline):
3635 (KJS::CTI::privateStringLengthTrampoline):
3637 === End merge of squirrelfish-extreme ===
3639 2008-09-06 Gavin Barraclough <barraclough@apple.com>
3641 Reviewed by Sam Weinig. Adapted somewhat by Maciej Stachowiak.
3643 - refactor WREC to share more of the JIT infrastructure with CTI
3646 (KJS::CTI::emitGetArg):
3647 (KJS::CTI::emitGetPutArg):
3648 (KJS::CTI::emitPutArg):
3649 (KJS::CTI::emitPutArgConstant):
3650 (KJS::CTI::emitPutCTIParam):
3651 (KJS::CTI::emitGetCTIParam):
3652 (KJS::CTI::emitPutToCallFrameHeader):
3653 (KJS::CTI::emitGetFromCallFrameHeader):
3654 (KJS::CTI::emitPutResult):
3655 (KJS::CTI::emitDebugExceptionCheck):
3656 (KJS::CTI::emitJumpSlowCaseIfNotImm):
3657 (KJS::CTI::emitJumpSlowCaseIfNotImms):
3658 (KJS::CTI::emitFastArithDeTagImmediate):
3659 (KJS::CTI::emitFastArithReTagImmediate):
3660 (KJS::CTI::emitFastArithPotentiallyReTagImmediate):
3661 (KJS::CTI::emitFastArithImmToInt):
3662 (KJS::CTI::emitFastArithIntToImmOrSlowCase):
3663 (KJS::CTI::emitFastArithIntToImmNoCheck):
3665 (KJS::CTI::compileOpCall):
3666 (KJS::CTI::privateCompileMainPass):
3667 (KJS::CTI::privateCompileSlowCases):
3668 (KJS::CTI::privateCompile):
3669 (KJS::CTI::privateCompileGetByIdSelf):
3670 (KJS::CTI::privateCompileGetByIdProto):
3671 (KJS::CTI::privateCompileGetByIdChain):
3672 (KJS::CTI::privateCompilePutByIdReplace):
3673 (KJS::CTI::privateArrayLengthTrampoline):
3674 (KJS::CTI::privateStringLengthTrampoline):
3675 (KJS::CTI::compileRegExp):
3677 (KJS::CallRecord::CallRecord):
3678 (KJS::JmpTable::JmpTable):
3679 (KJS::SlowCaseEntry::SlowCaseEntry):
3680 (KJS::CTI::JSRInfo::JSRInfo):
3682 (KJS::RegExp::RegExp):
3684 (KJS::GenerateParenthesesNonGreedyFunctor::GenerateParenthesesNonGreedyFunctor):
3685 (KJS::GeneratePatternCharacterFunctor::generateAtom):
3686 (KJS::GeneratePatternCharacterFunctor::backtrack):
3687 (KJS::GenerateCharacterClassFunctor::generateAtom):
3688 (KJS::GenerateCharacterClassFunctor::backtrack):
3689 (KJS::GenerateBackreferenceFunctor::generateAtom):
3690 (KJS::GenerateBackreferenceFunctor::backtrack):
3691 (KJS::GenerateParenthesesNonGreedyFunctor::generateAtom):
3692 (KJS::GenerateParenthesesNonGreedyFunctor::backtrack):
3693 (KJS::WRECGenerate::generateBacktrack1):
3694 (KJS::WRECGenerate::generateBacktrackBackreference):
3695 (KJS::WRECGenerate::generateBackreferenceQuantifier):
3696 (KJS::WRECGenerate::generateNonGreedyQuantifier):
3697 (KJS::WRECGenerate::generateGreedyQuantifier):
3698 (KJS::WRECGenerate::generatePatternCharacter):
3699 (KJS::WRECGenerate::generateCharacterClassInvertedRange):
3700 (KJS::WRECGenerate::generateCharacterClassInverted):
3701 (KJS::WRECGenerate::generateCharacterClass):
3702 (KJS::WRECGenerate::generateParentheses):
3703 (KJS::WRECGenerate::generateParenthesesNonGreedy):
3704 (KJS::WRECGenerate::gererateParenthesesResetTrampoline):
3705 (KJS::WRECGenerate::generateAssertionBOL):
3706 (KJS::WRECGenerate::generateAssertionEOL):
3707 (KJS::WRECGenerate::generateAssertionWordBoundary):
3708 (KJS::WRECGenerate::generateBackreference):
3709 (KJS::WRECGenerate::gernerateDisjunction):
3710 (KJS::WRECGenerate::terminateDisjunction):
3711 (KJS::WRECParser::parseGreedyQuantifier):
3712 (KJS::WRECParser::parseQuantifier):
3713 (KJS::WRECParser::parsePatternCharacterQualifier):
3714 (KJS::WRECParser::parseCharacterClassQuantifier):
3715 (KJS::WRECParser::parseBackreferenceQuantifier):
3716 (KJS::WRECParser::parseParentheses):
3717 (KJS::WRECParser::parseCharacterClass):
3718 (KJS::WRECParser::parseOctalEscape):
3719 (KJS::WRECParser::parseEscape):
3720 (KJS::WRECParser::parseTerm):
3721 (KJS::WRECParser::parseDisjunction):
3723 (KJS::WRECGenerate::WRECGenerate):
3724 (KJS::WRECParser::):
3725 (KJS::WRECParser::WRECParser):
3726 (KJS::WRECParser::parseAlternative):
3727 (KJS::WRECParser::isEndOfPattern):
3729 2008-09-06 Oliver Hunt <oliver@apple.com>
3731 Reviewed by NOBODY (Build fix).
3733 Fix the sampler build.
3735 * VM/SamplingTool.h:
3737 2008-09-06 Oliver Hunt <oliver@apple.com>
3739 Reviewed by Maciej Stachowiak.
3741 Jump through the necessary hoops required to make MSVC cooperate with SFX
3743 We now explicitly declare the calling convention on all cti_op_* cfunctions,
3744 and return int instead of bool where appropriate (despite the cdecl calling
3745 convention seems to state MSVC generates code that returns the result value
3746 through ecx). SFX behaves slightly differently under MSVC, specifically it
3747 stores the base argument address for the cti_op_* functions in the first
3748 argument, and then does the required stack manipulation through that pointer.
3749 This is necessary as MSVC's optimisations assume they have complete control
3750 of the stack, and periodically elide our stack manipulations, or move
3751 values in unexpected ways. MSVC also frequently produces tail calls which may
3752 clobber the first argument, so the MSVC path is slightly less efficient due
3753 to the need to restore it.
3755 * JavaScriptCore.xcodeproj/project.pbxproj:
3758 (KJS::CTI::compileOpCall):
3759 (KJS::CTI::privateCompileMainPass):
3760 (KJS::CTI::privateCompileSlowCases):
3764 * masm/MacroAssembler.h:
3765 (KJS::MacroAssembler::emitConvertToFastCall):
3766 * masm/MacroAssemblerIA32GCC.cpp: Removed.
3767 For performance reasons we need these no-op functions to be inlined.
3769 * masm/MacroAssemblerWin.cpp:
3770 (KJS::MacroAssembler::emitRestoreArgumentReference):
3773 2008-09-05 Geoffrey Garen <ggaren@apple.com>
3775 Reviewed by Maciej Stachowiak, or maybe the other way around.
3777 Added the ability to coalesce JITCode buffer grow operations by first
3778 growing the buffer and then executing unchecked puts to it.
3780 About a 2% speedup on date-format-tofte.
3783 (KJS::CTI::compileOpCall):
3784 * masm/IA32MacroAsm.h:
3785 (KJS::JITCodeBuffer::ensureSpace):
3786 (KJS::JITCodeBuffer::putByteUnchecked):
3787 (KJS::JITCodeBuffer::putByte):
3788 (KJS::JITCodeBuffer::putShortUnchecked):
3789 (KJS::JITCodeBuffer::putShort):
3790 (KJS::JITCodeBuffer::putIntUnchecked):
3791 (KJS::JITCodeBuffer::putInt):
3792 (KJS::IA32MacroAssembler::emitTestl_i32r):
3793 (KJS::IA32MacroAssembler::emitMovl_mr):
3794 (KJS::IA32MacroAssembler::emitMovl_rm):
3795 (KJS::IA32MacroAssembler::emitMovl_i32m):
3796 (KJS::IA32MacroAssembler::emitUnlinkedJe):
3797 (KJS::IA32MacroAssembler::emitModRm_rr):
3798 (KJS::IA32MacroAssembler::emitModRm_rr_Unchecked):
3799 (KJS::IA32MacroAssembler::emitModRm_rm_Unchecked):
3800 (KJS::IA32MacroAssembler::emitModRm_rm):
3801 (KJS::IA32MacroAssembler::emitModRm_opr):
3802 (KJS::IA32MacroAssembler::emitModRm_opr_Unchecked):
3803 (KJS::IA32MacroAssembler::emitModRm_opm_Unchecked):
3805 2008-09-05 Mark Rowe <mrowe@apple.com>
3807 Reviewed by Sam Weinig.
3809 Disable WREC and CTI on platforms that we have not yet had a chance to test with.
3813 2008-09-05 Geoffrey Garen <ggaren@apple.com>
3815 Reviewed by Sam Weinig.
3817 Use jo instead of a mask compare when fetching array.length and
3818 string.length. 4% speedup on array.length / string.length torture
3822 (KJS::CTI::privateArrayLengthTrampoline):
3823 (KJS::CTI::privateStringLengthTrampoline):
3825 2008-09-05 Geoffrey Garen <ggaren@apple.com>
3827 Reviewed by Sam Weinig.
3829 Removed a CTI compilation pass by recording labels during bytecode
3830 generation. This is more to reduce complexity than it is to improve
3833 SunSpider reports no change.
3835 CodeBlock now keeps a "labels" set, which holds the offsets of all the
3836 instructions that can be jumped to.
3838 * VM/CTI.cpp: Nixed a pass.
3840 * VM/CodeBlock.h: Added a "labels" set.
3842 * VM/LabelID.h: No need for a special LableID for holding jump
3843 destinations, since the CodeBlock now knows all jump destinations.
3845 * wtf/HashTraits.h: New hash traits to accomodate putting offset 0 in
3849 (KJS::TryNode::emitCode): Emit a dummy label to record sret targets.
3851 2008-09-05 Mark Rowe <mrowe@apple.com>
3853 Reviewed by Oliver Hunt and Gavin Barraclough.
3855 Move the JITCodeBuffer onto Machine and remove the static variables.
3857 * VM/CTI.cpp: Initialize m_jit with the Machine's code buffer.
3859 (KJS::Machine::Machine): Allocate a JITCodeBuffer.
3861 * kjs/RegExpConstructor.cpp:
3862 (KJS::constructRegExp): Pass the ExecState through.
3863 * kjs/RegExpPrototype.cpp:
3864 (KJS::regExpProtoFuncCompile): Ditto.
3865 * kjs/StringPrototype.cpp:
3866 (KJS::stringProtoFuncMatch): Ditto.
3867 (KJS::stringProtoFuncSearch): Ditto.
3869 (KJS::RegExpNode::emitCode): Compile the pattern at code generation time
3870 so that we have access to an ExecState.
3872 (KJS::RegExpNode::):
3873 * kjs/nodes2string.cpp:
3875 (KJS::RegExp::RegExp): Pass the ExecState through.
3876 (KJS::RegExp::create): Ditto.
3878 * masm/IA32MacroAsm.h:
3879 (KJS::IA32MacroAssembler::IA32MacroAssembler): Reset the JITCodeBuffer when we are
3882 (KJS::WRECompiler::compile): Retrieve the JITCodeBuffer from the Machine.
3885 2008-09-05 Mark Rowe <mrowe@apple.com>
3887 Reviewed by Oliver Hunt and Gavin Barraclough.
3889 Fix the build when CTI is disabled.
3892 (KJS::CodeBlock::~CodeBlock):
3893 * VM/CodeGenerator.cpp:
3894 (KJS::prepareJumpTableForStringSwitch):
3896 (KJS::Machine::Machine):
3897 (KJS::Machine::~Machine):
3899 2008-09-05 Gavin Barraclough <barraclough@apple.com>
3901 Reviewed by Mark Rowe.
3903 Fix some windows abi issues.
3906 (KJS::CTI::privateCompileMainPass):
3907 (KJS::CTI::privateCompileSlowCases):
3909 (KJS::CallRecord::CallRecord):
3912 (KJS::Machine::cti_op_resolve_func):
3913 (KJS::Machine::cti_op_post_inc):
3914 (KJS::Machine::cti_op_resolve_with_base):
3915 (KJS::Machine::cti_op_post_dec):
3918 2008-09-05 Mark Rowe <mrowe@apple.com>
3920 Reviewed by Sam Weinig.
3922 Fix ecma/FunctionObjects/15.3.5.3.js after I broke it in r93.
3925 (KJS::Machine::cti_op_call_NotJSFunction): Restore m_callFrame to the correct value after making the native call.
3926 (KJS::Machine::cti_op_construct_NotJSConstruct): Ditto.
3928 2008-09-04 Mark Rowe <mrowe@apple.com>
3930 Reviewed by Sam Weinig.
3932 Fix fast/dom/Window/console-functions.html.
3934 The call frame on the ExecState was not being updated on calls into native functions. This meant that functions
3935 such as console.log would use the line number of the last JS function on the call stack.
3938 (KJS::Machine::cti_op_call_NotJSFunction): Update the ExecState's call frame before making a native function call,
3939 and restore it when the function is done.
3940 (KJS::Machine::cti_op_construct_NotJSConstruct): Ditto.
3942 2008-09-05 Oliver Hunt <oliver@apple.com>
3944 Start bringing up SFX on windows.
3946 Reviewed by Mark Rowe and Sam Weinig
3948 Start doing the work to bring up SFX on windows. Initially
3949 just working on WREC, as it does not make any calls so reduces
3950 the amount of code that needs to be corrected.
3952 Start abstracting the CTI JIT codegen engine.
3955 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3956 * JavaScriptCore.xcodeproj/project.pbxproj:
3958 * masm/IA32MacroAsm.h:
3959 * masm/MacroAssembler.h: Added.
3960 (KJS::MacroAssembler::MacroAssembler):
3961 * masm/MacroAssemblerIA32GCC.cpp: Added.
3962 (KJS::MacroAssembler::emitConvertToFastCall):
3963 * masm/MacroAssemblerWin.cpp: Added.
3964 (KJS::MacroAssembler::emitConvertToFastCall):
3966 (KJS::WRECompiler::parseGreedyQuantifier):
3967 (KJS::WRECompiler::parseCharacterClass):
3968 (KJS::WRECompiler::parseEscape):
3969 (KJS::WRECompiler::compilePattern):
3972 2008-09-04 Gavin Barraclough <barraclough@apple.com>
3974 Reviewed by Sam Weinig.
3976 Support for slow scripts (timeout checking).
3979 (KJS::CTI::privateCompileMainPass):
3980 (KJS::CTI::privateCompile):
3982 (KJS::slideRegisterWindowForCall):
3983 (KJS::Machine::cti_timeout_check):
3984 (KJS::Machine::cti_vm_throw):
3986 2008-09-04 Sam Weinig <sam@webkit.org>
3988 Reviewed by Mark Rowe.
3990 Third round of style cleanup.
3999 2008-09-04 Sam Weinig <sam@webkit.org>
4001 Reviewed by Jon Honeycutt.
4003 Second round of style cleanup.
4009 2008-09-04 Sam Weinig <sam@webkit.org>
4011 Reviewed by Mark Rowe.
4013 First round of style cleanup.
4017 * masm/IA32MacroAsm.h:
4021 2008-09-04 Geoffrey Garen <ggaren@apple.com>
4023 Reviewed by Mark Rowe.
4025 Merged http://trac.webkit.org/changeset/36081 to work with CTI.
4028 (KJS::Machine::tryCtiCacheGetByID):
4030 2008-09-04 Gavin Barraclough <barraclough@apple.com>
4032 Reviewed by Sam Weinig.
4034 Enable profiling in CTI.
4038 (KJS::CTI::execute):
4040 (KJS::Machine::cti_op_call_JSFunction):
4041 (KJS::Machine::cti_op_call_NotJSFunction):
4042 (KJS::Machine::cti_op_ret):
4043 (KJS::Machine::cti_op_construct_JSConstruct):
4044 (KJS::Machine::cti_op_construct_NotJSConstruct):
4046 2008-09-04 Victor Hernandez <vhernandez@apple.com>
4048 Reviewed by Geoffrey Garen.
4050 Fixed an #if to support using WREC without CTI.
4053 (KJS::RegExp::match):
4055 2008-09-04 Gavin Barraclough <barraclough@apple.com>
4057 Reviewed by Oliver Hunt.
4059 The array/string length trampolines are owned by the Machine, not the codeblock that compiled them.
4062 (KJS::CTI::privateArrayLengthTrampoline):
4063 (KJS::CTI::privateStringLengthTrampoline):
4065 (KJS::Machine::~Machine):
4068 2008-09-04 Mark Rowe <mrowe@apple.com>
4070 Reviewed by Gavin Barraclough and Sam Weinig.
4072 Fix a crash on launch of jsc when GuardMalloc is enabled.
4075 (KJS::ScopeChain::ScopeChain): Initialize m_node to 0 when we have no valid scope chain.
4076 (KJS::ScopeChain::~ScopeChain): Null-check m_node before calling deref.
4078 2008-09-03 Oliver Hunt <oliver@apple.com>
4080 Reviewed by Gavin Barraclough and Geoff Garen.
4082 Fix inspector and fast array access so that it bounds
4086 (KJS::CTI::privateCompile_pass2_Main):
4087 * masm/IA32MacroAsm.h:
4088 (KJS::IA32MacroAssembler::):
4089 (KJS::IA32MacroAssembler::emitUnlinkedJb):
4090 (KJS::IA32MacroAssembler::emitUnlinkedJbe):
4092 2008-09-03 Mark Rowe <mrowe@apple.com>
4094 Move the assertion after the InitializeAndReturn block, as
4095 that is used even when CTI is enabled.
4098 (KJS::Machine::privateExecute):
4100 2008-09-03 Mark Rowe <mrowe@apple.com>
4102 Reviewed by Sam Weinig.
4104 Replace calls to exit with ASSERT_WITH_MESSAGE or ASSERT_NOT_REACHED.
4107 (KJS::CTI::privateCompile_pass1_Scan):
4108 (KJS::CTI::privateCompile_pass2_Main):
4109 (KJS::CTI::privateCompile_pass4_SlowCases):
4111 (KJS::Machine::privateExecute):
4112 (KJS::Machine::cti_vm_throw):
4114 2008-09-03 Mark Rowe <mrowe@apple.com>
4116 Reviewed by Sam Weinig.
4118 Tweak JavaScriptCore to compile on non-x86 platforms. This is achieved
4119 by wrapping more code with ENABLE(CTI), ENABLE(WREC), and PLATFORM(X86)
4125 (KJS::CodeBlock::printStructureIDs): Use %td as the format specifier for
4126 printing a ptrdiff_t.
4130 (KJS::RegExp::RegExp):
4131 (KJS::RegExp::~RegExp):
4132 (KJS::RegExp::match):
4134 * masm/IA32MacroAsm.h:
4137 * wtf/Platform.h: Only enable CTI and WREC on x86. Add an extra define to
4138 track whether any MASM-using features are enabled.
4140 2008-09-03 Gavin Barraclough <barraclough@apple.com>
4142 Reviewed by Oliver Hunt.
4144 Copy Geoff's array/string length optimization for CTI.
4147 (KJS::CTI::privateArrayLengthTrampoline):
4148 (KJS::CTI::privateStringLengthTrampoline):
4150 (KJS::CTI::compileArrayLengthTrampoline):
4151 (KJS::CTI::compileStringLengthTrampoline):
4153 (KJS::Machine::Machine):
4154 (KJS::Machine::getCtiArrayLengthTrampoline):
4155 (KJS::Machine::getCtiStringLengthTrampoline):
4156 (KJS::Machine::tryCtiCacheGetByID):
4157 (KJS::Machine::cti_op_get_by_id_second):
4162 2008-09-03 Gavin Barraclough <barraclough@apple.com>
4164 Reviewed by Oliver Hunt.
4166 Implement fast array accesses in CTI - 2-3% progression on sunspider.
4169 (KJS::CTI::emitFastArithIntToImmNoCheck):
4170 (KJS::CTI::compileOpCall):
4171 (KJS::CTI::privateCompile_pass2_Main):
4172 (KJS::CTI::privateCompile_pass4_SlowCases):
4176 2008-09-02 Gavin Barraclough <barraclough@apple.com>
4178 Reviewed by Oliver Hunt.
4180 Enable fast property access support in CTI.
4183 (KJS::ctiSetReturnAddress):
4184 (KJS::ctiRepatchCallByReturnAddress):
4185 (KJS::CTI::privateCompile_pass2_Main):
4186 (KJS::CTI::privateCompile):
4187 (KJS::CTI::privateCompileGetByIdSelf):
4188 (KJS::CTI::privateCompileGetByIdProto):
4189 (KJS::CTI::privateCompileGetByIdChain):
4190 (KJS::CTI::privateCompilePutByIdReplace):
4192 (KJS::CTI::compileGetByIdSelf):
4193 (KJS::CTI::compileGetByIdProto):
4194 (KJS::CTI::compileGetByIdChain):
4195 (KJS::CTI::compilePutByIdReplace):
4197 (KJS::CodeBlock::~CodeBlock):
4200 (KJS::doSetReturnAddressVmThrowTrampoline):
4201 (KJS::Machine::tryCtiCachePutByID):
4202 (KJS::Machine::tryCtiCacheGetByID):
4203 (KJS::Machine::cti_op_put_by_id):
4204 (KJS::Machine::cti_op_put_by_id_second):
4205 (KJS::Machine::cti_op_put_by_id_generic):
4206 (KJS::Machine::cti_op_put_by_id_fail):
4207 (KJS::Machine::cti_op_get_by_id):
4208 (KJS::Machine::cti_op_get_by_id_second):