1 2008-09-23 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3 Reviewed by Oliver Hunt.
5 Bug 20989: Aguments constructor should put 'callee' and 'length' properties in a more efficient way
6 <https://bugs.webkit.org/show_bug.cgi?id=20989>
8 Make special cases for the 'callee' and 'length' properties in the
11 This is somewhere between a 7.8% speedup and a 10% speedup on the V8
12 Raytrace benchmark, depending on whether it is run alone or with the
16 (JSC::ArgumentsData::ArgumentsData):
17 (JSC::Arguments::Arguments):
18 (JSC::Arguments::mark):
19 (JSC::Arguments::getOwnPropertySlot):
20 (JSC::Arguments::put):
21 (JSC::Arguments::deleteProperty):
23 2008-09-23 Maciej Stachowiak <mjs@apple.com>
27 - speed up instanceof some more
28 https://bugs.webkit.org/show_bug.cgi?id=20818
30 ~2% speedup on EarleyBoyer
32 The idea here is to record in the StructureID whether the class
33 needs a special hasInstance or if it can use the normal logic from
36 Based on this I inlined the real work directly into
37 cti_op_instanceof and put the fastest checks up front and the
38 error handling at the end (so it should be fairly straightforward
39 to split off the beginning to be inlined if desired).
41 I only did this for CTI, not the bytecode interpreter.
43 * API/JSCallbackObject.h:
44 (JSC::JSCallbackObject::createStructureID):
47 (JSC::Machine::cti_op_instanceof):
49 (JSC::JSImmediate::isAnyImmediate):
51 (JSC::TypeInfo::overridesHasInstance):
52 (JSC::TypeInfo::flags):
54 2008-09-22 Darin Adler <darin@apple.com>
56 Reviewed by Sam Weinig.
58 - https://bugs.webkit.org/show_bug.cgi?id=21019
59 make FunctionBodyNode::ref/deref fast
61 Speeds up v8-raytrace by 7.2%.
64 (JSC::FunctionBodyNode::FunctionBodyNode): Initialize m_refCount to 0.
66 (JSC::FunctionBodyNode::ref): Call base class ref once, and thereafter use
68 (JSC::FunctionBodyNode::deref): Ditto, but the deref side.
70 2008-09-22 Darin Adler <darin@apple.com>
72 Pointed out by Sam Weinig.
75 (JSC::Arguments::fillArgList): Fix bad copy and paste. Oops!
77 2008-09-22 Darin Adler <darin@apple.com>
79 Reviewed by Cameron Zwarich.
81 - https://bugs.webkit.org/show_bug.cgi?id=20983
82 ArgumentsData should have some room to allocate some extra arguments inline
84 Speeds up v8-raytrace by 5%.
87 (JSC::ArgumentsData::ArgumentsData): Use a fixed buffer if there are 4 or fewer
89 (JSC::Arguments::Arguments): Use a fixed buffer if there are 4 or fewer
91 (JSC::Arguments::~Arguments): Delete the buffer if necessary.
92 (JSC::Arguments::mark): Update since extraArguments are now Register.
93 (JSC::Arguments::fillArgList): Added special case for the only case that's
94 actually used in the practice, when there are no parameters. There are some
95 other special cases in there too, but that's the only one that matters.
96 (JSC::Arguments::getOwnPropertySlot): Updated to use setValueSlot since there's
97 no operation to get you at the JSValue* inside a Register as a "slot".
99 2008-09-22 Sam Weinig <sam@webkit.org>
101 Reviewed by Maciej Stachowiak.
103 Patch for https://bugs.webkit.org/show_bug.cgi?id=21014
104 Speed up for..in by using StructureID to avoid calls to hasProperty
106 Speeds up fasta by 8%.
108 * VM/JSPropertyNameIterator.cpp:
109 (JSC::JSPropertyNameIterator::invalidate):
110 * VM/JSPropertyNameIterator.h:
111 (JSC::JSPropertyNameIterator::next):
112 * kjs/PropertyNameArray.h:
113 (JSC::PropertyNameArrayData::begin):
114 (JSC::PropertyNameArrayData::end):
115 (JSC::PropertyNameArrayData::setCachedStructureID):
116 (JSC::PropertyNameArrayData::cachedStructureID):
117 * kjs/StructureID.cpp:
118 (JSC::StructureID::getEnumerablePropertyNames):
119 (JSC::structureIDChainsAreEqual):
122 2008-09-22 Kelvin Sherlock <ksherlock@gmail.com>
124 Updated and tweaked by Sam Weinig.
126 Reviewed by Geoffrey Garen.
128 Bug 20020: Proposed enhancement to JavaScriptCore API
129 <https://bugs.webkit.org/show_bug.cgi?id=20020>
131 Add JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError, and JSObjectMakeRegExp
132 functions to create JavaScript Array, Date, Error, and RegExp objects, respectively.
134 * API/JSObjectRef.cpp: The functions
135 * API/JSObjectRef.h: Function prototype and documentation
136 * JavaScriptCore.exp: Added functions to exported function list
137 * API/tests/testapi.c: Added basic functionality tests.
139 * kjs/DateConstructor.cpp:
140 Replaced static JSObject* constructDate(ExecState* exec, JSObject*, const ArgList& args)
141 with JSObject* constructDate(ExecState* exec, const ArgList& args).
142 Added static JSObject* constructWithDateConstructor(ExecState* exec, JSObject*, const ArgList& args) function
144 * kjs/DateConstructor.h:
145 added prototype for JSObject* constructDate(ExecState* exec, const ArgList& args)
147 * kjs/ErrorConstructor.cpp:
148 removed static qualifier from ErrorInstance* constructError(ExecState* exec, const ArgList& args)
150 * kjs/ErrorConstructor.h:
151 added prototype for ErrorInstance* constructError(ExecState* exec, const ArgList& args)
153 * kjs/RegExpConstructor.cpp:
154 removed static qualifier from JSObject* constructRegExp(ExecState* exec, const ArgList& args)
156 * kjs/RegExpConstructor.h:
157 added prototype for JSObject* constructRegExp(ExecState* exec, const ArgList& args)
159 2008-09-22 Matt Lilek <webkit@mattlilek.com>
161 Not reviewed, Windows build fix.
164 * kjs/FunctionPrototype.cpp:
166 2008-09-22 Sam Weinig <sam@webkit.org>
168 Reviewed by Darin Adler.
170 Patch for https://bugs.webkit.org/show_bug.cgi?id=20982
171 Speed up the apply method of functions by special-casing array and 'arguments' objects
173 1% speedup on v8-raytrace.
175 Test: fast/js/function-apply.html
178 (JSC::Arguments::fillArgList):
180 * kjs/FunctionPrototype.cpp:
181 (JSC::functionProtoFuncApply):
183 (JSC::JSArray::fillArgList):
186 2008-09-22 Darin Adler <darin@apple.com>
188 Reviewed by Sam Weinig.
190 - https://bugs.webkit.org/show_bug.cgi?id=20993
191 Array.push/pop need optimized cases for JSArray
193 3% or so speedup on DeltaBlue benchmark.
195 * kjs/ArrayPrototype.cpp:
196 (JSC::arrayProtoFuncPop): Call JSArray::pop when appropriate.
197 (JSC::arrayProtoFuncPush): Call JSArray::push when appropriate.
200 (JSC::JSArray::putSlowCase): Set m_fastAccessCutoff when appropriate, getting
201 us into the fast code path.
202 (JSC::JSArray::pop): Added.
203 (JSC::JSArray::push): Added.
204 * kjs/JSArray.h: Added push and pop.
206 * kjs/operations.cpp:
207 (JSC::throwOutOfMemoryError): Don't inline this. Helps us avoid PIC branches.
209 2008-09-22 Maciej Stachowiak <mjs@apple.com>
211 Reviewed by Cameron Zwarich.
213 - speed up instanceof operator by replacing implementsHasInstance method with a TypeInfo flag
215 Partial work towards <https://bugs.webkit.org/show_bug.cgi?id=20818>
217 2.2% speedup on EarleyBoyer benchmark.
219 * API/JSCallbackConstructor.cpp:
220 * API/JSCallbackConstructor.h:
221 (JSC::JSCallbackConstructor::createStructureID):
222 * API/JSCallbackFunction.cpp:
223 * API/JSCallbackFunction.h:
224 (JSC::JSCallbackFunction::createStructureID):
225 * API/JSCallbackObject.h:
226 (JSC::JSCallbackObject::createStructureID):
227 * API/JSCallbackObjectFunctions.h:
228 (JSC::::hasInstance):
229 * API/JSValueRef.cpp:
230 (JSValueIsInstanceOfConstructor):
231 * JavaScriptCore.exp:
233 (JSC::Machine::privateExecute):
234 (JSC::Machine::cti_op_instanceof):
235 * kjs/InternalFunction.cpp:
236 * kjs/InternalFunction.h:
237 (JSC::InternalFunction::createStructureID):
241 (JSC::TypeInfo::implementsHasInstance):
243 2008-09-22 Maciej Stachowiak <mjs@apple.com>
245 Reviewed by Dave Hyatt.
247 Based on initial work by Darin Adler.
249 - replace masqueradesAsUndefined virtual method with a flag in TypeInfo
250 - use this to JIT inline code for eq_null and neq_null
251 https://bugs.webkit.org/show_bug.cgi?id=20823
253 0.5% speedup on SunSpider
254 ~4% speedup on Richards benchmark
257 (JSC::CTI::privateCompileMainPass):
259 (JSC::jsTypeStringForValue):
260 (JSC::jsIsObjectType):
261 (JSC::Machine::privateExecute):
262 (JSC::Machine::cti_op_is_undefined):
266 * kjs/StringObjectThatMasqueradesAsUndefined.h:
267 (JSC::StringObjectThatMasqueradesAsUndefined::create):
268 (JSC::StringObjectThatMasqueradesAsUndefined::createStructureID):
270 (JSC::StructureID::mutableTypeInfo):
272 (JSC::TypeInfo::TypeInfo):
273 (JSC::TypeInfo::masqueradesAsUndefined):
274 * kjs/operations.cpp:
276 * masm/X86Assembler.h:
277 (JSC::X86Assembler::):
278 (JSC::X86Assembler::setne_r):
279 (JSC::X86Assembler::setnz_r):
280 (JSC::X86Assembler::testl_i32m):
282 2008-09-22 Tor Arne Vestbø <tavestbo@trolltech.com>
286 Initialize QCoreApplication in kjs binary/Shell.cpp
288 This allows us to use QCoreApplication::instance() to
289 get the main thread in ThreadingQt.cpp
293 * wtf/ThreadingQt.cpp:
294 (WTF::initializeThreading):
296 2008-09-21 Darin Adler <darin@apple.com>
298 - blind attempt to fix non-all-in-one builds
300 * kjs/JSGlobalObject.cpp: Added includes of Arguments.h and RegExpObject.h.
302 2008-09-21 Darin Adler <darin@apple.com>
306 * kjs/StructureID.cpp:
307 (JSC::StructureID::addPropertyTransition): Use typeInfo().type() instead of m_type.
308 (JSC::StructureID::createCachedPrototypeChain): Ditto.
310 2008-09-21 Maciej Stachowiak <mjs@apple.com>
312 Reviewed by Darin Adler.
314 - introduce a TypeInfo class, for holding per-type (in the C++ class sense) date in StructureID
315 https://bugs.webkit.org/show_bug.cgi?id=20981
317 * JavaScriptCore.exp:
318 * JavaScriptCore.xcodeproj/project.pbxproj:
320 (JSC::CTI::privateCompileMainPass):
321 (JSC::CTI::privateCompilePutByIdTransition):
323 (JSC::jsIsObjectType):
324 (JSC::Machine::Machine):
325 * kjs/AllInOneFile.cpp:
327 (JSC::JSCell::isObject):
328 (JSC::JSCell::isString):
329 * kjs/JSGlobalData.cpp:
330 (JSC::JSGlobalData::JSGlobalData):
331 * kjs/JSGlobalObject.cpp:
332 (JSC::JSGlobalObject::reset):
333 * kjs/JSGlobalObject.h:
334 (JSC::StructureID::prototypeForLookup):
335 * kjs/JSNumberCell.h:
336 (JSC::JSNumberCell::createStructureID):
338 (JSC::JSObject::createInheritorID):
340 (JSC::JSObject::createStructureID):
342 (JSC::JSString::createStructureID):
343 * kjs/NativeErrorConstructor.cpp:
344 (JSC::NativeErrorConstructor::NativeErrorConstructor):
345 * kjs/RegExpConstructor.cpp:
346 * kjs/RegExpMatchesArray.h: Added.
347 (JSC::RegExpMatchesArray::getOwnPropertySlot):
348 (JSC::RegExpMatchesArray::put):
349 (JSC::RegExpMatchesArray::deleteProperty):
350 (JSC::RegExpMatchesArray::getPropertyNames):
351 * kjs/StructureID.cpp:
352 (JSC::StructureID::StructureID):
353 (JSC::StructureID::addPropertyTransition):
354 (JSC::StructureID::toDictionaryTransition):
355 (JSC::StructureID::changePrototypeTransition):
356 (JSC::StructureID::getterSetterTransition):
358 (JSC::StructureID::create):
359 (JSC::StructureID::typeInfo):
360 * kjs/TypeInfo.h: Added.
361 (JSC::TypeInfo::TypeInfo):
362 (JSC::TypeInfo::type):
364 2008-09-21 Darin Adler <darin@apple.com>
366 Reviewed by Cameron Zwarich.
368 - fix crash logging into Gmail due to recent Arguments change
371 (JSC::Arguments::Arguments): Fix window where mark() function could
372 see d->extraArguments with uninitialized contents.
373 (JSC::Arguments::mark): Check d->extraArguments for 0 to handle two
374 cases: 1) Inside the constructor before it's initialized.
375 2) numArguments <= numParameters.
377 2008-09-21 Darin Adler <darin@apple.com>
379 - fix loose end from the "duplicate constant values" patch
381 * VM/CodeGenerator.cpp:
382 (JSC::CodeGenerator::emitLoad): Add a special case for values the
383 hash table can't handle.
385 2008-09-21 Mark Rowe <mrowe@apple.com>
387 Fix the non-AllInOneFile build.
389 * kjs/Arguments.cpp: Add missing #include.
391 2008-09-21 Darin Adler <darin@apple.com>
393 Reviewed by Cameron Zwarich and Mark Rowe.
395 - fix test failure caused by my recent IndexToNameMap patch
398 (JSC::Arguments::deleteProperty): Added the accidentally-omitted
399 check of the boolean result from toArrayIndex.
401 2008-09-21 Darin Adler <darin@apple.com>
403 Reviewed by Maciej Stachowiak.
405 - https://bugs.webkit.org/show_bug.cgi?id=20975
406 inline immediate-number case of ==
408 * VM/CTI.h: Renamed emitJumpSlowCaseIfNotImm to
409 emitJumpSlowCaseIfNotImmNum, since the old name was incorrect.
411 * VM/CTI.cpp: Updated for new name.
412 (JSC::CTI::privateCompileMainPass): Added op_eq.
413 (JSC::CTI::privateCompileSlowCases): Added op_eq.
416 (JSC::Machine::cti_op_eq): Removed fast case, since it's now
419 2008-09-21 Peter Gal <galpter@inf.u-szeged.hu>
421 Reviewed by Tim Hatcher and Eric Seidel.
423 Fix the QT/Linux JavaScriptCore segmentation fault.
424 https://bugs.webkit.org/show_bug.cgi?id=20914
426 * wtf/ThreadingQt.cpp:
427 (WTF::initializeThreading): Use currentThread() if
428 platform is not a MAC (like in pre 36541 revisions)
430 2008-09-21 Darin Adler <darin@apple.com>
432 Reviewed by Sam Weinig.
434 * kjs/debugger.h: Removed some unneeded includes and declarations.
436 2008-09-21 Darin Adler <darin@apple.com>
438 Reviewed by Sam Weinig.
440 - https://bugs.webkit.org/show_bug.cgi?id=20972
441 speed up Arguments further by eliminating the IndexToNameMap
443 No change on SunSpider. 1.29x as fast on V8 Raytrace.
445 * kjs/Arguments.cpp: Moved ArgumentsData in here. Eliminated the
446 indexToNameMap and hadDeletes data members. Changed extraArguments into
447 an OwnArrayPtr and added deletedArguments, another OwnArrayPtr.
448 Replaced numExtraArguments with numParameters, since that's what's
449 used more directly in hot code paths.
450 (JSC::Arguments::Arguments): Pass in argument count instead of ArgList.
451 Initialize ArgumentsData the new way.
452 (JSC::Arguments::mark): Updated.
453 (JSC::Arguments::getOwnPropertySlot): Overload for the integer form so
454 we don't have to convert integers to identifiers just to get an argument.
455 Integrated the deleted case with the fast case.
456 (JSC::Arguments::put): Ditto.
457 (JSC::Arguments::deleteProperty): Ditto.
459 * kjs/Arguments.h: Minimized includes. Made everything private. Added
460 overloads for the integral property name case. Eliminated mappedIndexSetter.
461 Moved ArgumentsData into the .cpp file.
463 * kjs/IndexToNameMap.cpp: Emptied out and prepared for deletion.
464 * kjs/IndexToNameMap.h: Ditto.
466 * kjs/JSActivation.cpp:
467 (JSC::JSActivation::createArgumentsObject): Elminated ArgList.
470 * JavaScriptCore.pri:
471 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
472 * JavaScriptCore.xcodeproj/project.pbxproj:
473 * JavaScriptCoreSources.bkl:
474 * kjs/AllInOneFile.cpp:
475 Removed IndexToNameMap.
477 2008-09-21 Darin Adler <darin@apple.com>
479 * VM/CodeGenerator.cpp:
480 (JSC::CodeGenerator::emitLoad): One more tweak: Wrote this in a slightly
483 2008-09-21 Judit Jasz <jasy@inf.u-szeged.hu>
485 Reviewed and tweaked by Darin Adler.
487 - https://bugs.webkit.org/show_bug.cgi?id=20645
488 Elminate duplicate constant values in CodeBlocks.
490 Seems to be a wash on SunSpider.
492 * VM/CodeGenerator.cpp:
493 (JSC::CodeGenerator::emitLoad): Use m_numberMap and m_stringMap to guarantee
494 we emit the same JSValue* for identical numbers and strings.
495 * VM/CodeGenerator.h: Added overload of emitLoad for const Identifier&.
496 Add NumberMap and IdentifierStringMap types and m_numberMap and m_stringMap.
498 (JSC::StringNode::emitCode): Call the new emitLoad and let it do the
501 2008-09-21 Paul Pedriana <webkit@pedriana.com>
503 Reviewed and tweaked by Darin Adler.
505 - https://bugs.webkit.org/show_bug.cgi?id=16925
506 Fixed lack of Vector buffer alignment for both GCC and MSVC.
507 Since there's no portable way to do this, for now we don't support
510 * wtf/Vector.h: Added WTF_ALIGH_ON, WTF_ALIGNED, AlignedBufferChar, and AlignedBuffer.
511 Use AlignedBuffer insteadof an array of char in VectorBuffer.
513 2008-09-21 Gabor Loki <loki@inf.u-szeged.hu>
515 Reviewed by Darin Adler.
517 - https://bugs.webkit.org/show_bug.cgi?id=19408
518 Add lightweight constant folding to the parser for *, /, + (only for numbers), <<, >>, ~ operators.
520 1.008x as fast on SunSpider.
523 (makeNegateNode): Fold if expression is a number > 0.
524 (makeBitwiseNotNode): Fold if expression is a number.
525 (makeMultNode): Fold if expressions are both numbers.
526 (makeDivNode): Fold if expressions are both numbers.
527 (makeAddNode): Fold if expressions are both numbers.
528 (makeLeftShiftNode): Fold if expressions are both numbers.
529 (makeRightShiftNode): Fold if expressions are both numbers.
531 2008-09-21 Maciej Stachowiak <mjs@apple.com>
535 - speed up === operator by generating inline machine code for the fast paths
536 https://bugs.webkit.org/show_bug.cgi?id=20820
539 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumber):
540 (JSC::CTI::emitJumpSlowCaseIfNotImmediateNumbers):
541 (JSC::CTI::emitJumpSlowCaseIfNotImmediates):
542 (JSC::CTI::emitTagAsBoolImmediate):
543 (JSC::CTI::privateCompileMainPass):
544 (JSC::CTI::privateCompileSlowCases):
547 (JSC::Machine::cti_op_stricteq):
548 * masm/X86Assembler.h:
549 (JSC::X86Assembler::):
550 (JSC::X86Assembler::sete_r):
551 (JSC::X86Assembler::setz_r):
552 (JSC::X86Assembler::movzbl_rr):
553 (JSC::X86Assembler::emitUnlinkedJnz):
555 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
557 Reviewed by Maciej Stachowiak.
559 Free memory allocated for extra arguments in the destructor of the
563 (JSC::Arguments::~Arguments):
566 2008-09-21 Cameron Zwarich <cwzwarich@uwaterloo.ca>
568 Reviewed by Maciej Stachowiak.
570 Bug 20815: 'arguments' object creation is non-optimal
571 <https://bugs.webkit.org/show_bug.cgi?id=20815>
573 Fix our inefficient way of creating the arguments object by only
574 creating named properties for each of the arguments after a use of the
575 'delete' statement. This patch also speeds up access to the 'arguments'
576 object slightly, but it still does not use the array fast path for
577 indexed access that exists for many opcodes.
579 This is about a 20% improvement on the V8 Raytrace benchmark, and a 1.5%
580 improvement on the Earley-Boyer benchmark, which gives a 4% improvement
584 (JSC::Arguments::Arguments):
585 (JSC::Arguments::mark):
586 (JSC::Arguments::getOwnPropertySlot):
587 (JSC::Arguments::put):
588 (JSC::Arguments::deleteProperty):
590 (JSC::Arguments::ArgumentsData::ArgumentsData):
591 * kjs/IndexToNameMap.h:
592 (JSC::IndexToNameMap::size):
593 * kjs/JSActivation.cpp:
594 (JSC::JSActivation::createArgumentsObject):
595 * kjs/JSActivation.h:
596 (JSC::JSActivation::uncheckedSymbolTableGet):
597 (JSC::JSActivation::uncheckedSymbolTableGetValue):
598 (JSC::JSActivation::uncheckedSymbolTablePut):
600 (JSC::JSFunction::numParameters):
602 2008-09-20 Darin Adler <darin@apple.com>
604 Reviewed by Mark Rowe.
606 - fix crash seen on buildbot
608 * kjs/JSGlobalObject.cpp:
609 (JSC::JSGlobalObject::mark): Add back mark of arrayPrototype,
610 deleted by accident in my recent check-in.
612 2008-09-20 Maciej Stachowiak <mjs@apple.com>
614 Not reviewed, build fix.
616 - speculative fix for non-AllInOne builds
620 2008-09-20 Maciej Stachowiak <mjs@apple.com>
622 Reviewed by Darin Adler.
624 - assorted optimizations to === and !== operators
625 (work towards <https://bugs.webkit.org/show_bug.cgi?id=20820>)
627 2.5% speedup on earley-boyer test
630 (JSC::Machine::cti_op_stricteq): Use inline version of
631 strictEqualSlowCase; remove unneeded exception check.
632 (JSC::Machine::cti_op_nstricteq): ditto
633 * kjs/operations.cpp:
634 (JSC::strictEqual): Use strictEqualSlowCaseInline
635 (JSC::strictEqualSlowCase): ditto
637 (JSC::strictEqualSlowCaseInline): Version of strictEqualSlowCase that can be inlined,
638 since the extra function call indirection is a lose for CTI.
640 2008-09-20 Darin Adler <darin@apple.com>
642 Reviewed by Maciej Stachowiak.
644 - finish https://bugs.webkit.org/show_bug.cgi?id=20858
645 make each distinct C++ class get a distinct JSC::Structure
647 This also includes some optimizations that make the change an overall
648 small speedup. Without those it was a bit of a slowdown.
650 * API/JSCallbackConstructor.cpp:
651 (JSC::JSCallbackConstructor::JSCallbackConstructor): Take a structure.
652 * API/JSCallbackConstructor.h: Ditto.
653 * API/JSCallbackFunction.cpp:
654 (JSC::JSCallbackFunction::JSCallbackFunction): Pass a structure.
655 * API/JSCallbackObject.h: Take a structure.
656 * API/JSCallbackObjectFunctions.h:
657 (JSC::JSCallbackObject::JSCallbackObject): Ditto.
659 * API/JSClassRef.cpp:
660 (OpaqueJSClass::prototype): Pass in a structure. Call setPrototype
661 if there's a custom prototype involved.
662 * API/JSObjectRef.cpp:
663 (JSObjectMake): Ditto.
664 (JSObjectMakeConstructor): Pass in a structure.
666 * JavaScriptCore.exp: Updated.
669 (JSC::jsLess): Added a special case for when both arguments are strings.
670 This avoids converting both strings to with UString::toDouble.
671 (JSC::jsLessEq): Ditto.
672 (JSC::Machine::privateExecute): Pass in a structure.
673 (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
674 (JSC::Machine::cti_op_new_regexp): Ditto.
675 (JSC::Machine::cti_op_is_string): Ditto.
676 * VM/Machine.h: Made isJSString public so it can be used in the CTI.
679 (JSC::Arguments::Arguments): Pass in a structure.
681 * kjs/JSCell.h: Mark constructor explicit.
683 * kjs/JSGlobalObject.cpp:
684 (JSC::markIfNeeded): Added an overload for marking structures.
685 (JSC::JSGlobalObject::reset): Eliminate code to set data members to
686 zero. We now do that in the constructor, and we no longer use this
687 anywhere except in the constructor. Added code to create structures.
688 Pass structures rather than prototypes when creating objects.
689 (JSC::JSGlobalObject::mark): Mark the structures.
691 * kjs/JSGlobalObject.h: Removed unneeded class declarations.
692 Added initializers for raw pointers in JSGlobalObjectData so
693 everything starts with a 0. Added structure data and accessor
696 * kjs/JSImmediate.cpp:
697 (JSC::JSImmediate::nonInlineNaN): Added.
699 (JSC::JSImmediate::toDouble): Rewrote to avoid PIC branches.
701 * kjs/JSNumberCell.cpp:
702 (JSC::jsNumberCell): Made non-inline to avoid PIC branches
703 in functions that call this one.
705 * kjs/JSNumberCell.h: Ditto.
707 * kjs/JSObject.h: Removed constructor that takes a prototype.
708 All callers now pass structures.
710 * kjs/ArrayConstructor.cpp:
711 (JSC::ArrayConstructor::ArrayConstructor):
712 (JSC::constructArrayWithSizeQuirk):
713 * kjs/ArrayConstructor.h:
714 * kjs/ArrayPrototype.cpp:
715 (JSC::ArrayPrototype::ArrayPrototype):
716 * kjs/ArrayPrototype.h:
717 * kjs/BooleanConstructor.cpp:
718 (JSC::BooleanConstructor::BooleanConstructor):
719 (JSC::constructBoolean):
720 (JSC::constructBooleanFromImmediateBoolean):
721 * kjs/BooleanConstructor.h:
722 * kjs/BooleanObject.cpp:
723 (JSC::BooleanObject::BooleanObject):
724 * kjs/BooleanObject.h:
725 * kjs/BooleanPrototype.cpp:
726 (JSC::BooleanPrototype::BooleanPrototype):
727 * kjs/BooleanPrototype.h:
728 * kjs/DateConstructor.cpp:
729 (JSC::DateConstructor::DateConstructor):
730 (JSC::constructDate):
731 * kjs/DateConstructor.h:
732 * kjs/DateInstance.cpp:
733 (JSC::DateInstance::DateInstance):
734 * kjs/DateInstance.h:
735 * kjs/DatePrototype.cpp:
736 (JSC::DatePrototype::DatePrototype):
737 * kjs/DatePrototype.h:
738 * kjs/ErrorConstructor.cpp:
739 (JSC::ErrorConstructor::ErrorConstructor):
740 (JSC::constructError):
741 * kjs/ErrorConstructor.h:
742 * kjs/ErrorInstance.cpp:
743 (JSC::ErrorInstance::ErrorInstance):
744 * kjs/ErrorInstance.h:
745 * kjs/ErrorPrototype.cpp:
746 (JSC::ErrorPrototype::ErrorPrototype):
747 * kjs/ErrorPrototype.h:
748 * kjs/FunctionConstructor.cpp:
749 (JSC::FunctionConstructor::FunctionConstructor):
750 * kjs/FunctionConstructor.h:
751 * kjs/FunctionPrototype.cpp:
752 (JSC::FunctionPrototype::FunctionPrototype):
753 (JSC::FunctionPrototype::addFunctionProperties):
754 * kjs/FunctionPrototype.h:
755 * kjs/GlobalEvalFunction.cpp:
756 (JSC::GlobalEvalFunction::GlobalEvalFunction):
757 * kjs/GlobalEvalFunction.h:
758 * kjs/InternalFunction.cpp:
759 (JSC::InternalFunction::InternalFunction):
760 * kjs/InternalFunction.h:
761 (JSC::InternalFunction::InternalFunction):
763 (JSC::JSArray::JSArray):
764 (JSC::constructEmptyArray):
765 (JSC::constructArray):
767 * kjs/JSFunction.cpp:
768 (JSC::JSFunction::JSFunction):
769 (JSC::JSFunction::construct):
771 (JSC::constructEmptyObject):
773 (JSC::StringObject::create):
774 * kjs/JSWrapperObject.h:
775 * kjs/MathObject.cpp:
776 (JSC::MathObject::MathObject):
778 * kjs/NativeErrorConstructor.cpp:
779 (JSC::NativeErrorConstructor::NativeErrorConstructor):
780 (JSC::NativeErrorConstructor::construct):
781 * kjs/NativeErrorConstructor.h:
782 * kjs/NativeErrorPrototype.cpp:
783 (JSC::NativeErrorPrototype::NativeErrorPrototype):
784 * kjs/NativeErrorPrototype.h:
785 * kjs/NumberConstructor.cpp:
786 (JSC::NumberConstructor::NumberConstructor):
787 (JSC::constructWithNumberConstructor):
788 * kjs/NumberConstructor.h:
789 * kjs/NumberObject.cpp:
790 (JSC::NumberObject::NumberObject):
791 (JSC::constructNumber):
792 (JSC::constructNumberFromImmediateNumber):
793 * kjs/NumberObject.h:
794 * kjs/NumberPrototype.cpp:
795 (JSC::NumberPrototype::NumberPrototype):
796 * kjs/NumberPrototype.h:
797 * kjs/ObjectConstructor.cpp:
798 (JSC::ObjectConstructor::ObjectConstructor):
799 (JSC::constructObject):
800 * kjs/ObjectConstructor.h:
801 * kjs/ObjectPrototype.cpp:
802 (JSC::ObjectPrototype::ObjectPrototype):
803 * kjs/ObjectPrototype.h:
804 * kjs/PrototypeFunction.cpp:
805 (JSC::PrototypeFunction::PrototypeFunction):
806 * kjs/PrototypeFunction.h:
807 * kjs/RegExpConstructor.cpp:
808 (JSC::RegExpConstructor::RegExpConstructor):
809 (JSC::RegExpMatchesArray::RegExpMatchesArray):
810 (JSC::constructRegExp):
811 * kjs/RegExpConstructor.h:
812 * kjs/RegExpObject.cpp:
813 (JSC::RegExpObject::RegExpObject):
814 * kjs/RegExpObject.h:
815 * kjs/RegExpPrototype.cpp:
816 (JSC::RegExpPrototype::RegExpPrototype):
817 * kjs/RegExpPrototype.h:
819 (GlobalObject::GlobalObject):
820 * kjs/StringConstructor.cpp:
821 (JSC::StringConstructor::StringConstructor):
822 (JSC::constructWithStringConstructor):
823 * kjs/StringConstructor.h:
824 * kjs/StringObject.cpp:
825 (JSC::StringObject::StringObject):
826 * kjs/StringObject.h:
827 * kjs/StringObjectThatMasqueradesAsUndefined.h:
828 (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
829 * kjs/StringPrototype.cpp:
830 (JSC::StringPrototype::StringPrototype):
831 * kjs/StringPrototype.h:
832 Take and pass structures.
834 2008-09-19 Alp Toker <alp@nuanti.com>
836 Build fix for the 'gold' linker and recent binutils. New behaviour
837 requires that we link to used libraries explicitly.
841 2008-09-19 Sam Weinig <sam@webkit.org>
843 Roll r36694 back in. It did not cause the crash.
845 * JavaScriptCore.exp:
846 * VM/JSPropertyNameIterator.cpp:
847 (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
848 (JSC::JSPropertyNameIterator::invalidate):
849 * VM/JSPropertyNameIterator.h:
850 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
851 (JSC::JSPropertyNameIterator::create):
853 (JSC::JSObject::getPropertyNames):
854 * kjs/PropertyMap.cpp:
855 (JSC::PropertyMap::getEnumerablePropertyNames):
857 * kjs/PropertyNameArray.cpp:
858 (JSC::PropertyNameArray::add):
859 * kjs/PropertyNameArray.h:
860 (JSC::PropertyNameArrayData::create):
861 (JSC::PropertyNameArrayData::propertyNameVector):
862 (JSC::PropertyNameArrayData::setCachedPrototypeChain):
863 (JSC::PropertyNameArrayData::cachedPrototypeChain):
864 (JSC::PropertyNameArrayData::begin):
865 (JSC::PropertyNameArrayData::end):
866 (JSC::PropertyNameArrayData::PropertyNameArrayData):
867 (JSC::PropertyNameArray::PropertyNameArray):
868 (JSC::PropertyNameArray::addKnownUnique):
869 (JSC::PropertyNameArray::size):
870 (JSC::PropertyNameArray::operator[]):
871 (JSC::PropertyNameArray::begin):
872 (JSC::PropertyNameArray::end):
873 (JSC::PropertyNameArray::setData):
874 (JSC::PropertyNameArray::data):
875 (JSC::PropertyNameArray::releaseData):
876 * kjs/StructureID.cpp:
877 (JSC::structureIDChainsAreEqual):
878 (JSC::StructureID::getEnumerablePropertyNames):
879 (JSC::StructureID::clearEnumerationCache):
880 (JSC::StructureID::createCachedPrototypeChain):
883 2008-09-19 Sam Weinig <sam@webkit.org>
887 * JavaScriptCore.exp:
888 * VM/JSPropertyNameIterator.cpp:
889 (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
890 (JSC::JSPropertyNameIterator::invalidate):
891 * VM/JSPropertyNameIterator.h:
892 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
893 (JSC::JSPropertyNameIterator::create):
895 (JSC::JSObject::getPropertyNames):
896 * kjs/PropertyMap.cpp:
897 (JSC::PropertyMap::getEnumerablePropertyNames):
899 * kjs/PropertyNameArray.cpp:
900 (JSC::PropertyNameArray::add):
901 * kjs/PropertyNameArray.h:
902 (JSC::PropertyNameArray::PropertyNameArray):
903 (JSC::PropertyNameArray::addKnownUnique):
904 (JSC::PropertyNameArray::begin):
905 (JSC::PropertyNameArray::end):
906 (JSC::PropertyNameArray::size):
907 (JSC::PropertyNameArray::operator[]):
908 (JSC::PropertyNameArray::releaseIdentifiers):
909 * kjs/StructureID.cpp:
910 (JSC::StructureID::getEnumerablePropertyNames):
912 (JSC::StructureID::clearEnumerationCache):
914 2008-09-19 Oliver Hunt <oliver@apple.com>
916 Reviewed by Maciej Stachowiak.
918 Improve peformance of local variable initialisation.
920 Pull local and constant initialisation out of slideRegisterWindowForCall
921 and into its own opcode. This allows the JIT to generate the initialisation
922 code for a function directly into the instruction stream and so avoids a few
923 branches on function entry.
925 Results a 1% progression in SunSpider, particularly in a number of the bitop
926 tests where the called functions are very fast.
929 (JSC::CTI::emitInitialiseRegister):
930 (JSC::CTI::privateCompileMainPass):
933 (JSC::CodeBlock::dump):
934 * VM/CodeGenerator.cpp:
935 (JSC::CodeGenerator::CodeGenerator):
937 (JSC::slideRegisterWindowForCall):
938 (JSC::Machine::privateExecute):
941 2008-09-19 Sam Weinig <sam@webkit.org>
943 Reviewed by Darin Adler.
945 Patch for https://bugs.webkit.org/show_bug.cgi?id=20928
946 Speed up JS property enumeration by caching entire PropertyNameArray
948 1.3% speedup on Sunspider, 30% on string-fasta.
950 * JavaScriptCore.exp:
951 * VM/JSPropertyNameIterator.cpp:
952 (JSC::JSPropertyNameIterator::~JSPropertyNameIterator):
953 (JSC::JSPropertyNameIterator::invalidate):
954 * VM/JSPropertyNameIterator.h:
955 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
956 (JSC::JSPropertyNameIterator::create):
958 (JSC::JSObject::getPropertyNames):
959 * kjs/PropertyMap.cpp:
960 (JSC::PropertyMap::getEnumerablePropertyNames):
962 * kjs/PropertyNameArray.cpp:
963 (JSC::PropertyNameArray::add):
964 * kjs/PropertyNameArray.h:
965 (JSC::PropertyNameArrayData::create):
966 (JSC::PropertyNameArrayData::propertyNameVector):
967 (JSC::PropertyNameArrayData::setCachedPrototypeChain):
968 (JSC::PropertyNameArrayData::cachedPrototypeChain):
969 (JSC::PropertyNameArrayData::begin):
970 (JSC::PropertyNameArrayData::end):
971 (JSC::PropertyNameArrayData::PropertyNameArrayData):
972 (JSC::PropertyNameArray::PropertyNameArray):
973 (JSC::PropertyNameArray::addKnownUnique):
974 (JSC::PropertyNameArray::size):
975 (JSC::PropertyNameArray::operator[]):
976 (JSC::PropertyNameArray::begin):
977 (JSC::PropertyNameArray::end):
978 (JSC::PropertyNameArray::setData):
979 (JSC::PropertyNameArray::data):
980 (JSC::PropertyNameArray::releaseData):
981 * kjs/ScopeChain.cpp:
982 (JSC::ScopeChainNode::print):
983 * kjs/StructureID.cpp:
984 (JSC::structureIDChainsAreEqual):
985 (JSC::StructureID::getEnumerablePropertyNames):
986 (JSC::StructureID::clearEnumerationCache):
987 (JSC::StructureID::createCachedPrototypeChain):
990 2008-09-19 Holger Hans Peter Freyther <zecke@selfish.org>
992 Reviewed by Maciej Stachowiak.
994 Fix a mismatched new[]/delete in JSObject::allocatePropertyStorage
997 (JSC::JSObject::allocatePropertyStorage): Spotted by valgrind.
999 2008-09-19 Darin Adler <darin@apple.com>
1001 Reviewed by Sam Weinig.
1003 - part 2 of https://bugs.webkit.org/show_bug.cgi?id=20858
1004 make each distinct C++ class get a distinct JSC::Structure
1006 * JavaScriptCore.exp: Exported constructEmptyObject for use in WebCore.
1008 * kjs/JSGlobalObject.h: Changed the protected constructor to take a
1009 structure instead of a prototype.
1011 * kjs/JSVariableObject.h: Removed constructor that takes a prototype.
1013 2008-09-19 Julien Chaffraix <jchaffraix@pleyo.com>
1015 Reviewed by Alexey Proskuryakov.
1017 Use the template hoisting technique on the RefCounted class. This reduces the code bloat due to
1018 non-template methods' code been copied for each instance of the template.
1019 The patch splits RefCounted between a base class that holds non-template methods and attributes
1020 and the template RefCounted class that keeps the same functionnality.
1022 On my Linux with gcc 4.3 for the Gtk port, this is:
1023 - a ~600KB save on libwebkit.so in release.
1024 - a ~1.6MB save on libwebkit.so in debug.
1026 It is a wash on Sunspider and a small win on Dromaeo (not sure it is relevant).
1027 On the whole, it should be a small win as we reduce the compiled code size and the only
1028 new function call should be inlined by the compiler.
1031 (WTF::RefCountedBase::ref): Copied from RefCounted.
1032 (WTF::RefCountedBase::hasOneRef): Ditto.
1033 (WTF::RefCountedBase::refCount): Ditto.
1034 (WTF::RefCountedBase::RefCountedBase): Ditto.
1035 (WTF::RefCountedBase::~RefCountedBase): Ditto.
1036 (WTF::RefCountedBase::derefBase): Tweaked from the RefCounted version to remove
1038 (WTF::RefCounted::RefCounted):
1039 (WTF::RefCounted::deref): Small wrapper around RefCountedBase::derefBase().
1040 (WTF::RefCounted::~RefCounted): Keep private destructor.
1042 2008-09-18 Darin Adler <darin@apple.com>
1044 Reviewed by Maciej Stachowiak.
1046 - part 1 of https://bugs.webkit.org/show_bug.cgi?id=20858
1047 make each distinct C++ class get a distinct JSC::Structure
1049 * kjs/lookup.h: Removed things here that were used only in WebCore:
1050 cacheGlobalObject, JSC_DEFINE_PROTOTYPE, JSC_DEFINE_PROTOTYPE_WITH_PROTOTYPE,
1051 and JSC_IMPLEMENT_PROTOTYPE.
1053 2008-09-18 Darin Adler <darin@apple.com>
1055 Reviewed by Maciej Stachowiak.
1057 - https://bugs.webkit.org/show_bug.cgi?id=20927
1058 simplify/streamline the code to turn strings into identifiers while parsing
1060 * kjs/grammar.y: Get rid of string from the union, and use ident for STRING as
1064 (JSC::Lexer::lex): Use makeIdentifier instead of makeUString for String.
1065 * kjs/lexer.h: Remove makeUString.
1067 * kjs/nodes.h: Changed StringNode to hold an Identifier instead of UString.
1069 * VM/CodeGenerator.cpp:
1070 (JSC::keyForCharacterSwitch): Updated since StringNode now holds an Identifier.
1071 (JSC::prepareJumpTableForStringSwitch): Ditto.
1073 (JSC::StringNode::emitCode): Ditto. The comment from here is now in the lexer.
1074 (JSC::processClauseList): Ditto.
1075 * kjs/nodes2string.cpp:
1076 (JSC::StringNode::streamTo): Ditto.
1078 2008-09-18 Sam Weinig <sam@webkit.org>
1083 (JSC::Instruction::Instruction):
1085 2008-09-18 Oliver Hunt <oliver@apple.com>
1087 Reviewed by Maciej Stachowiak.
1089 Bug 20911: REGRESSION(r36480?): Reproducible assertion failure below derefStructureIDs 64-bit JavaScriptCore
1090 <https://bugs.webkit.org/show_bug.cgi?id=20911>
1092 The problem was simply caused by the int constructor for Instruction
1093 failing to initialise the full struct in 64bit builds.
1096 (JSC::Instruction::Instruction):
1098 2008-09-18 Darin Adler <darin@apple.com>
1102 * wtf/RefCountedLeakCounter.cpp: Removed stray "static".
1104 2008-09-18 Darin Adler <darin@apple.com>
1106 Reviewed by Sam Weinig.
1108 * kjs/JSGlobalObject.h: Tiny style guideline tweak.
1110 2008-09-18 Darin Adler <darin@apple.com>
1112 Reviewed by Sam Weinig.
1114 - fix https://bugs.webkit.org/show_bug.cgi?id=20925
1115 LEAK messages appear every time I quit
1117 * JavaScriptCore.exp: Updated, and also added an export
1118 needed for future WebCore use of JSC::StructureID.
1120 * wtf/RefCountedLeakCounter.cpp:
1121 (WTF::RefCountedLeakCounter::suppressMessages): Added.
1122 (WTF::RefCountedLeakCounter::cancelMessageSuppression): Added.
1123 (WTF::RefCountedLeakCounter::RefCountedLeakCounter): Tweaked a bit.
1124 (WTF::RefCountedLeakCounter::~RefCountedLeakCounter): Added code to
1125 log the reason there was no leak checking done.
1126 (WTF::RefCountedLeakCounter::increment): Tweaked a bit.
1127 (WTF::RefCountedLeakCounter::decrement): Ditto.
1129 * wtf/RefCountedLeakCounter.h: Replaced setLogLeakMessages with two
1130 new functions, suppressMessages and cancelMessageSuppression. Also
1131 added m_ prefixes to the data member names.
1133 2008-09-18 Holger Hans Peter Freyther <zecke@selfish.org>
1135 Reviewed by Mark Rowe.
1137 https://bugs.webkit.org/show_bug.cgi?id=20437
1139 Add a proper #define to define which XML Parser implementation to use. Client
1140 code can use #if USE(QXMLSTREAM) to decide if the Qt XML StreamReader
1141 implementation is going to be used.
1145 2008-09-18 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1147 Reviewed by Maciej Stachowiak.
1149 Make a Unicode non-breaking space count as a whitespace character in
1150 PCRE. This change was already made in WREC, and it fixes one of the
1151 Mozilla JS tests. Since it is now fixed in PCRE as well, we can check
1152 in a new set of expected test results.
1154 * pcre/pcre_internal.h:
1156 * tests/mozilla/expected.html:
1158 2008-09-18 Stephanie Lewis <slewis@apple.com>
1160 Reviewed by Mark Rowe and Maciej Stachowiak.
1162 add an option use arch to specify which architecture to run.
1164 * tests/mozilla/jsDriver.pl:
1166 2008-09-17 Oliver Hunt <oliver@apple.com>
1168 Correctly restore argument reference prior to SFX runtime calls.
1170 Reviewed by Steve Falkenburg.
1173 (JSC::CTI::privateCompileSlowCases):
1174 (JSC::CTI::privateCompile):
1176 2008-09-17 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1178 Reviewed by Maciej Stachowiak.
1180 Bug 20876: REGRESSION (r36417, r36427): fast/js/exception-expression-offset.html fails
1181 <https://bugs.webkit.org/show_bug.cgi?id=20876>
1183 r36417 and r36427 caused an get_by_id opcode to be emitted before the
1184 instanceof and construct opcodes, in order to enable inline caching of
1185 the prototype property. Unfortunately, this regressed some tests dealing
1186 with exceptions thrown by 'instanceof' and the 'new' operator. We fix
1187 these problems by detecting whether an "is not an object" exception is
1188 thrown before op_instanceof or op_construct, and emit the proper
1189 exception in those cases.
1191 * VM/CodeGenerator.cpp:
1192 (JSC::CodeGenerator::emitConstruct):
1193 * VM/CodeGenerator.h:
1194 * VM/ExceptionHelpers.cpp:
1195 (JSC::createInvalidParamError):
1196 (JSC::createNotAConstructorError):
1197 (JSC::createNotAnObjectError):
1198 * VM/ExceptionHelpers.h:
1200 (JSC::Machine::getOpcode):
1201 (JSC::Machine::privateExecute):
1204 (JSC::NewExprNode::emitCode):
1205 (JSC::InstanceOfNode::emitCode):
1207 2008-09-17 Gavin Barraclough <barraclough@apple.com>
1209 Reviewed by Oliver Hunt.
1211 JIT generation cti_op_construct_verify.
1213 Quarter to half percent progression on v8-tests.
1214 Roughly not change on SunSpider (possible minor progression).
1217 (JSC::CTI::privateCompileMainPass):
1221 2008-09-15 Steve Falkenburg <sfalken@apple.com>
1223 Improve timer accuracy for JavaScript Date object on Windows.
1225 Use a combination of ftime and QueryPerformanceCounter.
1226 ftime returns the information we want, but doesn't have sufficient resolution.
1227 QueryPerformanceCounter has high resolution, but is only usable to measure time intervals.
1228 To combine them, we call ftime and QueryPerformanceCounter initially. Later calls will use
1229 QueryPerformanceCounter by itself, adding the delta to the saved ftime. We re-sync to
1230 correct for drift if the low-res and high-res elapsed time between calls differs by more
1231 than twice the low-resolution timer resolution.
1233 QueryPerformanceCounter may be inaccurate due to a problems with:
1234 - some PCI bridge chipsets (http://support.microsoft.com/kb/274323)
1235 - BIOS bugs (http://support.microsoft.com/kb/895980/)
1236 - BIOS/HAL bugs on multiprocessor/multicore systems (http://msdn.microsoft.com/en-us/library/ms644904.aspx)
1238 Reviewed by Darin Adler.
1241 (JSC::highResUpTime):
1242 (JSC::lowResUTCTime):
1243 (JSC::qpcAvailable):
1244 (JSC::getCurrentUTCTimeWithMicroseconds):
1246 2008-09-17 Gavin Barraclough <barraclough@apple.com>
1248 Reviewed by Geoff Garen.
1250 Implement JIT generation of CallFrame initialization, for op_call.
1252 1% sunspider 2.5% v8-tests.
1255 (JSC::CTI::compileOpCall):
1257 (JSC::Machine::cti_op_call_JSFunction):
1258 (JSC::Machine::cti_op_call_NotJSFunction):
1260 2008-09-17 Gavin Barraclough <barraclough@apple.com>
1262 Reviewed by Geoff Garen.
1264 Optimizations for op_call in CTI. Move check for (ctiCode == 0) into JIT code,
1265 move copying of scopeChain for CodeBlocks that needFullScopeChain into head of
1266 functions, instead of checking prior to making the call.
1268 3% on v8-tests (4% on richards, 6% in delta-blue)
1271 (JSC::CTI::compileOpCall):
1272 (JSC::CTI::privateCompileSlowCases):
1273 (JSC::CTI::privateCompile):
1275 (JSC::Machine::execute):
1276 (JSC::Machine::cti_op_call_JSFunction):
1277 (JSC::Machine::cti_vm_compile):
1278 (JSC::Machine::cti_vm_updateScopeChain):
1279 (JSC::Machine::cti_op_construct_JSConstruct):
1282 2008-09-17 Tor Arne Vestbø <tavestbo@trolltech.com>
1284 Fix the QtWebKit/Mac build
1286 * wtf/ThreadingQt.cpp:
1287 (WTF::initializeThreading): use QCoreApplication to get the main thread
1289 2008-09-16 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1291 Reviewed by Maciej Stachowiak.
1293 Bug 20857: REGRESSION (r36427): ASSERTION FAILED: m_refCount >= 0 in RegisterID::deref()
1294 <https://bugs.webkit.org/show_bug.cgi?id=20857>
1296 Fix a problem stemming from the slightly unsafe behaviour of the
1297 CodeGenerator::finalDestination() method by putting the "func" argument
1298 of the emitConstruct() method in a RefPtr in its caller. Also, add an
1299 assertion guaranteeing that this is always the case.
1301 CodeGenerator::finalDestination() is still incorrect and can cause
1302 problems with a different allocator; see bug 20340 for more details.
1304 * VM/CodeGenerator.cpp:
1305 (JSC::CodeGenerator::emitConstruct):
1307 (JSC::NewExprNode::emitCode):
1309 2008-09-16 Alice Liu <alice.liu@apple.com>
1314 (JSC::CTI::privateCompileMainPass):
1316 2008-09-16 Gavin Barraclough <barraclough@apple.com>
1318 Reviewed by Geoff Garen.
1320 CTI code generation for op_ret. The majority of the work
1321 (updating variables on the stack & on exec) can be performed
1322 directly in generated code.
1324 We still need to check, & to call out to C-code to handle
1325 activation records, profiling, and full scope chains.
1327 +1.5% Sunspider, +5/6% v8 tests.
1330 (JSC::CTI::emitPutCTIParam):
1331 (JSC::CTI::compileOpCall):
1332 (JSC::CTI::privateCompileMainPass):
1335 (JSC::Machine::cti_op_ret_activation):
1336 (JSC::Machine::cti_op_ret_profiler):
1337 (JSC::Machine::cti_op_ret_scopeChain):
1340 2008-09-16 Dimitri Glazkov <dglazkov@chromium.org>
1342 Fix the Windows build.
1344 Add some extra parentheses to stop MSVC from complaining so much.
1347 (JSC::Machine::privateExecute):
1348 (JSC::Machine::cti_op_stricteq):
1349 (JSC::Machine::cti_op_nstricteq):
1350 * kjs/operations.cpp:
1353 2008-09-15 Maciej Stachowiak <mjs@apple.com>
1355 Reviewed by Cameron Zwarich.
1357 - speed up the === and !== operators by choosing the fast cases better
1359 No effect on SunSpider but speeds up the V8 EarlyBoyer benchmark about 4%.
1362 (JSC::Machine::privateExecute):
1363 (JSC::Machine::cti_op_stricteq):
1364 (JSC::Machine::cti_op_nstricteq):
1365 * kjs/JSImmediate.h:
1366 (JSC::JSImmediate::areBothImmediate):
1367 * kjs/operations.cpp:
1369 (JSC::strictEqualSlowCase):
1372 2008-09-15 Oliver Hunt <oliver@apple.com>
1376 Coding style cleanup.
1379 (JSC::Machine::privateExecute):
1381 2008-09-15 Oliver Hunt <oliver@apple.com>
1383 Reviewed by Cameron Zwarich.
1385 Bug 20874: op_resolve does not do any form of caching
1386 <https://bugs.webkit.org/show_bug.cgi?id=20874>
1388 This patch adds an op_resolve_global opcode to handle (and cache)
1389 property lookup we can statically determine must occur on the global
1392 3% progression on sunspider, 3.2x improvement to bitops-bitwise-and, and
1393 10% in math-partial-sums
1396 (JSC::CTI::privateCompileMainPass):
1399 (JSC::CodeBlock::dump):
1400 * VM/CodeGenerator.cpp:
1401 (JSC::CodeGenerator::findScopedProperty):
1402 (JSC::CodeGenerator::emitResolve):
1404 (JSC::resolveGlobal):
1405 (JSC::Machine::privateExecute):
1406 (JSC::Machine::cti_op_resolve_global):
1410 2008-09-15 Sam Weinig <sam@webkit.org>
1412 Roll out r36462. It broke document.all.
1415 (JSC::CTI::privateCompileMainPass):
1416 (JSC::CTI::privateCompileSlowCases):
1419 (JSC::Machine::Machine):
1420 (JSC::Machine::cti_op_eq_null):
1421 (JSC::Machine::cti_op_neq_null):
1423 (JSC::Machine::isJSString):
1425 * kjs/JSWrapperObject.h:
1426 * kjs/StringObject.h:
1427 * kjs/StringObjectThatMasqueradesAsUndefined.h:
1429 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1431 Reviewed by Maciej Stachowiak.
1433 Bug 20863: ASSERTION FAILED: addressOffset < instructions.size() in CodeBlock::getHandlerForVPC
1434 <https://bugs.webkit.org/show_bug.cgi?id=20863>
1436 r36427 changed the number of arguments to op_construct without changing
1437 the argument index for the vPC in the call to initializeCallFrame() in
1438 the CTI case. This caused a JSC test failure. Correcting the argument
1439 index fixes the test failure.
1442 (JSC::Machine::cti_op_construct_JSConstruct):
1444 2008-09-15 Mark Rowe <mrowe@apple.com>
1450 2008-09-15 Geoffrey Garen <ggaren@apple.com>
1452 Reviewed by Maciej Stachowiak.
1454 Fixed a typo in op_get_by_id_chain that caused it to miss every time
1457 Also, a little cleanup.
1460 (JSC::Machine::privateExecute): Set up baseObject before entering the
1461 loop, so we compare against the right values.
1463 2008-09-15 Geoffrey Garen <ggaren@apple.com>
1465 Reviewed by Sam Weinig.
1467 Removed the CalledAsConstructor flag from the call frame header. Now,
1468 we use an explicit opcode at the call site to fix up constructor results.
1470 SunSpider says 0.4% faster.
1472 cti_op_construct_verify is an out-of-line function call for now, but we
1473 can fix that once StructureID holds type information like isObject.
1476 (JSC::CTI::privateCompileMainPass): Codegen for the new opcode.
1479 (JSC::CodeBlock::dump):
1481 * VM/CodeGenerator.cpp: Codegen for the new opcode. Also...
1482 (JSC::CodeGenerator::emitCall): ... don't test for known non-zero value.
1483 (JSC::CodeGenerator::emitConstruct): ... ditto.
1485 * VM/Machine.cpp: No more CalledAsConstructor
1486 (JSC::Machine::privateExecute): Implementation for the new opcode.
1487 (JSC::Machine::cti_op_ret): The speedup: no need to check whether we were
1488 called as a constructor.
1489 (JSC::Machine::cti_op_construct_verify): Implementation for the new opcode.
1492 * VM/Opcode.h: Declare new opcode.
1494 * VM/RegisterFile.h:
1495 (JSC::RegisterFile::): No more CalledAsConstructor
1497 2008-09-15 Gavin Barraclough <barraclough@apple.com>
1499 Reviewed by Geoff Garen.
1501 Inline code generation of eq_null/neq_null for CTI. Uses vptr checking for
1502 StringObjectsThatAreMasqueradingAsBeingUndefined. In the long run, the
1503 masquerading may be handled differently (through the StructureIDs - see bug
1509 (JSC::CTI::emitJumpSlowCaseIfIsJSCell):
1510 (JSC::CTI::privateCompileMainPass):
1511 (JSC::CTI::privateCompileSlowCases):
1514 (JSC::Machine::Machine):
1515 (JSC::Machine::cti_op_eq_null):
1516 (JSC::Machine::cti_op_neq_null):
1518 (JSC::Machine::doesMasqueradesAsUndefined):
1519 * kjs/JSWrapperObject.h:
1520 (JSC::JSWrapperObject::):
1521 (JSC::JSWrapperObject::JSWrapperObject):
1522 * kjs/StringObject.h:
1523 (JSC::StringObject::StringObject):
1524 * kjs/StringObjectThatMasqueradesAsUndefined.h:
1525 (JSC::StringObjectThatMasqueradesAsUndefined::StringObjectThatMasqueradesAsUndefined):
1527 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1529 Rubber-stamped by Oliver Hunt.
1531 r36427 broke CodeBlock::dump() by changing the number of arguments to
1532 op_construct without changing the code that prints it. This patch fixes
1533 it by printing the additional argument.
1535 * JavaScriptCore.xcodeproj/project.pbxproj:
1537 (JSC::CodeBlock::dump):
1539 2008-09-15 Adam Roben <aroben@apple.com>
1543 * kjs/StructureID.cpp: Removed a stray semicolon.
1545 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1547 Reviewed by Maciej Stachowiak.
1549 Fix a crash in fast/js/exception-expression-offset.html caused by not
1550 updating all mentions of the length of op_construct in r36427.
1553 (JSC::Machine::cti_op_construct_NotJSConstruct):
1555 2008-09-15 Maciej Stachowiak <mjs@apple.com>
1557 Reviewed by Cameron Zwarich.
1559 - fix layout test failure introduced by fix for 20849
1561 (The failing test was fast/js/delete-then-put.html)
1564 (JSC::JSObject::removeDirect): Clear enumeration cache
1565 in the dictionary case.
1567 (JSC::JSObject::putDirect): Ditto.
1568 * kjs/StructureID.h:
1569 (JSC::StructureID::clearEnumerationCache): Inline to handle the
1572 2008-09-15 Maciej Stachowiak <mjs@apple.com>
1574 Reviewed by Cameron Zwarich.
1576 - fix JSC test failures introduced by fix for 20849
1578 * kjs/PropertyMap.cpp:
1579 (JSC::PropertyMap::getEnumerablePropertyNames): Use the correct count.
1581 2008-09-15 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1583 Reviewed by Maciej Stachowiak.
1585 Bug 20851: REGRESSION (r36410): fast/js/kde/GlobalObject.html fails
1586 <https://bugs.webkit.org/show_bug.cgi?id=20851>
1588 r36410 introduced an optimization for parseInt() that is incorrect when
1589 its argument is larger than the range of a 32-bit integer. If the
1590 argument is a number that is not an immediate integer, then the correct
1591 behaviour is to return the floor of its value, unless it is an infinite
1592 value, in which case the correct behaviour is to return 0.
1594 * kjs/JSGlobalObjectFunctions.cpp:
1595 (JSC::globalFuncParseInt):
1597 2008-09-15 Sam Weinig <sam@webkit.org>
1599 Reviewed by Maciej Stachowiak.
1601 Patch for https://bugs.webkit.org/show_bug.cgi?id=20849
1602 Cache property names for getEnumerablePropertyNames in the StructureID.
1604 ~0.5% speedup on Sunspider overall (9.7% speedup on string-fasta). ~1% speedup
1605 on the v8 test suite.
1608 (JSC::JSObject::getPropertyNames):
1609 * kjs/PropertyMap.cpp:
1610 (JSC::PropertyMap::getEnumerablePropertyNames):
1611 * kjs/PropertyMap.h:
1612 * kjs/StructureID.cpp:
1613 (JSC::StructureID::StructureID):
1614 (JSC::StructureID::getEnumerablePropertyNames):
1615 * kjs/StructureID.h:
1617 2008-09-14 Maciej Stachowiak <mjs@apple.com>
1619 Reviewed by Cameron Zwarich.
1621 - speed up JS construction by extracting "prototype" lookup so PIC applies.
1623 ~0.5% speedup on SunSpider
1624 Speeds up some of the V8 tests as well, most notably earley-boyer.
1627 (JSC::CTI::compileOpCall): Account for extra arg for prototype.
1628 (JSC::CTI::privateCompileMainPass): Account for increased size of op_construct.
1629 * VM/CodeGenerator.cpp:
1630 (JSC::CodeGenerator::emitConstruct): Emit separate lookup to get prototype property.
1632 (JSC::Machine::privateExecute): Expect prototype arg in op_construct.
1633 (JSC::Machine::cti_op_construct_JSConstruct): ditto
1634 (JSC::Machine::cti_op_construct_NotJSConstruct): ditto
1636 2008-09-10 Alexey Proskuryakov <ap@webkit.org>
1638 Reviewed by Eric Seidel.
1640 Add a protected destructor for RefCounted.
1642 It is wrong to call its destructor directly, because (1) this should be taken care of by
1643 deref(), and (2) many classes that use RefCounted have non-virtual destructors.
1645 No change in behavior.
1647 * wtf/RefCounted.h: (WTF::RefCounted::~RefCounted):
1649 2008-09-14 Gavin Barraclough <barraclough@apple.com>
1651 Reviewed by Sam Weinig.
1653 Accelerated property accesses.
1655 Inline more of the array access code into the JIT code for get/put_by_val.
1656 Accelerate get/put_by_id by speculatively inlining a disable direct access
1657 into the hot path of the code, and repatch this with the correct StructureID
1658 and property map offset once these are known. In the case of accesses to the
1659 prototype and reading the array-length a trampoline is genertaed, and the
1660 branch to the slow-case is relinked to jump to this.
1662 By repatching, we mean rewriting the x86 instruction stream. Instructions are
1663 only modified in a simple fasion - altering immediate operands, memory access
1664 deisplacements, and branch offsets.
1666 For regular get_by_id/put_by_id accesses to an object, a StructureID in an
1667 instruction's immediate operant is updateded, and a memory access operation's
1668 displacement is updated to access the correct field on the object. In the case
1669 of more complex accesses (array length and get_by_id_prototype) the offset on
1670 the branch to slow-case is updated, to now jump to a trampoline.
1672 +2.8% sunspider, +13% v8-tests
1675 (JSC::CTI::emitCall):
1676 (JSC::CTI::emitJumpSlowCaseIfNotJSCell):
1678 (JSC::CTI::privateCompileMainPass):
1679 (JSC::CTI::privateCompileSlowCases):
1680 (JSC::CTI::privateCompile):
1681 (JSC::CTI::privateCompileGetByIdSelf):
1682 (JSC::CTI::privateCompileGetByIdProto):
1683 (JSC::CTI::privateCompileGetByIdChain):
1684 (JSC::CTI::privateCompilePutByIdReplace):
1685 (JSC::CTI::privateCompilePutByIdTransition):
1686 (JSC::CTI::privateCompileArrayLengthTrampoline):
1687 (JSC::CTI::privateCompileStringLengthTrampoline):
1688 (JSC::CTI::patchGetByIdSelf):
1689 (JSC::CTI::patchPutByIdReplace):
1690 (JSC::CTI::privateCompilePatchGetArrayLength):
1691 (JSC::CTI::privateCompilePatchGetStringLength):
1693 (JSC::CTI::compileGetByIdSelf):
1694 (JSC::CTI::compileGetByIdProto):
1695 (JSC::CTI::compileGetByIdChain):
1696 (JSC::CTI::compilePutByIdReplace):
1697 (JSC::CTI::compilePutByIdTransition):
1698 (JSC::CTI::compileArrayLengthTrampoline):
1699 (JSC::CTI::compileStringLengthTrampoline):
1700 (JSC::CTI::compilePatchGetArrayLength):
1701 (JSC::CTI::compilePatchGetStringLength):
1703 (JSC::CodeBlock::dump):
1704 (JSC::CodeBlock::~CodeBlock):
1706 (JSC::StructureStubInfo::StructureStubInfo):
1707 (JSC::CodeBlock::getStubInfo):
1709 (JSC::Machine::tryCTICachePutByID):
1710 (JSC::Machine::tryCTICacheGetByID):
1711 (JSC::Machine::cti_op_put_by_val_array):
1713 * masm/X86Assembler.h:
1714 (JSC::X86Assembler::):
1715 (JSC::X86Assembler::cmpl_i8m):
1716 (JSC::X86Assembler::emitUnlinkedJa):
1717 (JSC::X86Assembler::getRelocatedAddress):
1718 (JSC::X86Assembler::getDifferenceBetweenLabels):
1719 (JSC::X86Assembler::emitModRm_opmsib):
1721 2008-09-14 Maciej Stachowiak <mjs@apple.com>
1723 Reviewed by Cameron Zwarich.
1725 - split the "prototype" lookup for hasInstance into opcode stream so it can be cached
1727 ~5% speedup on v8 earley-boyer test
1729 * API/JSCallbackObject.h: Add a parameter for the pre-looked-up prototype.
1730 * API/JSCallbackObjectFunctions.h:
1731 (JSC::::hasInstance): Ditto.
1732 * API/JSValueRef.cpp:
1733 (JSValueIsInstanceOfConstructor): Look up and pass in prototype.
1734 * JavaScriptCore.exp:
1736 (JSC::CTI::privateCompileMainPass): Pass along prototype.
1738 (JSC::CodeBlock::dump): Print third arg.
1739 * VM/CodeGenerator.cpp:
1740 (JSC::CodeGenerator::emitInstanceOf): Implement this, now that there
1741 is a third argument.
1742 * VM/CodeGenerator.h:
1744 (JSC::Machine::privateExecute): Pass along the prototype.
1745 (JSC::Machine::cti_op_instanceof): ditto
1747 (JSC::JSObject::hasInstance): Expect to get a pre-looked-up prototype.
1750 (JSC::InstanceOfNode::emitCode): Emit a get_by_id of the prototype
1751 property and pass that register to instanceof.
1754 2008-09-14 Gavin Barraclough <barraclough@apple.com>
1756 Reviewed by Sam Weinig.
1758 Remove unnecessary virtual function call from cti_op_call_JSFunction -
1759 ~5% on richards, ~2.5% on v8-tests, ~0.5% on sunspider.
1762 (JSC::Machine::cti_op_call_JSFunction):
1764 2008-09-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1766 Reviewed by Maciej Stachowiak.
1768 Bug 20827: the 'typeof' operator is slow
1769 <https://bugs.webkit.org/show_bug.cgi?id=20827>
1771 Optimize the 'typeof' operator when its result is compared to a constant
1774 This is a 5.5% speedup on the V8 Earley-Boyer test.
1777 (JSC::CTI::privateCompileMainPass):
1779 (JSC::CodeBlock::dump):
1780 * VM/CodeGenerator.cpp:
1781 (JSC::CodeGenerator::emitEqualityOp):
1782 * VM/CodeGenerator.h:
1784 (JSC::jsIsObjectType):
1785 (JSC::jsIsFunctionType):
1786 (JSC::Machine::privateExecute):
1787 (JSC::Machine::cti_op_is_undefined):
1788 (JSC::Machine::cti_op_is_boolean):
1789 (JSC::Machine::cti_op_is_number):
1790 (JSC::Machine::cti_op_is_string):
1791 (JSC::Machine::cti_op_is_object):
1792 (JSC::Machine::cti_op_is_function):
1796 (JSC::BinaryOpNode::emitCode):
1797 (JSC::EqualNode::emitCode):
1798 (JSC::StrictEqualNode::emitCode):
1801 2008-09-14 Sam Weinig <sam@webkit.org>
1803 Reviewed by Cameron Zwarich.
1805 Patch for https://bugs.webkit.org/show_bug.cgi?id=20844
1806 Speed up parseInt for numbers
1808 Sunspider reports this as 1.029x as fast overall and 1.37x as fast on string-unpack-code.
1809 No change on the v8 suite.
1811 * kjs/JSGlobalObjectFunctions.cpp:
1812 (JSC::globalFuncParseInt): Don't convert numbers to strings just to
1813 convert them back to numbers.
1815 2008-09-14 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1817 Reviewed by Oliver Hunt.
1819 Bug 20816: op_lesseq should be optimized
1820 <https://bugs.webkit.org/show_bug.cgi?id=20816>
1822 Add a loop_if_lesseq opcode that is similar to the loop_if_less opcode.
1824 This is a 9.4% speedup on the V8 Crypto benchmark.
1827 (JSC::CTI::privateCompileMainPass):
1828 (JSC::CTI::privateCompileSlowCases):
1830 (JSC::CodeBlock::dump):
1831 * VM/CodeGenerator.cpp:
1832 (JSC::CodeGenerator::emitJumpIfTrue):
1834 (JSC::Machine::privateExecute):
1835 (JSC::Machine::cti_op_loop_if_lesseq):
1839 2008-09-14 Sam Weinig <sam@webkit.org>
1841 Reviewed by Cameron Zwarich.
1843 Cleanup Sampling code.
1846 (JSC::CTI::emitCall):
1847 (JSC::CTI::privateCompileMainPass):
1849 (JSC::CTI::execute):
1850 * VM/SamplingTool.cpp:
1852 (JSC::SamplingTool::run):
1853 (JSC::SamplingTool::dump):
1854 * VM/SamplingTool.h:
1855 (JSC::SamplingTool::callingHostFunction):
1857 2008-09-13 Oliver Hunt <oliver@apple.com>
1859 Reviewed by Cameron Zwarich.
1861 Bug 20821: Cache property transitions to speed up object initialization
1862 https://bugs.webkit.org/show_bug.cgi?id=20821
1864 Implement a transition cache to improve the performance of new properties
1865 being added to objects. This is extremely beneficial in constructors and
1866 shows up as a 34% improvement on access-binary-trees in SunSpider (0.8%
1870 (JSC::CTI::privateCompileMainPass):
1872 (JSC::transitionWillNeedStorageRealloc):
1873 (JSC::CTI::privateCompilePutByIdTransition):
1875 (JSC::CTI::compilePutByIdTransition):
1877 (JSC::printPutByIdOp):
1878 (JSC::CodeBlock::printStructureIDs):
1879 (JSC::CodeBlock::dump):
1880 (JSC::CodeBlock::derefStructureIDs):
1881 (JSC::CodeBlock::refStructureIDs):
1882 * VM/CodeGenerator.cpp:
1883 (JSC::CodeGenerator::emitPutById):
1885 (JSC::cachePrototypeChain):
1886 (JSC::Machine::tryCachePutByID):
1887 (JSC::Machine::tryCacheGetByID):
1888 (JSC::Machine::privateExecute):
1889 (JSC::Machine::tryCTICachePutByID):
1890 (JSC::Machine::tryCTICacheGetByID):
1894 (JSC::JSObject::putDirect):
1895 (JSC::JSObject::transitionTo):
1896 * kjs/PutPropertySlot.h:
1897 (JSC::PutPropertySlot::PutPropertySlot):
1898 (JSC::PutPropertySlot::wasTransition):
1899 (JSC::PutPropertySlot::setWasTransition):
1900 * kjs/StructureID.cpp:
1901 (JSC::StructureID::transitionTo):
1902 (JSC::StructureIDChain::StructureIDChain):
1903 * kjs/StructureID.h:
1904 (JSC::StructureID::previousID):
1905 (JSC::StructureID::setCachedPrototypeChain):
1906 (JSC::StructureID::cachedPrototypeChain):
1907 (JSC::StructureID::propertyMap):
1908 * masm/X86Assembler.h:
1909 (JSC::X86Assembler::addl_i8m):
1910 (JSC::X86Assembler::subl_i8m):
1912 2008-09-12 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1914 Reviewed by Maciej Stachowiak.
1916 Bug 20819: JSValue::isObject() is slow
1917 <https://bugs.webkit.org/show_bug.cgi?id=20819>
1919 Optimize JSCell::isObject() and JSCell::isString() by making them
1920 non-virtual calls that rely on the StructureID type information.
1922 This is a 0.7% speedup on SunSpider and a 1.0% speedup on the V8
1925 * JavaScriptCore.exp:
1928 (JSC::JSCell::isObject):
1929 (JSC::JSCell::isString):
1934 (JSC::JSString::JSString):
1935 * kjs/StructureID.h:
1936 (JSC::StructureID::type):
1938 2008-09-11 Stephanie Lewis <slewis@apple.com>
1940 Reviewed by Oliver Hunt.
1942 Turn off PGO Optimization on CTI.cpp -> <rdar://problem/6207709>. Fixes
1943 crash on CNN and on Dromaeo.
1944 Fix Missing close tag in vcproj.
1946 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1948 2008-09-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1952 Correct an SVN problem with the last commit and actually add the new
1955 * wrec/CharacterClassConstructor.cpp: Added.
1957 (JSC::getCharacterClassNewline):
1958 (JSC::getCharacterClassDigits):
1959 (JSC::getCharacterClassSpaces):
1960 (JSC::getCharacterClassWordchar):
1961 (JSC::getCharacterClassNondigits):
1962 (JSC::getCharacterClassNonspaces):
1963 (JSC::getCharacterClassNonwordchar):
1964 (JSC::CharacterClassConstructor::addSorted):
1965 (JSC::CharacterClassConstructor::addSortedRange):
1966 (JSC::CharacterClassConstructor::put):
1967 (JSC::CharacterClassConstructor::flush):
1968 (JSC::CharacterClassConstructor::append):
1969 * wrec/CharacterClassConstructor.h: Added.
1970 (JSC::CharacterClassConstructor::CharacterClassConstructor):
1971 (JSC::CharacterClassConstructor::isUpsideDown):
1972 (JSC::CharacterClassConstructor::charClass):
1974 2008-09-11 Cameron Zwarich <cwzwarich@uwaterloo.ca>
1976 Reviewed by Maciej Stachowiak.
1978 Bug 20788: Split CharacterClassConstructor into its own file
1979 <https://bugs.webkit.org/show_bug.cgi?id=20788>
1981 Split CharacterClassConstructor into its own file and clean up some
1984 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
1985 * JavaScriptCore.xcodeproj/project.pbxproj:
1986 * wrec/CharacterClassConstructor.cpp: Added.
1988 (JSC::getCharacterClassNewline):
1989 (JSC::getCharacterClassDigits):
1990 (JSC::getCharacterClassSpaces):
1991 (JSC::getCharacterClassWordchar):
1992 (JSC::getCharacterClassNondigits):
1993 (JSC::getCharacterClassNonspaces):
1994 (JSC::getCharacterClassNonwordchar):
1995 (JSC::CharacterClassConstructor::addSorted):
1996 (JSC::CharacterClassConstructor::addSortedRange):
1997 (JSC::CharacterClassConstructor::put):
1998 (JSC::CharacterClassConstructor::flush):
1999 (JSC::CharacterClassConstructor::append):
2000 * wrec/CharacterClassConstructor.h: Added.
2001 (JSC::CharacterClassConstructor::CharacterClassConstructor):
2002 (JSC::CharacterClassConstructor::isUpsideDown):
2003 (JSC::CharacterClassConstructor::charClass):
2005 (JSC::WRECParser::parseCharacterClass):
2007 2008-09-10 Simon Hausmann <hausmann@webkit.org>
2009 Not reviewed but trivial one-liner for yet unused macro.
2011 Changed PLATFORM(WINCE) to PLATFORM(WIN_CE) as requested by Mark.
2013 (part of https://bugs.webkit.org/show_bug.cgi?id=20746)
2017 2008-09-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2019 Rubber-stamped by Oliver Hunt.
2021 Fix a typo by renaming the overloaded orl_rr that takes an immediate to
2025 (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
2026 * masm/X86Assembler.h:
2027 (JSC::X86Assembler::orl_i32r):
2029 (JSC::WRECGenerator::generatePatternCharacter):
2030 (JSC::WRECGenerator::generateCharacterClassInverted):
2032 2008-09-10 Sam Weinig <sam@webkit.org>
2034 Reviewed by Geoff Garen.
2036 Add inline property storage for JSObject.
2038 1.2% progression on Sunspider. .5% progression on the v8 test suite.
2040 * JavaScriptCore.exp:
2042 (JSC::CTI::privateCompileGetByIdProto):
2043 (JSC::CTI::privateCompileGetByIdChain):
2045 (JSC::JSObject::mark): There is no reason to check storageSize now that
2047 (JSC::JSObject::allocatePropertyStorage): Allocates/reallocates heap storage.
2049 (JSC::JSObject::offsetForLocation): m_propertyStorage is not an OwnArrayPtr
2050 now so there is no reason to .get()
2051 (JSC::JSObject::usingInlineStorage):
2052 (JSC::JSObject::JSObject): Start with m_propertyStorage pointing to the
2054 (JSC::JSObject::~JSObject): Free the heap storage if not using the inline
2056 (JSC::JSObject::putDirect): Switch to the heap storage only when we know
2057 we know that we are about to add a property that will overflow the inline
2059 * kjs/PropertyMap.cpp:
2060 (JSC::PropertyMap::createTable): Don't allocate the propertyStorage, that is
2061 now handled by JSObject.
2062 (JSC::PropertyMap::rehash): PropertyStorage is not a OwnArrayPtr anymore.
2063 * kjs/PropertyMap.h:
2064 (JSC::PropertyMap::storageSize): Rename from markingCount.
2065 * kjs/StructureID.cpp:
2066 (JSC::StructureID::addPropertyTransition): Don't resize the property storage
2067 if we are using inline storage.
2068 * kjs/StructureID.h:
2070 2008-09-10 Oliver Hunt <oliver@apple.com>
2072 Reviewed by Geoff Garen.
2074 Inline immediate number version of op_mul.
2076 Renamed mull_rr to imull_rr as that's what it's
2077 actually doing, and added imull_i32r for the constant
2078 case immediate multiply.
2080 1.1% improvement to SunSpider.
2083 (JSC::CTI::privateCompileMainPass):
2084 (JSC::CTI::privateCompileSlowCases):
2085 * masm/X86Assembler.h:
2086 (JSC::X86Assembler::):
2087 (JSC::X86Assembler::imull_rr):
2088 (JSC::X86Assembler::imull_i32r):
2090 2008-09-10 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2096 * JavaScriptCore.xcodeproj/project.pbxproj:
2098 2008-09-09 Oliver Hunt <oliver@apple.com>
2100 Reviewed by Maciej Stachowiak.
2102 Add optimised access to known properties on the global object.
2104 Improve cross scope access to the global object by emitting
2105 code to access it directly rather than by walking the scope chain.
2107 This is a 0.8% win in SunSpider and a 1.7% win in the v8 benchmarks.
2110 (JSC::CTI::privateCompileMainPass):
2111 (JSC::CTI::emitGetVariableObjectRegister):
2112 (JSC::CTI::emitPutVariableObjectRegister):
2115 (JSC::CodeBlock::dump):
2116 * VM/CodeGenerator.cpp:
2117 (JSC::CodeGenerator::findScopedProperty):
2118 (JSC::CodeGenerator::emitResolve):
2119 (JSC::CodeGenerator::emitGetScopedVar):
2120 (JSC::CodeGenerator::emitPutScopedVar):
2121 * VM/CodeGenerator.h:
2123 (JSC::Machine::privateExecute):
2126 (JSC::FunctionCallResolveNode::emitCode):
2127 (JSC::PostfixResolveNode::emitCode):
2128 (JSC::PrefixResolveNode::emitCode):
2129 (JSC::ReadModifyResolveNode::emitCode):
2130 (JSC::AssignResolveNode::emitCode):
2132 2008-09-10 Maciej Stachowiak <mjs@apple.com>
2136 - enable polymorphic inline caching of properties of primitives
2138 1.012x speedup on SunSpider.
2140 We create special structure IDs for JSString and
2141 JSNumberCell. Unlike normal structure IDs, these cannot hold the
2142 true prototype. Due to JS autoboxing semantics, the prototype used
2143 when looking up string or number properties depends on the lexical
2144 global object of the call site, not the creation site. Thus we
2145 enable StructureIDs to handle this quirk for primitives.
2147 Everything else should be straightforward.
2150 (JSC::CTI::privateCompileGetByIdProto):
2151 (JSC::CTI::privateCompileGetByIdChain):
2153 (JSC::CTI::compileGetByIdProto):
2154 (JSC::CTI::compileGetByIdChain):
2155 * VM/JSPropertyNameIterator.h:
2156 (JSC::JSPropertyNameIterator::JSPropertyNameIterator):
2158 (JSC::Machine::Machine):
2159 (JSC::cachePrototypeChain):
2160 (JSC::Machine::tryCachePutByID):
2161 (JSC::Machine::tryCacheGetByID):
2162 (JSC::Machine::privateExecute):
2163 (JSC::Machine::tryCTICachePutByID):
2164 (JSC::Machine::tryCTICacheGetByID):
2165 * kjs/GetterSetter.h:
2166 (JSC::GetterSetter::GetterSetter):
2168 * kjs/JSGlobalData.cpp:
2169 (JSC::JSGlobalData::JSGlobalData):
2170 * kjs/JSGlobalData.h:
2171 * kjs/JSGlobalObject.h:
2172 (JSC::StructureID::prototypeForLookup):
2173 * kjs/JSNumberCell.h:
2174 (JSC::JSNumberCell::JSNumberCell):
2175 (JSC::jsNumberCell):
2177 (JSC::JSObject::prototype):
2181 (JSC::jsOwnedString):
2183 (JSC::JSString::JSString):
2185 (JSC::jsSingleCharacterString):
2186 (JSC::jsSingleCharacterSubstring):
2187 (JSC::jsNontrivialString):
2188 * kjs/SmallStrings.cpp:
2189 (JSC::SmallStrings::createEmptyString):
2190 (JSC::SmallStrings::createSingleCharacterString):
2191 * kjs/StructureID.cpp:
2192 (JSC::StructureID::StructureID):
2193 (JSC::StructureID::addPropertyTransition):
2194 (JSC::StructureID::getterSetterTransition):
2195 (JSC::StructureIDChain::StructureIDChain):
2196 * kjs/StructureID.h:
2197 (JSC::StructureID::create):
2198 (JSC::StructureID::storedPrototype):
2200 2008-09-09 Joerg Bornemann <joerg.bornemann@trolltech.com>
2202 Reviewed by Sam Weinig.
2204 https://bugs.webkit.org/show_bug.cgi?id=20746
2206 Added WINCE platform macro.
2210 2008-09-09 Sam Weinig <sam@webkit.org>
2212 Reviewed by Mark Rowe.
2214 Remove unnecessary override of getOffset.
2216 Sunspider reports this as a .6% progression.
2218 * JavaScriptCore.exp:
2220 (JSC::JSObject::getDirectLocation):
2221 (JSC::JSObject::getOwnPropertySlotForWrite):
2222 (JSC::JSObject::putDirect):
2223 * kjs/PropertyMap.cpp:
2224 * kjs/PropertyMap.h:
2226 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2228 Reviewed by Maciej Stachowiak.
2230 Bug 20759: Remove MacroAssembler
2231 <https://bugs.webkit.org/show_bug.cgi?id=20759>
2233 Remove MacroAssembler and move its functionality to X86Assembler.
2235 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
2236 * JavaScriptCore.xcodeproj/project.pbxproj:
2238 (JSC::CTI::emitGetArg):
2239 (JSC::CTI::emitGetPutArg):
2240 (JSC::CTI::emitPutArg):
2241 (JSC::CTI::emitPutCTIParam):
2242 (JSC::CTI::emitGetCTIParam):
2243 (JSC::CTI::emitPutToCallFrameHeader):
2244 (JSC::CTI::emitGetFromCallFrameHeader):
2245 (JSC::CTI::emitPutResult):
2246 (JSC::CTI::emitDebugExceptionCheck):
2247 (JSC::CTI::emitJumpSlowCaseIfNotImm):
2248 (JSC::CTI::emitJumpSlowCaseIfNotImms):
2249 (JSC::CTI::emitFastArithDeTagImmediate):
2250 (JSC::CTI::emitFastArithReTagImmediate):
2251 (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
2252 (JSC::CTI::emitFastArithImmToInt):
2253 (JSC::CTI::emitFastArithIntToImmOrSlowCase):
2254 (JSC::CTI::emitFastArithIntToImmNoCheck):
2255 (JSC::CTI::compileOpCall):
2256 (JSC::CTI::emitSlowScriptCheck):
2257 (JSC::CTI::privateCompileMainPass):
2258 (JSC::CTI::privateCompileSlowCases):
2259 (JSC::CTI::privateCompile):
2260 (JSC::CTI::privateCompileGetByIdSelf):
2261 (JSC::CTI::privateCompileGetByIdProto):
2262 (JSC::CTI::privateCompileGetByIdChain):
2263 (JSC::CTI::privateCompilePutByIdReplace):
2264 (JSC::CTI::privateArrayLengthTrampoline):
2265 (JSC::CTI::privateStringLengthTrampoline):
2266 (JSC::CTI::compileRegExp):
2268 (JSC::CallRecord::CallRecord):
2269 (JSC::JmpTable::JmpTable):
2270 (JSC::SlowCaseEntry::SlowCaseEntry):
2271 (JSC::CTI::JSRInfo::JSRInfo):
2272 * masm/MacroAssembler.h: Removed.
2273 * masm/MacroAssemblerWin.cpp: Removed.
2274 * masm/X86Assembler.h:
2275 (JSC::X86Assembler::emitConvertToFastCall):
2276 (JSC::X86Assembler::emitRestoreArgumentReference):
2278 (JSC::WRECGenerator::WRECGenerator):
2279 (JSC::WRECParser::WRECParser):
2281 2008-09-09 Sam Weinig <sam@webkit.org>
2283 Reviewed by Cameron Zwarich.
2285 Don't waste the first item in the PropertyStorage.
2287 - Fix typo (makingCount -> markingCount)
2288 - Remove undefined method declaration.
2290 No change on Sunspider.
2293 (JSC::JSObject::mark):
2294 * kjs/PropertyMap.cpp:
2295 (JSC::PropertyMap::put):
2296 (JSC::PropertyMap::remove):
2297 (JSC::PropertyMap::getOffset):
2298 (JSC::PropertyMap::insert):
2299 (JSC::PropertyMap::rehash):
2300 (JSC::PropertyMap::resizePropertyStorage):
2301 (JSC::PropertyMap::checkConsistency):
2302 * kjs/PropertyMap.h:
2303 (JSC::PropertyMap::markingCount): Fix typo.
2305 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2309 Speculative Windows build fix.
2311 * masm/MacroAssemblerWin.cpp:
2312 (JSC::MacroAssembler::emitConvertToFastCall):
2313 (JSC::MacroAssembler::emitRestoreArgumentReference):
2315 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2317 Reviewed by Maciej Stachowiak.
2319 Bug 20755: Create an X86 namespace for register names and other things
2320 <https://bugs.webkit.org/show_bug.cgi?id=20755>
2322 Create an X86 namespace to put X86 register names. Perhaps I will move
2323 opcode names here later as well.
2326 (JSC::CTI::emitGetArg):
2327 (JSC::CTI::emitGetPutArg):
2328 (JSC::CTI::emitPutArg):
2329 (JSC::CTI::emitPutArgConstant):
2330 (JSC::CTI::emitPutCTIParam):
2331 (JSC::CTI::emitGetCTIParam):
2332 (JSC::CTI::emitPutToCallFrameHeader):
2333 (JSC::CTI::emitGetFromCallFrameHeader):
2334 (JSC::CTI::emitPutResult):
2335 (JSC::CTI::emitDebugExceptionCheck):
2336 (JSC::CTI::emitJumpSlowCaseIfNotImms):
2337 (JSC::CTI::compileOpCall):
2338 (JSC::CTI::emitSlowScriptCheck):
2339 (JSC::CTI::privateCompileMainPass):
2340 (JSC::CTI::privateCompileSlowCases):
2341 (JSC::CTI::privateCompile):
2342 (JSC::CTI::privateCompileGetByIdSelf):
2343 (JSC::CTI::privateCompileGetByIdProto):
2344 (JSC::CTI::privateCompileGetByIdChain):
2345 (JSC::CTI::privateCompilePutByIdReplace):
2346 (JSC::CTI::privateArrayLengthTrampoline):
2347 (JSC::CTI::privateStringLengthTrampoline):
2348 (JSC::CTI::compileRegExp):
2350 * masm/X86Assembler.h:
2352 (JSC::X86Assembler::emitModRm_rm):
2353 (JSC::X86Assembler::emitModRm_rm_Unchecked):
2354 (JSC::X86Assembler::emitModRm_rmsib):
2356 (JSC::WRECGenerator::generateNonGreedyQuantifier):
2357 (JSC::WRECGenerator::generateGreedyQuantifier):
2358 (JSC::WRECGenerator::generateParentheses):
2359 (JSC::WRECGenerator::generateBackreference):
2360 (JSC::WRECGenerator::gernerateDisjunction):
2363 2008-09-09 Sam Weinig <sam@webkit.org>
2365 Reviewed by Geoffrey Garen.
2367 Remove unnecessary friend declaration.
2369 * kjs/PropertyMap.h:
2371 2008-09-09 Sam Weinig <sam@webkit.org>
2373 Reviewed by Geoffrey Garen.
2375 Replace uses of PropertyMap::get and PropertyMap::getLocation with
2376 PropertyMap::getOffset.
2378 Sunspider reports this as a .6% improvement.
2380 * JavaScriptCore.exp:
2382 (JSC::JSObject::put):
2383 (JSC::JSObject::deleteProperty):
2384 (JSC::JSObject::getPropertyAttributes):
2386 (JSC::JSObject::getDirect):
2387 (JSC::JSObject::getDirectLocation):
2388 (JSC::JSObject::locationForOffset):
2389 * kjs/PropertyMap.cpp:
2390 (JSC::PropertyMap::remove):
2391 (JSC::PropertyMap::getOffset):
2392 * kjs/PropertyMap.h:
2394 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2396 Reviewed by Sam Weinig.
2398 Bug 20754: Remove emit prefix from assembler opcode methods
2399 <https://bugs.webkit.org/show_bug.cgi?id=20754>
2402 (JSC::CTI::emitGetArg):
2403 (JSC::CTI::emitGetPutArg):
2404 (JSC::CTI::emitPutArg):
2405 (JSC::CTI::emitPutArgConstant):
2406 (JSC::CTI::emitPutCTIParam):
2407 (JSC::CTI::emitGetCTIParam):
2408 (JSC::CTI::emitPutToCallFrameHeader):
2409 (JSC::CTI::emitGetFromCallFrameHeader):
2410 (JSC::CTI::emitPutResult):
2411 (JSC::CTI::emitDebugExceptionCheck):
2412 (JSC::CTI::emitCall):
2413 (JSC::CTI::emitJumpSlowCaseIfNotImm):
2414 (JSC::CTI::emitJumpSlowCaseIfNotImms):
2415 (JSC::CTI::emitFastArithDeTagImmediate):
2416 (JSC::CTI::emitFastArithReTagImmediate):
2417 (JSC::CTI::emitFastArithPotentiallyReTagImmediate):
2418 (JSC::CTI::emitFastArithImmToInt):
2419 (JSC::CTI::emitFastArithIntToImmOrSlowCase):
2420 (JSC::CTI::emitFastArithIntToImmNoCheck):
2421 (JSC::CTI::compileOpCall):
2422 (JSC::CTI::emitSlowScriptCheck):
2423 (JSC::CTI::privateCompileMainPass):
2424 (JSC::CTI::privateCompileSlowCases):
2425 (JSC::CTI::privateCompile):
2426 (JSC::CTI::privateCompileGetByIdSelf):
2427 (JSC::CTI::privateCompileGetByIdProto):
2428 (JSC::CTI::privateCompileGetByIdChain):
2429 (JSC::CTI::privateCompilePutByIdReplace):
2430 (JSC::CTI::privateArrayLengthTrampoline):
2431 (JSC::CTI::privateStringLengthTrampoline):
2432 (JSC::CTI::compileRegExp):
2433 * masm/MacroAssemblerWin.cpp:
2434 (JSC::MacroAssembler::emitConvertToFastCall):
2435 (JSC::MacroAssembler::emitRestoreArgumentReference):
2436 * masm/X86Assembler.h:
2437 (JSC::X86Assembler::pushl_r):
2438 (JSC::X86Assembler::pushl_m):
2439 (JSC::X86Assembler::popl_r):
2440 (JSC::X86Assembler::popl_m):
2441 (JSC::X86Assembler::movl_rr):
2442 (JSC::X86Assembler::addl_rr):
2443 (JSC::X86Assembler::addl_i8r):
2444 (JSC::X86Assembler::addl_i32r):
2445 (JSC::X86Assembler::addl_mr):
2446 (JSC::X86Assembler::andl_rr):
2447 (JSC::X86Assembler::andl_i32r):
2448 (JSC::X86Assembler::cmpl_i8r):
2449 (JSC::X86Assembler::cmpl_rr):
2450 (JSC::X86Assembler::cmpl_rm):
2451 (JSC::X86Assembler::cmpl_i32r):
2452 (JSC::X86Assembler::cmpl_i32m):
2453 (JSC::X86Assembler::cmpw_rm):
2454 (JSC::X86Assembler::orl_rr):
2455 (JSC::X86Assembler::subl_rr):
2456 (JSC::X86Assembler::subl_i8r):
2457 (JSC::X86Assembler::subl_i32r):
2458 (JSC::X86Assembler::subl_mr):
2459 (JSC::X86Assembler::testl_i32r):
2460 (JSC::X86Assembler::testl_rr):
2461 (JSC::X86Assembler::xorl_i8r):
2462 (JSC::X86Assembler::xorl_rr):
2463 (JSC::X86Assembler::sarl_i8r):
2464 (JSC::X86Assembler::sarl_CLr):
2465 (JSC::X86Assembler::shl_i8r):
2466 (JSC::X86Assembler::shll_CLr):
2467 (JSC::X86Assembler::mull_rr):
2468 (JSC::X86Assembler::idivl_r):
2469 (JSC::X86Assembler::cdq):
2470 (JSC::X86Assembler::movl_mr):
2471 (JSC::X86Assembler::movzwl_mr):
2472 (JSC::X86Assembler::movl_rm):
2473 (JSC::X86Assembler::movl_i32r):
2474 (JSC::X86Assembler::movl_i32m):
2475 (JSC::X86Assembler::leal_mr):
2476 (JSC::X86Assembler::ret):
2477 (JSC::X86Assembler::jmp_r):
2478 (JSC::X86Assembler::jmp_m):
2479 (JSC::X86Assembler::call_r):
2481 (JSC::WRECGenerator::generateBacktrack1):
2482 (JSC::WRECGenerator::generateBacktrackBackreference):
2483 (JSC::WRECGenerator::generateBackreferenceQuantifier):
2484 (JSC::WRECGenerator::generateNonGreedyQuantifier):
2485 (JSC::WRECGenerator::generateGreedyQuantifier):
2486 (JSC::WRECGenerator::generatePatternCharacter):
2487 (JSC::WRECGenerator::generateCharacterClassInvertedRange):
2488 (JSC::WRECGenerator::generateCharacterClassInverted):
2489 (JSC::WRECGenerator::generateCharacterClass):
2490 (JSC::WRECGenerator::generateParentheses):
2491 (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
2492 (JSC::WRECGenerator::generateAssertionBOL):
2493 (JSC::WRECGenerator::generateAssertionEOL):
2494 (JSC::WRECGenerator::generateAssertionWordBoundary):
2495 (JSC::WRECGenerator::generateBackreference):
2496 (JSC::WRECGenerator::gernerateDisjunction):
2498 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2500 Reviewed by Maciej Stachowiak.
2502 Clean up the WREC code some more.
2505 (JSC::CTI::compileRegExp):
2507 (JSC::getCharacterClassNewline):
2508 (JSC::getCharacterClassDigits):
2509 (JSC::getCharacterClassSpaces):
2510 (JSC::getCharacterClassWordchar):
2511 (JSC::getCharacterClassNondigits):
2512 (JSC::getCharacterClassNonspaces):
2513 (JSC::getCharacterClassNonwordchar):
2514 (JSC::WRECGenerator::generateBacktrack1):
2515 (JSC::WRECGenerator::generateBacktrackBackreference):
2516 (JSC::WRECGenerator::generateBackreferenceQuantifier):
2517 (JSC::WRECGenerator::generateNonGreedyQuantifier):
2518 (JSC::WRECGenerator::generateGreedyQuantifier):
2519 (JSC::WRECGenerator::generatePatternCharacter):
2520 (JSC::WRECGenerator::generateCharacterClassInvertedRange):
2521 (JSC::WRECGenerator::generateCharacterClassInverted):
2522 (JSC::WRECGenerator::generateCharacterClass):
2523 (JSC::WRECGenerator::generateParentheses):
2524 (JSC::WRECGenerator::gererateParenthesesResetTrampoline):
2525 (JSC::WRECGenerator::generateAssertionBOL):
2526 (JSC::WRECGenerator::generateAssertionEOL):
2527 (JSC::WRECGenerator::generateAssertionWordBoundary):
2528 (JSC::WRECGenerator::generateBackreference):
2529 (JSC::WRECGenerator::gernerateDisjunction):
2530 (JSC::WRECParser::parseCharacterClass):
2531 (JSC::WRECParser::parseEscape):
2532 (JSC::WRECParser::parseTerm):
2535 2008-09-09 Mark Rowe <mrowe@apple.com>
2537 Build fix, rubber-stamped by Anders Carlsson.
2539 Silence spurious build warnings about missing format attributes on functions in Assertions.cpp.
2541 * JavaScriptCore.xcodeproj/project.pbxproj:
2543 2008-09-09 Mark Rowe <mrowe@apple.com>
2545 Rubber-stamped by Oliver Hunt.
2547 Fix builds using the "debug" variant.
2549 This reverts r36130 and tweaks Identifier to export the same symbols for Debug
2550 and Release configurations.
2552 * Configurations/JavaScriptCore.xcconfig:
2553 * DerivedSources.make:
2554 * JavaScriptCore.Debug.exp: Removed.
2555 * JavaScriptCore.base.exp: Removed.
2556 * JavaScriptCore.exp: Added.
2557 * JavaScriptCore.xcodeproj/project.pbxproj:
2558 * kjs/identifier.cpp:
2559 (JSC::Identifier::addSlowCase): #ifdef the call to checkSameIdentifierTable so that
2560 there is no overhead in Release builds.
2561 (JSC::Identifier::checkSameIdentifierTable): Add empty functions for Release builds.
2563 (JSC::Identifier::add): #ifdef the calls to checkSameIdentifierTable so that there is
2564 no overhead in Release builds, and remove the inline definitions of checkSameIdentifierTable.
2566 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2568 Reviewed by Maciej Stachowiak.
2570 Clean up WREC a bit to bring it closer to our coding style guidelines.
2574 (JSC::getCharacterClass_newline):
2575 (JSC::getCharacterClass_d):
2576 (JSC::getCharacterClass_s):
2577 (JSC::getCharacterClass_w):
2578 (JSC::getCharacterClass_D):
2579 (JSC::getCharacterClass_S):
2580 (JSC::getCharacterClass_W):
2581 (JSC::CharacterClassConstructor::append):
2582 (JSC::WRECGenerator::generateNonGreedyQuantifier):
2583 (JSC::WRECGenerator::generateGreedyQuantifier):
2584 (JSC::WRECGenerator::generateCharacterClassInverted):
2585 (JSC::WRECParser::parseQuantifier):
2586 (JSC::WRECParser::parsePatternCharacterQualifier):
2587 (JSC::WRECParser::parseCharacterClassQuantifier):
2588 (JSC::WRECParser::parseBackreferenceQuantifier):
2590 (JSC::Quantifier::):
2591 (JSC::Quantifier::Quantifier):
2593 2008-09-09 Jungshik Shin <jungshik.shin@gmail.com>
2595 Reviewed by Alexey Proskuryakov.
2597 Try MIME charset names before trying IANA names
2598 ( https://bugs.webkit.org/show_bug.cgi?id=17537 )
2600 * wtf/StringExtras.h: (strcasecmp): Added.
2602 2008-09-09 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2604 Reviewed by Mark Rowe.
2606 Bug 20719: REGRESSION (r36135-36244): Hangs, then crashes after several seconds
2607 <https://bugs.webkit.org/show_bug.cgi?id=20719>
2608 <rdar://problem/6205787>
2610 Fix a typo in the case-insensitive matching of character patterns.
2613 (JSC::WRECGenerator::generatePatternCharacter):
2615 2008-09-09 Maciej Stachowiak <mjs@apple.com>
2617 Reviewed by Sam Weinig.
2619 - allow polymorphic inline cache to handle Math object functions and possibly other similar things
2621 1.012x speedup on SunSpider.
2623 * kjs/MathObject.cpp:
2624 (JSC::MathObject::getOwnPropertySlot):
2626 (JSC::setUpStaticFunctionSlot):
2628 (JSC::getStaticPropertySlot):
2630 2008-09-08 Sam Weinig <sam@webkit.org>
2632 Reviewed by Maciej Stachowiak and Oliver Hunt.
2634 Split storage of properties out of the PropertyMap and into the JSObject
2635 to allow sharing PropertyMap on the StructureID. In order to get this
2636 function correctly, the StructureID's transition mappings were changed to
2637 transition based on property name and attribute pairs, instead of just
2640 - Removes the single property optimization now that the PropertyMap is shared.
2641 This will be replaced by in-lining some values on the JSObject.
2643 This is a wash on Sunspider and a 6.7% win on the v8 test suite.
2645 * JavaScriptCore.base.exp:
2647 (JSC::CTI::privateCompileGetByIdSelf): Get the storage directly off the JSObject.
2648 (JSC::CTI::privateCompileGetByIdProto): Ditto.
2649 (JSC::CTI::privateCompileGetByIdChain): Ditto.
2650 (JSC::CTI::privateCompilePutByIdReplace): Ditto.
2652 (JSC::JSObject::mark): Mark the PropertyStorage.
2653 (JSC::JSObject::put): Update to get the propertyMap of the StructureID.
2654 (JSC::JSObject::deleteProperty): Ditto.
2655 (JSC::JSObject::defineGetter): Return early if the property is already a getter/setter.
2656 (JSC::JSObject::defineSetter): Ditto.
2657 (JSC::JSObject::getPropertyAttributes): Update to get the propertyMap of the StructureID
2658 (JSC::JSObject::getPropertyNames): Ditto.
2659 (JSC::JSObject::removeDirect): Ditto.
2660 * kjs/JSObject.h: Remove PropertyMap and add PropertyStorage.
2661 (JSC::JSObject::propertyStorage): return the PropertyStorage.
2662 (JSC::JSObject::getDirect): Update to get the propertyMap of the StructureID.
2663 (JSC::JSObject::getDirectLocation): Ditto.
2664 (JSC::JSObject::offsetForLocation): Compute location directly.
2665 (JSC::JSObject::hasCustomProperties): Update to get the propertyMap of the StructureID.
2666 (JSC::JSObject::hasGetterSetterProperties): Ditto.
2667 (JSC::JSObject::getDirectOffset): Get by indexing into PropertyStorage.
2668 (JSC::JSObject::putDirectOffset): Put by indexing into PropertyStorage.
2669 (JSC::JSObject::getOwnPropertySlotForWrite): Update to get the propertyMap of the StructureID.
2670 (JSC::JSObject::getOwnPropertySlot): Ditto.
2671 (JSC::JSObject::putDirect): Move putting into the StructureID unless the property already exists.
2672 * kjs/PropertyMap.cpp: Use the propertyStorage as the storage for the JSValues.
2673 (JSC::PropertyMap::checkConsistency):
2674 (JSC::PropertyMap::operator=):
2675 (JSC::PropertyMap::~PropertyMap):
2676 (JSC::PropertyMap::get):
2677 (JSC::PropertyMap::getLocation):
2678 (JSC::PropertyMap::put):
2679 (JSC::PropertyMap::getOffset):
2680 (JSC::PropertyMap::insert):
2681 (JSC::PropertyMap::expand):
2682 (JSC::PropertyMap::rehash):
2683 (JSC::PropertyMap::createTable):
2684 (JSC::PropertyMap::resizePropertyStorage): Resize the storage to match the size of the map
2685 (JSC::PropertyMap::remove):
2686 (JSC::PropertyMap::getEnumerablePropertyNames):
2687 * kjs/PropertyMap.h:
2688 (JSC::PropertyMapEntry::PropertyMapEntry):
2689 (JSC::PropertyMap::isEmpty):
2690 (JSC::PropertyMap::size):
2691 (JSC::PropertyMap::makingCount):
2692 (JSC::PropertyMap::PropertyMap):
2694 * kjs/StructureID.cpp:
2695 (JSC::StructureID::addPropertyTransition): Transitions now are based off the property name
2697 (JSC::StructureID::toDictionaryTransition): Copy the map.
2698 (JSC::StructureID::changePrototypeTransition): Copy the map.
2699 (JSC::StructureID::getterSetterTransition): Copy the map.
2700 (JSC::StructureID::~StructureID):
2701 * kjs/StructureID.h:
2702 (JSC::TransitionTableHash::hash): Custom hash for transition map.
2703 (JSC::TransitionTableHash::equal): Ditto.
2704 (JSC::TransitionTableHashTraits::emptyValue): Custom traits for transition map
2705 (JSC::TransitionTableHashTraits::constructDeletedValue): Ditto.
2706 (JSC::TransitionTableHashTraits::isDeletedValue): Ditto.
2707 (JSC::StructureID::propertyMap): Added.
2709 2008-09-08 Oliver Hunt <oliver@apple.com>
2711 Reviewed by Mark Rowe.
2713 Bug 20694: Slow Script error pops up when running Dromaeo tests
2715 Correct error in timeout logic where execution tick count would
2716 be reset to incorrect value due to incorrect offset and indirection.
2717 Codegen for the slow script dialog was factored out into a separate
2718 method (emitSlowScriptCheck) rather than having multiple copies of
2719 the same code. Also added calls to generate slow script checks
2720 for loop_if_less and loop_if_true opcodes.
2723 (JSC::CTI::emitSlowScriptCheck):
2724 (JSC::CTI::privateCompileMainPass):
2725 (JSC::CTI::privateCompileSlowCases):
2728 2008-09-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2730 Reviewed by Maciej Stachowiak.
2732 Remove references to the removed WRECompiler class.
2737 2008-09-08 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2739 Rubber-stamped by Mark Rowe.
2741 Fix the build with CTI enabled but WREC disabled.
2746 2008-09-08 Dan Bernstein <mitz@apple.com>
2751 (JSC::StatementNode::):
2754 2008-09-08 Kevin McCullough <kmccullough@apple.com>
2758 <rdar://problem/6134407> Breakpoints in for loops, while loops or
2759 conditions without curly braces don't break. (19306)
2760 -Statement Lists already emit debug hooks but conditionals without
2761 brackets are not lists.
2764 (KJS::IfNode::emitCode):
2765 (KJS::IfElseNode::emitCode):
2766 (KJS::DoWhileNode::emitCode):
2767 (KJS::WhileNode::emitCode):
2768 (KJS::ForNode::emitCode):
2769 (KJS::ForInNode::emitCode):
2771 (KJS::StatementNode::):
2774 2008-09-08 Maciej Stachowiak <mjs@apple.com>
2776 Reviewed by Anders Carlsson.
2778 - Cache the code generated for eval to speed up SunSpider and web sites
2779 https://bugs.webkit.org/show_bug.cgi?id=20718
2782 2.29x on date-format-tofte
2784 Lots of real sites seem to get many hits on this cache as well,
2785 including GMail, Google Spreadsheets, Slate and Digg (the last of
2786 these gets over 100 hits on initial page load).
2789 (JSC::EvalCodeCache::get):
2791 (JSC::Machine::callEval):
2792 (JSC::Machine::privateExecute):
2793 (JSC::Machine::cti_op_call_eval):
2796 2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2798 Reviewed by Oliver Hunt.
2800 Bug 20711: Change KJS prefix on preprocessor macros to JSC
2801 <https://bugs.webkit.org/show_bug.cgi?id=20711>
2803 * kjs/CommonIdentifiers.cpp:
2804 (JSC::CommonIdentifiers::CommonIdentifiers):
2805 * kjs/CommonIdentifiers.h:
2806 * kjs/PropertySlot.h:
2807 (JSC::PropertySlot::getValue):
2808 (JSC::PropertySlot::putValue):
2809 (JSC::PropertySlot::setValueSlot):
2810 (JSC::PropertySlot::setValue):
2811 (JSC::PropertySlot::setRegisterSlot):
2816 (JSC::ExpressionNode::):
2817 (JSC::StatementNode::):
2819 (JSC::BooleanNode::):
2820 (JSC::NumberNode::):
2821 (JSC::ImmediateNumberNode::):
2822 (JSC::StringNode::):
2823 (JSC::RegExpNode::):
2825 (JSC::ResolveNode::):
2826 (JSC::ElementNode::):
2828 (JSC::PropertyNode::):
2829 (JSC::PropertyListNode::):
2830 (JSC::ObjectLiteralNode::):
2831 (JSC::BracketAccessorNode::):
2832 (JSC::DotAccessorNode::):
2833 (JSC::ArgumentListNode::):
2834 (JSC::ArgumentsNode::):
2835 (JSC::NewExprNode::):
2836 (JSC::EvalFunctionCallNode::):
2837 (JSC::FunctionCallValueNode::):
2838 (JSC::FunctionCallResolveNode::):
2839 (JSC::FunctionCallBracketNode::):
2840 (JSC::FunctionCallDotNode::):
2841 (JSC::PrePostResolveNode::):
2842 (JSC::PostfixResolveNode::):
2843 (JSC::PostfixBracketNode::):
2844 (JSC::PostfixDotNode::):
2845 (JSC::PostfixErrorNode::):
2846 (JSC::DeleteResolveNode::):
2847 (JSC::DeleteBracketNode::):
2848 (JSC::DeleteDotNode::):
2849 (JSC::DeleteValueNode::):
2851 (JSC::TypeOfResolveNode::):
2852 (JSC::TypeOfValueNode::):
2853 (JSC::PrefixResolveNode::):
2854 (JSC::PrefixBracketNode::):
2855 (JSC::PrefixDotNode::):
2856 (JSC::PrefixErrorNode::):
2857 (JSC::UnaryPlusNode::):
2858 (JSC::NegateNode::):
2859 (JSC::BitwiseNotNode::):
2860 (JSC::LogicalNotNode::):
2866 (JSC::LeftShiftNode::):
2867 (JSC::RightShiftNode::):
2868 (JSC::UnsignedRightShiftNode::):
2870 (JSC::GreaterNode::):
2871 (JSC::LessEqNode::):
2872 (JSC::GreaterEqNode::):
2873 (JSC::ThrowableBinaryOpNode::):
2874 (JSC::InstanceOfNode::):
2877 (JSC::NotEqualNode::):
2878 (JSC::StrictEqualNode::):
2879 (JSC::NotStrictEqualNode::):
2880 (JSC::BitAndNode::):
2882 (JSC::BitXOrNode::):
2883 (JSC::LogicalOpNode::):
2884 (JSC::ConditionalNode::):
2885 (JSC::ReadModifyResolveNode::):
2886 (JSC::AssignResolveNode::):
2887 (JSC::ReadModifyBracketNode::):
2888 (JSC::AssignBracketNode::):
2889 (JSC::AssignDotNode::):
2890 (JSC::ReadModifyDotNode::):
2891 (JSC::AssignErrorNode::):
2893 (JSC::VarDeclCommaNode::):
2894 (JSC::ConstDeclNode::):
2895 (JSC::ConstStatementNode::):
2896 (JSC::EmptyStatementNode::):
2897 (JSC::DebuggerStatementNode::):
2898 (JSC::ExprStatementNode::):
2899 (JSC::VarStatementNode::):
2901 (JSC::IfElseNode::):
2902 (JSC::DoWhileNode::):
2905 (JSC::ContinueNode::):
2907 (JSC::ReturnNode::):
2912 (JSC::ParameterNode::):
2914 (JSC::ProgramNode::):
2916 (JSC::FunctionBodyNode::):
2917 (JSC::FuncExprNode::):
2918 (JSC::FuncDeclNode::):
2919 (JSC::CaseClauseNode::):
2920 (JSC::ClauseListNode::):
2921 (JSC::CaseBlockNode::):
2922 (JSC::SwitchNode::):
2924 2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
2926 Reviewed by Maciej Stachowiak.
2928 Bug 20704: Replace the KJS namespace
2929 <https://bugs.webkit.org/show_bug.cgi?id=20704>
2931 Rename the KJS namespace to JSC. There are still some uses of KJS in
2932 preprocessor macros and comments, but these will also be changed some
2933 time in the near future.
2940 * API/JSCallbackConstructor.cpp:
2941 * API/JSCallbackConstructor.h:
2942 * API/JSCallbackFunction.cpp:
2943 * API/JSCallbackFunction.h:
2944 * API/JSCallbackObject.cpp:
2945 * API/JSCallbackObject.h:
2946 * API/JSCallbackObjectFunctions.h:
2947 * API/JSClassRef.cpp:
2948 (OpaqueJSClass::staticValues):
2949 (OpaqueJSClass::staticFunctions):
2951 * API/JSContextRef.cpp:
2952 * API/JSObjectRef.cpp:
2953 * API/JSProfilerPrivate.cpp:
2954 * API/JSStringRef.cpp:
2955 * API/JSValueRef.cpp:
2957 * API/OpaqueJSString.cpp:
2958 * API/OpaqueJSString.h:
2959 * JavaScriptCore.Debug.exp:
2960 * JavaScriptCore.base.exp:
2966 * VM/CodeGenerator.cpp:
2967 * VM/CodeGenerator.h:
2968 * VM/ExceptionHelpers.cpp:
2969 * VM/ExceptionHelpers.h:
2971 * VM/JSPropertyNameIterator.cpp:
2972 * VM/JSPropertyNameIterator.h:
2980 * VM/RegisterFile.cpp:
2981 * VM/RegisterFile.h:
2984 * VM/SamplingTool.cpp:
2985 * VM/SamplingTool.h:
2986 * VM/SegmentedVector.h:
2989 * kjs/Arguments.cpp:
2991 * kjs/ArrayConstructor.cpp:
2992 * kjs/ArrayConstructor.h:
2993 * kjs/ArrayPrototype.cpp:
2994 * kjs/ArrayPrototype.h:
2995 * kjs/BatchedTransitionOptimizer.h:
2996 * kjs/BooleanConstructor.cpp:
2997 * kjs/BooleanConstructor.h:
2998 * kjs/BooleanObject.cpp:
2999 * kjs/BooleanObject.h:
3000 * kjs/BooleanPrototype.cpp:
3001 * kjs/BooleanPrototype.h:
3005 * kjs/CommonIdentifiers.cpp:
3006 * kjs/CommonIdentifiers.h:
3007 * kjs/ConstructData.cpp:
3008 * kjs/ConstructData.h:
3009 * kjs/DateConstructor.cpp:
3010 * kjs/DateConstructor.h:
3011 * kjs/DateInstance.cpp:
3012 (JSC::DateInstance::msToGregorianDateTime):
3013 * kjs/DateInstance.h:
3016 * kjs/DatePrototype.cpp:
3017 * kjs/DatePrototype.h:
3018 * kjs/DebuggerCallFrame.cpp:
3019 * kjs/DebuggerCallFrame.h:
3022 * kjs/ErrorConstructor.cpp:
3023 * kjs/ErrorConstructor.h:
3024 * kjs/ErrorInstance.cpp:
3025 * kjs/ErrorInstance.h:
3026 * kjs/ErrorPrototype.cpp:
3027 * kjs/ErrorPrototype.h:
3028 * kjs/ExecState.cpp:
3030 * kjs/FunctionConstructor.cpp:
3031 * kjs/FunctionConstructor.h:
3032 * kjs/FunctionPrototype.cpp:
3033 * kjs/FunctionPrototype.h:
3034 * kjs/GetterSetter.cpp:
3035 * kjs/GetterSetter.h:
3036 * kjs/GlobalEvalFunction.cpp:
3037 * kjs/GlobalEvalFunction.h:
3038 * kjs/IndexToNameMap.cpp:
3039 * kjs/IndexToNameMap.h:
3040 * kjs/InitializeThreading.cpp:
3041 * kjs/InitializeThreading.h:
3042 * kjs/InternalFunction.cpp:
3043 * kjs/InternalFunction.h:
3044 (JSC::InternalFunction::InternalFunction):
3045 * kjs/JSActivation.cpp:
3046 * kjs/JSActivation.h:
3051 * kjs/JSFunction.cpp:
3053 (JSC::JSFunction::JSFunction):
3054 * kjs/JSGlobalData.cpp:
3055 (JSC::JSGlobalData::JSGlobalData):
3056 * kjs/JSGlobalData.h:
3057 * kjs/JSGlobalObject.cpp:
3058 * kjs/JSGlobalObject.h:
3059 * kjs/JSGlobalObjectFunctions.cpp:
3060 * kjs/JSGlobalObjectFunctions.h:
3061 * kjs/JSImmediate.cpp:
3062 * kjs/JSImmediate.h:
3065 * kjs/JSNotAnObject.cpp:
3066 * kjs/JSNotAnObject.h:
3067 * kjs/JSNumberCell.cpp:
3068 * kjs/JSNumberCell.h:
3071 * kjs/JSStaticScopeObject.cpp:
3072 * kjs/JSStaticScopeObject.h:
3078 * kjs/JSVariableObject.cpp:
3079 * kjs/JSVariableObject.h:
3080 * kjs/JSWrapperObject.cpp:
3081 * kjs/JSWrapperObject.h:
3082 * kjs/LabelStack.cpp:
3084 * kjs/MathObject.cpp:
3086 * kjs/NativeErrorConstructor.cpp:
3087 * kjs/NativeErrorConstructor.h:
3088 * kjs/NativeErrorPrototype.cpp:
3089 * kjs/NativeErrorPrototype.h:
3091 * kjs/NumberConstructor.cpp:
3092 * kjs/NumberConstructor.h:
3093 * kjs/NumberObject.cpp:
3094 * kjs/NumberObject.h:
3095 * kjs/NumberPrototype.cpp:
3096 * kjs/NumberPrototype.h:
3097 * kjs/ObjectConstructor.cpp:
3098 * kjs/ObjectConstructor.h:
3099 * kjs/ObjectPrototype.cpp:
3100 * kjs/ObjectPrototype.h:
3103 * kjs/PropertyMap.cpp:
3104 (JSC::PropertyMapStatisticsExitLogger::~PropertyMapStatisticsExitLogger):
3105 * kjs/PropertyMap.h:
3106 * kjs/PropertyNameArray.cpp:
3107 * kjs/PropertyNameArray.h:
3108 * kjs/PropertySlot.cpp:
3109 * kjs/PropertySlot.h:
3110 * kjs/PrototypeFunction.cpp:
3111 * kjs/PrototypeFunction.h:
3112 * kjs/PutPropertySlot.h:
3113 * kjs/RegExpConstructor.cpp:
3114 * kjs/RegExpConstructor.h:
3115 * kjs/RegExpObject.cpp:
3116 * kjs/RegExpObject.h:
3117 * kjs/RegExpPrototype.cpp:
3118 * kjs/RegExpPrototype.h:
3119 * kjs/ScopeChain.cpp:
3121 * kjs/ScopeChainMark.h:
3124 * kjs/SmallStrings.cpp:
3125 * kjs/SmallStrings.h:
3126 * kjs/SourceProvider.h:
3127 * kjs/SourceRange.h:
3128 * kjs/StringConstructor.cpp:
3129 * kjs/StringConstructor.h:
3130 * kjs/StringObject.cpp:
3131 * kjs/StringObject.h:
3132 * kjs/StringObjectThatMasqueradesAsUndefined.h:
3133 * kjs/StringPrototype.cpp:
3134 * kjs/StringPrototype.h:
3135 * kjs/StructureID.cpp:
3136 * kjs/StructureID.h:
3137 * kjs/SymbolTable.h:
3138 * kjs/collector.cpp:
3141 * kjs/create_hash_table:
3147 * kjs/identifier.cpp:
3149 (JSC::Identifier::equal):
3150 * kjs/interpreter.cpp:
3151 * kjs/interpreter.h:
3153 (JSC::Lexer::Lexer):
3154 (JSC::Lexer::clear):
3155 (JSC::Lexer::makeIdentifier):
3161 * kjs/nodes2string.cpp:
3162 * kjs/operations.cpp:
3170 (JSC::IdentifierRepHash::hash):
3172 * masm/MacroAssembler.h:
3173 * masm/MacroAssemblerWin.cpp:
3174 * masm/X86Assembler.h:
3175 * pcre/pcre_exec.cpp:
3176 * profiler/CallIdentifier.h:
3178 * profiler/HeavyProfile.cpp:
3179 * profiler/HeavyProfile.h:
3180 * profiler/Profile.cpp:
3181 * profiler/Profile.h:
3182 * profiler/ProfileGenerator.cpp:
3183 * profiler/ProfileGenerator.h:
3184 * profiler/ProfileNode.cpp:
3185 * profiler/ProfileNode.h:
3186 * profiler/Profiler.cpp:
3187 * profiler/Profiler.h:
3188 * profiler/TreeProfile.cpp:
3189 * profiler/TreeProfile.h:
3194 2008-09-07 Maciej Stachowiak <mjs@apple.com>
3196 Reviewed by Dan Bernstein.
3198 - rename IA32MacroAssembler class to X86Assembler
3200 We otherwise call the platform X86, and also, I don't see any macros.
3202 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3203 * JavaScriptCore.xcodeproj/project.pbxproj:
3204 * masm/IA32MacroAsm.h: Removed.
3205 * masm/MacroAssembler.h:
3206 (KJS::MacroAssembler::MacroAssembler):
3207 * masm/MacroAssemblerWin.cpp:
3208 (KJS::MacroAssembler::emitRestoreArgumentReference):
3209 * masm/X86Assembler.h: Copied from masm/IA32MacroAsm.h.
3210 (KJS::X86Assembler::X86Assembler):
3212 (KJS::WRECGenerator::generateNonGreedyQuantifier):
3213 (KJS::WRECGenerator::generateGreedyQuantifier):
3214 (KJS::WRECGenerator::generateParentheses):
3215 (KJS::WRECGenerator::generateBackreference):
3216 (KJS::WRECGenerator::gernerateDisjunction):
3219 2008-09-07 Cameron Zwarich <cwzwarich@webkit.org>
3223 Visual C++ seems to have some odd casting rules, so just convert the
3224 offending cast back to a C-style cast for now.
3226 * kjs/collector.cpp:
3227 (KJS::otherThreadStackPointer):
3229 2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3231 Reviewed by Mark Rowe.
3233 Attempt to fix the Windows build by using a const_cast to cast regs.Esp
3234 to a uintptr_t instead of a reinterpret_cast.
3236 * kjs/collector.cpp:
3237 (KJS::otherThreadStackPointer):
3239 2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3241 Reviewed by Sam Weinig.
3243 Remove C-style casts from kjs/collector.cpp.
3245 * kjs/collector.cpp:
3246 (KJS::Heap::heapAllocate):
3247 (KJS::currentThreadStackBase):
3248 (KJS::Heap::markConservatively):
3249 (KJS::otherThreadStackPointer):
3250 (KJS::Heap::markOtherThreadConservatively):
3253 2008-09-07 Mark Rowe <mrowe@apple.com>
3255 Build fix for the debug variant.
3257 * DerivedSources.make: Also use the .Debug.exp exports file when building the debug variant.
3259 2008-09-07 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3261 Reviewed by Timothy Hatcher.
3263 Remove C-style casts from the CTI code.
3266 (KJS::CTI::emitGetArg):
3267 (KJS::CTI::emitGetPutArg):
3268 (KJS::ctiRepatchCallByReturnAddress):
3269 (KJS::CTI::compileOpCall):
3270 (KJS::CTI::privateCompileMainPass):
3271 (KJS::CTI::privateCompileGetByIdSelf):
3272 (KJS::CTI::privateCompileGetByIdProto):
3273 (KJS::CTI::privateCompileGetByIdChain):
3274 (KJS::CTI::privateCompilePutByIdReplace):
3275 (KJS::CTI::privateArrayLengthTrampoline):
3276 (KJS::CTI::privateStringLengthTrampoline):
3278 === End merge of squirrelfish-extreme ===
3280 2008-09-06 Gavin Barraclough <barraclough@apple.com>
3282 Reviewed by Sam Weinig. Adapted somewhat by Maciej Stachowiak.
3284 - refactor WREC to share more of the JIT infrastructure with CTI
3287 (KJS::CTI::emitGetArg):
3288 (KJS::CTI::emitGetPutArg):
3289 (KJS::CTI::emitPutArg):
3290 (KJS::CTI::emitPutArgConstant):
3291 (KJS::CTI::emitPutCTIParam):
3292 (KJS::CTI::emitGetCTIParam):
3293 (KJS::CTI::emitPutToCallFrameHeader):
3294 (KJS::CTI::emitGetFromCallFrameHeader):
3295 (KJS::CTI::emitPutResult):
3296 (KJS::CTI::emitDebugExceptionCheck):
3297 (KJS::CTI::emitJumpSlowCaseIfNotImm):
3298 (KJS::CTI::emitJumpSlowCaseIfNotImms):
3299 (KJS::CTI::emitFastArithDeTagImmediate):
3300 (KJS::CTI::emitFastArithReTagImmediate):
3301 (KJS::CTI::emitFastArithPotentiallyReTagImmediate):
3302 (KJS::CTI::emitFastArithImmToInt):
3303 (KJS::CTI::emitFastArithIntToImmOrSlowCase):
3304 (KJS::CTI::emitFastArithIntToImmNoCheck):
3306 (KJS::CTI::compileOpCall):
3307 (KJS::CTI::privateCompileMainPass):
3308 (KJS::CTI::privateCompileSlowCases):
3309 (KJS::CTI::privateCompile):
3310 (KJS::CTI::privateCompileGetByIdSelf):
3311 (KJS::CTI::privateCompileGetByIdProto):
3312 (KJS::CTI::privateCompileGetByIdChain):
3313 (KJS::CTI::privateCompilePutByIdReplace):
3314 (KJS::CTI::privateArrayLengthTrampoline):
3315 (KJS::CTI::privateStringLengthTrampoline):
3316 (KJS::CTI::compileRegExp):
3318 (KJS::CallRecord::CallRecord):
3319 (KJS::JmpTable::JmpTable):
3320 (KJS::SlowCaseEntry::SlowCaseEntry):
3321 (KJS::CTI::JSRInfo::JSRInfo):
3323 (KJS::RegExp::RegExp):
3325 (KJS::GenerateParenthesesNonGreedyFunctor::GenerateParenthesesNonGreedyFunctor):
3326 (KJS::GeneratePatternCharacterFunctor::generateAtom):
3327 (KJS::GeneratePatternCharacterFunctor::backtrack):
3328 (KJS::GenerateCharacterClassFunctor::generateAtom):
3329 (KJS::GenerateCharacterClassFunctor::backtrack):
3330 (KJS::GenerateBackreferenceFunctor::generateAtom):
3331 (KJS::GenerateBackreferenceFunctor::backtrack):
3332 (KJS::GenerateParenthesesNonGreedyFunctor::generateAtom):
3333 (KJS::GenerateParenthesesNonGreedyFunctor::backtrack):
3334 (KJS::WRECGenerate::generateBacktrack1):
3335 (KJS::WRECGenerate::generateBacktrackBackreference):
3336 (KJS::WRECGenerate::generateBackreferenceQuantifier):
3337 (KJS::WRECGenerate::generateNonGreedyQuantifier):
3338 (KJS::WRECGenerate::generateGreedyQuantifier):
3339 (KJS::WRECGenerate::generatePatternCharacter):
3340 (KJS::WRECGenerate::generateCharacterClassInvertedRange):
3341 (KJS::WRECGenerate::generateCharacterClassInverted):
3342 (KJS::WRECGenerate::generateCharacterClass):
3343 (KJS::WRECGenerate::generateParentheses):
3344 (KJS::WRECGenerate::generateParenthesesNonGreedy):
3345 (KJS::WRECGenerate::gererateParenthesesResetTrampoline):
3346 (KJS::WRECGenerate::generateAssertionBOL):
3347 (KJS::WRECGenerate::generateAssertionEOL):
3348 (KJS::WRECGenerate::generateAssertionWordBoundary):
3349 (KJS::WRECGenerate::generateBackreference):
3350 (KJS::WRECGenerate::gernerateDisjunction):
3351 (KJS::WRECGenerate::terminateDisjunction):
3352 (KJS::WRECParser::parseGreedyQuantifier):
3353 (KJS::WRECParser::parseQuantifier):
3354 (KJS::WRECParser::parsePatternCharacterQualifier):
3355 (KJS::WRECParser::parseCharacterClassQuantifier):
3356 (KJS::WRECParser::parseBackreferenceQuantifier):
3357 (KJS::WRECParser::parseParentheses):
3358 (KJS::WRECParser::parseCharacterClass):
3359 (KJS::WRECParser::parseOctalEscape):
3360 (KJS::WRECParser::parseEscape):
3361 (KJS::WRECParser::parseTerm):
3362 (KJS::WRECParser::parseDisjunction):
3364 (KJS::WRECGenerate::WRECGenerate):
3365 (KJS::WRECParser::):
3366 (KJS::WRECParser::WRECParser):
3367 (KJS::WRECParser::parseAlternative):
3368 (KJS::WRECParser::isEndOfPattern):
3370 2008-09-06 Oliver Hunt <oliver@apple.com>
3372 Reviewed by NOBODY (Build fix).
3374 Fix the sampler build.
3376 * VM/SamplingTool.h:
3378 2008-09-06 Oliver Hunt <oliver@apple.com>
3380 Reviewed by Maciej Stachowiak.
3382 Jump through the necessary hoops required to make MSVC cooperate with SFX
3384 We now explicitly declare the calling convention on all cti_op_* cfunctions,
3385 and return int instead of bool where appropriate (despite the cdecl calling
3386 convention seems to state MSVC generates code that returns the result value
3387 through ecx). SFX behaves slightly differently under MSVC, specifically it
3388 stores the base argument address for the cti_op_* functions in the first
3389 argument, and then does the required stack manipulation through that pointer.
3390 This is necessary as MSVC's optimisations assume they have complete control
3391 of the stack, and periodically elide our stack manipulations, or move
3392 values in unexpected ways. MSVC also frequently produces tail calls which may
3393 clobber the first argument, so the MSVC path is slightly less efficient due
3394 to the need to restore it.
3396 * JavaScriptCore.xcodeproj/project.pbxproj:
3399 (KJS::CTI::compileOpCall):
3400 (KJS::CTI::privateCompileMainPass):
3401 (KJS::CTI::privateCompileSlowCases):
3405 * masm/MacroAssembler.h:
3406 (KJS::MacroAssembler::emitConvertToFastCall):
3407 * masm/MacroAssemblerIA32GCC.cpp: Removed.
3408 For performance reasons we need these no-op functions to be inlined.
3410 * masm/MacroAssemblerWin.cpp:
3411 (KJS::MacroAssembler::emitRestoreArgumentReference):
3414 2008-09-05 Geoffrey Garen <ggaren@apple.com>
3416 Reviewed by Maciej Stachowiak, or maybe the other way around.
3418 Added the ability to coalesce JITCode buffer grow operations by first
3419 growing the buffer and then executing unchecked puts to it.
3421 About a 2% speedup on date-format-tofte.
3424 (KJS::CTI::compileOpCall):
3425 * masm/IA32MacroAsm.h:
3426 (KJS::JITCodeBuffer::ensureSpace):
3427 (KJS::JITCodeBuffer::putByteUnchecked):
3428 (KJS::JITCodeBuffer::putByte):
3429 (KJS::JITCodeBuffer::putShortUnchecked):
3430 (KJS::JITCodeBuffer::putShort):
3431 (KJS::JITCodeBuffer::putIntUnchecked):
3432 (KJS::JITCodeBuffer::putInt):
3433 (KJS::IA32MacroAssembler::emitTestl_i32r):
3434 (KJS::IA32MacroAssembler::emitMovl_mr):
3435 (KJS::IA32MacroAssembler::emitMovl_rm):
3436 (KJS::IA32MacroAssembler::emitMovl_i32m):
3437 (KJS::IA32MacroAssembler::emitUnlinkedJe):
3438 (KJS::IA32MacroAssembler::emitModRm_rr):
3439 (KJS::IA32MacroAssembler::emitModRm_rr_Unchecked):
3440 (KJS::IA32MacroAssembler::emitModRm_rm_Unchecked):
3441 (KJS::IA32MacroAssembler::emitModRm_rm):
3442 (KJS::IA32MacroAssembler::emitModRm_opr):
3443 (KJS::IA32MacroAssembler::emitModRm_opr_Unchecked):
3444 (KJS::IA32MacroAssembler::emitModRm_opm_Unchecked):
3446 2008-09-05 Mark Rowe <mrowe@apple.com>
3448 Reviewed by Sam Weinig.
3450 Disable WREC and CTI on platforms that we have not yet had a chance to test with.
3454 2008-09-05 Geoffrey Garen <ggaren@apple.com>
3456 Reviewed by Sam Weinig.
3458 Use jo instead of a mask compare when fetching array.length and
3459 string.length. 4% speedup on array.length / string.length torture
3463 (KJS::CTI::privateArrayLengthTrampoline):
3464 (KJS::CTI::privateStringLengthTrampoline):
3466 2008-09-05 Geoffrey Garen <ggaren@apple.com>
3468 Reviewed by Sam Weinig.
3470 Removed a CTI compilation pass by recording labels during bytecode
3471 generation. This is more to reduce complexity than it is to improve
3474 SunSpider reports no change.
3476 CodeBlock now keeps a "labels" set, which holds the offsets of all the
3477 instructions that can be jumped to.
3479 * VM/CTI.cpp: Nixed a pass.
3481 * VM/CodeBlock.h: Added a "labels" set.
3483 * VM/LabelID.h: No need for a special LableID for holding jump
3484 destinations, since the CodeBlock now knows all jump destinations.
3486 * wtf/HashTraits.h: New hash traits to accomodate putting offset 0 in
3490 (KJS::TryNode::emitCode): Emit a dummy label to record sret targets.
3492 2008-09-05 Mark Rowe <mrowe@apple.com>
3494 Reviewed by Oliver Hunt and Gavin Barraclough.
3496 Move the JITCodeBuffer onto Machine and remove the static variables.
3498 * VM/CTI.cpp: Initialize m_jit with the Machine's code buffer.
3500 (KJS::Machine::Machine): Allocate a JITCodeBuffer.
3502 * kjs/RegExpConstructor.cpp:
3503 (KJS::constructRegExp): Pass the ExecState through.
3504 * kjs/RegExpPrototype.cpp:
3505 (KJS::regExpProtoFuncCompile): Ditto.
3506 * kjs/StringPrototype.cpp:
3507 (KJS::stringProtoFuncMatch): Ditto.
3508 (KJS::stringProtoFuncSearch): Ditto.
3510 (KJS::RegExpNode::emitCode): Compile the pattern at code generation time
3511 so that we have access to an ExecState.
3513 (KJS::RegExpNode::):
3514 * kjs/nodes2string.cpp:
3516 (KJS::RegExp::RegExp): Pass the ExecState through.
3517 (KJS::RegExp::create): Ditto.
3519 * masm/IA32MacroAsm.h:
3520 (KJS::IA32MacroAssembler::IA32MacroAssembler): Reset the JITCodeBuffer when we are
3523 (KJS::WRECompiler::compile): Retrieve the JITCodeBuffer from the Machine.
3526 2008-09-05 Mark Rowe <mrowe@apple.com>
3528 Reviewed by Oliver Hunt and Gavin Barraclough.
3530 Fix the build when CTI is disabled.
3533 (KJS::CodeBlock::~CodeBlock):
3534 * VM/CodeGenerator.cpp:
3535 (KJS::prepareJumpTableForStringSwitch):
3537 (KJS::Machine::Machine):
3538 (KJS::Machine::~Machine):
3540 2008-09-05 Gavin Barraclough <barraclough@apple.com>
3542 Reviewed by Mark Rowe.
3544 Fix some windows abi issues.
3547 (KJS::CTI::privateCompileMainPass):
3548 (KJS::CTI::privateCompileSlowCases):
3550 (KJS::CallRecord::CallRecord):
3553 (KJS::Machine::cti_op_resolve_func):
3554 (KJS::Machine::cti_op_post_inc):
3555 (KJS::Machine::cti_op_resolve_with_base):
3556 (KJS::Machine::cti_op_post_dec):
3559 2008-09-05 Mark Rowe <mrowe@apple.com>
3561 Reviewed by Sam Weinig.
3563 Fix ecma/FunctionObjects/15.3.5.3.js after I broke it in r93.
3566 (KJS::Machine::cti_op_call_NotJSFunction): Restore m_callFrame to the correct value after making the native call.
3567 (KJS::Machine::cti_op_construct_NotJSConstruct): Ditto.
3569 2008-09-04 Mark Rowe <mrowe@apple.com>
3571 Reviewed by Sam Weinig.
3573 Fix fast/dom/Window/console-functions.html.
3575 The call frame on the ExecState was not being updated on calls into native functions. This meant that functions
3576 such as console.log would use the line number of the last JS function on the call stack.
3579 (KJS::Machine::cti_op_call_NotJSFunction): Update the ExecState's call frame before making a native function call,
3580 and restore it when the function is done.
3581 (KJS::Machine::cti_op_construct_NotJSConstruct): Ditto.
3583 2008-09-05 Oliver Hunt <oliver@apple.com>
3585 Start bringing up SFX on windows.
3587 Reviewed by Mark Rowe and Sam Weinig
3589 Start doing the work to bring up SFX on windows. Initially
3590 just working on WREC, as it does not make any calls so reduces
3591 the amount of code that needs to be corrected.
3593 Start abstracting the CTI JIT codegen engine.
3596 * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
3597 * JavaScriptCore.xcodeproj/project.pbxproj:
3599 * masm/IA32MacroAsm.h:
3600 * masm/MacroAssembler.h: Added.
3601 (KJS::MacroAssembler::MacroAssembler):
3602 * masm/MacroAssemblerIA32GCC.cpp: Added.
3603 (KJS::MacroAssembler::emitConvertToFastCall):
3604 * masm/MacroAssemblerWin.cpp: Added.
3605 (KJS::MacroAssembler::emitConvertToFastCall):
3607 (KJS::WRECompiler::parseGreedyQuantifier):
3608 (KJS::WRECompiler::parseCharacterClass):
3609 (KJS::WRECompiler::parseEscape):
3610 (KJS::WRECompiler::compilePattern):
3613 2008-09-04 Gavin Barraclough <barraclough@apple.com>
3615 Reviewed by Sam Weinig.
3617 Support for slow scripts (timeout checking).
3620 (KJS::CTI::privateCompileMainPass):
3621 (KJS::CTI::privateCompile):
3623 (KJS::slideRegisterWindowForCall):
3624 (KJS::Machine::cti_timeout_check):
3625 (KJS::Machine::cti_vm_throw):
3627 2008-09-04 Sam Weinig <sam@webkit.org>
3629 Reviewed by Mark Rowe.
3631 Third round of style cleanup.
3640 2008-09-04 Sam Weinig <sam@webkit.org>
3642 Reviewed by Jon Honeycutt.
3644 Second round of style cleanup.
3650 2008-09-04 Sam Weinig <sam@webkit.org>
3652 Reviewed by Mark Rowe.
3654 First round of style cleanup.
3658 * masm/IA32MacroAsm.h:
3662 2008-09-04 Geoffrey Garen <ggaren@apple.com>
3664 Reviewed by Mark Rowe.
3666 Merged http://trac.webkit.org/changeset/36081 to work with CTI.
3669 (KJS::Machine::tryCtiCacheGetByID):
3671 2008-09-04 Gavin Barraclough <barraclough@apple.com>
3673 Reviewed by Sam Weinig.
3675 Enable profiling in CTI.
3679 (KJS::CTI::execute):
3681 (KJS::Machine::cti_op_call_JSFunction):
3682 (KJS::Machine::cti_op_call_NotJSFunction):
3683 (KJS::Machine::cti_op_ret):
3684 (KJS::Machine::cti_op_construct_JSConstruct):
3685 (KJS::Machine::cti_op_construct_NotJSConstruct):
3687 2008-09-04 Victor Hernandez <vhernandez@apple.com>
3689 Reviewed by Geoffrey Garen.
3691 Fixed an #if to support using WREC without CTI.
3694 (KJS::RegExp::match):
3696 2008-09-04 Gavin Barraclough <barraclough@apple.com>
3698 Reviewed by Oliver Hunt.
3700 The array/string length trampolines are owned by the Machine, not the codeblock that compiled them.
3703 (KJS::CTI::privateArrayLengthTrampoline):
3704 (KJS::CTI::privateStringLengthTrampoline):
3706 (KJS::Machine::~Machine):
3709 2008-09-04 Mark Rowe <mrowe@apple.com>
3711 Reviewed by Gavin Barraclough and Sam Weinig.
3713 Fix a crash on launch of jsc when GuardMalloc is enabled.
3716 (KJS::ScopeChain::ScopeChain): Initialize m_node to 0 when we have no valid scope chain.
3717 (KJS::ScopeChain::~ScopeChain): Null-check m_node before calling deref.
3719 2008-09-03 Oliver Hunt <oliver@apple.com>
3721 Reviewed by Gavin Barraclough and Geoff Garen.
3723 Fix inspector and fast array access so that it bounds
3727 (KJS::CTI::privateCompile_pass2_Main):
3728 * masm/IA32MacroAsm.h:
3729 (KJS::IA32MacroAssembler::):
3730 (KJS::IA32MacroAssembler::emitUnlinkedJb):
3731 (KJS::IA32MacroAssembler::emitUnlinkedJbe):
3733 2008-09-03 Mark Rowe <mrowe@apple.com>
3735 Move the assertion after the InitializeAndReturn block, as
3736 that is used even when CTI is enabled.
3739 (KJS::Machine::privateExecute):
3741 2008-09-03 Mark Rowe <mrowe@apple.com>
3743 Reviewed by Sam Weinig.
3745 Replace calls to exit with ASSERT_WITH_MESSAGE or ASSERT_NOT_REACHED.
3748 (KJS::CTI::privateCompile_pass1_Scan):
3749 (KJS::CTI::privateCompile_pass2_Main):
3750 (KJS::CTI::privateCompile_pass4_SlowCases):
3752 (KJS::Machine::privateExecute):
3753 (KJS::Machine::cti_vm_throw):
3755 2008-09-03 Mark Rowe <mrowe@apple.com>
3757 Reviewed by Sam Weinig.
3759 Tweak JavaScriptCore to compile on non-x86 platforms. This is achieved
3760 by wrapping more code with ENABLE(CTI), ENABLE(WREC), and PLATFORM(X86)
3766 (KJS::CodeBlock::printStructureIDs): Use %td as the format specifier for
3767 printing a ptrdiff_t.
3771 (KJS::RegExp::RegExp):
3772 (KJS::RegExp::~RegExp):
3773 (KJS::RegExp::match):
3775 * masm/IA32MacroAsm.h:
3778 * wtf/Platform.h: Only enable CTI and WREC on x86. Add an extra define to
3779 track whether any MASM-using features are enabled.
3781 2008-09-03 Gavin Barraclough <barraclough@apple.com>
3783 Reviewed by Oliver Hunt.
3785 Copy Geoff's array/string length optimization for CTI.
3788 (KJS::CTI::privateArrayLengthTrampoline):
3789 (KJS::CTI::privateStringLengthTrampoline):
3791 (KJS::CTI::compileArrayLengthTrampoline):
3792 (KJS::CTI::compileStringLengthTrampoline):
3794 (KJS::Machine::Machine):
3795 (KJS::Machine::getCtiArrayLengthTrampoline):
3796 (KJS::Machine::getCtiStringLengthTrampoline):
3797 (KJS::Machine::tryCtiCacheGetByID):
3798 (KJS::Machine::cti_op_get_by_id_second):
3803 2008-09-03 Gavin Barraclough <barraclough@apple.com>
3805 Reviewed by Oliver Hunt.
3807 Implement fast array accesses in CTI - 2-3% progression on sunspider.
3810 (KJS::CTI::emitFastArithIntToImmNoCheck):
3811 (KJS::CTI::compileOpCall):
3812 (KJS::CTI::privateCompile_pass2_Main):
3813 (KJS::CTI::privateCompile_pass4_SlowCases):
3817 2008-09-02 Gavin Barraclough <barraclough@apple.com>
3819 Reviewed by Oliver Hunt.
3821 Enable fast property access support in CTI.
3824 (KJS::ctiSetReturnAddress):
3825 (KJS::ctiRepatchCallByReturnAddress):
3826 (KJS::CTI::privateCompile_pass2_Main):
3827 (KJS::CTI::privateCompile):
3828 (KJS::CTI::privateCompileGetByIdSelf):
3829 (KJS::CTI::privateCompileGetByIdProto):
3830 (KJS::CTI::privateCompileGetByIdChain):
3831 (KJS::CTI::privateCompilePutByIdReplace):
3833 (KJS::CTI::compileGetByIdSelf):
3834 (KJS::CTI::compileGetByIdProto):
3835 (KJS::CTI::compileGetByIdChain):
3836 (KJS::CTI::compilePutByIdReplace):
3838 (KJS::CodeBlock::~CodeBlock):
3841 (KJS::doSetReturnAddressVmThrowTrampoline):
3842 (KJS::Machine::tryCtiCachePutByID):
3843 (KJS::Machine::tryCtiCacheGetByID):
3844 (KJS::Machine::cti_op_put_by_id):
3845 (KJS::Machine::cti_op_put_by_id_second):
3846 (KJS::Machine::cti_op_put_by_id_generic):
3847 (KJS::Machine::cti_op_put_by_id_fail):
3848 (KJS::Machine::cti_op_get_by_id):
3849 (KJS::Machine::cti_op_get_by_id_second):
3850 (KJS::Machine::cti_op_get_by_id_generic):
3851 (KJS::Machine::cti_op_get_by_id_fail):
3852 (KJS::Machine::cti_op_throw):
3853 (KJS::Machine::cti_vm_throw):
3857 * kjs/PropertyMap.h:
3858 * kjs/StructureID.cpp:
3859 (KJS::StructureIDChain::StructureIDChain):
3860 * masm/IA32MacroAsm.h:
3861 (KJS::IA32MacroAssembler::emitCmpl_i32m):
3862 (KJS::IA32MacroAssembler::emitMovl_mr):
3863 (KJS::IA32MacroAssembler::emitMovl_rm):
3865 2008-09-02 Sam Weinig <sam@webkit.org>
3867 Reviewed by Gavin Barraclough and Mark Rowe.
3869 A backslash (\) at the of a RegEx should produce an error.
3870 Fixes fast/regex/test1.html.
3873 (KJS::WRECompiler::parseEscape):
3875 2008-09-02 Sam Weinig <sam@webkit.org>
3877 Reviewed by Geoff Garen.
3879 Link jumps for the slow case of op_loop_if_less. Fixes acid3.
3882 (KJS::CTI::privateCompile_pass4_SlowCases):
3884 2008-09-01 Sam Weinig <sam@webkit.org>
3886 Rubber-stamped by Maciej Stachowiak.
3888 Switch WREC on by default.
3892 2008-09-01 Sam Weinig <sam@webkit.org>
3894 Reviewed by Mark Rowe.
3896 Fix two failures in fast/regex/test1.html
3897 - \- in a character class should be treated as a literal -
3898 - A missing max quantifier needs to be treated differently than
3899 a null max quantifier.
3902 (KJS::WRECompiler::generateNonGreedyQuantifier):
3903 (KJS::WRECompiler::generateGreedyQuantifier):
3904 (KJS::WRECompiler::parseCharacterClass):
3906 (KJS::Quantifier::Quantifier):
3908 2008-09-01 Sam Weinig <sam@webkit.org>
3910 Reviewed by Mark Rowe.
3912 Fix crash in fast/js/kde/evil-n.html
3914 * kjs/regexp.cpp: Always pass a non-null offset vector to the wrec function.
3916 2008-09-01 Sam Weinig <sam@webkit.org>
3918 Reviewed by Gavin Barraclough and Mark Rowe.
3920 Add pattern length limit fixing one test in fast/js.
3923 (KJS::WRECompiler::compile):
3925 (KJS::WRECompiler::):
3927 2008-09-01 Sam Weinig <sam@webkit.org>
3929 Reviewed by Gavin Barraclough and Mark Rowe.
3931 Make octal escape parsing/back-reference parsing more closely match
3932 prior behavior fixing one test in fast/js.
3935 (KJS::WRECompiler::parseCharacterClass): 8 and 9 should be IdentityEscaped
3936 (KJS::WRECompiler::parseEscape):
3938 (KJS::WRECompiler::peekDigit):
3940 2008-09-01 Sam Weinig <sam@webkit.org>
3942 Reviewed by Gavin Barraclough and Mark Rowe.
3944 Fix one mozilla test.
3947 (KJS::WRECompiler::generateCharacterClassInverted): Fix incorrect not
3950 2008-09-01 Sam Weinig <sam@webkit.org>
3952 Reviewed by Gavin Barraclough and Mark Rowe.
3954 Parse octal escapes in character classes fixing one mozilla test.
3957 (KJS::WRECompiler::parseCharacterClass):
3958 (KJS::WRECompiler::parseOctalEscape):
3960 (KJS::WRECompiler::consumeOctal):
3962 2008-09-01 Sam Weinig <sam@webkit.org>
3964 Reviewed by Oliver Hunt.
3966 Fixes two mozilla tests with WREC enabled.
3969 (KJS::CharacterClassConstructor::append): Keep the character class sorted
3970 when appending another character class.
3972 2008-09-01 Sam Weinig <sam@webkit.org>
3974 Reviewed by Gavin Barraclough and Mark Rowe.
3976 Fixes two mozilla tests with WREC enabled.
3979 (KJS::CharacterClassConstructor::addSortedRange): Insert the range at the correct position
3980 instead of appending it to the end.
3982 2008-09-01 Gavin Barraclough <barraclough@apple.com>
3984 Reviewed by Oliver Hunt.
3986 Move cross-compilation unit call into NEVER_INLINE function.
3989 (KJS::doSetReturnAddressVmThrowTrampoline):
3991 2008-09-01 Sam Weinig <sam@webkit.org>
3993 Reviewed by Gavin Barraclough and Geoff Garen.
3995 Fix one test in fast/js.
3998 (KJS::Machine::cti_op_construct_NotJSConstruct): Throw a createNotAConstructorError,
3999 instead of a createNotAFunctionError.
4001 2008-08-31 Gavin Barraclough <barraclough@apple.com>
4003 Reviewed by Maciej Stachowiak.
4005 Zero-cost exception handling. This patch takes the exception checking
4006 back of the hot path. When an exception occurs in a Machine::cti*
4007 method, the return address to JIT code is recorded, and is then
4008 overwritten with a pointer to a trampoline routine. When the method
4009 returns the trampoline will cause the cti_vm_throw method to be invoked.
4011 cti_vm_throw uses the return address preserved above, to discover the
4012 vPC of the bytecode that raised the exception (using a map build during
4013 translation). From the VPC of the faulting bytecode the vPC of a catch
4014 routine may be discovered (unwinding the stack where necesary), and then
4015 a bytecode address for the catch routine is looked up. Final cti_vm_throw
4016 overwrites its return address to JIT code again, to trampoline directly
4017 to the catch routine.
4019 cti_op_throw is handled in a similar fashion.
4022 (KJS::CTI::emitPutCTIParam):
4023 (KJS::CTI::emitPutToCallFrameHeader):
4024 (KJS::CTI::emitGetFromCallFrameHeader):
4025 (KJS::ctiSetReturnAddressForArgs):
4026 (KJS::CTI::emitDebugExceptionCheck):
4027 (KJS::CTI::printOpcodeOperandTypes):
4028 (KJS::CTI::emitCall):
4029 (KJS::CTI::compileOpCall):
4030 (KJS::CTI::privateCompile_pass2_Main):
4031 (KJS::CTI::privateCompile):
4033 (KJS::CallRecord::CallRecord):
4035 (KJS::CTI::execute):
4038 (KJS::Machine::privateExecute):
4039 (KJS::Machine::cti_op_instanceof):
4040 (KJS::Machine::cti_op_call_NotJSFunction):
4041 (KJS::Machine::cti_op_resolve):
4042 (KJS::Machine::cti_op_resolve_func):
4043 (KJS::Machine::cti_op_resolve_skip):
4044 (KJS::Machine::cti_op_resolve_with_base):
4045 (KJS::Machine::cti_op_throw):
4046 (KJS::Machine::cti_op_in):
4047 (KJS::Machine::cti_vm_throw):
4048 * VM/RegisterFile.h:
4049 (KJS::RegisterFile::):
4051 (KJS::ExecState::setCtiReturnAddress):
4052 (KJS::ExecState::ctiReturnAddress):
4053 * masm/IA32MacroAsm.h:
4054 (KJS::IA32MacroAssembler::):
4055 (KJS::IA32MacroAssembler::emitPushl_m):
4056 (KJS::IA32MacroAssembler::emitPopl_m):
4057 (KJS::IA32MacroAssembler::getRelocatedAddress):
4059 2008-08-31 Mark Rowe <mrowe@apple.com>
4061 Reviewed by Oliver Hunt.
4063 Fall back to PCRE for any regexp containing parentheses until we correctly backtrack within them.
4066 (KJS::WRECompiler::parseParentheses):
4068 (KJS::WRECompiler::):
4070 2008-08-31 Mark Rowe <mrowe@apple.com>
4072 Reviewed by Oliver Hunt.
4074 Fix several issues within ecma_3/RegExp/perlstress-001.js with WREC enabled.
4077 (KJS::WRECompiler::generateNonGreedyQuantifier): Compare with the maximum quantifier count rather than the minimum.
4078 (KJS::WRECompiler::generateAssertionEOL): Do a register-to-register comparison rather than immediate-to-register.
4079 (KJS::WRECompiler::parseCharacterClass): Pass through the correct inversion flag.
4081 2008-08-30 Mark Rowe <mrowe@apple.com>
4083 Reviewed by Oliver Hunt.
4085 Re-fix the six remaining failures in the Mozilla JavaScript tests in a manner that does not kill performance.
4086 This shows up as a 0.6% progression on SunSpider on my machine.
4088 Grow the JITCodeBuffer's underlying buffer when we run out of space rather than just bailing out.
4091 (KJS::CodeBlock::~CodeBlock): Switch to using fastFree now that JITCodeBuffer::copy uses fastMalloc.
4092 * kjs/regexp.cpp: Ditto.
4093 * masm/IA32MacroAsm.h:
4094 (KJS::JITCodeBuffer::growBuffer):
4095 (KJS::JITCodeBuffer::JITCodeBuffer):
4096 (KJS::JITCodeBuffer::~JITCodeBuffer):
4097 (KJS::JITCodeBuffer::putByte):
4098 (KJS::JITCodeBuffer::putShort):
4099 (KJS::JITCodeBuffer::putInt):
4100 (KJS::JITCodeBuffer::reset):
4101 (KJS::JITCodeBuffer::copy):
4103 2008-08-29 Oliver Hunt <oliver@apple.com>
4107 Roll out previous patch as it causes a 5% performance regression
4109 * JavaScriptCore.xcodeproj/project.pbxproj:
4112 (KJS::CTI::privateCompile):
4114 (KJS::CodeBlock::~CodeBlock):
4115 * masm/IA32MacroAsm.h:
4116 (KJS::JITCodeBuffer::JITCodeBuffer):
4117 (KJS::JITCodeBuffer::putByte):
4118 (KJS::JITCodeBuffer::putShort):
4119 (KJS::JITCodeBuffer::putInt):
4120 (KJS::JITCodeBuffer::getEIP):
4121 (KJS::JITCodeBuffer::start):
4122 (KJS::JITCodeBuffer::getOffset):
4123 (KJS::JITCodeBuffer::reset):
4124 (KJS::JITCodeBuffer::copy):
4125 (KJS::IA32MacroAssembler::emitModRm_rr):
4126 (KJS::IA32MacroAssembler::emitModRm_rm):
4127 (KJS::IA32MacroAssembler::emitModRm_rmsib):
4128 (KJS::IA32MacroAssembler::IA32MacroAssembler):
4129 (KJS::IA32MacroAssembler::emitInt3):
4130 (KJS::IA32MacroAssembler::emitPushl_r):
4131 (KJS::IA32MacroAssembler::emitPopl_r):
4132 (KJS::IA32MacroAssembler::emitMovl_rr):
4133 (KJS::IA32MacroAssembler::emitAddl_rr):
4134 (KJS::IA32MacroAssembler::emitAddl_i8r):
4135 (KJS::IA32MacroAssembler::emitAddl_i32r):
4136 (KJS::IA32MacroAssembler::emitAddl_mr):
4137 (KJS::IA32MacroAssembler::emitAndl_rr):
4138 (KJS::IA32MacroAssembler::emitAndl_i32r):
4139 (KJS::IA32MacroAssembler::emitCmpl_i8r):
4140 (KJS::IA32MacroAssembler::emitCmpl_rr):
4141 (KJS::IA32MacroAssembler::emitCmpl_rm):
4142 (KJS::IA32MacroAssembler::emitCmpl_i32r):
4143 (KJS::IA32MacroAssembler::emitCmpl_i32m):
4144 (KJS::IA32MacroAssembler::emitCmpw_rm):
4145 (KJS::IA32MacroAssembler::emitOrl_rr):
4146 (KJS::IA32MacroAssembler::emitOrl_i8r):
4147 (KJS::IA32MacroAssembler::emitSubl_rr):
4148 (KJS::IA32MacroAssembler::emitSubl_i8r):
4149 (KJS::IA32MacroAssembler::emitSubl_i32r):
4150 (KJS::IA32MacroAssembler::emitSubl_mr):
4151 (KJS::IA32MacroAssembler::emitTestl_i32r):
4152 (KJS::IA32MacroAssembler::emitTestl_rr):
4153 (KJS::IA32MacroAssembler::emitXorl_i8r):
4154 (KJS::IA32MacroAssembler::emitXorl_rr):
4155 (KJS::IA32MacroAssembler::emitSarl_i8r):
4156 (KJS::IA32MacroAssembler::emitSarl_CLr):
4157 (KJS::IA32MacroAssembler::emitShl_i8r):
4158 (KJS::IA32MacroAssembler::emitShll_CLr):
4159 (KJS::IA32MacroAssembler::emitMull_rr):
4160 (KJS::IA32MacroAssembler::emitIdivl_r):
4161 (KJS::IA32MacroAssembler::emitCdq):
4162 (KJS::IA32MacroAssembler::emitMovl_mr):
4163 (KJS::IA32MacroAssembler::emitMovzwl_mr):
4164 (KJS::IA32MacroAssembler::emitMovl_rm):
4165 (KJS::IA32MacroAssembler::emitMovl_i32r):
4166 (KJS::IA32MacroAssembler::emitMovl_i32m):
4167 (KJS::IA32MacroAssembler::emitLeal_mr):
4168 (KJS::IA32MacroAssembler::emitRet):
4169 (KJS::IA32MacroAssembler::emitJmpN_r):
4170 (KJS::IA32MacroAssembler::emitJmpN_m):
4171 (KJS::IA32MacroAssembler::emitCall):
4172 (KJS::IA32MacroAssembler::label):
4173 (KJS::IA32MacroAssembler::emitUnlinkedJmp):
4174 (KJS::IA32MacroAssembler::emitUnlinkedJne):
4175 (KJS::IA32MacroAssembler::emitUnlinkedJe):
4176 (KJS::IA32MacroAssembler::emitUnlinkedJl):
4177 (KJS::IA32MacroAssembler::emitUnlinkedJle):
4178 (KJS::IA32MacroAssembler::emitUnlinkedJge):
4179 (KJS::IA32MacroAssembler::emitUnlinkedJae):
4180 (KJS::IA32MacroAssembler::emitUnlinkedJo):
4181 (KJS::IA32MacroAssembler::link):
4183 (KJS::WRECompiler::compilePattern):
4184 (KJS::WRECompiler::compile):
4187 2008-08-29 Mark Rowe <mrowe@apple.com>
4189 Reviewed by Oliver Hunt.
4191 Have JITCodeBuffer manage a Vector containing the generated code so that it can grow
4192 as needed when generating code for a large function. This fixes all six remaining failures
4193 in Mozilla tests in both debug and release builds.
4196 (KJS::CTI::privateCompile):
4198 (KJS::CodeBlock::~CodeBlock):
4199 * masm/IA32MacroAsm.h:
4200 (KJS::JITCodeBuffer::putByte):
4201 (KJS::JITCodeBuffer::putShort):
4202 (KJS::JITCodeBuffer::putInt):
4203 (KJS::JITCodeBuffer::getEIP):
4204 (KJS::JITCodeBuffer::start):
4205 (KJS::JITCodeBuffer::getOffset):
4206 (KJS::JITCodeBuffer::getCode):
4207 (KJS::IA32MacroAssembler::emitModRm_rr):
4209 (KJS::WRECompiler::compilePattern):
4212 2008-08-29 Mark Rowe <mrowe@apple.com>
4214 Reviewed by Oliver Hunt.
4216 Implement parsing of octal escapes in regular expressions. This fixes three Mozilla tests.
4219 (KJS::WRECompiler::parseOctalEscape):
4220 (KJS::WRECompiler::parseEscape): Parse the escape sequence as an octal escape if it has a leading zero.
4221 Add a FIXME about treating invalid backreferences as octal escapes in the future.
4223 (KJS::WRECompiler::consumeNumber): Multiply by 10 rather than 0 so that we handle numbers with more than
4226 (WTF::isASCIIOctalDigit):
4228 2008-08-29 Sam Weinig <sam@webkit.org>
4230 Reviewed by Mark Rowe.
4232 Pass vPC to instanceof method. Fixes 2 mozilla tests in debug.
4235 (KJS::CTI::privateCompile_pass2_Main):
4237 (KJS::Machine::cti_op_instanceof):
4239 2008-08-29 Sam Weinig <sam@webkit.org>
4241 Reviewed by Mark Rowe.
4243 Pass vPCs to resolve methods for correct exception creation. Fixes
4244 17 mozilla tests in debug.
4247 (KJS::CTI::privateCompile_pass2_Main):
4250 (KJS::Machine::cti_op_resolve):
4251 (KJS::Machine::cti_op_resolve_func):
4252 (KJS::Machine::cti_op_resolve_skip):
4253 (KJS::Machine::cti_op_resolve_with_base):
4255 2008-08-29 Gavin Barraclough <barraclough@apple.com>
4257 Reviewed by Oliver Hunt.
4259 Remembering to actually throw the exception passed to op throw helps.
4260 Regressions 19 -> 6.
4263 (KJS::Machine::cti_op_throw):
4264 (KJS::Machine::cti_vm_throw):
4266 2008-08-29 Gavin Barraclough <barraclough@apple.com>
4268 Reviewed by Sam Weinig.
4270 Support for exception unwinding the stack.
4272 Once upon a time, Sam asked me for a bettr ChangeLog entry. The return address
4273 is now preserved on entry to a JIT code function (if we preserve lazily we need
4274 restore the native return address during exception stack unwind). This takes
4275 the number of regressions down from ~150 to 19.
4279 (KJS::CTI::emitExceptionCheck):
4280 (KJS::CTI::compileOpCall):
4281 (KJS::CTI::privateCompile_pass2_Main):
4282 (KJS::CTI::privateCompile):
4286 (KJS::Machine::throwException):
4287 (KJS::Machine::cti_op_call_JSFunction):
4288 (KJS::Machine::cti_op_call_NotJSFunction):
4289 (KJS::Machine::cti_op_construct_JSConstruct):
4290 (KJS::Machine::cti_op_construct_NotJSConstruct):
4291 (KJS::Machine::cti_op_throw):
4292 (KJS::Machine::cti_vm_throw):
4294 2008-08-29 Mark Rowe <mrowe@apple.com>
4296 Reviewed by Oliver Hunt.
4298 Fix js1_2/regexp/word_boundary.js and four other Mozilla tests with WREC enabled.
4301 (KJS::WRECompiler::generateCharacterClassInvertedRange): If none of the exact matches
4302 succeeded, jump to failure.
4303 (KJS::WRECompiler::compilePattern): Restore and increment the current position stored
4304 on the stack to ensure that it will be reset to the correct position after a failed
4305 match has consumed input.
4307 2008-08-29 Mark Rowe <mrowe@apple.com>
4309 Reviewed by Oliver Hunt.
4311 Fix a hang in ecma_3/RegExp/15.10.2-1.js with WREC enabled.
4312 A backreference with a quantifier would get stuck in an infinite
4313 loop if the captured range was empty.
4316 (KJS::WRECompiler::generateBackreferenceQuantifier): If the captured range
4317 was empty, do not attempt to match the backreference.
4318 (KJS::WRECompiler::parseBackreferenceQuantifier):
4320 (KJS::Quantifier::):