1 2008-10-16 Maciej Stachowiak <mjs@apple.com>
3 Reviewed by Geoff Garen.
5 - fixed <rdar://problem/5806316> JavaScriptCore should not force building with gcc 4.0
6 - use gcc 4.2 when building with Xcode 3.1 or newer on Leopard, even though this is not the default
8 This time there is no performance regression; we can avoid having
9 to use the fastcall calling convention for CTI functions by using
10 varargs to prevent the compiler from moving things around on the
13 * Configurations/DebugRelease.xcconfig:
14 * JavaScriptCore.xcodeproj/project.pbxproj:
19 2008-10-16 Maciej Stachowiak <mjs@apple.com>
21 Reviewed by Oliver Hunt.
23 - fix for REGRESSION: r37631 causing crashes on buildbot
24 https://bugs.webkit.org/show_bug.cgi?id=21682
27 (JSC::Heap::collect): Avoid crashing when a GC occurs while no global objects are live.
29 2008-10-16 Sam Weinig <sam@webkit.org>
31 Reviewed by Maciej Stachowiak.
33 Fix for https://bugs.webkit.org/show_bug.cgi?id=21683
34 Don't create intermediate StructureIDs for builtin objects
36 First step in reduce number of StructureIDs created when initializing the
39 - In order to avoid creating the intermediate StructureIDs use the new putDirectWithoutTransition
40 and putDirectFunctionWithoutTransition to add properties to JSObjects without transitioning
41 the StructureID. This patch just implements this strategy for ObjectPrototype but alone
42 reduces the number of StructureIDs create for about:blank by 10, from 142 to 132.
44 * kjs/JSGlobalObject.cpp:
45 (JSC::JSGlobalObject::reset):
47 (JSC::JSObject::putDirectFunctionWithoutTransition):
49 (JSC::JSObject::putDirectWithoutTransition):
50 * kjs/ObjectPrototype.cpp:
51 (JSC::ObjectPrototype::ObjectPrototype):
52 * kjs/ObjectPrototype.h:
53 * kjs/StructureID.cpp:
54 (JSC::StructureID::addPropertyWithoutTransition):
57 2008-10-16 Maciej Stachowiak <mjs@apple.com>
59 Reviewed by Cameron Zwarich.
61 - fix for: REGRESSION: over 100 StructureIDs leak loading about:blank (result of fix for bug 21633)
63 Apparent slight progression (< 0.5%) on v8 benchmarks and SunSpider.
65 * kjs/StructureID.cpp:
66 (JSC::StructureID::~StructureID): Don't deref this object's parent's pointer to
67 itself from the destructor; that doesn't even make sense.
68 (JSC::StructureID::addPropertyTransition): Don't refer the single transition;
69 the rule is that parent StructureIDs are ref'd but child ones are not. Refing
70 the child creates a cycle.
72 2008-10-15 Alexey Proskuryakov <ap@webkit.org>
74 Reviewed by Darin Adler.
76 https://bugs.webkit.org/show_bug.cgi?id=21609
77 Make MessagePorts protect their peers across heaps
80 * kjs/JSGlobalObject.cpp:
81 (JSC::JSGlobalObject::markCrossHeapDependentObjects):
82 * kjs/JSGlobalObject.h:
85 Before GC sweep phase, a function supplied by global object is now called for all global
86 objects in the heap, making it possible to implement cross-heap dependencies.
88 2008-10-15 Alexey Proskuryakov <ap@webkit.org>
90 Reviewed by Darin Adler.
92 https://bugs.webkit.org/show_bug.cgi?id=21610
93 run-webkit-threads --threaded crashes in StructureID destructor
95 * kjs/StructureID.cpp:
96 (JSC::StructureID::StructureID):
97 (JSC::StructureID::~StructureID):
98 Protect access to a static (debug-only) HashSet with a lock.
100 2008-10-15 Sam Weinig <sam@webkit.org>
102 Reviewed by Goeffrey Garen.
104 Add function to dump statistics for StructureIDs.
106 * kjs/StructureID.cpp:
107 (JSC::StructureID::dumpStatistics):
108 (JSC::StructureID::StructureID):
109 (JSC::StructureID::~StructureID):
112 2008-10-15 Cameron Zwarich <zwarich@apple.com>
114 Reviewed by Maciej Stachowiak.
116 Bug 21633: Avoid using a HashMap when there is only a single transition
117 <https://bugs.webkit.org/show_bug.cgi?id=21633>
119 This is a 0.8% speedup on SunSpider and between a 0.5% and 1.0% speedup
120 on the V8 benchmark suite, depending on which harness we use. It will
121 also slightly reduce the memory footprint of a StructureID.
123 * kjs/StructureID.cpp:
124 (JSC::StructureID::StructureID):
125 (JSC::StructureID::~StructureID):
126 (JSC::StructureID::addPropertyTransition):
128 (JSC::StructureID::):
130 2008-10-15 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
132 Reviewed by Geoffrey Garen.
134 1.40% speedup on SunSpider, 1.44% speedup on V8. (Linux)
139 (JSC::fastIsNumber): ALWAYS_INLINE modifier added.
141 2008-10-15 Geoffrey Garen <ggaren@apple.com>
143 Reviewed by Cameron Zwarich.
145 Fixed https://bugs.webkit.org/show_bug.cgi?id=21345
146 Start the debugger without reloading the inspected page
148 * JavaScriptCore.exp: New symbols.
149 * JavaScriptCore.xcodeproj/project.pbxproj: New files.
152 (JSC::EvalCodeCache::get): Updated for tweak to parsing API.
154 * kjs/CollectorHeapIterator.h: Added. An iterator for the object heap,
155 which we use to find all the live functions and recompile them.
157 * kjs/DebuggerCallFrame.cpp:
158 (JSC::DebuggerCallFrame::evaluate): Updated for tweak to parsing API.
160 * kjs/FunctionConstructor.cpp:
161 (JSC::constructFunction): Updated for tweak to parsing API.
163 * kjs/JSFunction.cpp:
164 (JSC::JSFunction::JSFunction): Try to validate our SourceCode in debug
165 builds by ASSERTing that it's syntactically valid. This doesn't catch
166 all SourceCode bugs, but it catches a lot of them.
168 * kjs/JSGlobalObjectFunctions.cpp:
169 (JSC::globalFuncEval): Updated for tweak to parsing API.
172 (JSC::Parser::parse):
174 (JSC::Parser::parse): Tweaked the parser to make it possible to parse
175 without an ExecState, and to allow the client to specify a debugger to
176 notify (or not) about the source we parse. This allows the inspector
177 to recompile even though no JavaScript is executing, then notify the
178 debugger about all source code when it's done.
181 (prettyPrintScript): Updated for tweak to parsing API.
184 (JSC::SourceCode::isNull): Added to help with ASSERTs.
187 (JSC::Heap::heapAllocate):
189 (JSC::Heap::primaryHeapBegin):
190 (JSC::Heap::primaryHeapEnd):
192 (JSC::): Moved a bunch of declarations around to enable compilation of
193 CollectorHeapIterator.
195 * kjs/interpreter.cpp:
196 (JSC::Interpreter::checkSyntax):
197 (JSC::Interpreter::evaluate): Updated for tweak to parsing API.
200 (JSC::Lexer::sourceCode): BUG FIX: Calculate SourceCode ranges relative
201 to the SourceCode range in which we're lexing, otherwise nested functions
202 that are compiled individually get SourceCode ranges that don't reflect
206 (JSC::FunctionBodyNode::FunctionBodyNode):
207 (JSC::FunctionBodyNode::finishParsing):
208 (JSC::FunctionBodyNode::create):
209 (JSC::FunctionBodyNode::copyParameters):
211 (JSC::ScopeNode::setSource):
212 (JSC::FunctionBodyNode::parameterCount): Added some helper functions for
213 copying one FunctionBodyNode's parameters to another. The recompiler uses
214 these when calling "finishParsing".
216 2008-10-15 Joerg Bornemann <joerg.bornemann@trolltech.com>
218 Reviewed by Darin Adler.
220 - part of https://bugs.webkit.org/show_bug.cgi?id=20746
221 Fix compilation on Windows CE.
223 str(n)icmp, strdup and vsnprintf are not available on Windows CE,
224 they are called _str(n)icmp, etc. instead
226 * wtf/StringExtras.h: Added inline function implementations.
228 2008-10-15 Gabor Loki <loki@inf.u-szeged.hu>
230 Reviewed by Cameron Zwarich.
232 <https://bugs.webkit.org/show_bug.cgi?id=20912>
233 Use simple uint32_t multiplication on op_mul if both operands are
234 immediate number and they are between zero and 0x7FFF.
237 (JSC::Machine::privateExecute):
239 2008-10-09 Darin Fisher <darin@chromium.org>
241 Reviewed by Sam Weinig.
243 Make pan scrolling a platform configurable option.
244 https://bugs.webkit.org/show_bug.cgi?id=21515
246 * wtf/Platform.h: Add ENABLE_PAN_SCROLLING
248 2008-10-14 Maciej Stachowiak <mjs@apple.com>
250 Rubber stamped by Sam Weinig.
252 - revert r37572 and r37581 for now
254 Turns out GCC 4.2 is still a (small) regression, we'll have to do
255 more work to turn it on.
257 * Configurations/DebugRelease.xcconfig:
258 * JavaScriptCore.xcodeproj/project.pbxproj:
262 (JSC::Machine::cti_op_convert_this):
263 (JSC::Machine::cti_op_end):
264 (JSC::Machine::cti_op_add):
265 (JSC::Machine::cti_op_pre_inc):
266 (JSC::Machine::cti_timeout_check):
267 (JSC::Machine::cti_register_file_check):
268 (JSC::Machine::cti_op_loop_if_less):
269 (JSC::Machine::cti_op_loop_if_lesseq):
270 (JSC::Machine::cti_op_new_object):
271 (JSC::Machine::cti_op_put_by_id):
272 (JSC::Machine::cti_op_put_by_id_second):
273 (JSC::Machine::cti_op_put_by_id_generic):
274 (JSC::Machine::cti_op_put_by_id_fail):
275 (JSC::Machine::cti_op_get_by_id):
276 (JSC::Machine::cti_op_get_by_id_second):
277 (JSC::Machine::cti_op_get_by_id_generic):
278 (JSC::Machine::cti_op_get_by_id_fail):
279 (JSC::Machine::cti_op_instanceof):
280 (JSC::Machine::cti_op_del_by_id):
281 (JSC::Machine::cti_op_mul):
282 (JSC::Machine::cti_op_new_func):
283 (JSC::Machine::cti_op_call_JSFunction):
284 (JSC::Machine::cti_vm_compile):
285 (JSC::Machine::cti_op_push_activation):
286 (JSC::Machine::cti_op_call_NotJSFunction):
287 (JSC::Machine::cti_op_create_arguments):
288 (JSC::Machine::cti_op_tear_off_activation):
289 (JSC::Machine::cti_op_tear_off_arguments):
290 (JSC::Machine::cti_op_ret_profiler):
291 (JSC::Machine::cti_op_ret_scopeChain):
292 (JSC::Machine::cti_op_new_array):
293 (JSC::Machine::cti_op_resolve):
294 (JSC::Machine::cti_op_construct_JSConstruct):
295 (JSC::Machine::cti_op_construct_NotJSConstruct):
296 (JSC::Machine::cti_op_get_by_val):
297 (JSC::Machine::cti_op_resolve_func):
298 (JSC::Machine::cti_op_sub):
299 (JSC::Machine::cti_op_put_by_val):
300 (JSC::Machine::cti_op_put_by_val_array):
301 (JSC::Machine::cti_op_lesseq):
302 (JSC::Machine::cti_op_loop_if_true):
303 (JSC::Machine::cti_op_negate):
304 (JSC::Machine::cti_op_resolve_base):
305 (JSC::Machine::cti_op_resolve_skip):
306 (JSC::Machine::cti_op_resolve_global):
307 (JSC::Machine::cti_op_div):
308 (JSC::Machine::cti_op_pre_dec):
309 (JSC::Machine::cti_op_jless):
310 (JSC::Machine::cti_op_not):
311 (JSC::Machine::cti_op_jtrue):
312 (JSC::Machine::cti_op_post_inc):
313 (JSC::Machine::cti_op_eq):
314 (JSC::Machine::cti_op_lshift):
315 (JSC::Machine::cti_op_bitand):
316 (JSC::Machine::cti_op_rshift):
317 (JSC::Machine::cti_op_bitnot):
318 (JSC::Machine::cti_op_resolve_with_base):
319 (JSC::Machine::cti_op_new_func_exp):
320 (JSC::Machine::cti_op_mod):
321 (JSC::Machine::cti_op_less):
322 (JSC::Machine::cti_op_neq):
323 (JSC::Machine::cti_op_post_dec):
324 (JSC::Machine::cti_op_urshift):
325 (JSC::Machine::cti_op_bitxor):
326 (JSC::Machine::cti_op_new_regexp):
327 (JSC::Machine::cti_op_bitor):
328 (JSC::Machine::cti_op_call_eval):
329 (JSC::Machine::cti_op_throw):
330 (JSC::Machine::cti_op_get_pnames):
331 (JSC::Machine::cti_op_next_pname):
332 (JSC::Machine::cti_op_push_scope):
333 (JSC::Machine::cti_op_pop_scope):
334 (JSC::Machine::cti_op_typeof):
335 (JSC::Machine::cti_op_is_undefined):
336 (JSC::Machine::cti_op_is_boolean):
337 (JSC::Machine::cti_op_is_number):
338 (JSC::Machine::cti_op_is_string):
339 (JSC::Machine::cti_op_is_object):
340 (JSC::Machine::cti_op_is_function):
341 (JSC::Machine::cti_op_stricteq):
342 (JSC::Machine::cti_op_nstricteq):
343 (JSC::Machine::cti_op_to_jsnumber):
344 (JSC::Machine::cti_op_in):
345 (JSC::Machine::cti_op_push_new_scope):
346 (JSC::Machine::cti_op_jmp_scopes):
347 (JSC::Machine::cti_op_put_by_index):
348 (JSC::Machine::cti_op_switch_imm):
349 (JSC::Machine::cti_op_switch_char):
350 (JSC::Machine::cti_op_switch_string):
351 (JSC::Machine::cti_op_del_by_val):
352 (JSC::Machine::cti_op_put_getter):
353 (JSC::Machine::cti_op_put_setter):
354 (JSC::Machine::cti_op_new_error):
355 (JSC::Machine::cti_op_debug):
356 (JSC::Machine::cti_vm_throw):
358 * masm/X86Assembler.h:
359 (JSC::X86Assembler::emitRestoreArgumentReference):
360 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
363 2008-10-14 Alexey Proskuryakov <ap@webkit.org>
365 Reviewed by Darin Adler.
367 https://bugs.webkit.org/show_bug.cgi?id=20256
368 Array.push and other standard methods disappear
370 * kjs/JSGlobalData.cpp:
371 (JSC::JSGlobalData::JSGlobalData):
372 (JSC::JSGlobalData::~JSGlobalData):
373 Don't use static hash tables even on platforms that don't enable JSC_MULTIPLE_THREADS -
374 these tables reference IdentifierTable, which is always per-GlobalData.
376 2008-10-14 Maciej Stachowiak <mjs@apple.com>
378 Reviewed by Cameron Zwarich.
380 - always use CTI_ARGUMENTS and CTI_ARGUMENTS_FASTCALL
382 This is a small regression for GCC 4.0, but simplifies the code
383 for future improvements and lets us focus on GCC 4.2+ and MSVC.
388 (JSC::Machine::cti_op_convert_this):
389 (JSC::Machine::cti_op_end):
390 (JSC::Machine::cti_op_add):
391 (JSC::Machine::cti_op_pre_inc):
392 (JSC::Machine::cti_timeout_check):
393 (JSC::Machine::cti_register_file_check):
394 (JSC::Machine::cti_op_loop_if_less):
395 (JSC::Machine::cti_op_loop_if_lesseq):
396 (JSC::Machine::cti_op_new_object):
397 (JSC::Machine::cti_op_put_by_id):
398 (JSC::Machine::cti_op_put_by_id_second):
399 (JSC::Machine::cti_op_put_by_id_generic):
400 (JSC::Machine::cti_op_put_by_id_fail):
401 (JSC::Machine::cti_op_get_by_id):
402 (JSC::Machine::cti_op_get_by_id_second):
403 (JSC::Machine::cti_op_get_by_id_generic):
404 (JSC::Machine::cti_op_get_by_id_fail):
405 (JSC::Machine::cti_op_instanceof):
406 (JSC::Machine::cti_op_del_by_id):
407 (JSC::Machine::cti_op_mul):
408 (JSC::Machine::cti_op_new_func):
409 (JSC::Machine::cti_op_call_JSFunction):
410 (JSC::Machine::cti_vm_compile):
411 (JSC::Machine::cti_op_push_activation):
412 (JSC::Machine::cti_op_call_NotJSFunction):
413 (JSC::Machine::cti_op_create_arguments):
414 (JSC::Machine::cti_op_tear_off_activation):
415 (JSC::Machine::cti_op_tear_off_arguments):
416 (JSC::Machine::cti_op_ret_profiler):
417 (JSC::Machine::cti_op_ret_scopeChain):
418 (JSC::Machine::cti_op_new_array):
419 (JSC::Machine::cti_op_resolve):
420 (JSC::Machine::cti_op_construct_JSConstruct):
421 (JSC::Machine::cti_op_construct_NotJSConstruct):
422 (JSC::Machine::cti_op_get_by_val):
423 (JSC::Machine::cti_op_resolve_func):
424 (JSC::Machine::cti_op_sub):
425 (JSC::Machine::cti_op_put_by_val):
426 (JSC::Machine::cti_op_put_by_val_array):
427 (JSC::Machine::cti_op_lesseq):
428 (JSC::Machine::cti_op_loop_if_true):
429 (JSC::Machine::cti_op_negate):
430 (JSC::Machine::cti_op_resolve_base):
431 (JSC::Machine::cti_op_resolve_skip):
432 (JSC::Machine::cti_op_resolve_global):
433 (JSC::Machine::cti_op_div):
434 (JSC::Machine::cti_op_pre_dec):
435 (JSC::Machine::cti_op_jless):
436 (JSC::Machine::cti_op_not):
437 (JSC::Machine::cti_op_jtrue):
438 (JSC::Machine::cti_op_post_inc):
439 (JSC::Machine::cti_op_eq):
440 (JSC::Machine::cti_op_lshift):
441 (JSC::Machine::cti_op_bitand):
442 (JSC::Machine::cti_op_rshift):
443 (JSC::Machine::cti_op_bitnot):
444 (JSC::Machine::cti_op_resolve_with_base):
445 (JSC::Machine::cti_op_new_func_exp):
446 (JSC::Machine::cti_op_mod):
447 (JSC::Machine::cti_op_less):
448 (JSC::Machine::cti_op_neq):
449 (JSC::Machine::cti_op_post_dec):
450 (JSC::Machine::cti_op_urshift):
451 (JSC::Machine::cti_op_bitxor):
452 (JSC::Machine::cti_op_new_regexp):
453 (JSC::Machine::cti_op_bitor):
454 (JSC::Machine::cti_op_call_eval):
455 (JSC::Machine::cti_op_throw):
456 (JSC::Machine::cti_op_get_pnames):
457 (JSC::Machine::cti_op_next_pname):
458 (JSC::Machine::cti_op_push_scope):
459 (JSC::Machine::cti_op_pop_scope):
460 (JSC::Machine::cti_op_typeof):
461 (JSC::Machine::cti_op_is_undefined):
462 (JSC::Machine::cti_op_is_boolean):
463 (JSC::Machine::cti_op_is_number):
464 (JSC::Machine::cti_op_is_string):
465 (JSC::Machine::cti_op_is_object):
466 (JSC::Machine::cti_op_is_function):
467 (JSC::Machine::cti_op_stricteq):
468 (JSC::Machine::cti_op_nstricteq):
469 (JSC::Machine::cti_op_to_jsnumber):
470 (JSC::Machine::cti_op_in):
471 (JSC::Machine::cti_op_push_new_scope):
472 (JSC::Machine::cti_op_jmp_scopes):
473 (JSC::Machine::cti_op_put_by_index):
474 (JSC::Machine::cti_op_switch_imm):
475 (JSC::Machine::cti_op_switch_char):
476 (JSC::Machine::cti_op_switch_string):
477 (JSC::Machine::cti_op_del_by_val):
478 (JSC::Machine::cti_op_put_getter):
479 (JSC::Machine::cti_op_put_setter):
480 (JSC::Machine::cti_op_new_error):
481 (JSC::Machine::cti_op_debug):
482 (JSC::Machine::cti_vm_throw):
484 * masm/X86Assembler.h:
485 (JSC::X86Assembler::emitRestoreArgumentReference):
486 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
489 2008-10-13 Maciej Stachowiak <mjs@apple.com>
491 Reviewed by Cameron Zwarich.
493 - make Machine::getArgumentsData an Arguments method and inline it
499 (JSC::Machine::getArgumentsData):
501 2008-10-13 Alp Toker <alp@nuanti.com>
503 Fix autotools dist build target by listing recently added header
504 files only. Not reviewed.
508 2008-10-13 Maciej Stachowiak <mjs@apple.com>
510 Rubber stamped by Mark Rowe.
512 - fixed <rdar://problem/5806316> JavaScriptCore should not force building with gcc 4.0
513 - use gcc 4.2 when building with Xcode 3.1 or newer on Leopard, even though this is not the default
515 * Configurations/DebugRelease.xcconfig:
516 * JavaScriptCore.xcodeproj/project.pbxproj:
518 2008-10-13 Cameron Zwarich <zwarich@apple.com>
520 Reviewed by Geoff Garen.
522 Bug 21541: Move RegisterFile growth check to callee
523 <https://bugs.webkit.org/show_bug.cgi?id=21541>
525 Move the RegisterFile growth check to the callee in the common case,
526 where some of the information is known statically at JIT time. There is
527 still a check in the caller in the case where the caller provides too
530 This is a 2.1% speedup on the V8 benchmark, including a 5.1% speedup on
531 the Richards benchmark, a 4.1% speedup on the DeltaBlue benchmark, and a
532 1.4% speedup on the Earley-Boyer benchmark. It is also a 0.5% speedup on
536 (JSC::CTI::privateCompile):
538 (JSC::Machine::cti_register_file_check):
539 (JSC::Machine::cti_op_call_JSFunction):
540 (JSC::Machine::cti_op_construct_JSConstruct):
543 * masm/X86Assembler.h:
544 (JSC::X86Assembler::):
545 (JSC::X86Assembler::cmpl_mr):
546 (JSC::X86Assembler::emitUnlinkedJg):
548 2008-10-13 Sam Weinig <sam@webkit.org>
550 Reviewed by Dan Bernstein.
552 Fix for https://bugs.webkit.org/show_bug.cgi?id=21577
553 5 false positive StructureID leaks
555 - Add leak ignore set to StructureID to selectively ignore leaking some StructureIDs.
556 - Add create method to JSGlolalData to be used when the data will be intentionally
557 leaked and ignore all leaks caused the StructureIDs stored in it.
559 * JavaScriptCore.exp:
560 * kjs/JSGlobalData.cpp:
561 (JSC::JSGlobalData::createLeaked):
562 * kjs/JSGlobalData.h:
563 * kjs/StructureID.cpp:
564 (JSC::StructureID::StructureID):
565 (JSC::StructureID::~StructureID):
566 (JSC::StructureID::startIgnoringLeaks):
567 (JSC::StructureID::stopIgnoringLeaks):
570 2008-10-13 Marco Barisione <marco.barisione@collabora.co.uk>
572 Reviewed by Darin Adler. Landed by Jan Alonzo.
574 WebKit GTK Port needs a smartpointer to handle g_free (GFreePtr?)
575 http://bugs.webkit.org/show_bug.cgi?id=20483
577 Add a GOwnPtr smart pointer (similar to OwnPtr) to handle memory
578 allocated by GLib and start the conversion to use it.
581 * wtf/GOwnPtr.cpp: Added.
588 * wtf/GOwnPtr.h: Added.
590 (WTF::GOwnPtr::GOwnPtr):
591 (WTF::GOwnPtr::~GOwnPtr):
593 (WTF::GOwnPtr::release):
594 (WTF::GOwnPtr::rawPtr):
596 (WTF::GOwnPtr::clear):
597 (WTF::GOwnPtr::operator*):
598 (WTF::GOwnPtr::operator->):
599 (WTF::GOwnPtr::operator!):
600 (WTF::GOwnPtr::operator UnspecifiedBoolType):
601 (WTF::GOwnPtr::swap):
607 * wtf/ThreadingGtk.cpp:
608 (WTF::Mutex::~Mutex):
610 (WTF::Mutex::tryLock):
611 (WTF::Mutex::unlock):
612 (WTF::ThreadCondition::~ThreadCondition):
613 (WTF::ThreadCondition::wait):
614 (WTF::ThreadCondition::timedWait):
615 (WTF::ThreadCondition::signal):
616 (WTF::ThreadCondition::broadcast):
618 2008-10-12 Gabriella Toth <gtoth@inf.u-szeged.hu>
620 Reviewed by Darin Adler.
622 - part of https://bugs.webkit.org/show_bug.cgi?id=21055
623 Bug 21055: not invoked functions
625 * kjs/nodes.cpp: Deleted a function that is not invoked:
626 statementListInitializeVariableAccessStack.
628 2008-10-12 Darin Adler <darin@apple.com>
630 Reviewed by Sam Weinig.
632 * wtf/unicode/icu/UnicodeIcu.h: Fixed indentation to match WebKit coding style.
633 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
635 2008-10-12 Darin Adler <darin@apple.com>
637 Reviewed by Sam Weinig.
639 - https://bugs.webkit.org/show_bug.cgi?id=21556
640 Bug 21556: non-ASCII digits are allowed in places where only ASCII should be
642 * wtf/unicode/icu/UnicodeIcu.h: Removed isDigit, digitValue, and isFormatChar.
643 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
645 2008-10-12 Anders Carlsson <andersca@apple.com>
647 Reviewed by Darin Adler.
649 Make the append method that takes a Vector more strict - it now requires the elements
650 of the vector to be appended same type as the elements of the Vector they're being appended to.
652 This would cause problems when dealing with Vectors containing other Vectors.
657 2008-10-11 Cameron Zwarich <zwarich@apple.com>
659 Reviewed by Sam Weinig.
661 Clean up RegExpMatchesArray.h to match our coding style.
663 * kjs/RegExpMatchesArray.h:
664 (JSC::RegExpMatchesArray::getOwnPropertySlot):
665 (JSC::RegExpMatchesArray::put):
666 (JSC::RegExpMatchesArray::deleteProperty):
667 (JSC::RegExpMatchesArray::getPropertyNames):
669 2008-10-11 Cameron Zwarich <zwarich@apple.com>
671 Reviewed by Sam Weinig.
673 Bug 21525: 55 StructureID leaks on Wikitravel's main page
674 <https://bugs.webkit.org/show_bug.cgi?id=21525>
676 Bug 21533: Simple JavaScript code leaks StructureIDs
677 <https://bugs.webkit.org/show_bug.cgi?id=21533>
679 StructureID::getEnumerablePropertyNames() ends up calling back to itself
680 via JSObject::getPropertyNames(), which causes the PropertyNameArray to
681 be cached twice. This leads to a memory leak in almost every use of
682 JSObject::getPropertyNames() on an object. The fix here is based on a
683 suggestion of Sam Weinig.
685 This patch also fixes every StructureID leaks that occurs while running
686 the Mozilla MemBuster test.
688 * kjs/PropertyNameArray.h:
689 (JSC::PropertyNameArray::PropertyNameArray):
690 (JSC::PropertyNameArray::setCacheable):
691 (JSC::PropertyNameArray::cacheable):
692 * kjs/StructureID.cpp:
693 (JSC::StructureID::getEnumerablePropertyNames):
695 2008-10-10 Oliver Hunt <oliver@apple.com>
697 Reviewed by Cameron Zwarich.
699 Use fastcall calling convention on GCC > 4.0
701 Results in a 2-3% improvement in GCC 4.2 performance, so
702 that it is no longer a regression vs. GCC 4.0
708 2008-10-10 Sam Weinig <sam@webkit.org>
710 Reviewed by Darin Adler.
712 - Add a workaround for a bug in ceil in Darwin libc.
713 - Remove old workarounds for JS math functions that are not needed
716 The math functions are heavily tested by fast/js/math.html.
718 * kjs/MathObject.cpp:
719 (JSC::mathProtoFuncAbs): Remove workaround.
720 (JSC::mathProtoFuncCeil): Ditto.
721 (JSC::mathProtoFuncFloor): Ditto.
723 (wtf_ceil): Add ceil workaround for darwin.
725 2008-10-10 Sam Weinig <sam@webkit.org>
727 Reviewed by Darin Adler
729 Add Assertions to JSObject constructor.
732 (JSC::JSObject::JSObject):
734 2008-10-10 Sam Weinig <sam@webkit.org>
736 Reviewed by Cameron Zwarich.
738 Remove now unused m_getterSetterFlag variable from PropertyMap.
740 * kjs/PropertyMap.cpp:
741 (JSC::PropertyMap::operator=):
743 (JSC::PropertyMap::PropertyMap):
745 2008-10-09 Sam Weinig <sam@webkit.org>
747 Reviewed by Maciej Stachowiak.
749 Add leaks checking to StructureID.
751 * kjs/StructureID.cpp:
752 (JSC::StructureID::StructureID):
753 (JSC::StructureID::~StructureID):
755 2008-10-09 Alp Toker <alp@nuanti.com>
757 Reviewed by Mark Rowe.
759 https://bugs.webkit.org/show_bug.cgi?id=20760
760 Implement support for x86 Linux in CTI
762 Prepare to enable CTI/WREC on supported architectures.
764 Make it possible to use the CTI_ARGUMENT workaround with GCC as well
765 as MSVC by fixing some preprocessor conditionals.
767 Note that CTI/WREC no longer requires CTI_ARGUMENT on Linux so we
768 don't actually enable it except when building with MSVC. GCC on Win32
771 Adapt inline ASM code to use the global symbol underscore prefix only
772 on Darwin and to call the properly mangled Machine::cti_vm_throw
773 symbol name depending on CTI_ARGUMENT.
775 Also avoid global inclusion of the JIT infrastructure headers
776 throughout WebCore and WebKit causing recompilation of about ~1500
777 source files after modification to X86Assembler.h, CTI.h, WREC.h,
778 which are only used deep inside JavaScriptCore.
786 (JSC::RegExp::RegExp):
787 (JSC::RegExp::~RegExp):
788 (JSC::RegExp::match):
790 * masm/X86Assembler.h:
791 (JSC::X86Assembler::emitConvertToFastCall):
792 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
793 (JSC::X86Assembler::emitRestoreArgumentReference):
795 2008-10-09 Gavin Barraclough <barraclough@apple.com>
797 Reviewed by Cameron Zwarich.
799 Fix for bug #21160, x=0;1/(x*-1) == -Infinity
803 (JSC::CTI::emitFastArithDeTagImmediate):
804 (JSC::CTI::emitFastArithDeTagImmediateJumpIfZero):
805 (JSC::CTI::compileBinaryArithOp):
806 (JSC::CTI::compileBinaryArithOpSlowCase):
807 (JSC::CTI::privateCompileMainPass):
808 (JSC::CTI::privateCompileSlowCases):
810 * masm/X86Assembler.h:
811 (JSC::X86Assembler::):
812 (JSC::X86Assembler::emitUnlinkedJs):
814 2008-10-09 Cameron Zwarich <zwarich@apple.com>
816 Reviewed by Oliver Hunt.
818 Bug 21459: REGRESSION (r37324): Safari crashes inside JavaScriptCore while browsing hulu.com
819 <https://bugs.webkit.org/show_bug.cgi?id=21459>
821 After r37324, an Arguments object does not mark an associated activation
822 object. This change was made because Arguments no longer directly used
823 the activation object in any way. However, if an activation is torn off,
824 then the backing store of Arguments becomes the register array of the
825 activation object. Arguments directly marks all of the arguments, but
826 the activation object is being collected, which causes its register
827 array to be freed and new memory to be allocated in its place.
829 Unfortunately, it does not seem possible to reproduce this issue in a
833 (JSC::Arguments::mark):
835 (JSC::Arguments::setActivation):
836 (JSC::Arguments::Arguments):
837 (JSC::JSActivation::copyRegisters):
839 2008-10-09 Ariya Hidayat <ariya.hidayat@trolltech.com>
845 * wtf/AlwaysInline.h:
847 2008-10-08 Cameron Zwarich <zwarich@apple.com>
849 Reviewed by Maciej Stachowiak.
851 Bug 21497: REGRESSION (r37433): Bytecode JSC tests are severely broken
852 <https://bugs.webkit.org/show_bug.cgi?id=21497>
854 Fix a typo in r37433 that causes the failure of a large number of JSC
855 tests with the bytecode interpreter enabled.
858 (JSC::Machine::privateExecute):
860 2008-10-08 Mark Rowe <mrowe@apple.com>
865 (JSC::): Update type of argument to ctiTrampoline.
867 2008-10-08 Darin Adler <darin@apple.com>
869 Reviewed by Cameron Zwarich.
871 - https://bugs.webkit.org/show_bug.cgi?id=21403
872 Bug 21403: use new CallFrame class rather than Register* for call frame manipulation
874 Add CallFrame as a synonym for ExecState. Arguably, some day we should switch every
875 client over to the new name.
877 Use CallFrame* consistently rather than Register* or ExecState* in low-level code such
878 as Machine.cpp and CTI.cpp. Similarly, use callFrame rather than r as its name and use
879 accessor functions to get at things in the frame.
881 Eliminate other uses of ExecState* that aren't needed, replacing in some cases with
882 JSGlobalData* and in other cases eliminating them entirely.
884 * API/JSObjectRef.cpp:
885 (JSObjectMakeFunctionWithCallback):
886 (JSObjectMakeFunction):
887 (JSObjectHasProperty):
888 (JSObjectGetProperty):
889 (JSObjectSetProperty):
890 (JSObjectDeleteProperty):
891 * API/OpaqueJSString.cpp:
892 * API/OpaqueJSString.h:
894 (JSC::CTI::getConstant):
895 (JSC::CTI::emitGetArg):
896 (JSC::CTI::emitGetPutArg):
897 (JSC::CTI::getConstantImmediateNumericArg):
898 (JSC::CTI::printOpcodeOperandTypes):
900 (JSC::CTI::compileOpCall):
901 (JSC::CTI::compileBinaryArithOp):
902 (JSC::CTI::privateCompileMainPass):
903 (JSC::CTI::privateCompile):
904 (JSC::CTI::privateCompileGetByIdProto):
905 (JSC::CTI::privateCompileGetByIdChain):
906 (JSC::CTI::compileRegExp):
909 * VM/CodeGenerator.cpp:
910 (JSC::CodeGenerator::emitEqualityOp):
911 (JSC::CodeGenerator::emitLoad):
912 (JSC::CodeGenerator::emitUnexpectedLoad):
913 (JSC::CodeGenerator::emitConstruct):
914 * VM/CodeGenerator.h:
918 (JSC::jsAddSlowCase):
920 (JSC::jsTypeStringForValue):
921 (JSC::Machine::resolve):
922 (JSC::Machine::resolveSkip):
923 (JSC::Machine::resolveGlobal):
924 (JSC::inlineResolveBase):
925 (JSC::Machine::resolveBase):
926 (JSC::Machine::resolveBaseAndProperty):
927 (JSC::Machine::resolveBaseAndFunc):
928 (JSC::Machine::slideRegisterWindowForCall):
930 (JSC::Machine::callEval):
931 (JSC::Machine::dumpCallFrame):
932 (JSC::Machine::dumpRegisters):
933 (JSC::Machine::unwindCallFrame):
934 (JSC::Machine::throwException):
935 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
936 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
937 (JSC::Machine::execute):
938 (JSC::Machine::debug):
939 (JSC::Machine::createExceptionScope):
940 (JSC::cachePrototypeChain):
941 (JSC::Machine::tryCachePutByID):
942 (JSC::Machine::tryCacheGetByID):
943 (JSC::Machine::privateExecute):
944 (JSC::Machine::retrieveArguments):
945 (JSC::Machine::retrieveCaller):
946 (JSC::Machine::retrieveLastCaller):
947 (JSC::Machine::findFunctionCallFrame):
948 (JSC::Machine::getArgumentsData):
949 (JSC::Machine::tryCTICachePutByID):
950 (JSC::Machine::getCTIArrayLengthTrampoline):
951 (JSC::Machine::getCTIStringLengthTrampoline):
952 (JSC::Machine::tryCTICacheGetByID):
953 (JSC::Machine::cti_op_convert_this):
954 (JSC::Machine::cti_op_end):
955 (JSC::Machine::cti_op_add):
956 (JSC::Machine::cti_op_pre_inc):
957 (JSC::Machine::cti_timeout_check):
958 (JSC::Machine::cti_op_loop_if_less):
959 (JSC::Machine::cti_op_loop_if_lesseq):
960 (JSC::Machine::cti_op_new_object):
961 (JSC::Machine::cti_op_put_by_id):
962 (JSC::Machine::cti_op_put_by_id_second):
963 (JSC::Machine::cti_op_put_by_id_generic):
964 (JSC::Machine::cti_op_put_by_id_fail):
965 (JSC::Machine::cti_op_get_by_id):
966 (JSC::Machine::cti_op_get_by_id_second):
967 (JSC::Machine::cti_op_get_by_id_generic):
968 (JSC::Machine::cti_op_get_by_id_fail):
969 (JSC::Machine::cti_op_instanceof):
970 (JSC::Machine::cti_op_del_by_id):
971 (JSC::Machine::cti_op_mul):
972 (JSC::Machine::cti_op_new_func):
973 (JSC::Machine::cti_op_call_JSFunction):
974 (JSC::Machine::cti_vm_compile):
975 (JSC::Machine::cti_op_push_activation):
976 (JSC::Machine::cti_op_call_NotJSFunction):
977 (JSC::Machine::cti_op_create_arguments):
978 (JSC::Machine::cti_op_tear_off_activation):
979 (JSC::Machine::cti_op_tear_off_arguments):
980 (JSC::Machine::cti_op_ret_profiler):
981 (JSC::Machine::cti_op_ret_scopeChain):
982 (JSC::Machine::cti_op_new_array):
983 (JSC::Machine::cti_op_resolve):
984 (JSC::Machine::cti_op_construct_JSConstruct):
985 (JSC::Machine::cti_op_construct_NotJSConstruct):
986 (JSC::Machine::cti_op_get_by_val):
987 (JSC::Machine::cti_op_resolve_func):
988 (JSC::Machine::cti_op_sub):
989 (JSC::Machine::cti_op_put_by_val):
990 (JSC::Machine::cti_op_put_by_val_array):
991 (JSC::Machine::cti_op_lesseq):
992 (JSC::Machine::cti_op_loop_if_true):
993 (JSC::Machine::cti_op_negate):
994 (JSC::Machine::cti_op_resolve_base):
995 (JSC::Machine::cti_op_resolve_skip):
996 (JSC::Machine::cti_op_resolve_global):
997 (JSC::Machine::cti_op_div):
998 (JSC::Machine::cti_op_pre_dec):
999 (JSC::Machine::cti_op_jless):
1000 (JSC::Machine::cti_op_not):
1001 (JSC::Machine::cti_op_jtrue):
1002 (JSC::Machine::cti_op_post_inc):
1003 (JSC::Machine::cti_op_eq):
1004 (JSC::Machine::cti_op_lshift):
1005 (JSC::Machine::cti_op_bitand):
1006 (JSC::Machine::cti_op_rshift):
1007 (JSC::Machine::cti_op_bitnot):
1008 (JSC::Machine::cti_op_resolve_with_base):
1009 (JSC::Machine::cti_op_new_func_exp):
1010 (JSC::Machine::cti_op_mod):
1011 (JSC::Machine::cti_op_less):
1012 (JSC::Machine::cti_op_neq):
1013 (JSC::Machine::cti_op_post_dec):
1014 (JSC::Machine::cti_op_urshift):
1015 (JSC::Machine::cti_op_bitxor):
1016 (JSC::Machine::cti_op_new_regexp):
1017 (JSC::Machine::cti_op_bitor):
1018 (JSC::Machine::cti_op_call_eval):
1019 (JSC::Machine::cti_op_throw):
1020 (JSC::Machine::cti_op_get_pnames):
1021 (JSC::Machine::cti_op_next_pname):
1022 (JSC::Machine::cti_op_push_scope):
1023 (JSC::Machine::cti_op_pop_scope):
1024 (JSC::Machine::cti_op_typeof):
1025 (JSC::Machine::cti_op_to_jsnumber):
1026 (JSC::Machine::cti_op_in):
1027 (JSC::Machine::cti_op_push_new_scope):
1028 (JSC::Machine::cti_op_jmp_scopes):
1029 (JSC::Machine::cti_op_put_by_index):
1030 (JSC::Machine::cti_op_switch_imm):
1031 (JSC::Machine::cti_op_switch_char):
1032 (JSC::Machine::cti_op_switch_string):
1033 (JSC::Machine::cti_op_del_by_val):
1034 (JSC::Machine::cti_op_put_getter):
1035 (JSC::Machine::cti_op_put_setter):
1036 (JSC::Machine::cti_op_new_error):
1037 (JSC::Machine::cti_op_debug):
1038 (JSC::Machine::cti_vm_throw):
1041 * VM/RegisterFile.h:
1043 * kjs/DebuggerCallFrame.cpp:
1044 (JSC::DebuggerCallFrame::functionName):
1045 (JSC::DebuggerCallFrame::type):
1046 (JSC::DebuggerCallFrame::thisObject):
1047 (JSC::DebuggerCallFrame::evaluate):
1048 * kjs/DebuggerCallFrame.h:
1049 * kjs/ExecState.cpp:
1050 (JSC::CallFrame::thisValue):
1052 * kjs/FunctionConstructor.cpp:
1053 (JSC::constructFunction):
1054 * kjs/JSActivation.cpp:
1055 (JSC::JSActivation::JSActivation):
1056 (JSC::JSActivation::argumentsGetter):
1057 * kjs/JSActivation.h:
1058 * kjs/JSGlobalObject.cpp:
1059 (JSC::JSGlobalObject::init):
1060 * kjs/JSGlobalObjectFunctions.cpp:
1061 (JSC::globalFuncEval):
1062 * kjs/JSVariableObject.h:
1064 (JSC::Parser::parse):
1065 * kjs/RegExpConstructor.cpp:
1066 (JSC::constructRegExp):
1067 * kjs/RegExpPrototype.cpp:
1068 (JSC::regExpProtoFuncCompile):
1070 (prettyPrintScript):
1071 * kjs/StringPrototype.cpp:
1072 (JSC::stringProtoFuncMatch):
1073 (JSC::stringProtoFuncSearch):
1074 * kjs/identifier.cpp:
1075 (JSC::Identifier::checkSameIdentifierTable):
1076 * kjs/interpreter.cpp:
1077 (JSC::Interpreter::checkSyntax):
1078 (JSC::Interpreter::evaluate):
1080 (JSC::ThrowableExpressionData::emitThrowError):
1081 (JSC::RegExpNode::emitCode):
1082 (JSC::ArrayNode::emitCode):
1083 (JSC::InstanceOfNode::emitCode):
1086 (JSC::RegExp::RegExp):
1087 (JSC::RegExp::create):
1089 * profiler/HeavyProfile.h:
1090 * profiler/Profile.h:
1094 2008-10-08 Mark Rowe <mrowe@apple.com>
1096 Typed by Maciej Stachowiak, reviewed by Mark Rowe.
1098 Fix crash in fast/js/constant-folding.html with CTI disabled.
1101 (JSC::Machine::privateExecute):
1103 2008-10-08 Timothy Hatcher <timothy@apple.com>
1105 Roll out r37427 because it causes an infinite recursion loading about:blank.
1107 https://bugs.webkit.org/show_bug.cgi?id=21476
1109 2008-10-08 Darin Adler <darin@apple.com>
1111 Reviewed by Cameron Zwarich.
1113 - https://bugs.webkit.org/show_bug.cgi?id=21403
1114 Bug 21403: use new CallFrame class rather than Register* for call frame manipulation
1116 Add CallFrame as a synonym for ExecState. Arguably, some day we should switch every
1117 client over to the new name.
1119 Use CallFrame* consistently rather than Register* or ExecState* in low-level code such
1120 as Machine.cpp and CTI.cpp. Similarly, use callFrame rather than r as its name and use
1121 accessor functions to get at things in the frame.
1123 Eliminate other uses of ExecState* that aren't needed, replacing in some cases with
1124 JSGlobalData* and in other cases eliminating them entirely.
1126 * API/JSObjectRef.cpp:
1127 (JSObjectMakeFunctionWithCallback):
1128 (JSObjectMakeFunction):
1129 (JSObjectHasProperty):
1130 (JSObjectGetProperty):
1131 (JSObjectSetProperty):
1132 (JSObjectDeleteProperty):
1133 * API/OpaqueJSString.cpp:
1134 * API/OpaqueJSString.h:
1136 (JSC::CTI::getConstant):
1137 (JSC::CTI::emitGetArg):
1138 (JSC::CTI::emitGetPutArg):
1139 (JSC::CTI::getConstantImmediateNumericArg):
1140 (JSC::CTI::printOpcodeOperandTypes):
1142 (JSC::CTI::compileOpCall):
1143 (JSC::CTI::compileBinaryArithOp):
1144 (JSC::CTI::privateCompileMainPass):
1145 (JSC::CTI::privateCompile):
1146 (JSC::CTI::privateCompileGetByIdProto):
1147 (JSC::CTI::privateCompileGetByIdChain):
1148 (JSC::CTI::compileRegExp):
1151 * VM/CodeGenerator.cpp:
1152 (JSC::CodeGenerator::emitEqualityOp):
1153 (JSC::CodeGenerator::emitLoad):
1154 (JSC::CodeGenerator::emitUnexpectedLoad):
1155 (JSC::CodeGenerator::emitConstruct):
1156 * VM/CodeGenerator.h:
1160 (JSC::jsAddSlowCase):
1162 (JSC::jsTypeStringForValue):
1163 (JSC::Machine::resolve):
1164 (JSC::Machine::resolveSkip):
1165 (JSC::Machine::resolveGlobal):
1166 (JSC::inlineResolveBase):
1167 (JSC::Machine::resolveBase):
1168 (JSC::Machine::resolveBaseAndProperty):
1169 (JSC::Machine::resolveBaseAndFunc):
1170 (JSC::Machine::slideRegisterWindowForCall):
1172 (JSC::Machine::callEval):
1173 (JSC::Machine::dumpCallFrame):
1174 (JSC::Machine::dumpRegisters):
1175 (JSC::Machine::unwindCallFrame):
1176 (JSC::Machine::throwException):
1177 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
1178 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
1179 (JSC::Machine::execute):
1180 (JSC::Machine::debug):
1181 (JSC::Machine::createExceptionScope):
1182 (JSC::cachePrototypeChain):
1183 (JSC::Machine::tryCachePutByID):
1184 (JSC::Machine::tryCacheGetByID):
1185 (JSC::Machine::privateExecute):
1186 (JSC::Machine::retrieveArguments):
1187 (JSC::Machine::retrieveCaller):
1188 (JSC::Machine::retrieveLastCaller):
1189 (JSC::Machine::findFunctionCallFrame):
1190 (JSC::Machine::getArgumentsData):
1191 (JSC::Machine::tryCTICachePutByID):
1192 (JSC::Machine::getCTIArrayLengthTrampoline):
1193 (JSC::Machine::getCTIStringLengthTrampoline):
1194 (JSC::Machine::tryCTICacheGetByID):
1195 (JSC::Machine::cti_op_convert_this):
1196 (JSC::Machine::cti_op_end):
1197 (JSC::Machine::cti_op_add):
1198 (JSC::Machine::cti_op_pre_inc):
1199 (JSC::Machine::cti_timeout_check):
1200 (JSC::Machine::cti_op_loop_if_less):
1201 (JSC::Machine::cti_op_loop_if_lesseq):
1202 (JSC::Machine::cti_op_new_object):
1203 (JSC::Machine::cti_op_put_by_id):
1204 (JSC::Machine::cti_op_put_by_id_second):
1205 (JSC::Machine::cti_op_put_by_id_generic):
1206 (JSC::Machine::cti_op_put_by_id_fail):
1207 (JSC::Machine::cti_op_get_by_id):
1208 (JSC::Machine::cti_op_get_by_id_second):
1209 (JSC::Machine::cti_op_get_by_id_generic):
1210 (JSC::Machine::cti_op_get_by_id_fail):
1211 (JSC::Machine::cti_op_instanceof):
1212 (JSC::Machine::cti_op_del_by_id):
1213 (JSC::Machine::cti_op_mul):
1214 (JSC::Machine::cti_op_new_func):
1215 (JSC::Machine::cti_op_call_JSFunction):
1216 (JSC::Machine::cti_vm_compile):
1217 (JSC::Machine::cti_op_push_activation):
1218 (JSC::Machine::cti_op_call_NotJSFunction):
1219 (JSC::Machine::cti_op_create_arguments):
1220 (JSC::Machine::cti_op_tear_off_activation):
1221 (JSC::Machine::cti_op_tear_off_arguments):
1222 (JSC::Machine::cti_op_ret_profiler):
1223 (JSC::Machine::cti_op_ret_scopeChain):
1224 (JSC::Machine::cti_op_new_array):
1225 (JSC::Machine::cti_op_resolve):
1226 (JSC::Machine::cti_op_construct_JSConstruct):
1227 (JSC::Machine::cti_op_construct_NotJSConstruct):
1228 (JSC::Machine::cti_op_get_by_val):
1229 (JSC::Machine::cti_op_resolve_func):
1230 (JSC::Machine::cti_op_sub):
1231 (JSC::Machine::cti_op_put_by_val):
1232 (JSC::Machine::cti_op_put_by_val_array):
1233 (JSC::Machine::cti_op_lesseq):
1234 (JSC::Machine::cti_op_loop_if_true):
1235 (JSC::Machine::cti_op_negate):
1236 (JSC::Machine::cti_op_resolve_base):
1237 (JSC::Machine::cti_op_resolve_skip):
1238 (JSC::Machine::cti_op_resolve_global):
1239 (JSC::Machine::cti_op_div):
1240 (JSC::Machine::cti_op_pre_dec):
1241 (JSC::Machine::cti_op_jless):
1242 (JSC::Machine::cti_op_not):
1243 (JSC::Machine::cti_op_jtrue):
1244 (JSC::Machine::cti_op_post_inc):
1245 (JSC::Machine::cti_op_eq):
1246 (JSC::Machine::cti_op_lshift):
1247 (JSC::Machine::cti_op_bitand):
1248 (JSC::Machine::cti_op_rshift):
1249 (JSC::Machine::cti_op_bitnot):
1250 (JSC::Machine::cti_op_resolve_with_base):
1251 (JSC::Machine::cti_op_new_func_exp):
1252 (JSC::Machine::cti_op_mod):
1253 (JSC::Machine::cti_op_less):
1254 (JSC::Machine::cti_op_neq):
1255 (JSC::Machine::cti_op_post_dec):
1256 (JSC::Machine::cti_op_urshift):
1257 (JSC::Machine::cti_op_bitxor):
1258 (JSC::Machine::cti_op_new_regexp):
1259 (JSC::Machine::cti_op_bitor):
1260 (JSC::Machine::cti_op_call_eval):
1261 (JSC::Machine::cti_op_throw):
1262 (JSC::Machine::cti_op_get_pnames):
1263 (JSC::Machine::cti_op_next_pname):
1264 (JSC::Machine::cti_op_push_scope):
1265 (JSC::Machine::cti_op_pop_scope):
1266 (JSC::Machine::cti_op_typeof):
1267 (JSC::Machine::cti_op_to_jsnumber):
1268 (JSC::Machine::cti_op_in):
1269 (JSC::Machine::cti_op_push_new_scope):
1270 (JSC::Machine::cti_op_jmp_scopes):
1271 (JSC::Machine::cti_op_put_by_index):
1272 (JSC::Machine::cti_op_switch_imm):
1273 (JSC::Machine::cti_op_switch_char):
1274 (JSC::Machine::cti_op_switch_string):
1275 (JSC::Machine::cti_op_del_by_val):
1276 (JSC::Machine::cti_op_put_getter):
1277 (JSC::Machine::cti_op_put_setter):
1278 (JSC::Machine::cti_op_new_error):
1279 (JSC::Machine::cti_op_debug):
1280 (JSC::Machine::cti_vm_throw):
1283 * VM/RegisterFile.h:
1285 * kjs/DebuggerCallFrame.cpp:
1286 (JSC::DebuggerCallFrame::functionName):
1287 (JSC::DebuggerCallFrame::type):
1288 (JSC::DebuggerCallFrame::thisObject):
1289 (JSC::DebuggerCallFrame::evaluate):
1290 * kjs/DebuggerCallFrame.h:
1291 * kjs/ExecState.cpp:
1292 (JSC::CallFrame::thisValue):
1294 * kjs/FunctionConstructor.cpp:
1295 (JSC::constructFunction):
1296 * kjs/JSActivation.cpp:
1297 (JSC::JSActivation::JSActivation):
1298 (JSC::JSActivation::argumentsGetter):
1299 * kjs/JSActivation.h:
1300 * kjs/JSGlobalObject.cpp:
1301 (JSC::JSGlobalObject::init):
1302 * kjs/JSGlobalObjectFunctions.cpp:
1303 (JSC::globalFuncEval):
1304 * kjs/JSVariableObject.h:
1306 (JSC::Parser::parse):
1307 * kjs/RegExpConstructor.cpp:
1308 (JSC::constructRegExp):
1309 * kjs/RegExpPrototype.cpp:
1310 (JSC::regExpProtoFuncCompile):
1312 (prettyPrintScript):
1313 * kjs/StringPrototype.cpp:
1314 (JSC::stringProtoFuncMatch):
1315 (JSC::stringProtoFuncSearch):
1316 * kjs/identifier.cpp:
1317 (JSC::Identifier::checkSameIdentifierTable):
1318 * kjs/interpreter.cpp:
1319 (JSC::Interpreter::checkSyntax):
1320 (JSC::Interpreter::evaluate):
1322 (JSC::ThrowableExpressionData::emitThrowError):
1323 (JSC::RegExpNode::emitCode):
1324 (JSC::ArrayNode::emitCode):
1325 (JSC::InstanceOfNode::emitCode):
1328 (JSC::RegExp::RegExp):
1329 (JSC::RegExp::create):
1331 * profiler/HeavyProfile.h:
1332 * profiler/Profile.h:
1336 2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
1338 Reviewed by Oliver Hunt.
1340 Avoid endless loops when compiling without the computed goto
1343 NEXT_OPCODE expands to "continue", which will not work inside
1347 (JSC::Machine::privateExecute):
1349 2008-10-08 Maciej Stachowiak <mjs@apple.com>
1351 Reviewed by Oliver Hunt.
1353 Re-landing the following fix with the crashing bug in it fixed (r37405):
1355 - optimize away multiplication by constant 1.0
1357 2.3% speedup on v8 RayTrace benchmark
1359 Apparently it's not uncommon for JavaScript code to multiply by
1360 constant 1.0 in the mistaken belief that this converts integer to
1361 floating point and that there is any operational difference.
1364 (JSC::CTI::privateCompileMainPass): Optimize to_jsnumber for
1365 case where parameter is already number.
1366 (JSC::CTI::privateCompileSlowCases): ditto
1368 (JSC::Machine::privateExecute): ditto
1370 (makeMultNode): Transform as follows:
1371 +FOO * BAR ==> FOO * BAR
1372 FOO * +BAR ==> FOO * BAR
1375 (makeDivNode): Transform as follows:
1376 +FOO / BAR ==> FOO / BAR
1377 FOO / +BAR ==> FOO / BAR
1378 (makeSubNode): Transform as follows:
1379 +FOO - BAR ==> FOO - BAR
1380 FOO - +BAR ==> FOO - BAR
1382 (JSC::ExpressionNode::stripUnaryPlus): Helper for above
1384 (JSC::UnaryPlusNode::stripUnaryPlus): ditto
1386 2008-10-08 Maciej Stachowiak <mjs@apple.com>
1388 Reviewed by Oliver Hunt.
1390 - correctly handle appending -0 to a string, it should stringify as just 0
1395 2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
1399 Fix WebKit compilation with VC2008SP1
1401 Apply the TR1 workaround for JavaScriptCore, too.
1403 * JavaScriptCore.pro:
1405 2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
1409 Fix compilation errors on VS2008 64Bit
1411 * kjs/collector.cpp:
1412 (JSC::currentThreadStackBase):
1414 2008-10-08 André Pönitz <apoenitz@trolltech.com>
1418 Fix compilation with Qt namespaces.
1422 2008-10-07 Sam Weinig <sam@webkit.org>
1426 2008-10-07 Oliver Hunt <oliver@apple.com>
1428 Reviewed by Cameron Zwarich.
1430 Switch CTI runtime calls to the fastcall calling convention
1432 Basically this means that we get to store the argument for CTI
1433 calls in the ECX register, which saves a register->memory write
1434 and subsequent memory->register read.
1436 This is a 1.7% progression in SunSpider and 2.4% on commandline
1441 (JSC::CTI::privateCompilePutByIdTransition):
1442 (JSC::CTI::privateCompilePatchGetArrayLength):
1445 * masm/X86Assembler.h:
1446 (JSC::X86Assembler::emitRestoreArgumentReference):
1447 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
1448 We need this to correctly reload ecx from inside certain property access
1452 2008-10-07 Maciej Stachowiak <mjs@apple.com>
1454 Reviewed by Mark Rowe.
1456 - optimize away multiplication by constant 1.0
1458 2.3% speedup on v8 RayTrace benchmark
1460 Apparently it's not uncommon for JavaScript code to multiply by
1461 constant 1.0 in the mistaken belief that this converts integer to
1462 floating point and that there is any operational difference.
1465 (JSC::CTI::privateCompileMainPass): Optimize to_jsnumber for
1466 case where parameter is already number.
1467 (JSC::CTI::privateCompileSlowCases): ditto
1469 (JSC::Machine::privateExecute): ditto
1471 (makeMultNode): Transform as follows:
1472 +FOO * BAR ==> FOO * BAR
1473 FOO * +BAR ==> FOO * BAR
1476 (makeDivNode): Transform as follows:
1477 +FOO / BAR ==> FOO / BAR
1478 FOO / +BAR ==> FOO / BAR
1479 (makeSubNode): Transform as follows:
1480 +FOO - BAR ==> FOO - BAR
1481 FOO - +BAR ==> FOO - BAR
1483 (JSC::ExpressionNode::stripUnaryPlus): Helper for above
1485 (JSC::UnaryPlusNode::stripUnaryPlus): ditto
1487 2008-10-07 Maciej Stachowiak <mjs@apple.com>
1489 Reviewed by Oliver Hunt.
1491 - make constant folding code more consistent
1493 Added a makeSubNode to match add, mult and div; use the makeFooNode functions always,
1494 instead of allocating nodes directly in other places in the grammar.
1498 2008-10-07 Sam Weinig <sam@webkit.org>
1500 Reviewed by Cameron Zwarich.
1502 Move hasGetterSetterProperties flag from PropertyMap to StructureID.
1505 (JSC::JSObject::put):
1506 (JSC::JSObject::defineGetter):
1507 (JSC::JSObject::defineSetter):
1509 (JSC::JSObject::hasGetterSetterProperties):
1510 (JSC::JSObject::getOwnPropertySlotForWrite):
1511 (JSC::JSObject::getOwnPropertySlot):
1512 * kjs/PropertyMap.h:
1513 * kjs/StructureID.cpp:
1514 (JSC::StructureID::StructureID):
1515 (JSC::StructureID::addPropertyTransition):
1516 (JSC::StructureID::toDictionaryTransition):
1517 (JSC::StructureID::changePrototypeTransition):
1518 (JSC::StructureID::getterSetterTransition):
1519 * kjs/StructureID.h:
1520 (JSC::StructureID::hasGetterSetterProperties):
1521 (JSC::StructureID::setHasGetterSetterProperties):
1523 2008-10-07 Sam Weinig <sam@webkit.org>
1525 Reviewed by Cameron Zwarich.
1527 Roll r37370 back in with bug fixes.
1529 - PropertyMap::storageSize() should reflect the number of keys + deletedOffsets
1530 and has nothing to do with the internal deletedSentinel count anymore.
1532 2008-10-07 Gavin Barraclough <barraclough@apple.com>
1534 Reviewed by Oliver Hunt.
1536 Move callframe initialization into JIT code, again.
1538 As a part of the restructuring the second result from functions is now
1539 returned in edx, allowing the new value of 'r' to be returned via a
1540 register, and stored to the stack from JIT code, too.
1542 4.5% progression on v8-tests. (3% in their harness)
1546 (JSC::CTI::emitCall):
1547 (JSC::CTI::compileOpCall):
1548 (JSC::CTI::privateCompileMainPass):
1549 (JSC::CTI::privateCompileSlowCases):
1550 (JSC::CTI::privateCompile):
1552 (JSC::CallRecord::CallRecord):
1554 (JSC::Machine::cti_op_call_JSFunction):
1555 (JSC::Machine::cti_op_construct_JSConstruct):
1556 (JSC::Machine::cti_op_resolve_func):
1557 (JSC::Machine::cti_op_post_inc):
1558 (JSC::Machine::cti_op_resolve_with_base):
1559 (JSC::Machine::cti_op_post_dec):
1564 2008-10-07 Mark Rowe <mrowe@apple.com>
1566 Fix typo in method name.
1571 2008-10-07 Cameron Zwarich <zwarich@apple.com>
1573 Rubber-stamped by Mark Rowe.
1577 2008-10-06 Sam Weinig <sam@webkit.org>
1579 Reviewed by Cameron Zwarich.
1581 Fix for https://bugs.webkit.org/show_bug.cgi?id=21415
1582 Improve the division between PropertyStorageArray and PropertyMap
1584 - Rework ProperyMap to store offsets in the value so that they don't
1585 change when rehashing. This allows us not to have to keep the
1586 PropertyStorageArray in sync and thus not have to pass it in.
1587 - Rename PropertyMap::getOffset -> PropertyMap::get since put/remove
1588 now also return offsets.
1589 - A Vector of deleted offsets is now needed since the storage is out of
1592 1% win on SunSpider. Wash on V8 suite.
1594 * JavaScriptCore.exp:
1596 (JSC::transitionWillNeedStorageRealloc):
1598 (JSC::Machine::privateExecute):
1599 Transition logic can be greatly simplified by the fact that
1600 the storage capacity is always known, and is correct for the
1603 (JSC::JSObject::put): Rename getOffset -> get.
1604 (JSC::JSObject::deleteProperty): Ditto.
1605 (JSC::JSObject::getPropertyAttributes): Ditto.
1606 (JSC::JSObject::removeDirect): Use returned offset to
1607 clear the value in the PropertyNameArray.
1608 (JSC::JSObject::allocatePropertyStorage): Add assert.
1610 (JSC::JSObject::getDirect): Rename getOffset -> get
1611 (JSC::JSObject::getDirectLocation): Rename getOffset -> get
1612 (JSC::JSObject::putDirect): Use propertyStorageCapacity to determine whether
1613 or not to resize. Also, since put now returns an offset (and thus
1614 addPropertyTransition does also) setting of the PropertyStorageArray is
1616 (JSC::JSObject::transitionTo):
1617 * kjs/PropertyMap.cpp:
1618 (JSC::PropertyMap::checkConsistency): PropertyStorageArray is no longer
1620 (JSC::PropertyMap::operator=): Copy the delete offsets vector.
1621 (JSC::PropertyMap::put): Instead of setting the PropertyNameArray
1622 explicitly, return the offset where the value should go.
1623 (JSC::PropertyMap::remove): Instead of removing from the PropertyNameArray
1624 explicitly, return the offset where the value should be removed.
1625 (JSC::PropertyMap::get): Switch to using the stored offset, instead
1626 of the implicit one.
1627 (JSC::PropertyMap::insert):
1628 (JSC::PropertyMap::expand): This is never called when m_table is null,
1629 so remove that branch and add it as an assertion.
1630 (JSC::PropertyMap::createTable): Consistency checks no longer take
1631 a PropertyNameArray.
1632 (JSC::PropertyMap::rehash): No need to rehash the PropertyNameArray
1633 now that it is completely out of band.
1634 * kjs/PropertyMap.h:
1635 (JSC::PropertyMapEntry::PropertyMapEntry): Store offset into PropertyNameArray.
1636 (JSC::PropertyMap::get): Switch to using the stored offset, instead
1637 of the implicit one.
1638 * kjs/StructureID.cpp:
1639 (JSC::StructureID::StructureID): Initialize the propertyStorageCapacity to
1640 JSObject::inlineStorageCapacity.
1641 (JSC::StructureID::growPropertyStorageCapacity): Grow the storage capacity as
1643 (JSC::StructureID::addPropertyTransition): Copy the storage capacity.
1644 (JSC::StructureID::toDictionaryTransition): Ditto.
1645 (JSC::StructureID::changePrototypeTransition): Ditto.
1646 (JSC::StructureID::getterSetterTransition): Ditto.
1647 * kjs/StructureID.h:
1648 (JSC::StructureID::propertyStorageCapacity): Add propertyStorageCapacity
1649 which is the current capacity for the JSObjects PropertyStorageArray.
1650 It starts at the JSObject::inlineStorageCapacity (currently 2), then
1651 when it first needs to be resized moves to the JSObject::nonInlineBaseStorageCapacity
1652 (currently 16), and after that doubles each time.
1654 2008-10-06 Cameron Zwarich <zwarich@apple.com>
1656 Reviewed by Oliver Hunt.
1658 Bug 21396: Remove the OptionalCalleeActivation call frame slot
1659 <https://bugs.webkit.org/show_bug.cgi?id=21396>
1661 Remove the OptionalCalleeActivation call frame slot. We have to be
1662 careful to store the activation object in a register, because objects
1663 in the scope chain do not get marked.
1665 This is a 0.3% speedup on both SunSpider and the V8 benchmark.
1668 (JSC::CTI::privateCompileMainPass):
1670 (JSC::CodeBlock::dump):
1671 * VM/CodeGenerator.cpp:
1672 (JSC::CodeGenerator::CodeGenerator):
1673 (JSC::CodeGenerator::emitReturn):
1674 * VM/CodeGenerator.h:
1676 (JSC::Machine::dumpRegisters):
1677 (JSC::Machine::unwindCallFrame):
1678 (JSC::Machine::privateExecute):
1679 (JSC::Machine::cti_op_call_JSFunction):
1680 (JSC::Machine::cti_op_push_activation):
1681 (JSC::Machine::cti_op_tear_off_activation):
1682 (JSC::Machine::cti_op_construct_JSConstruct):
1684 (JSC::Machine::initializeCallFrame):
1685 * VM/RegisterFile.h:
1686 (JSC::RegisterFile::):
1688 2008-10-06 Tony Chang <tony@chromium.org>
1690 Reviewed by Alexey Proskuryakov.
1692 Chromium doesn't use pthreads on windows, so make its use conditional.
1694 Also convert a WORD to a DWORD to avoid a compiler warning. This
1695 matches the other methods around it.
1697 * wtf/ThreadingWin.cpp:
1698 (WTF::wtfThreadEntryPoint):
1699 (WTF::ThreadCondition::broadcast):
1701 2008-10-06 Mark Mentovai <mark@moxienet.com>
1703 Reviewed by Tim Hatcher.
1705 Allow ENABLE_DASHBOARD_SUPPORT and ENABLE_MAC_JAVA_BRIDGE to be
1706 disabled on the Mac.
1708 https://bugs.webkit.org/show_bug.cgi?id=21333
1712 2008-10-06 Steve Falkenburg <sfalken@apple.com>
1714 https://bugs.webkit.org/show_bug.cgi?id=21416
1715 Pass 0 for size to VirtualAlloc, as documented by MSDN.
1716 Identified by Application Verifier.
1718 Reviewed by Darin Adler.
1720 * kjs/collector.cpp:
1723 2008-10-06 Kevin McCullough <kmccullough@apple.com>
1725 Reviewed by Tim Hatcheri and Oliver Hunt.
1727 https://bugs.webkit.org/show_bug.cgi?id=21412
1728 Bug 21412: Refactor user initiated profile count to be more stable
1729 - Export UString::from for use with creating the profile title.
1731 * JavaScriptCore.exp:
1733 2008-10-06 Maciej Stachowiak <mjs@apple.com>
1735 Not reviewed. Build fix.
1737 - revert toBoolean changes (r37333 and r37335); need to make WebCore work with these
1739 * API/JSValueRef.cpp:
1742 * JavaScriptCore.exp:
1744 (JSC::CodeBlock::dump):
1746 (JSC::Machine::privateExecute):
1747 (JSC::Machine::cti_op_loop_if_true):
1748 (JSC::Machine::cti_op_not):
1749 (JSC::Machine::cti_op_jtrue):
1750 * kjs/ArrayPrototype.cpp:
1751 (JSC::arrayProtoFuncFilter):
1752 (JSC::arrayProtoFuncEvery):
1753 (JSC::arrayProtoFuncSome):
1754 * kjs/BooleanConstructor.cpp:
1755 (JSC::constructBoolean):
1756 (JSC::callBooleanConstructor):
1757 * kjs/GetterSetter.h:
1759 (JSC::JSValue::toBoolean):
1760 * kjs/JSNumberCell.cpp:
1761 (JSC::JSNumberCell::toBoolean):
1762 * kjs/JSNumberCell.h:
1764 (JSC::JSObject::toBoolean):
1767 (JSC::JSString::toBoolean):
1770 * kjs/RegExpConstructor.cpp:
1771 (JSC::setRegExpConstructorMultiline):
1772 * kjs/RegExpObject.cpp:
1773 (JSC::RegExpObject::match):
1774 * kjs/RegExpPrototype.cpp:
1775 (JSC::regExpProtoFuncToString):
1777 2008-10-06 Maciej Stachowiak <mjs@apple.com>
1779 Reviewed by Sam Weinig.
1781 - optimize op_jtrue, op_loop_if_true and op_not in various ways
1782 https://bugs.webkit.org/show_bug.cgi?id=21404
1784 1) Make JSValue::toBoolean nonvirtual and completely inline by
1785 making use of the StructureID type field.
1787 2) Make JSValue::toBoolean not take an ExecState; doesn't need it.
1789 3) Make op_not, op_loop_if_true and op_jtrue not read the
1790 ExecState (toBoolean doesn't need it any more) and not check
1791 exceptions (toBoolean can't throw).
1793 * API/JSValueRef.cpp:
1795 * JavaScriptCore.exp:
1797 (JSC::CodeBlock::dump):
1799 (JSC::Machine::privateExecute):
1800 (JSC::Machine::cti_op_loop_if_true):
1801 (JSC::Machine::cti_op_not):
1802 (JSC::Machine::cti_op_jtrue):
1803 * kjs/ArrayPrototype.cpp:
1804 (JSC::arrayProtoFuncFilter):
1805 (JSC::arrayProtoFuncEvery):
1806 (JSC::arrayProtoFuncSome):
1807 * kjs/BooleanConstructor.cpp:
1808 (JSC::constructBoolean):
1809 (JSC::callBooleanConstructor):
1810 * kjs/GetterSetter.h:
1812 (JSC::JSValue::toBoolean):
1813 * kjs/JSNumberCell.cpp:
1814 * kjs/JSNumberCell.h:
1815 (JSC::JSNumberCell::toBoolean):
1818 (JSC::JSObject::toBoolean):
1819 (JSC::JSCell::toBoolean):
1822 (JSC::JSString::toBoolean):
1824 * kjs/RegExpConstructor.cpp:
1825 (JSC::setRegExpConstructorMultiline):
1826 * kjs/RegExpObject.cpp:
1827 (JSC::RegExpObject::match):
1828 * kjs/RegExpPrototype.cpp:
1829 (JSC::regExpProtoFuncToString):
1831 2008-10-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
1835 Build fix for MinGW.
1837 * JavaScriptCore.pri:
1839 (JSC::highResUpTime):
1841 2008-10-05 Cameron Zwarich <zwarich@apple.com>
1843 Reviewed by Oliver Hunt.
1845 Remove ScopeNode::containsClosures() now that it is unused.
1848 (JSC::ScopeNode::containsClosures):
1850 2008-10-05 Maciej Stachowiak <mjs@apple.com>
1852 Reviewed by Cameron Zwarich.
1854 - fix releas-only test failures caused by the fix to bug 21375
1857 (JSC::Machine::unwindCallFrame): Update ExecState while unwinding call frames;
1858 it now matters more to have a still-valid ExecState, since dynamicGlobalObject
1859 will make use of the ExecState's scope chain.
1862 2008-10-05 Cameron Zwarich <zwarich@apple.com>
1864 Reviewed by Oliver Hunt.
1866 Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
1867 <https://bugs.webkit.org/show_bug.cgi?id=21364>
1869 Use information from the parser to detect whether an activation is
1870 needed or 'arguments' is used, and emit explicit instructions to tear
1871 them off before op_ret. This allows a branch to be removed from op_ret
1872 and simplifies some other code. This does cause a small change in the
1873 behaviour of 'f.arguments'; it is no longer live when 'arguments' is not
1874 mentioned in the lexical scope of the function.
1876 It should now be easy to remove the OptionaCalleeActivation slot in the
1877 call frame, but this will be done in a later patch.
1880 (JSC::CTI::privateCompileMainPass):
1882 (JSC::CodeBlock::dump):
1883 * VM/CodeGenerator.cpp:
1884 (JSC::CodeGenerator::emitReturn):
1885 * VM/CodeGenerator.h:
1887 (JSC::Machine::unwindCallFrame):
1888 (JSC::Machine::privateExecute):
1889 (JSC::Machine::retrieveArguments):
1890 (JSC::Machine::cti_op_create_arguments):
1891 (JSC::Machine::cti_op_tear_off_activation):
1892 (JSC::Machine::cti_op_tear_off_arguments):
1895 * kjs/Arguments.cpp:
1896 (JSC::Arguments::mark):
1898 (JSC::Arguments::isTornOff):
1899 (JSC::Arguments::Arguments):
1900 (JSC::Arguments::copyRegisters):
1901 (JSC::JSActivation::copyRegisters):
1902 * kjs/JSActivation.cpp:
1903 (JSC::JSActivation::argumentsGetter):
1904 * kjs/JSActivation.h:
1906 2008-10-05 Maciej Stachowiak <mjs@apple.com>
1908 Reviewed by Oliver Hunt.
1910 - fixed "REGRESSION (r37297): fast/js/deep-recursion-test takes too long and times out"
1911 https://bugs.webkit.org/show_bug.cgi?id=21375
1913 The problem is that dynamicGlobalObject had become O(N) in number
1914 of call frames, but unwinding the stack for an exception called it
1915 for every call frame, resulting in O(N^2) behavior for an
1916 exception thrown from inside deep recursion.
1918 Instead of doing it that way, stash the dynamic global object in JSGlobalData.
1920 * JavaScriptCore.exp:
1922 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Helper class to temporarily
1923 store and later restore a dynamicGlobalObject in JSGlobalData.
1924 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
1925 (JSC::Machine::execute): In each version, establish a DynamicGlobalObjectScope.
1926 For ProgramNode, always establish set new dynamicGlobalObject, for FunctionBody and Eval,
1927 only if none is currently set.
1930 * kjs/JSGlobalData.cpp:
1931 (JSC::JSGlobalData::JSGlobalData): Ininitalize new dynamicGlobalObject field to 0.
1932 * kjs/JSGlobalData.h:
1933 * kjs/JSGlobalObject.h:
1934 (JSC::ExecState::dynamicGlobalObject): Moved here from ExecState for benefit of inlining.
1935 Return lexical global object if this is a globalExec(), otherwise look in JSGlobalData
1936 for the one stashed there.
1938 2008-10-05 Sam Weinig <sam@webkit.org>
1940 Reviewed by Maciej Stachowiak.
1942 Avoid an extra lookup when transitioning to an existing StructureID
1943 by caching the offset of property that caused the transition.
1945 1% win on V8 suite. Wash on SunSpider.
1947 * kjs/PropertyMap.cpp:
1948 (JSC::PropertyMap::put):
1949 * kjs/PropertyMap.h:
1950 * kjs/StructureID.cpp:
1951 (JSC::StructureID::StructureID):
1952 (JSC::StructureID::addPropertyTransition):
1953 * kjs/StructureID.h:
1954 (JSC::StructureID::setCachedTransistionOffset):
1955 (JSC::StructureID::cachedTransistionOffset):
1957 2008-10-05 Cameron Zwarich <zwarich@apple.com>
1959 Reviewed by Maciej Stachowiak.
1961 Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
1962 <https://bugs.webkit.org/show_bug.cgi?id=21364>
1964 This patch does not yet remove the branch, but it does a bit of refactoring
1965 so that a CodeGenerator now knows whether the associated CodeBlock will need
1966 a full scope before doing any code generation. This makes it possible to emit
1967 explicit tear-off instructions before every op_ret.
1970 (JSC::CodeBlock::CodeBlock):
1971 * VM/CodeGenerator.cpp:
1972 (JSC::CodeGenerator::generate):
1973 (JSC::CodeGenerator::CodeGenerator):
1974 (JSC::CodeGenerator::emitPushScope):
1975 (JSC::CodeGenerator::emitPushNewScope):
1977 (JSC::ScopeNode::needsActivation):
1979 2008-10-05 Gavin Barraclough <barraclough@apple.com>
1981 Reviewed by Cameron Zwarich.
1983 Fix for bug #21387 - using SamplingTool with CTI.
1985 (1) A repatch offset offset changes due to an additional instruction to update SamplingTool state.
1986 (2) Fix an incusion order problem due to ExecState changes.
1987 (3) Change to a MACHINE_SAMPLING macro, use of exec should now be accessing global data.
1990 (JSC::CTI::execute):
1991 * VM/SamplingTool.h:
1992 (JSC::SamplingTool::privateExecuteReturned):
1995 2008-10-04 Mark Rowe <mrowe@apple.com>
1997 Reviewed by Tim Hatcher.
1999 Add a 'Check For Weak VTables' build phase to catch weak vtables as early as possible.
2001 * JavaScriptCore.xcodeproj/project.pbxproj:
2003 2008-10-04 Sam Weinig <sam@webkit.org>
2005 Reviewed by Oliver Hunt.
2007 Fix https://bugs.webkit.org/show_bug.cgi?id=21320
2008 leaks of PropertyNameArrayData seen on buildbot
2010 - Fix RefPtr cycle by making PropertyNameArrayData's pointer back
2011 to the StructureID a weak pointer.
2013 * kjs/PropertyNameArray.h:
2014 (JSC::PropertyNameArrayData::setCachedStructureID):
2015 (JSC::PropertyNameArrayData::cachedStructureID):
2016 * kjs/StructureID.cpp:
2017 (JSC::StructureID::getEnumerablePropertyNames):
2018 (JSC::StructureID::clearEnumerationCache):
2019 (JSC::StructureID::~StructureID):
2021 2008-10-04 Darin Adler <darin@apple.com>
2023 Reviewed by Cameron Zwarich.
2025 - https://bugs.webkit.org/show_bug.cgi?id=21295
2026 Bug 21295: Replace ExecState with a call frame Register pointer
2028 10% faster on Richards; other v8 benchmarks faster too.
2029 A wash on SunSpider.
2031 This does the minimum necessary to get the speedup. Next step in
2032 cleaning this up is to replace ExecState with a CallFrame class,
2033 and be more judicious about when to pass a call frame and when
2034 to pass a global data pointer, global object pointer, or perhaps
2035 something else entirely.
2037 * VM/CTI.cpp: Remove the debug-only check of the exception in
2038 ctiVMThrowTrampoline -- already checked in the code the trampoline
2039 jumps to, so not all that useful. Removed the exec argument from
2040 ctiTrampoline. Removed emitDebugExceptionCheck -- no longer needed.
2041 (JSC::CTI::emitCall): Removed code to set ExecState::m_callFrame.
2042 (JSC::CTI::privateCompileMainPass): Removed code in catch to extract
2043 the exception from ExecState::m_exception; instead, the code that
2044 jumps into catch will make sure the exception is already in eax.
2045 * VM/CTI.h: Removed exec from the ctiTrampoline. Also removed the
2046 non-helpful "volatile". Temporarily left ARG_exec in as a synonym
2047 for ARG_r; I'll change that on a future cleanup pass when introducing
2048 more use of the CallFrame type.
2049 (JSC::CTI::execute): Removed the ExecState* argument.
2051 * VM/ExceptionHelpers.cpp:
2052 (JSC::InterruptedExecutionError::InterruptedExecutionError): Take
2053 JSGlobalData* instead of ExecState*.
2054 (JSC::createInterruptedExecutionException): Ditto.
2055 * VM/ExceptionHelpers.h: Ditto. Also removed an unneeded include.
2058 (JSC::slideRegisterWindowForCall): Removed the exec and
2059 exceptionValue arguments. Changed to return 0 when there's a stack
2060 overflow rather than using a separate exception argument to cut
2061 down on memory accesses in the calling convention.
2062 (JSC::Machine::unwindCallFrame): Removed the exec argument when
2063 constructing a DebuggerCallFrame. Also removed code to set
2064 ExecState::m_callFrame.
2065 (JSC::Machine::throwException): Removed the exec argument when
2066 construction a DebuggerCallFrame.
2067 (JSC::Machine::execute): Updated to use the register instead of
2068 ExecState and also removed various uses of ExecState.
2069 (JSC::Machine::debug):
2070 (JSC::Machine::privateExecute): Put globalData into a local
2071 variable so it can be used throughout the interpreter. Changed
2072 the VM_CHECK_EXCEPTION to get the exception in globalData instead
2073 of through ExecState.
2074 (JSC::Machine::retrieveLastCaller): Turn exec into a registers
2075 pointer by calling registers() instead of by getting m_callFrame.
2076 (JSC::Machine::callFrame): Ditto.
2077 Tweaked exception macros. Made new versions for when you know
2078 you have an exception. Get at global exception with ARG_globalData.
2079 Got rid of the need to pass in the return value type.
2080 (JSC::Machine::cti_op_add): Update to use new version of exception
2082 (JSC::Machine::cti_op_pre_inc): Ditto.
2083 (JSC::Machine::cti_timeout_check): Ditto.
2084 (JSC::Machine::cti_op_instanceof): Ditto.
2085 (JSC::Machine::cti_op_new_func): Ditto.
2086 (JSC::Machine::cti_op_call_JSFunction): Optimized by using the
2087 ARG values directly instead of through local variables -- this gets
2088 rid of code that just shuffles things around in the stack frame.
2089 Also get rid of ExecState and update for the new way exceptions are
2090 handled in slideRegisterWindowForCall.
2091 (JSC::Machine::cti_vm_compile): Update to make exec out of r since
2092 they are both the same thing now.
2093 (JSC::Machine::cti_op_call_NotJSFunction): Ditto.
2094 (JSC::Machine::cti_op_init_arguments): Ditto.
2095 (JSC::Machine::cti_op_resolve): Ditto.
2096 (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
2097 (JSC::Machine::cti_op_construct_NotJSConstruct): Ditto.
2098 (JSC::Machine::cti_op_resolve_func): Ditto.
2099 (JSC::Machine::cti_op_put_by_val): Ditto.
2100 (JSC::Machine::cti_op_put_by_val_array): Ditto.
2101 (JSC::Machine::cti_op_resolve_skip): Ditto.
2102 (JSC::Machine::cti_op_resolve_global): Ditto.
2103 (JSC::Machine::cti_op_post_inc): Ditto.
2104 (JSC::Machine::cti_op_resolve_with_base): Ditto.
2105 (JSC::Machine::cti_op_post_dec): Ditto.
2106 (JSC::Machine::cti_op_call_eval): Ditto.
2107 (JSC::Machine::cti_op_throw): Ditto. Also rearranged to return
2108 the exception value as the return value so it can be used by
2110 (JSC::Machine::cti_op_push_scope): Ditto.
2111 (JSC::Machine::cti_op_in): Ditto.
2112 (JSC::Machine::cti_op_del_by_val): Ditto.
2113 (JSC::Machine::cti_vm_throw): Ditto. Also rearranged to return
2114 the exception value as the return value so it can be used by
2117 * kjs/DebuggerCallFrame.cpp:
2118 (JSC::DebuggerCallFrame::functionName): Pass globalData.
2119 (JSC::DebuggerCallFrame::evaluate): Eliminated code to make a
2121 * kjs/DebuggerCallFrame.h: Removed ExecState argument from
2124 * kjs/ExecState.h: Eliminated all data members and made ExecState
2125 inherit privately from Register instead. Also added a typedef to
2126 the future name for this class, which is CallFrame. It's just a
2127 Register* that knows it's a pointer at a call frame. The new class
2128 can't be constructed or copied. Changed all functions to use
2129 the this pointer instead of m_callFrame. Changed exception-related
2130 functions to access an exception in JSGlobalData. Removed functions
2131 used by CTI to pass the return address to the throw machinery --
2132 this is now done directly with a global in the global data.
2134 * kjs/FunctionPrototype.cpp:
2135 (JSC::functionProtoFuncToString): Pass globalData instead of exec.
2137 * kjs/InternalFunction.cpp:
2138 (JSC::InternalFunction::name): Take globalData instead of exec.
2139 * kjs/InternalFunction.h: Ditto.
2141 * kjs/JSGlobalData.cpp: Initialize the new exception global to 0.
2142 * kjs/JSGlobalData.h: Declare two new globals. One for the current
2143 exception and another for the return address used by CTI to
2144 implement the throw operation.
2146 * kjs/JSGlobalObject.cpp:
2147 (JSC::JSGlobalObject::init): Removed code to set up globalExec,
2148 which is now the same thing as globalCallFrame.
2149 (JSC::JSGlobalObject::reset): Get globalExec from our globalExec
2150 function so we don't have to repeat the logic twice.
2151 (JSC::JSGlobalObject::mark): Removed code to mark the exception;
2152 the exception is now stored in JSGlobalData and marked there.
2153 (JSC::JSGlobalObject::globalExec): Return a pointer to the end
2154 of the global call frame.
2155 * kjs/JSGlobalObject.h: Removed the globalExec data member.
2158 (JSC::JSObject::putDirectFunction): Pass globalData instead of exec.
2160 * kjs/collector.cpp:
2161 (JSC::Heap::collect): Mark the global exception.
2163 * profiler/ProfileGenerator.cpp:
2164 (JSC::ProfileGenerator::addParentForConsoleStart): Pass globalData
2165 instead of exec to createCallIdentifier.
2167 * profiler/Profiler.cpp:
2168 (JSC::Profiler::willExecute): Pass globalData instead of exec to
2169 createCallIdentifier.
2170 (JSC::Profiler::didExecute): Ditto.
2171 (JSC::Profiler::createCallIdentifier): Take globalData instead of
2173 (JSC::createCallIdentifierFromFunctionImp): Ditto.
2174 * profiler/Profiler.h: Change interface to take a JSGlobalData
2175 instead of an ExecState.
2177 2008-10-04 Cameron Zwarich <zwarich@apple.com>
2179 Reviewed by Darin Adler.
2181 Bug 21369: Add opcode documentation for all undocumented opcodes
2182 <https://bugs.webkit.org/show_bug.cgi?id=21369>
2184 This patch adds opcode documentation for all undocumented opcodes, and
2185 it also renames op_init_arguments to op_create_arguments.
2188 (JSC::CTI::privateCompileMainPass):
2190 (JSC::CodeBlock::dump):
2191 * VM/CodeGenerator.cpp:
2192 (JSC::CodeGenerator::CodeGenerator):
2194 (JSC::Machine::privateExecute):
2195 (JSC::Machine::cti_op_create_arguments):
2199 2008-10-03 Maciej Stachowiak <mjs@apple.com>
2201 Reviewed by Cameron Zwarich.
2203 - "this" object in methods called on primitives should be wrapper object
2204 https://bugs.webkit.org/show_bug.cgi?id=21362
2206 I changed things so that functions which use "this" do a fast
2207 version of toThisObject conversion if needed. Currently we miss
2208 the conversion entirely, at least for primitive types. Using
2209 TypeInfo and the primitive check, I made the fast case bail out
2212 This is inexplicably an 1.007x SunSpider speedup (and a wash on V8 benchmarks).
2214 Also renamed some opcodes for clarity:
2217 init_activation ==> enter_with_activation
2220 (JSC::CTI::privateCompileMainPass):
2221 (JSC::CTI::privateCompileSlowCases):
2223 (JSC::CodeBlock::dump):
2224 * VM/CodeGenerator.cpp:
2225 (JSC::CodeGenerator::generate):
2226 (JSC::CodeGenerator::CodeGenerator):
2228 (JSC::Machine::privateExecute):
2229 (JSC::Machine::cti_op_convert_this):
2232 * kjs/JSActivation.cpp:
2233 (JSC::JSActivation::JSActivation):
2234 * kjs/JSActivation.h:
2235 (JSC::JSActivation::createStructureID):
2237 (JSC::JSValue::needsThisConversion):
2238 * kjs/JSGlobalData.cpp:
2239 (JSC::JSGlobalData::JSGlobalData):
2240 * kjs/JSGlobalData.h:
2241 * kjs/JSNumberCell.h:
2242 (JSC::JSNumberCell::createStructureID):
2243 * kjs/JSStaticScopeObject.h:
2244 (JSC::JSStaticScopeObject::JSStaticScopeObject):
2245 (JSC::JSStaticScopeObject::createStructureID):
2247 (JSC::JSString::createStructureID):
2250 (JSC::TypeInfo::needsThisConversion):
2252 (JSC::ScopeNode::usesThis):
2254 2008-10-03 Cameron Zwarich <zwarich@apple.com>
2256 Reviewed by Maciej Stachowiak.
2258 Bug 21356: The size of the RegisterFile differs depending on 32-bit / 64-bit and Debug / Release
2259 <https://bugs.webkit.org/show_bug.cgi?id=21356>
2261 The RegisterFile decreases in size (measured in terms of numbers of
2262 Registers) as the size of a Register increases. This causes
2264 js1_5/Regress/regress-159334.js
2266 to fail in 64-bit debug builds. This fix makes the RegisterFile on all
2267 platforms the same size that it is in 32-bit Release builds.
2269 * VM/RegisterFile.h:
2270 (JSC::RegisterFile::RegisterFile):
2272 2008-10-03 Maciej Stachowiak <mjs@apple.com>
2274 Reviewed by Cameron Zwarich.
2276 - Some code cleanup to how we handle code features.
2278 1) Rename FeatureInfo typedef to CodeFeatures.
2279 2) Rename NodeFeatureInfo template to NodeInfo.
2280 3) Keep CodeFeature bitmask in ScopeNode instead of trying to break it out into individual bools.
2281 4) Rename misleadingly named "needsClosure" method to "containsClosures", which better describes the meaning
2283 5) Make setUsersArguments() not take an argument since it only goes one way.
2285 * JavaScriptCore.exp:
2287 (JSC::CodeBlock::CodeBlock):
2290 (JSC::Parser::didFinishParsing):
2292 (JSC::Parser::parse):
2295 (JSC::ScopeNode::ScopeNode):
2296 (JSC::ProgramNode::ProgramNode):
2297 (JSC::ProgramNode::create):
2298 (JSC::EvalNode::EvalNode):
2299 (JSC::EvalNode::create):
2300 (JSC::FunctionBodyNode::FunctionBodyNode):
2301 (JSC::FunctionBodyNode::create):
2303 (JSC::ScopeNode::usesEval):
2304 (JSC::ScopeNode::containsClosures):
2305 (JSC::ScopeNode::usesArguments):
2306 (JSC::ScopeNode::setUsesArguments):
2308 2008-10-03 Cameron Zwarich <zwarich@apple.com>
2310 Reviewed by Maciej Stachowiak.
2312 Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
2313 <https://bugs.webkit.org/show_bug.cgi?id=21343>
2315 A fix was landed for this issue in r37253, and the ChangeLog assumes
2316 that it is a compiler bug, but it turns out that it is a subtle issue
2317 with mixing signed and unsigned 32-bit values in a 64-bit environment.
2318 In order to properly fix this bug, we should convert our signed offsets
2319 into the register file to use ptrdiff_t.
2321 This may not be the only instance of this issue, but I will land this
2322 fix first and look for more later.
2325 (JSC::Machine::getArgumentsData):
2327 * kjs/Arguments.cpp:
2328 (JSC::Arguments::getOwnPropertySlot):
2330 (JSC::Arguments::init):
2332 2008-10-03 Darin Adler <darin@apple.com>
2334 * VM/CTI.cpp: Another Windows build fix. Change the args of ctiTrampoline.
2336 * kjs/JSNumberCell.h: A build fix for newer versions of gcc. Added
2337 declarations of JSGlobalData overloads of jsNumberCell.
2339 2008-10-03 Darin Adler <darin@apple.com>
2341 - try to fix Windows build
2343 * kjs/ScopeChain.h: Add forward declaration of JSGlobalData.
2345 2008-10-03 Darin Adler <darin@apple.com>
2347 Reviewed by Geoff Garen.
2349 - next step of https://bugs.webkit.org/show_bug.cgi?id=21295
2350 Turn ExecState into a call frame pointer.
2352 Remove m_globalObject and m_globalData from ExecState.
2354 SunSpider says this is a wash (slightly faster but not statistically
2355 significant); which is good enough since it's a preparation step and
2356 not supposed to be a spedup.
2358 * API/JSCallbackFunction.cpp:
2359 (JSC::JSCallbackFunction::JSCallbackFunction):
2360 * kjs/ArrayConstructor.cpp:
2361 (JSC::ArrayConstructor::ArrayConstructor):
2362 * kjs/BooleanConstructor.cpp:
2363 (JSC::BooleanConstructor::BooleanConstructor):
2364 * kjs/DateConstructor.cpp:
2365 (JSC::DateConstructor::DateConstructor):
2366 * kjs/ErrorConstructor.cpp:
2367 (JSC::ErrorConstructor::ErrorConstructor):
2368 * kjs/FunctionPrototype.cpp:
2369 (JSC::FunctionPrototype::FunctionPrototype):
2370 * kjs/JSFunction.cpp:
2371 (JSC::JSFunction::JSFunction):
2372 * kjs/NativeErrorConstructor.cpp:
2373 (JSC::NativeErrorConstructor::NativeErrorConstructor):
2374 * kjs/NumberConstructor.cpp:
2375 (JSC::NumberConstructor::NumberConstructor):
2376 * kjs/ObjectConstructor.cpp:
2377 (JSC::ObjectConstructor::ObjectConstructor):
2378 * kjs/PrototypeFunction.cpp:
2379 (JSC::PrototypeFunction::PrototypeFunction):
2380 * kjs/RegExpConstructor.cpp:
2381 (JSC::RegExpConstructor::RegExpConstructor):
2382 * kjs/StringConstructor.cpp:
2383 (JSC::StringConstructor::StringConstructor):
2384 Pass JSGlobalData* instead of ExecState* to the InternalFunction
2387 * API/OpaqueJSString.cpp: Added now-needed include.
2389 * JavaScriptCore.exp: Updated.
2392 (JSC::CTI::emitSlowScriptCheck): Changed to use ARGS_globalData
2393 instead of ARGS_exec.
2395 * VM/CTI.h: Added a new argument to the CTI, the global data pointer.
2396 While it's possible to get to the global data pointer using the
2397 ExecState pointer, it's slow enough that it's better to just keep
2398 it around in the CTI arguments.
2400 * VM/CodeBlock.h: Moved the CodeType enum here from ExecState.h.
2403 (JSC::Machine::execute): Pass fewer arguments when constructing
2404 ExecState, and pass the global data pointer when invoking CTI.
2405 (JSC::Machine::firstCallFrame): Added. Used to get the dynamic global
2406 object, which is in the scope chain of the first call frame.
2407 (JSC::Machine::cti_op_add): Use globalData instead of exec when
2408 possible, to keep fast cases fast, since it's now more expensive to
2409 get to it through the exec pointer.
2410 (JSC::Machine::cti_timeout_check): Ditto.
2411 (JSC::Machine::cti_op_put_by_id_second): Ditto.
2412 (JSC::Machine::cti_op_get_by_id_second): Ditto.
2413 (JSC::Machine::cti_op_mul): Ditto.
2414 (JSC::Machine::cti_vm_compile): Ditto.
2415 (JSC::Machine::cti_op_get_by_val): Ditto.
2416 (JSC::Machine::cti_op_sub): Ditto.
2417 (JSC::Machine::cti_op_put_by_val): Ditto.
2418 (JSC::Machine::cti_op_put_by_val_array): Ditto.
2419 (JSC::Machine::cti_op_negate): Ditto.
2420 (JSC::Machine::cti_op_div): Ditto.
2421 (JSC::Machine::cti_op_pre_dec): Ditto.
2422 (JSC::Machine::cti_op_post_inc): Ditto.
2423 (JSC::Machine::cti_op_lshift): Ditto.
2424 (JSC::Machine::cti_op_bitand): Ditto.
2425 (JSC::Machine::cti_op_rshift): Ditto.
2426 (JSC::Machine::cti_op_bitnot): Ditto.
2427 (JSC::Machine::cti_op_mod): Ditto.
2428 (JSC::Machine::cti_op_post_dec): Ditto.
2429 (JSC::Machine::cti_op_urshift): Ditto.
2430 (JSC::Machine::cti_op_bitxor): Ditto.
2431 (JSC::Machine::cti_op_bitor): Ditto.
2432 (JSC::Machine::cti_op_call_eval): Ditto.
2433 (JSC::Machine::cti_op_throw): Ditto.
2434 (JSC::Machine::cti_op_is_string): Ditto.
2435 (JSC::Machine::cti_op_debug): Ditto.
2436 (JSC::Machine::cti_vm_throw): Ditto.
2438 * VM/Machine.h: Added firstCallFrame.
2440 * kjs/DebuggerCallFrame.cpp:
2441 (JSC::DebuggerCallFrame::evaluate): Pass fewer arguments when
2442 constructing ExecState.
2444 * kjs/ExecState.cpp: Deleted contents. Later we'll remove the
2447 * kjs/ExecState.h: Removed m_globalObject and m_globalData.
2448 Moved CodeType into another header.
2449 (JSC::ExecState::ExecState): Take only a single argument, a
2451 (JSC::ExecState::dynamicGlobalObject): Get the object from
2452 the first call frame since it's no longer stored.
2453 (JSC::ExecState::globalData): Get the global data from the
2454 scope chain, since we no longer store a pointer to it here.
2455 (JSC::ExecState::identifierTable): Ditto.
2456 (JSC::ExecState::propertyNames): Ditto.
2457 (JSC::ExecState::emptyList): Ditto.
2458 (JSC::ExecState::lexer): Ditto.
2459 (JSC::ExecState::parser): Ditto.
2460 (JSC::ExecState::machine): Ditto.
2461 (JSC::ExecState::arrayTable): Ditto.
2462 (JSC::ExecState::dateTable): Ditto.
2463 (JSC::ExecState::mathTable): Ditto.
2464 (JSC::ExecState::numberTable): Ditto.
2465 (JSC::ExecState::regExpTable): Ditto.
2466 (JSC::ExecState::regExpConstructorTable): Ditto.
2467 (JSC::ExecState::stringTable): Ditto.
2468 (JSC::ExecState::heap): Ditto.
2470 * kjs/FunctionConstructor.cpp:
2471 (JSC::FunctionConstructor::FunctionConstructor): Pass
2472 JSGlobalData* instead of ExecState* to the InternalFunction
2474 (JSC::constructFunction): Pass the global data pointer when
2475 constructing a new scope chain.
2477 * kjs/InternalFunction.cpp:
2478 (JSC::InternalFunction::InternalFunction): Take a JSGlobalData*
2479 instead of an ExecState*. Later we can change more places to
2480 work this way -- it's more efficient to take the type you need
2481 since the caller might already have it.
2482 * kjs/InternalFunction.h: Ditto.
2485 (JSC::JSCell::operator new): Added an overload that takes a
2486 JSGlobalData* so you can construct without an ExecState*.
2488 * kjs/JSGlobalObject.cpp:
2489 (JSC::JSGlobalObject::init): Moved creation of the global scope
2490 chain in here, since it now requires a pointer to the global data.
2491 Moved the initialization of the call frame in here since it requires
2492 the global scope chain node. Removed the extra argument to ExecState
2493 when creating the global ExecState*.
2494 * kjs/JSGlobalObject.h: Removed initialization of globalScopeChain
2495 and the call frame from the JSGlobalObjectData constructor. Added
2496 a thisValue argument to the init function.
2498 * kjs/JSNumberCell.cpp: Added versions of jsNumberCell that take
2499 JSGlobalData* rather than ExecState*.
2500 * kjs/JSNumberCell.h:
2501 (JSC::JSNumberCell::operator new): Added a version that takes
2503 (JSC::JSNumberCell::JSNumberCell): Ditto.
2504 (JSC::jsNumber): Ditto.
2506 (JSC::jsString): Ditto.
2507 (JSC::jsSubstring): Ditto.
2508 (JSC::jsOwnedString): Ditto.
2510 (JSC::JSString::JSString): Changed to take JSGlobalData*.
2511 (JSC::jsEmptyString): Added a version that takes JSGlobalData*.
2512 (JSC::jsSingleCharacterString): Ditto.
2513 (JSC::jsSingleCharacterSubstring): Ditto.
2514 (JSC::jsNontrivialString): Ditto.
2515 (JSC::JSString::getIndex): Ditto.
2516 (JSC::jsString): Ditto.
2517 (JSC::jsSubstring): Ditto.
2518 (JSC::jsOwnedString): Ditto.
2520 * kjs/ScopeChain.h: Added a globalData pointer to each node.
2521 (JSC::ScopeChainNode::ScopeChainNode): Initialize the globalData
2523 (JSC::ScopeChainNode::push): Set the global data pointer in the
2525 (JSC::ScopeChain::ScopeChain): Take a globalData argument.
2527 * kjs/SmallStrings.cpp:
2528 (JSC::SmallStrings::createEmptyString): Take JSGlobalData* instead of
2530 (JSC::SmallStrings::createSingleCharacterString): Ditto.
2531 * kjs/SmallStrings.h:
2532 (JSC::SmallStrings::emptyString): Ditto.
2533 (JSC::SmallStrings::singleCharacterString): Ditto.
2535 2008-10-03 Cameron Zwarich <zwarich@apple.com>
2537 Reviewed by Geoff Garen.
2539 Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
2540 <https://bugs.webkit.org/show_bug.cgi?id=21343>
2542 Add a workaround for a bug in GCC, which affects GCC 4.0, GCC 4.2, and
2543 llvm-gcc 4.2. I put it in an #ifdef because it was a slight regression
2544 on SunSpider in 32-bit, although that might be entirely random.
2546 * kjs/Arguments.cpp:
2547 (JSC::Arguments::getOwnPropertySlot):
2549 2008-10-03 Darin Adler <darin@apple.com>
2551 Rubber stamped by Alexey Proskuryakov.
2553 * kjs/Shell.cpp: (main): Don't delete JSGlobalData. Later, we need to change
2554 this tool to use public JavaScriptCore API instead.
2556 2008-10-03 Darin Adler <darin@apple.com>
2558 Suggested by Alexey Proskuryakov.
2560 * kjs/JSGlobalData.cpp:
2561 (JSC::JSGlobalData::~JSGlobalData): Remove call to heap.destroy() because
2562 it's too late to ref the JSGlobalData object once it's already being
2563 destroyed. In practice this is not a problem because WebCore's JSGlobalData
2564 is never destroyed and JSGlobalContextRelease takes care of calling
2565 heap.destroy() in advance.
2567 2008-10-02 Oliver Hunt <oliver@apple.com>
2569 Reviewed by Maciej Stachowiak.
2571 Replace SSE3 check with an SSE2 check, and implement SSE2 check on windows.
2573 5.6% win on SunSpider on windows.
2576 (JSC::isSSE2Present):
2577 (JSC::CTI::compileBinaryArithOp):
2578 (JSC::CTI::compileBinaryArithOpSlowCase):
2580 2008-10-03 Maciej Stachowiak <mjs@apple.com>
2582 Rubber stamped by Cameron Zwarich.
2584 - fix mistaken change of | to || which caused a big perf regression on EarleyBoyer
2588 2008-10-02 Darin Adler <darin@apple.com>
2590 Reviewed by Geoff Garen.
2592 - https://bugs.webkit.org/show_bug.cgi?id=21321
2593 Bug 21321: speed up JavaScriptCore by inlining Heap in JSGlobalData
2595 1.019x as fast on SunSpider.
2598 (JSEvaluateScript): Use heap. instead of heap-> to work with the heap.
2599 (JSCheckScriptSyntax): Ditto.
2600 (JSGarbageCollect): Ditto.
2601 (JSReportExtraMemoryCost): Ditto.
2602 * API/JSContextRef.cpp:
2603 (JSGlobalContextRetain): Ditto.
2604 (JSGlobalContextRelease): Destroy the heap with the destroy function instead
2605 of the delete operator.
2606 (JSContextGetGlobalObject): Use heap. instead of heap-> to work with the heap.
2607 * API/JSObjectRef.cpp:
2608 (JSObjectMake): Use heap. instead of heap-> to work with the heap.
2609 (JSObjectMakeFunctionWithCallback): Ditto.
2610 (JSObjectMakeConstructor): Ditto.
2611 (JSObjectMakeFunction): Ditto.
2612 (JSObjectMakeArray): Ditto.
2613 (JSObjectMakeDate): Ditto.
2614 (JSObjectMakeError): Ditto.
2615 (JSObjectMakeRegExp): Ditto.
2616 (JSObjectHasProperty): Ditto.
2617 (JSObjectGetProperty): Ditto.
2618 (JSObjectSetProperty): Ditto.
2619 (JSObjectGetPropertyAtIndex): Ditto.
2620 (JSObjectSetPropertyAtIndex): Ditto.
2621 (JSObjectDeleteProperty): Ditto.
2622 (JSObjectCallAsFunction): Ditto.
2623 (JSObjectCallAsConstructor): Ditto.
2624 (JSObjectCopyPropertyNames): Ditto.
2625 (JSPropertyNameAccumulatorAddName): Ditto.
2626 * API/JSValueRef.cpp:
2627 (JSValueIsEqual): Ditto.
2628 (JSValueIsInstanceOfConstructor): Ditto.
2629 (JSValueMakeNumber): Ditto.
2630 (JSValueMakeString): Ditto.
2631 (JSValueToNumber): Ditto.
2632 (JSValueToStringCopy): Ditto.
2633 (JSValueToObject): Ditto.
2634 (JSValueProtect): Ditto.
2635 (JSValueUnprotect): Ditto.
2638 (JSC::ExecState::heap): Update to use the & operator.
2640 * kjs/JSGlobalData.cpp:
2641 (JSC::JSGlobalData::JSGlobalData): Update to initialize a heap member
2642 instead of calling new to make a heap.
2643 (JSC::JSGlobalData::~JSGlobalData): Destroy the heap with the destroy
2644 function instead of the delete operator.
2645 * kjs/JSGlobalData.h: Change from Heap* to a Heap.
2646 * kjs/JSGlobalObject.cpp:
2647 (JSC::JSGlobalObject::mark): Use the & operator here.
2648 (JSC::JSGlobalObject::operator new): Use heap. instead of heap-> to work
2651 2008-10-02 Cameron Zwarich <zwarich@apple.com>
2653 Reviewed by Geoff Garen.
2655 Bug 21317: Replace RegisterFile size and capacity information with Register pointers
2656 <https://bugs.webkit.org/show_bug.cgi?id=21317>
2658 This is a 2.3% speedup on the V8 DeltaBlue benchmark, a 3.3% speedup on
2659 the V8 Raytrace benchmark, and a 1.0% speedup on SunSpider.
2662 (JSC::slideRegisterWindowForCall):
2663 (JSC::Machine::callEval):
2664 (JSC::Machine::execute):
2665 (JSC::Machine::privateExecute):
2666 (JSC::Machine::cti_op_call_JSFunction):
2667 (JSC::Machine::cti_op_construct_JSConstruct):
2668 * VM/RegisterFile.cpp:
2669 (JSC::RegisterFile::~RegisterFile):
2670 * VM/RegisterFile.h:
2671 (JSC::RegisterFile::RegisterFile):
2672 (JSC::RegisterFile::start):
2673 (JSC::RegisterFile::end):
2674 (JSC::RegisterFile::size):
2675 (JSC::RegisterFile::shrink):
2676 (JSC::RegisterFile::grow):
2677 (JSC::RegisterFile::lastGlobal):
2678 (JSC::RegisterFile::markGlobals):
2679 (JSC::RegisterFile::markCallFrames):
2680 * kjs/JSGlobalObject.cpp:
2681 (JSC::JSGlobalObject::copyGlobalsTo):
2683 2008-10-02 Cameron Zwarich <zwarich@apple.com>
2685 Rubber-stamped by Darin Adler.
2687 Change bitwise operations introduced in r37166 to boolean operations. We
2688 only use bitwise operations over boolean operations for increasing
2689 performance in extremely hot code, but that does not apply to anything
2694 2008-10-02 Gavin Barraclough <barraclough@apple.com>
2696 Reviewed by Darin Adler.
2698 Fix for bug #21232 - should reset m_isPendingDash on flush,
2699 and should allow '\-' as beginning or end of a range (though
2700 not to specifiy a range itself).
2703 * wrec/CharacterClassConstructor.cpp:
2704 (JSC::CharacterClassConstructor::put):
2705 (JSC::CharacterClassConstructor::flush):
2706 * wrec/CharacterClassConstructor.h:
2707 (JSC::CharacterClassConstructor::flushBeforeEscapedHyphen):
2709 (JSC::WRECGenerator::generateDisjunction):
2710 (JSC::WRECParser::parseCharacterClass):
2711 (JSC::WRECParser::parseDisjunction):
2714 2008-10-02 Darin Adler <darin@apple.com>
2716 Reviewed by Sam Weinig.
2718 - remove the "static" from declarations in a header file, since we
2719 don't want them to have internal linkage
2721 * VM/Machine.h: Remove the static keyword from the constant and the
2722 three inline functions that Geoff just moved here.
2724 2008-10-02 Geoffrey Garen <ggaren@apple.com>
2726 Reviewed by Sam Weinig.
2728 Fixed https://bugs.webkit.org/show_bug.cgi?id=21283.
2729 Profiler Crashes When Started
2733 (JSC::makeHostCallFramePointer):
2734 (JSC::isHostCallFrame):
2735 (JSC::stripHostCallFrameBit): Moved some things to the header so
2736 JSGlobalObject could use them.
2738 * kjs/JSGlobalObject.h:
2739 (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Call the
2740 new makeHostCallFramePointer API, since 0 no longer indicates a host
2743 2008-10-02 Alexey Proskuryakov <ap@webkit.org>
2745 Reviewed by Darin Adler.
2747 https://bugs.webkit.org/show_bug.cgi?id=21304
2748 Stop using a static wrapper map for WebCore JS bindings
2750 * kjs/JSGlobalData.cpp:
2751 (JSC::JSGlobalData::JSGlobalData):
2752 (JSC::JSGlobalData::~JSGlobalData):
2753 (JSC::JSGlobalData::ClientData::~ClientData):
2754 * kjs/JSGlobalData.h:
2755 Added a client data member to JSGlobalData. WebCore will use it to store bindings-related
2758 * JavaScriptCore.exp: Export virtual ClientData destructor.
2760 2008-10-02 Geoffrey Garen <ggaren@apple.com>
2764 Try to fix Qt build.
2768 2008-10-01 Geoffrey Garen <ggaren@apple.com>
2770 Reviewed by Darin Adler and Cameron Zwarich.
2772 Preliminary step toward dynamic recompilation: Standardized and
2773 simplified the parsing interface.
2775 The main goal in this patch is to make it easy to ask for a duplicate
2776 compilation, and get back a duplicate result -- same source URL, same
2777 debugger / profiler ID, same toString behavior, etc.
2779 The basic unit of compilation and evaluation is now SourceCode, which
2780 encompasses a SourceProvider, a range in that provider, and a starting
2783 A SourceProvider now encompasses a source URL, and *is* a source ID,
2784 since a pointer is a unique identifier.
2788 (JSCheckScriptSyntax): Provide a SourceCode to the Interpreter, since
2789 other APIs are no longer supported.
2792 (JSC::EvalCodeCache::get): Provide a SourceCode to the Interpreter, since
2793 other APIs are no longer supported.
2794 (JSC::CodeBlock::CodeBlock): ASSERT something that used to be ASSERTed
2795 by our caller -- this is a better bottleneck.
2797 * VM/CodeGenerator.cpp:
2798 (JSC::CodeGenerator::CodeGenerator): Updated for the fact that
2799 FunctionBodyNode's parameters are no longer a WTF::Vector.
2801 * kjs/Arguments.cpp:
2802 (JSC::Arguments::Arguments): ditto
2804 * kjs/DebuggerCallFrame.cpp:
2805 (JSC::DebuggerCallFrame::evaluate): Provide a SourceCode to the Parser,
2806 since other APIs are no longer supported.
2808 * kjs/FunctionConstructor.cpp:
2809 (JSC::constructFunction): Provide a SourceCode to the Parser, since
2810 other APIs are no longer supported. Adopt FunctionBodyNode's new
2811 "finishParsing" API.
2813 * kjs/JSFunction.cpp:
2814 (JSC::JSFunction::lengthGetter):
2815 (JSC::JSFunction::getParameterName): Updated for the fact that
2816 FunctionBodyNode's parameters are no longer a wtf::Vector.
2818 * kjs/JSFunction.h: Nixed some cruft.
2820 * kjs/JSGlobalObjectFunctions.cpp:
2821 (JSC::globalFuncEval): Provide a SourceCode to the Parser, since
2822 other APIs are no longer supported.
2825 (JSC::Parser::parse): Require a SourceCode argument, instead of a bunch
2826 of broken out parameters. Stop tracking sourceId as an integer, since we
2827 use the SourceProvider pointer for this now. Don't clamp the
2828 startingLineNumber, since SourceCode does that now.
2831 (JSC::Parser::parse): Standardized the parsing interface to require a
2837 (prettyPrintScript):
2839 (runInteractive): Provide a SourceCode to the Interpreter, since
2840 other APIs are no longer supported.
2842 * kjs/SourceProvider.h:
2843 (JSC::SourceProvider::SourceProvider):
2844 (JSC::SourceProvider::url):
2845 (JSC::SourceProvider::asId):
2846 (JSC::UStringSourceProvider::create):
2847 (JSC::UStringSourceProvider::UStringSourceProvider): Added new
2848 responsibilities described above.
2850 * kjs/SourceRange.h:
2851 (JSC::SourceCode::SourceCode):
2852 (JSC::SourceCode::toString):
2853 (JSC::SourceCode::provider):
2854 (JSC::SourceCode::firstLine):
2855 (JSC::SourceCode::data):
2856 (JSC::SourceCode::length): Added new responsibilities described above.
2857 Renamed SourceRange to SourceCode, based on review feedback. Added
2858 a makeSource function for convenience.
2860 * kjs/debugger.h: Provide a SourceCode to the client, since other APIs
2861 are no longer supported.
2863 * kjs/grammar.y: Provide startingLineNumber when creating a SourceCode.
2865 * kjs/debugger.h: Treat sourceId as intptr_t to avoid loss of precision
2868 * kjs/interpreter.cpp:
2869 (JSC::Interpreter::checkSyntax):
2870 (JSC::Interpreter::evaluate):
2871 * kjs/interpreter.h: Require a SourceCode instead of broken out arguments.
2874 (JSC::Lexer::setCode):
2876 (JSC::Lexer::sourceRange): Fold together the SourceProvider and line number
2877 into a SourceCode. Fixed a bug where the Lexer would accidentally keep
2878 alive the last SourceProvider forever.
2881 (JSC::ScopeNode::ScopeNode):
2882 (JSC::ProgramNode::ProgramNode):
2883 (JSC::ProgramNode::create):
2884 (JSC::EvalNode::EvalNode):
2885 (JSC::EvalNode::generateCode):
2886 (JSC::EvalNode::create):
2887 (JSC::FunctionBodyNode::FunctionBodyNode):
2888 (JSC::FunctionBodyNode::finishParsing):
2889 (JSC::FunctionBodyNode::create):
2890 (JSC::FunctionBodyNode::generateCode):
2891 (JSC::ProgramNode::generateCode):
2892 (JSC::FunctionBodyNode::paramString):
2895 (JSC::ScopeNode::sourceId):
2896 (JSC::FunctionBodyNode::):
2897 (JSC::FunctionBodyNode::parameterCount):
2898 (JSC::FuncExprNode::):
2899 (JSC::FuncDeclNode::): Store a SourceCode in all ScopeNodes, since
2900 SourceCode is now responsible for tracking URL, ID, etc. Streamlined
2901 some ad hoc FunctionBodyNode fixups into a "finishParsing" function, to
2902 help make clear what you need to do in order to finish parsing a
2906 (WTF::::releaseBuffer): Don't ASSERT that releaseBuffer() is only called
2907 when buffer is not 0, since FunctionBodyNode is more than happy
2908 to get back a 0 buffer, and other functions like RefPtr::release() allow
2911 2008-10-01 Cameron Zwarich <zwarich@apple.com>
2913 Reviewed by Maciej Stachowiak.
2915 Bug 21289: REGRESSION (r37160): Inspector crashes on load
2916 <https://bugs.webkit.org/show_bug.cgi?id=21289>
2918 The code in Arguments::mark() in r37160 was wrong. It marks indices in
2919 d->registers, but that makes no sense (they are local variables, not
2920 arguments). It should mark those indices in d->registerArray instead.
2922 This patch also changes Arguments::copyRegisters() to use d->numParameters
2923 instead of recomputing it.
2925 * kjs/Arguments.cpp:
2926 (JSC::Arguments::mark):
2928 (JSC::Arguments::copyRegisters):
2930 2008-09-30 Darin Adler <darin@apple.com>
2932 Reviewed by Eric Seidel.
2934 - https://bugs.webkit.org/show_bug.cgi?id=21214
2935 work on getting rid of ExecState
2937 Eliminate some unneeded uses of dynamicGlobalObject.
2939 * API/JSClassRef.cpp:
2940 (OpaqueJSClass::contextData): Changed to use a map in the global data instead
2941 of on the global object. Also fixed to use only a single hash table lookup.
2943 * API/JSObjectRef.cpp:
2944 (JSObjectMakeConstructor): Use lexicalGlobalObject rather than dynamicGlobalObject
2945 to get the object prototype.
2947 * kjs/ArrayPrototype.cpp:
2948 (JSC::arrayProtoFuncToString): Use arrayVisitedElements set in global data rather
2949 than in the global object.
2950 (JSC::arrayProtoFuncToLocaleString): Ditto.
2951 (JSC::arrayProtoFuncJoin): Ditto.
2953 * kjs/JSGlobalData.cpp:
2954 (JSC::JSGlobalData::JSGlobalData): Don't initialize opaqueJSClassData, since
2955 it's no longer a pointer.
2956 (JSC::JSGlobalData::~JSGlobalData): We still need to delete all the values, but
2957 we don't need to delete the map since it's no longer a pointer.
2959 * kjs/JSGlobalData.h: Made opaqueJSClassData a map instead of a pointer to a map.
2960 Also added arrayVisitedElements.
2962 * kjs/JSGlobalObject.h: Removed arrayVisitedElements.
2965 (functionRun): Use lexicalGlobalObject instead of dynamicGlobalObject.
2966 (functionLoad): Ditto.
2968 2008-10-01 Cameron Zwarich <zwarich@apple.com>
2972 Speculative Windows build fix.
2976 2008-10-01 Cameron Zwarich <zwarich@apple.com>
2978 Reviewed by Darin Adler.
2980 Bug 21123: using "arguments" in a function should not force creation of an activation object
2981 <https://bugs.webkit.org/show_bug.cgi?id=21123>
2983 Make the 'arguments' object not require a JSActivation. We store the
2984 'arguments' object in the OptionalCalleeArguments call frame slot. We
2985 need to be able to get the original 'arguments' object to tear it off
2986 when returning from a function, but 'arguments' may be assigned to in a
2989 Therefore, we use the OptionalCalleeArguments slot when we want to get
2990 the original activation or we know that 'arguments' was not assigned a
2991 different value. When 'arguments' may have been assigned a new value,
2992 we use a new local variable that is initialized with 'arguments'. Since
2993 a function parameter named 'arguments' may overwrite the value of
2994 'arguments', we also need to be careful to look up 'arguments' in the
2995 symbol table, so we get the parameter named 'arguments' instead of the
2996 local variable that we have added for holding the 'arguments' object.
2998 This is a 19.1% win on the V8 Raytrace benchmark using the SunSpider
2999 harness, and a 20.7% win using the V8 harness. This amounts to a 6.5%
3000 total speedup on the V8 benchmark suite using the V8 harness.
3003 (JSC::CTI::privateCompileMainPass):
3005 * VM/CodeGenerator.cpp:
3006 (JSC::CodeGenerator::CodeGenerator):
3008 (JSC::Machine::unwindCallFrame):
3009 (JSC::Machine::privateExecute):
3010 (JSC::Machine::retrieveArguments):
3011 (JSC::Machine::cti_op_init_arguments):
3012 (JSC::Machine::cti_op_ret_activation_arguments):
3014 * VM/RegisterFile.h:
3015 (JSC::RegisterFile::):
3016 * kjs/Arguments.cpp:
3017 (JSC::Arguments::mark):
3018 (JSC::Arguments::fillArgList):
3019 (JSC::Arguments::getOwnPropertySlot):
3020 (JSC::Arguments::put):
3022 (JSC::Arguments::setRegisters):
3023 (JSC::Arguments::init):
3024 (JSC::Arguments::Arguments):
3025 (JSC::Arguments::copyRegisters):
3026 (JSC::JSActivation::copyRegisters):
3027 * kjs/JSActivation.cpp:
3028 (JSC::JSActivation::argumentsGetter):
3029 * kjs/JSActivation.h:
3030 (JSC::JSActivation::JSActivationData::JSActivationData):
3033 (JSC::ScopeNode::setUsesArguments):
3034 * masm/X86Assembler.h:
3035 (JSC::X86Assembler::):
3036 (JSC::X86Assembler::orl_mr):
3038 2008-10-01 Kevin McCullough <kmccullough@apple.com>
3040 Rubberstamped by Geoff Garen.
3042 Remove BreakpointCheckStatement because it's not used anymore.
3043 No effect on sunspider or the jsc tests.
3048 2008-09-30 Oliver Hunt <oliver@apple.com>
3050 Reviewed by Geoff Garen.
3052 Improve performance of CTI on windows.
3054 Currently on platforms where the compiler doesn't allow us to safely
3055 index relative to the address of a parameter we need to actually
3056 provide a pointer to CTI runtime call arguments. This patch improves
3057 performance in this case by making the CTI logic for restoring this
3058 parameter much less conservative by only resetting it before we actually
3059 make a call, rather than between each and every SF bytecode we generate
3062 This results in a 3.6% progression on the v8 benchmark when compiled with MSVC.
3065 (JSC::CTI::emitCall):
3066 (JSC::CTI::compileOpCall):
3067 (JSC::CTI::privateCompileMainPass):
3068 (JSC::CTI::privateCompileSlowCases):
3069 (JSC::CTI::privateCompilePutByIdTransition):
3071 * masm/X86Assembler.h:
3074 2008-09-30 Maciej Stachowiak <mjs@apple.com>
3076 Reviewed by Oliver Hunt.
3078 - track uses of "this", "with" and "catch" in the parser
3080 Knowing this up front will be useful for future optimizations.
3082 Perf and correctness remain the same.
3087 2008-09-30 Sam Weinig <sam@webkit.org>
3089 Reviewed by Mark Rowe.
3091 Add WebKitAvailability macros for JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError,
3092 and JSObjectMakeRegExp
3094 * API/JSObjectRef.h:
3096 2008-09-30 Darin Adler <darin@apple.com>
3098 Reviewed by Geoff Garen.
3100 - https://bugs.webkit.org/show_bug.cgi?id=21214
3101 work on getting rid of ExecState
3103 Replaced the m_prev field of ExecState with a bit in the
3104 call frame pointer to indicate "host" call frames.
3107 (JSC::makeHostCallFramePointer): Added. Sets low bit.
3108 (JSC::isHostCallFrame): Added. Checks low bit.
3109 (JSC::stripHostCallFrameBit): Added. Clears low bit.
3110 (JSC::Machine::unwindCallFrame): Replaced null check that was
3111 formerly used to detect host call frames with an isHostCallFrame check.
3112 (JSC::Machine::execute): Pass in a host call frame pointer rather than
3113 always passing 0 when starting execution from the host. This allows us
3114 to follow the entire call frame pointer chain when desired, or to stop
3115 at the host calls when that's desired.
3116 (JSC::Machine::privateExecute): Replaced null check that was
3117 formerly used to detect host call frames with an isHostCallFrame check.
3118 (JSC::Machine::retrieveCaller): Ditto.
3119 (JSC::Machine::retrieveLastCaller): Ditto.
3120 (JSC::Machine::callFrame): Removed the code to walk up m_prev pointers
3121 and replaced it with code that uses the caller pointer and uses the
3122 stripHostCallFrameBit function.
3124 * kjs/ExecState.cpp: Removed m_prev.
3125 * kjs/ExecState.h: Ditto.
3127 2008-09-30 Cameron Zwarich <zwarich@apple.com>
3129 Reviewed by Geoff Garen.
3131 Move all detection of 'arguments' in a lexical scope to the parser, in
3132 preparation for fixing
3134 Bug 21123: using "arguments" in a function should not force creation of an activation object
3135 <https://bugs.webkit.org/show_bug.cgi?id=21123>
3137 * VM/CodeGenerator.cpp:
3138 (JSC::CodeGenerator::CodeGenerator):
3142 2008-09-30 Geoffrey Garen <ggaren@apple.com>
3147 (runWithScripts): Fixed indentation.
3149 2008-09-30 Mark Rowe <mrowe@apple.com>
3151 Rubber-stamped by Sam Weinig.
3153 Build fix. Move InternalFunction::classInfo implementation into the .cpp
3154 file to prevent the vtable for InternalFunction being generated as a weak symbol.
3155 Has no effect on SunSpider.
3157 * kjs/InternalFunction.cpp:
3158 (JSC::InternalFunction::classInfo):
3159 * kjs/InternalFunction.h:
3161 2008-09-29 Maciej Stachowiak <mjs@apple.com>
3163 Reviewed by Darin Adler.
3165 - optimize appending a number to a string
3166 https://bugs.webkit.org/show_bug.cgi?id=21203
3168 It's pretty common in real-world code (and on some of the v8
3169 benchmarks) to append a number to a string, so I made this one of
3170 the fast cases, and also added support to UString to do it
3171 directly without allocating a temporary UString.
3173 ~1% speedup on v8 benchmark.
3176 (JSC::jsAddSlowCase): Make this NEVER_INLINE because somehow otherwise
3177 the change is a regression.
3178 (JSC::jsAdd): Handle number + string special case.
3179 (JSC::Machine::cti_op_add): Integrate much of the logic of jsAdd to
3180 avoid exception check in the str + str, num + num and str + num cases.
3182 (JSC::expandedSize): Make this a non-member function, since it needs to be
3183 called in non-member functions but not outside this file.
3184 (JSC::expandCapacity): Ditto.
3185 (JSC::UString::expandCapacity): Call the non-member version.
3186 (JSC::createRep): Helper to make a rep from a char*.
3187 (JSC::UString::UString): Use above helper.
3188 (JSC::concatenate): Guts of concatenating constructor for cases where first
3189 item is a UString::Rep, and second is a UChar* and length, or a char*.
3190 (JSC::UString::append): Implement for cases where first item is a UString::Rep,
3191 and second is an int or double. Sadly duplicates logic of UString::from(int)
3192 and UString::from(double).
3195 2008-09-29 Darin Adler <darin@apple.com>
3197 Reviewed by Sam Weinig.
3199 - https://bugs.webkit.org/show_bug.cgi?id=21214
3200 work on getting rid of ExecState
3202 * JavaScriptCore.exp: Updated since JSGlobalObject::init
3203 no longer takes a parameter.
3206 (JSC::Machine::execute): Removed m_registerFile argument
3207 for ExecState constructors.
3209 * kjs/DebuggerCallFrame.cpp:
3210 (JSC::DebuggerCallFrame::evaluate): Removed globalThisValue
3211 argument for ExecState constructor.
3213 * kjs/ExecState.cpp:
3214 (JSC::ExecState::ExecState): Removed globalThisValue and
3215 registerFile arguments to constructors.
3217 * kjs/ExecState.h: Removed m_globalThisValue and
3218 m_registerFile data members.
3220 * kjs/JSGlobalObject.cpp:
3221 (JSC::JSGlobalObject::init): Removed globalThisValue
3222 argument for ExecState constructor.
3224 * kjs/JSGlobalObject.h:
3225 (JSC::JSGlobalObject::JSGlobalObject): Got rid of parameter
3226 for the init function.
3228 2008-09-29 Geoffrey Garen <ggaren@apple.com>
3230 Rubber-stamped by Cameron Zwarich.
3232 Fixed https://bugs.webkit.org/show_bug.cgi?id=21225
3233 Machine::retrieveLastCaller should check for a NULL codeBlock
3235 In order to crash, you would need to call retrieveCaller in a situation
3236 where you had two host call frames in a row in the register file. I
3237 don't know how to make that happen, or if it's even possible, so I don't
3238 have a test case -- but better safe than sorry!
3241 (JSC::Machine::retrieveLastCaller):
3243 2008-09-29 Geoffrey Garen <ggaren@apple.com>
3245 Reviewed by Cameron Zwarich.
3247 Store the callee ScopeChain, not the caller ScopeChain, in the call frame
3248 header. Nix the "scopeChain" local variable and ExecState::m_scopeChain, and
3249 access the callee ScopeChain through the call frame header instead.
3251 Profit: call + return are simpler, because they don't have to update the
3252 "scopeChain" local variable, or ExecState::m_scopeChain.
3254 Because CTI keeps "r" in a register, reading the callee ScopeChain relative
3255 to "r" can be very fast, in any cases we care to optimize.
3257 0% speedup on empty function call benchmark. (5.5% speedup in bytecode.)
3258 0% speedup on SunSpider. (7.5% speedup on controlflow-recursive.)
3259 2% speedup on SunSpider --v8.
3260 2% speedup on v8 benchmark.
3262 * VM/CTI.cpp: Changed scope chain access to read the scope chain from
3263 the call frame header. Sped up op_ret by changing it not to fuss with
3264 the "scopeChain" local variable or ExecState::m_scopeChain.
3266 * VM/CTI.h: Updated CTI trampolines not to take a ScopeChainNode*
3267 argument, since that's stored in the call frame header now.
3269 * VM/Machine.cpp: Access "scopeChain" and "codeBlock" through new helper
3270 functions that read from the call frame header. Updated functions operating
3271 on ExecState::m_callFrame to account for / take advantage of the fact that
3272 Exec:m_callFrame is now never NULL.
3274 Fixed a bug in op_construct, where it would use the caller's default
3275 object prototype, rather than the callee's, when constructing a new object.
3277 * VM/Machine.h: Made some helper functions available. Removed
3278 ScopeChainNode* arguments to a lot of functions, since the ScopeChainNode*
3279 is now stored in the call frame header.
3281 * VM/RegisterFile.h: Renamed "CallerScopeChain" to "ScopeChain", since
3282 that's what it is now.
3284 * kjs/DebuggerCallFrame.cpp: Updated for change to ExecState signature.
3286 * kjs/ExecState.cpp:
3287 * kjs/ExecState.h: Nixed ExecState::m_callFrame, along with the unused
3288 isGlobalObject function.
3290 * kjs/JSGlobalObject.cpp:
3291 * kjs/JSGlobalObject.h: Gave the global object a fake call frame in
3292 which to store the global scope chain, since our code now assumes that
3293 it can always read the scope chain out of the ExecState's call frame.
3295 2008-09-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3297 Reviewed by Sam Weinig.
3299 Remove the isActivationObject() virtual method on JSObject and use
3300 StructureID information instead. This should be slightly faster, but
3301 isActivationObject() is only used in assertions and unwinding the stack
3306 (JSC::Machine::unwindCallFrame):
3307 (JSC::Machine::privateExecute):
3308 (JSC::Machine::cti_op_ret_activation):
3309 * kjs/JSActivation.cpp:
3310 * kjs/JSActivation.h:
3313 2008-09-29 Peter Gal <galpeter@inf.u-szeged.hu>
3315 Reviewed and tweaked by Darin Adler.
3317 Fix build for non-all-in-one platforms.
3319 * kjs/StringPrototype.cpp: Added missing ASCIICType.h include.
3321 2008-09-29 Bradley T. Hughes <bradley.hughes@nokia.com>
3323 Reviewed by Simon Hausmann.
3325 Fix compilation with icpc
3331 2008-09-29 Thiago Macieira <thiago.macieira@nokia.com>
3333 Reviewed by Simon Hausmann.
3335 Changed copyright from Trolltech ASA to Nokia.
3337 Nokia acquired Trolltech ASA, assets were transferred on September 26th 2008.
3340 * wtf/qt/MainThreadQt.cpp:
3342 2008-09-29 Simon Hausmann <hausmann@webkit.org>
3344 Reviewed by Lars Knoll.
3346 Don't accidentially install libJavaScriptCore.a for the build inside
3349 * JavaScriptCore.pro:
3351 2008-09-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3353 Reviewed by Maciej Stachowiak.
3355 Bug 21200: Allow direct access to 'arguments' without using op_resolve
3356 <https://bugs.webkit.org/show_bug.cgi?id=21200>
3358 Allow fast access to the 'arguments' object by adding an extra slot to
3359 the callframe to store it.
3361 This is a 3.0% speedup on the V8 Raytrace benchmark.
3363 * JavaScriptCore.exp:
3365 (JSC::CTI::privateCompileMainPass):
3367 (JSC::CodeBlock::dump):
3368 * VM/CodeGenerator.cpp:
3369 (JSC::CodeGenerator::CodeGenerator):
3370 (JSC::CodeGenerator::registerFor):
3371 * VM/CodeGenerator.h:
3372 (JSC::CodeGenerator::registerFor):
3374 (JSC::Machine::initializeCallFrame):
3375 (JSC::Machine::dumpRegisters):
3376 (JSC::Machine::privateExecute):
3377 (JSC::Machine::retrieveArguments):
3378 (JSC::Machine::cti_op_call_JSFunction):
3379 (JSC::Machine::cti_op_create_arguments):
3380 (JSC::Machine::cti_op_construct_JSConstruct):
3383 * VM/RegisterFile.h:
3384 (JSC::RegisterFile::):
3385 * kjs/JSActivation.cpp:
3386 (JSC::JSActivation::mark):
3387 (JSC::JSActivation::argumentsGetter):
3388 * kjs/JSActivation.h:
3389 (JSC::JSActivation::JSActivationData::JSActivationData):
3392 (JSC::Parser::didFinishParsing):
3394 (JSC::Parser::parse):
3397 (JSC::ScopeNode::ScopeNode):
3398 (JSC::ProgramNode::ProgramNode):
3399 (JSC::ProgramNode::create):
3400 (JSC::EvalNode::EvalNode):
3401 (JSC::EvalNode::create):
3402 (JSC::FunctionBodyNode::FunctionBodyNode):
3403 (JSC::FunctionBodyNode::create):
3405 (JSC::ScopeNode::usesArguments):
3407 2008-09-28 Mark Rowe <mrowe@apple.com>
3409 Reviewed by Sam Weinig.
3411 Add an ASCII fast-path to toLowerCase and toUpperCase.
3413 The fast path speeds up the common case of an ASCII-only string by up to 60% while adding a less than 5% penalty
3414 to the less common non-ASCII case.
3416 This also removes stringProtoFuncToLocaleLowerCase and stringProtoFuncToLocaleUpperCase, which were identical
3417 to the non-locale variants of the functions. toLocaleLowerCase and toLocaleUpperCase now use the non-locale
3418 variants of the functions directly.
3420 * kjs/StringPrototype.cpp:
3421 (JSC::stringProtoFuncToLowerCase):
3422 (JSC::stringProtoFuncToUpperCase):
3424 2008-09-28 Mark Rowe <mrowe@apple.com>
3426 Reviewed by Cameron Zwarich.
3428 Speed up parseInt and parseFloat.
3430 Repeatedly indexing into a UString is slow, so retrieve a pointer into the underlying buffer once up front
3431 and use that instead. This is a 7% win on a parseInt/parseFloat micro-benchmark.
3433 * kjs/JSGlobalObjectFunctions.cpp:
3437 2008-09-28 Simon Hausmann <hausmann@webkit.org>
3439 Reviewed by David Hyatt.
3441 In Qt's initializeThreading re-use an existing thread identifier for the main
3442 thread if it exists.
3444 currentThread() implicitly creates new identifiers and it could be that
3445 it is called before initializeThreading().
3447 * wtf/ThreadingQt.cpp:
3448 (WTF::initializeThreading):
3450 2008-09-27 Keishi Hattori <casey.hattori@gmail.com>
3452 Added Machine::retrieveCaller to the export list.
3454 Reviewed by Kevin McCullough and Tim Hatcher.
3456 * JavaScriptCore.exp: Added Machine::retrieveCaller.
3458 2008-09-27 Anders Carlsson <andersca@apple.com>
3465 2008-09-27 Geoffrey Garen <ggaren@apple.com>
3467 Reviewed by Cameron Zwarich.
3469 https://bugs.webkit.org/show_bug.cgi?id=21175
3471 Store the callee CodeBlock, not the caller CodeBlock, in the call frame
3472 header. Nix the "codeBlock" local variable, and access the callee
3473 CodeBlock through the call frame header instead.
3475 Profit: call + return are simpler, because they don't have to update the
3476 "codeBlock" local variable.
3478 Because CTI keeps "r" in a register, reading the callee CodeBlock relative
3479 to "r" can be very fast, in any cases we care to optimize. Presently,
3480 no such cases seem important.
3482 Also, stop writing "dst" to the call frame header. CTI doesn't use it.
3484 21.6% speedup on empty function call benchmark.
3485 3.8% speedup on SunSpider --v8.
3486 2.1% speedup on v8 benchmark.
3487 0.7% speedup on SunSpider (6% speedup on controlflow-recursive).
3489 Small regression in bytecode, because currently every op_ret reads the
3490 callee CodeBlock to check needsFullScopeChain, and bytecode does not
3491 keep "r" in a register. On-balance, this is probably OK, since CTI is
3492 our high-performance execution model. Also, this should go away once
3493 we make needsFullScopeChain statically determinable at parse time.
3496 (JSC::CTI::compileOpCall): The speedup!
3497 (JSC::CTI::privateCompileSlowCases): ditto
3500 (JSC::): Fixed up magic trampoline constants to account for the nixed
3501 "codeBlock" argument.
3502 (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock"
3503 argument, since codeBlock is now stored in the call frame header.
3505 * VM/Machine.cpp: Read the callee CodeBlock from the register file. Use
3506 a NULL CallerRegisters in the call frame header to signal a built-in
3507 caller, since CodeBlock is now never NULL.
3509 * VM/Machine.h: Made some stand-alone functions Machine member functions
3510 so they could call the private codeBlock() accessor in the Register
3511 class, of which Machine is a friend. Renamed "CallerCodeBlock" to
3512 "CodeBlock", since it's no longer the caller's CodeBlock.
3514 * VM/RegisterFile.h: Marked some methods const to accommodate a
3515 const RegisterFile* being passed around in Machine.cpp.
3517 2008-09-26 Jan Michael Alonzo <jmalonzo@webkit.org>
3519 Gtk build fix. Not reviewed.
3521 Narrow-down the target of the JavaScriptCore .lut.h generator so
3522 it won't try to create the WebCore .lut.hs.
3526 2008-09-26 Matt Lilek <webkit@mattlilek.com>
3528 Reviewed by Tim Hatcher.
3530 Update FEATURE_DEFINES after ENABLE_CROSS_DOCUMENT_MESSAGING was removed.
3532 * Configurations/JavaScriptCore.xcconfig:
3534 2008-09-26 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3536 Rubber-stamped by Anders Carlson.
3538 Change the name 'sc' to 'scopeChainNode' in a few places.
3541 (JSC::EvalNode::generateCode):
3542 (JSC::FunctionBodyNode::generateCode):
3543 (JSC::ProgramNode::generateCode):
3545 2008-09-26 Sam Weinig <sam@webkit.org>
3547 Reviewed by Darin Adler.
3549 Patch for https://bugs.webkit.org/show_bug.cgi?id=21152
3550 Speedup static property get/put
3552 Convert getting/setting static property values to use static functions
3553 instead of storing an integer and switching in getValueProperty/putValueProperty.
3556 (JSC::JSObject::deleteProperty):
3557 (JSC::JSObject::getPropertyAttributes):
3558 * kjs/MathObject.cpp:
3559 (JSC::MathObject::getOwnPropertySlot):
3560 * kjs/NumberConstructor.cpp:
3561 (JSC::numberConstructorNaNValue):
3562 (JSC::numberConstructorNegInfinity):
3563 (JSC::numberConstructorPosInfinity):
3564 (JSC::numberConstructorMaxValue):
3565 (JSC::numberConstructorMinValue):
3566 * kjs/PropertySlot.h:
3567 (JSC::PropertySlot::):
3568 * kjs/RegExpConstructor.cpp:
3569 (JSC::regExpConstructorDollar1):
3570 (JSC::regExpConstructorDollar2):
3571 (JSC::regExpConstructorDollar3):
3572 (JSC::regExpConstructorDollar4):
3573 (JSC::regExpConstructorDollar5):
3574 (JSC::regExpConstructorDollar6):
3575 (JSC::regExpConstructorDollar7):
3576 (JSC::regExpConstructorDollar8):
3577 (JSC::regExpConstructorDollar9):
3578 (JSC::regExpConstructorInput):
3579 (JSC::regExpConstructorMultiline):
3580 (JSC::regExpConstructorLastMatch):
3581 (JSC::regExpConstructorLastParen):
3582 (JSC::regExpConstructorLeftContext):
3583 (JSC::regExpConstructorRightContext):
3584 (JSC::setRegExpConstructorInput):
3585 (JSC::setRegExpConstructorMultiline):
3586 (JSC::RegExpConstructor::setInput):
3587 (JSC::RegExpConstructor::setMultiline):
3588 (JSC::RegExpConstructor::multiline):