1 2008-10-17 Maciej Stachowiak <mjs@apple.com>
3 Reviewed by Cameron Zwarich.
5 - speed up transitions that resize the property storage a fair bit
7 ~3% speedup on v8 RayTrace benchmark, ~1% on DeltaBlue
10 (JSC::resizePropertyStorage): renamed from transitionObject, and reduced to just resize
11 the object's property storage with one inline call.
12 (JSC::CTI::privateCompilePutByIdTransition): Use a separate function for property storage
13 resize, but still do all the rest of the work in assembly in that case, and pass the known
14 compile-time constants of old and new size rather than structureIDs, saving a bunch of
15 redundant memory access.
17 (JSC::JSObject::allocatePropertyStorage): Just call the inline version.
19 (JSC::JSObject::allocatePropertyStorageInline): Inline version of allocatePropertyStorage
20 * masm/X86Assembler.h:
21 (JSC::X86Assembler::):
22 (JSC::X86Assembler::pushl_i32): Add code to assmeble push of a constant; code originally by Cameron Zwarich.
24 2008-10-17 Cameron Zwarich <zwarich@apple.com>
26 Reviewed by Maciej Stachowiak.
28 Remove some C style casts.
30 * masm/X86Assembler.h:
31 (JSC::JITCodeBuffer::putIntUnchecked):
32 (JSC::X86Assembler::link):
33 (JSC::X86Assembler::linkAbsoluteAddress):
34 (JSC::X86Assembler::getRelocatedAddress):
36 2008-10-17 Cameron Zwarich <zwarich@apple.com>
38 Rubber-stamped by Maciej Stachowiak.
40 Remove some C style casts.
43 (JSC::CTI::patchGetByIdSelf):
44 (JSC::CTI::patchPutByIdReplace):
46 (JSC::Machine::tryCTICachePutByID):
47 (JSC::Machine::tryCTICacheGetByID):
48 (JSC::Machine::cti_op_put_by_id):
49 (JSC::Machine::cti_op_put_by_id_fail):
50 (JSC::Machine::cti_op_get_by_id):
51 (JSC::Machine::cti_op_get_by_id_fail):
53 2008-10-17 Maciej Stachowiak <mjs@apple.com>
55 Reviewed by Cameron Zwarich.
57 - Avoid restoring the caller's 'r' value in op_ret
58 https://bugs.webkit.org/show_bug.cgi?id=21319
60 This patch stops writing the call frame at call and return points;
61 instead it does so immediately before any CTI call.
63 0.5% speedup or so on the v8 benchmark
66 (JSC::CTI::emitCTICall):
67 (JSC::CTI::compileOpCall):
68 (JSC::CTI::emitSlowScriptCheck):
69 (JSC::CTI::compileBinaryArithOpSlowCase):
70 (JSC::CTI::privateCompileMainPass):
71 (JSC::CTI::privateCompileSlowCases):
72 (JSC::CTI::privateCompile):
75 2008-10-17 Cameron Zwarich <zwarich@apple.com>
77 Reviewed by Sam Weinig.
79 Make WREC require CTI because it won't actually compile otherwise.
83 2008-10-16 Maciej Stachowiak <mjs@apple.com>
85 Reviewed by Geoff Garen.
87 - fixed <rdar://problem/5806316> JavaScriptCore should not force building with gcc 4.0
88 - use gcc 4.2 when building with Xcode 3.1 or newer on Leopard, even though this is not the default
90 This time there is no performance regression; we can avoid having
91 to use the fastcall calling convention for CTI functions by using
92 varargs to prevent the compiler from moving things around on the
95 * Configurations/DebugRelease.xcconfig:
96 * JavaScriptCore.xcodeproj/project.pbxproj:
101 2008-10-16 Maciej Stachowiak <mjs@apple.com>
103 Reviewed by Oliver Hunt.
105 - fix for REGRESSION: r37631 causing crashes on buildbot
106 https://bugs.webkit.org/show_bug.cgi?id=21682
109 (JSC::Heap::collect): Avoid crashing when a GC occurs while no global objects are live.
111 2008-10-16 Sam Weinig <sam@webkit.org>
113 Reviewed by Maciej Stachowiak.
115 Fix for https://bugs.webkit.org/show_bug.cgi?id=21683
116 Don't create intermediate StructureIDs for builtin objects
118 First step in reduce number of StructureIDs created when initializing the
121 - In order to avoid creating the intermediate StructureIDs use the new putDirectWithoutTransition
122 and putDirectFunctionWithoutTransition to add properties to JSObjects without transitioning
123 the StructureID. This patch just implements this strategy for ObjectPrototype but alone
124 reduces the number of StructureIDs create for about:blank by 10, from 142 to 132.
126 * kjs/JSGlobalObject.cpp:
127 (JSC::JSGlobalObject::reset):
129 (JSC::JSObject::putDirectFunctionWithoutTransition):
131 (JSC::JSObject::putDirectWithoutTransition):
132 * kjs/ObjectPrototype.cpp:
133 (JSC::ObjectPrototype::ObjectPrototype):
134 * kjs/ObjectPrototype.h:
135 * kjs/StructureID.cpp:
136 (JSC::StructureID::addPropertyWithoutTransition):
139 2008-10-16 Maciej Stachowiak <mjs@apple.com>
141 Reviewed by Cameron Zwarich.
143 - fix for: REGRESSION: over 100 StructureIDs leak loading about:blank (result of fix for bug 21633)
145 Apparent slight progression (< 0.5%) on v8 benchmarks and SunSpider.
147 * kjs/StructureID.cpp:
148 (JSC::StructureID::~StructureID): Don't deref this object's parent's pointer to
149 itself from the destructor; that doesn't even make sense.
150 (JSC::StructureID::addPropertyTransition): Don't refer the single transition;
151 the rule is that parent StructureIDs are ref'd but child ones are not. Refing
152 the child creates a cycle.
154 2008-10-15 Alexey Proskuryakov <ap@webkit.org>
156 Reviewed by Darin Adler.
158 https://bugs.webkit.org/show_bug.cgi?id=21609
159 Make MessagePorts protect their peers across heaps
161 * JavaScriptCore.exp:
162 * kjs/JSGlobalObject.cpp:
163 (JSC::JSGlobalObject::markCrossHeapDependentObjects):
164 * kjs/JSGlobalObject.h:
166 (JSC::Heap::collect):
167 Before GC sweep phase, a function supplied by global object is now called for all global
168 objects in the heap, making it possible to implement cross-heap dependencies.
170 2008-10-15 Alexey Proskuryakov <ap@webkit.org>
172 Reviewed by Darin Adler.
174 https://bugs.webkit.org/show_bug.cgi?id=21610
175 run-webkit-threads --threaded crashes in StructureID destructor
177 * kjs/StructureID.cpp:
178 (JSC::StructureID::StructureID):
179 (JSC::StructureID::~StructureID):
180 Protect access to a static (debug-only) HashSet with a lock.
182 2008-10-15 Sam Weinig <sam@webkit.org>
184 Reviewed by Goeffrey Garen.
186 Add function to dump statistics for StructureIDs.
188 * kjs/StructureID.cpp:
189 (JSC::StructureID::dumpStatistics):
190 (JSC::StructureID::StructureID):
191 (JSC::StructureID::~StructureID):
194 2008-10-15 Cameron Zwarich <zwarich@apple.com>
196 Reviewed by Maciej Stachowiak.
198 Bug 21633: Avoid using a HashMap when there is only a single transition
199 <https://bugs.webkit.org/show_bug.cgi?id=21633>
201 This is a 0.8% speedup on SunSpider and between a 0.5% and 1.0% speedup
202 on the V8 benchmark suite, depending on which harness we use. It will
203 also slightly reduce the memory footprint of a StructureID.
205 * kjs/StructureID.cpp:
206 (JSC::StructureID::StructureID):
207 (JSC::StructureID::~StructureID):
208 (JSC::StructureID::addPropertyTransition):
210 (JSC::StructureID::):
212 2008-10-15 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
214 Reviewed by Geoffrey Garen.
216 1.40% speedup on SunSpider, 1.44% speedup on V8. (Linux)
221 (JSC::fastIsNumber): ALWAYS_INLINE modifier added.
223 2008-10-15 Geoffrey Garen <ggaren@apple.com>
225 Reviewed by Cameron Zwarich.
227 Fixed https://bugs.webkit.org/show_bug.cgi?id=21345
228 Start the debugger without reloading the inspected page
230 * JavaScriptCore.exp: New symbols.
231 * JavaScriptCore.xcodeproj/project.pbxproj: New files.
234 (JSC::EvalCodeCache::get): Updated for tweak to parsing API.
236 * kjs/CollectorHeapIterator.h: Added. An iterator for the object heap,
237 which we use to find all the live functions and recompile them.
239 * kjs/DebuggerCallFrame.cpp:
240 (JSC::DebuggerCallFrame::evaluate): Updated for tweak to parsing API.
242 * kjs/FunctionConstructor.cpp:
243 (JSC::constructFunction): Updated for tweak to parsing API.
245 * kjs/JSFunction.cpp:
246 (JSC::JSFunction::JSFunction): Try to validate our SourceCode in debug
247 builds by ASSERTing that it's syntactically valid. This doesn't catch
248 all SourceCode bugs, but it catches a lot of them.
250 * kjs/JSGlobalObjectFunctions.cpp:
251 (JSC::globalFuncEval): Updated for tweak to parsing API.
254 (JSC::Parser::parse):
256 (JSC::Parser::parse): Tweaked the parser to make it possible to parse
257 without an ExecState, and to allow the client to specify a debugger to
258 notify (or not) about the source we parse. This allows the inspector
259 to recompile even though no JavaScript is executing, then notify the
260 debugger about all source code when it's done.
263 (prettyPrintScript): Updated for tweak to parsing API.
266 (JSC::SourceCode::isNull): Added to help with ASSERTs.
269 (JSC::Heap::heapAllocate):
271 (JSC::Heap::primaryHeapBegin):
272 (JSC::Heap::primaryHeapEnd):
274 (JSC::): Moved a bunch of declarations around to enable compilation of
275 CollectorHeapIterator.
277 * kjs/interpreter.cpp:
278 (JSC::Interpreter::checkSyntax):
279 (JSC::Interpreter::evaluate): Updated for tweak to parsing API.
282 (JSC::Lexer::sourceCode): BUG FIX: Calculate SourceCode ranges relative
283 to the SourceCode range in which we're lexing, otherwise nested functions
284 that are compiled individually get SourceCode ranges that don't reflect
288 (JSC::FunctionBodyNode::FunctionBodyNode):
289 (JSC::FunctionBodyNode::finishParsing):
290 (JSC::FunctionBodyNode::create):
291 (JSC::FunctionBodyNode::copyParameters):
293 (JSC::ScopeNode::setSource):
294 (JSC::FunctionBodyNode::parameterCount): Added some helper functions for
295 copying one FunctionBodyNode's parameters to another. The recompiler uses
296 these when calling "finishParsing".
298 2008-10-15 Joerg Bornemann <joerg.bornemann@trolltech.com>
300 Reviewed by Darin Adler.
302 - part of https://bugs.webkit.org/show_bug.cgi?id=20746
303 Fix compilation on Windows CE.
305 str(n)icmp, strdup and vsnprintf are not available on Windows CE,
306 they are called _str(n)icmp, etc. instead
308 * wtf/StringExtras.h: Added inline function implementations.
310 2008-10-15 Gabor Loki <loki@inf.u-szeged.hu>
312 Reviewed by Cameron Zwarich.
314 <https://bugs.webkit.org/show_bug.cgi?id=20912>
315 Use simple uint32_t multiplication on op_mul if both operands are
316 immediate number and they are between zero and 0x7FFF.
319 (JSC::Machine::privateExecute):
321 2008-10-09 Darin Fisher <darin@chromium.org>
323 Reviewed by Sam Weinig.
325 Make pan scrolling a platform configurable option.
326 https://bugs.webkit.org/show_bug.cgi?id=21515
328 * wtf/Platform.h: Add ENABLE_PAN_SCROLLING
330 2008-10-14 Maciej Stachowiak <mjs@apple.com>
332 Rubber stamped by Sam Weinig.
334 - revert r37572 and r37581 for now
336 Turns out GCC 4.2 is still a (small) regression, we'll have to do
337 more work to turn it on.
339 * Configurations/DebugRelease.xcconfig:
340 * JavaScriptCore.xcodeproj/project.pbxproj:
344 (JSC::Machine::cti_op_convert_this):
345 (JSC::Machine::cti_op_end):
346 (JSC::Machine::cti_op_add):
347 (JSC::Machine::cti_op_pre_inc):
348 (JSC::Machine::cti_timeout_check):
349 (JSC::Machine::cti_register_file_check):
350 (JSC::Machine::cti_op_loop_if_less):
351 (JSC::Machine::cti_op_loop_if_lesseq):
352 (JSC::Machine::cti_op_new_object):
353 (JSC::Machine::cti_op_put_by_id):
354 (JSC::Machine::cti_op_put_by_id_second):
355 (JSC::Machine::cti_op_put_by_id_generic):
356 (JSC::Machine::cti_op_put_by_id_fail):
357 (JSC::Machine::cti_op_get_by_id):
358 (JSC::Machine::cti_op_get_by_id_second):
359 (JSC::Machine::cti_op_get_by_id_generic):
360 (JSC::Machine::cti_op_get_by_id_fail):
361 (JSC::Machine::cti_op_instanceof):
362 (JSC::Machine::cti_op_del_by_id):
363 (JSC::Machine::cti_op_mul):
364 (JSC::Machine::cti_op_new_func):
365 (JSC::Machine::cti_op_call_JSFunction):
366 (JSC::Machine::cti_vm_compile):
367 (JSC::Machine::cti_op_push_activation):
368 (JSC::Machine::cti_op_call_NotJSFunction):
369 (JSC::Machine::cti_op_create_arguments):
370 (JSC::Machine::cti_op_tear_off_activation):
371 (JSC::Machine::cti_op_tear_off_arguments):
372 (JSC::Machine::cti_op_ret_profiler):
373 (JSC::Machine::cti_op_ret_scopeChain):
374 (JSC::Machine::cti_op_new_array):
375 (JSC::Machine::cti_op_resolve):
376 (JSC::Machine::cti_op_construct_JSConstruct):
377 (JSC::Machine::cti_op_construct_NotJSConstruct):
378 (JSC::Machine::cti_op_get_by_val):
379 (JSC::Machine::cti_op_resolve_func):
380 (JSC::Machine::cti_op_sub):
381 (JSC::Machine::cti_op_put_by_val):
382 (JSC::Machine::cti_op_put_by_val_array):
383 (JSC::Machine::cti_op_lesseq):
384 (JSC::Machine::cti_op_loop_if_true):
385 (JSC::Machine::cti_op_negate):
386 (JSC::Machine::cti_op_resolve_base):
387 (JSC::Machine::cti_op_resolve_skip):
388 (JSC::Machine::cti_op_resolve_global):
389 (JSC::Machine::cti_op_div):
390 (JSC::Machine::cti_op_pre_dec):
391 (JSC::Machine::cti_op_jless):
392 (JSC::Machine::cti_op_not):
393 (JSC::Machine::cti_op_jtrue):
394 (JSC::Machine::cti_op_post_inc):
395 (JSC::Machine::cti_op_eq):
396 (JSC::Machine::cti_op_lshift):
397 (JSC::Machine::cti_op_bitand):
398 (JSC::Machine::cti_op_rshift):
399 (JSC::Machine::cti_op_bitnot):
400 (JSC::Machine::cti_op_resolve_with_base):
401 (JSC::Machine::cti_op_new_func_exp):
402 (JSC::Machine::cti_op_mod):
403 (JSC::Machine::cti_op_less):
404 (JSC::Machine::cti_op_neq):
405 (JSC::Machine::cti_op_post_dec):
406 (JSC::Machine::cti_op_urshift):
407 (JSC::Machine::cti_op_bitxor):
408 (JSC::Machine::cti_op_new_regexp):
409 (JSC::Machine::cti_op_bitor):
410 (JSC::Machine::cti_op_call_eval):
411 (JSC::Machine::cti_op_throw):
412 (JSC::Machine::cti_op_get_pnames):
413 (JSC::Machine::cti_op_next_pname):
414 (JSC::Machine::cti_op_push_scope):
415 (JSC::Machine::cti_op_pop_scope):
416 (JSC::Machine::cti_op_typeof):
417 (JSC::Machine::cti_op_is_undefined):
418 (JSC::Machine::cti_op_is_boolean):
419 (JSC::Machine::cti_op_is_number):
420 (JSC::Machine::cti_op_is_string):
421 (JSC::Machine::cti_op_is_object):
422 (JSC::Machine::cti_op_is_function):
423 (JSC::Machine::cti_op_stricteq):
424 (JSC::Machine::cti_op_nstricteq):
425 (JSC::Machine::cti_op_to_jsnumber):
426 (JSC::Machine::cti_op_in):
427 (JSC::Machine::cti_op_push_new_scope):
428 (JSC::Machine::cti_op_jmp_scopes):
429 (JSC::Machine::cti_op_put_by_index):
430 (JSC::Machine::cti_op_switch_imm):
431 (JSC::Machine::cti_op_switch_char):
432 (JSC::Machine::cti_op_switch_string):
433 (JSC::Machine::cti_op_del_by_val):
434 (JSC::Machine::cti_op_put_getter):
435 (JSC::Machine::cti_op_put_setter):
436 (JSC::Machine::cti_op_new_error):
437 (JSC::Machine::cti_op_debug):
438 (JSC::Machine::cti_vm_throw):
440 * masm/X86Assembler.h:
441 (JSC::X86Assembler::emitRestoreArgumentReference):
442 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
445 2008-10-14 Alexey Proskuryakov <ap@webkit.org>
447 Reviewed by Darin Adler.
449 https://bugs.webkit.org/show_bug.cgi?id=20256
450 Array.push and other standard methods disappear
452 * kjs/JSGlobalData.cpp:
453 (JSC::JSGlobalData::JSGlobalData):
454 (JSC::JSGlobalData::~JSGlobalData):
455 Don't use static hash tables even on platforms that don't enable JSC_MULTIPLE_THREADS -
456 these tables reference IdentifierTable, which is always per-GlobalData.
458 2008-10-14 Maciej Stachowiak <mjs@apple.com>
460 Reviewed by Cameron Zwarich.
462 - always use CTI_ARGUMENTS and CTI_ARGUMENTS_FASTCALL
464 This is a small regression for GCC 4.0, but simplifies the code
465 for future improvements and lets us focus on GCC 4.2+ and MSVC.
470 (JSC::Machine::cti_op_convert_this):
471 (JSC::Machine::cti_op_end):
472 (JSC::Machine::cti_op_add):
473 (JSC::Machine::cti_op_pre_inc):
474 (JSC::Machine::cti_timeout_check):
475 (JSC::Machine::cti_register_file_check):
476 (JSC::Machine::cti_op_loop_if_less):
477 (JSC::Machine::cti_op_loop_if_lesseq):
478 (JSC::Machine::cti_op_new_object):
479 (JSC::Machine::cti_op_put_by_id):
480 (JSC::Machine::cti_op_put_by_id_second):
481 (JSC::Machine::cti_op_put_by_id_generic):
482 (JSC::Machine::cti_op_put_by_id_fail):
483 (JSC::Machine::cti_op_get_by_id):
484 (JSC::Machine::cti_op_get_by_id_second):
485 (JSC::Machine::cti_op_get_by_id_generic):
486 (JSC::Machine::cti_op_get_by_id_fail):
487 (JSC::Machine::cti_op_instanceof):
488 (JSC::Machine::cti_op_del_by_id):
489 (JSC::Machine::cti_op_mul):
490 (JSC::Machine::cti_op_new_func):
491 (JSC::Machine::cti_op_call_JSFunction):
492 (JSC::Machine::cti_vm_compile):
493 (JSC::Machine::cti_op_push_activation):
494 (JSC::Machine::cti_op_call_NotJSFunction):
495 (JSC::Machine::cti_op_create_arguments):
496 (JSC::Machine::cti_op_tear_off_activation):
497 (JSC::Machine::cti_op_tear_off_arguments):
498 (JSC::Machine::cti_op_ret_profiler):
499 (JSC::Machine::cti_op_ret_scopeChain):
500 (JSC::Machine::cti_op_new_array):
501 (JSC::Machine::cti_op_resolve):
502 (JSC::Machine::cti_op_construct_JSConstruct):
503 (JSC::Machine::cti_op_construct_NotJSConstruct):
504 (JSC::Machine::cti_op_get_by_val):
505 (JSC::Machine::cti_op_resolve_func):
506 (JSC::Machine::cti_op_sub):
507 (JSC::Machine::cti_op_put_by_val):
508 (JSC::Machine::cti_op_put_by_val_array):
509 (JSC::Machine::cti_op_lesseq):
510 (JSC::Machine::cti_op_loop_if_true):
511 (JSC::Machine::cti_op_negate):
512 (JSC::Machine::cti_op_resolve_base):
513 (JSC::Machine::cti_op_resolve_skip):
514 (JSC::Machine::cti_op_resolve_global):
515 (JSC::Machine::cti_op_div):
516 (JSC::Machine::cti_op_pre_dec):
517 (JSC::Machine::cti_op_jless):
518 (JSC::Machine::cti_op_not):
519 (JSC::Machine::cti_op_jtrue):
520 (JSC::Machine::cti_op_post_inc):
521 (JSC::Machine::cti_op_eq):
522 (JSC::Machine::cti_op_lshift):
523 (JSC::Machine::cti_op_bitand):
524 (JSC::Machine::cti_op_rshift):
525 (JSC::Machine::cti_op_bitnot):
526 (JSC::Machine::cti_op_resolve_with_base):
527 (JSC::Machine::cti_op_new_func_exp):
528 (JSC::Machine::cti_op_mod):
529 (JSC::Machine::cti_op_less):
530 (JSC::Machine::cti_op_neq):
531 (JSC::Machine::cti_op_post_dec):
532 (JSC::Machine::cti_op_urshift):
533 (JSC::Machine::cti_op_bitxor):
534 (JSC::Machine::cti_op_new_regexp):
535 (JSC::Machine::cti_op_bitor):
536 (JSC::Machine::cti_op_call_eval):
537 (JSC::Machine::cti_op_throw):
538 (JSC::Machine::cti_op_get_pnames):
539 (JSC::Machine::cti_op_next_pname):
540 (JSC::Machine::cti_op_push_scope):
541 (JSC::Machine::cti_op_pop_scope):
542 (JSC::Machine::cti_op_typeof):
543 (JSC::Machine::cti_op_is_undefined):
544 (JSC::Machine::cti_op_is_boolean):
545 (JSC::Machine::cti_op_is_number):
546 (JSC::Machine::cti_op_is_string):
547 (JSC::Machine::cti_op_is_object):
548 (JSC::Machine::cti_op_is_function):
549 (JSC::Machine::cti_op_stricteq):
550 (JSC::Machine::cti_op_nstricteq):
551 (JSC::Machine::cti_op_to_jsnumber):
552 (JSC::Machine::cti_op_in):
553 (JSC::Machine::cti_op_push_new_scope):
554 (JSC::Machine::cti_op_jmp_scopes):
555 (JSC::Machine::cti_op_put_by_index):
556 (JSC::Machine::cti_op_switch_imm):
557 (JSC::Machine::cti_op_switch_char):
558 (JSC::Machine::cti_op_switch_string):
559 (JSC::Machine::cti_op_del_by_val):
560 (JSC::Machine::cti_op_put_getter):
561 (JSC::Machine::cti_op_put_setter):
562 (JSC::Machine::cti_op_new_error):
563 (JSC::Machine::cti_op_debug):
564 (JSC::Machine::cti_vm_throw):
566 * masm/X86Assembler.h:
567 (JSC::X86Assembler::emitRestoreArgumentReference):
568 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
571 2008-10-13 Maciej Stachowiak <mjs@apple.com>
573 Reviewed by Cameron Zwarich.
575 - make Machine::getArgumentsData an Arguments method and inline it
581 (JSC::Machine::getArgumentsData):
583 2008-10-13 Alp Toker <alp@nuanti.com>
585 Fix autotools dist build target by listing recently added header
586 files only. Not reviewed.
590 2008-10-13 Maciej Stachowiak <mjs@apple.com>
592 Rubber stamped by Mark Rowe.
594 - fixed <rdar://problem/5806316> JavaScriptCore should not force building with gcc 4.0
595 - use gcc 4.2 when building with Xcode 3.1 or newer on Leopard, even though this is not the default
597 * Configurations/DebugRelease.xcconfig:
598 * JavaScriptCore.xcodeproj/project.pbxproj:
600 2008-10-13 Cameron Zwarich <zwarich@apple.com>
602 Reviewed by Geoff Garen.
604 Bug 21541: Move RegisterFile growth check to callee
605 <https://bugs.webkit.org/show_bug.cgi?id=21541>
607 Move the RegisterFile growth check to the callee in the common case,
608 where some of the information is known statically at JIT time. There is
609 still a check in the caller in the case where the caller provides too
612 This is a 2.1% speedup on the V8 benchmark, including a 5.1% speedup on
613 the Richards benchmark, a 4.1% speedup on the DeltaBlue benchmark, and a
614 1.4% speedup on the Earley-Boyer benchmark. It is also a 0.5% speedup on
618 (JSC::CTI::privateCompile):
620 (JSC::Machine::cti_register_file_check):
621 (JSC::Machine::cti_op_call_JSFunction):
622 (JSC::Machine::cti_op_construct_JSConstruct):
625 * masm/X86Assembler.h:
626 (JSC::X86Assembler::):
627 (JSC::X86Assembler::cmpl_mr):
628 (JSC::X86Assembler::emitUnlinkedJg):
630 2008-10-13 Sam Weinig <sam@webkit.org>
632 Reviewed by Dan Bernstein.
634 Fix for https://bugs.webkit.org/show_bug.cgi?id=21577
635 5 false positive StructureID leaks
637 - Add leak ignore set to StructureID to selectively ignore leaking some StructureIDs.
638 - Add create method to JSGlolalData to be used when the data will be intentionally
639 leaked and ignore all leaks caused the StructureIDs stored in it.
641 * JavaScriptCore.exp:
642 * kjs/JSGlobalData.cpp:
643 (JSC::JSGlobalData::createLeaked):
644 * kjs/JSGlobalData.h:
645 * kjs/StructureID.cpp:
646 (JSC::StructureID::StructureID):
647 (JSC::StructureID::~StructureID):
648 (JSC::StructureID::startIgnoringLeaks):
649 (JSC::StructureID::stopIgnoringLeaks):
652 2008-10-13 Marco Barisione <marco.barisione@collabora.co.uk>
654 Reviewed by Darin Adler. Landed by Jan Alonzo.
656 WebKit GTK Port needs a smartpointer to handle g_free (GFreePtr?)
657 http://bugs.webkit.org/show_bug.cgi?id=20483
659 Add a GOwnPtr smart pointer (similar to OwnPtr) to handle memory
660 allocated by GLib and start the conversion to use it.
663 * wtf/GOwnPtr.cpp: Added.
670 * wtf/GOwnPtr.h: Added.
672 (WTF::GOwnPtr::GOwnPtr):
673 (WTF::GOwnPtr::~GOwnPtr):
675 (WTF::GOwnPtr::release):
676 (WTF::GOwnPtr::rawPtr):
678 (WTF::GOwnPtr::clear):
679 (WTF::GOwnPtr::operator*):
680 (WTF::GOwnPtr::operator->):
681 (WTF::GOwnPtr::operator!):
682 (WTF::GOwnPtr::operator UnspecifiedBoolType):
683 (WTF::GOwnPtr::swap):
689 * wtf/ThreadingGtk.cpp:
690 (WTF::Mutex::~Mutex):
692 (WTF::Mutex::tryLock):
693 (WTF::Mutex::unlock):
694 (WTF::ThreadCondition::~ThreadCondition):
695 (WTF::ThreadCondition::wait):
696 (WTF::ThreadCondition::timedWait):
697 (WTF::ThreadCondition::signal):
698 (WTF::ThreadCondition::broadcast):
700 2008-10-12 Gabriella Toth <gtoth@inf.u-szeged.hu>
702 Reviewed by Darin Adler.
704 - part of https://bugs.webkit.org/show_bug.cgi?id=21055
705 Bug 21055: not invoked functions
707 * kjs/nodes.cpp: Deleted a function that is not invoked:
708 statementListInitializeVariableAccessStack.
710 2008-10-12 Darin Adler <darin@apple.com>
712 Reviewed by Sam Weinig.
714 * wtf/unicode/icu/UnicodeIcu.h: Fixed indentation to match WebKit coding style.
715 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
717 2008-10-12 Darin Adler <darin@apple.com>
719 Reviewed by Sam Weinig.
721 - https://bugs.webkit.org/show_bug.cgi?id=21556
722 Bug 21556: non-ASCII digits are allowed in places where only ASCII should be
724 * wtf/unicode/icu/UnicodeIcu.h: Removed isDigit, digitValue, and isFormatChar.
725 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
727 2008-10-12 Anders Carlsson <andersca@apple.com>
729 Reviewed by Darin Adler.
731 Make the append method that takes a Vector more strict - it now requires the elements
732 of the vector to be appended same type as the elements of the Vector they're being appended to.
734 This would cause problems when dealing with Vectors containing other Vectors.
739 2008-10-11 Cameron Zwarich <zwarich@apple.com>
741 Reviewed by Sam Weinig.
743 Clean up RegExpMatchesArray.h to match our coding style.
745 * kjs/RegExpMatchesArray.h:
746 (JSC::RegExpMatchesArray::getOwnPropertySlot):
747 (JSC::RegExpMatchesArray::put):
748 (JSC::RegExpMatchesArray::deleteProperty):
749 (JSC::RegExpMatchesArray::getPropertyNames):
751 2008-10-11 Cameron Zwarich <zwarich@apple.com>
753 Reviewed by Sam Weinig.
755 Bug 21525: 55 StructureID leaks on Wikitravel's main page
756 <https://bugs.webkit.org/show_bug.cgi?id=21525>
758 Bug 21533: Simple JavaScript code leaks StructureIDs
759 <https://bugs.webkit.org/show_bug.cgi?id=21533>
761 StructureID::getEnumerablePropertyNames() ends up calling back to itself
762 via JSObject::getPropertyNames(), which causes the PropertyNameArray to
763 be cached twice. This leads to a memory leak in almost every use of
764 JSObject::getPropertyNames() on an object. The fix here is based on a
765 suggestion of Sam Weinig.
767 This patch also fixes every StructureID leaks that occurs while running
768 the Mozilla MemBuster test.
770 * kjs/PropertyNameArray.h:
771 (JSC::PropertyNameArray::PropertyNameArray):
772 (JSC::PropertyNameArray::setCacheable):
773 (JSC::PropertyNameArray::cacheable):
774 * kjs/StructureID.cpp:
775 (JSC::StructureID::getEnumerablePropertyNames):
777 2008-10-10 Oliver Hunt <oliver@apple.com>
779 Reviewed by Cameron Zwarich.
781 Use fastcall calling convention on GCC > 4.0
783 Results in a 2-3% improvement in GCC 4.2 performance, so
784 that it is no longer a regression vs. GCC 4.0
790 2008-10-10 Sam Weinig <sam@webkit.org>
792 Reviewed by Darin Adler.
794 - Add a workaround for a bug in ceil in Darwin libc.
795 - Remove old workarounds for JS math functions that are not needed
798 The math functions are heavily tested by fast/js/math.html.
800 * kjs/MathObject.cpp:
801 (JSC::mathProtoFuncAbs): Remove workaround.
802 (JSC::mathProtoFuncCeil): Ditto.
803 (JSC::mathProtoFuncFloor): Ditto.
805 (wtf_ceil): Add ceil workaround for darwin.
807 2008-10-10 Sam Weinig <sam@webkit.org>
809 Reviewed by Darin Adler
811 Add Assertions to JSObject constructor.
814 (JSC::JSObject::JSObject):
816 2008-10-10 Sam Weinig <sam@webkit.org>
818 Reviewed by Cameron Zwarich.
820 Remove now unused m_getterSetterFlag variable from PropertyMap.
822 * kjs/PropertyMap.cpp:
823 (JSC::PropertyMap::operator=):
825 (JSC::PropertyMap::PropertyMap):
827 2008-10-09 Sam Weinig <sam@webkit.org>
829 Reviewed by Maciej Stachowiak.
831 Add leaks checking to StructureID.
833 * kjs/StructureID.cpp:
834 (JSC::StructureID::StructureID):
835 (JSC::StructureID::~StructureID):
837 2008-10-09 Alp Toker <alp@nuanti.com>
839 Reviewed by Mark Rowe.
841 https://bugs.webkit.org/show_bug.cgi?id=20760
842 Implement support for x86 Linux in CTI
844 Prepare to enable CTI/WREC on supported architectures.
846 Make it possible to use the CTI_ARGUMENT workaround with GCC as well
847 as MSVC by fixing some preprocessor conditionals.
849 Note that CTI/WREC no longer requires CTI_ARGUMENT on Linux so we
850 don't actually enable it except when building with MSVC. GCC on Win32
853 Adapt inline ASM code to use the global symbol underscore prefix only
854 on Darwin and to call the properly mangled Machine::cti_vm_throw
855 symbol name depending on CTI_ARGUMENT.
857 Also avoid global inclusion of the JIT infrastructure headers
858 throughout WebCore and WebKit causing recompilation of about ~1500
859 source files after modification to X86Assembler.h, CTI.h, WREC.h,
860 which are only used deep inside JavaScriptCore.
868 (JSC::RegExp::RegExp):
869 (JSC::RegExp::~RegExp):
870 (JSC::RegExp::match):
872 * masm/X86Assembler.h:
873 (JSC::X86Assembler::emitConvertToFastCall):
874 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
875 (JSC::X86Assembler::emitRestoreArgumentReference):
877 2008-10-09 Gavin Barraclough <barraclough@apple.com>
879 Reviewed by Cameron Zwarich.
881 Fix for bug #21160, x=0;1/(x*-1) == -Infinity
885 (JSC::CTI::emitFastArithDeTagImmediate):
886 (JSC::CTI::emitFastArithDeTagImmediateJumpIfZero):
887 (JSC::CTI::compileBinaryArithOp):
888 (JSC::CTI::compileBinaryArithOpSlowCase):
889 (JSC::CTI::privateCompileMainPass):
890 (JSC::CTI::privateCompileSlowCases):
892 * masm/X86Assembler.h:
893 (JSC::X86Assembler::):
894 (JSC::X86Assembler::emitUnlinkedJs):
896 2008-10-09 Cameron Zwarich <zwarich@apple.com>
898 Reviewed by Oliver Hunt.
900 Bug 21459: REGRESSION (r37324): Safari crashes inside JavaScriptCore while browsing hulu.com
901 <https://bugs.webkit.org/show_bug.cgi?id=21459>
903 After r37324, an Arguments object does not mark an associated activation
904 object. This change was made because Arguments no longer directly used
905 the activation object in any way. However, if an activation is torn off,
906 then the backing store of Arguments becomes the register array of the
907 activation object. Arguments directly marks all of the arguments, but
908 the activation object is being collected, which causes its register
909 array to be freed and new memory to be allocated in its place.
911 Unfortunately, it does not seem possible to reproduce this issue in a
915 (JSC::Arguments::mark):
917 (JSC::Arguments::setActivation):
918 (JSC::Arguments::Arguments):
919 (JSC::JSActivation::copyRegisters):
921 2008-10-09 Ariya Hidayat <ariya.hidayat@trolltech.com>
927 * wtf/AlwaysInline.h:
929 2008-10-08 Cameron Zwarich <zwarich@apple.com>
931 Reviewed by Maciej Stachowiak.
933 Bug 21497: REGRESSION (r37433): Bytecode JSC tests are severely broken
934 <https://bugs.webkit.org/show_bug.cgi?id=21497>
936 Fix a typo in r37433 that causes the failure of a large number of JSC
937 tests with the bytecode interpreter enabled.
940 (JSC::Machine::privateExecute):
942 2008-10-08 Mark Rowe <mrowe@apple.com>
947 (JSC::): Update type of argument to ctiTrampoline.
949 2008-10-08 Darin Adler <darin@apple.com>
951 Reviewed by Cameron Zwarich.
953 - https://bugs.webkit.org/show_bug.cgi?id=21403
954 Bug 21403: use new CallFrame class rather than Register* for call frame manipulation
956 Add CallFrame as a synonym for ExecState. Arguably, some day we should switch every
957 client over to the new name.
959 Use CallFrame* consistently rather than Register* or ExecState* in low-level code such
960 as Machine.cpp and CTI.cpp. Similarly, use callFrame rather than r as its name and use
961 accessor functions to get at things in the frame.
963 Eliminate other uses of ExecState* that aren't needed, replacing in some cases with
964 JSGlobalData* and in other cases eliminating them entirely.
966 * API/JSObjectRef.cpp:
967 (JSObjectMakeFunctionWithCallback):
968 (JSObjectMakeFunction):
969 (JSObjectHasProperty):
970 (JSObjectGetProperty):
971 (JSObjectSetProperty):
972 (JSObjectDeleteProperty):
973 * API/OpaqueJSString.cpp:
974 * API/OpaqueJSString.h:
976 (JSC::CTI::getConstant):
977 (JSC::CTI::emitGetArg):
978 (JSC::CTI::emitGetPutArg):
979 (JSC::CTI::getConstantImmediateNumericArg):
980 (JSC::CTI::printOpcodeOperandTypes):
982 (JSC::CTI::compileOpCall):
983 (JSC::CTI::compileBinaryArithOp):
984 (JSC::CTI::privateCompileMainPass):
985 (JSC::CTI::privateCompile):
986 (JSC::CTI::privateCompileGetByIdProto):
987 (JSC::CTI::privateCompileGetByIdChain):
988 (JSC::CTI::compileRegExp):
991 * VM/CodeGenerator.cpp:
992 (JSC::CodeGenerator::emitEqualityOp):
993 (JSC::CodeGenerator::emitLoad):
994 (JSC::CodeGenerator::emitUnexpectedLoad):
995 (JSC::CodeGenerator::emitConstruct):
996 * VM/CodeGenerator.h:
1000 (JSC::jsAddSlowCase):
1002 (JSC::jsTypeStringForValue):
1003 (JSC::Machine::resolve):
1004 (JSC::Machine::resolveSkip):
1005 (JSC::Machine::resolveGlobal):
1006 (JSC::inlineResolveBase):
1007 (JSC::Machine::resolveBase):
1008 (JSC::Machine::resolveBaseAndProperty):
1009 (JSC::Machine::resolveBaseAndFunc):
1010 (JSC::Machine::slideRegisterWindowForCall):
1012 (JSC::Machine::callEval):
1013 (JSC::Machine::dumpCallFrame):
1014 (JSC::Machine::dumpRegisters):
1015 (JSC::Machine::unwindCallFrame):
1016 (JSC::Machine::throwException):
1017 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
1018 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
1019 (JSC::Machine::execute):
1020 (JSC::Machine::debug):
1021 (JSC::Machine::createExceptionScope):
1022 (JSC::cachePrototypeChain):
1023 (JSC::Machine::tryCachePutByID):
1024 (JSC::Machine::tryCacheGetByID):
1025 (JSC::Machine::privateExecute):
1026 (JSC::Machine::retrieveArguments):
1027 (JSC::Machine::retrieveCaller):
1028 (JSC::Machine::retrieveLastCaller):
1029 (JSC::Machine::findFunctionCallFrame):
1030 (JSC::Machine::getArgumentsData):
1031 (JSC::Machine::tryCTICachePutByID):
1032 (JSC::Machine::getCTIArrayLengthTrampoline):
1033 (JSC::Machine::getCTIStringLengthTrampoline):
1034 (JSC::Machine::tryCTICacheGetByID):
1035 (JSC::Machine::cti_op_convert_this):
1036 (JSC::Machine::cti_op_end):
1037 (JSC::Machine::cti_op_add):
1038 (JSC::Machine::cti_op_pre_inc):
1039 (JSC::Machine::cti_timeout_check):
1040 (JSC::Machine::cti_op_loop_if_less):
1041 (JSC::Machine::cti_op_loop_if_lesseq):
1042 (JSC::Machine::cti_op_new_object):
1043 (JSC::Machine::cti_op_put_by_id):
1044 (JSC::Machine::cti_op_put_by_id_second):
1045 (JSC::Machine::cti_op_put_by_id_generic):
1046 (JSC::Machine::cti_op_put_by_id_fail):
1047 (JSC::Machine::cti_op_get_by_id):
1048 (JSC::Machine::cti_op_get_by_id_second):
1049 (JSC::Machine::cti_op_get_by_id_generic):
1050 (JSC::Machine::cti_op_get_by_id_fail):
1051 (JSC::Machine::cti_op_instanceof):
1052 (JSC::Machine::cti_op_del_by_id):
1053 (JSC::Machine::cti_op_mul):
1054 (JSC::Machine::cti_op_new_func):
1055 (JSC::Machine::cti_op_call_JSFunction):
1056 (JSC::Machine::cti_vm_compile):
1057 (JSC::Machine::cti_op_push_activation):
1058 (JSC::Machine::cti_op_call_NotJSFunction):
1059 (JSC::Machine::cti_op_create_arguments):
1060 (JSC::Machine::cti_op_tear_off_activation):
1061 (JSC::Machine::cti_op_tear_off_arguments):
1062 (JSC::Machine::cti_op_ret_profiler):
1063 (JSC::Machine::cti_op_ret_scopeChain):
1064 (JSC::Machine::cti_op_new_array):
1065 (JSC::Machine::cti_op_resolve):
1066 (JSC::Machine::cti_op_construct_JSConstruct):
1067 (JSC::Machine::cti_op_construct_NotJSConstruct):
1068 (JSC::Machine::cti_op_get_by_val):
1069 (JSC::Machine::cti_op_resolve_func):
1070 (JSC::Machine::cti_op_sub):
1071 (JSC::Machine::cti_op_put_by_val):
1072 (JSC::Machine::cti_op_put_by_val_array):
1073 (JSC::Machine::cti_op_lesseq):
1074 (JSC::Machine::cti_op_loop_if_true):
1075 (JSC::Machine::cti_op_negate):
1076 (JSC::Machine::cti_op_resolve_base):
1077 (JSC::Machine::cti_op_resolve_skip):
1078 (JSC::Machine::cti_op_resolve_global):
1079 (JSC::Machine::cti_op_div):
1080 (JSC::Machine::cti_op_pre_dec):
1081 (JSC::Machine::cti_op_jless):
1082 (JSC::Machine::cti_op_not):
1083 (JSC::Machine::cti_op_jtrue):
1084 (JSC::Machine::cti_op_post_inc):
1085 (JSC::Machine::cti_op_eq):
1086 (JSC::Machine::cti_op_lshift):
1087 (JSC::Machine::cti_op_bitand):
1088 (JSC::Machine::cti_op_rshift):
1089 (JSC::Machine::cti_op_bitnot):
1090 (JSC::Machine::cti_op_resolve_with_base):
1091 (JSC::Machine::cti_op_new_func_exp):
1092 (JSC::Machine::cti_op_mod):
1093 (JSC::Machine::cti_op_less):
1094 (JSC::Machine::cti_op_neq):
1095 (JSC::Machine::cti_op_post_dec):
1096 (JSC::Machine::cti_op_urshift):
1097 (JSC::Machine::cti_op_bitxor):
1098 (JSC::Machine::cti_op_new_regexp):
1099 (JSC::Machine::cti_op_bitor):
1100 (JSC::Machine::cti_op_call_eval):
1101 (JSC::Machine::cti_op_throw):
1102 (JSC::Machine::cti_op_get_pnames):
1103 (JSC::Machine::cti_op_next_pname):
1104 (JSC::Machine::cti_op_push_scope):
1105 (JSC::Machine::cti_op_pop_scope):
1106 (JSC::Machine::cti_op_typeof):
1107 (JSC::Machine::cti_op_to_jsnumber):
1108 (JSC::Machine::cti_op_in):
1109 (JSC::Machine::cti_op_push_new_scope):
1110 (JSC::Machine::cti_op_jmp_scopes):
1111 (JSC::Machine::cti_op_put_by_index):
1112 (JSC::Machine::cti_op_switch_imm):
1113 (JSC::Machine::cti_op_switch_char):
1114 (JSC::Machine::cti_op_switch_string):
1115 (JSC::Machine::cti_op_del_by_val):
1116 (JSC::Machine::cti_op_put_getter):
1117 (JSC::Machine::cti_op_put_setter):
1118 (JSC::Machine::cti_op_new_error):
1119 (JSC::Machine::cti_op_debug):
1120 (JSC::Machine::cti_vm_throw):
1123 * VM/RegisterFile.h:
1125 * kjs/DebuggerCallFrame.cpp:
1126 (JSC::DebuggerCallFrame::functionName):
1127 (JSC::DebuggerCallFrame::type):
1128 (JSC::DebuggerCallFrame::thisObject):
1129 (JSC::DebuggerCallFrame::evaluate):
1130 * kjs/DebuggerCallFrame.h:
1131 * kjs/ExecState.cpp:
1132 (JSC::CallFrame::thisValue):
1134 * kjs/FunctionConstructor.cpp:
1135 (JSC::constructFunction):
1136 * kjs/JSActivation.cpp:
1137 (JSC::JSActivation::JSActivation):
1138 (JSC::JSActivation::argumentsGetter):
1139 * kjs/JSActivation.h:
1140 * kjs/JSGlobalObject.cpp:
1141 (JSC::JSGlobalObject::init):
1142 * kjs/JSGlobalObjectFunctions.cpp:
1143 (JSC::globalFuncEval):
1144 * kjs/JSVariableObject.h:
1146 (JSC::Parser::parse):
1147 * kjs/RegExpConstructor.cpp:
1148 (JSC::constructRegExp):
1149 * kjs/RegExpPrototype.cpp:
1150 (JSC::regExpProtoFuncCompile):
1152 (prettyPrintScript):
1153 * kjs/StringPrototype.cpp:
1154 (JSC::stringProtoFuncMatch):
1155 (JSC::stringProtoFuncSearch):
1156 * kjs/identifier.cpp:
1157 (JSC::Identifier::checkSameIdentifierTable):
1158 * kjs/interpreter.cpp:
1159 (JSC::Interpreter::checkSyntax):
1160 (JSC::Interpreter::evaluate):
1162 (JSC::ThrowableExpressionData::emitThrowError):
1163 (JSC::RegExpNode::emitCode):
1164 (JSC::ArrayNode::emitCode):
1165 (JSC::InstanceOfNode::emitCode):
1168 (JSC::RegExp::RegExp):
1169 (JSC::RegExp::create):
1171 * profiler/HeavyProfile.h:
1172 * profiler/Profile.h:
1176 2008-10-08 Mark Rowe <mrowe@apple.com>
1178 Typed by Maciej Stachowiak, reviewed by Mark Rowe.
1180 Fix crash in fast/js/constant-folding.html with CTI disabled.
1183 (JSC::Machine::privateExecute):
1185 2008-10-08 Timothy Hatcher <timothy@apple.com>
1187 Roll out r37427 because it causes an infinite recursion loading about:blank.
1189 https://bugs.webkit.org/show_bug.cgi?id=21476
1191 2008-10-08 Darin Adler <darin@apple.com>
1193 Reviewed by Cameron Zwarich.
1195 - https://bugs.webkit.org/show_bug.cgi?id=21403
1196 Bug 21403: use new CallFrame class rather than Register* for call frame manipulation
1198 Add CallFrame as a synonym for ExecState. Arguably, some day we should switch every
1199 client over to the new name.
1201 Use CallFrame* consistently rather than Register* or ExecState* in low-level code such
1202 as Machine.cpp and CTI.cpp. Similarly, use callFrame rather than r as its name and use
1203 accessor functions to get at things in the frame.
1205 Eliminate other uses of ExecState* that aren't needed, replacing in some cases with
1206 JSGlobalData* and in other cases eliminating them entirely.
1208 * API/JSObjectRef.cpp:
1209 (JSObjectMakeFunctionWithCallback):
1210 (JSObjectMakeFunction):
1211 (JSObjectHasProperty):
1212 (JSObjectGetProperty):
1213 (JSObjectSetProperty):
1214 (JSObjectDeleteProperty):
1215 * API/OpaqueJSString.cpp:
1216 * API/OpaqueJSString.h:
1218 (JSC::CTI::getConstant):
1219 (JSC::CTI::emitGetArg):
1220 (JSC::CTI::emitGetPutArg):
1221 (JSC::CTI::getConstantImmediateNumericArg):
1222 (JSC::CTI::printOpcodeOperandTypes):
1224 (JSC::CTI::compileOpCall):
1225 (JSC::CTI::compileBinaryArithOp):
1226 (JSC::CTI::privateCompileMainPass):
1227 (JSC::CTI::privateCompile):
1228 (JSC::CTI::privateCompileGetByIdProto):
1229 (JSC::CTI::privateCompileGetByIdChain):
1230 (JSC::CTI::compileRegExp):
1233 * VM/CodeGenerator.cpp:
1234 (JSC::CodeGenerator::emitEqualityOp):
1235 (JSC::CodeGenerator::emitLoad):
1236 (JSC::CodeGenerator::emitUnexpectedLoad):
1237 (JSC::CodeGenerator::emitConstruct):
1238 * VM/CodeGenerator.h:
1242 (JSC::jsAddSlowCase):
1244 (JSC::jsTypeStringForValue):
1245 (JSC::Machine::resolve):
1246 (JSC::Machine::resolveSkip):
1247 (JSC::Machine::resolveGlobal):
1248 (JSC::inlineResolveBase):
1249 (JSC::Machine::resolveBase):
1250 (JSC::Machine::resolveBaseAndProperty):
1251 (JSC::Machine::resolveBaseAndFunc):
1252 (JSC::Machine::slideRegisterWindowForCall):
1254 (JSC::Machine::callEval):
1255 (JSC::Machine::dumpCallFrame):
1256 (JSC::Machine::dumpRegisters):
1257 (JSC::Machine::unwindCallFrame):
1258 (JSC::Machine::throwException):
1259 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
1260 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
1261 (JSC::Machine::execute):
1262 (JSC::Machine::debug):
1263 (JSC::Machine::createExceptionScope):
1264 (JSC::cachePrototypeChain):
1265 (JSC::Machine::tryCachePutByID):
1266 (JSC::Machine::tryCacheGetByID):
1267 (JSC::Machine::privateExecute):
1268 (JSC::Machine::retrieveArguments):
1269 (JSC::Machine::retrieveCaller):
1270 (JSC::Machine::retrieveLastCaller):
1271 (JSC::Machine::findFunctionCallFrame):
1272 (JSC::Machine::getArgumentsData):
1273 (JSC::Machine::tryCTICachePutByID):
1274 (JSC::Machine::getCTIArrayLengthTrampoline):
1275 (JSC::Machine::getCTIStringLengthTrampoline):
1276 (JSC::Machine::tryCTICacheGetByID):
1277 (JSC::Machine::cti_op_convert_this):
1278 (JSC::Machine::cti_op_end):
1279 (JSC::Machine::cti_op_add):
1280 (JSC::Machine::cti_op_pre_inc):
1281 (JSC::Machine::cti_timeout_check):
1282 (JSC::Machine::cti_op_loop_if_less):
1283 (JSC::Machine::cti_op_loop_if_lesseq):
1284 (JSC::Machine::cti_op_new_object):
1285 (JSC::Machine::cti_op_put_by_id):
1286 (JSC::Machine::cti_op_put_by_id_second):
1287 (JSC::Machine::cti_op_put_by_id_generic):
1288 (JSC::Machine::cti_op_put_by_id_fail):
1289 (JSC::Machine::cti_op_get_by_id):
1290 (JSC::Machine::cti_op_get_by_id_second):
1291 (JSC::Machine::cti_op_get_by_id_generic):
1292 (JSC::Machine::cti_op_get_by_id_fail):
1293 (JSC::Machine::cti_op_instanceof):
1294 (JSC::Machine::cti_op_del_by_id):
1295 (JSC::Machine::cti_op_mul):
1296 (JSC::Machine::cti_op_new_func):
1297 (JSC::Machine::cti_op_call_JSFunction):
1298 (JSC::Machine::cti_vm_compile):
1299 (JSC::Machine::cti_op_push_activation):
1300 (JSC::Machine::cti_op_call_NotJSFunction):
1301 (JSC::Machine::cti_op_create_arguments):
1302 (JSC::Machine::cti_op_tear_off_activation):
1303 (JSC::Machine::cti_op_tear_off_arguments):
1304 (JSC::Machine::cti_op_ret_profiler):
1305 (JSC::Machine::cti_op_ret_scopeChain):
1306 (JSC::Machine::cti_op_new_array):
1307 (JSC::Machine::cti_op_resolve):
1308 (JSC::Machine::cti_op_construct_JSConstruct):
1309 (JSC::Machine::cti_op_construct_NotJSConstruct):
1310 (JSC::Machine::cti_op_get_by_val):
1311 (JSC::Machine::cti_op_resolve_func):
1312 (JSC::Machine::cti_op_sub):
1313 (JSC::Machine::cti_op_put_by_val):
1314 (JSC::Machine::cti_op_put_by_val_array):
1315 (JSC::Machine::cti_op_lesseq):
1316 (JSC::Machine::cti_op_loop_if_true):
1317 (JSC::Machine::cti_op_negate):
1318 (JSC::Machine::cti_op_resolve_base):
1319 (JSC::Machine::cti_op_resolve_skip):
1320 (JSC::Machine::cti_op_resolve_global):
1321 (JSC::Machine::cti_op_div):
1322 (JSC::Machine::cti_op_pre_dec):
1323 (JSC::Machine::cti_op_jless):
1324 (JSC::Machine::cti_op_not):
1325 (JSC::Machine::cti_op_jtrue):
1326 (JSC::Machine::cti_op_post_inc):
1327 (JSC::Machine::cti_op_eq):
1328 (JSC::Machine::cti_op_lshift):
1329 (JSC::Machine::cti_op_bitand):
1330 (JSC::Machine::cti_op_rshift):
1331 (JSC::Machine::cti_op_bitnot):
1332 (JSC::Machine::cti_op_resolve_with_base):
1333 (JSC::Machine::cti_op_new_func_exp):
1334 (JSC::Machine::cti_op_mod):
1335 (JSC::Machine::cti_op_less):
1336 (JSC::Machine::cti_op_neq):
1337 (JSC::Machine::cti_op_post_dec):
1338 (JSC::Machine::cti_op_urshift):
1339 (JSC::Machine::cti_op_bitxor):
1340 (JSC::Machine::cti_op_new_regexp):
1341 (JSC::Machine::cti_op_bitor):
1342 (JSC::Machine::cti_op_call_eval):
1343 (JSC::Machine::cti_op_throw):
1344 (JSC::Machine::cti_op_get_pnames):
1345 (JSC::Machine::cti_op_next_pname):
1346 (JSC::Machine::cti_op_push_scope):
1347 (JSC::Machine::cti_op_pop_scope):
1348 (JSC::Machine::cti_op_typeof):
1349 (JSC::Machine::cti_op_to_jsnumber):
1350 (JSC::Machine::cti_op_in):
1351 (JSC::Machine::cti_op_push_new_scope):
1352 (JSC::Machine::cti_op_jmp_scopes):
1353 (JSC::Machine::cti_op_put_by_index):
1354 (JSC::Machine::cti_op_switch_imm):
1355 (JSC::Machine::cti_op_switch_char):
1356 (JSC::Machine::cti_op_switch_string):
1357 (JSC::Machine::cti_op_del_by_val):
1358 (JSC::Machine::cti_op_put_getter):
1359 (JSC::Machine::cti_op_put_setter):
1360 (JSC::Machine::cti_op_new_error):
1361 (JSC::Machine::cti_op_debug):
1362 (JSC::Machine::cti_vm_throw):
1365 * VM/RegisterFile.h:
1367 * kjs/DebuggerCallFrame.cpp:
1368 (JSC::DebuggerCallFrame::functionName):
1369 (JSC::DebuggerCallFrame::type):
1370 (JSC::DebuggerCallFrame::thisObject):
1371 (JSC::DebuggerCallFrame::evaluate):
1372 * kjs/DebuggerCallFrame.h:
1373 * kjs/ExecState.cpp:
1374 (JSC::CallFrame::thisValue):
1376 * kjs/FunctionConstructor.cpp:
1377 (JSC::constructFunction):
1378 * kjs/JSActivation.cpp:
1379 (JSC::JSActivation::JSActivation):
1380 (JSC::JSActivation::argumentsGetter):
1381 * kjs/JSActivation.h:
1382 * kjs/JSGlobalObject.cpp:
1383 (JSC::JSGlobalObject::init):
1384 * kjs/JSGlobalObjectFunctions.cpp:
1385 (JSC::globalFuncEval):
1386 * kjs/JSVariableObject.h:
1388 (JSC::Parser::parse):
1389 * kjs/RegExpConstructor.cpp:
1390 (JSC::constructRegExp):
1391 * kjs/RegExpPrototype.cpp:
1392 (JSC::regExpProtoFuncCompile):
1394 (prettyPrintScript):
1395 * kjs/StringPrototype.cpp:
1396 (JSC::stringProtoFuncMatch):
1397 (JSC::stringProtoFuncSearch):
1398 * kjs/identifier.cpp:
1399 (JSC::Identifier::checkSameIdentifierTable):
1400 * kjs/interpreter.cpp:
1401 (JSC::Interpreter::checkSyntax):
1402 (JSC::Interpreter::evaluate):
1404 (JSC::ThrowableExpressionData::emitThrowError):
1405 (JSC::RegExpNode::emitCode):
1406 (JSC::ArrayNode::emitCode):
1407 (JSC::InstanceOfNode::emitCode):
1410 (JSC::RegExp::RegExp):
1411 (JSC::RegExp::create):
1413 * profiler/HeavyProfile.h:
1414 * profiler/Profile.h:
1418 2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
1420 Reviewed by Oliver Hunt.
1422 Avoid endless loops when compiling without the computed goto
1425 NEXT_OPCODE expands to "continue", which will not work inside
1429 (JSC::Machine::privateExecute):
1431 2008-10-08 Maciej Stachowiak <mjs@apple.com>
1433 Reviewed by Oliver Hunt.
1435 Re-landing the following fix with the crashing bug in it fixed (r37405):
1437 - optimize away multiplication by constant 1.0
1439 2.3% speedup on v8 RayTrace benchmark
1441 Apparently it's not uncommon for JavaScript code to multiply by
1442 constant 1.0 in the mistaken belief that this converts integer to
1443 floating point and that there is any operational difference.
1446 (JSC::CTI::privateCompileMainPass): Optimize to_jsnumber for
1447 case where parameter is already number.
1448 (JSC::CTI::privateCompileSlowCases): ditto
1450 (JSC::Machine::privateExecute): ditto
1452 (makeMultNode): Transform as follows:
1453 +FOO * BAR ==> FOO * BAR
1454 FOO * +BAR ==> FOO * BAR
1457 (makeDivNode): Transform as follows:
1458 +FOO / BAR ==> FOO / BAR
1459 FOO / +BAR ==> FOO / BAR
1460 (makeSubNode): Transform as follows:
1461 +FOO - BAR ==> FOO - BAR
1462 FOO - +BAR ==> FOO - BAR
1464 (JSC::ExpressionNode::stripUnaryPlus): Helper for above
1466 (JSC::UnaryPlusNode::stripUnaryPlus): ditto
1468 2008-10-08 Maciej Stachowiak <mjs@apple.com>
1470 Reviewed by Oliver Hunt.
1472 - correctly handle appending -0 to a string, it should stringify as just 0
1477 2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
1481 Fix WebKit compilation with VC2008SP1
1483 Apply the TR1 workaround for JavaScriptCore, too.
1485 * JavaScriptCore.pro:
1487 2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
1491 Fix compilation errors on VS2008 64Bit
1493 * kjs/collector.cpp:
1494 (JSC::currentThreadStackBase):
1496 2008-10-08 André Pönitz <apoenitz@trolltech.com>
1500 Fix compilation with Qt namespaces.
1504 2008-10-07 Sam Weinig <sam@webkit.org>
1508 2008-10-07 Oliver Hunt <oliver@apple.com>
1510 Reviewed by Cameron Zwarich.
1512 Switch CTI runtime calls to the fastcall calling convention
1514 Basically this means that we get to store the argument for CTI
1515 calls in the ECX register, which saves a register->memory write
1516 and subsequent memory->register read.
1518 This is a 1.7% progression in SunSpider and 2.4% on commandline
1523 (JSC::CTI::privateCompilePutByIdTransition):
1524 (JSC::CTI::privateCompilePatchGetArrayLength):
1527 * masm/X86Assembler.h:
1528 (JSC::X86Assembler::emitRestoreArgumentReference):
1529 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
1530 We need this to correctly reload ecx from inside certain property access
1534 2008-10-07 Maciej Stachowiak <mjs@apple.com>
1536 Reviewed by Mark Rowe.
1538 - optimize away multiplication by constant 1.0
1540 2.3% speedup on v8 RayTrace benchmark
1542 Apparently it's not uncommon for JavaScript code to multiply by
1543 constant 1.0 in the mistaken belief that this converts integer to
1544 floating point and that there is any operational difference.
1547 (JSC::CTI::privateCompileMainPass): Optimize to_jsnumber for
1548 case where parameter is already number.
1549 (JSC::CTI::privateCompileSlowCases): ditto
1551 (JSC::Machine::privateExecute): ditto
1553 (makeMultNode): Transform as follows:
1554 +FOO * BAR ==> FOO * BAR
1555 FOO * +BAR ==> FOO * BAR
1558 (makeDivNode): Transform as follows:
1559 +FOO / BAR ==> FOO / BAR
1560 FOO / +BAR ==> FOO / BAR
1561 (makeSubNode): Transform as follows:
1562 +FOO - BAR ==> FOO - BAR
1563 FOO - +BAR ==> FOO - BAR
1565 (JSC::ExpressionNode::stripUnaryPlus): Helper for above
1567 (JSC::UnaryPlusNode::stripUnaryPlus): ditto
1569 2008-10-07 Maciej Stachowiak <mjs@apple.com>
1571 Reviewed by Oliver Hunt.
1573 - make constant folding code more consistent
1575 Added a makeSubNode to match add, mult and div; use the makeFooNode functions always,
1576 instead of allocating nodes directly in other places in the grammar.
1580 2008-10-07 Sam Weinig <sam@webkit.org>
1582 Reviewed by Cameron Zwarich.
1584 Move hasGetterSetterProperties flag from PropertyMap to StructureID.
1587 (JSC::JSObject::put):
1588 (JSC::JSObject::defineGetter):
1589 (JSC::JSObject::defineSetter):
1591 (JSC::JSObject::hasGetterSetterProperties):
1592 (JSC::JSObject::getOwnPropertySlotForWrite):
1593 (JSC::JSObject::getOwnPropertySlot):
1594 * kjs/PropertyMap.h:
1595 * kjs/StructureID.cpp:
1596 (JSC::StructureID::StructureID):
1597 (JSC::StructureID::addPropertyTransition):
1598 (JSC::StructureID::toDictionaryTransition):
1599 (JSC::StructureID::changePrototypeTransition):
1600 (JSC::StructureID::getterSetterTransition):
1601 * kjs/StructureID.h:
1602 (JSC::StructureID::hasGetterSetterProperties):
1603 (JSC::StructureID::setHasGetterSetterProperties):
1605 2008-10-07 Sam Weinig <sam@webkit.org>
1607 Reviewed by Cameron Zwarich.
1609 Roll r37370 back in with bug fixes.
1611 - PropertyMap::storageSize() should reflect the number of keys + deletedOffsets
1612 and has nothing to do with the internal deletedSentinel count anymore.
1614 2008-10-07 Gavin Barraclough <barraclough@apple.com>
1616 Reviewed by Oliver Hunt.
1618 Move callframe initialization into JIT code, again.
1620 As a part of the restructuring the second result from functions is now
1621 returned in edx, allowing the new value of 'r' to be returned via a
1622 register, and stored to the stack from JIT code, too.
1624 4.5% progression on v8-tests. (3% in their harness)
1628 (JSC::CTI::emitCall):
1629 (JSC::CTI::compileOpCall):
1630 (JSC::CTI::privateCompileMainPass):
1631 (JSC::CTI::privateCompileSlowCases):
1632 (JSC::CTI::privateCompile):
1634 (JSC::CallRecord::CallRecord):
1636 (JSC::Machine::cti_op_call_JSFunction):
1637 (JSC::Machine::cti_op_construct_JSConstruct):
1638 (JSC::Machine::cti_op_resolve_func):
1639 (JSC::Machine::cti_op_post_inc):
1640 (JSC::Machine::cti_op_resolve_with_base):
1641 (JSC::Machine::cti_op_post_dec):
1646 2008-10-07 Mark Rowe <mrowe@apple.com>
1648 Fix typo in method name.
1653 2008-10-07 Cameron Zwarich <zwarich@apple.com>
1655 Rubber-stamped by Mark Rowe.
1659 2008-10-06 Sam Weinig <sam@webkit.org>
1661 Reviewed by Cameron Zwarich.
1663 Fix for https://bugs.webkit.org/show_bug.cgi?id=21415
1664 Improve the division between PropertyStorageArray and PropertyMap
1666 - Rework ProperyMap to store offsets in the value so that they don't
1667 change when rehashing. This allows us not to have to keep the
1668 PropertyStorageArray in sync and thus not have to pass it in.
1669 - Rename PropertyMap::getOffset -> PropertyMap::get since put/remove
1670 now also return offsets.
1671 - A Vector of deleted offsets is now needed since the storage is out of
1674 1% win on SunSpider. Wash on V8 suite.
1676 * JavaScriptCore.exp:
1678 (JSC::transitionWillNeedStorageRealloc):
1680 (JSC::Machine::privateExecute):
1681 Transition logic can be greatly simplified by the fact that
1682 the storage capacity is always known, and is correct for the
1685 (JSC::JSObject::put): Rename getOffset -> get.
1686 (JSC::JSObject::deleteProperty): Ditto.
1687 (JSC::JSObject::getPropertyAttributes): Ditto.
1688 (JSC::JSObject::removeDirect): Use returned offset to
1689 clear the value in the PropertyNameArray.
1690 (JSC::JSObject::allocatePropertyStorage): Add assert.
1692 (JSC::JSObject::getDirect): Rename getOffset -> get
1693 (JSC::JSObject::getDirectLocation): Rename getOffset -> get
1694 (JSC::JSObject::putDirect): Use propertyStorageCapacity to determine whether
1695 or not to resize. Also, since put now returns an offset (and thus
1696 addPropertyTransition does also) setting of the PropertyStorageArray is
1698 (JSC::JSObject::transitionTo):
1699 * kjs/PropertyMap.cpp:
1700 (JSC::PropertyMap::checkConsistency): PropertyStorageArray is no longer
1702 (JSC::PropertyMap::operator=): Copy the delete offsets vector.
1703 (JSC::PropertyMap::put): Instead of setting the PropertyNameArray
1704 explicitly, return the offset where the value should go.
1705 (JSC::PropertyMap::remove): Instead of removing from the PropertyNameArray
1706 explicitly, return the offset where the value should be removed.
1707 (JSC::PropertyMap::get): Switch to using the stored offset, instead
1708 of the implicit one.
1709 (JSC::PropertyMap::insert):
1710 (JSC::PropertyMap::expand): This is never called when m_table is null,
1711 so remove that branch and add it as an assertion.
1712 (JSC::PropertyMap::createTable): Consistency checks no longer take
1713 a PropertyNameArray.
1714 (JSC::PropertyMap::rehash): No need to rehash the PropertyNameArray
1715 now that it is completely out of band.
1716 * kjs/PropertyMap.h:
1717 (JSC::PropertyMapEntry::PropertyMapEntry): Store offset into PropertyNameArray.
1718 (JSC::PropertyMap::get): Switch to using the stored offset, instead
1719 of the implicit one.
1720 * kjs/StructureID.cpp:
1721 (JSC::StructureID::StructureID): Initialize the propertyStorageCapacity to
1722 JSObject::inlineStorageCapacity.
1723 (JSC::StructureID::growPropertyStorageCapacity): Grow the storage capacity as
1725 (JSC::StructureID::addPropertyTransition): Copy the storage capacity.
1726 (JSC::StructureID::toDictionaryTransition): Ditto.
1727 (JSC::StructureID::changePrototypeTransition): Ditto.
1728 (JSC::StructureID::getterSetterTransition): Ditto.
1729 * kjs/StructureID.h:
1730 (JSC::StructureID::propertyStorageCapacity): Add propertyStorageCapacity
1731 which is the current capacity for the JSObjects PropertyStorageArray.
1732 It starts at the JSObject::inlineStorageCapacity (currently 2), then
1733 when it first needs to be resized moves to the JSObject::nonInlineBaseStorageCapacity
1734 (currently 16), and after that doubles each time.
1736 2008-10-06 Cameron Zwarich <zwarich@apple.com>
1738 Reviewed by Oliver Hunt.
1740 Bug 21396: Remove the OptionalCalleeActivation call frame slot
1741 <https://bugs.webkit.org/show_bug.cgi?id=21396>
1743 Remove the OptionalCalleeActivation call frame slot. We have to be
1744 careful to store the activation object in a register, because objects
1745 in the scope chain do not get marked.
1747 This is a 0.3% speedup on both SunSpider and the V8 benchmark.
1750 (JSC::CTI::privateCompileMainPass):
1752 (JSC::CodeBlock::dump):
1753 * VM/CodeGenerator.cpp:
1754 (JSC::CodeGenerator::CodeGenerator):
1755 (JSC::CodeGenerator::emitReturn):
1756 * VM/CodeGenerator.h:
1758 (JSC::Machine::dumpRegisters):
1759 (JSC::Machine::unwindCallFrame):
1760 (JSC::Machine::privateExecute):
1761 (JSC::Machine::cti_op_call_JSFunction):
1762 (JSC::Machine::cti_op_push_activation):
1763 (JSC::Machine::cti_op_tear_off_activation):
1764 (JSC::Machine::cti_op_construct_JSConstruct):
1766 (JSC::Machine::initializeCallFrame):
1767 * VM/RegisterFile.h:
1768 (JSC::RegisterFile::):
1770 2008-10-06 Tony Chang <tony@chromium.org>
1772 Reviewed by Alexey Proskuryakov.
1774 Chromium doesn't use pthreads on windows, so make its use conditional.
1776 Also convert a WORD to a DWORD to avoid a compiler warning. This
1777 matches the other methods around it.
1779 * wtf/ThreadingWin.cpp:
1780 (WTF::wtfThreadEntryPoint):
1781 (WTF::ThreadCondition::broadcast):
1783 2008-10-06 Mark Mentovai <mark@moxienet.com>
1785 Reviewed by Tim Hatcher.
1787 Allow ENABLE_DASHBOARD_SUPPORT and ENABLE_MAC_JAVA_BRIDGE to be
1788 disabled on the Mac.
1790 https://bugs.webkit.org/show_bug.cgi?id=21333
1794 2008-10-06 Steve Falkenburg <sfalken@apple.com>
1796 https://bugs.webkit.org/show_bug.cgi?id=21416
1797 Pass 0 for size to VirtualAlloc, as documented by MSDN.
1798 Identified by Application Verifier.
1800 Reviewed by Darin Adler.
1802 * kjs/collector.cpp:
1805 2008-10-06 Kevin McCullough <kmccullough@apple.com>
1807 Reviewed by Tim Hatcheri and Oliver Hunt.
1809 https://bugs.webkit.org/show_bug.cgi?id=21412
1810 Bug 21412: Refactor user initiated profile count to be more stable
1811 - Export UString::from for use with creating the profile title.
1813 * JavaScriptCore.exp:
1815 2008-10-06 Maciej Stachowiak <mjs@apple.com>
1817 Not reviewed. Build fix.
1819 - revert toBoolean changes (r37333 and r37335); need to make WebCore work with these
1821 * API/JSValueRef.cpp:
1824 * JavaScriptCore.exp:
1826 (JSC::CodeBlock::dump):
1828 (JSC::Machine::privateExecute):
1829 (JSC::Machine::cti_op_loop_if_true):
1830 (JSC::Machine::cti_op_not):
1831 (JSC::Machine::cti_op_jtrue):
1832 * kjs/ArrayPrototype.cpp:
1833 (JSC::arrayProtoFuncFilter):
1834 (JSC::arrayProtoFuncEvery):
1835 (JSC::arrayProtoFuncSome):
1836 * kjs/BooleanConstructor.cpp:
1837 (JSC::constructBoolean):
1838 (JSC::callBooleanConstructor):
1839 * kjs/GetterSetter.h:
1841 (JSC::JSValue::toBoolean):
1842 * kjs/JSNumberCell.cpp:
1843 (JSC::JSNumberCell::toBoolean):
1844 * kjs/JSNumberCell.h:
1846 (JSC::JSObject::toBoolean):
1849 (JSC::JSString::toBoolean):
1852 * kjs/RegExpConstructor.cpp:
1853 (JSC::setRegExpConstructorMultiline):
1854 * kjs/RegExpObject.cpp:
1855 (JSC::RegExpObject::match):
1856 * kjs/RegExpPrototype.cpp:
1857 (JSC::regExpProtoFuncToString):
1859 2008-10-06 Maciej Stachowiak <mjs@apple.com>
1861 Reviewed by Sam Weinig.
1863 - optimize op_jtrue, op_loop_if_true and op_not in various ways
1864 https://bugs.webkit.org/show_bug.cgi?id=21404
1866 1) Make JSValue::toBoolean nonvirtual and completely inline by
1867 making use of the StructureID type field.
1869 2) Make JSValue::toBoolean not take an ExecState; doesn't need it.
1871 3) Make op_not, op_loop_if_true and op_jtrue not read the
1872 ExecState (toBoolean doesn't need it any more) and not check
1873 exceptions (toBoolean can't throw).
1875 * API/JSValueRef.cpp:
1877 * JavaScriptCore.exp:
1879 (JSC::CodeBlock::dump):
1881 (JSC::Machine::privateExecute):
1882 (JSC::Machine::cti_op_loop_if_true):
1883 (JSC::Machine::cti_op_not):
1884 (JSC::Machine::cti_op_jtrue):
1885 * kjs/ArrayPrototype.cpp:
1886 (JSC::arrayProtoFuncFilter):
1887 (JSC::arrayProtoFuncEvery):
1888 (JSC::arrayProtoFuncSome):
1889 * kjs/BooleanConstructor.cpp:
1890 (JSC::constructBoolean):
1891 (JSC::callBooleanConstructor):
1892 * kjs/GetterSetter.h:
1894 (JSC::JSValue::toBoolean):
1895 * kjs/JSNumberCell.cpp:
1896 * kjs/JSNumberCell.h:
1897 (JSC::JSNumberCell::toBoolean):
1900 (JSC::JSObject::toBoolean):
1901 (JSC::JSCell::toBoolean):
1904 (JSC::JSString::toBoolean):
1906 * kjs/RegExpConstructor.cpp:
1907 (JSC::setRegExpConstructorMultiline):
1908 * kjs/RegExpObject.cpp:
1909 (JSC::RegExpObject::match):
1910 * kjs/RegExpPrototype.cpp:
1911 (JSC::regExpProtoFuncToString):
1913 2008-10-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
1917 Build fix for MinGW.
1919 * JavaScriptCore.pri:
1921 (JSC::highResUpTime):
1923 2008-10-05 Cameron Zwarich <zwarich@apple.com>
1925 Reviewed by Oliver Hunt.
1927 Remove ScopeNode::containsClosures() now that it is unused.
1930 (JSC::ScopeNode::containsClosures):
1932 2008-10-05 Maciej Stachowiak <mjs@apple.com>
1934 Reviewed by Cameron Zwarich.
1936 - fix releas-only test failures caused by the fix to bug 21375
1939 (JSC::Machine::unwindCallFrame): Update ExecState while unwinding call frames;
1940 it now matters more to have a still-valid ExecState, since dynamicGlobalObject
1941 will make use of the ExecState's scope chain.
1944 2008-10-05 Cameron Zwarich <zwarich@apple.com>
1946 Reviewed by Oliver Hunt.
1948 Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
1949 <https://bugs.webkit.org/show_bug.cgi?id=21364>
1951 Use information from the parser to detect whether an activation is
1952 needed or 'arguments' is used, and emit explicit instructions to tear
1953 them off before op_ret. This allows a branch to be removed from op_ret
1954 and simplifies some other code. This does cause a small change in the
1955 behaviour of 'f.arguments'; it is no longer live when 'arguments' is not
1956 mentioned in the lexical scope of the function.
1958 It should now be easy to remove the OptionaCalleeActivation slot in the
1959 call frame, but this will be done in a later patch.
1962 (JSC::CTI::privateCompileMainPass):
1964 (JSC::CodeBlock::dump):
1965 * VM/CodeGenerator.cpp:
1966 (JSC::CodeGenerator::emitReturn):
1967 * VM/CodeGenerator.h:
1969 (JSC::Machine::unwindCallFrame):
1970 (JSC::Machine::privateExecute):
1971 (JSC::Machine::retrieveArguments):
1972 (JSC::Machine::cti_op_create_arguments):
1973 (JSC::Machine::cti_op_tear_off_activation):
1974 (JSC::Machine::cti_op_tear_off_arguments):
1977 * kjs/Arguments.cpp:
1978 (JSC::Arguments::mark):
1980 (JSC::Arguments::isTornOff):
1981 (JSC::Arguments::Arguments):
1982 (JSC::Arguments::copyRegisters):
1983 (JSC::JSActivation::copyRegisters):
1984 * kjs/JSActivation.cpp:
1985 (JSC::JSActivation::argumentsGetter):
1986 * kjs/JSActivation.h:
1988 2008-10-05 Maciej Stachowiak <mjs@apple.com>
1990 Reviewed by Oliver Hunt.
1992 - fixed "REGRESSION (r37297): fast/js/deep-recursion-test takes too long and times out"
1993 https://bugs.webkit.org/show_bug.cgi?id=21375
1995 The problem is that dynamicGlobalObject had become O(N) in number
1996 of call frames, but unwinding the stack for an exception called it
1997 for every call frame, resulting in O(N^2) behavior for an
1998 exception thrown from inside deep recursion.
2000 Instead of doing it that way, stash the dynamic global object in JSGlobalData.
2002 * JavaScriptCore.exp:
2004 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Helper class to temporarily
2005 store and later restore a dynamicGlobalObject in JSGlobalData.
2006 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
2007 (JSC::Machine::execute): In each version, establish a DynamicGlobalObjectScope.
2008 For ProgramNode, always establish set new dynamicGlobalObject, for FunctionBody and Eval,
2009 only if none is currently set.
2012 * kjs/JSGlobalData.cpp:
2013 (JSC::JSGlobalData::JSGlobalData): Ininitalize new dynamicGlobalObject field to 0.
2014 * kjs/JSGlobalData.h:
2015 * kjs/JSGlobalObject.h:
2016 (JSC::ExecState::dynamicGlobalObject): Moved here from ExecState for benefit of inlining.
2017 Return lexical global object if this is a globalExec(), otherwise look in JSGlobalData
2018 for the one stashed there.
2020 2008-10-05 Sam Weinig <sam@webkit.org>
2022 Reviewed by Maciej Stachowiak.
2024 Avoid an extra lookup when transitioning to an existing StructureID
2025 by caching the offset of property that caused the transition.
2027 1% win on V8 suite. Wash on SunSpider.
2029 * kjs/PropertyMap.cpp:
2030 (JSC::PropertyMap::put):
2031 * kjs/PropertyMap.h:
2032 * kjs/StructureID.cpp:
2033 (JSC::StructureID::StructureID):
2034 (JSC::StructureID::addPropertyTransition):
2035 * kjs/StructureID.h:
2036 (JSC::StructureID::setCachedTransistionOffset):
2037 (JSC::StructureID::cachedTransistionOffset):
2039 2008-10-05 Cameron Zwarich <zwarich@apple.com>
2041 Reviewed by Maciej Stachowiak.
2043 Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
2044 <https://bugs.webkit.org/show_bug.cgi?id=21364>
2046 This patch does not yet remove the branch, but it does a bit of refactoring
2047 so that a CodeGenerator now knows whether the associated CodeBlock will need
2048 a full scope before doing any code generation. This makes it possible to emit
2049 explicit tear-off instructions before every op_ret.
2052 (JSC::CodeBlock::CodeBlock):
2053 * VM/CodeGenerator.cpp:
2054 (JSC::CodeGenerator::generate):
2055 (JSC::CodeGenerator::CodeGenerator):
2056 (JSC::CodeGenerator::emitPushScope):
2057 (JSC::CodeGenerator::emitPushNewScope):
2059 (JSC::ScopeNode::needsActivation):
2061 2008-10-05 Gavin Barraclough <barraclough@apple.com>
2063 Reviewed by Cameron Zwarich.
2065 Fix for bug #21387 - using SamplingTool with CTI.
2067 (1) A repatch offset offset changes due to an additional instruction to update SamplingTool state.
2068 (2) Fix an incusion order problem due to ExecState changes.
2069 (3) Change to a MACHINE_SAMPLING macro, use of exec should now be accessing global data.
2072 (JSC::CTI::execute):
2073 * VM/SamplingTool.h:
2074 (JSC::SamplingTool::privateExecuteReturned):
2077 2008-10-04 Mark Rowe <mrowe@apple.com>
2079 Reviewed by Tim Hatcher.
2081 Add a 'Check For Weak VTables' build phase to catch weak vtables as early as possible.
2083 * JavaScriptCore.xcodeproj/project.pbxproj:
2085 2008-10-04 Sam Weinig <sam@webkit.org>
2087 Reviewed by Oliver Hunt.
2089 Fix https://bugs.webkit.org/show_bug.cgi?id=21320
2090 leaks of PropertyNameArrayData seen on buildbot
2092 - Fix RefPtr cycle by making PropertyNameArrayData's pointer back
2093 to the StructureID a weak pointer.
2095 * kjs/PropertyNameArray.h:
2096 (JSC::PropertyNameArrayData::setCachedStructureID):
2097 (JSC::PropertyNameArrayData::cachedStructureID):
2098 * kjs/StructureID.cpp:
2099 (JSC::StructureID::getEnumerablePropertyNames):
2100 (JSC::StructureID::clearEnumerationCache):
2101 (JSC::StructureID::~StructureID):
2103 2008-10-04 Darin Adler <darin@apple.com>
2105 Reviewed by Cameron Zwarich.
2107 - https://bugs.webkit.org/show_bug.cgi?id=21295
2108 Bug 21295: Replace ExecState with a call frame Register pointer
2110 10% faster on Richards; other v8 benchmarks faster too.
2111 A wash on SunSpider.
2113 This does the minimum necessary to get the speedup. Next step in
2114 cleaning this up is to replace ExecState with a CallFrame class,
2115 and be more judicious about when to pass a call frame and when
2116 to pass a global data pointer, global object pointer, or perhaps
2117 something else entirely.
2119 * VM/CTI.cpp: Remove the debug-only check of the exception in
2120 ctiVMThrowTrampoline -- already checked in the code the trampoline
2121 jumps to, so not all that useful. Removed the exec argument from
2122 ctiTrampoline. Removed emitDebugExceptionCheck -- no longer needed.
2123 (JSC::CTI::emitCall): Removed code to set ExecState::m_callFrame.
2124 (JSC::CTI::privateCompileMainPass): Removed code in catch to extract
2125 the exception from ExecState::m_exception; instead, the code that
2126 jumps into catch will make sure the exception is already in eax.
2127 * VM/CTI.h: Removed exec from the ctiTrampoline. Also removed the
2128 non-helpful "volatile". Temporarily left ARG_exec in as a synonym
2129 for ARG_r; I'll change that on a future cleanup pass when introducing
2130 more use of the CallFrame type.
2131 (JSC::CTI::execute): Removed the ExecState* argument.
2133 * VM/ExceptionHelpers.cpp:
2134 (JSC::InterruptedExecutionError::InterruptedExecutionError): Take
2135 JSGlobalData* instead of ExecState*.
2136 (JSC::createInterruptedExecutionException): Ditto.
2137 * VM/ExceptionHelpers.h: Ditto. Also removed an unneeded include.
2140 (JSC::slideRegisterWindowForCall): Removed the exec and
2141 exceptionValue arguments. Changed to return 0 when there's a stack
2142 overflow rather than using a separate exception argument to cut
2143 down on memory accesses in the calling convention.
2144 (JSC::Machine::unwindCallFrame): Removed the exec argument when
2145 constructing a DebuggerCallFrame. Also removed code to set
2146 ExecState::m_callFrame.
2147 (JSC::Machine::throwException): Removed the exec argument when
2148 construction a DebuggerCallFrame.
2149 (JSC::Machine::execute): Updated to use the register instead of
2150 ExecState and also removed various uses of ExecState.
2151 (JSC::Machine::debug):
2152 (JSC::Machine::privateExecute): Put globalData into a local
2153 variable so it can be used throughout the interpreter. Changed
2154 the VM_CHECK_EXCEPTION to get the exception in globalData instead
2155 of through ExecState.
2156 (JSC::Machine::retrieveLastCaller): Turn exec into a registers
2157 pointer by calling registers() instead of by getting m_callFrame.
2158 (JSC::Machine::callFrame): Ditto.
2159 Tweaked exception macros. Made new versions for when you know
2160 you have an exception. Get at global exception with ARG_globalData.
2161 Got rid of the need to pass in the return value type.
2162 (JSC::Machine::cti_op_add): Update to use new version of exception
2164 (JSC::Machine::cti_op_pre_inc): Ditto.
2165 (JSC::Machine::cti_timeout_check): Ditto.
2166 (JSC::Machine::cti_op_instanceof): Ditto.
2167 (JSC::Machine::cti_op_new_func): Ditto.
2168 (JSC::Machine::cti_op_call_JSFunction): Optimized by using the
2169 ARG values directly instead of through local variables -- this gets
2170 rid of code that just shuffles things around in the stack frame.
2171 Also get rid of ExecState and update for the new way exceptions are
2172 handled in slideRegisterWindowForCall.
2173 (JSC::Machine::cti_vm_compile): Update to make exec out of r since
2174 they are both the same thing now.
2175 (JSC::Machine::cti_op_call_NotJSFunction): Ditto.
2176 (JSC::Machine::cti_op_init_arguments): Ditto.
2177 (JSC::Machine::cti_op_resolve): Ditto.
2178 (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
2179 (JSC::Machine::cti_op_construct_NotJSConstruct): Ditto.
2180 (JSC::Machine::cti_op_resolve_func): Ditto.
2181 (JSC::Machine::cti_op_put_by_val): Ditto.
2182 (JSC::Machine::cti_op_put_by_val_array): Ditto.
2183 (JSC::Machine::cti_op_resolve_skip): Ditto.
2184 (JSC::Machine::cti_op_resolve_global): Ditto.
2185 (JSC::Machine::cti_op_post_inc): Ditto.
2186 (JSC::Machine::cti_op_resolve_with_base): Ditto.
2187 (JSC::Machine::cti_op_post_dec): Ditto.
2188 (JSC::Machine::cti_op_call_eval): Ditto.
2189 (JSC::Machine::cti_op_throw): Ditto. Also rearranged to return
2190 the exception value as the return value so it can be used by
2192 (JSC::Machine::cti_op_push_scope): Ditto.
2193 (JSC::Machine::cti_op_in): Ditto.
2194 (JSC::Machine::cti_op_del_by_val): Ditto.
2195 (JSC::Machine::cti_vm_throw): Ditto. Also rearranged to return
2196 the exception value as the return value so it can be used by
2199 * kjs/DebuggerCallFrame.cpp:
2200 (JSC::DebuggerCallFrame::functionName): Pass globalData.
2201 (JSC::DebuggerCallFrame::evaluate): Eliminated code to make a
2203 * kjs/DebuggerCallFrame.h: Removed ExecState argument from
2206 * kjs/ExecState.h: Eliminated all data members and made ExecState
2207 inherit privately from Register instead. Also added a typedef to
2208 the future name for this class, which is CallFrame. It's just a
2209 Register* that knows it's a pointer at a call frame. The new class
2210 can't be constructed or copied. Changed all functions to use
2211 the this pointer instead of m_callFrame. Changed exception-related
2212 functions to access an exception in JSGlobalData. Removed functions
2213 used by CTI to pass the return address to the throw machinery --
2214 this is now done directly with a global in the global data.
2216 * kjs/FunctionPrototype.cpp:
2217 (JSC::functionProtoFuncToString): Pass globalData instead of exec.
2219 * kjs/InternalFunction.cpp:
2220 (JSC::InternalFunction::name): Take globalData instead of exec.
2221 * kjs/InternalFunction.h: Ditto.
2223 * kjs/JSGlobalData.cpp: Initialize the new exception global to 0.
2224 * kjs/JSGlobalData.h: Declare two new globals. One for the current
2225 exception and another for the return address used by CTI to
2226 implement the throw operation.
2228 * kjs/JSGlobalObject.cpp:
2229 (JSC::JSGlobalObject::init): Removed code to set up globalExec,
2230 which is now the same thing as globalCallFrame.
2231 (JSC::JSGlobalObject::reset): Get globalExec from our globalExec
2232 function so we don't have to repeat the logic twice.
2233 (JSC::JSGlobalObject::mark): Removed code to mark the exception;
2234 the exception is now stored in JSGlobalData and marked there.
2235 (JSC::JSGlobalObject::globalExec): Return a pointer to the end
2236 of the global call frame.
2237 * kjs/JSGlobalObject.h: Removed the globalExec data member.
2240 (JSC::JSObject::putDirectFunction): Pass globalData instead of exec.
2242 * kjs/collector.cpp:
2243 (JSC::Heap::collect): Mark the global exception.
2245 * profiler/ProfileGenerator.cpp:
2246 (JSC::ProfileGenerator::addParentForConsoleStart): Pass globalData
2247 instead of exec to createCallIdentifier.
2249 * profiler/Profiler.cpp:
2250 (JSC::Profiler::willExecute): Pass globalData instead of exec to
2251 createCallIdentifier.
2252 (JSC::Profiler::didExecute): Ditto.
2253 (JSC::Profiler::createCallIdentifier): Take globalData instead of
2255 (JSC::createCallIdentifierFromFunctionImp): Ditto.
2256 * profiler/Profiler.h: Change interface to take a JSGlobalData
2257 instead of an ExecState.
2259 2008-10-04 Cameron Zwarich <zwarich@apple.com>
2261 Reviewed by Darin Adler.
2263 Bug 21369: Add opcode documentation for all undocumented opcodes
2264 <https://bugs.webkit.org/show_bug.cgi?id=21369>
2266 This patch adds opcode documentation for all undocumented opcodes, and
2267 it also renames op_init_arguments to op_create_arguments.
2270 (JSC::CTI::privateCompileMainPass):
2272 (JSC::CodeBlock::dump):
2273 * VM/CodeGenerator.cpp:
2274 (JSC::CodeGenerator::CodeGenerator):
2276 (JSC::Machine::privateExecute):
2277 (JSC::Machine::cti_op_create_arguments):
2281 2008-10-03 Maciej Stachowiak <mjs@apple.com>
2283 Reviewed by Cameron Zwarich.
2285 - "this" object in methods called on primitives should be wrapper object
2286 https://bugs.webkit.org/show_bug.cgi?id=21362
2288 I changed things so that functions which use "this" do a fast
2289 version of toThisObject conversion if needed. Currently we miss
2290 the conversion entirely, at least for primitive types. Using
2291 TypeInfo and the primitive check, I made the fast case bail out
2294 This is inexplicably an 1.007x SunSpider speedup (and a wash on V8 benchmarks).
2296 Also renamed some opcodes for clarity:
2299 init_activation ==> enter_with_activation
2302 (JSC::CTI::privateCompileMainPass):
2303 (JSC::CTI::privateCompileSlowCases):
2305 (JSC::CodeBlock::dump):
2306 * VM/CodeGenerator.cpp:
2307 (JSC::CodeGenerator::generate):
2308 (JSC::CodeGenerator::CodeGenerator):
2310 (JSC::Machine::privateExecute):
2311 (JSC::Machine::cti_op_convert_this):
2314 * kjs/JSActivation.cpp:
2315 (JSC::JSActivation::JSActivation):
2316 * kjs/JSActivation.h:
2317 (JSC::JSActivation::createStructureID):
2319 (JSC::JSValue::needsThisConversion):
2320 * kjs/JSGlobalData.cpp:
2321 (JSC::JSGlobalData::JSGlobalData):
2322 * kjs/JSGlobalData.h:
2323 * kjs/JSNumberCell.h:
2324 (JSC::JSNumberCell::createStructureID):
2325 * kjs/JSStaticScopeObject.h:
2326 (JSC::JSStaticScopeObject::JSStaticScopeObject):
2327 (JSC::JSStaticScopeObject::createStructureID):
2329 (JSC::JSString::createStructureID):
2332 (JSC::TypeInfo::needsThisConversion):
2334 (JSC::ScopeNode::usesThis):
2336 2008-10-03 Cameron Zwarich <zwarich@apple.com>
2338 Reviewed by Maciej Stachowiak.
2340 Bug 21356: The size of the RegisterFile differs depending on 32-bit / 64-bit and Debug / Release
2341 <https://bugs.webkit.org/show_bug.cgi?id=21356>
2343 The RegisterFile decreases in size (measured in terms of numbers of
2344 Registers) as the size of a Register increases. This causes
2346 js1_5/Regress/regress-159334.js
2348 to fail in 64-bit debug builds. This fix makes the RegisterFile on all
2349 platforms the same size that it is in 32-bit Release builds.
2351 * VM/RegisterFile.h:
2352 (JSC::RegisterFile::RegisterFile):
2354 2008-10-03 Maciej Stachowiak <mjs@apple.com>
2356 Reviewed by Cameron Zwarich.
2358 - Some code cleanup to how we handle code features.
2360 1) Rename FeatureInfo typedef to CodeFeatures.
2361 2) Rename NodeFeatureInfo template to NodeInfo.
2362 3) Keep CodeFeature bitmask in ScopeNode instead of trying to break it out into individual bools.
2363 4) Rename misleadingly named "needsClosure" method to "containsClosures", which better describes the meaning
2365 5) Make setUsersArguments() not take an argument since it only goes one way.
2367 * JavaScriptCore.exp:
2369 (JSC::CodeBlock::CodeBlock):
2372 (JSC::Parser::didFinishParsing):
2374 (JSC::Parser::parse):
2377 (JSC::ScopeNode::ScopeNode):
2378 (JSC::ProgramNode::ProgramNode):
2379 (JSC::ProgramNode::create):
2380 (JSC::EvalNode::EvalNode):
2381 (JSC::EvalNode::create):
2382 (JSC::FunctionBodyNode::FunctionBodyNode):
2383 (JSC::FunctionBodyNode::create):
2385 (JSC::ScopeNode::usesEval):
2386 (JSC::ScopeNode::containsClosures):
2387 (JSC::ScopeNode::usesArguments):
2388 (JSC::ScopeNode::setUsesArguments):
2390 2008-10-03 Cameron Zwarich <zwarich@apple.com>
2392 Reviewed by Maciej Stachowiak.
2394 Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
2395 <https://bugs.webkit.org/show_bug.cgi?id=21343>
2397 A fix was landed for this issue in r37253, and the ChangeLog assumes
2398 that it is a compiler bug, but it turns out that it is a subtle issue
2399 with mixing signed and unsigned 32-bit values in a 64-bit environment.
2400 In order to properly fix this bug, we should convert our signed offsets
2401 into the register file to use ptrdiff_t.
2403 This may not be the only instance of this issue, but I will land this
2404 fix first and look for more later.
2407 (JSC::Machine::getArgumentsData):
2409 * kjs/Arguments.cpp:
2410 (JSC::Arguments::getOwnPropertySlot):
2412 (JSC::Arguments::init):
2414 2008-10-03 Darin Adler <darin@apple.com>
2416 * VM/CTI.cpp: Another Windows build fix. Change the args of ctiTrampoline.
2418 * kjs/JSNumberCell.h: A build fix for newer versions of gcc. Added
2419 declarations of JSGlobalData overloads of jsNumberCell.
2421 2008-10-03 Darin Adler <darin@apple.com>
2423 - try to fix Windows build
2425 * kjs/ScopeChain.h: Add forward declaration of JSGlobalData.
2427 2008-10-03 Darin Adler <darin@apple.com>
2429 Reviewed by Geoff Garen.
2431 - next step of https://bugs.webkit.org/show_bug.cgi?id=21295
2432 Turn ExecState into a call frame pointer.
2434 Remove m_globalObject and m_globalData from ExecState.
2436 SunSpider says this is a wash (slightly faster but not statistically
2437 significant); which is good enough since it's a preparation step and
2438 not supposed to be a spedup.
2440 * API/JSCallbackFunction.cpp:
2441 (JSC::JSCallbackFunction::JSCallbackFunction):
2442 * kjs/ArrayConstructor.cpp:
2443 (JSC::ArrayConstructor::ArrayConstructor):
2444 * kjs/BooleanConstructor.cpp:
2445 (JSC::BooleanConstructor::BooleanConstructor):
2446 * kjs/DateConstructor.cpp:
2447 (JSC::DateConstructor::DateConstructor):
2448 * kjs/ErrorConstructor.cpp:
2449 (JSC::ErrorConstructor::ErrorConstructor):
2450 * kjs/FunctionPrototype.cpp:
2451 (JSC::FunctionPrototype::FunctionPrototype):
2452 * kjs/JSFunction.cpp:
2453 (JSC::JSFunction::JSFunction):
2454 * kjs/NativeErrorConstructor.cpp:
2455 (JSC::NativeErrorConstructor::NativeErrorConstructor):
2456 * kjs/NumberConstructor.cpp:
2457 (JSC::NumberConstructor::NumberConstructor):
2458 * kjs/ObjectConstructor.cpp:
2459 (JSC::ObjectConstructor::ObjectConstructor):
2460 * kjs/PrototypeFunction.cpp:
2461 (JSC::PrototypeFunction::PrototypeFunction):
2462 * kjs/RegExpConstructor.cpp:
2463 (JSC::RegExpConstructor::RegExpConstructor):
2464 * kjs/StringConstructor.cpp:
2465 (JSC::StringConstructor::StringConstructor):
2466 Pass JSGlobalData* instead of ExecState* to the InternalFunction
2469 * API/OpaqueJSString.cpp: Added now-needed include.
2471 * JavaScriptCore.exp: Updated.
2474 (JSC::CTI::emitSlowScriptCheck): Changed to use ARGS_globalData
2475 instead of ARGS_exec.
2477 * VM/CTI.h: Added a new argument to the CTI, the global data pointer.
2478 While it's possible to get to the global data pointer using the
2479 ExecState pointer, it's slow enough that it's better to just keep
2480 it around in the CTI arguments.
2482 * VM/CodeBlock.h: Moved the CodeType enum here from ExecState.h.
2485 (JSC::Machine::execute): Pass fewer arguments when constructing
2486 ExecState, and pass the global data pointer when invoking CTI.
2487 (JSC::Machine::firstCallFrame): Added. Used to get the dynamic global
2488 object, which is in the scope chain of the first call frame.
2489 (JSC::Machine::cti_op_add): Use globalData instead of exec when
2490 possible, to keep fast cases fast, since it's now more expensive to
2491 get to it through the exec pointer.
2492 (JSC::Machine::cti_timeout_check): Ditto.
2493 (JSC::Machine::cti_op_put_by_id_second): Ditto.
2494 (JSC::Machine::cti_op_get_by_id_second): Ditto.
2495 (JSC::Machine::cti_op_mul): Ditto.
2496 (JSC::Machine::cti_vm_compile): Ditto.
2497 (JSC::Machine::cti_op_get_by_val): Ditto.
2498 (JSC::Machine::cti_op_sub): Ditto.
2499 (JSC::Machine::cti_op_put_by_val): Ditto.
2500 (JSC::Machine::cti_op_put_by_val_array): Ditto.
2501 (JSC::Machine::cti_op_negate): Ditto.
2502 (JSC::Machine::cti_op_div): Ditto.
2503 (JSC::Machine::cti_op_pre_dec): Ditto.
2504 (JSC::Machine::cti_op_post_inc): Ditto.
2505 (JSC::Machine::cti_op_lshift): Ditto.
2506 (JSC::Machine::cti_op_bitand): Ditto.
2507 (JSC::Machine::cti_op_rshift): Ditto.
2508 (JSC::Machine::cti_op_bitnot): Ditto.
2509 (JSC::Machine::cti_op_mod): Ditto.
2510 (JSC::Machine::cti_op_post_dec): Ditto.
2511 (JSC::Machine::cti_op_urshift): Ditto.
2512 (JSC::Machine::cti_op_bitxor): Ditto.
2513 (JSC::Machine::cti_op_bitor): Ditto.
2514 (JSC::Machine::cti_op_call_eval): Ditto.
2515 (JSC::Machine::cti_op_throw): Ditto.
2516 (JSC::Machine::cti_op_is_string): Ditto.
2517 (JSC::Machine::cti_op_debug): Ditto.
2518 (JSC::Machine::cti_vm_throw): Ditto.
2520 * VM/Machine.h: Added firstCallFrame.
2522 * kjs/DebuggerCallFrame.cpp:
2523 (JSC::DebuggerCallFrame::evaluate): Pass fewer arguments when
2524 constructing ExecState.
2526 * kjs/ExecState.cpp: Deleted contents. Later we'll remove the
2529 * kjs/ExecState.h: Removed m_globalObject and m_globalData.
2530 Moved CodeType into another header.
2531 (JSC::ExecState::ExecState): Take only a single argument, a
2533 (JSC::ExecState::dynamicGlobalObject): Get the object from
2534 the first call frame since it's no longer stored.
2535 (JSC::ExecState::globalData): Get the global data from the
2536 scope chain, since we no longer store a pointer to it here.
2537 (JSC::ExecState::identifierTable): Ditto.
2538 (JSC::ExecState::propertyNames): Ditto.
2539 (JSC::ExecState::emptyList): Ditto.
2540 (JSC::ExecState::lexer): Ditto.
2541 (JSC::ExecState::parser): Ditto.
2542 (JSC::ExecState::machine): Ditto.
2543 (JSC::ExecState::arrayTable): Ditto.
2544 (JSC::ExecState::dateTable): Ditto.
2545 (JSC::ExecState::mathTable): Ditto.
2546 (JSC::ExecState::numberTable): Ditto.
2547 (JSC::ExecState::regExpTable): Ditto.
2548 (JSC::ExecState::regExpConstructorTable): Ditto.
2549 (JSC::ExecState::stringTable): Ditto.
2550 (JSC::ExecState::heap): Ditto.
2552 * kjs/FunctionConstructor.cpp:
2553 (JSC::FunctionConstructor::FunctionConstructor): Pass
2554 JSGlobalData* instead of ExecState* to the InternalFunction
2556 (JSC::constructFunction): Pass the global data pointer when
2557 constructing a new scope chain.
2559 * kjs/InternalFunction.cpp:
2560 (JSC::InternalFunction::InternalFunction): Take a JSGlobalData*
2561 instead of an ExecState*. Later we can change more places to
2562 work this way -- it's more efficient to take the type you need
2563 since the caller might already have it.
2564 * kjs/InternalFunction.h: Ditto.
2567 (JSC::JSCell::operator new): Added an overload that takes a
2568 JSGlobalData* so you can construct without an ExecState*.
2570 * kjs/JSGlobalObject.cpp:
2571 (JSC::JSGlobalObject::init): Moved creation of the global scope
2572 chain in here, since it now requires a pointer to the global data.
2573 Moved the initialization of the call frame in here since it requires
2574 the global scope chain node. Removed the extra argument to ExecState
2575 when creating the global ExecState*.
2576 * kjs/JSGlobalObject.h: Removed initialization of globalScopeChain
2577 and the call frame from the JSGlobalObjectData constructor. Added
2578 a thisValue argument to the init function.
2580 * kjs/JSNumberCell.cpp: Added versions of jsNumberCell that take
2581 JSGlobalData* rather than ExecState*.
2582 * kjs/JSNumberCell.h:
2583 (JSC::JSNumberCell::operator new): Added a version that takes
2585 (JSC::JSNumberCell::JSNumberCell): Ditto.
2586 (JSC::jsNumber): Ditto.
2588 (JSC::jsString): Ditto.
2589 (JSC::jsSubstring): Ditto.
2590 (JSC::jsOwnedString): Ditto.
2592 (JSC::JSString::JSString): Changed to take JSGlobalData*.
2593 (JSC::jsEmptyString): Added a version that takes JSGlobalData*.
2594 (JSC::jsSingleCharacterString): Ditto.
2595 (JSC::jsSingleCharacterSubstring): Ditto.
2596 (JSC::jsNontrivialString): Ditto.
2597 (JSC::JSString::getIndex): Ditto.
2598 (JSC::jsString): Ditto.
2599 (JSC::jsSubstring): Ditto.
2600 (JSC::jsOwnedString): Ditto.
2602 * kjs/ScopeChain.h: Added a globalData pointer to each node.
2603 (JSC::ScopeChainNode::ScopeChainNode): Initialize the globalData
2605 (JSC::ScopeChainNode::push): Set the global data pointer in the
2607 (JSC::ScopeChain::ScopeChain): Take a globalData argument.
2609 * kjs/SmallStrings.cpp:
2610 (JSC::SmallStrings::createEmptyString): Take JSGlobalData* instead of
2612 (JSC::SmallStrings::createSingleCharacterString): Ditto.
2613 * kjs/SmallStrings.h:
2614 (JSC::SmallStrings::emptyString): Ditto.
2615 (JSC::SmallStrings::singleCharacterString): Ditto.
2617 2008-10-03 Cameron Zwarich <zwarich@apple.com>
2619 Reviewed by Geoff Garen.
2621 Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
2622 <https://bugs.webkit.org/show_bug.cgi?id=21343>
2624 Add a workaround for a bug in GCC, which affects GCC 4.0, GCC 4.2, and
2625 llvm-gcc 4.2. I put it in an #ifdef because it was a slight regression
2626 on SunSpider in 32-bit, although that might be entirely random.
2628 * kjs/Arguments.cpp:
2629 (JSC::Arguments::getOwnPropertySlot):
2631 2008-10-03 Darin Adler <darin@apple.com>
2633 Rubber stamped by Alexey Proskuryakov.
2635 * kjs/Shell.cpp: (main): Don't delete JSGlobalData. Later, we need to change
2636 this tool to use public JavaScriptCore API instead.
2638 2008-10-03 Darin Adler <darin@apple.com>
2640 Suggested by Alexey Proskuryakov.
2642 * kjs/JSGlobalData.cpp:
2643 (JSC::JSGlobalData::~JSGlobalData): Remove call to heap.destroy() because
2644 it's too late to ref the JSGlobalData object once it's already being
2645 destroyed. In practice this is not a problem because WebCore's JSGlobalData
2646 is never destroyed and JSGlobalContextRelease takes care of calling
2647 heap.destroy() in advance.
2649 2008-10-02 Oliver Hunt <oliver@apple.com>
2651 Reviewed by Maciej Stachowiak.
2653 Replace SSE3 check with an SSE2 check, and implement SSE2 check on windows.
2655 5.6% win on SunSpider on windows.
2658 (JSC::isSSE2Present):
2659 (JSC::CTI::compileBinaryArithOp):
2660 (JSC::CTI::compileBinaryArithOpSlowCase):
2662 2008-10-03 Maciej Stachowiak <mjs@apple.com>
2664 Rubber stamped by Cameron Zwarich.
2666 - fix mistaken change of | to || which caused a big perf regression on EarleyBoyer
2670 2008-10-02 Darin Adler <darin@apple.com>
2672 Reviewed by Geoff Garen.
2674 - https://bugs.webkit.org/show_bug.cgi?id=21321
2675 Bug 21321: speed up JavaScriptCore by inlining Heap in JSGlobalData
2677 1.019x as fast on SunSpider.
2680 (JSEvaluateScript): Use heap. instead of heap-> to work with the heap.
2681 (JSCheckScriptSyntax): Ditto.
2682 (JSGarbageCollect): Ditto.
2683 (JSReportExtraMemoryCost): Ditto.
2684 * API/JSContextRef.cpp:
2685 (JSGlobalContextRetain): Ditto.
2686 (JSGlobalContextRelease): Destroy the heap with the destroy function instead
2687 of the delete operator.
2688 (JSContextGetGlobalObject): Use heap. instead of heap-> to work with the heap.
2689 * API/JSObjectRef.cpp:
2690 (JSObjectMake): Use heap. instead of heap-> to work with the heap.
2691 (JSObjectMakeFunctionWithCallback): Ditto.
2692 (JSObjectMakeConstructor): Ditto.
2693 (JSObjectMakeFunction): Ditto.
2694 (JSObjectMakeArray): Ditto.
2695 (JSObjectMakeDate): Ditto.
2696 (JSObjectMakeError): Ditto.
2697 (JSObjectMakeRegExp): Ditto.
2698 (JSObjectHasProperty): Ditto.
2699 (JSObjectGetProperty): Ditto.
2700 (JSObjectSetProperty): Ditto.
2701 (JSObjectGetPropertyAtIndex): Ditto.
2702 (JSObjectSetPropertyAtIndex): Ditto.
2703 (JSObjectDeleteProperty): Ditto.
2704 (JSObjectCallAsFunction): Ditto.
2705 (JSObjectCallAsConstructor): Ditto.
2706 (JSObjectCopyPropertyNames): Ditto.
2707 (JSPropertyNameAccumulatorAddName): Ditto.
2708 * API/JSValueRef.cpp:
2709 (JSValueIsEqual): Ditto.
2710 (JSValueIsInstanceOfConstructor): Ditto.
2711 (JSValueMakeNumber): Ditto.
2712 (JSValueMakeString): Ditto.
2713 (JSValueToNumber): Ditto.
2714 (JSValueToStringCopy): Ditto.
2715 (JSValueToObject): Ditto.
2716 (JSValueProtect): Ditto.
2717 (JSValueUnprotect): Ditto.
2720 (JSC::ExecState::heap): Update to use the & operator.
2722 * kjs/JSGlobalData.cpp:
2723 (JSC::JSGlobalData::JSGlobalData): Update to initialize a heap member
2724 instead of calling new to make a heap.
2725 (JSC::JSGlobalData::~JSGlobalData): Destroy the heap with the destroy
2726 function instead of the delete operator.
2727 * kjs/JSGlobalData.h: Change from Heap* to a Heap.
2728 * kjs/JSGlobalObject.cpp:
2729 (JSC::JSGlobalObject::mark): Use the & operator here.
2730 (JSC::JSGlobalObject::operator new): Use heap. instead of heap-> to work
2733 2008-10-02 Cameron Zwarich <zwarich@apple.com>
2735 Reviewed by Geoff Garen.
2737 Bug 21317: Replace RegisterFile size and capacity information with Register pointers
2738 <https://bugs.webkit.org/show_bug.cgi?id=21317>
2740 This is a 2.3% speedup on the V8 DeltaBlue benchmark, a 3.3% speedup on
2741 the V8 Raytrace benchmark, and a 1.0% speedup on SunSpider.
2744 (JSC::slideRegisterWindowForCall):
2745 (JSC::Machine::callEval):
2746 (JSC::Machine::execute):
2747 (JSC::Machine::privateExecute):
2748 (JSC::Machine::cti_op_call_JSFunction):
2749 (JSC::Machine::cti_op_construct_JSConstruct):
2750 * VM/RegisterFile.cpp:
2751 (JSC::RegisterFile::~RegisterFile):
2752 * VM/RegisterFile.h:
2753 (JSC::RegisterFile::RegisterFile):
2754 (JSC::RegisterFile::start):
2755 (JSC::RegisterFile::end):
2756 (JSC::RegisterFile::size):
2757 (JSC::RegisterFile::shrink):
2758 (JSC::RegisterFile::grow):
2759 (JSC::RegisterFile::lastGlobal):
2760 (JSC::RegisterFile::markGlobals):
2761 (JSC::RegisterFile::markCallFrames):
2762 * kjs/JSGlobalObject.cpp:
2763 (JSC::JSGlobalObject::copyGlobalsTo):
2765 2008-10-02 Cameron Zwarich <zwarich@apple.com>
2767 Rubber-stamped by Darin Adler.
2769 Change bitwise operations introduced in r37166 to boolean operations. We
2770 only use bitwise operations over boolean operations for increasing
2771 performance in extremely hot code, but that does not apply to anything
2776 2008-10-02 Gavin Barraclough <barraclough@apple.com>
2778 Reviewed by Darin Adler.
2780 Fix for bug #21232 - should reset m_isPendingDash on flush,
2781 and should allow '\-' as beginning or end of a range (though
2782 not to specifiy a range itself).
2785 * wrec/CharacterClassConstructor.cpp:
2786 (JSC::CharacterClassConstructor::put):
2787 (JSC::CharacterClassConstructor::flush):
2788 * wrec/CharacterClassConstructor.h:
2789 (JSC::CharacterClassConstructor::flushBeforeEscapedHyphen):
2791 (JSC::WRECGenerator::generateDisjunction):
2792 (JSC::WRECParser::parseCharacterClass):
2793 (JSC::WRECParser::parseDisjunction):
2796 2008-10-02 Darin Adler <darin@apple.com>
2798 Reviewed by Sam Weinig.
2800 - remove the "static" from declarations in a header file, since we
2801 don't want them to have internal linkage
2803 * VM/Machine.h: Remove the static keyword from the constant and the
2804 three inline functions that Geoff just moved here.
2806 2008-10-02 Geoffrey Garen <ggaren@apple.com>
2808 Reviewed by Sam Weinig.
2810 Fixed https://bugs.webkit.org/show_bug.cgi?id=21283.
2811 Profiler Crashes When Started
2815 (JSC::makeHostCallFramePointer):
2816 (JSC::isHostCallFrame):
2817 (JSC::stripHostCallFrameBit): Moved some things to the header so
2818 JSGlobalObject could use them.
2820 * kjs/JSGlobalObject.h:
2821 (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Call the
2822 new makeHostCallFramePointer API, since 0 no longer indicates a host
2825 2008-10-02 Alexey Proskuryakov <ap@webkit.org>
2827 Reviewed by Darin Adler.
2829 https://bugs.webkit.org/show_bug.cgi?id=21304
2830 Stop using a static wrapper map for WebCore JS bindings
2832 * kjs/JSGlobalData.cpp:
2833 (JSC::JSGlobalData::JSGlobalData):
2834 (JSC::JSGlobalData::~JSGlobalData):
2835 (JSC::JSGlobalData::ClientData::~ClientData):
2836 * kjs/JSGlobalData.h:
2837 Added a client data member to JSGlobalData. WebCore will use it to store bindings-related
2840 * JavaScriptCore.exp: Export virtual ClientData destructor.
2842 2008-10-02 Geoffrey Garen <ggaren@apple.com>
2846 Try to fix Qt build.
2850 2008-10-01 Geoffrey Garen <ggaren@apple.com>
2852 Reviewed by Darin Adler and Cameron Zwarich.
2854 Preliminary step toward dynamic recompilation: Standardized and
2855 simplified the parsing interface.
2857 The main goal in this patch is to make it easy to ask for a duplicate
2858 compilation, and get back a duplicate result -- same source URL, same
2859 debugger / profiler ID, same toString behavior, etc.
2861 The basic unit of compilation and evaluation is now SourceCode, which
2862 encompasses a SourceProvider, a range in that provider, and a starting
2865 A SourceProvider now encompasses a source URL, and *is* a source ID,
2866 since a pointer is a unique identifier.
2870 (JSCheckScriptSyntax): Provide a SourceCode to the Interpreter, since
2871 other APIs are no longer supported.
2874 (JSC::EvalCodeCache::get): Provide a SourceCode to the Interpreter, since
2875 other APIs are no longer supported.
2876 (JSC::CodeBlock::CodeBlock): ASSERT something that used to be ASSERTed
2877 by our caller -- this is a better bottleneck.
2879 * VM/CodeGenerator.cpp:
2880 (JSC::CodeGenerator::CodeGenerator): Updated for the fact that
2881 FunctionBodyNode's parameters are no longer a WTF::Vector.
2883 * kjs/Arguments.cpp:
2884 (JSC::Arguments::Arguments): ditto
2886 * kjs/DebuggerCallFrame.cpp:
2887 (JSC::DebuggerCallFrame::evaluate): Provide a SourceCode to the Parser,
2888 since other APIs are no longer supported.
2890 * kjs/FunctionConstructor.cpp:
2891 (JSC::constructFunction): Provide a SourceCode to the Parser, since
2892 other APIs are no longer supported. Adopt FunctionBodyNode's new
2893 "finishParsing" API.
2895 * kjs/JSFunction.cpp:
2896 (JSC::JSFunction::lengthGetter):
2897 (JSC::JSFunction::getParameterName): Updated for the fact that
2898 FunctionBodyNode's parameters are no longer a wtf::Vector.
2900 * kjs/JSFunction.h: Nixed some cruft.
2902 * kjs/JSGlobalObjectFunctions.cpp:
2903 (JSC::globalFuncEval): Provide a SourceCode to the Parser, since
2904 other APIs are no longer supported.
2907 (JSC::Parser::parse): Require a SourceCode argument, instead of a bunch
2908 of broken out parameters. Stop tracking sourceId as an integer, since we
2909 use the SourceProvider pointer for this now. Don't clamp the
2910 startingLineNumber, since SourceCode does that now.
2913 (JSC::Parser::parse): Standardized the parsing interface to require a
2919 (prettyPrintScript):
2921 (runInteractive): Provide a SourceCode to the Interpreter, since
2922 other APIs are no longer supported.
2924 * kjs/SourceProvider.h:
2925 (JSC::SourceProvider::SourceProvider):
2926 (JSC::SourceProvider::url):
2927 (JSC::SourceProvider::asId):
2928 (JSC::UStringSourceProvider::create):
2929 (JSC::UStringSourceProvider::UStringSourceProvider): Added new
2930 responsibilities described above.
2932 * kjs/SourceRange.h:
2933 (JSC::SourceCode::SourceCode):
2934 (JSC::SourceCode::toString):
2935 (JSC::SourceCode::provider):
2936 (JSC::SourceCode::firstLine):
2937 (JSC::SourceCode::data):
2938 (JSC::SourceCode::length): Added new responsibilities described above.
2939 Renamed SourceRange to SourceCode, based on review feedback. Added
2940 a makeSource function for convenience.
2942 * kjs/debugger.h: Provide a SourceCode to the client, since other APIs
2943 are no longer supported.
2945 * kjs/grammar.y: Provide startingLineNumber when creating a SourceCode.
2947 * kjs/debugger.h: Treat sourceId as intptr_t to avoid loss of precision
2950 * kjs/interpreter.cpp:
2951 (JSC::Interpreter::checkSyntax):
2952 (JSC::Interpreter::evaluate):
2953 * kjs/interpreter.h: Require a SourceCode instead of broken out arguments.
2956 (JSC::Lexer::setCode):
2958 (JSC::Lexer::sourceRange): Fold together the SourceProvider and line number
2959 into a SourceCode. Fixed a bug where the Lexer would accidentally keep
2960 alive the last SourceProvider forever.
2963 (JSC::ScopeNode::ScopeNode):
2964 (JSC::ProgramNode::ProgramNode):
2965 (JSC::ProgramNode::create):
2966 (JSC::EvalNode::EvalNode):
2967 (JSC::EvalNode::generateCode):
2968 (JSC::EvalNode::create):
2969 (JSC::FunctionBodyNode::FunctionBodyNode):
2970 (JSC::FunctionBodyNode::finishParsing):
2971 (JSC::FunctionBodyNode::create):
2972 (JSC::FunctionBodyNode::generateCode):
2973 (JSC::ProgramNode::generateCode):
2974 (JSC::FunctionBodyNode::paramString):
2977 (JSC::ScopeNode::sourceId):
2978 (JSC::FunctionBodyNode::):
2979 (JSC::FunctionBodyNode::parameterCount):
2980 (JSC::FuncExprNode::):
2981 (JSC::FuncDeclNode::): Store a SourceCode in all ScopeNodes, since
2982 SourceCode is now responsible for tracking URL, ID, etc. Streamlined
2983 some ad hoc FunctionBodyNode fixups into a "finishParsing" function, to
2984 help make clear what you need to do in order to finish parsing a
2988 (WTF::::releaseBuffer): Don't ASSERT that releaseBuffer() is only called
2989 when buffer is not 0, since FunctionBodyNode is more than happy
2990 to get back a 0 buffer, and other functions like RefPtr::release() allow
2993 2008-10-01 Cameron Zwarich <zwarich@apple.com>
2995 Reviewed by Maciej Stachowiak.
2997 Bug 21289: REGRESSION (r37160): Inspector crashes on load
2998 <https://bugs.webkit.org/show_bug.cgi?id=21289>
3000 The code in Arguments::mark() in r37160 was wrong. It marks indices in
3001 d->registers, but that makes no sense (they are local variables, not
3002 arguments). It should mark those indices in d->registerArray instead.
3004 This patch also changes Arguments::copyRegisters() to use d->numParameters
3005 instead of recomputing it.
3007 * kjs/Arguments.cpp:
3008 (JSC::Arguments::mark):
3010 (JSC::Arguments::copyRegisters):
3012 2008-09-30 Darin Adler <darin@apple.com>
3014 Reviewed by Eric Seidel.
3016 - https://bugs.webkit.org/show_bug.cgi?id=21214
3017 work on getting rid of ExecState
3019 Eliminate some unneeded uses of dynamicGlobalObject.
3021 * API/JSClassRef.cpp:
3022 (OpaqueJSClass::contextData): Changed to use a map in the global data instead
3023 of on the global object. Also fixed to use only a single hash table lookup.
3025 * API/JSObjectRef.cpp:
3026 (JSObjectMakeConstructor): Use lexicalGlobalObject rather than dynamicGlobalObject
3027 to get the object prototype.
3029 * kjs/ArrayPrototype.cpp:
3030 (JSC::arrayProtoFuncToString): Use arrayVisitedElements set in global data rather
3031 than in the global object.
3032 (JSC::arrayProtoFuncToLocaleString): Ditto.
3033 (JSC::arrayProtoFuncJoin): Ditto.
3035 * kjs/JSGlobalData.cpp:
3036 (JSC::JSGlobalData::JSGlobalData): Don't initialize opaqueJSClassData, since
3037 it's no longer a pointer.
3038 (JSC::JSGlobalData::~JSGlobalData): We still need to delete all the values, but
3039 we don't need to delete the map since it's no longer a pointer.
3041 * kjs/JSGlobalData.h: Made opaqueJSClassData a map instead of a pointer to a map.
3042 Also added arrayVisitedElements.
3044 * kjs/JSGlobalObject.h: Removed arrayVisitedElements.
3047 (functionRun): Use lexicalGlobalObject instead of dynamicGlobalObject.
3048 (functionLoad): Ditto.
3050 2008-10-01 Cameron Zwarich <zwarich@apple.com>
3054 Speculative Windows build fix.
3058 2008-10-01 Cameron Zwarich <zwarich@apple.com>
3060 Reviewed by Darin Adler.
3062 Bug 21123: using "arguments" in a function should not force creation of an activation object
3063 <https://bugs.webkit.org/show_bug.cgi?id=21123>
3065 Make the 'arguments' object not require a JSActivation. We store the
3066 'arguments' object in the OptionalCalleeArguments call frame slot. We
3067 need to be able to get the original 'arguments' object to tear it off
3068 when returning from a function, but 'arguments' may be assigned to in a
3071 Therefore, we use the OptionalCalleeArguments slot when we want to get
3072 the original activation or we know that 'arguments' was not assigned a
3073 different value. When 'arguments' may have been assigned a new value,
3074 we use a new local variable that is initialized with 'arguments'. Since
3075 a function parameter named 'arguments' may overwrite the value of
3076 'arguments', we also need to be careful to look up 'arguments' in the
3077 symbol table, so we get the parameter named 'arguments' instead of the
3078 local variable that we have added for holding the 'arguments' object.
3080 This is a 19.1% win on the V8 Raytrace benchmark using the SunSpider
3081 harness, and a 20.7% win using the V8 harness. This amounts to a 6.5%
3082 total speedup on the V8 benchmark suite using the V8 harness.
3085 (JSC::CTI::privateCompileMainPass):
3087 * VM/CodeGenerator.cpp:
3088 (JSC::CodeGenerator::CodeGenerator):
3090 (JSC::Machine::unwindCallFrame):
3091 (JSC::Machine::privateExecute):
3092 (JSC::Machine::retrieveArguments):
3093 (JSC::Machine::cti_op_init_arguments):
3094 (JSC::Machine::cti_op_ret_activation_arguments):
3096 * VM/RegisterFile.h:
3097 (JSC::RegisterFile::):
3098 * kjs/Arguments.cpp:
3099 (JSC::Arguments::mark):
3100 (JSC::Arguments::fillArgList):
3101 (JSC::Arguments::getOwnPropertySlot):
3102 (JSC::Arguments::put):
3104 (JSC::Arguments::setRegisters):
3105 (JSC::Arguments::init):
3106 (JSC::Arguments::Arguments):
3107 (JSC::Arguments::copyRegisters):
3108 (JSC::JSActivation::copyRegisters):
3109 * kjs/JSActivation.cpp:
3110 (JSC::JSActivation::argumentsGetter):
3111 * kjs/JSActivation.h:
3112 (JSC::JSActivation::JSActivationData::JSActivationData):
3115 (JSC::ScopeNode::setUsesArguments):
3116 * masm/X86Assembler.h:
3117 (JSC::X86Assembler::):
3118 (JSC::X86Assembler::orl_mr):
3120 2008-10-01 Kevin McCullough <kmccullough@apple.com>
3122 Rubberstamped by Geoff Garen.
3124 Remove BreakpointCheckStatement because it's not used anymore.
3125 No effect on sunspider or the jsc tests.
3130 2008-09-30 Oliver Hunt <oliver@apple.com>
3132 Reviewed by Geoff Garen.
3134 Improve performance of CTI on windows.
3136 Currently on platforms where the compiler doesn't allow us to safely
3137 index relative to the address of a parameter we need to actually
3138 provide a pointer to CTI runtime call arguments. This patch improves
3139 performance in this case by making the CTI logic for restoring this
3140 parameter much less conservative by only resetting it before we actually
3141 make a call, rather than between each and every SF bytecode we generate
3144 This results in a 3.6% progression on the v8 benchmark when compiled with MSVC.
3147 (JSC::CTI::emitCall):
3148 (JSC::CTI::compileOpCall):
3149 (JSC::CTI::privateCompileMainPass):
3150 (JSC::CTI::privateCompileSlowCases):
3151 (JSC::CTI::privateCompilePutByIdTransition):
3153 * masm/X86Assembler.h:
3156 2008-09-30 Maciej Stachowiak <mjs@apple.com>
3158 Reviewed by Oliver Hunt.
3160 - track uses of "this", "with" and "catch" in the parser
3162 Knowing this up front will be useful for future optimizations.
3164 Perf and correctness remain the same.
3169 2008-09-30 Sam Weinig <sam@webkit.org>
3171 Reviewed by Mark Rowe.
3173 Add WebKitAvailability macros for JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError,
3174 and JSObjectMakeRegExp
3176 * API/JSObjectRef.h:
3178 2008-09-30 Darin Adler <darin@apple.com>
3180 Reviewed by Geoff Garen.
3182 - https://bugs.webkit.org/show_bug.cgi?id=21214
3183 work on getting rid of ExecState
3185 Replaced the m_prev field of ExecState with a bit in the
3186 call frame pointer to indicate "host" call frames.
3189 (JSC::makeHostCallFramePointer): Added. Sets low bit.
3190 (JSC::isHostCallFrame): Added. Checks low bit.
3191 (JSC::stripHostCallFrameBit): Added. Clears low bit.
3192 (JSC::Machine::unwindCallFrame): Replaced null check that was
3193 formerly used to detect host call frames with an isHostCallFrame check.
3194 (JSC::Machine::execute): Pass in a host call frame pointer rather than
3195 always passing 0 when starting execution from the host. This allows us
3196 to follow the entire call frame pointer chain when desired, or to stop
3197 at the host calls when that's desired.
3198 (JSC::Machine::privateExecute): Replaced null check that was
3199 formerly used to detect host call frames with an isHostCallFrame check.
3200 (JSC::Machine::retrieveCaller): Ditto.
3201 (JSC::Machine::retrieveLastCaller): Ditto.
3202 (JSC::Machine::callFrame): Removed the code to walk up m_prev pointers
3203 and replaced it with code that uses the caller pointer and uses the
3204 stripHostCallFrameBit function.
3206 * kjs/ExecState.cpp: Removed m_prev.
3207 * kjs/ExecState.h: Ditto.
3209 2008-09-30 Cameron Zwarich <zwarich@apple.com>
3211 Reviewed by Geoff Garen.
3213 Move all detection of 'arguments' in a lexical scope to the parser, in
3214 preparation for fixing
3216 Bug 21123: using "arguments" in a function should not force creation of an activation object
3217 <https://bugs.webkit.org/show_bug.cgi?id=21123>
3219 * VM/CodeGenerator.cpp:
3220 (JSC::CodeGenerator::CodeGenerator):
3224 2008-09-30 Geoffrey Garen <ggaren@apple.com>
3229 (runWithScripts): Fixed indentation.
3231 2008-09-30 Mark Rowe <mrowe@apple.com>
3233 Rubber-stamped by Sam Weinig.
3235 Build fix. Move InternalFunction::classInfo implementation into the .cpp
3236 file to prevent the vtable for InternalFunction being generated as a weak symbol.
3237 Has no effect on SunSpider.
3239 * kjs/InternalFunction.cpp:
3240 (JSC::InternalFunction::classInfo):
3241 * kjs/InternalFunction.h:
3243 2008-09-29 Maciej Stachowiak <mjs@apple.com>
3245 Reviewed by Darin Adler.
3247 - optimize appending a number to a string
3248 https://bugs.webkit.org/show_bug.cgi?id=21203
3250 It's pretty common in real-world code (and on some of the v8
3251 benchmarks) to append a number to a string, so I made this one of
3252 the fast cases, and also added support to UString to do it
3253 directly without allocating a temporary UString.
3255 ~1% speedup on v8 benchmark.
3258 (JSC::jsAddSlowCase): Make this NEVER_INLINE because somehow otherwise
3259 the change is a regression.
3260 (JSC::jsAdd): Handle number + string special case.
3261 (JSC::Machine::cti_op_add): Integrate much of the logic of jsAdd to
3262 avoid exception check in the str + str, num + num and str + num cases.
3264 (JSC::expandedSize): Make this a non-member function, since it needs to be
3265 called in non-member functions but not outside this file.
3266 (JSC::expandCapacity): Ditto.
3267 (JSC::UString::expandCapacity): Call the non-member version.
3268 (JSC::createRep): Helper to make a rep from a char*.
3269 (JSC::UString::UString): Use above helper.
3270 (JSC::concatenate): Guts of concatenating constructor for cases where first
3271 item is a UString::Rep, and second is a UChar* and length, or a char*.
3272 (JSC::UString::append): Implement for cases where first item is a UString::Rep,
3273 and second is an int or double. Sadly duplicates logic of UString::from(int)
3274 and UString::from(double).
3277 2008-09-29 Darin Adler <darin@apple.com>
3279 Reviewed by Sam Weinig.
3281 - https://bugs.webkit.org/show_bug.cgi?id=21214
3282 work on getting rid of ExecState
3284 * JavaScriptCore.exp: Updated since JSGlobalObject::init
3285 no longer takes a parameter.
3288 (JSC::Machine::execute): Removed m_registerFile argument
3289 for ExecState constructors.
3291 * kjs/DebuggerCallFrame.cpp:
3292 (JSC::DebuggerCallFrame::evaluate): Removed globalThisValue
3293 argument for ExecState constructor.
3295 * kjs/ExecState.cpp:
3296 (JSC::ExecState::ExecState): Removed globalThisValue and
3297 registerFile arguments to constructors.
3299 * kjs/ExecState.h: Removed m_globalThisValue and
3300 m_registerFile data members.
3302 * kjs/JSGlobalObject.cpp:
3303 (JSC::JSGlobalObject::init): Removed globalThisValue
3304 argument for ExecState constructor.
3306 * kjs/JSGlobalObject.h:
3307 (JSC::JSGlobalObject::JSGlobalObject): Got rid of parameter
3308 for the init function.
3310 2008-09-29 Geoffrey Garen <ggaren@apple.com>
3312 Rubber-stamped by Cameron Zwarich.
3314 Fixed https://bugs.webkit.org/show_bug.cgi?id=21225
3315 Machine::retrieveLastCaller should check for a NULL codeBlock
3317 In order to crash, you would need to call retrieveCaller in a situation
3318 where you had two host call frames in a row in the register file. I
3319 don't know how to make that happen, or if it's even possible, so I don't
3320 have a test case -- but better safe than sorry!
3323 (JSC::Machine::retrieveLastCaller):
3325 2008-09-29 Geoffrey Garen <ggaren@apple.com>
3327 Reviewed by Cameron Zwarich.
3329 Store the callee ScopeChain, not the caller ScopeChain, in the call frame
3330 header. Nix the "scopeChain" local variable and ExecState::m_scopeChain, and
3331 access the callee ScopeChain through the call frame header instead.
3333 Profit: call + return are simpler, because they don't have to update the
3334 "scopeChain" local variable, or ExecState::m_scopeChain.
3336 Because CTI keeps "r" in a register, reading the callee ScopeChain relative
3337 to "r" can be very fast, in any cases we care to optimize.
3339 0% speedup on empty function call benchmark. (5.5% speedup in bytecode.)
3340 0% speedup on SunSpider. (7.5% speedup on controlflow-recursive.)
3341 2% speedup on SunSpider --v8.
3342 2% speedup on v8 benchmark.
3344 * VM/CTI.cpp: Changed scope chain access to read the scope chain from
3345 the call frame header. Sped up op_ret by changing it not to fuss with
3346 the "scopeChain" local variable or ExecState::m_scopeChain.
3348 * VM/CTI.h: Updated CTI trampolines not to take a ScopeChainNode*
3349 argument, since that's stored in the call frame header now.
3351 * VM/Machine.cpp: Access "scopeChain" and "codeBlock" through new helper
3352 functions that read from the call frame header. Updated functions operating
3353 on ExecState::m_callFrame to account for / take advantage of the fact that
3354 Exec:m_callFrame is now never NULL.
3356 Fixed a bug in op_construct, where it would use the caller's default
3357 object prototype, rather than the callee's, when constructing a new object.
3359 * VM/Machine.h: Made some helper functions available. Removed
3360 ScopeChainNode* arguments to a lot of functions, since the ScopeChainNode*
3361 is now stored in the call frame header.
3363 * VM/RegisterFile.h: Renamed "CallerScopeChain" to "ScopeChain", since
3364 that's what it is now.
3366 * kjs/DebuggerCallFrame.cpp: Updated for change to ExecState signature.
3368 * kjs/ExecState.cpp:
3369 * kjs/ExecState.h: Nixed ExecState::m_callFrame, along with the unused
3370 isGlobalObject function.
3372 * kjs/JSGlobalObject.cpp:
3373 * kjs/JSGlobalObject.h: Gave the global object a fake call frame in
3374 which to store the global scope chain, since our code now assumes that
3375 it can always read the scope chain out of the ExecState's call frame.
3377 2008-09-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3379 Reviewed by Sam Weinig.
3381 Remove the isActivationObject() virtual method on JSObject and use
3382 StructureID information instead. This should be slightly faster, but
3383 isActivationObject() is only used in assertions and unwinding the stack
3388 (JSC::Machine::unwindCallFrame):
3389 (JSC::Machine::privateExecute):
3390 (JSC::Machine::cti_op_ret_activation):
3391 * kjs/JSActivation.cpp:
3392 * kjs/JSActivation.h:
3395 2008-09-29 Peter Gal <galpeter@inf.u-szeged.hu>
3397 Reviewed and tweaked by Darin Adler.
3399 Fix build for non-all-in-one platforms.
3401 * kjs/StringPrototype.cpp: Added missing ASCIICType.h include.
3403 2008-09-29 Bradley T. Hughes <bradley.hughes@nokia.com>
3405 Reviewed by Simon Hausmann.
3407 Fix compilation with icpc
3413 2008-09-29 Thiago Macieira <thiago.macieira@nokia.com>
3415 Reviewed by Simon Hausmann.
3417 Changed copyright from Trolltech ASA to Nokia.
3419 Nokia acquired Trolltech ASA, assets were transferred on September 26th 2008.
3422 * wtf/qt/MainThreadQt.cpp:
3424 2008-09-29 Simon Hausmann <hausmann@webkit.org>
3426 Reviewed by Lars Knoll.
3428 Don't accidentially install libJavaScriptCore.a for the build inside
3431 * JavaScriptCore.pro:
3433 2008-09-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3435 Reviewed by Maciej Stachowiak.
3437 Bug 21200: Allow direct access to 'arguments' without using op_resolve
3438 <https://bugs.webkit.org/show_bug.cgi?id=21200>
3440 Allow fast access to the 'arguments' object by adding an extra slot to
3441 the callframe to store it.
3443 This is a 3.0% speedup on the V8 Raytrace benchmark.
3445 * JavaScriptCore.exp:
3447 (JSC::CTI::privateCompileMainPass):
3449 (JSC::CodeBlock::dump):
3450 * VM/CodeGenerator.cpp:
3451 (JSC::CodeGenerator::CodeGenerator):
3452 (JSC::CodeGenerator::registerFor):
3453 * VM/CodeGenerator.h:
3454 (JSC::CodeGenerator::registerFor):
3456 (JSC::Machine::initializeCallFrame):
3457 (JSC::Machine::dumpRegisters):
3458 (JSC::Machine::privateExecute):
3459 (JSC::Machine::retrieveArguments):
3460 (JSC::Machine::cti_op_call_JSFunction):
3461 (JSC::Machine::cti_op_create_arguments):
3462 (JSC::Machine::cti_op_construct_JSConstruct):
3465 * VM/RegisterFile.h:
3466 (JSC::RegisterFile::):
3467 * kjs/JSActivation.cpp:
3468 (JSC::JSActivation::mark):
3469 (JSC::JSActivation::argumentsGetter):
3470 * kjs/JSActivation.h:
3471 (JSC::JSActivation::JSActivationData::JSActivationData):
3474 (JSC::Parser::didFinishParsing):
3476 (JSC::Parser::parse):
3479 (JSC::ScopeNode::ScopeNode):
3480 (JSC::ProgramNode::ProgramNode):
3481 (JSC::ProgramNode::create):
3482 (JSC::EvalNode::EvalNode):
3483 (JSC::EvalNode::create):
3484 (JSC::FunctionBodyNode::FunctionBodyNode):
3485 (JSC::FunctionBodyNode::create):
3487 (JSC::ScopeNode::usesArguments):
3489 2008-09-28 Mark Rowe <mrowe@apple.com>
3491 Reviewed by Sam Weinig.
3493 Add an ASCII fast-path to toLowerCase and toUpperCase.
3495 The fast path speeds up the common case of an ASCII-only string by up to 60% while adding a less than 5% penalty
3496 to the less common non-ASCII case.
3498 This also removes stringProtoFuncToLocaleLowerCase and stringProtoFuncToLocaleUpperCase, which were identical
3499 to the non-locale variants of the functions. toLocaleLowerCase and toLocaleUpperCase now use the non-locale
3500 variants of the functions directly.
3502 * kjs/StringPrototype.cpp:
3503 (JSC::stringProtoFuncToLowerCase):
3504 (JSC::stringProtoFuncToUpperCase):
3506 2008-09-28 Mark Rowe <mrowe@apple.com>
3508 Reviewed by Cameron Zwarich.
3510 Speed up parseInt and parseFloat.
3512 Repeatedly indexing into a UString is slow, so retrieve a pointer into the underlying buffer once up front
3513 and use that instead. This is a 7% win on a parseInt/parseFloat micro-benchmark.
3515 * kjs/JSGlobalObjectFunctions.cpp:
3519 2008-09-28 Simon Hausmann <hausmann@webkit.org>
3521 Reviewed by David Hyatt.
3523 In Qt's initializeThreading re-use an existing thread identifier for the main
3524 thread if it exists.
3526 currentThread() implicitly creates new identifiers and it could be that
3527 it is called before initializeThreading().
3529 * wtf/ThreadingQt.cpp:
3530 (WTF::initializeThreading):
3532 2008-09-27 Keishi Hattori <casey.hattori@gmail.com>
3534 Added Machine::retrieveCaller to the export list.
3536 Reviewed by Kevin McCullough and Tim Hatcher.
3538 * JavaScriptCore.exp: Added Machine::retrieveCaller.
3540 2008-09-27 Anders Carlsson <andersca@apple.com>
3547 2008-09-27 Geoffrey Garen <ggaren@apple.com>
3549 Reviewed by Cameron Zwarich.
3551 https://bugs.webkit.org/show_bug.cgi?id=21175
3553 Store the callee CodeBlock, not the caller CodeBlock, in the call frame
3554 header. Nix the "codeBlock" local variable, and access the callee
3555 CodeBlock through the call frame header instead.
3557 Profit: call + return are simpler, because they don't have to update the
3558 "codeBlock" local variable.
3560 Because CTI keeps "r" in a register, reading the callee CodeBlock relative
3561 to "r" can be very fast, in any cases we care to optimize. Presently,
3562 no such cases seem important.
3564 Also, stop writing "dst" to the call frame header. CTI doesn't use it.
3566 21.6% speedup on empty function call benchmark.
3567 3.8% speedup on SunSpider --v8.
3568 2.1% speedup on v8 benchmark.
3569 0.7% speedup on SunSpider (6% speedup on controlflow-recursive).
3571 Small regression in bytecode, because currently every op_ret reads the
3572 callee CodeBlock to check needsFullScopeChain, and bytecode does not
3573 keep "r" in a register. On-balance, this is probably OK, since CTI is
3574 our high-performance execution model. Also, this should go away once
3575 we make needsFullScopeChain statically determinable at parse time.
3578 (JSC::CTI::compileOpCall): The speedup!
3579 (JSC::CTI::privateCompileSlowCases): ditto
3582 (JSC::): Fixed up magic trampoline constants to account for the nixed
3583 "codeBlock" argument.
3584 (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock"
3585 argument, since codeBlock is now stored in the call frame header.
3587 * VM/Machine.cpp: Read the callee CodeBlock from the register file. Use
3588 a NULL CallerRegisters in the call frame header to signal a built-in
3589 caller, since CodeBlock is now never NULL.
3591 * VM/Machine.h: Made some stand-alone functions Machine member functions