1 2008-10-17 Cameron Zwarich <zwarich@apple.com>
3 Reviewed by Maciej Stachowiak.
5 Remove some C style casts.
8 (JSC::JITCodeBuffer::putIntUnchecked):
9 (JSC::X86Assembler::link):
10 (JSC::X86Assembler::linkAbsoluteAddress):
11 (JSC::X86Assembler::getRelocatedAddress):
13 2008-10-17 Cameron Zwarich <zwarich@apple.com>
15 Rubber-stamped by Maciej Stachowiak.
17 Remove some C style casts.
20 (JSC::CTI::patchGetByIdSelf):
21 (JSC::CTI::patchPutByIdReplace):
23 (JSC::Machine::tryCTICachePutByID):
24 (JSC::Machine::tryCTICacheGetByID):
25 (JSC::Machine::cti_op_put_by_id):
26 (JSC::Machine::cti_op_put_by_id_fail):
27 (JSC::Machine::cti_op_get_by_id):
28 (JSC::Machine::cti_op_get_by_id_fail):
30 2008-10-17 Maciej Stachowiak <mjs@apple.com>
32 Reviewed by Cameron Zwarich.
34 - Avoid restoring the caller's 'r' value in op_ret
35 https://bugs.webkit.org/show_bug.cgi?id=21319
37 This patch stops writing the call frame at call and return points;
38 instead it does so immediately before any CTI call.
40 0.5% speedup or so on the v8 benchmark
43 (JSC::CTI::emitCTICall):
44 (JSC::CTI::compileOpCall):
45 (JSC::CTI::emitSlowScriptCheck):
46 (JSC::CTI::compileBinaryArithOpSlowCase):
47 (JSC::CTI::privateCompileMainPass):
48 (JSC::CTI::privateCompileSlowCases):
49 (JSC::CTI::privateCompile):
52 2008-10-17 Cameron Zwarich <zwarich@apple.com>
54 Reviewed by Sam Weinig.
56 Make WREC require CTI because it won't actually compile otherwise.
60 2008-10-16 Maciej Stachowiak <mjs@apple.com>
62 Reviewed by Geoff Garen.
64 - fixed <rdar://problem/5806316> JavaScriptCore should not force building with gcc 4.0
65 - use gcc 4.2 when building with Xcode 3.1 or newer on Leopard, even though this is not the default
67 This time there is no performance regression; we can avoid having
68 to use the fastcall calling convention for CTI functions by using
69 varargs to prevent the compiler from moving things around on the
72 * Configurations/DebugRelease.xcconfig:
73 * JavaScriptCore.xcodeproj/project.pbxproj:
78 2008-10-16 Maciej Stachowiak <mjs@apple.com>
80 Reviewed by Oliver Hunt.
82 - fix for REGRESSION: r37631 causing crashes on buildbot
83 https://bugs.webkit.org/show_bug.cgi?id=21682
86 (JSC::Heap::collect): Avoid crashing when a GC occurs while no global objects are live.
88 2008-10-16 Sam Weinig <sam@webkit.org>
90 Reviewed by Maciej Stachowiak.
92 Fix for https://bugs.webkit.org/show_bug.cgi?id=21683
93 Don't create intermediate StructureIDs for builtin objects
95 First step in reduce number of StructureIDs created when initializing the
98 - In order to avoid creating the intermediate StructureIDs use the new putDirectWithoutTransition
99 and putDirectFunctionWithoutTransition to add properties to JSObjects without transitioning
100 the StructureID. This patch just implements this strategy for ObjectPrototype but alone
101 reduces the number of StructureIDs create for about:blank by 10, from 142 to 132.
103 * kjs/JSGlobalObject.cpp:
104 (JSC::JSGlobalObject::reset):
106 (JSC::JSObject::putDirectFunctionWithoutTransition):
108 (JSC::JSObject::putDirectWithoutTransition):
109 * kjs/ObjectPrototype.cpp:
110 (JSC::ObjectPrototype::ObjectPrototype):
111 * kjs/ObjectPrototype.h:
112 * kjs/StructureID.cpp:
113 (JSC::StructureID::addPropertyWithoutTransition):
116 2008-10-16 Maciej Stachowiak <mjs@apple.com>
118 Reviewed by Cameron Zwarich.
120 - fix for: REGRESSION: over 100 StructureIDs leak loading about:blank (result of fix for bug 21633)
122 Apparent slight progression (< 0.5%) on v8 benchmarks and SunSpider.
124 * kjs/StructureID.cpp:
125 (JSC::StructureID::~StructureID): Don't deref this object's parent's pointer to
126 itself from the destructor; that doesn't even make sense.
127 (JSC::StructureID::addPropertyTransition): Don't refer the single transition;
128 the rule is that parent StructureIDs are ref'd but child ones are not. Refing
129 the child creates a cycle.
131 2008-10-15 Alexey Proskuryakov <ap@webkit.org>
133 Reviewed by Darin Adler.
135 https://bugs.webkit.org/show_bug.cgi?id=21609
136 Make MessagePorts protect their peers across heaps
138 * JavaScriptCore.exp:
139 * kjs/JSGlobalObject.cpp:
140 (JSC::JSGlobalObject::markCrossHeapDependentObjects):
141 * kjs/JSGlobalObject.h:
143 (JSC::Heap::collect):
144 Before GC sweep phase, a function supplied by global object is now called for all global
145 objects in the heap, making it possible to implement cross-heap dependencies.
147 2008-10-15 Alexey Proskuryakov <ap@webkit.org>
149 Reviewed by Darin Adler.
151 https://bugs.webkit.org/show_bug.cgi?id=21610
152 run-webkit-threads --threaded crashes in StructureID destructor
154 * kjs/StructureID.cpp:
155 (JSC::StructureID::StructureID):
156 (JSC::StructureID::~StructureID):
157 Protect access to a static (debug-only) HashSet with a lock.
159 2008-10-15 Sam Weinig <sam@webkit.org>
161 Reviewed by Goeffrey Garen.
163 Add function to dump statistics for StructureIDs.
165 * kjs/StructureID.cpp:
166 (JSC::StructureID::dumpStatistics):
167 (JSC::StructureID::StructureID):
168 (JSC::StructureID::~StructureID):
171 2008-10-15 Cameron Zwarich <zwarich@apple.com>
173 Reviewed by Maciej Stachowiak.
175 Bug 21633: Avoid using a HashMap when there is only a single transition
176 <https://bugs.webkit.org/show_bug.cgi?id=21633>
178 This is a 0.8% speedup on SunSpider and between a 0.5% and 1.0% speedup
179 on the V8 benchmark suite, depending on which harness we use. It will
180 also slightly reduce the memory footprint of a StructureID.
182 * kjs/StructureID.cpp:
183 (JSC::StructureID::StructureID):
184 (JSC::StructureID::~StructureID):
185 (JSC::StructureID::addPropertyTransition):
187 (JSC::StructureID::):
189 2008-10-15 Csaba Osztrogonac <oszi@inf.u-szeged.hu>
191 Reviewed by Geoffrey Garen.
193 1.40% speedup on SunSpider, 1.44% speedup on V8. (Linux)
198 (JSC::fastIsNumber): ALWAYS_INLINE modifier added.
200 2008-10-15 Geoffrey Garen <ggaren@apple.com>
202 Reviewed by Cameron Zwarich.
204 Fixed https://bugs.webkit.org/show_bug.cgi?id=21345
205 Start the debugger without reloading the inspected page
207 * JavaScriptCore.exp: New symbols.
208 * JavaScriptCore.xcodeproj/project.pbxproj: New files.
211 (JSC::EvalCodeCache::get): Updated for tweak to parsing API.
213 * kjs/CollectorHeapIterator.h: Added. An iterator for the object heap,
214 which we use to find all the live functions and recompile them.
216 * kjs/DebuggerCallFrame.cpp:
217 (JSC::DebuggerCallFrame::evaluate): Updated for tweak to parsing API.
219 * kjs/FunctionConstructor.cpp:
220 (JSC::constructFunction): Updated for tweak to parsing API.
222 * kjs/JSFunction.cpp:
223 (JSC::JSFunction::JSFunction): Try to validate our SourceCode in debug
224 builds by ASSERTing that it's syntactically valid. This doesn't catch
225 all SourceCode bugs, but it catches a lot of them.
227 * kjs/JSGlobalObjectFunctions.cpp:
228 (JSC::globalFuncEval): Updated for tweak to parsing API.
231 (JSC::Parser::parse):
233 (JSC::Parser::parse): Tweaked the parser to make it possible to parse
234 without an ExecState, and to allow the client to specify a debugger to
235 notify (or not) about the source we parse. This allows the inspector
236 to recompile even though no JavaScript is executing, then notify the
237 debugger about all source code when it's done.
240 (prettyPrintScript): Updated for tweak to parsing API.
243 (JSC::SourceCode::isNull): Added to help with ASSERTs.
246 (JSC::Heap::heapAllocate):
248 (JSC::Heap::primaryHeapBegin):
249 (JSC::Heap::primaryHeapEnd):
251 (JSC::): Moved a bunch of declarations around to enable compilation of
252 CollectorHeapIterator.
254 * kjs/interpreter.cpp:
255 (JSC::Interpreter::checkSyntax):
256 (JSC::Interpreter::evaluate): Updated for tweak to parsing API.
259 (JSC::Lexer::sourceCode): BUG FIX: Calculate SourceCode ranges relative
260 to the SourceCode range in which we're lexing, otherwise nested functions
261 that are compiled individually get SourceCode ranges that don't reflect
265 (JSC::FunctionBodyNode::FunctionBodyNode):
266 (JSC::FunctionBodyNode::finishParsing):
267 (JSC::FunctionBodyNode::create):
268 (JSC::FunctionBodyNode::copyParameters):
270 (JSC::ScopeNode::setSource):
271 (JSC::FunctionBodyNode::parameterCount): Added some helper functions for
272 copying one FunctionBodyNode's parameters to another. The recompiler uses
273 these when calling "finishParsing".
275 2008-10-15 Joerg Bornemann <joerg.bornemann@trolltech.com>
277 Reviewed by Darin Adler.
279 - part of https://bugs.webkit.org/show_bug.cgi?id=20746
280 Fix compilation on Windows CE.
282 str(n)icmp, strdup and vsnprintf are not available on Windows CE,
283 they are called _str(n)icmp, etc. instead
285 * wtf/StringExtras.h: Added inline function implementations.
287 2008-10-15 Gabor Loki <loki@inf.u-szeged.hu>
289 Reviewed by Cameron Zwarich.
291 <https://bugs.webkit.org/show_bug.cgi?id=20912>
292 Use simple uint32_t multiplication on op_mul if both operands are
293 immediate number and they are between zero and 0x7FFF.
296 (JSC::Machine::privateExecute):
298 2008-10-09 Darin Fisher <darin@chromium.org>
300 Reviewed by Sam Weinig.
302 Make pan scrolling a platform configurable option.
303 https://bugs.webkit.org/show_bug.cgi?id=21515
305 * wtf/Platform.h: Add ENABLE_PAN_SCROLLING
307 2008-10-14 Maciej Stachowiak <mjs@apple.com>
309 Rubber stamped by Sam Weinig.
311 - revert r37572 and r37581 for now
313 Turns out GCC 4.2 is still a (small) regression, we'll have to do
314 more work to turn it on.
316 * Configurations/DebugRelease.xcconfig:
317 * JavaScriptCore.xcodeproj/project.pbxproj:
321 (JSC::Machine::cti_op_convert_this):
322 (JSC::Machine::cti_op_end):
323 (JSC::Machine::cti_op_add):
324 (JSC::Machine::cti_op_pre_inc):
325 (JSC::Machine::cti_timeout_check):
326 (JSC::Machine::cti_register_file_check):
327 (JSC::Machine::cti_op_loop_if_less):
328 (JSC::Machine::cti_op_loop_if_lesseq):
329 (JSC::Machine::cti_op_new_object):
330 (JSC::Machine::cti_op_put_by_id):
331 (JSC::Machine::cti_op_put_by_id_second):
332 (JSC::Machine::cti_op_put_by_id_generic):
333 (JSC::Machine::cti_op_put_by_id_fail):
334 (JSC::Machine::cti_op_get_by_id):
335 (JSC::Machine::cti_op_get_by_id_second):
336 (JSC::Machine::cti_op_get_by_id_generic):
337 (JSC::Machine::cti_op_get_by_id_fail):
338 (JSC::Machine::cti_op_instanceof):
339 (JSC::Machine::cti_op_del_by_id):
340 (JSC::Machine::cti_op_mul):
341 (JSC::Machine::cti_op_new_func):
342 (JSC::Machine::cti_op_call_JSFunction):
343 (JSC::Machine::cti_vm_compile):
344 (JSC::Machine::cti_op_push_activation):
345 (JSC::Machine::cti_op_call_NotJSFunction):
346 (JSC::Machine::cti_op_create_arguments):
347 (JSC::Machine::cti_op_tear_off_activation):
348 (JSC::Machine::cti_op_tear_off_arguments):
349 (JSC::Machine::cti_op_ret_profiler):
350 (JSC::Machine::cti_op_ret_scopeChain):
351 (JSC::Machine::cti_op_new_array):
352 (JSC::Machine::cti_op_resolve):
353 (JSC::Machine::cti_op_construct_JSConstruct):
354 (JSC::Machine::cti_op_construct_NotJSConstruct):
355 (JSC::Machine::cti_op_get_by_val):
356 (JSC::Machine::cti_op_resolve_func):
357 (JSC::Machine::cti_op_sub):
358 (JSC::Machine::cti_op_put_by_val):
359 (JSC::Machine::cti_op_put_by_val_array):
360 (JSC::Machine::cti_op_lesseq):
361 (JSC::Machine::cti_op_loop_if_true):
362 (JSC::Machine::cti_op_negate):
363 (JSC::Machine::cti_op_resolve_base):
364 (JSC::Machine::cti_op_resolve_skip):
365 (JSC::Machine::cti_op_resolve_global):
366 (JSC::Machine::cti_op_div):
367 (JSC::Machine::cti_op_pre_dec):
368 (JSC::Machine::cti_op_jless):
369 (JSC::Machine::cti_op_not):
370 (JSC::Machine::cti_op_jtrue):
371 (JSC::Machine::cti_op_post_inc):
372 (JSC::Machine::cti_op_eq):
373 (JSC::Machine::cti_op_lshift):
374 (JSC::Machine::cti_op_bitand):
375 (JSC::Machine::cti_op_rshift):
376 (JSC::Machine::cti_op_bitnot):
377 (JSC::Machine::cti_op_resolve_with_base):
378 (JSC::Machine::cti_op_new_func_exp):
379 (JSC::Machine::cti_op_mod):
380 (JSC::Machine::cti_op_less):
381 (JSC::Machine::cti_op_neq):
382 (JSC::Machine::cti_op_post_dec):
383 (JSC::Machine::cti_op_urshift):
384 (JSC::Machine::cti_op_bitxor):
385 (JSC::Machine::cti_op_new_regexp):
386 (JSC::Machine::cti_op_bitor):
387 (JSC::Machine::cti_op_call_eval):
388 (JSC::Machine::cti_op_throw):
389 (JSC::Machine::cti_op_get_pnames):
390 (JSC::Machine::cti_op_next_pname):
391 (JSC::Machine::cti_op_push_scope):
392 (JSC::Machine::cti_op_pop_scope):
393 (JSC::Machine::cti_op_typeof):
394 (JSC::Machine::cti_op_is_undefined):
395 (JSC::Machine::cti_op_is_boolean):
396 (JSC::Machine::cti_op_is_number):
397 (JSC::Machine::cti_op_is_string):
398 (JSC::Machine::cti_op_is_object):
399 (JSC::Machine::cti_op_is_function):
400 (JSC::Machine::cti_op_stricteq):
401 (JSC::Machine::cti_op_nstricteq):
402 (JSC::Machine::cti_op_to_jsnumber):
403 (JSC::Machine::cti_op_in):
404 (JSC::Machine::cti_op_push_new_scope):
405 (JSC::Machine::cti_op_jmp_scopes):
406 (JSC::Machine::cti_op_put_by_index):
407 (JSC::Machine::cti_op_switch_imm):
408 (JSC::Machine::cti_op_switch_char):
409 (JSC::Machine::cti_op_switch_string):
410 (JSC::Machine::cti_op_del_by_val):
411 (JSC::Machine::cti_op_put_getter):
412 (JSC::Machine::cti_op_put_setter):
413 (JSC::Machine::cti_op_new_error):
414 (JSC::Machine::cti_op_debug):
415 (JSC::Machine::cti_vm_throw):
417 * masm/X86Assembler.h:
418 (JSC::X86Assembler::emitRestoreArgumentReference):
419 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
422 2008-10-14 Alexey Proskuryakov <ap@webkit.org>
424 Reviewed by Darin Adler.
426 https://bugs.webkit.org/show_bug.cgi?id=20256
427 Array.push and other standard methods disappear
429 * kjs/JSGlobalData.cpp:
430 (JSC::JSGlobalData::JSGlobalData):
431 (JSC::JSGlobalData::~JSGlobalData):
432 Don't use static hash tables even on platforms that don't enable JSC_MULTIPLE_THREADS -
433 these tables reference IdentifierTable, which is always per-GlobalData.
435 2008-10-14 Maciej Stachowiak <mjs@apple.com>
437 Reviewed by Cameron Zwarich.
439 - always use CTI_ARGUMENTS and CTI_ARGUMENTS_FASTCALL
441 This is a small regression for GCC 4.0, but simplifies the code
442 for future improvements and lets us focus on GCC 4.2+ and MSVC.
447 (JSC::Machine::cti_op_convert_this):
448 (JSC::Machine::cti_op_end):
449 (JSC::Machine::cti_op_add):
450 (JSC::Machine::cti_op_pre_inc):
451 (JSC::Machine::cti_timeout_check):
452 (JSC::Machine::cti_register_file_check):
453 (JSC::Machine::cti_op_loop_if_less):
454 (JSC::Machine::cti_op_loop_if_lesseq):
455 (JSC::Machine::cti_op_new_object):
456 (JSC::Machine::cti_op_put_by_id):
457 (JSC::Machine::cti_op_put_by_id_second):
458 (JSC::Machine::cti_op_put_by_id_generic):
459 (JSC::Machine::cti_op_put_by_id_fail):
460 (JSC::Machine::cti_op_get_by_id):
461 (JSC::Machine::cti_op_get_by_id_second):
462 (JSC::Machine::cti_op_get_by_id_generic):
463 (JSC::Machine::cti_op_get_by_id_fail):
464 (JSC::Machine::cti_op_instanceof):
465 (JSC::Machine::cti_op_del_by_id):
466 (JSC::Machine::cti_op_mul):
467 (JSC::Machine::cti_op_new_func):
468 (JSC::Machine::cti_op_call_JSFunction):
469 (JSC::Machine::cti_vm_compile):
470 (JSC::Machine::cti_op_push_activation):
471 (JSC::Machine::cti_op_call_NotJSFunction):
472 (JSC::Machine::cti_op_create_arguments):
473 (JSC::Machine::cti_op_tear_off_activation):
474 (JSC::Machine::cti_op_tear_off_arguments):
475 (JSC::Machine::cti_op_ret_profiler):
476 (JSC::Machine::cti_op_ret_scopeChain):
477 (JSC::Machine::cti_op_new_array):
478 (JSC::Machine::cti_op_resolve):
479 (JSC::Machine::cti_op_construct_JSConstruct):
480 (JSC::Machine::cti_op_construct_NotJSConstruct):
481 (JSC::Machine::cti_op_get_by_val):
482 (JSC::Machine::cti_op_resolve_func):
483 (JSC::Machine::cti_op_sub):
484 (JSC::Machine::cti_op_put_by_val):
485 (JSC::Machine::cti_op_put_by_val_array):
486 (JSC::Machine::cti_op_lesseq):
487 (JSC::Machine::cti_op_loop_if_true):
488 (JSC::Machine::cti_op_negate):
489 (JSC::Machine::cti_op_resolve_base):
490 (JSC::Machine::cti_op_resolve_skip):
491 (JSC::Machine::cti_op_resolve_global):
492 (JSC::Machine::cti_op_div):
493 (JSC::Machine::cti_op_pre_dec):
494 (JSC::Machine::cti_op_jless):
495 (JSC::Machine::cti_op_not):
496 (JSC::Machine::cti_op_jtrue):
497 (JSC::Machine::cti_op_post_inc):
498 (JSC::Machine::cti_op_eq):
499 (JSC::Machine::cti_op_lshift):
500 (JSC::Machine::cti_op_bitand):
501 (JSC::Machine::cti_op_rshift):
502 (JSC::Machine::cti_op_bitnot):
503 (JSC::Machine::cti_op_resolve_with_base):
504 (JSC::Machine::cti_op_new_func_exp):
505 (JSC::Machine::cti_op_mod):
506 (JSC::Machine::cti_op_less):
507 (JSC::Machine::cti_op_neq):
508 (JSC::Machine::cti_op_post_dec):
509 (JSC::Machine::cti_op_urshift):
510 (JSC::Machine::cti_op_bitxor):
511 (JSC::Machine::cti_op_new_regexp):
512 (JSC::Machine::cti_op_bitor):
513 (JSC::Machine::cti_op_call_eval):
514 (JSC::Machine::cti_op_throw):
515 (JSC::Machine::cti_op_get_pnames):
516 (JSC::Machine::cti_op_next_pname):
517 (JSC::Machine::cti_op_push_scope):
518 (JSC::Machine::cti_op_pop_scope):
519 (JSC::Machine::cti_op_typeof):
520 (JSC::Machine::cti_op_is_undefined):
521 (JSC::Machine::cti_op_is_boolean):
522 (JSC::Machine::cti_op_is_number):
523 (JSC::Machine::cti_op_is_string):
524 (JSC::Machine::cti_op_is_object):
525 (JSC::Machine::cti_op_is_function):
526 (JSC::Machine::cti_op_stricteq):
527 (JSC::Machine::cti_op_nstricteq):
528 (JSC::Machine::cti_op_to_jsnumber):
529 (JSC::Machine::cti_op_in):
530 (JSC::Machine::cti_op_push_new_scope):
531 (JSC::Machine::cti_op_jmp_scopes):
532 (JSC::Machine::cti_op_put_by_index):
533 (JSC::Machine::cti_op_switch_imm):
534 (JSC::Machine::cti_op_switch_char):
535 (JSC::Machine::cti_op_switch_string):
536 (JSC::Machine::cti_op_del_by_val):
537 (JSC::Machine::cti_op_put_getter):
538 (JSC::Machine::cti_op_put_setter):
539 (JSC::Machine::cti_op_new_error):
540 (JSC::Machine::cti_op_debug):
541 (JSC::Machine::cti_vm_throw):
543 * masm/X86Assembler.h:
544 (JSC::X86Assembler::emitRestoreArgumentReference):
545 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
548 2008-10-13 Maciej Stachowiak <mjs@apple.com>
550 Reviewed by Cameron Zwarich.
552 - make Machine::getArgumentsData an Arguments method and inline it
558 (JSC::Machine::getArgumentsData):
560 2008-10-13 Alp Toker <alp@nuanti.com>
562 Fix autotools dist build target by listing recently added header
563 files only. Not reviewed.
567 2008-10-13 Maciej Stachowiak <mjs@apple.com>
569 Rubber stamped by Mark Rowe.
571 - fixed <rdar://problem/5806316> JavaScriptCore should not force building with gcc 4.0
572 - use gcc 4.2 when building with Xcode 3.1 or newer on Leopard, even though this is not the default
574 * Configurations/DebugRelease.xcconfig:
575 * JavaScriptCore.xcodeproj/project.pbxproj:
577 2008-10-13 Cameron Zwarich <zwarich@apple.com>
579 Reviewed by Geoff Garen.
581 Bug 21541: Move RegisterFile growth check to callee
582 <https://bugs.webkit.org/show_bug.cgi?id=21541>
584 Move the RegisterFile growth check to the callee in the common case,
585 where some of the information is known statically at JIT time. There is
586 still a check in the caller in the case where the caller provides too
589 This is a 2.1% speedup on the V8 benchmark, including a 5.1% speedup on
590 the Richards benchmark, a 4.1% speedup on the DeltaBlue benchmark, and a
591 1.4% speedup on the Earley-Boyer benchmark. It is also a 0.5% speedup on
595 (JSC::CTI::privateCompile):
597 (JSC::Machine::cti_register_file_check):
598 (JSC::Machine::cti_op_call_JSFunction):
599 (JSC::Machine::cti_op_construct_JSConstruct):
602 * masm/X86Assembler.h:
603 (JSC::X86Assembler::):
604 (JSC::X86Assembler::cmpl_mr):
605 (JSC::X86Assembler::emitUnlinkedJg):
607 2008-10-13 Sam Weinig <sam@webkit.org>
609 Reviewed by Dan Bernstein.
611 Fix for https://bugs.webkit.org/show_bug.cgi?id=21577
612 5 false positive StructureID leaks
614 - Add leak ignore set to StructureID to selectively ignore leaking some StructureIDs.
615 - Add create method to JSGlolalData to be used when the data will be intentionally
616 leaked and ignore all leaks caused the StructureIDs stored in it.
618 * JavaScriptCore.exp:
619 * kjs/JSGlobalData.cpp:
620 (JSC::JSGlobalData::createLeaked):
621 * kjs/JSGlobalData.h:
622 * kjs/StructureID.cpp:
623 (JSC::StructureID::StructureID):
624 (JSC::StructureID::~StructureID):
625 (JSC::StructureID::startIgnoringLeaks):
626 (JSC::StructureID::stopIgnoringLeaks):
629 2008-10-13 Marco Barisione <marco.barisione@collabora.co.uk>
631 Reviewed by Darin Adler. Landed by Jan Alonzo.
633 WebKit GTK Port needs a smartpointer to handle g_free (GFreePtr?)
634 http://bugs.webkit.org/show_bug.cgi?id=20483
636 Add a GOwnPtr smart pointer (similar to OwnPtr) to handle memory
637 allocated by GLib and start the conversion to use it.
640 * wtf/GOwnPtr.cpp: Added.
647 * wtf/GOwnPtr.h: Added.
649 (WTF::GOwnPtr::GOwnPtr):
650 (WTF::GOwnPtr::~GOwnPtr):
652 (WTF::GOwnPtr::release):
653 (WTF::GOwnPtr::rawPtr):
655 (WTF::GOwnPtr::clear):
656 (WTF::GOwnPtr::operator*):
657 (WTF::GOwnPtr::operator->):
658 (WTF::GOwnPtr::operator!):
659 (WTF::GOwnPtr::operator UnspecifiedBoolType):
660 (WTF::GOwnPtr::swap):
666 * wtf/ThreadingGtk.cpp:
667 (WTF::Mutex::~Mutex):
669 (WTF::Mutex::tryLock):
670 (WTF::Mutex::unlock):
671 (WTF::ThreadCondition::~ThreadCondition):
672 (WTF::ThreadCondition::wait):
673 (WTF::ThreadCondition::timedWait):
674 (WTF::ThreadCondition::signal):
675 (WTF::ThreadCondition::broadcast):
677 2008-10-12 Gabriella Toth <gtoth@inf.u-szeged.hu>
679 Reviewed by Darin Adler.
681 - part of https://bugs.webkit.org/show_bug.cgi?id=21055
682 Bug 21055: not invoked functions
684 * kjs/nodes.cpp: Deleted a function that is not invoked:
685 statementListInitializeVariableAccessStack.
687 2008-10-12 Darin Adler <darin@apple.com>
689 Reviewed by Sam Weinig.
691 * wtf/unicode/icu/UnicodeIcu.h: Fixed indentation to match WebKit coding style.
692 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
694 2008-10-12 Darin Adler <darin@apple.com>
696 Reviewed by Sam Weinig.
698 - https://bugs.webkit.org/show_bug.cgi?id=21556
699 Bug 21556: non-ASCII digits are allowed in places where only ASCII should be
701 * wtf/unicode/icu/UnicodeIcu.h: Removed isDigit, digitValue, and isFormatChar.
702 * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
704 2008-10-12 Anders Carlsson <andersca@apple.com>
706 Reviewed by Darin Adler.
708 Make the append method that takes a Vector more strict - it now requires the elements
709 of the vector to be appended same type as the elements of the Vector they're being appended to.
711 This would cause problems when dealing with Vectors containing other Vectors.
716 2008-10-11 Cameron Zwarich <zwarich@apple.com>
718 Reviewed by Sam Weinig.
720 Clean up RegExpMatchesArray.h to match our coding style.
722 * kjs/RegExpMatchesArray.h:
723 (JSC::RegExpMatchesArray::getOwnPropertySlot):
724 (JSC::RegExpMatchesArray::put):
725 (JSC::RegExpMatchesArray::deleteProperty):
726 (JSC::RegExpMatchesArray::getPropertyNames):
728 2008-10-11 Cameron Zwarich <zwarich@apple.com>
730 Reviewed by Sam Weinig.
732 Bug 21525: 55 StructureID leaks on Wikitravel's main page
733 <https://bugs.webkit.org/show_bug.cgi?id=21525>
735 Bug 21533: Simple JavaScript code leaks StructureIDs
736 <https://bugs.webkit.org/show_bug.cgi?id=21533>
738 StructureID::getEnumerablePropertyNames() ends up calling back to itself
739 via JSObject::getPropertyNames(), which causes the PropertyNameArray to
740 be cached twice. This leads to a memory leak in almost every use of
741 JSObject::getPropertyNames() on an object. The fix here is based on a
742 suggestion of Sam Weinig.
744 This patch also fixes every StructureID leaks that occurs while running
745 the Mozilla MemBuster test.
747 * kjs/PropertyNameArray.h:
748 (JSC::PropertyNameArray::PropertyNameArray):
749 (JSC::PropertyNameArray::setCacheable):
750 (JSC::PropertyNameArray::cacheable):
751 * kjs/StructureID.cpp:
752 (JSC::StructureID::getEnumerablePropertyNames):
754 2008-10-10 Oliver Hunt <oliver@apple.com>
756 Reviewed by Cameron Zwarich.
758 Use fastcall calling convention on GCC > 4.0
760 Results in a 2-3% improvement in GCC 4.2 performance, so
761 that it is no longer a regression vs. GCC 4.0
767 2008-10-10 Sam Weinig <sam@webkit.org>
769 Reviewed by Darin Adler.
771 - Add a workaround for a bug in ceil in Darwin libc.
772 - Remove old workarounds for JS math functions that are not needed
775 The math functions are heavily tested by fast/js/math.html.
777 * kjs/MathObject.cpp:
778 (JSC::mathProtoFuncAbs): Remove workaround.
779 (JSC::mathProtoFuncCeil): Ditto.
780 (JSC::mathProtoFuncFloor): Ditto.
782 (wtf_ceil): Add ceil workaround for darwin.
784 2008-10-10 Sam Weinig <sam@webkit.org>
786 Reviewed by Darin Adler
788 Add Assertions to JSObject constructor.
791 (JSC::JSObject::JSObject):
793 2008-10-10 Sam Weinig <sam@webkit.org>
795 Reviewed by Cameron Zwarich.
797 Remove now unused m_getterSetterFlag variable from PropertyMap.
799 * kjs/PropertyMap.cpp:
800 (JSC::PropertyMap::operator=):
802 (JSC::PropertyMap::PropertyMap):
804 2008-10-09 Sam Weinig <sam@webkit.org>
806 Reviewed by Maciej Stachowiak.
808 Add leaks checking to StructureID.
810 * kjs/StructureID.cpp:
811 (JSC::StructureID::StructureID):
812 (JSC::StructureID::~StructureID):
814 2008-10-09 Alp Toker <alp@nuanti.com>
816 Reviewed by Mark Rowe.
818 https://bugs.webkit.org/show_bug.cgi?id=20760
819 Implement support for x86 Linux in CTI
821 Prepare to enable CTI/WREC on supported architectures.
823 Make it possible to use the CTI_ARGUMENT workaround with GCC as well
824 as MSVC by fixing some preprocessor conditionals.
826 Note that CTI/WREC no longer requires CTI_ARGUMENT on Linux so we
827 don't actually enable it except when building with MSVC. GCC on Win32
830 Adapt inline ASM code to use the global symbol underscore prefix only
831 on Darwin and to call the properly mangled Machine::cti_vm_throw
832 symbol name depending on CTI_ARGUMENT.
834 Also avoid global inclusion of the JIT infrastructure headers
835 throughout WebCore and WebKit causing recompilation of about ~1500
836 source files after modification to X86Assembler.h, CTI.h, WREC.h,
837 which are only used deep inside JavaScriptCore.
845 (JSC::RegExp::RegExp):
846 (JSC::RegExp::~RegExp):
847 (JSC::RegExp::match):
849 * masm/X86Assembler.h:
850 (JSC::X86Assembler::emitConvertToFastCall):
851 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
852 (JSC::X86Assembler::emitRestoreArgumentReference):
854 2008-10-09 Gavin Barraclough <barraclough@apple.com>
856 Reviewed by Cameron Zwarich.
858 Fix for bug #21160, x=0;1/(x*-1) == -Infinity
862 (JSC::CTI::emitFastArithDeTagImmediate):
863 (JSC::CTI::emitFastArithDeTagImmediateJumpIfZero):
864 (JSC::CTI::compileBinaryArithOp):
865 (JSC::CTI::compileBinaryArithOpSlowCase):
866 (JSC::CTI::privateCompileMainPass):
867 (JSC::CTI::privateCompileSlowCases):
869 * masm/X86Assembler.h:
870 (JSC::X86Assembler::):
871 (JSC::X86Assembler::emitUnlinkedJs):
873 2008-10-09 Cameron Zwarich <zwarich@apple.com>
875 Reviewed by Oliver Hunt.
877 Bug 21459: REGRESSION (r37324): Safari crashes inside JavaScriptCore while browsing hulu.com
878 <https://bugs.webkit.org/show_bug.cgi?id=21459>
880 After r37324, an Arguments object does not mark an associated activation
881 object. This change was made because Arguments no longer directly used
882 the activation object in any way. However, if an activation is torn off,
883 then the backing store of Arguments becomes the register array of the
884 activation object. Arguments directly marks all of the arguments, but
885 the activation object is being collected, which causes its register
886 array to be freed and new memory to be allocated in its place.
888 Unfortunately, it does not seem possible to reproduce this issue in a
892 (JSC::Arguments::mark):
894 (JSC::Arguments::setActivation):
895 (JSC::Arguments::Arguments):
896 (JSC::JSActivation::copyRegisters):
898 2008-10-09 Ariya Hidayat <ariya.hidayat@trolltech.com>
904 * wtf/AlwaysInline.h:
906 2008-10-08 Cameron Zwarich <zwarich@apple.com>
908 Reviewed by Maciej Stachowiak.
910 Bug 21497: REGRESSION (r37433): Bytecode JSC tests are severely broken
911 <https://bugs.webkit.org/show_bug.cgi?id=21497>
913 Fix a typo in r37433 that causes the failure of a large number of JSC
914 tests with the bytecode interpreter enabled.
917 (JSC::Machine::privateExecute):
919 2008-10-08 Mark Rowe <mrowe@apple.com>
924 (JSC::): Update type of argument to ctiTrampoline.
926 2008-10-08 Darin Adler <darin@apple.com>
928 Reviewed by Cameron Zwarich.
930 - https://bugs.webkit.org/show_bug.cgi?id=21403
931 Bug 21403: use new CallFrame class rather than Register* for call frame manipulation
933 Add CallFrame as a synonym for ExecState. Arguably, some day we should switch every
934 client over to the new name.
936 Use CallFrame* consistently rather than Register* or ExecState* in low-level code such
937 as Machine.cpp and CTI.cpp. Similarly, use callFrame rather than r as its name and use
938 accessor functions to get at things in the frame.
940 Eliminate other uses of ExecState* that aren't needed, replacing in some cases with
941 JSGlobalData* and in other cases eliminating them entirely.
943 * API/JSObjectRef.cpp:
944 (JSObjectMakeFunctionWithCallback):
945 (JSObjectMakeFunction):
946 (JSObjectHasProperty):
947 (JSObjectGetProperty):
948 (JSObjectSetProperty):
949 (JSObjectDeleteProperty):
950 * API/OpaqueJSString.cpp:
951 * API/OpaqueJSString.h:
953 (JSC::CTI::getConstant):
954 (JSC::CTI::emitGetArg):
955 (JSC::CTI::emitGetPutArg):
956 (JSC::CTI::getConstantImmediateNumericArg):
957 (JSC::CTI::printOpcodeOperandTypes):
959 (JSC::CTI::compileOpCall):
960 (JSC::CTI::compileBinaryArithOp):
961 (JSC::CTI::privateCompileMainPass):
962 (JSC::CTI::privateCompile):
963 (JSC::CTI::privateCompileGetByIdProto):
964 (JSC::CTI::privateCompileGetByIdChain):
965 (JSC::CTI::compileRegExp):
968 * VM/CodeGenerator.cpp:
969 (JSC::CodeGenerator::emitEqualityOp):
970 (JSC::CodeGenerator::emitLoad):
971 (JSC::CodeGenerator::emitUnexpectedLoad):
972 (JSC::CodeGenerator::emitConstruct):
973 * VM/CodeGenerator.h:
977 (JSC::jsAddSlowCase):
979 (JSC::jsTypeStringForValue):
980 (JSC::Machine::resolve):
981 (JSC::Machine::resolveSkip):
982 (JSC::Machine::resolveGlobal):
983 (JSC::inlineResolveBase):
984 (JSC::Machine::resolveBase):
985 (JSC::Machine::resolveBaseAndProperty):
986 (JSC::Machine::resolveBaseAndFunc):
987 (JSC::Machine::slideRegisterWindowForCall):
989 (JSC::Machine::callEval):
990 (JSC::Machine::dumpCallFrame):
991 (JSC::Machine::dumpRegisters):
992 (JSC::Machine::unwindCallFrame):
993 (JSC::Machine::throwException):
994 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
995 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
996 (JSC::Machine::execute):
997 (JSC::Machine::debug):
998 (JSC::Machine::createExceptionScope):
999 (JSC::cachePrototypeChain):
1000 (JSC::Machine::tryCachePutByID):
1001 (JSC::Machine::tryCacheGetByID):
1002 (JSC::Machine::privateExecute):
1003 (JSC::Machine::retrieveArguments):
1004 (JSC::Machine::retrieveCaller):
1005 (JSC::Machine::retrieveLastCaller):
1006 (JSC::Machine::findFunctionCallFrame):
1007 (JSC::Machine::getArgumentsData):
1008 (JSC::Machine::tryCTICachePutByID):
1009 (JSC::Machine::getCTIArrayLengthTrampoline):
1010 (JSC::Machine::getCTIStringLengthTrampoline):
1011 (JSC::Machine::tryCTICacheGetByID):
1012 (JSC::Machine::cti_op_convert_this):
1013 (JSC::Machine::cti_op_end):
1014 (JSC::Machine::cti_op_add):
1015 (JSC::Machine::cti_op_pre_inc):
1016 (JSC::Machine::cti_timeout_check):
1017 (JSC::Machine::cti_op_loop_if_less):
1018 (JSC::Machine::cti_op_loop_if_lesseq):
1019 (JSC::Machine::cti_op_new_object):
1020 (JSC::Machine::cti_op_put_by_id):
1021 (JSC::Machine::cti_op_put_by_id_second):
1022 (JSC::Machine::cti_op_put_by_id_generic):
1023 (JSC::Machine::cti_op_put_by_id_fail):
1024 (JSC::Machine::cti_op_get_by_id):
1025 (JSC::Machine::cti_op_get_by_id_second):
1026 (JSC::Machine::cti_op_get_by_id_generic):
1027 (JSC::Machine::cti_op_get_by_id_fail):
1028 (JSC::Machine::cti_op_instanceof):
1029 (JSC::Machine::cti_op_del_by_id):
1030 (JSC::Machine::cti_op_mul):
1031 (JSC::Machine::cti_op_new_func):
1032 (JSC::Machine::cti_op_call_JSFunction):
1033 (JSC::Machine::cti_vm_compile):
1034 (JSC::Machine::cti_op_push_activation):
1035 (JSC::Machine::cti_op_call_NotJSFunction):
1036 (JSC::Machine::cti_op_create_arguments):
1037 (JSC::Machine::cti_op_tear_off_activation):
1038 (JSC::Machine::cti_op_tear_off_arguments):
1039 (JSC::Machine::cti_op_ret_profiler):
1040 (JSC::Machine::cti_op_ret_scopeChain):
1041 (JSC::Machine::cti_op_new_array):
1042 (JSC::Machine::cti_op_resolve):
1043 (JSC::Machine::cti_op_construct_JSConstruct):
1044 (JSC::Machine::cti_op_construct_NotJSConstruct):
1045 (JSC::Machine::cti_op_get_by_val):
1046 (JSC::Machine::cti_op_resolve_func):
1047 (JSC::Machine::cti_op_sub):
1048 (JSC::Machine::cti_op_put_by_val):
1049 (JSC::Machine::cti_op_put_by_val_array):
1050 (JSC::Machine::cti_op_lesseq):
1051 (JSC::Machine::cti_op_loop_if_true):
1052 (JSC::Machine::cti_op_negate):
1053 (JSC::Machine::cti_op_resolve_base):
1054 (JSC::Machine::cti_op_resolve_skip):
1055 (JSC::Machine::cti_op_resolve_global):
1056 (JSC::Machine::cti_op_div):
1057 (JSC::Machine::cti_op_pre_dec):
1058 (JSC::Machine::cti_op_jless):
1059 (JSC::Machine::cti_op_not):
1060 (JSC::Machine::cti_op_jtrue):
1061 (JSC::Machine::cti_op_post_inc):
1062 (JSC::Machine::cti_op_eq):
1063 (JSC::Machine::cti_op_lshift):
1064 (JSC::Machine::cti_op_bitand):
1065 (JSC::Machine::cti_op_rshift):
1066 (JSC::Machine::cti_op_bitnot):
1067 (JSC::Machine::cti_op_resolve_with_base):
1068 (JSC::Machine::cti_op_new_func_exp):
1069 (JSC::Machine::cti_op_mod):
1070 (JSC::Machine::cti_op_less):
1071 (JSC::Machine::cti_op_neq):
1072 (JSC::Machine::cti_op_post_dec):
1073 (JSC::Machine::cti_op_urshift):
1074 (JSC::Machine::cti_op_bitxor):
1075 (JSC::Machine::cti_op_new_regexp):
1076 (JSC::Machine::cti_op_bitor):
1077 (JSC::Machine::cti_op_call_eval):
1078 (JSC::Machine::cti_op_throw):
1079 (JSC::Machine::cti_op_get_pnames):
1080 (JSC::Machine::cti_op_next_pname):
1081 (JSC::Machine::cti_op_push_scope):
1082 (JSC::Machine::cti_op_pop_scope):
1083 (JSC::Machine::cti_op_typeof):
1084 (JSC::Machine::cti_op_to_jsnumber):
1085 (JSC::Machine::cti_op_in):
1086 (JSC::Machine::cti_op_push_new_scope):
1087 (JSC::Machine::cti_op_jmp_scopes):
1088 (JSC::Machine::cti_op_put_by_index):
1089 (JSC::Machine::cti_op_switch_imm):
1090 (JSC::Machine::cti_op_switch_char):
1091 (JSC::Machine::cti_op_switch_string):
1092 (JSC::Machine::cti_op_del_by_val):
1093 (JSC::Machine::cti_op_put_getter):
1094 (JSC::Machine::cti_op_put_setter):
1095 (JSC::Machine::cti_op_new_error):
1096 (JSC::Machine::cti_op_debug):
1097 (JSC::Machine::cti_vm_throw):
1100 * VM/RegisterFile.h:
1102 * kjs/DebuggerCallFrame.cpp:
1103 (JSC::DebuggerCallFrame::functionName):
1104 (JSC::DebuggerCallFrame::type):
1105 (JSC::DebuggerCallFrame::thisObject):
1106 (JSC::DebuggerCallFrame::evaluate):
1107 * kjs/DebuggerCallFrame.h:
1108 * kjs/ExecState.cpp:
1109 (JSC::CallFrame::thisValue):
1111 * kjs/FunctionConstructor.cpp:
1112 (JSC::constructFunction):
1113 * kjs/JSActivation.cpp:
1114 (JSC::JSActivation::JSActivation):
1115 (JSC::JSActivation::argumentsGetter):
1116 * kjs/JSActivation.h:
1117 * kjs/JSGlobalObject.cpp:
1118 (JSC::JSGlobalObject::init):
1119 * kjs/JSGlobalObjectFunctions.cpp:
1120 (JSC::globalFuncEval):
1121 * kjs/JSVariableObject.h:
1123 (JSC::Parser::parse):
1124 * kjs/RegExpConstructor.cpp:
1125 (JSC::constructRegExp):
1126 * kjs/RegExpPrototype.cpp:
1127 (JSC::regExpProtoFuncCompile):
1129 (prettyPrintScript):
1130 * kjs/StringPrototype.cpp:
1131 (JSC::stringProtoFuncMatch):
1132 (JSC::stringProtoFuncSearch):
1133 * kjs/identifier.cpp:
1134 (JSC::Identifier::checkSameIdentifierTable):
1135 * kjs/interpreter.cpp:
1136 (JSC::Interpreter::checkSyntax):
1137 (JSC::Interpreter::evaluate):
1139 (JSC::ThrowableExpressionData::emitThrowError):
1140 (JSC::RegExpNode::emitCode):
1141 (JSC::ArrayNode::emitCode):
1142 (JSC::InstanceOfNode::emitCode):
1145 (JSC::RegExp::RegExp):
1146 (JSC::RegExp::create):
1148 * profiler/HeavyProfile.h:
1149 * profiler/Profile.h:
1153 2008-10-08 Mark Rowe <mrowe@apple.com>
1155 Typed by Maciej Stachowiak, reviewed by Mark Rowe.
1157 Fix crash in fast/js/constant-folding.html with CTI disabled.
1160 (JSC::Machine::privateExecute):
1162 2008-10-08 Timothy Hatcher <timothy@apple.com>
1164 Roll out r37427 because it causes an infinite recursion loading about:blank.
1166 https://bugs.webkit.org/show_bug.cgi?id=21476
1168 2008-10-08 Darin Adler <darin@apple.com>
1170 Reviewed by Cameron Zwarich.
1172 - https://bugs.webkit.org/show_bug.cgi?id=21403
1173 Bug 21403: use new CallFrame class rather than Register* for call frame manipulation
1175 Add CallFrame as a synonym for ExecState. Arguably, some day we should switch every
1176 client over to the new name.
1178 Use CallFrame* consistently rather than Register* or ExecState* in low-level code such
1179 as Machine.cpp and CTI.cpp. Similarly, use callFrame rather than r as its name and use
1180 accessor functions to get at things in the frame.
1182 Eliminate other uses of ExecState* that aren't needed, replacing in some cases with
1183 JSGlobalData* and in other cases eliminating them entirely.
1185 * API/JSObjectRef.cpp:
1186 (JSObjectMakeFunctionWithCallback):
1187 (JSObjectMakeFunction):
1188 (JSObjectHasProperty):
1189 (JSObjectGetProperty):
1190 (JSObjectSetProperty):
1191 (JSObjectDeleteProperty):
1192 * API/OpaqueJSString.cpp:
1193 * API/OpaqueJSString.h:
1195 (JSC::CTI::getConstant):
1196 (JSC::CTI::emitGetArg):
1197 (JSC::CTI::emitGetPutArg):
1198 (JSC::CTI::getConstantImmediateNumericArg):
1199 (JSC::CTI::printOpcodeOperandTypes):
1201 (JSC::CTI::compileOpCall):
1202 (JSC::CTI::compileBinaryArithOp):
1203 (JSC::CTI::privateCompileMainPass):
1204 (JSC::CTI::privateCompile):
1205 (JSC::CTI::privateCompileGetByIdProto):
1206 (JSC::CTI::privateCompileGetByIdChain):
1207 (JSC::CTI::compileRegExp):
1210 * VM/CodeGenerator.cpp:
1211 (JSC::CodeGenerator::emitEqualityOp):
1212 (JSC::CodeGenerator::emitLoad):
1213 (JSC::CodeGenerator::emitUnexpectedLoad):
1214 (JSC::CodeGenerator::emitConstruct):
1215 * VM/CodeGenerator.h:
1219 (JSC::jsAddSlowCase):
1221 (JSC::jsTypeStringForValue):
1222 (JSC::Machine::resolve):
1223 (JSC::Machine::resolveSkip):
1224 (JSC::Machine::resolveGlobal):
1225 (JSC::inlineResolveBase):
1226 (JSC::Machine::resolveBase):
1227 (JSC::Machine::resolveBaseAndProperty):
1228 (JSC::Machine::resolveBaseAndFunc):
1229 (JSC::Machine::slideRegisterWindowForCall):
1231 (JSC::Machine::callEval):
1232 (JSC::Machine::dumpCallFrame):
1233 (JSC::Machine::dumpRegisters):
1234 (JSC::Machine::unwindCallFrame):
1235 (JSC::Machine::throwException):
1236 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope):
1237 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
1238 (JSC::Machine::execute):
1239 (JSC::Machine::debug):
1240 (JSC::Machine::createExceptionScope):
1241 (JSC::cachePrototypeChain):
1242 (JSC::Machine::tryCachePutByID):
1243 (JSC::Machine::tryCacheGetByID):
1244 (JSC::Machine::privateExecute):
1245 (JSC::Machine::retrieveArguments):
1246 (JSC::Machine::retrieveCaller):
1247 (JSC::Machine::retrieveLastCaller):
1248 (JSC::Machine::findFunctionCallFrame):
1249 (JSC::Machine::getArgumentsData):
1250 (JSC::Machine::tryCTICachePutByID):
1251 (JSC::Machine::getCTIArrayLengthTrampoline):
1252 (JSC::Machine::getCTIStringLengthTrampoline):
1253 (JSC::Machine::tryCTICacheGetByID):
1254 (JSC::Machine::cti_op_convert_this):
1255 (JSC::Machine::cti_op_end):
1256 (JSC::Machine::cti_op_add):
1257 (JSC::Machine::cti_op_pre_inc):
1258 (JSC::Machine::cti_timeout_check):
1259 (JSC::Machine::cti_op_loop_if_less):
1260 (JSC::Machine::cti_op_loop_if_lesseq):
1261 (JSC::Machine::cti_op_new_object):
1262 (JSC::Machine::cti_op_put_by_id):
1263 (JSC::Machine::cti_op_put_by_id_second):
1264 (JSC::Machine::cti_op_put_by_id_generic):
1265 (JSC::Machine::cti_op_put_by_id_fail):
1266 (JSC::Machine::cti_op_get_by_id):
1267 (JSC::Machine::cti_op_get_by_id_second):
1268 (JSC::Machine::cti_op_get_by_id_generic):
1269 (JSC::Machine::cti_op_get_by_id_fail):
1270 (JSC::Machine::cti_op_instanceof):
1271 (JSC::Machine::cti_op_del_by_id):
1272 (JSC::Machine::cti_op_mul):
1273 (JSC::Machine::cti_op_new_func):
1274 (JSC::Machine::cti_op_call_JSFunction):
1275 (JSC::Machine::cti_vm_compile):
1276 (JSC::Machine::cti_op_push_activation):
1277 (JSC::Machine::cti_op_call_NotJSFunction):
1278 (JSC::Machine::cti_op_create_arguments):
1279 (JSC::Machine::cti_op_tear_off_activation):
1280 (JSC::Machine::cti_op_tear_off_arguments):
1281 (JSC::Machine::cti_op_ret_profiler):
1282 (JSC::Machine::cti_op_ret_scopeChain):
1283 (JSC::Machine::cti_op_new_array):
1284 (JSC::Machine::cti_op_resolve):
1285 (JSC::Machine::cti_op_construct_JSConstruct):
1286 (JSC::Machine::cti_op_construct_NotJSConstruct):
1287 (JSC::Machine::cti_op_get_by_val):
1288 (JSC::Machine::cti_op_resolve_func):
1289 (JSC::Machine::cti_op_sub):
1290 (JSC::Machine::cti_op_put_by_val):
1291 (JSC::Machine::cti_op_put_by_val_array):
1292 (JSC::Machine::cti_op_lesseq):
1293 (JSC::Machine::cti_op_loop_if_true):
1294 (JSC::Machine::cti_op_negate):
1295 (JSC::Machine::cti_op_resolve_base):
1296 (JSC::Machine::cti_op_resolve_skip):
1297 (JSC::Machine::cti_op_resolve_global):
1298 (JSC::Machine::cti_op_div):
1299 (JSC::Machine::cti_op_pre_dec):
1300 (JSC::Machine::cti_op_jless):
1301 (JSC::Machine::cti_op_not):
1302 (JSC::Machine::cti_op_jtrue):
1303 (JSC::Machine::cti_op_post_inc):
1304 (JSC::Machine::cti_op_eq):
1305 (JSC::Machine::cti_op_lshift):
1306 (JSC::Machine::cti_op_bitand):
1307 (JSC::Machine::cti_op_rshift):
1308 (JSC::Machine::cti_op_bitnot):
1309 (JSC::Machine::cti_op_resolve_with_base):
1310 (JSC::Machine::cti_op_new_func_exp):
1311 (JSC::Machine::cti_op_mod):
1312 (JSC::Machine::cti_op_less):
1313 (JSC::Machine::cti_op_neq):
1314 (JSC::Machine::cti_op_post_dec):
1315 (JSC::Machine::cti_op_urshift):
1316 (JSC::Machine::cti_op_bitxor):
1317 (JSC::Machine::cti_op_new_regexp):
1318 (JSC::Machine::cti_op_bitor):
1319 (JSC::Machine::cti_op_call_eval):
1320 (JSC::Machine::cti_op_throw):
1321 (JSC::Machine::cti_op_get_pnames):
1322 (JSC::Machine::cti_op_next_pname):
1323 (JSC::Machine::cti_op_push_scope):
1324 (JSC::Machine::cti_op_pop_scope):
1325 (JSC::Machine::cti_op_typeof):
1326 (JSC::Machine::cti_op_to_jsnumber):
1327 (JSC::Machine::cti_op_in):
1328 (JSC::Machine::cti_op_push_new_scope):
1329 (JSC::Machine::cti_op_jmp_scopes):
1330 (JSC::Machine::cti_op_put_by_index):
1331 (JSC::Machine::cti_op_switch_imm):
1332 (JSC::Machine::cti_op_switch_char):
1333 (JSC::Machine::cti_op_switch_string):
1334 (JSC::Machine::cti_op_del_by_val):
1335 (JSC::Machine::cti_op_put_getter):
1336 (JSC::Machine::cti_op_put_setter):
1337 (JSC::Machine::cti_op_new_error):
1338 (JSC::Machine::cti_op_debug):
1339 (JSC::Machine::cti_vm_throw):
1342 * VM/RegisterFile.h:
1344 * kjs/DebuggerCallFrame.cpp:
1345 (JSC::DebuggerCallFrame::functionName):
1346 (JSC::DebuggerCallFrame::type):
1347 (JSC::DebuggerCallFrame::thisObject):
1348 (JSC::DebuggerCallFrame::evaluate):
1349 * kjs/DebuggerCallFrame.h:
1350 * kjs/ExecState.cpp:
1351 (JSC::CallFrame::thisValue):
1353 * kjs/FunctionConstructor.cpp:
1354 (JSC::constructFunction):
1355 * kjs/JSActivation.cpp:
1356 (JSC::JSActivation::JSActivation):
1357 (JSC::JSActivation::argumentsGetter):
1358 * kjs/JSActivation.h:
1359 * kjs/JSGlobalObject.cpp:
1360 (JSC::JSGlobalObject::init):
1361 * kjs/JSGlobalObjectFunctions.cpp:
1362 (JSC::globalFuncEval):
1363 * kjs/JSVariableObject.h:
1365 (JSC::Parser::parse):
1366 * kjs/RegExpConstructor.cpp:
1367 (JSC::constructRegExp):
1368 * kjs/RegExpPrototype.cpp:
1369 (JSC::regExpProtoFuncCompile):
1371 (prettyPrintScript):
1372 * kjs/StringPrototype.cpp:
1373 (JSC::stringProtoFuncMatch):
1374 (JSC::stringProtoFuncSearch):
1375 * kjs/identifier.cpp:
1376 (JSC::Identifier::checkSameIdentifierTable):
1377 * kjs/interpreter.cpp:
1378 (JSC::Interpreter::checkSyntax):
1379 (JSC::Interpreter::evaluate):
1381 (JSC::ThrowableExpressionData::emitThrowError):
1382 (JSC::RegExpNode::emitCode):
1383 (JSC::ArrayNode::emitCode):
1384 (JSC::InstanceOfNode::emitCode):
1387 (JSC::RegExp::RegExp):
1388 (JSC::RegExp::create):
1390 * profiler/HeavyProfile.h:
1391 * profiler/Profile.h:
1395 2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
1397 Reviewed by Oliver Hunt.
1399 Avoid endless loops when compiling without the computed goto
1402 NEXT_OPCODE expands to "continue", which will not work inside
1406 (JSC::Machine::privateExecute):
1408 2008-10-08 Maciej Stachowiak <mjs@apple.com>
1410 Reviewed by Oliver Hunt.
1412 Re-landing the following fix with the crashing bug in it fixed (r37405):
1414 - optimize away multiplication by constant 1.0
1416 2.3% speedup on v8 RayTrace benchmark
1418 Apparently it's not uncommon for JavaScript code to multiply by
1419 constant 1.0 in the mistaken belief that this converts integer to
1420 floating point and that there is any operational difference.
1423 (JSC::CTI::privateCompileMainPass): Optimize to_jsnumber for
1424 case where parameter is already number.
1425 (JSC::CTI::privateCompileSlowCases): ditto
1427 (JSC::Machine::privateExecute): ditto
1429 (makeMultNode): Transform as follows:
1430 +FOO * BAR ==> FOO * BAR
1431 FOO * +BAR ==> FOO * BAR
1434 (makeDivNode): Transform as follows:
1435 +FOO / BAR ==> FOO / BAR
1436 FOO / +BAR ==> FOO / BAR
1437 (makeSubNode): Transform as follows:
1438 +FOO - BAR ==> FOO - BAR
1439 FOO - +BAR ==> FOO - BAR
1441 (JSC::ExpressionNode::stripUnaryPlus): Helper for above
1443 (JSC::UnaryPlusNode::stripUnaryPlus): ditto
1445 2008-10-08 Maciej Stachowiak <mjs@apple.com>
1447 Reviewed by Oliver Hunt.
1449 - correctly handle appending -0 to a string, it should stringify as just 0
1454 2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
1458 Fix WebKit compilation with VC2008SP1
1460 Apply the TR1 workaround for JavaScriptCore, too.
1462 * JavaScriptCore.pro:
1464 2008-10-08 Prasanth Ullattil <pullatti@trolltech.com>
1468 Fix compilation errors on VS2008 64Bit
1470 * kjs/collector.cpp:
1471 (JSC::currentThreadStackBase):
1473 2008-10-08 André Pönitz <apoenitz@trolltech.com>
1477 Fix compilation with Qt namespaces.
1481 2008-10-07 Sam Weinig <sam@webkit.org>
1485 2008-10-07 Oliver Hunt <oliver@apple.com>
1487 Reviewed by Cameron Zwarich.
1489 Switch CTI runtime calls to the fastcall calling convention
1491 Basically this means that we get to store the argument for CTI
1492 calls in the ECX register, which saves a register->memory write
1493 and subsequent memory->register read.
1495 This is a 1.7% progression in SunSpider and 2.4% on commandline
1500 (JSC::CTI::privateCompilePutByIdTransition):
1501 (JSC::CTI::privateCompilePatchGetArrayLength):
1504 * masm/X86Assembler.h:
1505 (JSC::X86Assembler::emitRestoreArgumentReference):
1506 (JSC::X86Assembler::emitRestoreArgumentReferenceForTrampoline):
1507 We need this to correctly reload ecx from inside certain property access
1511 2008-10-07 Maciej Stachowiak <mjs@apple.com>
1513 Reviewed by Mark Rowe.
1515 - optimize away multiplication by constant 1.0
1517 2.3% speedup on v8 RayTrace benchmark
1519 Apparently it's not uncommon for JavaScript code to multiply by
1520 constant 1.0 in the mistaken belief that this converts integer to
1521 floating point and that there is any operational difference.
1524 (JSC::CTI::privateCompileMainPass): Optimize to_jsnumber for
1525 case where parameter is already number.
1526 (JSC::CTI::privateCompileSlowCases): ditto
1528 (JSC::Machine::privateExecute): ditto
1530 (makeMultNode): Transform as follows:
1531 +FOO * BAR ==> FOO * BAR
1532 FOO * +BAR ==> FOO * BAR
1535 (makeDivNode): Transform as follows:
1536 +FOO / BAR ==> FOO / BAR
1537 FOO / +BAR ==> FOO / BAR
1538 (makeSubNode): Transform as follows:
1539 +FOO - BAR ==> FOO - BAR
1540 FOO - +BAR ==> FOO - BAR
1542 (JSC::ExpressionNode::stripUnaryPlus): Helper for above
1544 (JSC::UnaryPlusNode::stripUnaryPlus): ditto
1546 2008-10-07 Maciej Stachowiak <mjs@apple.com>
1548 Reviewed by Oliver Hunt.
1550 - make constant folding code more consistent
1552 Added a makeSubNode to match add, mult and div; use the makeFooNode functions always,
1553 instead of allocating nodes directly in other places in the grammar.
1557 2008-10-07 Sam Weinig <sam@webkit.org>
1559 Reviewed by Cameron Zwarich.
1561 Move hasGetterSetterProperties flag from PropertyMap to StructureID.
1564 (JSC::JSObject::put):
1565 (JSC::JSObject::defineGetter):
1566 (JSC::JSObject::defineSetter):
1568 (JSC::JSObject::hasGetterSetterProperties):
1569 (JSC::JSObject::getOwnPropertySlotForWrite):
1570 (JSC::JSObject::getOwnPropertySlot):
1571 * kjs/PropertyMap.h:
1572 * kjs/StructureID.cpp:
1573 (JSC::StructureID::StructureID):
1574 (JSC::StructureID::addPropertyTransition):
1575 (JSC::StructureID::toDictionaryTransition):
1576 (JSC::StructureID::changePrototypeTransition):
1577 (JSC::StructureID::getterSetterTransition):
1578 * kjs/StructureID.h:
1579 (JSC::StructureID::hasGetterSetterProperties):
1580 (JSC::StructureID::setHasGetterSetterProperties):
1582 2008-10-07 Sam Weinig <sam@webkit.org>
1584 Reviewed by Cameron Zwarich.
1586 Roll r37370 back in with bug fixes.
1588 - PropertyMap::storageSize() should reflect the number of keys + deletedOffsets
1589 and has nothing to do with the internal deletedSentinel count anymore.
1591 2008-10-07 Gavin Barraclough <barraclough@apple.com>
1593 Reviewed by Oliver Hunt.
1595 Move callframe initialization into JIT code, again.
1597 As a part of the restructuring the second result from functions is now
1598 returned in edx, allowing the new value of 'r' to be returned via a
1599 register, and stored to the stack from JIT code, too.
1601 4.5% progression on v8-tests. (3% in their harness)
1605 (JSC::CTI::emitCall):
1606 (JSC::CTI::compileOpCall):
1607 (JSC::CTI::privateCompileMainPass):
1608 (JSC::CTI::privateCompileSlowCases):
1609 (JSC::CTI::privateCompile):
1611 (JSC::CallRecord::CallRecord):
1613 (JSC::Machine::cti_op_call_JSFunction):
1614 (JSC::Machine::cti_op_construct_JSConstruct):
1615 (JSC::Machine::cti_op_resolve_func):
1616 (JSC::Machine::cti_op_post_inc):
1617 (JSC::Machine::cti_op_resolve_with_base):
1618 (JSC::Machine::cti_op_post_dec):
1623 2008-10-07 Mark Rowe <mrowe@apple.com>
1625 Fix typo in method name.
1630 2008-10-07 Cameron Zwarich <zwarich@apple.com>
1632 Rubber-stamped by Mark Rowe.
1636 2008-10-06 Sam Weinig <sam@webkit.org>
1638 Reviewed by Cameron Zwarich.
1640 Fix for https://bugs.webkit.org/show_bug.cgi?id=21415
1641 Improve the division between PropertyStorageArray and PropertyMap
1643 - Rework ProperyMap to store offsets in the value so that they don't
1644 change when rehashing. This allows us not to have to keep the
1645 PropertyStorageArray in sync and thus not have to pass it in.
1646 - Rename PropertyMap::getOffset -> PropertyMap::get since put/remove
1647 now also return offsets.
1648 - A Vector of deleted offsets is now needed since the storage is out of
1651 1% win on SunSpider. Wash on V8 suite.
1653 * JavaScriptCore.exp:
1655 (JSC::transitionWillNeedStorageRealloc):
1657 (JSC::Machine::privateExecute):
1658 Transition logic can be greatly simplified by the fact that
1659 the storage capacity is always known, and is correct for the
1662 (JSC::JSObject::put): Rename getOffset -> get.
1663 (JSC::JSObject::deleteProperty): Ditto.
1664 (JSC::JSObject::getPropertyAttributes): Ditto.
1665 (JSC::JSObject::removeDirect): Use returned offset to
1666 clear the value in the PropertyNameArray.
1667 (JSC::JSObject::allocatePropertyStorage): Add assert.
1669 (JSC::JSObject::getDirect): Rename getOffset -> get
1670 (JSC::JSObject::getDirectLocation): Rename getOffset -> get
1671 (JSC::JSObject::putDirect): Use propertyStorageCapacity to determine whether
1672 or not to resize. Also, since put now returns an offset (and thus
1673 addPropertyTransition does also) setting of the PropertyStorageArray is
1675 (JSC::JSObject::transitionTo):
1676 * kjs/PropertyMap.cpp:
1677 (JSC::PropertyMap::checkConsistency): PropertyStorageArray is no longer
1679 (JSC::PropertyMap::operator=): Copy the delete offsets vector.
1680 (JSC::PropertyMap::put): Instead of setting the PropertyNameArray
1681 explicitly, return the offset where the value should go.
1682 (JSC::PropertyMap::remove): Instead of removing from the PropertyNameArray
1683 explicitly, return the offset where the value should be removed.
1684 (JSC::PropertyMap::get): Switch to using the stored offset, instead
1685 of the implicit one.
1686 (JSC::PropertyMap::insert):
1687 (JSC::PropertyMap::expand): This is never called when m_table is null,
1688 so remove that branch and add it as an assertion.
1689 (JSC::PropertyMap::createTable): Consistency checks no longer take
1690 a PropertyNameArray.
1691 (JSC::PropertyMap::rehash): No need to rehash the PropertyNameArray
1692 now that it is completely out of band.
1693 * kjs/PropertyMap.h:
1694 (JSC::PropertyMapEntry::PropertyMapEntry): Store offset into PropertyNameArray.
1695 (JSC::PropertyMap::get): Switch to using the stored offset, instead
1696 of the implicit one.
1697 * kjs/StructureID.cpp:
1698 (JSC::StructureID::StructureID): Initialize the propertyStorageCapacity to
1699 JSObject::inlineStorageCapacity.
1700 (JSC::StructureID::growPropertyStorageCapacity): Grow the storage capacity as
1702 (JSC::StructureID::addPropertyTransition): Copy the storage capacity.
1703 (JSC::StructureID::toDictionaryTransition): Ditto.
1704 (JSC::StructureID::changePrototypeTransition): Ditto.
1705 (JSC::StructureID::getterSetterTransition): Ditto.
1706 * kjs/StructureID.h:
1707 (JSC::StructureID::propertyStorageCapacity): Add propertyStorageCapacity
1708 which is the current capacity for the JSObjects PropertyStorageArray.
1709 It starts at the JSObject::inlineStorageCapacity (currently 2), then
1710 when it first needs to be resized moves to the JSObject::nonInlineBaseStorageCapacity
1711 (currently 16), and after that doubles each time.
1713 2008-10-06 Cameron Zwarich <zwarich@apple.com>
1715 Reviewed by Oliver Hunt.
1717 Bug 21396: Remove the OptionalCalleeActivation call frame slot
1718 <https://bugs.webkit.org/show_bug.cgi?id=21396>
1720 Remove the OptionalCalleeActivation call frame slot. We have to be
1721 careful to store the activation object in a register, because objects
1722 in the scope chain do not get marked.
1724 This is a 0.3% speedup on both SunSpider and the V8 benchmark.
1727 (JSC::CTI::privateCompileMainPass):
1729 (JSC::CodeBlock::dump):
1730 * VM/CodeGenerator.cpp:
1731 (JSC::CodeGenerator::CodeGenerator):
1732 (JSC::CodeGenerator::emitReturn):
1733 * VM/CodeGenerator.h:
1735 (JSC::Machine::dumpRegisters):
1736 (JSC::Machine::unwindCallFrame):
1737 (JSC::Machine::privateExecute):
1738 (JSC::Machine::cti_op_call_JSFunction):
1739 (JSC::Machine::cti_op_push_activation):
1740 (JSC::Machine::cti_op_tear_off_activation):
1741 (JSC::Machine::cti_op_construct_JSConstruct):
1743 (JSC::Machine::initializeCallFrame):
1744 * VM/RegisterFile.h:
1745 (JSC::RegisterFile::):
1747 2008-10-06 Tony Chang <tony@chromium.org>
1749 Reviewed by Alexey Proskuryakov.
1751 Chromium doesn't use pthreads on windows, so make its use conditional.
1753 Also convert a WORD to a DWORD to avoid a compiler warning. This
1754 matches the other methods around it.
1756 * wtf/ThreadingWin.cpp:
1757 (WTF::wtfThreadEntryPoint):
1758 (WTF::ThreadCondition::broadcast):
1760 2008-10-06 Mark Mentovai <mark@moxienet.com>
1762 Reviewed by Tim Hatcher.
1764 Allow ENABLE_DASHBOARD_SUPPORT and ENABLE_MAC_JAVA_BRIDGE to be
1765 disabled on the Mac.
1767 https://bugs.webkit.org/show_bug.cgi?id=21333
1771 2008-10-06 Steve Falkenburg <sfalken@apple.com>
1773 https://bugs.webkit.org/show_bug.cgi?id=21416
1774 Pass 0 for size to VirtualAlloc, as documented by MSDN.
1775 Identified by Application Verifier.
1777 Reviewed by Darin Adler.
1779 * kjs/collector.cpp:
1782 2008-10-06 Kevin McCullough <kmccullough@apple.com>
1784 Reviewed by Tim Hatcheri and Oliver Hunt.
1786 https://bugs.webkit.org/show_bug.cgi?id=21412
1787 Bug 21412: Refactor user initiated profile count to be more stable
1788 - Export UString::from for use with creating the profile title.
1790 * JavaScriptCore.exp:
1792 2008-10-06 Maciej Stachowiak <mjs@apple.com>
1794 Not reviewed. Build fix.
1796 - revert toBoolean changes (r37333 and r37335); need to make WebCore work with these
1798 * API/JSValueRef.cpp:
1801 * JavaScriptCore.exp:
1803 (JSC::CodeBlock::dump):
1805 (JSC::Machine::privateExecute):
1806 (JSC::Machine::cti_op_loop_if_true):
1807 (JSC::Machine::cti_op_not):
1808 (JSC::Machine::cti_op_jtrue):
1809 * kjs/ArrayPrototype.cpp:
1810 (JSC::arrayProtoFuncFilter):
1811 (JSC::arrayProtoFuncEvery):
1812 (JSC::arrayProtoFuncSome):
1813 * kjs/BooleanConstructor.cpp:
1814 (JSC::constructBoolean):
1815 (JSC::callBooleanConstructor):
1816 * kjs/GetterSetter.h:
1818 (JSC::JSValue::toBoolean):
1819 * kjs/JSNumberCell.cpp:
1820 (JSC::JSNumberCell::toBoolean):
1821 * kjs/JSNumberCell.h:
1823 (JSC::JSObject::toBoolean):
1826 (JSC::JSString::toBoolean):
1829 * kjs/RegExpConstructor.cpp:
1830 (JSC::setRegExpConstructorMultiline):
1831 * kjs/RegExpObject.cpp:
1832 (JSC::RegExpObject::match):
1833 * kjs/RegExpPrototype.cpp:
1834 (JSC::regExpProtoFuncToString):
1836 2008-10-06 Maciej Stachowiak <mjs@apple.com>
1838 Reviewed by Sam Weinig.
1840 - optimize op_jtrue, op_loop_if_true and op_not in various ways
1841 https://bugs.webkit.org/show_bug.cgi?id=21404
1843 1) Make JSValue::toBoolean nonvirtual and completely inline by
1844 making use of the StructureID type field.
1846 2) Make JSValue::toBoolean not take an ExecState; doesn't need it.
1848 3) Make op_not, op_loop_if_true and op_jtrue not read the
1849 ExecState (toBoolean doesn't need it any more) and not check
1850 exceptions (toBoolean can't throw).
1852 * API/JSValueRef.cpp:
1854 * JavaScriptCore.exp:
1856 (JSC::CodeBlock::dump):
1858 (JSC::Machine::privateExecute):
1859 (JSC::Machine::cti_op_loop_if_true):
1860 (JSC::Machine::cti_op_not):
1861 (JSC::Machine::cti_op_jtrue):
1862 * kjs/ArrayPrototype.cpp:
1863 (JSC::arrayProtoFuncFilter):
1864 (JSC::arrayProtoFuncEvery):
1865 (JSC::arrayProtoFuncSome):
1866 * kjs/BooleanConstructor.cpp:
1867 (JSC::constructBoolean):
1868 (JSC::callBooleanConstructor):
1869 * kjs/GetterSetter.h:
1871 (JSC::JSValue::toBoolean):
1872 * kjs/JSNumberCell.cpp:
1873 * kjs/JSNumberCell.h:
1874 (JSC::JSNumberCell::toBoolean):
1877 (JSC::JSObject::toBoolean):
1878 (JSC::JSCell::toBoolean):
1881 (JSC::JSString::toBoolean):
1883 * kjs/RegExpConstructor.cpp:
1884 (JSC::setRegExpConstructorMultiline):
1885 * kjs/RegExpObject.cpp:
1886 (JSC::RegExpObject::match):
1887 * kjs/RegExpPrototype.cpp:
1888 (JSC::regExpProtoFuncToString):
1890 2008-10-06 Ariya Hidayat <ariya.hidayat@trolltech.com>
1894 Build fix for MinGW.
1896 * JavaScriptCore.pri:
1898 (JSC::highResUpTime):
1900 2008-10-05 Cameron Zwarich <zwarich@apple.com>
1902 Reviewed by Oliver Hunt.
1904 Remove ScopeNode::containsClosures() now that it is unused.
1907 (JSC::ScopeNode::containsClosures):
1909 2008-10-05 Maciej Stachowiak <mjs@apple.com>
1911 Reviewed by Cameron Zwarich.
1913 - fix releas-only test failures caused by the fix to bug 21375
1916 (JSC::Machine::unwindCallFrame): Update ExecState while unwinding call frames;
1917 it now matters more to have a still-valid ExecState, since dynamicGlobalObject
1918 will make use of the ExecState's scope chain.
1921 2008-10-05 Cameron Zwarich <zwarich@apple.com>
1923 Reviewed by Oliver Hunt.
1925 Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
1926 <https://bugs.webkit.org/show_bug.cgi?id=21364>
1928 Use information from the parser to detect whether an activation is
1929 needed or 'arguments' is used, and emit explicit instructions to tear
1930 them off before op_ret. This allows a branch to be removed from op_ret
1931 and simplifies some other code. This does cause a small change in the
1932 behaviour of 'f.arguments'; it is no longer live when 'arguments' is not
1933 mentioned in the lexical scope of the function.
1935 It should now be easy to remove the OptionaCalleeActivation slot in the
1936 call frame, but this will be done in a later patch.
1939 (JSC::CTI::privateCompileMainPass):
1941 (JSC::CodeBlock::dump):
1942 * VM/CodeGenerator.cpp:
1943 (JSC::CodeGenerator::emitReturn):
1944 * VM/CodeGenerator.h:
1946 (JSC::Machine::unwindCallFrame):
1947 (JSC::Machine::privateExecute):
1948 (JSC::Machine::retrieveArguments):
1949 (JSC::Machine::cti_op_create_arguments):
1950 (JSC::Machine::cti_op_tear_off_activation):
1951 (JSC::Machine::cti_op_tear_off_arguments):
1954 * kjs/Arguments.cpp:
1955 (JSC::Arguments::mark):
1957 (JSC::Arguments::isTornOff):
1958 (JSC::Arguments::Arguments):
1959 (JSC::Arguments::copyRegisters):
1960 (JSC::JSActivation::copyRegisters):
1961 * kjs/JSActivation.cpp:
1962 (JSC::JSActivation::argumentsGetter):
1963 * kjs/JSActivation.h:
1965 2008-10-05 Maciej Stachowiak <mjs@apple.com>
1967 Reviewed by Oliver Hunt.
1969 - fixed "REGRESSION (r37297): fast/js/deep-recursion-test takes too long and times out"
1970 https://bugs.webkit.org/show_bug.cgi?id=21375
1972 The problem is that dynamicGlobalObject had become O(N) in number
1973 of call frames, but unwinding the stack for an exception called it
1974 for every call frame, resulting in O(N^2) behavior for an
1975 exception thrown from inside deep recursion.
1977 Instead of doing it that way, stash the dynamic global object in JSGlobalData.
1979 * JavaScriptCore.exp:
1981 (JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Helper class to temporarily
1982 store and later restore a dynamicGlobalObject in JSGlobalData.
1983 (JSC::DynamicGlobalObjectScope::~DynamicGlobalObjectScope):
1984 (JSC::Machine::execute): In each version, establish a DynamicGlobalObjectScope.
1985 For ProgramNode, always establish set new dynamicGlobalObject, for FunctionBody and Eval,
1986 only if none is currently set.
1989 * kjs/JSGlobalData.cpp:
1990 (JSC::JSGlobalData::JSGlobalData): Ininitalize new dynamicGlobalObject field to 0.
1991 * kjs/JSGlobalData.h:
1992 * kjs/JSGlobalObject.h:
1993 (JSC::ExecState::dynamicGlobalObject): Moved here from ExecState for benefit of inlining.
1994 Return lexical global object if this is a globalExec(), otherwise look in JSGlobalData
1995 for the one stashed there.
1997 2008-10-05 Sam Weinig <sam@webkit.org>
1999 Reviewed by Maciej Stachowiak.
2001 Avoid an extra lookup when transitioning to an existing StructureID
2002 by caching the offset of property that caused the transition.
2004 1% win on V8 suite. Wash on SunSpider.
2006 * kjs/PropertyMap.cpp:
2007 (JSC::PropertyMap::put):
2008 * kjs/PropertyMap.h:
2009 * kjs/StructureID.cpp:
2010 (JSC::StructureID::StructureID):
2011 (JSC::StructureID::addPropertyTransition):
2012 * kjs/StructureID.h:
2013 (JSC::StructureID::setCachedTransistionOffset):
2014 (JSC::StructureID::cachedTransistionOffset):
2016 2008-10-05 Cameron Zwarich <zwarich@apple.com>
2018 Reviewed by Maciej Stachowiak.
2020 Bug 21364: Remove the branch in op_ret for OptionalCalleeActivation and OptionalCalleeArguments
2021 <https://bugs.webkit.org/show_bug.cgi?id=21364>
2023 This patch does not yet remove the branch, but it does a bit of refactoring
2024 so that a CodeGenerator now knows whether the associated CodeBlock will need
2025 a full scope before doing any code generation. This makes it possible to emit
2026 explicit tear-off instructions before every op_ret.
2029 (JSC::CodeBlock::CodeBlock):
2030 * VM/CodeGenerator.cpp:
2031 (JSC::CodeGenerator::generate):
2032 (JSC::CodeGenerator::CodeGenerator):
2033 (JSC::CodeGenerator::emitPushScope):
2034 (JSC::CodeGenerator::emitPushNewScope):
2036 (JSC::ScopeNode::needsActivation):
2038 2008-10-05 Gavin Barraclough <barraclough@apple.com>
2040 Reviewed by Cameron Zwarich.
2042 Fix for bug #21387 - using SamplingTool with CTI.
2044 (1) A repatch offset offset changes due to an additional instruction to update SamplingTool state.
2045 (2) Fix an incusion order problem due to ExecState changes.
2046 (3) Change to a MACHINE_SAMPLING macro, use of exec should now be accessing global data.
2049 (JSC::CTI::execute):
2050 * VM/SamplingTool.h:
2051 (JSC::SamplingTool::privateExecuteReturned):
2054 2008-10-04 Mark Rowe <mrowe@apple.com>
2056 Reviewed by Tim Hatcher.
2058 Add a 'Check For Weak VTables' build phase to catch weak vtables as early as possible.
2060 * JavaScriptCore.xcodeproj/project.pbxproj:
2062 2008-10-04 Sam Weinig <sam@webkit.org>
2064 Reviewed by Oliver Hunt.
2066 Fix https://bugs.webkit.org/show_bug.cgi?id=21320
2067 leaks of PropertyNameArrayData seen on buildbot
2069 - Fix RefPtr cycle by making PropertyNameArrayData's pointer back
2070 to the StructureID a weak pointer.
2072 * kjs/PropertyNameArray.h:
2073 (JSC::PropertyNameArrayData::setCachedStructureID):
2074 (JSC::PropertyNameArrayData::cachedStructureID):
2075 * kjs/StructureID.cpp:
2076 (JSC::StructureID::getEnumerablePropertyNames):
2077 (JSC::StructureID::clearEnumerationCache):
2078 (JSC::StructureID::~StructureID):
2080 2008-10-04 Darin Adler <darin@apple.com>
2082 Reviewed by Cameron Zwarich.
2084 - https://bugs.webkit.org/show_bug.cgi?id=21295
2085 Bug 21295: Replace ExecState with a call frame Register pointer
2087 10% faster on Richards; other v8 benchmarks faster too.
2088 A wash on SunSpider.
2090 This does the minimum necessary to get the speedup. Next step in
2091 cleaning this up is to replace ExecState with a CallFrame class,
2092 and be more judicious about when to pass a call frame and when
2093 to pass a global data pointer, global object pointer, or perhaps
2094 something else entirely.
2096 * VM/CTI.cpp: Remove the debug-only check of the exception in
2097 ctiVMThrowTrampoline -- already checked in the code the trampoline
2098 jumps to, so not all that useful. Removed the exec argument from
2099 ctiTrampoline. Removed emitDebugExceptionCheck -- no longer needed.
2100 (JSC::CTI::emitCall): Removed code to set ExecState::m_callFrame.
2101 (JSC::CTI::privateCompileMainPass): Removed code in catch to extract
2102 the exception from ExecState::m_exception; instead, the code that
2103 jumps into catch will make sure the exception is already in eax.
2104 * VM/CTI.h: Removed exec from the ctiTrampoline. Also removed the
2105 non-helpful "volatile". Temporarily left ARG_exec in as a synonym
2106 for ARG_r; I'll change that on a future cleanup pass when introducing
2107 more use of the CallFrame type.
2108 (JSC::CTI::execute): Removed the ExecState* argument.
2110 * VM/ExceptionHelpers.cpp:
2111 (JSC::InterruptedExecutionError::InterruptedExecutionError): Take
2112 JSGlobalData* instead of ExecState*.
2113 (JSC::createInterruptedExecutionException): Ditto.
2114 * VM/ExceptionHelpers.h: Ditto. Also removed an unneeded include.
2117 (JSC::slideRegisterWindowForCall): Removed the exec and
2118 exceptionValue arguments. Changed to return 0 when there's a stack
2119 overflow rather than using a separate exception argument to cut
2120 down on memory accesses in the calling convention.
2121 (JSC::Machine::unwindCallFrame): Removed the exec argument when
2122 constructing a DebuggerCallFrame. Also removed code to set
2123 ExecState::m_callFrame.
2124 (JSC::Machine::throwException): Removed the exec argument when
2125 construction a DebuggerCallFrame.
2126 (JSC::Machine::execute): Updated to use the register instead of
2127 ExecState and also removed various uses of ExecState.
2128 (JSC::Machine::debug):
2129 (JSC::Machine::privateExecute): Put globalData into a local
2130 variable so it can be used throughout the interpreter. Changed
2131 the VM_CHECK_EXCEPTION to get the exception in globalData instead
2132 of through ExecState.
2133 (JSC::Machine::retrieveLastCaller): Turn exec into a registers
2134 pointer by calling registers() instead of by getting m_callFrame.
2135 (JSC::Machine::callFrame): Ditto.
2136 Tweaked exception macros. Made new versions for when you know
2137 you have an exception. Get at global exception with ARG_globalData.
2138 Got rid of the need to pass in the return value type.
2139 (JSC::Machine::cti_op_add): Update to use new version of exception
2141 (JSC::Machine::cti_op_pre_inc): Ditto.
2142 (JSC::Machine::cti_timeout_check): Ditto.
2143 (JSC::Machine::cti_op_instanceof): Ditto.
2144 (JSC::Machine::cti_op_new_func): Ditto.
2145 (JSC::Machine::cti_op_call_JSFunction): Optimized by using the
2146 ARG values directly instead of through local variables -- this gets
2147 rid of code that just shuffles things around in the stack frame.
2148 Also get rid of ExecState and update for the new way exceptions are
2149 handled in slideRegisterWindowForCall.
2150 (JSC::Machine::cti_vm_compile): Update to make exec out of r since
2151 they are both the same thing now.
2152 (JSC::Machine::cti_op_call_NotJSFunction): Ditto.
2153 (JSC::Machine::cti_op_init_arguments): Ditto.
2154 (JSC::Machine::cti_op_resolve): Ditto.
2155 (JSC::Machine::cti_op_construct_JSConstruct): Ditto.
2156 (JSC::Machine::cti_op_construct_NotJSConstruct): Ditto.
2157 (JSC::Machine::cti_op_resolve_func): Ditto.
2158 (JSC::Machine::cti_op_put_by_val): Ditto.
2159 (JSC::Machine::cti_op_put_by_val_array): Ditto.
2160 (JSC::Machine::cti_op_resolve_skip): Ditto.
2161 (JSC::Machine::cti_op_resolve_global): Ditto.
2162 (JSC::Machine::cti_op_post_inc): Ditto.
2163 (JSC::Machine::cti_op_resolve_with_base): Ditto.
2164 (JSC::Machine::cti_op_post_dec): Ditto.
2165 (JSC::Machine::cti_op_call_eval): Ditto.
2166 (JSC::Machine::cti_op_throw): Ditto. Also rearranged to return
2167 the exception value as the return value so it can be used by
2169 (JSC::Machine::cti_op_push_scope): Ditto.
2170 (JSC::Machine::cti_op_in): Ditto.
2171 (JSC::Machine::cti_op_del_by_val): Ditto.
2172 (JSC::Machine::cti_vm_throw): Ditto. Also rearranged to return
2173 the exception value as the return value so it can be used by
2176 * kjs/DebuggerCallFrame.cpp:
2177 (JSC::DebuggerCallFrame::functionName): Pass globalData.
2178 (JSC::DebuggerCallFrame::evaluate): Eliminated code to make a
2180 * kjs/DebuggerCallFrame.h: Removed ExecState argument from
2183 * kjs/ExecState.h: Eliminated all data members and made ExecState
2184 inherit privately from Register instead. Also added a typedef to
2185 the future name for this class, which is CallFrame. It's just a
2186 Register* that knows it's a pointer at a call frame. The new class
2187 can't be constructed or copied. Changed all functions to use
2188 the this pointer instead of m_callFrame. Changed exception-related
2189 functions to access an exception in JSGlobalData. Removed functions
2190 used by CTI to pass the return address to the throw machinery --
2191 this is now done directly with a global in the global data.
2193 * kjs/FunctionPrototype.cpp:
2194 (JSC::functionProtoFuncToString): Pass globalData instead of exec.
2196 * kjs/InternalFunction.cpp:
2197 (JSC::InternalFunction::name): Take globalData instead of exec.
2198 * kjs/InternalFunction.h: Ditto.
2200 * kjs/JSGlobalData.cpp: Initialize the new exception global to 0.
2201 * kjs/JSGlobalData.h: Declare two new globals. One for the current
2202 exception and another for the return address used by CTI to
2203 implement the throw operation.
2205 * kjs/JSGlobalObject.cpp:
2206 (JSC::JSGlobalObject::init): Removed code to set up globalExec,
2207 which is now the same thing as globalCallFrame.
2208 (JSC::JSGlobalObject::reset): Get globalExec from our globalExec
2209 function so we don't have to repeat the logic twice.
2210 (JSC::JSGlobalObject::mark): Removed code to mark the exception;
2211 the exception is now stored in JSGlobalData and marked there.
2212 (JSC::JSGlobalObject::globalExec): Return a pointer to the end
2213 of the global call frame.
2214 * kjs/JSGlobalObject.h: Removed the globalExec data member.
2217 (JSC::JSObject::putDirectFunction): Pass globalData instead of exec.
2219 * kjs/collector.cpp:
2220 (JSC::Heap::collect): Mark the global exception.
2222 * profiler/ProfileGenerator.cpp:
2223 (JSC::ProfileGenerator::addParentForConsoleStart): Pass globalData
2224 instead of exec to createCallIdentifier.
2226 * profiler/Profiler.cpp:
2227 (JSC::Profiler::willExecute): Pass globalData instead of exec to
2228 createCallIdentifier.
2229 (JSC::Profiler::didExecute): Ditto.
2230 (JSC::Profiler::createCallIdentifier): Take globalData instead of
2232 (JSC::createCallIdentifierFromFunctionImp): Ditto.
2233 * profiler/Profiler.h: Change interface to take a JSGlobalData
2234 instead of an ExecState.
2236 2008-10-04 Cameron Zwarich <zwarich@apple.com>
2238 Reviewed by Darin Adler.
2240 Bug 21369: Add opcode documentation for all undocumented opcodes
2241 <https://bugs.webkit.org/show_bug.cgi?id=21369>
2243 This patch adds opcode documentation for all undocumented opcodes, and
2244 it also renames op_init_arguments to op_create_arguments.
2247 (JSC::CTI::privateCompileMainPass):
2249 (JSC::CodeBlock::dump):
2250 * VM/CodeGenerator.cpp:
2251 (JSC::CodeGenerator::CodeGenerator):
2253 (JSC::Machine::privateExecute):
2254 (JSC::Machine::cti_op_create_arguments):
2258 2008-10-03 Maciej Stachowiak <mjs@apple.com>
2260 Reviewed by Cameron Zwarich.
2262 - "this" object in methods called on primitives should be wrapper object
2263 https://bugs.webkit.org/show_bug.cgi?id=21362
2265 I changed things so that functions which use "this" do a fast
2266 version of toThisObject conversion if needed. Currently we miss
2267 the conversion entirely, at least for primitive types. Using
2268 TypeInfo and the primitive check, I made the fast case bail out
2271 This is inexplicably an 1.007x SunSpider speedup (and a wash on V8 benchmarks).
2273 Also renamed some opcodes for clarity:
2276 init_activation ==> enter_with_activation
2279 (JSC::CTI::privateCompileMainPass):
2280 (JSC::CTI::privateCompileSlowCases):
2282 (JSC::CodeBlock::dump):
2283 * VM/CodeGenerator.cpp:
2284 (JSC::CodeGenerator::generate):
2285 (JSC::CodeGenerator::CodeGenerator):
2287 (JSC::Machine::privateExecute):
2288 (JSC::Machine::cti_op_convert_this):
2291 * kjs/JSActivation.cpp:
2292 (JSC::JSActivation::JSActivation):
2293 * kjs/JSActivation.h:
2294 (JSC::JSActivation::createStructureID):
2296 (JSC::JSValue::needsThisConversion):
2297 * kjs/JSGlobalData.cpp:
2298 (JSC::JSGlobalData::JSGlobalData):
2299 * kjs/JSGlobalData.h:
2300 * kjs/JSNumberCell.h:
2301 (JSC::JSNumberCell::createStructureID):
2302 * kjs/JSStaticScopeObject.h:
2303 (JSC::JSStaticScopeObject::JSStaticScopeObject):
2304 (JSC::JSStaticScopeObject::createStructureID):
2306 (JSC::JSString::createStructureID):
2309 (JSC::TypeInfo::needsThisConversion):
2311 (JSC::ScopeNode::usesThis):
2313 2008-10-03 Cameron Zwarich <zwarich@apple.com>
2315 Reviewed by Maciej Stachowiak.
2317 Bug 21356: The size of the RegisterFile differs depending on 32-bit / 64-bit and Debug / Release
2318 <https://bugs.webkit.org/show_bug.cgi?id=21356>
2320 The RegisterFile decreases in size (measured in terms of numbers of
2321 Registers) as the size of a Register increases. This causes
2323 js1_5/Regress/regress-159334.js
2325 to fail in 64-bit debug builds. This fix makes the RegisterFile on all
2326 platforms the same size that it is in 32-bit Release builds.
2328 * VM/RegisterFile.h:
2329 (JSC::RegisterFile::RegisterFile):
2331 2008-10-03 Maciej Stachowiak <mjs@apple.com>
2333 Reviewed by Cameron Zwarich.
2335 - Some code cleanup to how we handle code features.
2337 1) Rename FeatureInfo typedef to CodeFeatures.
2338 2) Rename NodeFeatureInfo template to NodeInfo.
2339 3) Keep CodeFeature bitmask in ScopeNode instead of trying to break it out into individual bools.
2340 4) Rename misleadingly named "needsClosure" method to "containsClosures", which better describes the meaning
2342 5) Make setUsersArguments() not take an argument since it only goes one way.
2344 * JavaScriptCore.exp:
2346 (JSC::CodeBlock::CodeBlock):
2349 (JSC::Parser::didFinishParsing):
2351 (JSC::Parser::parse):
2354 (JSC::ScopeNode::ScopeNode):
2355 (JSC::ProgramNode::ProgramNode):
2356 (JSC::ProgramNode::create):
2357 (JSC::EvalNode::EvalNode):
2358 (JSC::EvalNode::create):
2359 (JSC::FunctionBodyNode::FunctionBodyNode):
2360 (JSC::FunctionBodyNode::create):
2362 (JSC::ScopeNode::usesEval):
2363 (JSC::ScopeNode::containsClosures):
2364 (JSC::ScopeNode::usesArguments):
2365 (JSC::ScopeNode::setUsesArguments):
2367 2008-10-03 Cameron Zwarich <zwarich@apple.com>
2369 Reviewed by Maciej Stachowiak.
2371 Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
2372 <https://bugs.webkit.org/show_bug.cgi?id=21343>
2374 A fix was landed for this issue in r37253, and the ChangeLog assumes
2375 that it is a compiler bug, but it turns out that it is a subtle issue
2376 with mixing signed and unsigned 32-bit values in a 64-bit environment.
2377 In order to properly fix this bug, we should convert our signed offsets
2378 into the register file to use ptrdiff_t.
2380 This may not be the only instance of this issue, but I will land this
2381 fix first and look for more later.
2384 (JSC::Machine::getArgumentsData):
2386 * kjs/Arguments.cpp:
2387 (JSC::Arguments::getOwnPropertySlot):
2389 (JSC::Arguments::init):
2391 2008-10-03 Darin Adler <darin@apple.com>
2393 * VM/CTI.cpp: Another Windows build fix. Change the args of ctiTrampoline.
2395 * kjs/JSNumberCell.h: A build fix for newer versions of gcc. Added
2396 declarations of JSGlobalData overloads of jsNumberCell.
2398 2008-10-03 Darin Adler <darin@apple.com>
2400 - try to fix Windows build
2402 * kjs/ScopeChain.h: Add forward declaration of JSGlobalData.
2404 2008-10-03 Darin Adler <darin@apple.com>
2406 Reviewed by Geoff Garen.
2408 - next step of https://bugs.webkit.org/show_bug.cgi?id=21295
2409 Turn ExecState into a call frame pointer.
2411 Remove m_globalObject and m_globalData from ExecState.
2413 SunSpider says this is a wash (slightly faster but not statistically
2414 significant); which is good enough since it's a preparation step and
2415 not supposed to be a spedup.
2417 * API/JSCallbackFunction.cpp:
2418 (JSC::JSCallbackFunction::JSCallbackFunction):
2419 * kjs/ArrayConstructor.cpp:
2420 (JSC::ArrayConstructor::ArrayConstructor):
2421 * kjs/BooleanConstructor.cpp:
2422 (JSC::BooleanConstructor::BooleanConstructor):
2423 * kjs/DateConstructor.cpp:
2424 (JSC::DateConstructor::DateConstructor):
2425 * kjs/ErrorConstructor.cpp:
2426 (JSC::ErrorConstructor::ErrorConstructor):
2427 * kjs/FunctionPrototype.cpp:
2428 (JSC::FunctionPrototype::FunctionPrototype):
2429 * kjs/JSFunction.cpp:
2430 (JSC::JSFunction::JSFunction):
2431 * kjs/NativeErrorConstructor.cpp:
2432 (JSC::NativeErrorConstructor::NativeErrorConstructor):
2433 * kjs/NumberConstructor.cpp:
2434 (JSC::NumberConstructor::NumberConstructor):
2435 * kjs/ObjectConstructor.cpp:
2436 (JSC::ObjectConstructor::ObjectConstructor):
2437 * kjs/PrototypeFunction.cpp:
2438 (JSC::PrototypeFunction::PrototypeFunction):
2439 * kjs/RegExpConstructor.cpp:
2440 (JSC::RegExpConstructor::RegExpConstructor):
2441 * kjs/StringConstructor.cpp:
2442 (JSC::StringConstructor::StringConstructor):
2443 Pass JSGlobalData* instead of ExecState* to the InternalFunction
2446 * API/OpaqueJSString.cpp: Added now-needed include.
2448 * JavaScriptCore.exp: Updated.
2451 (JSC::CTI::emitSlowScriptCheck): Changed to use ARGS_globalData
2452 instead of ARGS_exec.
2454 * VM/CTI.h: Added a new argument to the CTI, the global data pointer.
2455 While it's possible to get to the global data pointer using the
2456 ExecState pointer, it's slow enough that it's better to just keep
2457 it around in the CTI arguments.
2459 * VM/CodeBlock.h: Moved the CodeType enum here from ExecState.h.
2462 (JSC::Machine::execute): Pass fewer arguments when constructing
2463 ExecState, and pass the global data pointer when invoking CTI.
2464 (JSC::Machine::firstCallFrame): Added. Used to get the dynamic global
2465 object, which is in the scope chain of the first call frame.
2466 (JSC::Machine::cti_op_add): Use globalData instead of exec when
2467 possible, to keep fast cases fast, since it's now more expensive to
2468 get to it through the exec pointer.
2469 (JSC::Machine::cti_timeout_check): Ditto.
2470 (JSC::Machine::cti_op_put_by_id_second): Ditto.
2471 (JSC::Machine::cti_op_get_by_id_second): Ditto.
2472 (JSC::Machine::cti_op_mul): Ditto.
2473 (JSC::Machine::cti_vm_compile): Ditto.
2474 (JSC::Machine::cti_op_get_by_val): Ditto.
2475 (JSC::Machine::cti_op_sub): Ditto.
2476 (JSC::Machine::cti_op_put_by_val): Ditto.
2477 (JSC::Machine::cti_op_put_by_val_array): Ditto.
2478 (JSC::Machine::cti_op_negate): Ditto.
2479 (JSC::Machine::cti_op_div): Ditto.
2480 (JSC::Machine::cti_op_pre_dec): Ditto.
2481 (JSC::Machine::cti_op_post_inc): Ditto.
2482 (JSC::Machine::cti_op_lshift): Ditto.
2483 (JSC::Machine::cti_op_bitand): Ditto.
2484 (JSC::Machine::cti_op_rshift): Ditto.
2485 (JSC::Machine::cti_op_bitnot): Ditto.
2486 (JSC::Machine::cti_op_mod): Ditto.
2487 (JSC::Machine::cti_op_post_dec): Ditto.
2488 (JSC::Machine::cti_op_urshift): Ditto.
2489 (JSC::Machine::cti_op_bitxor): Ditto.
2490 (JSC::Machine::cti_op_bitor): Ditto.
2491 (JSC::Machine::cti_op_call_eval): Ditto.
2492 (JSC::Machine::cti_op_throw): Ditto.
2493 (JSC::Machine::cti_op_is_string): Ditto.
2494 (JSC::Machine::cti_op_debug): Ditto.
2495 (JSC::Machine::cti_vm_throw): Ditto.
2497 * VM/Machine.h: Added firstCallFrame.
2499 * kjs/DebuggerCallFrame.cpp:
2500 (JSC::DebuggerCallFrame::evaluate): Pass fewer arguments when
2501 constructing ExecState.
2503 * kjs/ExecState.cpp: Deleted contents. Later we'll remove the
2506 * kjs/ExecState.h: Removed m_globalObject and m_globalData.
2507 Moved CodeType into another header.
2508 (JSC::ExecState::ExecState): Take only a single argument, a
2510 (JSC::ExecState::dynamicGlobalObject): Get the object from
2511 the first call frame since it's no longer stored.
2512 (JSC::ExecState::globalData): Get the global data from the
2513 scope chain, since we no longer store a pointer to it here.
2514 (JSC::ExecState::identifierTable): Ditto.
2515 (JSC::ExecState::propertyNames): Ditto.
2516 (JSC::ExecState::emptyList): Ditto.
2517 (JSC::ExecState::lexer): Ditto.
2518 (JSC::ExecState::parser): Ditto.
2519 (JSC::ExecState::machine): Ditto.
2520 (JSC::ExecState::arrayTable): Ditto.
2521 (JSC::ExecState::dateTable): Ditto.
2522 (JSC::ExecState::mathTable): Ditto.
2523 (JSC::ExecState::numberTable): Ditto.
2524 (JSC::ExecState::regExpTable): Ditto.
2525 (JSC::ExecState::regExpConstructorTable): Ditto.
2526 (JSC::ExecState::stringTable): Ditto.
2527 (JSC::ExecState::heap): Ditto.
2529 * kjs/FunctionConstructor.cpp:
2530 (JSC::FunctionConstructor::FunctionConstructor): Pass
2531 JSGlobalData* instead of ExecState* to the InternalFunction
2533 (JSC::constructFunction): Pass the global data pointer when
2534 constructing a new scope chain.
2536 * kjs/InternalFunction.cpp:
2537 (JSC::InternalFunction::InternalFunction): Take a JSGlobalData*
2538 instead of an ExecState*. Later we can change more places to
2539 work this way -- it's more efficient to take the type you need
2540 since the caller might already have it.
2541 * kjs/InternalFunction.h: Ditto.
2544 (JSC::JSCell::operator new): Added an overload that takes a
2545 JSGlobalData* so you can construct without an ExecState*.
2547 * kjs/JSGlobalObject.cpp:
2548 (JSC::JSGlobalObject::init): Moved creation of the global scope
2549 chain in here, since it now requires a pointer to the global data.
2550 Moved the initialization of the call frame in here since it requires
2551 the global scope chain node. Removed the extra argument to ExecState
2552 when creating the global ExecState*.
2553 * kjs/JSGlobalObject.h: Removed initialization of globalScopeChain
2554 and the call frame from the JSGlobalObjectData constructor. Added
2555 a thisValue argument to the init function.
2557 * kjs/JSNumberCell.cpp: Added versions of jsNumberCell that take
2558 JSGlobalData* rather than ExecState*.
2559 * kjs/JSNumberCell.h:
2560 (JSC::JSNumberCell::operator new): Added a version that takes
2562 (JSC::JSNumberCell::JSNumberCell): Ditto.
2563 (JSC::jsNumber): Ditto.
2565 (JSC::jsString): Ditto.
2566 (JSC::jsSubstring): Ditto.
2567 (JSC::jsOwnedString): Ditto.
2569 (JSC::JSString::JSString): Changed to take JSGlobalData*.
2570 (JSC::jsEmptyString): Added a version that takes JSGlobalData*.
2571 (JSC::jsSingleCharacterString): Ditto.
2572 (JSC::jsSingleCharacterSubstring): Ditto.
2573 (JSC::jsNontrivialString): Ditto.
2574 (JSC::JSString::getIndex): Ditto.
2575 (JSC::jsString): Ditto.
2576 (JSC::jsSubstring): Ditto.
2577 (JSC::jsOwnedString): Ditto.
2579 * kjs/ScopeChain.h: Added a globalData pointer to each node.
2580 (JSC::ScopeChainNode::ScopeChainNode): Initialize the globalData
2582 (JSC::ScopeChainNode::push): Set the global data pointer in the
2584 (JSC::ScopeChain::ScopeChain): Take a globalData argument.
2586 * kjs/SmallStrings.cpp:
2587 (JSC::SmallStrings::createEmptyString): Take JSGlobalData* instead of
2589 (JSC::SmallStrings::createSingleCharacterString): Ditto.
2590 * kjs/SmallStrings.h:
2591 (JSC::SmallStrings::emptyString): Ditto.
2592 (JSC::SmallStrings::singleCharacterString): Ditto.
2594 2008-10-03 Cameron Zwarich <zwarich@apple.com>
2596 Reviewed by Geoff Garen.
2598 Bug 21343: REGRESSSION (r37160): ecma_3/ExecutionContexts/10.1.3-1.js and js1_4/Functions/function-001.js fail on 64-bit
2599 <https://bugs.webkit.org/show_bug.cgi?id=21343>
2601 Add a workaround for a bug in GCC, which affects GCC 4.0, GCC 4.2, and
2602 llvm-gcc 4.2. I put it in an #ifdef because it was a slight regression
2603 on SunSpider in 32-bit, although that might be entirely random.
2605 * kjs/Arguments.cpp:
2606 (JSC::Arguments::getOwnPropertySlot):
2608 2008-10-03 Darin Adler <darin@apple.com>
2610 Rubber stamped by Alexey Proskuryakov.
2612 * kjs/Shell.cpp: (main): Don't delete JSGlobalData. Later, we need to change
2613 this tool to use public JavaScriptCore API instead.
2615 2008-10-03 Darin Adler <darin@apple.com>
2617 Suggested by Alexey Proskuryakov.
2619 * kjs/JSGlobalData.cpp:
2620 (JSC::JSGlobalData::~JSGlobalData): Remove call to heap.destroy() because
2621 it's too late to ref the JSGlobalData object once it's already being
2622 destroyed. In practice this is not a problem because WebCore's JSGlobalData
2623 is never destroyed and JSGlobalContextRelease takes care of calling
2624 heap.destroy() in advance.
2626 2008-10-02 Oliver Hunt <oliver@apple.com>
2628 Reviewed by Maciej Stachowiak.
2630 Replace SSE3 check with an SSE2 check, and implement SSE2 check on windows.
2632 5.6% win on SunSpider on windows.
2635 (JSC::isSSE2Present):
2636 (JSC::CTI::compileBinaryArithOp):
2637 (JSC::CTI::compileBinaryArithOpSlowCase):
2639 2008-10-03 Maciej Stachowiak <mjs@apple.com>
2641 Rubber stamped by Cameron Zwarich.
2643 - fix mistaken change of | to || which caused a big perf regression on EarleyBoyer
2647 2008-10-02 Darin Adler <darin@apple.com>
2649 Reviewed by Geoff Garen.
2651 - https://bugs.webkit.org/show_bug.cgi?id=21321
2652 Bug 21321: speed up JavaScriptCore by inlining Heap in JSGlobalData
2654 1.019x as fast on SunSpider.
2657 (JSEvaluateScript): Use heap. instead of heap-> to work with the heap.
2658 (JSCheckScriptSyntax): Ditto.
2659 (JSGarbageCollect): Ditto.
2660 (JSReportExtraMemoryCost): Ditto.
2661 * API/JSContextRef.cpp:
2662 (JSGlobalContextRetain): Ditto.
2663 (JSGlobalContextRelease): Destroy the heap with the destroy function instead
2664 of the delete operator.
2665 (JSContextGetGlobalObject): Use heap. instead of heap-> to work with the heap.
2666 * API/JSObjectRef.cpp:
2667 (JSObjectMake): Use heap. instead of heap-> to work with the heap.
2668 (JSObjectMakeFunctionWithCallback): Ditto.
2669 (JSObjectMakeConstructor): Ditto.
2670 (JSObjectMakeFunction): Ditto.
2671 (JSObjectMakeArray): Ditto.
2672 (JSObjectMakeDate): Ditto.
2673 (JSObjectMakeError): Ditto.
2674 (JSObjectMakeRegExp): Ditto.
2675 (JSObjectHasProperty): Ditto.
2676 (JSObjectGetProperty): Ditto.
2677 (JSObjectSetProperty): Ditto.
2678 (JSObjectGetPropertyAtIndex): Ditto.
2679 (JSObjectSetPropertyAtIndex): Ditto.
2680 (JSObjectDeleteProperty): Ditto.
2681 (JSObjectCallAsFunction): Ditto.
2682 (JSObjectCallAsConstructor): Ditto.
2683 (JSObjectCopyPropertyNames): Ditto.
2684 (JSPropertyNameAccumulatorAddName): Ditto.
2685 * API/JSValueRef.cpp:
2686 (JSValueIsEqual): Ditto.
2687 (JSValueIsInstanceOfConstructor): Ditto.
2688 (JSValueMakeNumber): Ditto.
2689 (JSValueMakeString): Ditto.
2690 (JSValueToNumber): Ditto.
2691 (JSValueToStringCopy): Ditto.
2692 (JSValueToObject): Ditto.
2693 (JSValueProtect): Ditto.
2694 (JSValueUnprotect): Ditto.
2697 (JSC::ExecState::heap): Update to use the & operator.
2699 * kjs/JSGlobalData.cpp:
2700 (JSC::JSGlobalData::JSGlobalData): Update to initialize a heap member
2701 instead of calling new to make a heap.
2702 (JSC::JSGlobalData::~JSGlobalData): Destroy the heap with the destroy
2703 function instead of the delete operator.
2704 * kjs/JSGlobalData.h: Change from Heap* to a Heap.
2705 * kjs/JSGlobalObject.cpp:
2706 (JSC::JSGlobalObject::mark): Use the & operator here.
2707 (JSC::JSGlobalObject::operator new): Use heap. instead of heap-> to work
2710 2008-10-02 Cameron Zwarich <zwarich@apple.com>
2712 Reviewed by Geoff Garen.
2714 Bug 21317: Replace RegisterFile size and capacity information with Register pointers
2715 <https://bugs.webkit.org/show_bug.cgi?id=21317>
2717 This is a 2.3% speedup on the V8 DeltaBlue benchmark, a 3.3% speedup on
2718 the V8 Raytrace benchmark, and a 1.0% speedup on SunSpider.
2721 (JSC::slideRegisterWindowForCall):
2722 (JSC::Machine::callEval):
2723 (JSC::Machine::execute):
2724 (JSC::Machine::privateExecute):
2725 (JSC::Machine::cti_op_call_JSFunction):
2726 (JSC::Machine::cti_op_construct_JSConstruct):
2727 * VM/RegisterFile.cpp:
2728 (JSC::RegisterFile::~RegisterFile):
2729 * VM/RegisterFile.h:
2730 (JSC::RegisterFile::RegisterFile):
2731 (JSC::RegisterFile::start):
2732 (JSC::RegisterFile::end):
2733 (JSC::RegisterFile::size):
2734 (JSC::RegisterFile::shrink):
2735 (JSC::RegisterFile::grow):
2736 (JSC::RegisterFile::lastGlobal):
2737 (JSC::RegisterFile::markGlobals):
2738 (JSC::RegisterFile::markCallFrames):
2739 * kjs/JSGlobalObject.cpp:
2740 (JSC::JSGlobalObject::copyGlobalsTo):
2742 2008-10-02 Cameron Zwarich <zwarich@apple.com>
2744 Rubber-stamped by Darin Adler.
2746 Change bitwise operations introduced in r37166 to boolean operations. We
2747 only use bitwise operations over boolean operations for increasing
2748 performance in extremely hot code, but that does not apply to anything
2753 2008-10-02 Gavin Barraclough <barraclough@apple.com>
2755 Reviewed by Darin Adler.
2757 Fix for bug #21232 - should reset m_isPendingDash on flush,
2758 and should allow '\-' as beginning or end of a range (though
2759 not to specifiy a range itself).
2762 * wrec/CharacterClassConstructor.cpp:
2763 (JSC::CharacterClassConstructor::put):
2764 (JSC::CharacterClassConstructor::flush):
2765 * wrec/CharacterClassConstructor.h:
2766 (JSC::CharacterClassConstructor::flushBeforeEscapedHyphen):
2768 (JSC::WRECGenerator::generateDisjunction):
2769 (JSC::WRECParser::parseCharacterClass):
2770 (JSC::WRECParser::parseDisjunction):
2773 2008-10-02 Darin Adler <darin@apple.com>
2775 Reviewed by Sam Weinig.
2777 - remove the "static" from declarations in a header file, since we
2778 don't want them to have internal linkage
2780 * VM/Machine.h: Remove the static keyword from the constant and the
2781 three inline functions that Geoff just moved here.
2783 2008-10-02 Geoffrey Garen <ggaren@apple.com>
2785 Reviewed by Sam Weinig.
2787 Fixed https://bugs.webkit.org/show_bug.cgi?id=21283.
2788 Profiler Crashes When Started
2792 (JSC::makeHostCallFramePointer):
2793 (JSC::isHostCallFrame):
2794 (JSC::stripHostCallFrameBit): Moved some things to the header so
2795 JSGlobalObject could use them.
2797 * kjs/JSGlobalObject.h:
2798 (JSC::JSGlobalObject::JSGlobalObjectData::JSGlobalObjectData): Call the
2799 new makeHostCallFramePointer API, since 0 no longer indicates a host
2802 2008-10-02 Alexey Proskuryakov <ap@webkit.org>
2804 Reviewed by Darin Adler.
2806 https://bugs.webkit.org/show_bug.cgi?id=21304
2807 Stop using a static wrapper map for WebCore JS bindings
2809 * kjs/JSGlobalData.cpp:
2810 (JSC::JSGlobalData::JSGlobalData):
2811 (JSC::JSGlobalData::~JSGlobalData):
2812 (JSC::JSGlobalData::ClientData::~ClientData):
2813 * kjs/JSGlobalData.h:
2814 Added a client data member to JSGlobalData. WebCore will use it to store bindings-related
2817 * JavaScriptCore.exp: Export virtual ClientData destructor.
2819 2008-10-02 Geoffrey Garen <ggaren@apple.com>
2823 Try to fix Qt build.
2827 2008-10-01 Geoffrey Garen <ggaren@apple.com>
2829 Reviewed by Darin Adler and Cameron Zwarich.
2831 Preliminary step toward dynamic recompilation: Standardized and
2832 simplified the parsing interface.
2834 The main goal in this patch is to make it easy to ask for a duplicate
2835 compilation, and get back a duplicate result -- same source URL, same
2836 debugger / profiler ID, same toString behavior, etc.
2838 The basic unit of compilation and evaluation is now SourceCode, which
2839 encompasses a SourceProvider, a range in that provider, and a starting
2842 A SourceProvider now encompasses a source URL, and *is* a source ID,
2843 since a pointer is a unique identifier.
2847 (JSCheckScriptSyntax): Provide a SourceCode to the Interpreter, since
2848 other APIs are no longer supported.
2851 (JSC::EvalCodeCache::get): Provide a SourceCode to the Interpreter, since
2852 other APIs are no longer supported.
2853 (JSC::CodeBlock::CodeBlock): ASSERT something that used to be ASSERTed
2854 by our caller -- this is a better bottleneck.
2856 * VM/CodeGenerator.cpp:
2857 (JSC::CodeGenerator::CodeGenerator): Updated for the fact that
2858 FunctionBodyNode's parameters are no longer a WTF::Vector.
2860 * kjs/Arguments.cpp:
2861 (JSC::Arguments::Arguments): ditto
2863 * kjs/DebuggerCallFrame.cpp:
2864 (JSC::DebuggerCallFrame::evaluate): Provide a SourceCode to the Parser,
2865 since other APIs are no longer supported.
2867 * kjs/FunctionConstructor.cpp:
2868 (JSC::constructFunction): Provide a SourceCode to the Parser, since
2869 other APIs are no longer supported. Adopt FunctionBodyNode's new
2870 "finishParsing" API.
2872 * kjs/JSFunction.cpp:
2873 (JSC::JSFunction::lengthGetter):
2874 (JSC::JSFunction::getParameterName): Updated for the fact that
2875 FunctionBodyNode's parameters are no longer a wtf::Vector.
2877 * kjs/JSFunction.h: Nixed some cruft.
2879 * kjs/JSGlobalObjectFunctions.cpp:
2880 (JSC::globalFuncEval): Provide a SourceCode to the Parser, since
2881 other APIs are no longer supported.
2884 (JSC::Parser::parse): Require a SourceCode argument, instead of a bunch
2885 of broken out parameters. Stop tracking sourceId as an integer, since we
2886 use the SourceProvider pointer for this now. Don't clamp the
2887 startingLineNumber, since SourceCode does that now.
2890 (JSC::Parser::parse): Standardized the parsing interface to require a
2896 (prettyPrintScript):
2898 (runInteractive): Provide a SourceCode to the Interpreter, since
2899 other APIs are no longer supported.
2901 * kjs/SourceProvider.h:
2902 (JSC::SourceProvider::SourceProvider):
2903 (JSC::SourceProvider::url):
2904 (JSC::SourceProvider::asId):
2905 (JSC::UStringSourceProvider::create):
2906 (JSC::UStringSourceProvider::UStringSourceProvider): Added new
2907 responsibilities described above.
2909 * kjs/SourceRange.h:
2910 (JSC::SourceCode::SourceCode):
2911 (JSC::SourceCode::toString):
2912 (JSC::SourceCode::provider):
2913 (JSC::SourceCode::firstLine):
2914 (JSC::SourceCode::data):
2915 (JSC::SourceCode::length): Added new responsibilities described above.
2916 Renamed SourceRange to SourceCode, based on review feedback. Added
2917 a makeSource function for convenience.
2919 * kjs/debugger.h: Provide a SourceCode to the client, since other APIs
2920 are no longer supported.
2922 * kjs/grammar.y: Provide startingLineNumber when creating a SourceCode.
2924 * kjs/debugger.h: Treat sourceId as intptr_t to avoid loss of precision
2927 * kjs/interpreter.cpp:
2928 (JSC::Interpreter::checkSyntax):
2929 (JSC::Interpreter::evaluate):
2930 * kjs/interpreter.h: Require a SourceCode instead of broken out arguments.
2933 (JSC::Lexer::setCode):
2935 (JSC::Lexer::sourceRange): Fold together the SourceProvider and line number
2936 into a SourceCode. Fixed a bug where the Lexer would accidentally keep
2937 alive the last SourceProvider forever.
2940 (JSC::ScopeNode::ScopeNode):
2941 (JSC::ProgramNode::ProgramNode):
2942 (JSC::ProgramNode::create):
2943 (JSC::EvalNode::EvalNode):
2944 (JSC::EvalNode::generateCode):
2945 (JSC::EvalNode::create):
2946 (JSC::FunctionBodyNode::FunctionBodyNode):
2947 (JSC::FunctionBodyNode::finishParsing):
2948 (JSC::FunctionBodyNode::create):
2949 (JSC::FunctionBodyNode::generateCode):
2950 (JSC::ProgramNode::generateCode):
2951 (JSC::FunctionBodyNode::paramString):
2954 (JSC::ScopeNode::sourceId):
2955 (JSC::FunctionBodyNode::):
2956 (JSC::FunctionBodyNode::parameterCount):
2957 (JSC::FuncExprNode::):
2958 (JSC::FuncDeclNode::): Store a SourceCode in all ScopeNodes, since
2959 SourceCode is now responsible for tracking URL, ID, etc. Streamlined
2960 some ad hoc FunctionBodyNode fixups into a "finishParsing" function, to
2961 help make clear what you need to do in order to finish parsing a
2965 (WTF::::releaseBuffer): Don't ASSERT that releaseBuffer() is only called
2966 when buffer is not 0, since FunctionBodyNode is more than happy
2967 to get back a 0 buffer, and other functions like RefPtr::release() allow
2970 2008-10-01 Cameron Zwarich <zwarich@apple.com>
2972 Reviewed by Maciej Stachowiak.
2974 Bug 21289: REGRESSION (r37160): Inspector crashes on load
2975 <https://bugs.webkit.org/show_bug.cgi?id=21289>
2977 The code in Arguments::mark() in r37160 was wrong. It marks indices in
2978 d->registers, but that makes no sense (they are local variables, not
2979 arguments). It should mark those indices in d->registerArray instead.
2981 This patch also changes Arguments::copyRegisters() to use d->numParameters
2982 instead of recomputing it.
2984 * kjs/Arguments.cpp:
2985 (JSC::Arguments::mark):
2987 (JSC::Arguments::copyRegisters):
2989 2008-09-30 Darin Adler <darin@apple.com>
2991 Reviewed by Eric Seidel.
2993 - https://bugs.webkit.org/show_bug.cgi?id=21214
2994 work on getting rid of ExecState
2996 Eliminate some unneeded uses of dynamicGlobalObject.
2998 * API/JSClassRef.cpp:
2999 (OpaqueJSClass::contextData): Changed to use a map in the global data instead
3000 of on the global object. Also fixed to use only a single hash table lookup.
3002 * API/JSObjectRef.cpp:
3003 (JSObjectMakeConstructor): Use lexicalGlobalObject rather than dynamicGlobalObject
3004 to get the object prototype.
3006 * kjs/ArrayPrototype.cpp:
3007 (JSC::arrayProtoFuncToString): Use arrayVisitedElements set in global data rather
3008 than in the global object.
3009 (JSC::arrayProtoFuncToLocaleString): Ditto.
3010 (JSC::arrayProtoFuncJoin): Ditto.
3012 * kjs/JSGlobalData.cpp:
3013 (JSC::JSGlobalData::JSGlobalData): Don't initialize opaqueJSClassData, since
3014 it's no longer a pointer.
3015 (JSC::JSGlobalData::~JSGlobalData): We still need to delete all the values, but
3016 we don't need to delete the map since it's no longer a pointer.
3018 * kjs/JSGlobalData.h: Made opaqueJSClassData a map instead of a pointer to a map.
3019 Also added arrayVisitedElements.
3021 * kjs/JSGlobalObject.h: Removed arrayVisitedElements.
3024 (functionRun): Use lexicalGlobalObject instead of dynamicGlobalObject.
3025 (functionLoad): Ditto.
3027 2008-10-01 Cameron Zwarich <zwarich@apple.com>
3031 Speculative Windows build fix.
3035 2008-10-01 Cameron Zwarich <zwarich@apple.com>
3037 Reviewed by Darin Adler.
3039 Bug 21123: using "arguments" in a function should not force creation of an activation object
3040 <https://bugs.webkit.org/show_bug.cgi?id=21123>
3042 Make the 'arguments' object not require a JSActivation. We store the
3043 'arguments' object in the OptionalCalleeArguments call frame slot. We
3044 need to be able to get the original 'arguments' object to tear it off
3045 when returning from a function, but 'arguments' may be assigned to in a
3048 Therefore, we use the OptionalCalleeArguments slot when we want to get
3049 the original activation or we know that 'arguments' was not assigned a
3050 different value. When 'arguments' may have been assigned a new value,
3051 we use a new local variable that is initialized with 'arguments'. Since
3052 a function parameter named 'arguments' may overwrite the value of
3053 'arguments', we also need to be careful to look up 'arguments' in the
3054 symbol table, so we get the parameter named 'arguments' instead of the
3055 local variable that we have added for holding the 'arguments' object.
3057 This is a 19.1% win on the V8 Raytrace benchmark using the SunSpider
3058 harness, and a 20.7% win using the V8 harness. This amounts to a 6.5%
3059 total speedup on the V8 benchmark suite using the V8 harness.
3062 (JSC::CTI::privateCompileMainPass):
3064 * VM/CodeGenerator.cpp:
3065 (JSC::CodeGenerator::CodeGenerator):
3067 (JSC::Machine::unwindCallFrame):
3068 (JSC::Machine::privateExecute):
3069 (JSC::Machine::retrieveArguments):
3070 (JSC::Machine::cti_op_init_arguments):
3071 (JSC::Machine::cti_op_ret_activation_arguments):
3073 * VM/RegisterFile.h:
3074 (JSC::RegisterFile::):
3075 * kjs/Arguments.cpp:
3076 (JSC::Arguments::mark):
3077 (JSC::Arguments::fillArgList):
3078 (JSC::Arguments::getOwnPropertySlot):
3079 (JSC::Arguments::put):
3081 (JSC::Arguments::setRegisters):
3082 (JSC::Arguments::init):
3083 (JSC::Arguments::Arguments):
3084 (JSC::Arguments::copyRegisters):
3085 (JSC::JSActivation::copyRegisters):
3086 * kjs/JSActivation.cpp:
3087 (JSC::JSActivation::argumentsGetter):
3088 * kjs/JSActivation.h:
3089 (JSC::JSActivation::JSActivationData::JSActivationData):
3092 (JSC::ScopeNode::setUsesArguments):
3093 * masm/X86Assembler.h:
3094 (JSC::X86Assembler::):
3095 (JSC::X86Assembler::orl_mr):
3097 2008-10-01 Kevin McCullough <kmccullough@apple.com>
3099 Rubberstamped by Geoff Garen.
3101 Remove BreakpointCheckStatement because it's not used anymore.
3102 No effect on sunspider or the jsc tests.
3107 2008-09-30 Oliver Hunt <oliver@apple.com>
3109 Reviewed by Geoff Garen.
3111 Improve performance of CTI on windows.
3113 Currently on platforms where the compiler doesn't allow us to safely
3114 index relative to the address of a parameter we need to actually
3115 provide a pointer to CTI runtime call arguments. This patch improves
3116 performance in this case by making the CTI logic for restoring this
3117 parameter much less conservative by only resetting it before we actually
3118 make a call, rather than between each and every SF bytecode we generate
3121 This results in a 3.6% progression on the v8 benchmark when compiled with MSVC.
3124 (JSC::CTI::emitCall):
3125 (JSC::CTI::compileOpCall):
3126 (JSC::CTI::privateCompileMainPass):
3127 (JSC::CTI::privateCompileSlowCases):
3128 (JSC::CTI::privateCompilePutByIdTransition):
3130 * masm/X86Assembler.h:
3133 2008-09-30 Maciej Stachowiak <mjs@apple.com>
3135 Reviewed by Oliver Hunt.
3137 - track uses of "this", "with" and "catch" in the parser
3139 Knowing this up front will be useful for future optimizations.
3141 Perf and correctness remain the same.
3146 2008-09-30 Sam Weinig <sam@webkit.org>
3148 Reviewed by Mark Rowe.
3150 Add WebKitAvailability macros for JSObjectMakeArray, JSObjectMakeDate, JSObjectMakeError,
3151 and JSObjectMakeRegExp
3153 * API/JSObjectRef.h:
3155 2008-09-30 Darin Adler <darin@apple.com>
3157 Reviewed by Geoff Garen.
3159 - https://bugs.webkit.org/show_bug.cgi?id=21214
3160 work on getting rid of ExecState
3162 Replaced the m_prev field of ExecState with a bit in the
3163 call frame pointer to indicate "host" call frames.
3166 (JSC::makeHostCallFramePointer): Added. Sets low bit.
3167 (JSC::isHostCallFrame): Added. Checks low bit.
3168 (JSC::stripHostCallFrameBit): Added. Clears low bit.
3169 (JSC::Machine::unwindCallFrame): Replaced null check that was
3170 formerly used to detect host call frames with an isHostCallFrame check.
3171 (JSC::Machine::execute): Pass in a host call frame pointer rather than
3172 always passing 0 when starting execution from the host. This allows us
3173 to follow the entire call frame pointer chain when desired, or to stop
3174 at the host calls when that's desired.
3175 (JSC::Machine::privateExecute): Replaced null check that was
3176 formerly used to detect host call frames with an isHostCallFrame check.
3177 (JSC::Machine::retrieveCaller): Ditto.
3178 (JSC::Machine::retrieveLastCaller): Ditto.
3179 (JSC::Machine::callFrame): Removed the code to walk up m_prev pointers
3180 and replaced it with code that uses the caller pointer and uses the
3181 stripHostCallFrameBit function.
3183 * kjs/ExecState.cpp: Removed m_prev.
3184 * kjs/ExecState.h: Ditto.
3186 2008-09-30 Cameron Zwarich <zwarich@apple.com>
3188 Reviewed by Geoff Garen.
3190 Move all detection of 'arguments' in a lexical scope to the parser, in
3191 preparation for fixing
3193 Bug 21123: using "arguments" in a function should not force creation of an activation object
3194 <https://bugs.webkit.org/show_bug.cgi?id=21123>
3196 * VM/CodeGenerator.cpp:
3197 (JSC::CodeGenerator::CodeGenerator):
3201 2008-09-30 Geoffrey Garen <ggaren@apple.com>
3206 (runWithScripts): Fixed indentation.
3208 2008-09-30 Mark Rowe <mrowe@apple.com>
3210 Rubber-stamped by Sam Weinig.
3212 Build fix. Move InternalFunction::classInfo implementation into the .cpp
3213 file to prevent the vtable for InternalFunction being generated as a weak symbol.
3214 Has no effect on SunSpider.
3216 * kjs/InternalFunction.cpp:
3217 (JSC::InternalFunction::classInfo):
3218 * kjs/InternalFunction.h:
3220 2008-09-29 Maciej Stachowiak <mjs@apple.com>
3222 Reviewed by Darin Adler.
3224 - optimize appending a number to a string
3225 https://bugs.webkit.org/show_bug.cgi?id=21203
3227 It's pretty common in real-world code (and on some of the v8
3228 benchmarks) to append a number to a string, so I made this one of
3229 the fast cases, and also added support to UString to do it
3230 directly without allocating a temporary UString.
3232 ~1% speedup on v8 benchmark.
3235 (JSC::jsAddSlowCase): Make this NEVER_INLINE because somehow otherwise
3236 the change is a regression.
3237 (JSC::jsAdd): Handle number + string special case.
3238 (JSC::Machine::cti_op_add): Integrate much of the logic of jsAdd to
3239 avoid exception check in the str + str, num + num and str + num cases.
3241 (JSC::expandedSize): Make this a non-member function, since it needs to be
3242 called in non-member functions but not outside this file.
3243 (JSC::expandCapacity): Ditto.
3244 (JSC::UString::expandCapacity): Call the non-member version.
3245 (JSC::createRep): Helper to make a rep from a char*.
3246 (JSC::UString::UString): Use above helper.
3247 (JSC::concatenate): Guts of concatenating constructor for cases where first
3248 item is a UString::Rep, and second is a UChar* and length, or a char*.
3249 (JSC::UString::append): Implement for cases where first item is a UString::Rep,
3250 and second is an int or double. Sadly duplicates logic of UString::from(int)
3251 and UString::from(double).
3254 2008-09-29 Darin Adler <darin@apple.com>
3256 Reviewed by Sam Weinig.
3258 - https://bugs.webkit.org/show_bug.cgi?id=21214
3259 work on getting rid of ExecState
3261 * JavaScriptCore.exp: Updated since JSGlobalObject::init
3262 no longer takes a parameter.
3265 (JSC::Machine::execute): Removed m_registerFile argument
3266 for ExecState constructors.
3268 * kjs/DebuggerCallFrame.cpp:
3269 (JSC::DebuggerCallFrame::evaluate): Removed globalThisValue
3270 argument for ExecState constructor.
3272 * kjs/ExecState.cpp:
3273 (JSC::ExecState::ExecState): Removed globalThisValue and
3274 registerFile arguments to constructors.
3276 * kjs/ExecState.h: Removed m_globalThisValue and
3277 m_registerFile data members.
3279 * kjs/JSGlobalObject.cpp:
3280 (JSC::JSGlobalObject::init): Removed globalThisValue
3281 argument for ExecState constructor.
3283 * kjs/JSGlobalObject.h:
3284 (JSC::JSGlobalObject::JSGlobalObject): Got rid of parameter
3285 for the init function.
3287 2008-09-29 Geoffrey Garen <ggaren@apple.com>
3289 Rubber-stamped by Cameron Zwarich.
3291 Fixed https://bugs.webkit.org/show_bug.cgi?id=21225
3292 Machine::retrieveLastCaller should check for a NULL codeBlock
3294 In order to crash, you would need to call retrieveCaller in a situation
3295 where you had two host call frames in a row in the register file. I
3296 don't know how to make that happen, or if it's even possible, so I don't
3297 have a test case -- but better safe than sorry!
3300 (JSC::Machine::retrieveLastCaller):
3302 2008-09-29 Geoffrey Garen <ggaren@apple.com>
3304 Reviewed by Cameron Zwarich.
3306 Store the callee ScopeChain, not the caller ScopeChain, in the call frame
3307 header. Nix the "scopeChain" local variable and ExecState::m_scopeChain, and
3308 access the callee ScopeChain through the call frame header instead.
3310 Profit: call + return are simpler, because they don't have to update the
3311 "scopeChain" local variable, or ExecState::m_scopeChain.
3313 Because CTI keeps "r" in a register, reading the callee ScopeChain relative
3314 to "r" can be very fast, in any cases we care to optimize.
3316 0% speedup on empty function call benchmark. (5.5% speedup in bytecode.)
3317 0% speedup on SunSpider. (7.5% speedup on controlflow-recursive.)
3318 2% speedup on SunSpider --v8.
3319 2% speedup on v8 benchmark.
3321 * VM/CTI.cpp: Changed scope chain access to read the scope chain from
3322 the call frame header. Sped up op_ret by changing it not to fuss with
3323 the "scopeChain" local variable or ExecState::m_scopeChain.
3325 * VM/CTI.h: Updated CTI trampolines not to take a ScopeChainNode*
3326 argument, since that's stored in the call frame header now.
3328 * VM/Machine.cpp: Access "scopeChain" and "codeBlock" through new helper
3329 functions that read from the call frame header. Updated functions operating
3330 on ExecState::m_callFrame to account for / take advantage of the fact that
3331 Exec:m_callFrame is now never NULL.
3333 Fixed a bug in op_construct, where it would use the caller's default
3334 object prototype, rather than the callee's, when constructing a new object.
3336 * VM/Machine.h: Made some helper functions available. Removed
3337 ScopeChainNode* arguments to a lot of functions, since the ScopeChainNode*
3338 is now stored in the call frame header.
3340 * VM/RegisterFile.h: Renamed "CallerScopeChain" to "ScopeChain", since
3341 that's what it is now.
3343 * kjs/DebuggerCallFrame.cpp: Updated for change to ExecState signature.
3345 * kjs/ExecState.cpp:
3346 * kjs/ExecState.h: Nixed ExecState::m_callFrame, along with the unused
3347 isGlobalObject function.
3349 * kjs/JSGlobalObject.cpp:
3350 * kjs/JSGlobalObject.h: Gave the global object a fake call frame in
3351 which to store the global scope chain, since our code now assumes that
3352 it can always read the scope chain out of the ExecState's call frame.
3354 2008-09-29 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3356 Reviewed by Sam Weinig.
3358 Remove the isActivationObject() virtual method on JSObject and use
3359 StructureID information instead. This should be slightly faster, but
3360 isActivationObject() is only used in assertions and unwinding the stack
3365 (JSC::Machine::unwindCallFrame):
3366 (JSC::Machine::privateExecute):
3367 (JSC::Machine::cti_op_ret_activation):
3368 * kjs/JSActivation.cpp:
3369 * kjs/JSActivation.h:
3372 2008-09-29 Peter Gal <galpeter@inf.u-szeged.hu>
3374 Reviewed and tweaked by Darin Adler.
3376 Fix build for non-all-in-one platforms.
3378 * kjs/StringPrototype.cpp: Added missing ASCIICType.h include.
3380 2008-09-29 Bradley T. Hughes <bradley.hughes@nokia.com>
3382 Reviewed by Simon Hausmann.
3384 Fix compilation with icpc
3390 2008-09-29 Thiago Macieira <thiago.macieira@nokia.com>
3392 Reviewed by Simon Hausmann.
3394 Changed copyright from Trolltech ASA to Nokia.
3396 Nokia acquired Trolltech ASA, assets were transferred on September 26th 2008.
3399 * wtf/qt/MainThreadQt.cpp:
3401 2008-09-29 Simon Hausmann <hausmann@webkit.org>
3403 Reviewed by Lars Knoll.
3405 Don't accidentially install libJavaScriptCore.a for the build inside
3408 * JavaScriptCore.pro:
3410 2008-09-28 Cameron Zwarich <cwzwarich@uwaterloo.ca>
3412 Reviewed by Maciej Stachowiak.
3414 Bug 21200: Allow direct access to 'arguments' without using op_resolve
3415 <https://bugs.webkit.org/show_bug.cgi?id=21200>
3417 Allow fast access to the 'arguments' object by adding an extra slot to
3418 the callframe to store it.
3420 This is a 3.0% speedup on the V8 Raytrace benchmark.
3422 * JavaScriptCore.exp:
3424 (JSC::CTI::privateCompileMainPass):
3426 (JSC::CodeBlock::dump):
3427 * VM/CodeGenerator.cpp:
3428 (JSC::CodeGenerator::CodeGenerator):
3429 (JSC::CodeGenerator::registerFor):
3430 * VM/CodeGenerator.h:
3431 (JSC::CodeGenerator::registerFor):
3433 (JSC::Machine::initializeCallFrame):
3434 (JSC::Machine::dumpRegisters):
3435 (JSC::Machine::privateExecute):
3436 (JSC::Machine::retrieveArguments):
3437 (JSC::Machine::cti_op_call_JSFunction):
3438 (JSC::Machine::cti_op_create_arguments):
3439 (JSC::Machine::cti_op_construct_JSConstruct):
3442 * VM/RegisterFile.h:
3443 (JSC::RegisterFile::):
3444 * kjs/JSActivation.cpp:
3445 (JSC::JSActivation::mark):
3446 (JSC::JSActivation::argumentsGetter):
3447 * kjs/JSActivation.h:
3448 (JSC::JSActivation::JSActivationData::JSActivationData):
3451 (JSC::Parser::didFinishParsing):
3453 (JSC::Parser::parse):
3456 (JSC::ScopeNode::ScopeNode):
3457 (JSC::ProgramNode::ProgramNode):
3458 (JSC::ProgramNode::create):
3459 (JSC::EvalNode::EvalNode):
3460 (JSC::EvalNode::create):
3461 (JSC::FunctionBodyNode::FunctionBodyNode):
3462 (JSC::FunctionBodyNode::create):
3464 (JSC::ScopeNode::usesArguments):
3466 2008-09-28 Mark Rowe <mrowe@apple.com>
3468 Reviewed by Sam Weinig.
3470 Add an ASCII fast-path to toLowerCase and toUpperCase.
3472 The fast path speeds up the common case of an ASCII-only string by up to 60% while adding a less than 5% penalty
3473 to the less common non-ASCII case.
3475 This also removes stringProtoFuncToLocaleLowerCase and stringProtoFuncToLocaleUpperCase, which were identical
3476 to the non-locale variants of the functions. toLocaleLowerCase and toLocaleUpperCase now use the non-locale
3477 variants of the functions directly.
3479 * kjs/StringPrototype.cpp:
3480 (JSC::stringProtoFuncToLowerCase):
3481 (JSC::stringProtoFuncToUpperCase):
3483 2008-09-28 Mark Rowe <mrowe@apple.com>
3485 Reviewed by Cameron Zwarich.
3487 Speed up parseInt and parseFloat.
3489 Repeatedly indexing into a UString is slow, so retrieve a pointer into the underlying buffer once up front
3490 and use that instead. This is a 7% win on a parseInt/parseFloat micro-benchmark.
3492 * kjs/JSGlobalObjectFunctions.cpp:
3496 2008-09-28 Simon Hausmann <hausmann@webkit.org>
3498 Reviewed by David Hyatt.
3500 In Qt's initializeThreading re-use an existing thread identifier for the main
3501 thread if it exists.
3503 currentThread() implicitly creates new identifiers and it could be that
3504 it is called before initializeThreading().
3506 * wtf/ThreadingQt.cpp:
3507 (WTF::initializeThreading):
3509 2008-09-27 Keishi Hattori <casey.hattori@gmail.com>
3511 Added Machine::retrieveCaller to the export list.
3513 Reviewed by Kevin McCullough and Tim Hatcher.
3515 * JavaScriptCore.exp: Added Machine::retrieveCaller.
3517 2008-09-27 Anders Carlsson <andersca@apple.com>
3524 2008-09-27 Geoffrey Garen <ggaren@apple.com>
3526 Reviewed by Cameron Zwarich.
3528 https://bugs.webkit.org/show_bug.cgi?id=21175
3530 Store the callee CodeBlock, not the caller CodeBlock, in the call frame
3531 header. Nix the "codeBlock" local variable, and access the callee
3532 CodeBlock through the call frame header instead.
3534 Profit: call + return are simpler, because they don't have to update the
3535 "codeBlock" local variable.
3537 Because CTI keeps "r" in a register, reading the callee CodeBlock relative
3538 to "r" can be very fast, in any cases we care to optimize. Presently,
3539 no such cases seem important.
3541 Also, stop writing "dst" to the call frame header. CTI doesn't use it.
3543 21.6% speedup on empty function call benchmark.
3544 3.8% speedup on SunSpider --v8.
3545 2.1% speedup on v8 benchmark.
3546 0.7% speedup on SunSpider (6% speedup on controlflow-recursive).
3548 Small regression in bytecode, because currently every op_ret reads the
3549 callee CodeBlock to check needsFullScopeChain, and bytecode does not
3550 keep "r" in a register. On-balance, this is probably OK, since CTI is
3551 our high-performance execution model. Also, this should go away once
3552 we make needsFullScopeChain statically determinable at parse time.
3555 (JSC::CTI::compileOpCall): The speedup!
3556 (JSC::CTI::privateCompileSlowCases): ditto
3559 (JSC::): Fixed up magic trampoline constants to account for the nixed
3560 "codeBlock" argument.
3561 (JSC::CTI::execute): Changed trampoline function not to take a "codeBlock"
3562 argument, since codeBlock is now stored in the call frame header.
3564 * VM/Machine.cpp: Read the callee CodeBlock from the register file. Use
3565 a NULL CallerRegisters in the call frame header to signal a built-in
3566 caller, since CodeBlock is now never NULL.
3568 * VM/Machine.h: Made some stand-alone functions Machine member functions
3569 so they could call the private codeBlock() accessor in the Register
3570 class, of which Machine is a friend. Renamed "CallerCodeBlock" to
3571 "CodeBlock", since it's no longer the caller's CodeBlock.
3573 * VM/RegisterFile.h: Marked some methods const to accommodate a
3574 const RegisterFile* being passed around in Machine.cpp.
3576 2008-09-26 Jan Michael Alonzo <jmalonzo@webkit.org>
3578 Gtk build fix. Not reviewed.
3580 Narrow-down the target of the JavaScriptCore .lut.h generator so
3581 it won't try to create the WebCore .lut.hs.
3585 2008-09-26 Matt Lilek <webkit@mattlilek.com>
3587 Reviewed by Tim Hatcher.
3589 Update FEATURE_DEFINES after ENABLE_CROSS_DOCUMENT_MESSAGING was removed.