1 2008-10-22 Oliver Hunt <oliver@apple.com>
3 Reviewed by Maciej Stachowiak.
5 Really "fix" CTI mode on windows 2k3.
7 This adds new methods fastMallocExecutable and fastFreeExecutable
8 to wrap allocation for cti code. This still just makes fastMalloc
9 return executable memory all the time, which will be fixed in a
12 However in windows debug builds all executable allocations will be
13 allocated on separate executable pages, which should resolve any
14 remaining 2k3 issues. Conveniently the 2k3 bot will now also fail
15 if there are any fastFree vs. fastFreeExecutable errors.
19 (JSC::CodeBlock::~CodeBlock):
21 (JSC::RegExp::~RegExp):
22 * masm/X86Assembler.h:
23 (JSC::JITCodeBuffer::copy):
25 (WTF::fastMallocExecutable):
26 (WTF::fastFreeExecutable):
27 (WTF::TCMallocStats::fastMallocExecutable):
28 (WTF::TCMallocStats::fastFreeExecutable):
31 2008-10-22 Darin Adler <darin@apple.com>
33 Reviewed by Sam Weinig.
35 - fix https://bugs.webkit.org/show_bug.cgi?id=21294
36 Bug 21294: Devirtualize getOwnPropertySlot()
38 A bit over 3% faster on V8 tests.
40 * JavascriptCore.exp: Export leak-related functions..
42 * API/JSCallbackConstructor.h:
43 (JSC::JSCallbackConstructor::createStructureID): Set HasStandardGetOwnPropertySlot
44 since this class doesn't override getPropertySlot.
45 * API/JSCallbackFunction.h:
46 (JSC::JSCallbackFunction::createStructureID): Ditto.
48 * VM/ExceptionHelpers.cpp:
49 (JSC::InterruptedExecutionError::InterruptedExecutionError): Use a structure
50 that's created just for this class instead of trying to share a single "null
54 (JSC::Machine::cti_op_create_arguments_no_params): Rename
55 Arguments::ArgumentsNoParameters to Arguments::NoParameters.
57 * kjs/Arguments.h: Rename the enum from Arguments::ArgumentsParameters to
58 Arguments::NoParametersType and the value from Arguments::ArgumentsNoParameters
59 to Arguments::NoParameters.
60 (JSC::Arguments::createStructureID): Added. Returns a structure without
61 HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
62 (JSC::Arguments::Arguments): Added an assertion that there are no parameters.
64 * kjs/DatePrototype.h:
65 (JSC::DatePrototype::createStructureID): Added. Returns a structure without
66 HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
68 * kjs/FunctionPrototype.h:
69 (JSC::FunctionPrototype::createStructureID): Set HasStandardGetOwnPropertySlot
70 since this class doesn't override getPropertySlot.
71 * kjs/InternalFunction.h:
72 (JSC::InternalFunction::createStructureID): Ditto.
75 (JSC::JSArray::createStructureID): Added. Returns a structure without
76 HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
78 * kjs/JSCell.h: Added declaration of fastGetOwnPropertySlot; a non-virtual
79 version that uses the structure bit to decide whether to call the virtual
83 (JSC::JSFunction::createStructureID): Added. Returns a structure without
84 HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
86 * kjs/JSGlobalData.cpp:
87 (JSC::JSGlobalData::JSGlobalData): Initialize new structures; removed
89 * kjs/JSGlobalData.h: Added new structures. Removed nullProtoStructureID.
91 * kjs/JSGlobalObject.h:
92 (JSC::JSGlobalObject::createStructureID): Added. Returns a structure without
93 HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
95 * kjs/JSNotAnObject.h:
96 (JSC::JSNotAnObjectErrorStub::JSNotAnObjectErrorStub): Use a structure
97 that's created just for this class instead of trying to share a single "null
99 (JSC::JSNotAnObjectErrorStub::isNotAnObjectErrorStub): Marked this function
100 virtual for clarity and made it private since no one should call it if they
101 already have a pointer to this specific type.
102 (JSC::JSNotAnObject::JSNotAnObject): Use a structure that's created just
103 for this class instead of trying to share a single "null prototype" structure.
104 (JSC::JSNotAnObject::createStructureID): Added. Returns a structure without
105 HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
108 (JSC::JSObject::createStructureID): Added HasStandardGetOwnPropertySlot.
109 (JSC::JSObject::inlineGetOwnPropertySlot): Added. Used so we can share code
110 between getOwnPropertySlot and fastGetOwnPropertySlot.
111 (JSC::JSObject::getOwnPropertySlot): Moved so that functions are above the
112 functions that call them. Moved the guts of this function into
113 inlineGetOwnPropertySlot.
114 (JSC::JSCell::fastGetOwnPropertySlot): Added. Checks the
115 HasStandardGetOwnPropertySlot bit and if it's set, calls
116 inlineGetOwnPropertySlot, otherwise calls getOwnPropertySlot.
117 (JSC::JSObject::getPropertySlot): Changed to call fastGetOwnPropertySlot.
118 (JSC::JSValue::get): Changed to call fastGetOwnPropertySlot.
120 * kjs/JSWrapperObject.h: Made constructor protected to emphasize that
121 this class is only a base class and never instantiated.
124 (JSC::MathObject::createStructureID): Added. Returns a structure without
125 HasStandardGetOwnPropertySlot since this class overrides getOwnPropertySlot.
126 * kjs/NumberConstructor.h:
127 (JSC::NumberConstructor::createStructureID): Ditto.
128 * kjs/RegExpConstructor.h:
129 (JSC::RegExpConstructor::createStructureID): Ditto.
130 * kjs/RegExpObject.h:
131 (JSC::RegExpObject::createStructureID): Ditto.
132 * kjs/StringObject.h:
133 (JSC::StringObject::createStructureID): Ditto.
135 * kjs/TypeInfo.h: Added HasStandardGetOwnPropertySlot flag and
136 hasStandardGetOwnPropertySlot accessor function.
138 2008-10-22 Cameron Zwarich <zwarich@apple.com>
140 Reviewed by Geoff Garen.
142 Bug 21803: Fuse op_jfalse with op_eq_null and op_neq_null
143 <https://bugs.webkit.org/show_bug.cgi?id=21803>
145 Fuse op_jfalse with op_eq_null and op_neq_null to make the new opcodes
146 op_jeq_null and op_jneq_null.
148 This is a 2.6% speedup on the V8 Raytrace benchmark, and strangely also
149 a 4.7% speedup on the V8 Arguments benchmark, even though it uses
150 neither of the two new opcodes.
153 (JSC::CTI::privateCompileMainPass):
155 (JSC::CodeBlock::dump):
156 * VM/CodeGenerator.cpp:
157 (JSC::CodeGenerator::emitJumpIfTrue):
158 (JSC::CodeGenerator::emitJumpIfFalse):
160 (JSC::Machine::privateExecute):
163 2008-10-22 Darin Fisher <darin@chromium.org>
165 Reviewed by Eric Seidel.
167 Should not define PLATFORM(WIN,MAC,GTK) when PLATFORM(CHROMIUM) is defined
168 https://bugs.webkit.org/show_bug.cgi?id=21757
170 PLATFORM(CHROMIUM) implies HAVE_ACCESSIBILITY
174 2008-10-22 Cameron Zwarich <zwarich@apple.com>
176 Reviewed by Alexey Proskuryakov.
178 Correct opcode names in documentation.
181 (JSC::Machine::privateExecute):
183 2008-10-21 Oliver Hunt <oliver@apple.com>
185 RS=Maciej Stachowiak.
187 Force FastMalloc to make all allocated pages executable in
188 a vague hope this will allow the Win2k3 bot to be able to
191 Filed Bug 21783: Need more granular control over allocation of executable memory
192 to cover a more granular version of this patch.
194 * wtf/TCSystemAlloc.cpp:
197 2008-10-21 Alexey Proskuryakov <ap@webkit.org>
199 Reviewed by Darin Adler.
201 https://bugs.webkit.org/show_bug.cgi?id=21769
202 MessagePort should be GC protected if there are messages to be delivered
204 * wtf/MessageQueue.h:
205 (WTF::::isEmpty): Added. Also added a warning for methods that return a snapshot of queue
206 state, thus likely to cause race conditions.
208 2008-10-21 Darin Adler <darin@apple.com>
210 Reviewed by Maciej Stachowiak.
212 - convert post-increment to pre-increment in a couple more places for speed
214 Speeds up V8 benchmarks a little on most computers. (But, strangely, slows
215 them down a little on my computer.)
218 (JSC::statementListEmitCode): Removed default argument, since we always want
219 to specify this explicitly.
220 (JSC::ForNode::emitCode): Tolerate ignoredResult() as the dst -- means the
222 (JSC::ReturnNode::emitCode): Ditto.
223 (JSC::ThrowNode::emitCode): Ditto.
224 (JSC::FunctionBodyNode::emitCode): Pass ignoredResult() so that we know we
225 don't have to compute the result of function statements.
227 2008-10-21 Peter Kasting <pkasting@google.com>
229 Reviewed by Maciej Stachowiak.
231 Fix an include of a non-public header to use "" instead of <>.
233 * API/JSProfilerPrivate.cpp:
235 2008-10-20 Sam Weinig <sam@webkit.org>
237 Reviewed by Cameron Zwarich.
239 Fix for https://bugs.webkit.org/show_bug.cgi?id=21766
240 REGRESSION: 12 JSC tests fail
242 The JSGlobalObject was mutating the shared nullProtoStructureID when
243 used in jsc. Instead of using nullProtoStructureID, use a new StructureID.
245 * API/JSCallbackObject.h:
246 * API/JSCallbackObjectFunctions.h:
247 (JSC::::JSCallbackObject):
248 * API/JSContextRef.cpp:
249 (JSGlobalContextCreateInGroup):
250 * kjs/JSGlobalObject.h:
251 (JSC::JSGlobalObject::JSGlobalObject):
253 (GlobalObject::GlobalObject):
256 2008-10-20 Cameron Zwarich <zwarich@apple.com>
258 Reviewed by Maciej Stachowiak.
260 Remove an untaken branch in CodeGenerator::emitJumpIfFalse(). This
261 function is never called with a backwards target LabelID, and there is
262 even an assertion to this effect at the top of the function body.
264 * VM/CodeGenerator.cpp:
265 (JSC::CodeGenerator::emitJumpIfFalse):
267 2008-10-20 Cameron Zwarich <zwarich@apple.com>
269 Rubber-stamped by Sam Weinig.
271 Add opcode documentation for undocumented opcodes.
274 (JSC::Machine::privateExecute):
276 2008-10-16 Sam Weinig <sam@webkit.org>
278 Reviewed by Cameron Zwarich.
280 Fix for https://bugs.webkit.org/show_bug.cgi?id=21683
281 Don't create intermediate StructureIDs for builtin objects
283 Second stage in reduce number of StructureIDs created when initializing the
286 - Use putDirectWithoutTransition for the remaining singleton objects to reduce
287 the number of StructureIDs create for about:blank from 132 to 73.
289 * kjs/ArrayConstructor.cpp:
290 (JSC::ArrayConstructor::ArrayConstructor):
291 * kjs/BooleanConstructor.cpp:
292 (JSC::BooleanConstructor::BooleanConstructor):
293 * kjs/BooleanPrototype.cpp:
294 (JSC::BooleanPrototype::BooleanPrototype):
295 * kjs/DateConstructor.cpp:
296 (JSC::DateConstructor::DateConstructor):
297 * kjs/ErrorConstructor.cpp:
298 (JSC::ErrorConstructor::ErrorConstructor):
299 * kjs/ErrorPrototype.cpp:
300 (JSC::ErrorPrototype::ErrorPrototype):
301 * kjs/FunctionConstructor.cpp:
302 (JSC::FunctionConstructor::FunctionConstructor):
303 * kjs/FunctionPrototype.cpp:
304 (JSC::FunctionPrototype::FunctionPrototype):
305 (JSC::FunctionPrototype::addFunctionProperties):
306 * kjs/FunctionPrototype.h:
307 (JSC::FunctionPrototype::createStructureID):
308 * kjs/InternalFunction.cpp:
309 * kjs/InternalFunction.h:
310 (JSC::InternalFunction::InternalFunction):
311 * kjs/JSGlobalObject.cpp:
312 (JSC::JSGlobalObject::reset):
314 * kjs/MathObject.cpp:
315 (JSC::MathObject::MathObject):
316 * kjs/NumberConstructor.cpp:
317 (JSC::NumberConstructor::NumberConstructor):
318 * kjs/NumberPrototype.cpp:
319 (JSC::NumberPrototype::NumberPrototype):
320 * kjs/ObjectConstructor.cpp:
321 (JSC::ObjectConstructor::ObjectConstructor):
322 * kjs/RegExpConstructor.cpp:
323 (JSC::RegExpConstructor::RegExpConstructor):
324 * kjs/RegExpPrototype.cpp:
325 (JSC::RegExpPrototype::RegExpPrototype):
326 * kjs/StringConstructor.cpp:
327 (JSC::StringConstructor::StringConstructor):
328 * kjs/StringPrototype.cpp:
329 (JSC::StringPrototype::StringPrototype):
330 * kjs/StructureID.cpp:
331 (JSC::StructureID::dumpStatistics):
333 (JSC::StructureID::setPrototypeWithoutTransition):
335 2008-10-20 Alp Toker <alp@nuanti.com>
337 Fix autotools dist build target by listing recently added header
338 files only. Not reviewed.
342 2008-10-20 Geoffrey Garen <ggaren@apple.com>
344 Reviewed by Anders Carlsson.
347 (JSC::Machine::tryCacheGetByID): Removed a redundant and sometimes
348 incorrect cast, which started ASSERTing after Darin's last checkin.
350 2008-10-20 Geoffrey Garen <ggaren@apple.com>
354 Re-enable CTI, which I accidentally disabled while checking in fixes
359 2008-10-20 Alp Toker <alp@nuanti.com>
361 Rubber-stamped by Mark Rowe.
363 Typo fix in function name: mimimum -> minimum.
366 (JSC::minimumYearForDST):
367 (JSC::equivalentYearForDST):
369 2008-10-20 Alp Toker <alp@nuanti.com>
371 Reviewed by Mark Rowe.
373 Use pthread instead of GThread where possible in the GTK+ port. This
374 fixes issues with global initialisation, particularly on GTK+/Win32
375 where a late g_thread_init() will cause hangs.
380 * wtf/ThreadingGtk.cpp:
381 * wtf/ThreadingPthreads.cpp:
383 2008-10-20 Geoffrey Garen <ggaren@apple.com>
385 Reviewed by Darin Adler.
387 Fixed https://bugs.webkit.org/show_bug.cgi?id=21735
388 Emit profiling instrumentation only if the Web Inspector's profiling
391 22.2% speedup on empty function call benchmark.
392 2.9% speedup on v8 benchmark.
393 0.7% speedup on SunSpider.
395 Lesser but similar speedups in bytecode.
398 (JSC::CTI::compileOpCall):
399 (JSC::CTI::privateCompileMainPass):
400 (JSC::CTI::privateCompileSlowCases): Nixed JITed profiler hooks. Profiler
401 hooks now have their own opcodes. Added support for compiling profiler
404 (JSC::CodeBlock::dump): Dump support for the new profiling opcodes.
406 * VM/CodeGenerator.h:
407 * VM/CodeGenerator.cpp:
408 (JSC::CodeGenerator::CodeGenerator):
409 (JSC::CodeGenerator::emitCall):
410 (JSC::CodeGenerator::emitConstruct): Conditionally emit profiling hooks
411 around call and construct, at the call site. (It's easier to get things
412 right this way, if you have profiled code calling non-profiled code.
413 Also, you get a slightly more accurate profile, since you charge the full
414 cost of the call / construct operation to the callee.)
416 Also, fixed a bug where construct would fetch the ".prototype" property
417 from the constructor before evaluating the arguments to the constructor,
418 incorrectly allowing an "invalid constructor" exception to short-circuit
419 argument evaluation. I encountered this bug when trying to make
420 constructor exceptions work with profiling.
423 (JSC::Machine::callEval): Removed obsolete profiler hooks.
425 (JSC::Machine::throwException): Added a check for an exception thrown
426 within a call instruction. We didn't need this before because the call
427 instruction would check for a valid call before involing the profiler.
428 (JSC::Machine::execute): Added a didExecute hook at the end of top-level
429 function invocation, since op_ret no longer does this for us.
431 (JSC::Machine::privateExecute): Removed obsolete profiler hooks. Added
432 profiler opcodes. Changed some ++vPC to vPC[x] notation, since the
433 latter is better for performance, and it makes reasoning about the
434 current opcode in exception handling much simpler.
436 (JSC::Machine::cti_op_call_NotJSFunction): Removed obsolete profiler
439 (JSC::Machine::cti_op_create_arguments_no_params): Added missing
440 CTI_STACK_HACK that I noticed when adding CTI_STACK_HACK to the new
441 profiler opcode functions.
443 (JSC::Machine::cti_op_profile_will_call):
444 (JSC::Machine::cti_op_profile_did_call): The new profiler opcode
447 (JSC::Machine::cti_op_construct_NotJSConstruct): Removed obsolete profiler
451 (JSC::Machine::isCallOpcode): Helper for exception handling.
453 * VM/Opcode.h: Declare new opcodes.
455 * kjs/JSGlobalObject.h:
456 (JSC::JSGlobalObject::supportsProfiling): Added virtual interface that
457 allows WebCore to specify whether the target global object has the Web
458 Inspector's profiling feature enabled.
460 * profiler/Profiler.cpp:
461 (JSC::Profiler::willExecute):
462 (JSC::Profiler::didExecute):
463 (JSC::Profiler::createCallIdentifier):
464 * profiler/Profiler.h: Added support for invoking the profiler with
465 an arbitrary JSValue*, and not a known object. We didn't need this
466 before because the call instruction would check for a valid call before
467 involing the profiler.
469 2008-10-20 Darin Adler <darin@apple.com>
471 Reviewed by Geoff Garen.
473 - get CTI working on Windows again
476 (JSC::CTI::emitCTICall): Add an overload for functions that
478 * VM/CTI.h: Use JSValue* and JSObject* as return types for
479 cti_op functions. Apparently, MSVC doesn't handle returning
480 the JSValuePtr struct in a register. We'll have to look into
484 (JSC::Machine::cti_op_convert_this):
485 (JSC::Machine::cti_op_add):
486 (JSC::Machine::cti_op_pre_inc):
487 (JSC::Machine::cti_op_new_object):
488 (JSC::Machine::cti_op_get_by_id):
489 (JSC::Machine::cti_op_get_by_id_second):
490 (JSC::Machine::cti_op_get_by_id_generic):
491 (JSC::Machine::cti_op_get_by_id_fail):
492 (JSC::Machine::cti_op_instanceof):
493 (JSC::Machine::cti_op_del_by_id):
494 (JSC::Machine::cti_op_mul):
495 (JSC::Machine::cti_op_new_func):
496 (JSC::Machine::cti_op_push_activation):
497 (JSC::Machine::cti_op_call_NotJSFunction):
498 (JSC::Machine::cti_op_new_array):
499 (JSC::Machine::cti_op_resolve):
500 (JSC::Machine::cti_op_construct_JSConstructFast):
501 (JSC::Machine::cti_op_construct_NotJSConstruct):
502 (JSC::Machine::cti_op_get_by_val):
503 (JSC::Machine::cti_op_sub):
504 (JSC::Machine::cti_op_lesseq):
505 (JSC::Machine::cti_op_negate):
506 (JSC::Machine::cti_op_resolve_base):
507 (JSC::Machine::cti_op_resolve_skip):
508 (JSC::Machine::cti_op_resolve_global):
509 (JSC::Machine::cti_op_div):
510 (JSC::Machine::cti_op_pre_dec):
511 (JSC::Machine::cti_op_not):
512 (JSC::Machine::cti_op_eq):
513 (JSC::Machine::cti_op_lshift):
514 (JSC::Machine::cti_op_bitand):
515 (JSC::Machine::cti_op_rshift):
516 (JSC::Machine::cti_op_bitnot):
517 (JSC::Machine::cti_op_new_func_exp):
518 (JSC::Machine::cti_op_mod):
519 (JSC::Machine::cti_op_less):
520 (JSC::Machine::cti_op_neq):
521 (JSC::Machine::cti_op_urshift):
522 (JSC::Machine::cti_op_bitxor):
523 (JSC::Machine::cti_op_new_regexp):
524 (JSC::Machine::cti_op_bitor):
525 (JSC::Machine::cti_op_call_eval):
526 (JSC::Machine::cti_op_throw):
527 (JSC::Machine::cti_op_next_pname):
528 (JSC::Machine::cti_op_typeof):
529 (JSC::Machine::cti_op_is_undefined):
530 (JSC::Machine::cti_op_is_boolean):
531 (JSC::Machine::cti_op_is_number):
532 (JSC::Machine::cti_op_is_string):
533 (JSC::Machine::cti_op_is_object):
534 (JSC::Machine::cti_op_is_function):
535 (JSC::Machine::cti_op_stricteq):
536 (JSC::Machine::cti_op_nstricteq):
537 (JSC::Machine::cti_op_to_jsnumber):
538 (JSC::Machine::cti_op_in):
539 (JSC::Machine::cti_op_push_new_scope):
540 (JSC::Machine::cti_op_del_by_val):
541 (JSC::Machine::cti_op_new_error):
542 (JSC::Machine::cti_vm_throw):
543 Change these functions to return pointer types, and never
545 * VM/Machine.h: Ditto.
547 2008-10-20 Geoffrey Garen <ggaren@apple.com>
549 Reviewed by Darin Adler.
551 Fixed some recent break-age in bytecode mode.
554 (JSC::CodeBlock::printStructureIDs): Fixed up an ASSERT caused by
555 Gavin's last checkin. This is a temporary fix so I can keep on moving.
556 I'll send email about what I think is an underlying problem soon.
559 (JSC::Machine::privateExecute): Removed a redundant and sometimes
560 incorrect cast, which started ASSERTing after Darin's last checkin.
562 2008-10-20 Darin Adler <darin@apple.com>
564 - another similar Windows build fix
566 * VM/CTI.cpp: Changed return type to JSObject* instead of JSValuePtr.
568 2008-10-20 Darin Adler <darin@apple.com>
570 - try to fix Windows build
572 * VM/CTI.cpp: Use JSValue* instead of JSValuePtr for ctiTrampoline.
575 2008-10-19 Darin Adler <darin@apple.com>
577 Reviewed by Cameron Zwarich.
579 - finish https://bugs.webkit.org/show_bug.cgi?id=21732
580 improve performance by eliminating JSValue as a base class for JSCell
583 (JSC::Machine::cti_op_call_profiler): Use asFunction.
584 (JSC::Machine::cti_vm_lazyLinkCall): Ditto.
585 (JSC::Machine::cti_op_construct_JSConstructFast): Use asObject.
587 * kjs/JSCell.h: Re-sort friend classes. Eliminate inheritance from
588 JSValue. Changed cast in asCell from static_cast to reinterpret_cast.
589 Removed JSValue::getNumber(double&) and one of JSValue::getObject
592 * kjs/JSValue.h: Made the private constructor and destructor both
593 non-virtual and also remove the definitions. This class can never
594 be instantiated or derived.
596 2008-10-19 Darin Adler <darin@apple.com>
598 Reviewed by Cameron Zwarich.
600 - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
601 improve performance by eliminating JSValue as a base class for JSCell
603 Change JSValuePtr from a typedef into a class. This allows us to support
604 conversion from JSCell* to JSValuePtr even if JSCell isn't derived from
607 * JavaScriptCore.exp: Updated symbols that involve JSValuePtr, since
608 it's now a distinct type.
611 (toRef): Extract the JSValuePtr payload explicitly since we can't just
614 (JSC::CTI::asInteger): Ditto.
616 * VM/CodeGenerator.cpp:
617 (JSC::CodeGenerator::addConstant): Get at the payload directly.
618 (JSC::CodeGenerator::emitLoad): Added an overload of JSCell* because
619 otherwise classes derived from JSValue end up calling the bool
620 overload instead of JSValuePtr.
621 * VM/CodeGenerator.h: Ditto. Also update traits to use JSValue*
622 and the payload functions.
624 * VM/Register.h: Added a JSCell* overload and use of payload functions.
627 (JSC::asCell): Use payload function.
628 (JSC::JSValue::asCell): Use JSValue* instead of JSValuePtr.
629 (JSC::JSValuePtr::JSValuePtr): Added. Constructor that takes JSCell*
630 and creates a JSValuePtr.
632 * kjs/JSImmediate.h: Added JSValuePtr class. Also updated makeValue
633 and makeInt to work with JSValue* and the payload function.
635 * kjs/JSValue.h: Added == and != operators for JSValuePtr. Put them
636 here because eventually all the JSValue functions should go here
637 except what's needed by JSImmediate. Also fix asValue to use
638 JSValue* instead of JSValuePtr.
640 * kjs/PropertySlot.h: Change constructor to take JSValuePtr.
642 * kjs/protect.h: Update gcProtect functions to work with JSCell*
643 as well as JSValuePtr. Also updated the ProtectedPtr<JSValuePtr>
644 specialization to work more directly. Also changed all the call
645 sites to use gcProtectNullTolerant.
647 2008-10-19 Darin Adler <darin@apple.com>
649 Reviewed by Oliver Hunt.
651 - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
652 improve performance by eliminating JSValue as a base class for JSCell
654 Remove most uses of JSValue, which will be removed in a future patch.
657 (JSC::fastToUInt32): Call toUInt32SlowCase function; no longer a member
659 * kjs/JSNumberCell.h:
660 (JSC::JSNumberCell::toInt32): Ditto.
661 (JSC::JSNumberCell::toUInt32): Ditto.
664 (JSC::toInt32SlowCase): Made a non-member function.
665 (JSC::JSValue::toInt32SlowCase): Changed to call non-member function.
666 (JSC::toUInt32SlowCase): More of the same.
667 (JSC::JSValue::toUInt32SlowCase): Ditto.
669 * kjs/JSValue.h: Moved static member function so they are no longer
670 member functions at all.
672 * VM/CTI.h: Removed forward declaration of JSValue.
673 * VM/ExceptionHelpers.h: Ditto.
674 * kjs/CallData.h: Ditto.
675 * kjs/ConstructData.h: Ditto.
676 * kjs/JSGlobalObjectFunctions.h: Ditto.
677 * kjs/PropertyMap.h: Ditto.
678 * kjs/StructureID.h: Ditto.
679 * kjs/collector.h: Ditto.
680 * kjs/completion.h: Ditto.
683 (JSC::makeBitwiseNotNode): Call new non-member toInt32 function.
684 (JSC::makeLeftShiftNode): More of the same.
685 (JSC::makeRightShiftNode): Ditto.
687 * kjs/protect.h: Added a specialization for ProtectedPtr<JSValuePtr>
688 so this can be used with JSValuePtr.
690 2008-10-18 Darin Adler <darin@apple.com>
692 Reviewed by Oliver Hunt.
694 - next step of https://bugs.webkit.org/show_bug.cgi?id=21732
695 improve performance by eliminating JSValue as a base class for JSCell
697 Tweak a little more to get closer to where we can make JSValuePtr a class.
700 (toJS): Change back to JSValue* here, since we're converting the
703 (JSC::CTI::unlinkCall): Call asPointer.
704 * VM/CTI.h: Cast to JSValue* here, since it's a pointer cast.
705 * kjs/DebuggerCallFrame.h:
706 (JSC::DebuggerCallFrame::DebuggerCallFrame): Call noValue.
707 * kjs/JSGlobalData.cpp:
708 (JSC::JSGlobalData::JSGlobalData): Call noValue.
709 * kjs/JSImmediate.cpp:
710 (JSC::JSImmediate::toObject): Remove unneeded const_cast.
711 * kjs/JSWrapperObject.h:
712 (JSC::JSWrapperObject::JSWrapperObject): Call noValue.
714 2008-10-18 Darin Adler <darin@apple.com>
716 - fix non-all-in-one build
719 (JSC::Completion::Completion): Add include of JSValue.h.
721 2008-10-18 Darin Adler <darin@apple.com>
723 Reviewed by Oliver Hunt.
725 - fix assertions I introduced with my casting changes
727 These were showing up as failures in the JavaScriptCore tests.
730 (JSC::Machine::cti_op_instanceof): Remove the bogus asCell casting that
731 was at the top of the function, and instead cast at the point of use.
732 (JSC::Machine::cti_op_construct_NotJSConstruct): Moved the cast to
733 object after checking the construct type.
735 2008-10-18 Darin Adler <darin@apple.com>
737 - fix non-all-in-one build
739 * kjs/JSGlobalObjectFunctions.h: Add include of JSImmedate.h (for now).
741 2008-10-18 Darin Adler <darin@apple.com>
745 * kjs/interpreter.h: Include JSValue.h instead of JSImmediate.h.
747 2008-10-18 Darin Adler <darin@apple.com>
749 * kjs/interpreter.h: Fix include of JSImmediate.h.
751 2008-10-18 Darin Adler <darin@apple.com>
753 - fix non-all-in-one build
755 * kjs/interpreter.h: Add include of JSImmediate.h.
757 2008-10-18 Darin Adler <darin@apple.com>
759 - fix non-all-in-one build
761 * kjs/ConstructData.h: Add include of JSImmedate.h (for now).
763 2008-10-18 Darin Adler <darin@apple.com>
765 - try to fix Windows build
768 (JSC::Machine::Machine): Use JSCell* type since MSVC seems to only allow
769 calling ~JSCell directly if it's a JSCell*.
771 2008-10-18 Darin Adler <darin@apple.com>
773 Reviewed by Cameron Zwarich.
775 - next step on https://bugs.webkit.org/show_bug.cgi?id=21732
776 improve performance by eliminating JSValue as a base class for JSCell
778 Use JSValuePtr everywhere instead of JSValue*. In the future, we'll be
779 changing JSValuePtr to be a class, and then eventually renaming it
780 to JSValue once that's done.
782 * JavaScriptCore.exp: Update entry points, since some now take JSValue*
783 instead of const JSValue*.
786 * API/JSCallbackConstructor.h:
787 * API/JSCallbackFunction.cpp:
788 * API/JSCallbackFunction.h:
789 * API/JSCallbackObject.h:
790 * API/JSCallbackObjectFunctions.h:
791 * API/JSContextRef.cpp:
792 * API/JSObjectRef.cpp:
793 * API/JSValueRef.cpp:
798 * VM/CodeGenerator.cpp:
799 * VM/CodeGenerator.h:
800 * VM/ExceptionHelpers.cpp:
801 * VM/ExceptionHelpers.h:
802 * VM/JSPropertyNameIterator.cpp:
803 * VM/JSPropertyNameIterator.h:
811 * kjs/ArrayConstructor.cpp:
812 * kjs/ArrayPrototype.cpp:
813 * kjs/BooleanConstructor.cpp:
814 * kjs/BooleanConstructor.h:
815 * kjs/BooleanObject.h:
816 * kjs/BooleanPrototype.cpp:
819 * kjs/ConstructData.cpp:
820 * kjs/ConstructData.h:
821 * kjs/DateConstructor.cpp:
822 * kjs/DateInstance.h:
823 * kjs/DatePrototype.cpp:
824 * kjs/DebuggerCallFrame.cpp:
825 * kjs/DebuggerCallFrame.h:
826 * kjs/ErrorConstructor.cpp:
827 * kjs/ErrorPrototype.cpp:
830 * kjs/FunctionConstructor.cpp:
831 * kjs/FunctionPrototype.cpp:
832 * kjs/GetterSetter.cpp:
833 * kjs/GetterSetter.h:
834 * kjs/InternalFunction.h:
835 * kjs/JSActivation.cpp:
836 * kjs/JSActivation.h:
841 * kjs/JSFunction.cpp:
843 * kjs/JSGlobalData.h:
844 * kjs/JSGlobalObject.cpp:
845 * kjs/JSGlobalObject.h:
846 * kjs/JSGlobalObjectFunctions.cpp:
847 * kjs/JSGlobalObjectFunctions.h:
848 * kjs/JSImmediate.cpp:
850 * kjs/JSNotAnObject.cpp:
851 * kjs/JSNotAnObject.h:
852 * kjs/JSNumberCell.cpp:
853 * kjs/JSNumberCell.h:
856 * kjs/JSStaticScopeObject.cpp:
857 * kjs/JSStaticScopeObject.h:
861 * kjs/JSVariableObject.h:
862 * kjs/JSWrapperObject.h:
863 * kjs/MathObject.cpp:
864 * kjs/NativeErrorConstructor.cpp:
865 * kjs/NumberConstructor.cpp:
866 * kjs/NumberConstructor.h:
867 * kjs/NumberObject.cpp:
868 * kjs/NumberObject.h:
869 * kjs/NumberPrototype.cpp:
870 * kjs/ObjectConstructor.cpp:
871 * kjs/ObjectPrototype.cpp:
872 * kjs/ObjectPrototype.h:
874 * kjs/PropertySlot.cpp:
875 * kjs/PropertySlot.h:
876 * kjs/RegExpConstructor.cpp:
877 * kjs/RegExpConstructor.h:
878 * kjs/RegExpMatchesArray.h:
879 * kjs/RegExpObject.cpp:
880 * kjs/RegExpObject.h:
881 * kjs/RegExpPrototype.cpp:
883 * kjs/StringConstructor.cpp:
884 * kjs/StringObject.cpp:
885 * kjs/StringObject.h:
886 * kjs/StringObjectThatMasqueradesAsUndefined.h:
887 * kjs/StringPrototype.cpp:
888 * kjs/StructureID.cpp:
894 * kjs/interpreter.cpp:
899 * kjs/operations.cpp:
902 * profiler/ProfileGenerator.cpp:
903 Replace JSValue* with JSValuePtr.
905 2008-10-18 Darin Adler <darin@apple.com>
908 (JSC::Machine::cti_op_call_eval): Removed stray parentheses from my
911 2008-10-18 Darin Adler <darin@apple.com>
913 Reviewed by Oliver Hunt.
915 - first step of https://bugs.webkit.org/show_bug.cgi?id=21732
916 improve performance by eliminating JSValue as a base class for JSCell
918 Remove casts from JSValue* to derived classes, replacing them with
919 calls to inline casting functions. These functions are also a bit
920 better than aidrect cast because they also do a runtime assertion.
922 Removed use of 0 as for JSValue*, changing call sites to use a
923 noValue() function instead.
925 Move things needed by classes derived from JSValue out of the class,
926 since the classes won't be deriving from JSValue any more soon.
928 I did most of these changes by changing JSValue to not be JSValue* any
929 more, then fixing a lot of the compilation problems, then rolling out
932 1.011x as fast on SunSpider (presumably due to some of the Machine.cpp changes)
934 * API/APICast.h: Removed unneeded forward declarations.
936 * API/JSCallbackObject.h: Added an asCallbackObject function for casting.
937 * API/JSCallbackObjectFunctions.h:
938 (JSC::JSCallbackObject::asCallbackObject): Added.
939 (JSC::JSCallbackObject::getOwnPropertySlot): Use asObject.
940 (JSC::JSCallbackObject::call): Use noValue.
941 (JSC::JSCallbackObject::staticValueGetter): Use asCallbackObject.
942 (JSC::JSCallbackObject::staticFunctionGetter): Ditto.
943 (JSC::JSCallbackObject::callbackGetter): Ditto.
945 * JavaScriptCore.exp: Updated.
947 * JavaScriptCore.xcodeproj/project.pbxproj: Added RegExpMatchesArray.h.
950 (JSC::CTI::asInteger): Added. For use casting a JSValue to an integer.
951 (JSC::CTI::emitGetArg): Use asInteger.
952 (JSC::CTI::emitGetPutArg): Ditto.
953 (JSC::CTI::getConstantImmediateNumericArg): Ditto. Also use noValue.
954 (JSC::CTI::emitInitRegister): Use asInteger.
955 (JSC::CTI::getDeTaggedConstantImmediate): Ditto.
956 (JSC::CTI::compileOpCallInitializeCallFrame): Ditto.
957 (JSC::CTI::compileOpCall): Ditto.
958 (JSC::CTI::compileOpStrictEq): Ditto.
959 (JSC::CTI::privateCompileMainPass): Ditto.
960 (JSC::CTI::privateCompileGetByIdProto): Ditto.
961 (JSC::CTI::privateCompileGetByIdChain): Ditto.
962 (JSC::CTI::privateCompilePutByIdTransition): Ditto.
963 * VM/CTI.h: Rewrite the ARG-related macros to use C++ casts instead of
964 C casts and get rid of some extra parentheses. Addd declaration of
967 * VM/CodeGenerator.cpp:
968 (JSC::CodeGenerator::emitEqualityOp): Use asString.
969 (JSC::CodeGenerator::emitLoad): Use noValue.
970 (JSC::CodeGenerator::findScopedProperty): Change globalObject argument
971 to JSObject* instead of JSValue*.
972 (JSC::CodeGenerator::emitResolve): Remove unneeded cast.
973 (JSC::CodeGenerator::emitGetScopedVar): Use asCell.
974 (JSC::CodeGenerator::emitPutScopedVar): Ditto.
975 * VM/CodeGenerator.h: Changed out argument of findScopedProperty.
976 Also change the JSValueMap to use PtrHash explicitly instead of
977 getting it from DefaultHash.
979 * VM/JSPropertyNameIterator.cpp:
980 (JSC::JSPropertyNameIterator::toPrimitive): Use noValue.
981 * VM/JSPropertyNameIterator.h:
982 (JSC::JSPropertyNameIterator::next): Ditto.
985 (JSC::fastIsNumber): Moved isImmediate check here instead of
986 checking for 0 inside Heap::isNumber. Use asCell and asNumberCell.
987 (JSC::fastToInt32): Ditto.
988 (JSC::fastToUInt32): Ditto.
989 (JSC::jsLess): Use asString.
990 (JSC::jsLessEq): Ditto.
992 (JSC::jsTypeStringForValue): Use asObject.
993 (JSC::jsIsObjectType): Ditto.
994 (JSC::jsIsFunctionType): Ditto.
995 (JSC::inlineResolveBase): Use noValue.
996 (JSC::Machine::callEval): Use asString. Initialize result to
998 (JSC::Machine::Machine): Remove unneeded casts to JSCell*.
999 (JSC::Machine::throwException): Use asObject.
1000 (JSC::Machine::debug): Remove explicit calls to the DebuggerCallFrame
1002 (JSC::Machine::checkTimeout): Use noValue.
1003 (JSC::cachePrototypeChain): Use asObject.
1004 (JSC::Machine::tryCachePutByID): Use asCell.
1005 (JSC::Machine::tryCacheGetByID): Use aCell and asObject.
1006 (JSC::Machine::privateExecute): Use noValue, asCell, asObject, asString,
1007 asArray, asActivation, asFunction. Changed code that creates call frames
1008 for host functions to pass 0 for the function pointer -- the call frame
1009 needs a JSFunction* and a host function object is not one. This was
1010 caught by the assertions in the casting functions. Also remove some
1011 unneeded casts in cases where two values are compared.
1012 (JSC::Machine::retrieveLastCaller): Use noValue.
1013 (JSC::Machine::tryCTICachePutByID): Use asCell.
1014 (JSC::Machine::tryCTICacheGetByID): Use aCell and asObject.
1015 (JSC::setUpThrowTrampolineReturnAddress): Added this function to restore
1016 the PIC-branch-avoidance that was recently lost.
1017 (JSC::Machine::cti_op_add): Use asString.
1018 (JSC::Machine::cti_op_instanceof): Use asCell and asObject.
1019 (JSC::Machine::cti_op_call_JSFunction): Use asFunction.
1020 (JSC::Machine::cti_op_call_NotJSFunction): Changed code to pass 0 for
1021 the function pointer, since we don't have a JSFunction. Use asObject.
1022 (JSC::Machine::cti_op_tear_off_activation): Use asActivation.
1023 (JSC::Machine::cti_op_construct_JSConstruct): Use asFunction and asObject.
1024 (JSC::Machine::cti_op_construct_NotJSConstruct): use asObject.
1025 (JSC::Machine::cti_op_get_by_val): Use asArray and asString.
1026 (JSC::Machine::cti_op_resolve_func): Use asPointer; this helps prepare
1027 us for a situation where JSValue is not a pointer.
1028 (JSC::Machine::cti_op_put_by_val): Use asArray.
1029 (JSC::Machine::cti_op_put_by_val_array): Ditto.
1030 (JSC::Machine::cti_op_resolve_global): Use asGlobalObject.
1031 (JSC::Machine::cti_op_post_inc): Change VM_CHECK_EXCEPTION_2 to
1032 VM_CHECK_EXCEPTION_AT_END, since there's no observable work done after
1033 that point. Also use asPointer.
1034 (JSC::Machine::cti_op_resolve_with_base): Use asPointer.
1035 (JSC::Machine::cti_op_post_dec): Change VM_CHECK_EXCEPTION_2 to
1036 VM_CHECK_EXCEPTION_AT_END, since there's no observable work done after
1037 that point. Also use asPointer.
1038 (JSC::Machine::cti_op_call_eval): Use asObject, noValue, and change
1039 VM_CHECK_EXCEPTION_ARG to VM_THROW_EXCEPTION_AT_END.
1040 (JSC::Machine::cti_op_throw): Change return value to a JSValue*.
1041 (JSC::Machine::cti_op_in): Use asObject.
1042 (JSC::Machine::cti_op_switch_char): Use asString.
1043 (JSC::Machine::cti_op_switch_string): Ditto.
1044 (JSC::Machine::cti_op_put_getter): Use asObject.
1045 (JSC::Machine::cti_op_put_setter): Ditto.
1046 (JSC::Machine::cti_vm_throw): Change return value to a JSValue*.
1048 * VM/Machine.h: Change return values of both cti_op_throw and
1049 cti_vm_throw to JSValue*.
1051 * VM/Register.h: Remove nullJSValue, which is the same thing
1052 as noValue(). Also removed unneeded definition of JSValue.
1054 * kjs/ArgList.h: Removed unneeded definition of JSValue.
1057 (JSC::asArguments): Added.
1059 * kjs/ArrayPrototype.cpp:
1060 (JSC::getProperty): Use noValue.
1061 (JSC::arrayProtoFuncToString): Use asArray.
1062 (JSC::arrayProtoFuncToLocaleString): Ditto.
1063 (JSC::arrayProtoFuncConcat): Ditto.
1064 (JSC::arrayProtoFuncPop): Ditto. Also removed unneeded initialization
1065 of the result, which is set in both sides of the branch.
1066 (JSC::arrayProtoFuncPush): Ditto.
1067 (JSC::arrayProtoFuncShift): Removed unneeded initialization
1068 of the result, which is set in both sides of the branch.
1069 (JSC::arrayProtoFuncSort): Use asArray.
1071 * kjs/BooleanObject.h:
1072 (JSC::asBooleanObject): Added.
1074 * kjs/BooleanPrototype.cpp:
1075 (JSC::booleanProtoFuncToString): Use asBooleanObject.
1076 (JSC::booleanProtoFuncValueOf): Ditto.
1079 (JSC::call): Use asObject and asFunction.
1080 * kjs/ConstructData.cpp:
1081 (JSC::construct): Ditto.
1083 * kjs/DateConstructor.cpp:
1084 (JSC::constructDate): Use asDateInstance.
1086 * kjs/DateInstance.h:
1087 (JSC::asDateInstance): Added.
1089 * kjs/DatePrototype.cpp:
1090 (JSC::dateProtoFuncToString): Use asDateInstance.
1091 (JSC::dateProtoFuncToUTCString): Ditto.
1092 (JSC::dateProtoFuncToDateString): Ditto.
1093 (JSC::dateProtoFuncToTimeString): Ditto.
1094 (JSC::dateProtoFuncToLocaleString): Ditto.
1095 (JSC::dateProtoFuncToLocaleDateString): Ditto.
1096 (JSC::dateProtoFuncToLocaleTimeString): Ditto.
1097 (JSC::dateProtoFuncValueOf): Ditto.
1098 (JSC::dateProtoFuncGetTime): Ditto.
1099 (JSC::dateProtoFuncGetFullYear): Ditto.
1100 (JSC::dateProtoFuncGetUTCFullYear): Ditto.
1101 (JSC::dateProtoFuncToGMTString): Ditto.
1102 (JSC::dateProtoFuncGetMonth): Ditto.
1103 (JSC::dateProtoFuncGetUTCMonth): Ditto.
1104 (JSC::dateProtoFuncGetDate): Ditto.
1105 (JSC::dateProtoFuncGetUTCDate): Ditto.
1106 (JSC::dateProtoFuncGetDay): Ditto.
1107 (JSC::dateProtoFuncGetUTCDay): Ditto.
1108 (JSC::dateProtoFuncGetHours): Ditto.
1109 (JSC::dateProtoFuncGetUTCHours): Ditto.
1110 (JSC::dateProtoFuncGetMinutes): Ditto.
1111 (JSC::dateProtoFuncGetUTCMinutes): Ditto.
1112 (JSC::dateProtoFuncGetSeconds): Ditto.
1113 (JSC::dateProtoFuncGetUTCSeconds): Ditto.
1114 (JSC::dateProtoFuncGetMilliSeconds): Ditto.
1115 (JSC::dateProtoFuncGetUTCMilliseconds): Ditto.
1116 (JSC::dateProtoFuncGetTimezoneOffset): Ditto.
1117 (JSC::dateProtoFuncSetTime): Ditto.
1118 (JSC::setNewValueFromTimeArgs): Ditto.
1119 (JSC::setNewValueFromDateArgs): Ditto.
1120 (JSC::dateProtoFuncSetYear): Ditto.
1121 (JSC::dateProtoFuncGetYear): Ditto.
1123 * kjs/DebuggerCallFrame.cpp:
1124 (JSC::DebuggerCallFrame::thisObject): Use asObject.
1125 (JSC::DebuggerCallFrame::evaluate): Use noValue.
1126 * kjs/DebuggerCallFrame.h: Added a constructor that
1127 takes only a callFrame.
1130 (JSC::ExecState::clearException): Use noValue.
1132 * kjs/FunctionPrototype.cpp:
1133 (JSC::functionProtoFuncToString): Use asFunction.
1134 (JSC::functionProtoFuncApply): Use asArguments and asArray.
1136 * kjs/GetterSetter.cpp:
1137 (JSC::GetterSetter::getPrimitiveNumber): Use noValue.
1139 * kjs/GetterSetter.h:
1140 (JSC::asGetterSetter): Added.
1142 * kjs/InternalFunction.cpp:
1143 (JSC::InternalFunction::name): Use asString.
1145 * kjs/InternalFunction.h:
1146 (JSC::asInternalFunction): Added.
1148 * kjs/JSActivation.cpp:
1149 (JSC::JSActivation::argumentsGetter): Use asActivation.
1151 * kjs/JSActivation.h:
1152 (JSC::asActivation): Added.
1155 (JSC::JSArray::putSlowCase): Use noValue.
1156 (JSC::JSArray::deleteProperty): Ditto.
1157 (JSC::JSArray::increaseVectorLength): Ditto.
1158 (JSC::JSArray::setLength): Ditto.
1159 (JSC::JSArray::pop): Ditto.
1160 (JSC::JSArray::sort): Ditto.
1161 (JSC::JSArray::compactForSorting): Ditto.
1163 (JSC::asArray): Added.
1166 (JSC::JSCell::getJSNumber): Use noValue.
1169 (JSC::asCell): Added.
1170 (JSC::JSValue::asCell): Changed to not preserve const.
1171 Given the wide use of JSValue* and JSCell*, it's not
1172 really useful to use const.
1173 (JSC::JSValue::isNumber): Use asValue.
1174 (JSC::JSValue::isString): Ditto.
1175 (JSC::JSValue::isGetterSetter): Ditto.
1176 (JSC::JSValue::isObject): Ditto.
1177 (JSC::JSValue::getNumber): Ditto.
1178 (JSC::JSValue::getString): Ditto.
1179 (JSC::JSValue::getObject): Ditto.
1180 (JSC::JSValue::getCallData): Ditto.
1181 (JSC::JSValue::getConstructData): Ditto.
1182 (JSC::JSValue::getUInt32): Ditto.
1183 (JSC::JSValue::getTruncatedInt32): Ditto.
1184 (JSC::JSValue::getTruncatedUInt32): Ditto.
1185 (JSC::JSValue::mark): Ditto.
1186 (JSC::JSValue::marked): Ditto.
1187 (JSC::JSValue::toPrimitive): Ditto.
1188 (JSC::JSValue::getPrimitiveNumber): Ditto.
1189 (JSC::JSValue::toBoolean): Ditto.
1190 (JSC::JSValue::toNumber): Ditto.
1191 (JSC::JSValue::toString): Ditto.
1192 (JSC::JSValue::toObject): Ditto.
1193 (JSC::JSValue::toThisObject): Ditto.
1194 (JSC::JSValue::needsThisConversion): Ditto.
1195 (JSC::JSValue::toThisString): Ditto.
1196 (JSC::JSValue::getJSNumber): Ditto.
1198 * kjs/JSFunction.cpp:
1199 (JSC::JSFunction::argumentsGetter): Use asFunction.
1200 (JSC::JSFunction::callerGetter): Ditto.
1201 (JSC::JSFunction::lengthGetter): Ditto.
1202 (JSC::JSFunction::construct): Use asObject.
1205 (JSC::asFunction): Added.
1207 * kjs/JSGlobalObject.cpp:
1208 (JSC::lastInPrototypeChain): Use asObject.
1210 * kjs/JSGlobalObject.h:
1211 (JSC::asGlobalObject): Added.
1212 (JSC::ScopeChainNode::globalObject): Use asGlobalObject.
1214 * kjs/JSImmediate.h: Added noValue, asPointer, and makeValue
1215 functions. Use rawValue, makeValue, and noValue consistently
1216 instead of doing reinterpret_cast in various functions.
1218 * kjs/JSNumberCell.h:
1219 (JSC::asNumberCell): Added.
1220 (JSC::JSValue::uncheckedGetNumber): Use asValue and asNumberCell.
1221 (JSC::JSValue::toJSNumber): Use asValue.
1224 (JSC::JSObject::put): Use asObject and asGetterSetter.
1225 (JSC::callDefaultValueFunction): Use noValue.
1226 (JSC::JSObject::defineGetter): Use asGetterSetter.
1227 (JSC::JSObject::defineSetter): Ditto.
1228 (JSC::JSObject::lookupGetter): Ditto. Also use asObject.
1229 (JSC::JSObject::lookupSetter): Ditto.
1230 (JSC::JSObject::hasInstance): Use asObject.
1231 (JSC::JSObject::fillGetterPropertySlot): Use asGetterSetter.
1234 (JSC::JSObject::getDirect): Use noValue.
1235 (JSC::asObject): Added.
1236 (JSC::JSValue::isObject): Use asValue.
1237 (JSC::JSObject::get): Removed unneeded const_cast.
1238 (JSC::JSObject::getPropertySlot): Use asObject.
1239 (JSC::JSValue::get): Removed unneeded const_cast.
1240 Use asValue, asCell, and asObject.
1241 (JSC::JSValue::put): Ditto.
1242 (JSC::JSObject::allocatePropertyStorageInline): Fixed spelling
1243 of "oldPropertStorage".
1246 (JSC::JSString::getOwnPropertySlot): Use asObject.
1249 (JSC::asString): Added.
1250 (JSC::JSValue::toThisJSString): Use asValue.
1252 * kjs/JSValue.h: Make PreferredPrimitiveType a top level enum
1253 instead of a member of JSValue. Added an asValue function that
1254 returns this. Removed overload of asCell for const. Use asValue
1255 instead of getting right at this.
1257 * kjs/ObjectPrototype.cpp:
1258 (JSC::objectProtoFuncIsPrototypeOf): Use asObject.
1259 (JSC::objectProtoFuncDefineGetter): Ditto.
1260 (JSC::objectProtoFuncDefineSetter): Ditto.
1262 * kjs/PropertySlot.h:
1263 (JSC::PropertySlot::PropertySlot): Take a const JSValue* so the
1264 callers don't have to worry about const.
1265 (JSC::PropertySlot::clearBase): Use noValue.
1266 (JSC::PropertySlot::clearValue): Ditto.
1268 * kjs/RegExpConstructor.cpp:
1269 (JSC::regExpConstructorDollar1): Use asRegExpConstructor.
1270 (JSC::regExpConstructorDollar2): Ditto.
1271 (JSC::regExpConstructorDollar3): Ditto.
1272 (JSC::regExpConstructorDollar4): Ditto.
1273 (JSC::regExpConstructorDollar5): Ditto.
1274 (JSC::regExpConstructorDollar6): Ditto.
1275 (JSC::regExpConstructorDollar7): Ditto.
1276 (JSC::regExpConstructorDollar8): Ditto.
1277 (JSC::regExpConstructorDollar9): Ditto.
1278 (JSC::regExpConstructorInput): Ditto.
1279 (JSC::regExpConstructorMultiline): Ditto.
1280 (JSC::regExpConstructorLastMatch): Ditto.
1281 (JSC::regExpConstructorLastParen): Ditto.
1282 (JSC::regExpConstructorLeftContext): Ditto.
1283 (JSC::regExpConstructorRightContext): Ditto.
1284 (JSC::setRegExpConstructorInput): Ditto.
1285 (JSC::setRegExpConstructorMultiline): Ditto.
1286 (JSC::constructRegExp): Use asObject.
1288 * kjs/RegExpConstructor.h:
1289 (JSC::asRegExpConstructor): Added.
1291 * kjs/RegExpObject.cpp:
1292 (JSC::regExpObjectGlobal): Use asRegExpObject.
1293 (JSC::regExpObjectIgnoreCase): Ditto.
1294 (JSC::regExpObjectMultiline): Ditto.
1295 (JSC::regExpObjectSource): Ditto.
1296 (JSC::regExpObjectLastIndex): Ditto.
1297 (JSC::setRegExpObjectLastIndex): Ditto.
1298 (JSC::callRegExpObject): Ditto.
1300 * kjs/RegExpObject.h:
1301 (JSC::asRegExpObject): Added.
1303 * kjs/RegExpPrototype.cpp:
1304 (JSC::regExpProtoFuncTest): Use asRegExpObject.
1305 (JSC::regExpProtoFuncExec): Ditto.
1306 (JSC::regExpProtoFuncCompile): Ditto.
1307 (JSC::regExpProtoFuncToString): Ditto.
1309 * kjs/StringObject.h:
1310 (JSC::StringObject::internalValue): Use asString.
1311 (JSC::asStringObject): Added.
1313 * kjs/StringPrototype.cpp:
1314 (JSC::stringProtoFuncReplace): Use asRegExpObject.
1315 (JSC::stringProtoFuncToString): Ue asStringObject.
1316 (JSC::stringProtoFuncMatch): Use asRegExpObject.
1317 (JSC::stringProtoFuncSearch): Ditto.
1318 (JSC::stringProtoFuncSplit): Ditto.
1320 * kjs/StructureID.cpp:
1321 (JSC::StructureID::getEnumerablePropertyNames): Use asObject.
1322 (JSC::StructureID::createCachedPrototypeChain): Ditto.
1323 (JSC::StructureIDChain::StructureIDChain): Use asCell and asObject.
1326 (JSC::Heap::isNumber): Removed null handling. This can only be called
1328 (JSC::Heap::cellBlock): Removed overload for const and non-const.
1329 Whether the JSCell* is const or not really should have no effect on
1330 whether you can modify the collector block it's in.
1332 * kjs/interpreter.cpp:
1333 (JSC::Interpreter::evaluate): Use noValue and noObject.
1336 (JSC::FunctionCallResolveNode::emitCode): Use JSObject for the global
1337 object rather than JSValue.
1338 (JSC::PostfixResolveNode::emitCode): Ditto.
1339 (JSC::PrefixResolveNode::emitCode): Ditto.
1340 (JSC::ReadModifyResolveNode::emitCode): Ditto.
1341 (JSC::AssignResolveNode::emitCode): Ditto.
1344 (JSC::equalSlowCaseInline): Use asString, asCell, asNumberCell,
1345 (JSC::strictEqualSlowCaseInline): Ditto.
1347 2008-10-18 Cameron Zwarich <zwarich@apple.com>
1349 Reviewed by Oliver Hunt.
1351 Bug 21702: Special op_create_activation for the case where there are no named parameters
1352 <https://bugs.webkit.org/show_bug.cgi?id=21702>
1354 This is a 2.5% speedup on the V8 Raytrace benchmark and a 1.1% speedup
1355 on the V8 Earley-Boyer benchmark.
1358 (JSC::CTI::privateCompileMainPass):
1360 (JSC::Machine::cti_op_create_arguments_no_params):
1364 (JSC::Arguments::Arguments):
1366 2008-10-17 Maciej Stachowiak <mjs@apple.com>
1368 Reviewed by Cameron Zwarich.
1370 - in debug builds, alter the stack to avoid blowing out MallocStackLogging
1372 (In essence, while executing a CTI function we alter the return
1373 address to jscGeneratedNativeCode so that a single consistent
1374 function is on the stack instead of many random functions without
1379 (JSC::doSetReturnAddress):
1381 (JSC::StackHack::StackHack):
1382 (JSC::StackHack::~StackHack):
1383 (JSC::Machine::cti_op_convert_this):
1384 (JSC::Machine::cti_op_end):
1385 (JSC::Machine::cti_op_add):
1386 (JSC::Machine::cti_op_pre_inc):
1387 (JSC::Machine::cti_timeout_check):
1388 (JSC::Machine::cti_register_file_check):
1389 (JSC::Machine::cti_op_loop_if_less):
1390 (JSC::Machine::cti_op_loop_if_lesseq):
1391 (JSC::Machine::cti_op_new_object):
1392 (JSC::Machine::cti_op_put_by_id):
1393 (JSC::Machine::cti_op_put_by_id_second):
1394 (JSC::Machine::cti_op_put_by_id_generic):
1395 (JSC::Machine::cti_op_put_by_id_fail):
1396 (JSC::Machine::cti_op_get_by_id):
1397 (JSC::Machine::cti_op_get_by_id_second):
1398 (JSC::Machine::cti_op_get_by_id_generic):
1399 (JSC::Machine::cti_op_get_by_id_fail):
1400 (JSC::Machine::cti_op_instanceof):
1401 (JSC::Machine::cti_op_del_by_id):
1402 (JSC::Machine::cti_op_mul):
1403 (JSC::Machine::cti_op_new_func):
1404 (JSC::Machine::cti_op_call_profiler):
1405 (JSC::Machine::cti_op_call_JSFunction):
1406 (JSC::Machine::cti_vm_lazyLinkCall):
1407 (JSC::Machine::cti_vm_compile):
1408 (JSC::Machine::cti_op_push_activation):
1409 (JSC::Machine::cti_op_call_NotJSFunction):
1410 (JSC::Machine::cti_op_create_arguments):
1411 (JSC::Machine::cti_op_tear_off_activation):
1412 (JSC::Machine::cti_op_tear_off_arguments):
1413 (JSC::Machine::cti_op_ret_profiler):
1414 (JSC::Machine::cti_op_ret_scopeChain):
1415 (JSC::Machine::cti_op_new_array):
1416 (JSC::Machine::cti_op_resolve):
1417 (JSC::Machine::cti_op_construct_JSConstructFast):
1418 (JSC::Machine::cti_op_construct_JSConstruct):
1419 (JSC::Machine::cti_op_construct_NotJSConstruct):
1420 (JSC::Machine::cti_op_get_by_val):
1421 (JSC::Machine::cti_op_resolve_func):
1422 (JSC::Machine::cti_op_sub):
1423 (JSC::Machine::cti_op_put_by_val):
1424 (JSC::Machine::cti_op_put_by_val_array):
1425 (JSC::Machine::cti_op_lesseq):
1426 (JSC::Machine::cti_op_loop_if_true):
1427 (JSC::Machine::cti_op_negate):
1428 (JSC::Machine::cti_op_resolve_base):
1429 (JSC::Machine::cti_op_resolve_skip):
1430 (JSC::Machine::cti_op_resolve_global):
1431 (JSC::Machine::cti_op_div):
1432 (JSC::Machine::cti_op_pre_dec):
1433 (JSC::Machine::cti_op_jless):
1434 (JSC::Machine::cti_op_not):
1435 (JSC::Machine::cti_op_jtrue):
1436 (JSC::Machine::cti_op_post_inc):
1437 (JSC::Machine::cti_op_eq):
1438 (JSC::Machine::cti_op_lshift):
1439 (JSC::Machine::cti_op_bitand):
1440 (JSC::Machine::cti_op_rshift):
1441 (JSC::Machine::cti_op_bitnot):
1442 (JSC::Machine::cti_op_resolve_with_base):
1443 (JSC::Machine::cti_op_new_func_exp):
1444 (JSC::Machine::cti_op_mod):
1445 (JSC::Machine::cti_op_less):
1446 (JSC::Machine::cti_op_neq):
1447 (JSC::Machine::cti_op_post_dec):
1448 (JSC::Machine::cti_op_urshift):
1449 (JSC::Machine::cti_op_bitxor):
1450 (JSC::Machine::cti_op_new_regexp):
1451 (JSC::Machine::cti_op_bitor):
1452 (JSC::Machine::cti_op_call_eval):
1453 (JSC::Machine::cti_op_throw):
1454 (JSC::Machine::cti_op_get_pnames):
1455 (JSC::Machine::cti_op_next_pname):
1456 (JSC::Machine::cti_op_push_scope):
1457 (JSC::Machine::cti_op_pop_scope):
1458 (JSC::Machine::cti_op_typeof):
1459 (JSC::Machine::cti_op_is_undefined):
1460 (JSC::Machine::cti_op_is_boolean):
1461 (JSC::Machine::cti_op_is_number):
1462 (JSC::Machine::cti_op_is_string):
1463 (JSC::Machine::cti_op_is_object):
1464 (JSC::Machine::cti_op_is_function):
1465 (JSC::Machine::cti_op_stricteq):
1466 (JSC::Machine::cti_op_nstricteq):
1467 (JSC::Machine::cti_op_to_jsnumber):
1468 (JSC::Machine::cti_op_in):
1469 (JSC::Machine::cti_op_push_new_scope):
1470 (JSC::Machine::cti_op_jmp_scopes):
1471 (JSC::Machine::cti_op_put_by_index):
1472 (JSC::Machine::cti_op_switch_imm):
1473 (JSC::Machine::cti_op_switch_char):
1474 (JSC::Machine::cti_op_switch_string):
1475 (JSC::Machine::cti_op_del_by_val):
1476 (JSC::Machine::cti_op_put_getter):
1477 (JSC::Machine::cti_op_put_setter):
1478 (JSC::Machine::cti_op_new_error):
1479 (JSC::Machine::cti_op_debug):
1480 (JSC::Machine::cti_vm_throw):
1482 2008-10-17 Gavin Barraclough <barraclough@apple.com>
1484 Optimize op_call by allowing call sites to be directly linked to callees.
1486 For the hot path of op_call, CTI now generates a check (initially for an impossible
1487 value), and the first time the call is executed we attempt to link the call directly
1488 to the callee. We can currently only do so if the arity of the caller and callee
1489 match. The (optimized) setup for the call on the hot path is linked directly to
1490 the ctiCode for the callee, without indirection.
1492 Two forms of the slow case of the call are generated, the first will be executed the
1493 first time the call is reached. As well as this path attempting to link the call to
1494 a callee, it also relinks the slow case to a second slow case, which will not continue
1495 to attempt relinking the call. (This policy could be changed in future, but for not
1496 this is intended to prevent thrashing).
1498 If a callee that the caller has been linked to is garbage collected, then the link
1499 in the caller's JIt code will be reset back to a value that cannot match - to prevent
1500 any false positive matches.
1502 ~20% progression on deltablue & richards, >12% overall reduction in v8-tests
1503 runtime, one or two percent progression on sunspider.
1505 Reviewed by Oliver Hunt.
1509 (JSC::CTI::emitNakedCall):
1511 (JSC::CTI::compileOpCallInitializeCallFrame):
1512 (JSC::CTI::compileOpCallSetupArgs):
1513 (JSC::CTI::compileOpCall):
1514 (JSC::CTI::privateCompileMainPass):
1515 (JSC::CTI::privateCompileSlowCases):
1516 (JSC::CTI::privateCompile):
1517 (JSC::CTI::unlinkCall):
1518 (JSC::CTI::linkCall):
1521 (JSC::CodeBlock::~CodeBlock):
1522 (JSC::CodeBlock::unlinkCallers):
1523 (JSC::CodeBlock::derefStructureIDs):
1525 (JSC::StructureStubInfo::StructureStubInfo):
1526 (JSC::CallLinkInfo::CallLinkInfo):
1527 (JSC::CodeBlock::addCaller):
1528 (JSC::CodeBlock::removeCaller):
1529 (JSC::CodeBlock::getStubInfo):
1530 * VM/CodeGenerator.cpp:
1531 (JSC::CodeGenerator::emitCall):
1532 (JSC::CodeGenerator::emitConstruct):
1534 (JSC::Machine::cti_op_call_profiler):
1535 (JSC::Machine::cti_op_call_JSFunction):
1536 (JSC::Machine::cti_vm_lazyLinkCall):
1537 (JSC::Machine::cti_op_construct_JSConstructFast):
1538 (JSC::Machine::cti_op_construct_JSConstruct):
1539 (JSC::Machine::cti_op_construct_NotJSConstruct):
1541 * kjs/JSFunction.cpp:
1542 (JSC::JSFunction::~JSFunction):
1545 (JSC::FunctionBodyNode::):
1546 * masm/X86Assembler.h:
1547 (JSC::X86Assembler::getDifferenceBetweenLabels):
1549 2008-10-17 Maciej Stachowiak <mjs@apple.com>
1551 Reviewed by Geoff Garen.
1553 - remove ASSERT that makes the leaks buildbot cry
1555 * kjs/JSFunction.cpp:
1556 (JSC::JSFunction::JSFunction):
1558 2008-10-17 Maciej Stachowiak <mjs@apple.com>
1560 Reviewed by Cameron Zwarich
1562 - don't bother to do arguments tearoff when it will have no effect
1566 * VM/CodeGenerator.cpp:
1567 (JSC::CodeGenerator::emitReturn):
1569 2008-10-17 Marco Barisione <marco.barisione@collabora.co.uk>
1571 Reviewed by Sam Weinig. Landed by Jan Alonzo.
1573 https://bugs.webkit.org/show_bug.cgi?id=21603
1574 [GTK] Minor fixes to GOwnPtr
1581 (WTF::GPatternSpec):
1584 (WTF::freeOwnedGPtr):
1585 (WTF::GOwnPtr::~GOwnPtr):
1586 (WTF::GOwnPtr::outPtr):
1587 (WTF::GOwnPtr::set):
1588 (WTF::GOwnPtr::clear):
1591 2008-10-17 Maciej Stachowiak <mjs@apple.com>
1593 Reviewed by Cameron Zwarich.
1595 - speed up transitions that resize the property storage a fair bit
1597 ~3% speedup on v8 RayTrace benchmark, ~1% on DeltaBlue
1600 (JSC::resizePropertyStorage): renamed from transitionObject, and reduced to just resize
1601 the object's property storage with one inline call.
1602 (JSC::CTI::privateCompilePutByIdTransition): Use a separate function for property storage
1603 resize, but still do all the rest of the work in assembly in that case, and pass the known
1604 compile-time constants of old and new size rather than structureIDs, saving a bunch of
1605 redundant memory access.
1607 (JSC::JSObject::allocatePropertyStorage): Just call the inline version.
1609 (JSC::JSObject::allocatePropertyStorageInline): Inline version of allocatePropertyStorage
1610 * masm/X86Assembler.h:
1611 (JSC::X86Assembler::):
1612 (JSC::X86Assembler::pushl_i32): Add code to assmeble push of a constant; code originally by Cameron Zwarich.
1614 2008-10-17 Cameron Zwarich <zwarich@apple.com>
1616 Reviewed by Maciej Stachowiak.
1618 Remove some C style casts.
1620 * masm/X86Assembler.h:
1621 (JSC::JITCodeBuffer::putIntUnchecked):
1622 (JSC::X86Assembler::link):
1623 (JSC::X86Assembler::linkAbsoluteAddress):
1624 (JSC::X86Assembler::getRelocatedAddress):
1626 2008-10-17 Cameron Zwarich <zwarich@apple.com>
1628 Rubber-stamped by Maciej Stachowiak.
1630 Remove some C style casts.
1633 (JSC::CTI::patchGetByIdSelf):
1634 (JSC::CTI::patchPutByIdReplace):
1636 (JSC::Machine::tryCTICachePutByID):
1637 (JSC::Machine::tryCTICacheGetByID):
1638 (JSC::Machine::cti_op_put_by_id):
1639 (JSC::Machine::cti_op_put_by_id_fail):
1640 (JSC::Machine::cti_op_get_by_id):
1641 (JSC::Machine::cti_op_get_by_id_fail):
1643 2008-10-17 Maciej Stachowiak <mjs@apple.com>
1645 Reviewed by Cameron Zwarich.
1647 - Avoid restoring the caller's 'r' value in op_ret
1648 https://bugs.webkit.org/show_bug.cgi?id=21319
1650 This patch stops writing the call frame at call and return points;
1651 instead it does so immediately before any CTI call.
1653 0.5% speedup or so on the v8 benchmark
1656 (JSC::CTI::emitCTICall):
1657 (JSC::CTI::compileOpCall):
1658 (JSC::CTI::emitSlowScriptCheck):
1659 (JSC::CTI::compileBinaryArithOpSlowCase):
1660 (JSC::CTI::privateCompileMainPass):
1661 (JSC::CTI::privateCompileSlowCases):
1662 (JSC::CTI::privateCompile):
1665 2008-10-17 Cameron Zwarich <zwarich@apple.com>
1667 Reviewed by Sam Weinig.
1669 Make WREC require CTI because it won't actually compile otherwise.
1673 2008-10-16 Maciej Stachowiak <mjs@apple.com>
1675 Reviewed by Geoff Garen.
1677 - fixed <rdar://problem/5806316> JavaScriptCore should not force building with gcc 4.0
1678 - use gcc 4.2 when building with Xcode 3.1 or newer on Leopard, even though this is not the default
1680 This time there is no performance regression; we can avoid having
1681 to use the fastcall calling convention for CTI functions by using
1682 varargs to prevent the compiler from moving things around on the
1685 * Configurations/DebugRelease.xcconfig:
1686 * JavaScriptCore.xcodeproj/project.pbxproj:
1691 2008-10-16 Maciej Stachowiak <mjs@apple.com>
1693 Reviewed by Oliver Hunt.
1695 - fix for REGRESSION: r37631 causing crashes on buildbot
1696 https://bugs.webkit.org/show_bug.cgi?id=21682
1698 * kjs/collector.cpp:
1699 (JSC::Heap::collect): Avoid crashing when a GC occurs while no global objects are live.
1701 2008-10-16 Sam Weinig <sam@webkit.org>
1703 Reviewed by Maciej Stachowiak.
1705 Fix for https://bugs.webkit.org/show_bug.cgi?id=21683
1706 Don't create intermediate StructureIDs for builtin objects
1708 First step in reduce number of StructureIDs created when initializing the
1711 - In order to avoid creating the intermediate StructureIDs use the new putDirectWithoutTransition
1712 and putDirectFunctionWithoutTransition to add properties to JSObjects without transitioning
1713 the StructureID. This patch just implements this strategy for ObjectPrototype but alone
1714 reduces the number of StructureIDs create for about:blank by 10, from 142 to 132.
1716 * kjs/JSGlobalObject.cpp:
1717 (JSC::JSGlobalObject::reset):
1719 (JSC::JSObject::putDirectFunctionWithoutTransition):
1721 (JSC::JSObject::putDirectWithoutTransition):
1722 * kjs/ObjectPrototype.cpp:
1723 (JSC::ObjectPrototype::ObjectPrototype):
1724 * kjs/ObjectPrototype.h:
1725 * kjs/StructureID.cpp:
1726 (JSC::StructureID::addPropertyWithoutTransition):
1727 * kjs/StructureID.h:
1729 2008-10-16 Maciej Stachowiak <mjs@apple.com>
1731 Reviewed by Cameron Zwarich.
1733 - fix for: REGRESSION: over 100 StructureIDs leak loading about:blank (result of fix for bug 21633)
1735 Apparent slight progression (< 0.5%) on v8 benchmarks and SunSpider.
1737 * kjs/StructureID.cpp:
1738 (JSC::StructureID::~StructureID): Don't deref this object's parent's pointer to
1739 itself from the destructor; that doesn't even make sense.
1740 (JSC::StructureID::addPropertyTransition): Don't refer the single transition;
1741 the rule is that parent StructureIDs are ref'd but child ones are not. Refing
1742 the child creates a cycle.
1744 2008-10-15 Alexey Proskuryakov <ap@webkit.org>
1746 Reviewed by Darin Adler.
1748 https://bugs.webkit.org/show_bug.cgi?id=21609
1749 Make MessagePorts protect their peers across heaps
1751 * JavaScriptCore.exp:
1752 * kjs/JSGlobalObject.cpp:
1753 (JSC::JSGlobalObject::markCrossHeapDependentObjects):
1754 * kjs/JSGlobalObject.h:
1755 * kjs/collector.cpp:
1756 (JSC::Heap::collect):
1757 Before GC sweep phase, a function supplied by global object is now called for all global
1758 objects in the heap, making it possible to implement cross-heap dependencies.
1760 2008-10-15 Alexey Proskuryakov <ap@webkit.org>
1762 Reviewed by Darin Adler.
1764 https://bugs.webkit.org/show_bug.cgi?id=21610
1765 run-webkit-threads --threaded crashes in StructureID destructor
1767 * kjs/StructureID.cpp:
1768 (JSC::StructureID::StructureID):
1769 (JSC::StructureID::~StructureID):
1770 Protect access to a static (debug-only) HashSet with a lock.
1772 2008-10-15 Sam Weinig <sam@webkit.org>
1774 Reviewed by Goeffrey Garen.
1776 Add function to dump statistics for StructureIDs.
1778 * kjs/StructureID.cpp:
1779 (JSC::StructureID::dumpStatistics):
1780 (JSC::StructureID::StructureID):
1781 (JSC::StructureID::~StructureID):
1782 * kjs/StructureID.h:
1784 2008-10-15 Cameron Zwarich <zwarich@apple.com>
1786 Reviewed by Maciej Stachowiak.
1788 Bug 21633: Avoid using a HashMap when there is only a single transition
1789 <https://bugs.webkit.org/show_bug.cgi?id=21633>
1791 This is a 0.8% speedup on SunSpider and between a 0.5% and 1.0% speedup
1792 on the V8 benchmark suite, depending on which harness we use. It will
1793 also slightly reduce the memory footprint of a StructureID.
1795 * kjs/StructureID.cpp:
1796 (JSC::StructureID::StructureID):
1797 (JSC::StructureID::~StructureID):
1798 (JSC::StructureID::addPropertyTransition):
1799 * kjs/StructureID.h:
1800 (JSC::StructureID::):
1802 2008-10-15 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
1804 Reviewed by Geoffrey Garen.
1806 1.40% speedup on SunSpider, 1.44% speedup on V8. (Linux)
1811 (JSC::fastIsNumber): ALWAYS_INLINE modifier added.
1813 2008-10-15 Geoffrey Garen <ggaren@apple.com>
1815 Reviewed by Cameron Zwarich.
1817 Fixed https://bugs.webkit.org/show_bug.cgi?id=21345
1818 Start the debugger without reloading the inspected page
1820 * JavaScriptCore.exp: New symbols.
1821 * JavaScriptCore.xcodeproj/project.pbxproj: New files.
1824 (JSC::EvalCodeCache::get): Updated for tweak to parsing API.
1826 * kjs/CollectorHeapIterator.h: Added. An iterator for the object heap,
1827 which we use to find all the live functions and recompile them.
1829 * kjs/DebuggerCallFrame.cpp:
1830 (JSC::DebuggerCallFrame::evaluate): Updated for tweak to parsing API.
1832 * kjs/FunctionConstructor.cpp:
1833 (JSC::constructFunction): Updated for tweak to parsing API.
1835 * kjs/JSFunction.cpp:
1836 (JSC::JSFunction::JSFunction): Try to validate our SourceCode in debug
1837 builds by ASSERTing that it's syntactically valid. This doesn't catch
1838 all SourceCode bugs, but it catches a lot of them.
1840 * kjs/JSGlobalObjectFunctions.cpp:
1841 (JSC::globalFuncEval): Updated for tweak to parsing API.
1844 (JSC::Parser::parse):
1846 (JSC::Parser::parse): Tweaked the parser to make it possible to parse
1847 without an ExecState, and to allow the client to specify a debugger to
1848 notify (or not) about the source we parse. This allows the inspector
1849 to recompile even though no JavaScript is executing, then notify the
1850 debugger about all source code when it's done.
1853 (prettyPrintScript): Updated for tweak to parsing API.
1855 * kjs/SourceRange.h:
1856 (JSC::SourceCode::isNull): Added to help with ASSERTs.
1858 * kjs/collector.cpp:
1859 (JSC::Heap::heapAllocate):
1861 (JSC::Heap::primaryHeapBegin):
1862 (JSC::Heap::primaryHeapEnd):
1864 (JSC::): Moved a bunch of declarations around to enable compilation of
1865 CollectorHeapIterator.
1867 * kjs/interpreter.cpp:
1868 (JSC::Interpreter::checkSyntax):
1869 (JSC::Interpreter::evaluate): Updated for tweak to parsing API.
1872 (JSC::Lexer::sourceCode): BUG FIX: Calculate SourceCode ranges relative
1873 to the SourceCode range in which we're lexing, otherwise nested functions
1874 that are compiled individually get SourceCode ranges that don't reflect
1878 (JSC::FunctionBodyNode::FunctionBodyNode):
1879 (JSC::FunctionBodyNode::finishParsing):
1880 (JSC::FunctionBodyNode::create):
1881 (JSC::FunctionBodyNode::copyParameters):
1883 (JSC::ScopeNode::setSource):
1884 (JSC::FunctionBodyNode::parameterCount): Added some helper functions for
1885 copying one FunctionBodyNode's parameters to another. The recompiler uses
1886 these when calling "finishParsing".
1888 2008-10-15 Joerg Bornemann <joerg.bornemann@trolltech.com>
1890 Reviewed by Darin Adler.
1892 - part of https://bugs.webkit.org/show_bug.cgi?id=20746
1893 Fix compilation on Windows CE.
1895 str(n)icmp, strdup and vsnprintf are not available on Windows CE,
1896 they are called _str(n)icmp, etc. instead
1898 * wtf/StringExtras.h: Added inline function implementations.
1900 2008-10-15 Gabor Loki <loki@inf.u-szeged.hu>
1902 Reviewed by Cameron Zwarich.
1904 <https://bugs.webkit.org/show_bug.cgi?id=20912>
1905 Use simple uint32_t multiplication on op_mul if both operands are
1906 immediate number and they are between zero and 0x7FFF.
1909 (JSC::Machine::privateExecute):
1911 2008-10-09 Darin Fisher <darin@chromium.org>
1913 Reviewed by Sam Weinig.
1915 Make pan scrolling a platform configurable option.
1916 https://bugs.webkit.org/show_bug.cgi?id=21515
1918 * wtf/Platform.h: Add ENABLE_PAN_SCROLLING
1920 2008-10-14 Maciej Stachowiak <mjs@apple.com>
1922 Rubber stamped by Sam Weinig.
1924 - revert r37572 and r37581 for now
1926 Turns out GCC 4.2 is still a (small) regression, we'll have to do
1927 more work to turn it on.
1929 * Configurations/DebugRelease.xcconfig:
1930 * JavaScriptCore.xcodeproj/project.pbxproj:
1934 (JSC::Machine::cti_op_convert_this):
1935 (JSC::Machine::cti_op_end):
1936 (JSC::Machine::cti_op_add):
1937 (JSC::Machine::cti_op_pre_inc):
1938 (JSC::Machine::cti_timeout_check):
1939 (JSC::Machine::cti_register_file_check):
1940 (JSC::Machine::cti_op_loop_if_less):
1941 (JSC::Machine::cti_op_loop_if_lesseq):
1942 (JSC::Machine::cti_op_new_object):
1943 (JSC::Machine::cti_op_put_by_id):
1944 (JSC::Machine::cti_op_put_by_id_second):
1945 (JSC::Machine::cti_op_put_by_id_generic):
1946 (JSC::Machine::cti_op_put_by_id_fail):
1947 (JSC::Machine::cti_op_get_by_id):
1948 (JSC::Machine::cti_op_get_by_id_second):
1949 (JSC::Machine::cti_op_get_by_id_generic):
1950 (JSC::Machine::cti_op_get_by_id_fail):
1951 (JSC::Machine::cti_op_instanceof):
1952 (JSC::Machine::cti_op_del_by_id):
1953 (JSC::Machine::cti_op_mul):
1954 (JSC::Machine::cti_op_new_func):
1955 (JSC::Machine::cti_op_call_JSFunction):
1956 (JSC::Machine::cti_vm_compile):
1957 (JSC::Machine::cti_op_push_activation):
1958 (JSC::Machine::cti_op_call_NotJSFunction):
1959 (JSC::Machine::cti_op_create_arguments):
1960 (JSC::Machine::cti_op_tear_off_activation):
1961 (JSC::Machine::cti_op_tear_off_arguments):
1962 (JSC::Machine::cti_op_ret_profiler):
1963 (JSC::Machine::cti_op_ret_scopeChain):
1964 (JSC::Machine::cti_op_new_array):
1965 (JSC::Machine::cti_op_resolve):
1966 (JSC::Machine::cti_op_construct_JSConstruct):
1967 (JSC::Machine::cti_op_construct_NotJSConstruct):
1968 (JSC::Machine::cti_op_get_by_val):
1969 (JSC::Machine::cti_op_resolve_func):
1970 (JSC::Machine::cti_op_sub):
1971 (JSC::Machine::cti_op_put_by_val):
1972 (JSC::Machine::cti_op_put_by_val_array):
1973 (JSC::Machine::cti_op_lesseq):
1974 (JSC::Machine::cti_op_loop_if_true):
1975 (JSC::Machine::cti_op_negate):
1976 (JSC::Machine::cti_op_resolve_base):
1977 (JSC::Machine::cti_op_resolve_skip):
1978 (JSC::Machine::cti_op_resolve_global):
1979 (JSC::Machine::cti_op_div):
1980 (JSC::Machine::cti_op_pre_dec):
1981 (JSC::Machine::cti_op_jless):
1982 (JSC::Machine::cti_op_not):
1983 (JSC::Machine::cti_op_jtrue):
1984 (JSC::Machine::cti_op_post_inc):
1985 (JSC::Machine::cti_op_eq):
1986 (JSC::Machine::cti_op_lshift):
1987 (JSC::Machine::cti_op_bitand):
1988 (JSC::Machine::cti_op_rshift):
1989 (JSC::Machine::cti_op_bitnot):
1990 (JSC::Machine::cti_op_resolve_with_base):
1991 (JSC::Machine::cti_op_new_func_exp):
1992 (JSC::Machine::cti_op_mod):
1993 (JSC::Machine::cti_op_less):
1994 (JSC::Machine::cti_op_neq):
1995 (JSC::Machine::cti_op_post_dec):
1996 (JSC::Machine::cti_op_urshift):
1997 (JSC::Machine::cti_op_bitxor):
1998 (JSC::Machine::cti_op_new_regexp):
1999 (JSC::Machine::cti_op_bitor):
2000 (JSC::Machine::cti_op_call_eval):
2001 (JSC::Machine::cti_op_throw):
2002 (JSC::Machine::cti_op_get_pnames):
2003 (JSC::Machine::cti_op_next_pname):
2004 (JSC::Machine::cti_op_push_scope):
2005 (JSC::Machine::cti_op_pop_scope):
2006 (JSC::Machine::cti_op_typeof):
2007 (JSC::Machine::cti_op_is_undefined):
2008 (JSC::Machine::cti_op_is_boolean):
2009 (JSC::Machine::cti_op_is_number):
2010 (JSC::Machine::cti_op_is_string):
2011 (JSC::Machine::cti_op_is_object):
2012 (JSC::Machine::cti_op_is_function):
2013 (JSC::Machine::cti_op_stricteq):
2014 (JSC::Machine::cti_op_nstricteq):
2015 (JSC::Machine::cti_op_to_jsnumber):
2016 (JSC::Machine::cti_op_in):
2017 (JSC::Machine::cti_op_push_new_scope):
2018 (JSC::Machine::cti_op_jmp_scopes):
2019 (JSC::Machine::cti_op_put_by_index):
2020 (JSC::Machine::cti_op_switch_imm):
2021 (JSC::Machine::cti_op_switch_char):
2022 (JSC::Machine::cti_op_switch_string):
2023 (JSC::Machine::cti_op_del_by_val):
2024 (JSC::Machine::cti_op_put_getter):
2025 (JSC::Machine::cti_op_put_setter):
2026 (JSC::Machine::cti_op_new_error):
2027 (JSC::Machine::cti_op_debug):
2028 (JSC::Machine::cti_vm_throw):
2030 * masm/X86Assembler.h:
2031 (JSC::X86Assembler::emitRestoreArgumentReference):
2032 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
2035 2008-10-14 Alexey Proskuryakov <ap@webkit.org>
2037 Reviewed by Darin Adler.
2039 https://bugs.webkit.org/show_bug.cgi?id=20256
2040 Array.push and other standard methods disappear
2042 * kjs/JSGlobalData.cpp:
2043 (JSC::JSGlobalData::JSGlobalData):
2044 (JSC::JSGlobalData::~JSGlobalData):
2045 Don't use static hash tables even on platforms that don't enable JSC_MULTIPLE_THREADS -
2046 these tables reference IdentifierTable, which is always per-GlobalData.
2048 2008-10-14 Maciej Stachowiak <mjs@apple.com>
2050 Reviewed by Cameron Zwarich.
2052 - always use CTI_ARGUMENTS and CTI_ARGUMENTS_FASTCALL
2054 This is a small regression for GCC 4.0, but simplifies the code
2055 for future improvements and lets us focus on GCC 4.2+ and MSVC.
2060 (JSC::Machine::cti_op_convert_this):
2061 (JSC::Machine::cti_op_end):
2062 (JSC::Machine::cti_op_add):
2063 (JSC::Machine::cti_op_pre_inc):
2064 (JSC::Machine::cti_timeout_check):
2065 (JSC::Machine::cti_register_file_check):
2066 (JSC::Machine::cti_op_loop_if_less):
2067 (JSC::Machine::cti_op_loop_if_lesseq):
2068 (JSC::Machine::cti_op_new_object):
2069 (JSC::Machine::cti_op_put_by_id):
2070 (JSC::Machine::cti_op_put_by_id_second):
2071 (JSC::Machine::cti_op_put_by_id_generic):
2072 (JSC::Machine::cti_op_put_by_id_fail):
2073 (JSC::Machine::cti_op_get_by_id):
2074 (JSC::Machine::cti_op_get_by_id_second):
2075 (JSC::Machine::cti_op_get_by_id_generic):
2076 (JSC::Machine::cti_op_get_by_id_fail):
2077 (JSC::Machine::cti_op_instanceof):
2078 (JSC::Machine::cti_op_del_by_id):
2079 (JSC::Machine::cti_op_mul):
2080 (JSC::Machine::cti_op_new_func):
2081 (JSC::Machine::cti_op_call_JSFunction):
2082 (JSC::Machine::cti_vm_compile):
2083 (JSC::Machine::cti_op_push_activation):
2084 (JSC::Machine::cti_op_call_NotJSFunction):
2085 (JSC::Machine::cti_op_create_arguments):
2086 (JSC::Machine::cti_op_tear_off_activation):
2087 (JSC::Machine::cti_op_tear_off_arguments):
2088 (JSC::Machine::cti_op_ret_profiler):
2089 (JSC::Machine::cti_op_ret_scopeChain):
2090 (JSC::Machine::cti_op_new_array):
2091 (JSC::Machine::cti_op_resolve):
2092 (JSC::Machine::cti_op_construct_JSConstruct):
2093 (JSC::Machine::cti_op_construct_NotJSConstruct):
2094 (JSC::Machine::cti_op_get_by_val):
2095 (JSC::Machine::cti_op_resolve_func):
2096 (JSC::Machine::cti_op_sub):
2097 (JSC::Machine::cti_op_put_by_val):
2098 (JSC::Machine::cti_op_put_by_val_array):
2099 (JSC::Machine::cti_op_lesseq):
2100 (JSC::Machine::cti_op_loop_if_true):
2101 (JSC::Machine::cti_op_negate):
2102 (JSC::Machine::cti_op_resolve_base):
2103 (JSC::Machine::cti_op_resolve_skip):
2104 (JSC::Machine::cti_op_resolve_global):
2105 (JSC::Machine::cti_op_div):
2106 (JSC::Machine::cti_op_pre_dec):
2107 (JSC::Machine::cti_op_jless):
2108 (JSC::Machine::cti_op_not):
2109 (JSC::Machine::cti_op_jtrue):
2110 (JSC::Machine::cti_op_post_inc):
2111 (JSC::Machine::cti_op_eq):
2112 (JSC::Machine::cti_op_lshift):
2113 (JSC::Machine::cti_op_bitand):
2114 (JSC::Machine::cti_op_rshift):
2115 (JSC::Machine::cti_op_bitnot):
2116 (JSC::Machine::cti_op_resolve_with_base):
2117 (JSC::Machine::cti_op_new_func_exp):
2118 (JSC::Machine::cti_op_mod):
2119 (JSC::Machine::cti_op_less):
2120 (JSC::Machine::cti_op_neq):
2121 (JSC::Machine::cti_op_post_dec):
2122 (JSC::Machine::cti_op_urshift):
2123 (JSC::Machine::cti_op_bitxor):
2124 (JSC::Machine::cti_op_new_regexp):
2125 (JSC::Machine::cti_op_bitor):
2126 (JSC::Machine::cti_op_call_eval):
2127 (JSC::Machine::cti_op_throw):
2128 (JSC::Machine::cti_op_get_pnames):
2129 (JSC::Machine::cti_op_next_pname):
2130 (JSC::Machine::cti_op_push_scope):
2131 (JSC::Machine::cti_op_pop_scope):
2132 (JSC::Machine::cti_op_typeof):
2133 (JSC::Machine::cti_op_is_undefined):
2134 (JSC::Machine::cti_op_is_boolean):
2135 (JSC::Machine::cti_op_is_number):
2136 (JSC::Machine::cti_op_is_string):
2137 (JSC::Machine::cti_op_is_object):
2138 (JSC::Machine::cti_op_is_function):
2139 (JSC::Machine::cti_op_stricteq):
2140 (JSC::Machine::cti_op_nstricteq):
2141 (JSC::Machine::cti_op_to_jsnumber):
2142 (JSC::Machine::cti_op_in):
2143 (JSC::Machine::cti_op_push_new_scope):
2144 (JSC::Machine::cti_op_jmp_scopes):
2145 (JSC::Machine::cti_op_put_by_index):
2146 (JSC::Machine::cti_op_switch_imm):
2147 (JSC::Machine::cti_op_switch_char):
2148 (JSC::Machine::cti_op_switch_string):
2149 (JSC::Machine::cti_op_del_by_val):
2150 (JSC::Machine::cti_op_put_getter):
2151 (JSC::Machine::cti_op_put_setter):
2152 (JSC::Machine::cti_op_new_error):
2153 (JSC::Machine::cti_op_debug):
2154 (JSC::Machine::cti_vm_throw):
2156 * masm/X86Assembler.h:
2157 (JSC::X86Assembler::emitRestoreArgumentReference):
2158 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
2161 2008-10-13 Maciej Stachowiak <mjs@apple.com>
2163 Reviewed by Cameron Zwarich.
2165 - make Machine::getArgumentsData an Arguments method and inline it
2171 (JSC::Machine::getArgumentsData):
2173 2008-10-13 Alp Toker <alp@nuanti.com>
2175 Fix autotools dist build target by listing recently added header
2176 files only. Not reviewed.
2180 2008-10-13 Maciej Stachowiak <mjs@apple.com>
2182 Rubber stamped by Mark Rowe.
2184 - fixed <rdar://problem/5806316> JavaScriptCore should not force building with gcc 4.0
2185 - use gcc 4.2 when building with Xcode 3.1 or newer on Leopard, even though this is not the default
2187 * Configurations/DebugRelease.xcconfig:
2188 * JavaScriptCore.xcodeproj/project.pbxproj:
2190 2008-10-13 Cameron Zwarich <zwarich@apple.com>
2192 Reviewed by Geoff Garen.
2194 Bug 21541: Move RegisterFile growth check to callee
2195 <https://bugs.webkit.org/show_bug.cgi?id=21541>
2197 Move the RegisterFile growth check to the callee in the common case,
2198 where some of the information is known statically at JIT time. There is
2199 still a check in the caller in the case where the caller provides too
2202 This is a 2.1% speedup on the V8 benchmark, including a 5.1% speedup on
2203 the Richards benchmark, a 4.1% speedup on the DeltaBlue benchmark, and a
2204 1.4% speedup on the Earley-Boyer benchmark. It is also a 0.5% speedup on
2208 (JSC::CTI::privateCompile):
2210 (JSC::Machine::cti_register_file_check):
2211 (JSC::Machine::cti_op_call_JSFunction):
2212 (JSC::Machine::cti_op_construct_JSConstruct):
2214 * VM/RegisterFile.h:
2215 * masm/X86Assembler.h:
2216 (JSC::X86Assembler::):
2217 (JSC::X86Assembler::cmpl_mr):
2218 (JSC::X86Assembler::emitUnlinkedJg):
2220 2008-10-13 Sam Weinig <sam@webkit.org>
2222 Reviewed by Dan Bernstein.
2224 Fix for https://bugs.webkit.org/show_bug.cgi?id=21577
2225 5 false positive StructureID leaks
2227 - Add leak ignore set to StructureID to selectively ignore leaking some StructureIDs.
2228 - Add create method to JSGlolalData to be used when the data will be intentionally
2229 leaked and ignore all leaks caused the StructureIDs stored in it.
2231 * JavaScriptCore.exp:
2232 * kjs/JSGlobalData.cpp:
2233 (JSC::JSGlobalData::createLeaked):
2234 * kjs/JSGlobalData.h:
2235 * kjs/StructureID.cpp:
2236 (JSC::StructureID::StructureID):
2237 (JSC::StructureID::~StructureID):
2238 (JSC::StructureID::startIgnoringLeaks):
2239 (JSC::StructureID::stopIgnoringLeaks):
2240 * kjs/StructureID.h:
2242 2008-10-13 Marco Barisione <marco.barisione@collabora.co.uk>
2244 Reviewed by Darin Adler. Landed by Jan Alonzo.
2246 WebKit GTK Port needs a smartpointer to handle g_free (GFreePtr?)
2247 http://bugs.webkit.org/show_bug.cgi?id=20483
2249 Add a GOwnPtr smart pointer (similar to OwnPtr) to handle memory
2250 allocated by GLib and start the conversion to use it.
2253 * wtf/GOwnPtr.cpp: Added.
2258 (WTF::GPatternSpec):
2260 * wtf/GOwnPtr.h: Added.
2261 (WTF::freeOwnedPtr):
2262 (WTF::GOwnPtr::GOwnPtr):
2263 (WTF::GOwnPtr::~GOwnPtr):
2264 (WTF::GOwnPtr::get):
2265 (WTF::GOwnPtr::release):
2266 (WTF::GOwnPtr::rawPtr):
2267 (WTF::GOwnPtr::set):
2268 (WTF::GOwnPtr::clear):
2269 (WTF::GOwnPtr::operator*):
2270 (WTF::GOwnPtr::operator->):
2271 (WTF::GOwnPtr::operator!):
2272 (WTF::GOwnPtr::operator UnspecifiedBoolType):
2273 (WTF::GOwnPtr::swap):
2279 * wtf/ThreadingGtk.cpp:
2280 (WTF::Mutex::~Mutex):
2282 (WTF::Mutex::tryLock):
2283 (WTF::Mutex::unlock):
2284 (WTF::ThreadCondition::~ThreadCondition):
2285 (WTF::ThreadCondition::wait):
2286 (WTF::ThreadCondition::timedWait):
2287 (WTF::ThreadCondition::signal):
2288 (WTF::ThreadCondition::broadcast):
2290 2008-10-12 Gabriella Toth <gtoth@inf.u-szeged.hu>
2292 Reviewed by Darin Adler.
2294 - part of https://bugs.webkit.org/show_bug.cgi?id=21055
2295 Bug 21055: not invoked functions
2297 * kjs/nodes.cpp: Deleted a function that is not invoked:
2298 statementListInitializeVariableAccessStack.
2300 2008-10-12 Darin Adler <darin@apple.com>
2302 Reviewed by Sam Weinig.
2304 * wtf/unicode/icu/UnicodeIcu.h: Fixed indentation to match WebKit coding style.
2305 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
2307 2008-10-12 Darin Adler <darin@apple.com>
2309 Reviewed by Sam Weinig.
2311 - https://bugs.webkit.org/show_bug.cgi?id=21556
2312 Bug 21556: non-ASCII digits are allowed in places where only ASCII should be
2314 * wtf/unicode/icu/UnicodeIcu.h: Removed isDigit, digitValue, and isFormatChar.
2315 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
2317 2008-10-12 Anders Carlsson <andersca@apple.com>
2319 Reviewed by Darin Adler.
2321 Make the append method that takes a Vector more strict - it now requires the elements
2322 of the vector to be appended same type as the elements of the Vector they're being appended to.
2324 This would cause problems when dealing with Vectors containing other Vectors.
2329 2008-10-11 Cameron Zwarich <zwarich@apple.com>
2331 Reviewed by Sam Weinig.
2333 Clean up RegExpMatchesArray.h to match our coding style.
2335 * kjs/RegExpMatchesArray.h:
2336 (JSC::RegExpMatchesArray::getOwnPropertySlot):
2337 (JSC::RegExpMatchesArray::put):
2338 (JSC::RegExpMatchesArray::deleteProperty):
2339 (JSC::RegExpMatchesArray::getPropertyNames):
2341 2008-10-11 Cameron Zwarich <zwarich@apple.com>
2343 Reviewed by Sam Weinig.
2345 Bug 21525: 55 StructureID leaks on Wikitravel's main page
2346 <https://bugs.webkit.org/show_bug.cgi?id=21525>
2348 Bug 21533: Simple JavaScript code leaks StructureIDs
2349 <https://bugs.webkit.org/show_bug.cgi?id=21533>
2351 StructureID::getEnumerablePropertyNames() ends up calling back to itself
2352 via JSObject::getPropertyNames(), which causes the PropertyNameArray to
2353 be cached twice. This leads to a memory leak in almost every use of
2354 JSObject::getPropertyNames() on an object. The fix here is based on a
2355 suggestion of Sam Weinig.
2357 This patch also fixes every StructureID leaks that occurs while running
2358 the Mozilla MemBuster test.
2360 * kjs/PropertyNameArray.h:
2361 (JSC::PropertyNameArray::PropertyNameArray):
2362 (JSC::PropertyNameArray::setCacheable):
2363 (JSC::PropertyNameArray::cacheable):
2364 * kjs/StructureID.cpp:
2365 (JSC::StructureID::getEnumerablePropertyNames):
2367 2008-10-10 Oliver Hunt <oliver@apple.com>
2369 Reviewed by Cameron Zwarich.
2371 Use fastcall calling convention on GCC > 4.0
2373 Results in a 2-3% improvement in GCC 4.2 performance, so
2374 that it is no longer a regression vs. GCC 4.0
2380 2008-10-10 Sam Weinig <sam@webkit.org>
2382 Reviewed by Darin Adler.
2384 - Add a workaround for a bug in ceil in Darwin libc.
2385 - Remove old workarounds for JS math functions that are not needed
2388 The math functions are heavily tested by fast/js/math.html.
2390 * kjs/MathObject.cpp:
2391 (JSC::mathProtoFuncAbs): Remove workaround.
2392 (JSC::mathProtoFuncCeil): Ditto.
2393 (JSC::mathProtoFuncFloor): Ditto.
2395 (wtf_ceil): Add ceil workaround for darwin.
2397 2008-10-10 Sam Weinig <sam@webkit.org>
2399 Reviewed by Darin Adler
2401 Add Assertions to JSObject constructor.
2404 (JSC::JSObject::JSObject):
2406 2008-10-10 Sam Weinig <sam@webkit.org>
2408 Reviewed by Cameron Zwarich.
2410 Remove now unused m_getterSetterFlag variable from PropertyMap.
2412 * kjs/PropertyMap.cpp:
2413 (JSC::PropertyMap::operator=):
2414 * kjs/PropertyMap.h:
2415 (JSC::PropertyMap::PropertyMap):
2417 2008-10-09 Sam Weinig <sam@webkit.org>
2419 Reviewed by Maciej Stachowiak.
2421 Add leaks checking to StructureID.
2423 * kjs/StructureID.cpp:
2424 (JSC::StructureID::StructureID):
2425 (JSC::StructureID::~StructureID):
2427 2008-10-09 Alp Toker <alp@nuanti.com>
2429 Reviewed by Mark Rowe.
2431 https://bugs.webkit.org/show_bug.cgi?id=20760
2432 Implement support for x86 Linux in CTI
2434 Prepare to enable CTI/WREC on supported architectures.
2436 Make it possible to use the CTI_ARGUMENT workaround with GCC as well
2437 as MSVC by fixing some preprocessor conditionals.
2439 Note that CTI/WREC no longer requires CTI_ARGUMENT on Linux so we
2440 don't actually enable it except when building with MSVC. GCC on Win32
2443 Adapt inline ASM code to use the global symbol underscore prefix only
2444 on Darwin and to call the properly mangled Machine::cti_vm_throw
2445 symbol name depending on CTI_ARGUMENT.
2447 Also avoid global inclusion of the JIT infrastructure headers
2448 throughout WebCore and WebKit causing recompilation of about ~1500
2449 source files after modification to X86Assembler.h, CTI.h, WREC.h,
2450 which are only used deep inside JavaScriptCore.
2458 (JSC::RegExp::RegExp):
2459 (JSC::RegExp::~RegExp):
2460 (JSC::RegExp::match):
2462 * masm/X86Assembler.h:
2463 (JSC::X86Assembler::emitConvertToFastCall):
2464 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
2465 (JSC::X86Assembler::emitRestoreArgumentReference):
2467 2008-10-09 Gavin Barraclough <barraclough@apple.com>
2469 Reviewed by Cameron Zwarich.
2471 Fix for bug #21160, x=0;1/(x*-1) == -Infinity
2475 (JSC::CTI::emitFastArithDeTagImmediate):
2476 (JSC::CTI::emitFastArithDeTagImmediateJumpIfZero):
2477 (JSC::CTI::compileBinaryArithOp):
2478 (JSC::CTI::compileBinaryArithOpSlowCase):
2479 (JSC::CTI::privateCompileMainPass):
2480 (JSC::CTI::privateCompileSlowCases):
2482 * masm/X86Assembler.h:
2483 (JSC::X86Assembler::):
2484 (JSC::X86Assembler::emitUnlinkedJs):
2486 2008-10-09 Cameron Zwarich <zwarich@apple.com>
2488 Reviewed by Oliver Hunt.
2490 Bug 21459: REGRESSION (r37324): Safari crashes inside JavaScriptCore while browsing hulu.com
2491 <https://bugs.webkit.org/show_bug.cgi?id=21459>
2493 After r37324, an Arguments object does not mark an associated activation
2494 object. This change was made because Arguments no longer directly used
2495 the activation object in any way. However, if an activation is torn off,
2496 then the backing store of Arguments becomes the register array of the
2497 activation object. Arguments directly marks all of the arguments, but
2498 the activation object is being collected, which causes its register
2499 array to be freed and new memory to be allocated in its place.
2501 Unfortunately, it does not seem possible to reproduce this issue in a
2504 * kjs/Arguments.cpp:
2505 (JSC::Arguments::mark):
2507 (JSC::Arguments::setActivation):
2508 (JSC::Arguments::Arguments):
2509 (JSC::JSActivation::copyRegisters):
2511 2008-10-09 Ariya Hidayat <ariya.hidayat@trolltech.com>
2515 Build fix for MinGW.
2517 * wtf/AlwaysInline.h:
2519 2008-10-08 Cameron Zwarich <zwarich@apple.com>
2521 Reviewed by Maciej Stachowiak.
2523 Bug 21497: REGRESSION (r37433): Bytecode JSC tests are severely broken
2524 <https://bugs.webkit.org/show_bug.cgi?id=21497>
2526 Fix a typo in r37433 that causes the failure of a large number of JSC
2527 tests with the bytecode interpreter enabled.
2530 (JSC::Machine::privateExecute):
2532 2008-10-08 Mark Rowe <mrowe@apple.com>
2537 (JSC::): Update type of argument to ctiTrampoline.
2539 2008-10-08 Darin Adler <darin@apple.com>
2541 Reviewed by Cameron Zwarich.
2543 - https://bugs.webkit.org/show_bug.cgi?id=21403
2544 Bug 21403: use new CallFrame class rather than Register* for call frame manipulation
2546 Add CallFrame as a synonym for ExecState. Arguably, some day we should switch every
2547 client over to the new name.
2549 Use CallFrame* consistently rather than Register* or ExecState* in low-level code such
2550 as Machine.cpp and CTI.cpp. Similarly, use callFrame rather than r as its name and use
2551 accessor functions to get at things in the frame.
2553 Eliminate other uses of ExecState* that aren't needed, replacing in some cases with
2554 JSGlobalData* and in other cases eliminating them entirely.
2556 * API/JSObjectRef.cpp:
2557 (JSObjectMakeFunctionWithCallback):
2558 (JSObjectMakeFunction):
2559 (JSObjectHasProperty):
2560 (JSObjectGetProperty):
2561 (JSObjectSetProperty):
2562 (JSObjectDeleteProperty):
2563 * API/OpaqueJSString.cpp:
2564 * API/OpaqueJSString.h:
2566 (JSC::CTI::getConstant):
2567 (JSC::CTI::emitGetArg):
2568 (JSC::CTI::emitGetPutArg):
2569 (JSC::CTI::getConstantImmediateNumericArg):
2570 (JSC::CTI::printOpcodeOperandTypes):
2572 (JSC::CTI::compileOpCall):
2573 (JSC::CTI::compileBinaryArithOp):
2574 (JSC::CTI::privateCompileMainPass):
2575 (JSC::CTI::privateCompile):
2576 (JSC::CTI::privateCompileGetByIdProto):
2577 (JSC::CTI::privateCompileGetByIdChain):
2578 (JSC::CTI::compileRegExp):
2581 * VM/CodeGenerator.cpp:
2582 (JSC::CodeGenerator::emitEqualityOp):
2583 (JSC::CodeGenerator::emitLoad):
2584 (JSC::CodeGenerator::emitUnexpectedLoad):
2585 (JSC::CodeGenerator::emitConstruct):
2586 * VM/CodeGenerator.h:
2590 (JSC::jsAddSlowCase):
2592 (JSC::jsTypeStringForValue):
2593 (JSC::Machine::resolve):
2594 (JSC::Machine::resolveSkip):
2595 (JSC::Machine::resolveGlobal):
2596 (JSC::inlineResolveBase):
2597 (JSC::Machine::resolveBase):
2598 (JSC::Machine::resolveBaseAndProperty):
2599 (JSC::Machine::resolveBaseAndFunc):
2600 (JSC::Machine::slideRegisterWindowForCall):
2602 (JSC::Machine::callEval):
2603 (JSC::Machine::dumpCallFrame):
2604 (JSC::Machine::dumpRegisters):
2605 (JSC::Machine::unwindCallFrame):
2606 (JSC::Machine::throwException):
2607 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
2608 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
2609 (JSC::Machine::execute):
2610 (JSC::Machine::debug):
2611 (JSC::Machine::createExceptionScope):
2612 (JSC::cachePrototypeChain):
2613 (JSC::Machine::tryCachePutByID):
2614 (JSC::Machine::tryCacheGetByID):
2615 (JSC::Machine::privateExecute):
2616 (JSC::Machine::retrieveArguments):
2617 (JSC::Machine::retrieveCaller):
2618 (JSC::Machine::retrieveLastCaller):
2619 (JSC::Machine::findFunctionCallFrame):
2620 (JSC::Machine::getArgumentsData):
2621 (JSC::Machine::tryCTICachePutByID):
2622 (JSC::Machine::getCTIArrayLengthTrampoline):
2623 (JSC::Machine::getCTIStringLengthTrampoline):
2624 (JSC::Machine::tryCTICacheGetByID):
2625 (JSC::Machine::cti_op_convert_this):
2626 (JSC::Machine::cti_op_end):
2627 (JSC::Machine::cti_op_add):
2628 (JSC::Machine::cti_op_pre_inc):
2629 (JSC::Machine::cti_timeout_check):
2630 (JSC::Machine::cti_op_loop_if_less):
2631 (JSC::Machine::cti_op_loop_if_lesseq):
2632 (JSC::Machine::cti_op_new_object):
2633 (JSC::Machine::cti_op_put_by_id):
2634 (JSC::Machine::cti_op_put_by_id_second):
2635 (JSC::Machine::cti_op_put_by_id_generic):
2636 (JSC::Machine::cti_op_put_by_id_fail):
2637 (JSC::Machine::cti_op_get_by_id):
2638 (JSC::Machine::cti_op_get_by_id_second):
2639 (JSC::Machine::cti_op_get_by_id_generic):
2640 (JSC::Machine::cti_op_get_by_id_fail):
2641 (JSC::Machine::cti_op_instanceof):
2642 (JSC::Machine::cti_op_del_by_id):
2643 (JSC::Machine::cti_op_mul):
2644 (JSC::Machine::cti_op_new_func):
2645 (JSC::Machine::cti_op_call_JSFunction):
2646 (JSC::Machine::cti_vm_compile):
2647 (JSC::Machine::cti_op_push_activation):
2648 (JSC::Machine::cti_op_call_NotJSFunction):
2649 (JSC::Machine::cti_op_create_arguments):
2650 (JSC::Machine::cti_op_tear_off_activation):
2651 (JSC::Machine::cti_op_tear_off_arguments):
2652 (JSC::Machine::cti_op_ret_profiler):
2653 (JSC::Machine::cti_op_ret_scopeChain):
2654 (JSC::Machine::cti_op_new_array):
2655 (JSC::Machine::cti_op_resolve):
2656 (JSC::Machine::cti_op_construct_JSConstruct):
2657 (JSC::Machine::cti_op_construct_NotJSConstruct):
2658 (JSC::Machine::cti_op_get_by_val):
2659 (JSC::Machine::cti_op_resolve_func):
2660 (JSC::Machine::cti_op_sub):
2661 (JSC::Machine::cti_op_put_by_val):
2662 (JSC::Machine::cti_op_put_by_val_array):
2663 (JSC::Machine::cti_op_lesseq):
2664 (JSC::Machine::cti_op_loop_if_true):
2665 (JSC::Machine::cti_op_negate):
2666 (JSC::Machine::cti_op_resolve_base):
2667 (JSC::Machine::cti_op_resolve_skip):
2668 (JSC::Machine::cti_op_resolve_global):
2669 (JSC::Machine::cti_op_div):
2670 (JSC::Machine::cti_op_pre_dec):
2671 (JSC::Machine::cti_op_jless):
2672 (JSC::Machine::cti_op_not):
2673 (JSC::Machine::cti_op_jtrue):
2674 (JSC::Machine::cti_op_post_inc):
2675 (JSC::Machine::cti_op_eq):
2676 (JSC::Machine::cti_op_lshift):
2677 (JSC::Machine::cti_op_bitand):
2678 (JSC::Machine::cti_op_rshift):
2679 (JSC::Machine::cti_op_bitnot):
2680 (JSC::Machine::cti_op_resolve_with_base):
2681 (JSC::Machine::cti_op_new_func_exp):
2682 (JSC::Machine::cti_op_mod):
2683 (JSC::Machine::cti_op_less):
2684 (JSC::Machine::cti_op_neq):
2685 (JSC::Machine::cti_op_post_dec):
2686 (JSC::Machine::cti_op_urshift):
2687 (JSC::Machine::cti_op_bitxor):
2688 (JSC::Machine::cti_op_new_regexp):
2689 (JSC::Machine::cti_op_bitor):
2690 (JSC::Machine::cti_op_call_eval):
2691 (JSC::Machine::cti_op_throw):
2692 (JSC::Machine::cti_op_get_pnames):
2693 (JSC::Machine::cti_op_next_pname):
2694 (JSC::Machine::cti_op_push_scope):
2695 (JSC::Machine::cti_op_pop_scope):
2696 (JSC::Machine::cti_op_typeof):
2697 (JSC::Machine::cti_op_to_jsnumber):
2698 (JSC::Machine::cti_op_in):
2699 (JSC::Machine::cti_op_push_new_scope):
2700 (JSC::Machine::cti_op_jmp_scopes):
2701 (JSC::Machine::cti_op_put_by_index):
2702 (JSC::Machine::cti_op_switch_imm):
2703 (JSC::Machine::cti_op_switch_char):
2704 (JSC::Machine::cti_op_switch_string):
2705 (JSC::Machine::cti_op_del_by_val):
2706 (JSC::Machine::cti_op_put_getter):
2707 (JSC::Machine::cti_op_put_setter):
2708 (JSC::Machine::cti_op_new_error):
2709 (JSC::Machine::cti_op_debug):
2710 (JSC::Machine::cti_vm_throw):
2713 * VM/RegisterFile.h:
2715 * kjs/DebuggerCallFrame.cpp:
2716 (JSC::DebuggerCallFrame::functionName):
2717 (JSC::DebuggerCallFrame::type):
2718 (JSC::DebuggerCallFrame::thisObject):
2719 (JSC::DebuggerCallFrame::evaluate):
2720 * kjs/DebuggerCallFrame.h:
2721 * kjs/ExecState.cpp:
2722 (JSC::CallFrame::thisValue):
2724 * kjs/FunctionConstructor.cpp:
2725 (JSC::constructFunction):
2726 * kjs/JSActivation.cpp:
2727 (JSC::JSActivation::JSActivation):
2728 (JSC::JSActivation::argumentsGetter):
2729 * kjs/JSActivation.h:
2730 * kjs/JSGlobalObject.cpp:
2731 (JSC::JSGlobalObject::init):
2732 * kjs/JSGlobalObjectFunctions.cpp:
2733 (JSC::globalFuncEval):
2734 * kjs/JSVariableObject.h:
2736 (JSC::Parser::parse):
2737 * kjs/RegExpConstructor.cpp:
2738 (JSC::constructRegExp):
2739 * kjs/RegExpPrototype.cpp:
2740 (JSC::regExpProtoFuncCompile):
2742 (prettyPrintScript):
2743 * kjs/StringPrototype.cpp:
2744 (JSC::stringProtoFuncMatch):
2745 (JSC::stringProtoFuncSearch):
2746 * kjs/identifier.cpp:
2747 (JSC::Identifier::checkSameIdentifierTable):
2748 * kjs/interpreter.cpp:
2749 (JSC::Interpreter::checkSyntax):
2750 (JSC::Interpreter::evaluate):
2752 (JSC::ThrowableExpressionData::emitThrowError):
2753 (JSC::RegExpNode::emitCode):
2754 (JSC::ArrayNode::emitCode):
2755 (JSC::InstanceOfNode::emitCode):
2758 (JSC::RegExp::RegExp):
2759 (JSC::RegExp::create):
2761 * profiler/HeavyProfile.h:
2762 * profiler/Profile.h:
2766 2008-10-08 Mark Rowe <mrowe@apple.com>
2768 Typed by Maciej Stachowiak, reviewed by Mark Rowe.
2770 Fix crash in fast/js/constant-folding.html with CTI disabled.
2773 (JSC::Machine::privateExecute):
2775 2008-10-08 Timothy Hatcher <timothy@apple.com>
2777 Roll out r37427 because it causes an infinite recursion loading about:blank.
2779 https://bugs.webkit.org/show_bug.cgi?id=21476
2781 2008-10-08 Darin Adler <darin@apple.com>
2783 Reviewed by Cameron Zwarich.
2785 - https://bugs.webkit.org/show_bug.cgi?id=21403
2786 Bug 21403: use new CallFrame class rather than Register* for call frame manipulation
2788 Add CallFrame as a synonym for ExecState. Arguably, some day we should switch every
2789 client over to the new name.
2791 Use CallFrame* consistently rather than Register* or ExecState* in low-level code such
2792 as Machine.cpp and CTI.cpp. Similarly, use callFrame rather than r as its name and use
2793 accessor functions to get at things in the frame.
2795 Eliminate other uses of ExecState* that aren't needed, replacing in some cases with
2796 JSGlobalData* and in other cases eliminating them entirely.
2798 * API/JSObjectRef.cpp:
2799 (JSObjectMakeFunctionWithCallback):
2800 (JSObjectMakeFunction):
2801 (JSObjectHasProperty):
2802 (JSObjectGetProperty):
2803 (JSObjectSetProperty):
2804 (JSObjectDeleteProperty):
2805 * API/OpaqueJSString.cpp:
2806 * API/OpaqueJSString.h:
2808 (JSC::CTI::getConstant):
2809 (JSC::CTI::emitGetArg):
2810 (JSC::CTI::emitGetPutArg):
2811 (JSC::CTI::getConstantImmediateNumericArg):
2812 (JSC::CTI::printOpcodeOperandTypes):
2814 (JSC::CTI::compileOpCall):
2815 (JSC::CTI::compileBinaryArithOp):
2816 (JSC::CTI::privateCompileMainPass):
2817 (JSC::CTI::privateCompile):
2818 (JSC::CTI::privateCompileGetByIdProto):
2819 (JSC::CTI::privateCompileGetByIdChain):
2820 (JSC::CTI::compileRegExp):
2823 * VM/CodeGenerator.cpp:
2824 (JSC::CodeGenerator::emitEqualityOp):
2825 (JSC::CodeGenerator::emitLoad):
2826 (JSC::CodeGenerator::emitUnexpectedLoad):
2827 (JSC::CodeGenerator::emitConstruct):
2828 * VM/CodeGenerator.h:
2832 (JSC::jsAddSlowCase):
2834 (JSC::jsTypeStringForValue):
2835 (JSC::Machine::resolve):
2836 (JSC::Machine::resolveSkip):
2837 (JSC::Machine::resolveGlobal):
2838 (JSC::inlineResolveBase):
2839 (JSC::Machine::resolveBase):
2840 (JSC::Machine::resolveBaseAndProperty):
2841 (JSC::Machine::resolveBaseAndFunc):
2842 (JSC::Machine::slideRegisterWindowForCall):
2844 (JSC::Machine::callEval):
2845 (JSC::Machine::dumpCallFrame):
2846 (JSC::Machine::dumpRegisters):
2847 (JSC::Machine::unwindCallFrame):
2848 (JSC::Machine::throwException):
2849 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
2850 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
2851 (JSC::Machine::execute):
2852 (JSC::Machine::debug):
2853 (JSC::Machine::createExceptionScope):
2854 (JSC::cachePrototypeChain):
2855 (JSC::Machine::tryCachePutByID):
2856 (JSC::Machine::tryCacheGetByID):
2857 (JSC::Machine::privateExecute):
2858 (JSC::Machine::retrieveArguments):
2859 (JSC::Machine::retrieveCaller):
2860 (JSC::Machine::retrieveLastCaller):
2861 (JSC::Machine::findFunctionCallFrame):
2862 (JSC::Machine::getArgumentsData):
2863 (JSC::Machine::tryCTICachePutByID):
2864 (JSC::Machine::getCTIArrayLengthTrampoline):
2865 (JSC::Machine::getCTIStringLengthTrampoline):
2866 (JSC::Machine::tryCTICacheGetByID):
2867 (JSC::Machine::cti_op_convert_this):
2868 (JSC::Machine::cti_op_end):
2869 (JSC::Machine::cti_op_add):
2870 (JSC::Machine::cti_op_pre_inc):
2871 (JSC::Machine::cti_timeout_check):
2872 (JSC::Machine::cti_op_loop_if_less):
2873 (JSC::Machine::cti_op_loop_if_lesseq):
2874 (JSC::Machine::cti_op_new_object):
2875 (JSC::Machine::cti_op_put_by_id):
2876 (JSC::Machine::cti_op_put_by_id_second):
2877 (JSC::Machine::cti_op_put_by_id_generic):
2878 (JSC::Machine::cti_op_put_by_id_fail):
2879 (JSC::Machine::cti_op_get_by_id):
2880 (JSC::Machine::cti_op_get_by_id_second):
2881 (JSC::Machine::cti_op_get_by_id_generic):
2882 (JSC::Machine::cti_op_get_by_id_fail):
2883 (JSC::Machine::cti_op_instanceof):
2884 (JSC::Machine::cti_op_del_by_id):
2885 (JSC::Machine::cti_op_mul):
2886 (JSC::Machine::cti_op_new_func):
2887 (JSC::Machine::cti_op_call_JSFunction):
2888 (JSC::Machine::cti_vm_compile):
2889 (JSC::Machine::cti_op_push_activation):
2890 (JSC::Machine::cti_op_call_NotJSFunction):
2891 (JSC::Machine::cti_op_create_arguments):
2892 (JSC::Machine::cti_op_tear_off_activation):
2893 (JSC::Machine::cti_op_tear_off_arguments):
2894 (JSC::Machine::cti_op_ret_profiler):
2895 (JSC::Machine::cti_op_ret_scopeChain):
2896 (JSC::Machine::cti_op_new_array):
2897 (JSC::Machine::cti_op_resolve):
2898 (JSC::Machine::cti_op_construct_JSConstruct):
2899 (JSC::Machine::cti_op_construct_NotJSConstruct):
2900 (JSC::Machine::cti_op_get_by_val):
2901 (JSC::Machine::cti_op_resolve_func):
2902 (JSC::Machine::cti_op_sub):
2903 (JSC::Machine::cti_op_put_by_val):
2904 (JSC::Machine::cti_op_put_by_val_array):
2905 (JSC::Machine::cti_op_lesseq):
2906 (JSC::Machine::cti_op_loop_if_true):
2907 (JSC::Machine::cti_op_negate):
2908 (JSC::Machine::cti_op_resolve_base):
2909 (JSC::Machine::cti_op_resolve_skip):
2910 (JSC::Machine::cti_op_resolve_global):
2911 (JSC::Machine::cti_op_div):
2912 (JSC::Machine::cti_op_pre_dec):
2913 (JSC::Machine::cti_op_jless):
2914 (JSC::Machine::cti_op_not):
2915 (JSC::Machine::cti_op_jtrue):
2916 (JSC::Machine::cti_op_post_inc):
2917 (JSC::Machine::cti_op_eq):
2918 (JSC::Machine::cti_op_lshift):
2919 (JSC::Machine::cti_op_bitand):
2920 (JSC::Machine::cti_op_rshift):
2921 (JSC::Machine::cti_op_bitnot):
2922 (JSC::Machine::cti_op_resolve_with_base):
2923 (JSC::Machine::cti_op_new_func_exp):
2924 (JSC::Machine::cti_op_mod):
2925 (JSC::Machine::cti_op_less):
2926 (JSC::Machine::cti_op_neq):
2927 (JSC::Machine::cti_op_post_dec):
2928 (JSC::Machine::cti_op_urshift):
2929 (JSC::Machine::cti_op_bitxor):
2930 (JSC::Machine::cti_op_new_regexp):
2931 (JSC::Machine::cti_op_bitor):
2932 (JSC::Machine::cti_op_call_eval):
2933 (JSC::Machine::cti_op_throw):
2934 (JSC::Machine::cti_op_get_pnames):
2935 (JSC::Machine::cti_op_next_pname):
2936 (JSC::Machine::cti_op_push_scope):
2937 (JSC::Machine::cti_op_pop_scope):
2938 (JSC::Machine::cti_op_typeof):
2939 (JSC::Machine::cti_op_to_jsnumber):
2940 (JSC::Machine::cti_op_in):
2941 (JSC::Machine::cti_op_push_new_scope):
2942 (JSC::Machine::cti_op_jmp_scopes):
2943 (JSC::Machine::cti_op_put_by_index):
2944 (JSC::Machine::cti_op_switch_imm):
2945 (JSC::Machine::cti_op_switch_char):
2946 (JSC::Machine::cti_op_switch_string):
2947 (JSC::Machine::cti_op_del_by_val):
2948 (JSC::Machine::cti_op_put_getter):
2949 (JSC::Machine::cti_op_put_setter):
2950 (JSC::Machine::cti_op_new_error):
2951 (JSC::Machine::cti_op_debug):
2952 (JSC::Machine::cti_vm_throw):
2955 * VM/RegisterFile.h:
2957 * kjs/DebuggerCallFrame.cpp:
2958 (JSC::DebuggerCallFrame::functionName):
2959 (JSC::DebuggerCallFrame::type):
2960 (JSC::DebuggerCallFrame::thisObject):
2961 (JSC::DebuggerCallFrame::evaluate):
2962 * kjs/DebuggerCallFrame.h:
2963 * kjs/ExecState.cpp:
2964 (JSC::CallFrame::thisValue):
2966 * kjs/FunctionConstructor.cpp:
2967 (JSC::constructFunction):
2968 * kjs/JSActivation.cpp:
2969 (JSC::JSActivation::JSActivation):
2970 (JSC::JSActivation::argumentsGetter):
2971 * kjs/JSActivation.h:
2972 * kjs/JSGlobalObject.cpp:
2973 (JSC::JSGlobalObject::init):
2974 * kjs/JSGlobalObjectFunctions.cpp:
2975 (JSC::globalFuncEval):
2976 * kjs/JSVariableObject.h:
2978 (JSC::Parser::parse):
2979 * kjs/RegExpConstructor.cpp:
2980 (JSC::constructRegExp):
2981 * kjs/RegExpPrototype.cpp:
2982 (JSC::regExpProtoFuncCompile):
2984 (prettyPrintScript):
2985 * kjs/StringPrototype.cpp:
2986 (JSC::stringProtoFuncMatch):
2987 (JSC::stringProtoFuncSearch):
2988 * kjs/identifier.cpp:
2989 (JSC::Identifier::checkSameIdentifierTable):
2990 * kjs/interpreter.cpp:
2991 (JSC::Interpreter::checkSyntax):
2992 (JSC::Interpreter::evaluate):
2994 (JSC::ThrowableExpressionData::emitThrowError):
2995 (JSC::RegExpNode::emitCode):
2996 (JSC::ArrayNode::emitCode):
2997 (JSC::InstanceOfNode::emitCode):
3000 (JSC::RegExp::RegExp):
3001 (JSC::RegExp::create):
3003 * profiler/HeavyProfile.h:
3004 * profiler/Profile.h:
3008 2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
3010 Reviewed by Oliver Hunt.
3012 Avoid endless loops when compiling without the computed goto
3015 NEXT_OPCODE expands to "continue", which will not work inside
3019 (JSC::Machine::privateExecute):
3021 2008-10-08 Maciej Stachowiak <mjs@apple.com>
3023 Reviewed by Oliver Hunt.
3025 Re-landing the following fix with the crashing bug in it fixed (r37405):
3027 - optimize away multiplication by constant 1.0
3029 2.3% speedup on v8 RayTrace benchmark
3031 Apparently it's not uncommon for JavaScript code to multiply by
3032 constant 1.0 in the mistaken belief that this converts integer to
3033 floating point and that there is any operational difference.
3036 (JSC::CTI::privateCompileMainPass): Optimize to_jsnumber for
3037 case where parameter is already number.
3038 (JSC::CTI::privateCompileSlowCases): ditto
3040 (JSC::Machine::privateExecute): ditto
3042 (makeMultNode): Transform as follows:
3043 +FOO * BAR ==> FOO * BAR
3044 FOO * +BAR ==> FOO * BAR
3047 (makeDivNode): Transform as follows:
3048 +FOO / BAR ==> FOO / BAR
3049 FOO / +BAR ==> FOO / BAR
3050 (makeSubNode): Transform as follows:
3051 +FOO - BAR ==> FOO - BAR
3052 FOO - +BAR ==> FOO - BAR
3054 (JSC::ExpressionNode::stripUnaryPlus): Helper for above
3056 (JSC::UnaryPlusNode::stripUnaryPlus): ditto
3058 2008-10-08 Maciej Stachowiak <mjs@apple.com>
3060 Reviewed by Oliver Hunt.
3062 - correctly handle appending -0 to a string, it should stringify as just 0
3067 2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
3071 Fix WebKit compilation with VC2008SP1
3073 Apply the TR1 workaround for JavaScriptCore, too.
3075 * JavaScriptCore.pro:
3077 2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
3081 Fix compilation errors on VS2008 64Bit
3083 * kjs/collector.cpp:
3084 (JSC::currentThreadStackBase):
3086 2008-10-08 André Pönitz <apoenitz@trolltech.com>
3090 Fix compilation with Qt namespaces.
3094 2008-10-07 Sam Weinig <sam@webkit.org>
3098 2008-10-07 Oliver Hunt <oliver@apple.com>
3100 Reviewed by Cameron Zwarich.
3102 Switch CTI runtime calls to the fastcall calling convention
3104 Basically this means that we get to store the argument for CTI
3105 calls in the ECX register, which saves a register->memory write
3106 and subsequent memory->register read.
3108 This is a 1.7% progression in SunSpider and 2.4% on commandline
3113 (JSC::CTI::privateCompilePutByIdTransition):
3114 (JSC::CTI::privateCompilePatchGetArrayLength):
3117 * masm/X86Assembler.h:
3118 (JSC::X86Assembler::emitRestoreArgumentReference):
3119 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
3120 We need this to correctly reload ecx from inside certain property access
3124 2008-10-07 Maciej Stachowiak <mjs@apple.com>
3126 Reviewed by Mark Rowe.
3128 - optimize away multiplication by constant 1.0
3130 2.3% speedup on v8 RayTrace benchmark
3132 Apparently it's not uncommon for JavaScript code to multiply by
3133 constant 1.0 in the mistaken belief that this converts integer to
3134 floating point and that there is any operational difference.
3137 (JSC::CTI::privateCompileMainPass): Optimize to_jsnumber for
3138 case where parameter is already number.
3139 (JSC::CTI::privateCompileSlowCases): ditto
3141 (JSC::Machine::privateExecute): ditto
3143 (makeMultNode): Transform as follows:
3144 +FOO * BAR ==> FOO * BAR
3145 FOO * +BAR ==> FOO * BAR
3148 (makeDivNode): Transform as follows:
3149 +FOO / BAR ==> FOO / BAR
3150 FOO / +BAR ==> FOO / BAR
3151 (makeSubNode): Transform as follows:
3152 +FOO - BAR ==> FOO - BAR
3153 FOO - +BAR ==> FOO - BAR
3155 (JSC::ExpressionNode::stripUnaryPlus): Helper for above
3157 (JSC::UnaryPlusNode::stripUnaryPlus): ditto
3159 2008-10-07 Maciej Stachowiak <mjs@apple.com>
3161 Reviewed by Oliver Hunt.
3163 - make constant folding code more consistent
3165 Added a makeSubNode to match add, mult and div; use the makeFooNode functions always,
3166 instead of allocating nodes directly in other places in the grammar.
3170 2008-10-07 Sam Weinig <sam@webkit.org>
3172 Reviewed by Cameron Zwarich.
3174 Move hasGetterSetterProperties flag from PropertyMap to StructureID.
3177 (JSC::JSObject::put):
3178 (JSC::JSObject::defineGetter):
3179 (JSC::JSObject::defineSetter):
3181 (JSC::JSObject::hasGetterSetterProperties):
3182 (JSC::JSObject::getOwnPropertySlotForWrite):
3183 (JSC::JSObject::getOwnPropertySlot):
3184 * kjs/PropertyMap.h:
3185 * kjs/StructureID.cpp:
3186 (JSC::StructureID::StructureID):
3187 (JSC::StructureID::addPropertyTransition):
3188 (JSC::StructureID::toDictionaryTransition):
3189 (JSC::StructureID::changePrototypeTransition):
3190 (JSC::StructureID::getterSetterTransition):
3191 * kjs/StructureID.h:
3192 (JSC::StructureID::hasGetterSetterProperties):
3193 (JSC::StructureID::setHasGetterSetterProperties):
3195 2008-10-07 Sam Weinig <sam@webkit.org>
3197 Reviewed by Cameron Zwarich.
3199 Roll r37370 back in with bug fixes.
3201 - PropertyMap::storageSize() should reflect the number of keys + deletedOffsets
3202 and has nothing to do with the internal deletedSentinel count anymore.
3204 2008-10-07 Gavin Barraclough <barraclough@apple.com>
3206 Reviewed by Oliver Hunt.
3208 Move callframe initialization into JIT code, again.
3210 As a part of the restructuring the second result from functions is now
3211 returned in edx, allowing the new value of 'r' to be returned via a
3212 register, and stored to the stack from JIT code, too.
3214 4.5% progression on v8-tests. (3% in their harness)
3218 (JSC::CTI::emitCall):
3219 (JSC::CTI::compileOpCall):
3220 (JSC::CTI::privateCompileMainPass):
3221 (JSC::CTI::privateCompileSlowCases):
3222 (JSC::CTI::privateCompile):
3224 (JSC::CallRecord::CallRecord):
3226 (JSC::Machine::cti_op_call_JSFunction):
3227 (JSC::Machine::cti_op_construct_JSConstruct):
3228 (JSC::Machine::cti_op_resolve_func):
3229 (JSC::Machine::cti_op_post_inc):
3230 (JSC::Machine::cti_op_resolve_with_base):
3231 (JSC::Machine::cti_op_post_dec):
3236 2008-10-07 Mark Rowe <mrowe@apple.com>
3238 Fix typo in method name.
3243 2008-10-07 Cameron Zwarich <zwarich@apple.com>
3245 Rubber-stamped by Mark Rowe.
3249 2008-10-06 Sam Weinig <sam@webkit.org>
3251 Reviewed by Cameron Zwarich.
3253 Fix for https://bugs.webkit.org/show_bug.cgi?id=21415
3254 Improve the division between PropertyStorageArray and PropertyMap
3256 - Rework ProperyMap to store offsets in the value so that they don't
3257 change when rehashing. This allows us not to have to keep the
3258 PropertyStorageArray in sync and thus not have to pass it in.
3259 - Rename PropertyMap::getOffset -> PropertyMap::get since put/remove
3260 now also return offsets.
3261 - A Vector of deleted offsets is now needed since the storage is out of
3264 1% win on SunSpider. Wash on V8 suite.
3266 * JavaScriptCore.exp:
3268 (JSC::transitionWillNeedStorageRealloc):
3270 (JSC::Machine::privateExecute):
3271 Transition logic can be greatly simplified by the fact that
3272 the storage capacity is always known, and is correct for the
3275 (JSC::JSObject::put): Rename getOffset -> get.
3276 (JSC::JSObject::deleteProperty): Ditto.
3277 (JSC::JSObject::getPropertyAttributes): Ditto.
3278 (JSC::JSObject::removeDirect): Use returned offset to
3279 clear the value in the PropertyNameArray.
3280 (JSC::JSObject::allocatePropertyStorage): Add assert.
3282 (JSC::JSObject::getDirect): Rename getOffset -> get
3283 (JSC::JSObject::getDirectLocation): Rename getOffset -> get
3284 (JSC::JSObject::putDirect): Use propertyStorageCapacity to determine whether
3285 or not to resize. Also, since put now returns an offset (and thus
3286 addPropertyTransition does also) setting of the PropertyStorageArray is
3288 (JSC::JSObject::transitionTo):
3289 * kjs/PropertyMap.cpp:
3290 (JSC::PropertyMap::checkConsistency): PropertyStorageArray is no longer
3292 (JSC::PropertyMap::operator=): Copy the delete offsets vector.
3293 (JSC::PropertyMap::put): Instead of setting the PropertyNameArray
3294 explicitly, return the offset where the value should go.
3295 (JSC::PropertyMap::remove): Instead of removing from the PropertyNameArray
3296 explicitly, return the offset where the value should be removed.
3297 (JSC::PropertyMap::get): Switch to using the stored offset, instead
3298 of the implicit one.
3299 (JSC::PropertyMap::insert):
3300 (JSC::PropertyMap::expand): This is never called when m_table is null,
3301 so remove that branch and add it as an assertion.
3302 (JSC::PropertyMap::createTable): Consistency checks no longer take
3303 a PropertyNameArray.
3304 (JSC::PropertyMap::rehash): No need to rehash the PropertyNameArray
3305 now that it is completely out of band.
3306 * kjs/PropertyMap.h:
3307 (JSC::PropertyMapEntry::PropertyMapEntry): Store offset into PropertyNameArray.
3308 (JSC::PropertyMap::get): Switch to using the stored offset, instead
3309 of the implicit one.
3310 * kjs/StructureID.cpp:
3311 (JSC::StructureID::StructureID): Initialize the propertyStorageCapacity to
3312 JSObject::inlineStorageCapacity.
3313 (JSC::StructureID::growPropertyStorageCapacity): Grow the storage capacity as
3315 (JSC::StructureID::addPropertyTransition): Copy the storage capacity.
3316 (JSC::StructureID::toDictionaryTransition): Ditto.
3317 (JSC::StructureID::changePrototypeTransition): Ditto.
3318 (JSC::StructureID::getterSetterTransition): Ditto.
3319 * kjs/StructureID.h:
3320 (JSC::StructureID::propertyStorageCapacity): Add propertyStorageCapacity
3321 which is the current capacity for the JSObjects PropertyStorageArray.
3322 It starts at the JSObject::inlineStorageCapacity (currently 2), then
3323 when it first needs to be resized moves to the JSObject::nonInlineBaseStorageCapacity
3324 (currently 16), and after that doubles each time.
3326 2008-10-06 Cameron Zwarich <zwarich@apple.com>
3328 Reviewed by Oliver Hunt.
3330 Bug 21396: Remove the OptionalCalleeActivation call frame slot
3331 <https://bugs.webkit.org/show_bug.cgi?id=21396>
3333 Remove the OptionalCalleeActivation call frame slot. We have to be
3334 careful to store the activation object in a register, because objects
3335 in the scope chain do not get marked.
3337 This is a 0.3% speedup on both SunSpider and the V8 benchmark.
3340 (JSC::CTI::privateCompileMainPass):
3342 (JSC::CodeBlock::dump):
3343 * VM/CodeGenerator.cpp:
3344 (JSC::CodeGenerator::CodeGenerator):
3345 (JSC::CodeGenerator::emitReturn):
3346 * VM/CodeGenerator.h:
3348 (JSC::Machine::dumpRegisters):
3349 (JSC::Machine::unwindCallFrame):
3350 (JSC::Machine::privateExecute):
3351 (JSC::Machine::cti_op_call_JSFunction):
3352 (JSC::Machine::cti_op_push_activation):
3353 (JSC::Machine::cti_op_tear_off_activation):
3354 (JSC::Machine::cti_op_construct_JSConstruct):
3356 (JSC::Machine::initializeCallFrame):
3357 * VM/RegisterFile.h:
3358 (JSC::RegisterFile::):
3360 2008-10-06 Tony Chang <tony@chromium.org>
3362 Reviewed by Alexey Proskuryakov.
3364 Chromium doesn't use pthreads on windows, so make its use conditional.
3366 Also convert a WORD to a DWORD to avoid a compiler warning. This
3367 matches the other methods around it.
3369 * wtf/ThreadingWin.cpp:
3370 (WTF::wtfThreadEntryPoint):
3371 (WTF::ThreadCondition::broadcast):
3373 2008-10-06 Mark Mentovai <mark@moxienet.com>
3375 Reviewed by Tim Hatcher.
3377 Allow ENABLE_DASHBOARD_SUPPORT and ENABLE_MAC_JAVA_BRIDGE to be
3378 disabled on the Mac.
3380 https://bugs.webkit.org/show_bug.cgi?id=21333
3384 2008-10-06 Steve Falkenburg <sfalken@apple.com>
3386 https://bugs.webkit.org/show_bug.cgi?id=21416
3387 Pass 0 for size to VirtualAlloc, as documented by MSDN.
3388 Identified by Application Verifier.
3390 Reviewed by Darin Adler.
3392 * kjs/collector.cpp:
3395 2008-10-06 Kevin McCullough <kmccullough@apple.com>
3397 Reviewed by Tim Hatcheri and Oliver Hunt.
3399 https://bugs.webkit.org/show_bug.cgi?id=21412
3400 Bug 21412: Refactor user initiated profile count to be more stable
3401 - Export UString::from for use with creating the profile title.
3403 * JavaScriptCore.exp:
3405 2008-10-06 Maciej Stachowiak <mjs@apple.com>
3407 Not reviewed. Build fix.
3409 - revert toBoolean changes (r37333 and r37335); need to make WebCore work with these
3411 * API/JSValueRef.cpp:
3414 * JavaScriptCore.exp:
3416 (JSC::CodeBlock::dump):
3418 (JSC::Machine::privateExecute):
3419 (JSC::Machine::cti_op_loop_if_true):
3420 (JSC::Machine::cti_op_not):
3421 (JSC::Machine::cti_op_jtrue):
3422 * kjs/ArrayPrototype.cpp:
3423 (JSC::arrayProtoFuncFilter):
3424 (JSC::arrayProtoFuncEvery):
3425 (JSC::arrayProtoFuncSome):
3426 * kjs/BooleanConstructor.cpp:
3427 (JSC::constructBoolean):
3428 (JSC::callBooleanConstructor):
3429 * kjs/GetterSetter.h:
3431 (JSC::JSValue::toBoolean):
3432 * kjs/JSNumberCell.cpp:
3433 (JSC::JSNumberCell::toBoolean):
3434 * kjs/JSNumberCell.h:
3436 (JSC::JSObject::toBoolean):
3439 (JSC::JSString::toBoolean):
3442 * kjs/RegExpConstructor.cpp:
3443 (JSC::setRegExpConstructorMultiline):
3444 * kjs/RegExpObject.cpp:
3445 (JSC::RegExpObject::match):
3446 * kjs/RegExpPrototype.cpp:
3447 (JSC::regExpProtoFuncToString):
3449 2008-10-06 Maciej Stachowiak <mjs@apple.com>
3451 Reviewed by Sam Weinig.
3453 - optimize op_jtrue, op_loop_if_true and op_not in various ways
3454 https://bugs.webkit.org/show_bug.cgi?id=21404
3456 1) Make JSValue::toBoolean nonvirtual and completely inline by
3457 making use of the StructureID type field.
3459 2) Make JSValue::toBoolean not take an ExecState; doesn't need it.
3461 3) Make op_not, op_loop_if_true and op_jtrue not read the
3462 ExecState (toBoolean doesn't need it any more) and not check
3463 exceptions (toBoolean can't throw).
3465 * API/JSValueRef.cpp:
3467 * JavaScriptCore.exp:
3469 (JSC::CodeBlock::dump):
3471 (JSC::Machine::privateExecute):
3472 (JSC::Machine::cti_op_loop_if_true):
3473 (JSC::Machine::cti_op_not):
3474 (JSC::Machine::cti_op_jtrue):
3475 * kjs/ArrayPrototype.cpp:
3476 (JSC::arrayProtoFuncFilter):
3477 (JSC::arrayProtoFuncEvery):
3478 (JSC::arrayProtoFuncSome):
3479 * kjs/BooleanConstructor.cpp:
3480 (JSC::constructBoolean):
3481 (JSC::callBooleanConstructor):
3482 * kjs/GetterSetter.h:
3484 (JSC::JSValue::toBoolean):
3485 * kjs/JSNumberCell.cpp:
3486 * kjs/JSNumberCell.h:
3487 (JSC::JSNumberCell::toBoolean):
3490 (JSC::JSObject::toBoolean):
3491 (JSC::JSCell::toBoolean):
3494 (JSC::JSString::toBoolean):
3496 * kjs/RegExpConstructor.cpp:
3497 (JSC::setRegExpConstructorMultiline):
3498 * kjs/RegExpObject.cpp:
3499 (JSC::RegExpObject::match):
3500 * kjs/RegExpPrototype.cpp:
3501 (JSC::regExpProtoFuncToString):
3503 2008-10-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
3507 Build fix for MinGW.
3509 * JavaScriptCore.pri:
3511 (JSC::highResUpTime):
3513 2008-10-05 Cameron Zwarich <zwarich@apple.com>
3515 Reviewed by Oliver Hunt.
3517 Remove ScopeNode::containsClosures() now that it is unused.
3520 (JSC::ScopeNode::containsClosures):
3522 2008-10-05 Maciej Stachowiak <mjs@apple.com>
3524 Reviewed by Cameron Zwarich.
3526 - fix releas-only test failures caused by the fix to bug 21375
3529 (JSC::Machine::unwindCallFrame): Update ExecState while unwinding call frames;
3530 it now matters more to have a still-valid ExecState, since dynamicGlobalObject
3531 will make use of the ExecState's scope chain.