| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 2190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2201 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2201 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2202 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2202 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2203 v8::HandleScope scope(CcTest::isolate()); | 2203 v8::HandleScope scope(CcTest::isolate()); |
| 2204 | 2204 |
| 2205 // Grow new space unitl maximum capacity reached. | 2205 // Grow new space unitl maximum capacity reached. |
| 2206 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { | 2206 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { |
| 2207 CcTest::heap()->new_space()->Grow(); | 2207 CcTest::heap()->new_space()->Grow(); |
| 2208 } | 2208 } |
| 2209 | 2209 |
| 2210 i::ScopedVector<char> source(1024); | 2210 i::ScopedVector<char> source(1024); |
| 2211 i::OS::SNPrintF( | 2211 i::SNPrintF( |
| 2212 source, | 2212 source, |
| 2213 "var number_elements = %d;" | 2213 "var number_elements = %d;" |
| 2214 "var elements = new Array();" | 2214 "var elements = new Array();" |
| 2215 "function f() {" | 2215 "function f() {" |
| 2216 " for (var i = 0; i < number_elements; i++) {" | 2216 " for (var i = 0; i < number_elements; i++) {" |
| 2217 " elements[i] = [[{}], [1.1]];" | 2217 " elements[i] = [[{}], [1.1]];" |
| 2218 " }" | 2218 " }" |
| 2219 " return elements[number_elements-1]" | 2219 " return elements[number_elements-1]" |
| 2220 "};" | 2220 "};" |
| 2221 "f(); gc();" | 2221 "f(); gc();" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2250 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2250 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2251 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2251 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2252 v8::HandleScope scope(CcTest::isolate()); | 2252 v8::HandleScope scope(CcTest::isolate()); |
| 2253 | 2253 |
| 2254 // Grow new space unitl maximum capacity reached. | 2254 // Grow new space unitl maximum capacity reached. |
| 2255 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { | 2255 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { |
| 2256 CcTest::heap()->new_space()->Grow(); | 2256 CcTest::heap()->new_space()->Grow(); |
| 2257 } | 2257 } |
| 2258 | 2258 |
| 2259 i::ScopedVector<char> source(1024); | 2259 i::ScopedVector<char> source(1024); |
| 2260 i::OS::SNPrintF( | 2260 i::SNPrintF( |
| 2261 source, | 2261 source, |
| 2262 "var number_elements = %d;" | 2262 "var number_elements = %d;" |
| 2263 "var elements = new Array(number_elements);" | 2263 "var elements = new Array(number_elements);" |
| 2264 "function f() {" | 2264 "function f() {" |
| 2265 " for (var i = 0; i < number_elements; i++) {" | 2265 " for (var i = 0; i < number_elements; i++) {" |
| 2266 " elements[i] = [{}, {}, {}];" | 2266 " elements[i] = [{}, {}, {}];" |
| 2267 " }" | 2267 " }" |
| 2268 " return elements[number_elements - 1];" | 2268 " return elements[number_elements - 1];" |
| 2269 "};" | 2269 "};" |
| 2270 "f(); gc();" | 2270 "f(); gc();" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 2291 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2291 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2292 v8::HandleScope scope(CcTest::isolate()); | 2292 v8::HandleScope scope(CcTest::isolate()); |
| 2293 | 2293 |
| 2294 // Grow new space unitl maximum capacity reached. | 2294 // Grow new space unitl maximum capacity reached. |
| 2295 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { | 2295 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { |
| 2296 CcTest::heap()->new_space()->Grow(); | 2296 CcTest::heap()->new_space()->Grow(); |
| 2297 } | 2297 } |
| 2298 | 2298 |
| 2299 | 2299 |
| 2300 i::ScopedVector<char> source(1024); | 2300 i::ScopedVector<char> source(1024); |
| 2301 i::OS::SNPrintF( | 2301 i::SNPrintF( |
| 2302 source, | 2302 source, |
| 2303 "var number_elements = %d;" | 2303 "var number_elements = %d;" |
| 2304 "var elements = new Array(number_elements);" | 2304 "var elements = new Array(number_elements);" |
| 2305 "function f() {" | 2305 "function f() {" |
| 2306 " for (var i = 0; i < number_elements; i++) {" | 2306 " for (var i = 0; i < number_elements; i++) {" |
| 2307 " elements[i] = {a: {c: 2.2, d: {}}, b: 1.1};" | 2307 " elements[i] = {a: {c: 2.2, d: {}}, b: 1.1};" |
| 2308 " }" | 2308 " }" |
| 2309 " return elements[number_elements - 1];" | 2309 " return elements[number_elements - 1];" |
| 2310 "};" | 2310 "};" |
| 2311 "f(); gc();" | 2311 "f(); gc();" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2341 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2341 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2342 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2342 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2343 v8::HandleScope scope(CcTest::isolate()); | 2343 v8::HandleScope scope(CcTest::isolate()); |
| 2344 | 2344 |
| 2345 // Grow new space unitl maximum capacity reached. | 2345 // Grow new space unitl maximum capacity reached. |
| 2346 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { | 2346 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { |
| 2347 CcTest::heap()->new_space()->Grow(); | 2347 CcTest::heap()->new_space()->Grow(); |
| 2348 } | 2348 } |
| 2349 | 2349 |
| 2350 i::ScopedVector<char> source(1024); | 2350 i::ScopedVector<char> source(1024); |
| 2351 i::OS::SNPrintF( | 2351 i::SNPrintF( |
| 2352 source, | 2352 source, |
| 2353 "var number_elements = %d;" | 2353 "var number_elements = %d;" |
| 2354 "var elements = new Array(number_elements);" | 2354 "var elements = new Array(number_elements);" |
| 2355 "function f() {" | 2355 "function f() {" |
| 2356 " for (var i = 0; i < number_elements; i++) {" | 2356 " for (var i = 0; i < number_elements; i++) {" |
| 2357 " elements[i] = {a: 1.1, b: 2.2};" | 2357 " elements[i] = {a: 1.1, b: 2.2};" |
| 2358 " }" | 2358 " }" |
| 2359 " return elements[i - 1];" | 2359 " return elements[i - 1];" |
| 2360 "};" | 2360 "};" |
| 2361 "f(); gc();" | 2361 "f(); gc();" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2381 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2381 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2382 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2382 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2383 v8::HandleScope scope(CcTest::isolate()); | 2383 v8::HandleScope scope(CcTest::isolate()); |
| 2384 | 2384 |
| 2385 // Grow new space unitl maximum capacity reached. | 2385 // Grow new space unitl maximum capacity reached. |
| 2386 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { | 2386 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { |
| 2387 CcTest::heap()->new_space()->Grow(); | 2387 CcTest::heap()->new_space()->Grow(); |
| 2388 } | 2388 } |
| 2389 | 2389 |
| 2390 i::ScopedVector<char> source(1024); | 2390 i::ScopedVector<char> source(1024); |
| 2391 i::OS::SNPrintF( | 2391 i::SNPrintF( |
| 2392 source, | 2392 source, |
| 2393 "var number_elements = %d;" | 2393 "var number_elements = %d;" |
| 2394 "var elements = new Array(number_elements);" | 2394 "var elements = new Array(number_elements);" |
| 2395 "function f() {" | 2395 "function f() {" |
| 2396 " for (var i = 0; i < number_elements; i++) {" | 2396 " for (var i = 0; i < number_elements; i++) {" |
| 2397 " elements[i] = [1.1, 2.2, 3.3];" | 2397 " elements[i] = [1.1, 2.2, 3.3];" |
| 2398 " }" | 2398 " }" |
| 2399 " return elements[number_elements - 1];" | 2399 " return elements[number_elements - 1];" |
| 2400 "};" | 2400 "};" |
| 2401 "f(); gc();" | 2401 "f(); gc();" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 2421 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2421 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2422 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2422 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2423 v8::HandleScope scope(CcTest::isolate()); | 2423 v8::HandleScope scope(CcTest::isolate()); |
| 2424 | 2424 |
| 2425 // Grow new space unitl maximum capacity reached. | 2425 // Grow new space unitl maximum capacity reached. |
| 2426 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { | 2426 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { |
| 2427 CcTest::heap()->new_space()->Grow(); | 2427 CcTest::heap()->new_space()->Grow(); |
| 2428 } | 2428 } |
| 2429 | 2429 |
| 2430 i::ScopedVector<char> source(1024); | 2430 i::ScopedVector<char> source(1024); |
| 2431 i::OS::SNPrintF( | 2431 i::SNPrintF( |
| 2432 source, | 2432 source, |
| 2433 "var number_elements = 100;" | 2433 "var number_elements = 100;" |
| 2434 "var elements = new Array(number_elements);" | 2434 "var elements = new Array(number_elements);" |
| 2435 "function f() {" | 2435 "function f() {" |
| 2436 " for (var i = 0; i < number_elements; i++) {" | 2436 " for (var i = 0; i < number_elements; i++) {" |
| 2437 " elements[i] = [[{}, {}, {}], [1.1, 2.2, 3.3]];" | 2437 " elements[i] = [[{}, {}, {}], [1.1, 2.2, 3.3]];" |
| 2438 " }" | 2438 " }" |
| 2439 " return elements[number_elements - 1];" | 2439 " return elements[number_elements - 1];" |
| 2440 "};" | 2440 "};" |
| 2441 "f(); gc();" | 2441 "f(); gc();" |
| 2442 "f(); f();" | 2442 "f(); f();" |
| 2443 "%%OptimizeFunctionOnNextCall(f);" | 2443 "%%OptimizeFunctionOnNextCall(f);" |
| 2444 "f();", | 2444 "f();"); |
| 2445 AllocationSite::kPretenureMinimumCreated); | |
| 2446 | 2445 |
| 2447 v8::Local<v8::Value> res = CompileRun(source.start()); | 2446 v8::Local<v8::Value> res = CompileRun(source.start()); |
| 2448 | 2447 |
| 2449 v8::Local<v8::Value> int_array = v8::Object::Cast(*res)->Get(v8_str("0")); | 2448 v8::Local<v8::Value> int_array = v8::Object::Cast(*res)->Get(v8_str("0")); |
| 2450 Handle<JSObject> int_array_handle = | 2449 Handle<JSObject> int_array_handle = |
| 2451 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array)); | 2450 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array)); |
| 2452 v8::Local<v8::Value> double_array = v8::Object::Cast(*res)->Get(v8_str("1")); | 2451 v8::Local<v8::Value> double_array = v8::Object::Cast(*res)->Get(v8_str("1")); |
| 2453 Handle<JSObject> double_array_handle = | 2452 Handle<JSObject> double_array_handle = |
| 2454 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(double_array)); | 2453 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(double_array)); |
| 2455 | 2454 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2470 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2469 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2471 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2470 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2472 v8::HandleScope scope(CcTest::isolate()); | 2471 v8::HandleScope scope(CcTest::isolate()); |
| 2473 | 2472 |
| 2474 // Grow new space unitl maximum capacity reached. | 2473 // Grow new space unitl maximum capacity reached. |
| 2475 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { | 2474 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { |
| 2476 CcTest::heap()->new_space()->Grow(); | 2475 CcTest::heap()->new_space()->Grow(); |
| 2477 } | 2476 } |
| 2478 | 2477 |
| 2479 i::ScopedVector<char> source(1024); | 2478 i::ScopedVector<char> source(1024); |
| 2480 i::OS::SNPrintF( | 2479 i::SNPrintF( |
| 2481 source, | 2480 source, |
| 2482 "var number_elements = %d;" | 2481 "var number_elements = %d;" |
| 2483 "var elements = new Array(number_elements);" | 2482 "var elements = new Array(number_elements);" |
| 2484 "function f() {" | 2483 "function f() {" |
| 2485 " for (var i = 0; i < number_elements; i++) {" | 2484 " for (var i = 0; i < number_elements; i++) {" |
| 2486 " elements[i] = [[{}, {}, {}],[{}, {}, {}]];" | 2485 " elements[i] = [[{}, {}, {}],[{}, {}, {}]];" |
| 2487 " }" | 2486 " }" |
| 2488 " return elements[number_elements - 1];" | 2487 " return elements[number_elements - 1];" |
| 2489 "};" | 2488 "};" |
| 2490 "f(); gc();" | 2489 "f(); gc();" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 2519 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2518 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2520 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2519 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2521 v8::HandleScope scope(CcTest::isolate()); | 2520 v8::HandleScope scope(CcTest::isolate()); |
| 2522 | 2521 |
| 2523 // Grow new space unitl maximum capacity reached. | 2522 // Grow new space unitl maximum capacity reached. |
| 2524 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { | 2523 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { |
| 2525 CcTest::heap()->new_space()->Grow(); | 2524 CcTest::heap()->new_space()->Grow(); |
| 2526 } | 2525 } |
| 2527 | 2526 |
| 2528 i::ScopedVector<char> source(1024); | 2527 i::ScopedVector<char> source(1024); |
| 2529 i::OS::SNPrintF( | 2528 i::SNPrintF( |
| 2530 source, | 2529 source, |
| 2531 "var number_elements = %d;" | 2530 "var number_elements = %d;" |
| 2532 "var elements = new Array(number_elements);" | 2531 "var elements = new Array(number_elements);" |
| 2533 "function f() {" | 2532 "function f() {" |
| 2534 " for (var i = 0; i < number_elements; i++) {" | 2533 " for (var i = 0; i < number_elements; i++) {" |
| 2535 " elements[i] = [[1.1, 1.2, 1.3],[2.1, 2.2, 2.3]];" | 2534 " elements[i] = [[1.1, 1.2, 1.3],[2.1, 2.2, 2.3]];" |
| 2536 " }" | 2535 " }" |
| 2537 " return elements[number_elements - 1];" | 2536 " return elements[number_elements - 1];" |
| 2538 "};" | 2537 "};" |
| 2539 "f(); gc();" | 2538 "f(); gc();" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2579 | 2578 |
| 2580 // Grow new space unitl maximum capacity reached. | 2579 // Grow new space unitl maximum capacity reached. |
| 2581 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { | 2580 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { |
| 2582 CcTest::heap()->new_space()->Grow(); | 2581 CcTest::heap()->new_space()->Grow(); |
| 2583 } | 2582 } |
| 2584 | 2583 |
| 2585 i::ScopedVector<char> source(1024); | 2584 i::ScopedVector<char> source(1024); |
| 2586 // Call new is doing slack tracking for the first | 2585 // Call new is doing slack tracking for the first |
| 2587 // JSFunction::kGenerousAllocationCount allocations, and we can't find | 2586 // JSFunction::kGenerousAllocationCount allocations, and we can't find |
| 2588 // mementos during that time. | 2587 // mementos during that time. |
| 2589 i::OS::SNPrintF( | 2588 i::SNPrintF( |
| 2590 source, | 2589 source, |
| 2591 "var number_elements = %d;" | 2590 "var number_elements = %d;" |
| 2592 "var elements = new Array(number_elements);" | 2591 "var elements = new Array(number_elements);" |
| 2593 "function foo() {" | 2592 "function foo() {" |
| 2594 " this.a = 3;" | 2593 " this.a = 3;" |
| 2595 " this.b = {};" | 2594 " this.b = {};" |
| 2596 "}" | 2595 "}" |
| 2597 "function f() {" | 2596 "function f() {" |
| 2598 " for (var i = 0; i < number_elements; i++) {" | 2597 " for (var i = 0; i < number_elements; i++) {" |
| 2599 " elements[i] = new foo();" | 2598 " elements[i] = new foo();" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 2630 | 2629 |
| 2631 // Grow new space unitl maximum capacity reached. | 2630 // Grow new space unitl maximum capacity reached. |
| 2632 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { | 2631 while (!CcTest::heap()->new_space()->IsAtMaximumCapacity()) { |
| 2633 CcTest::heap()->new_space()->Grow(); | 2632 CcTest::heap()->new_space()->Grow(); |
| 2634 } | 2633 } |
| 2635 | 2634 |
| 2636 i::ScopedVector<char> source(1024); | 2635 i::ScopedVector<char> source(1024); |
| 2637 // Call new is doing slack tracking for the first | 2636 // Call new is doing slack tracking for the first |
| 2638 // JSFunction::kGenerousAllocationCount allocations, and we can't find | 2637 // JSFunction::kGenerousAllocationCount allocations, and we can't find |
| 2639 // mementos during that time. | 2638 // mementos during that time. |
| 2640 i::OS::SNPrintF( | 2639 i::SNPrintF( |
| 2641 source, | 2640 source, |
| 2642 "var number_elements = %d;" | 2641 "var number_elements = %d;" |
| 2643 "var elements = new Array(number_elements);" | 2642 "var elements = new Array(number_elements);" |
| 2644 "function g() { this.a = 0; }" | 2643 "function g() { this.a = 0; }" |
| 2645 "function f() {" | 2644 "function f() {" |
| 2646 " for (var i = 0; i < number_elements; i++) {" | 2645 " for (var i = 0; i < number_elements; i++) {" |
| 2647 " elements[i] = new g();" | 2646 " elements[i] = new g();" |
| 2648 " }" | 2647 " }" |
| 2649 " return elements[number_elements - 1];" | 2648 " return elements[number_elements - 1];" |
| 2650 "};" | 2649 "};" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2703 i::FLAG_trace_incremental_marking = true; | 2702 i::FLAG_trace_incremental_marking = true; |
| 2704 CcTest::InitializeVM(); | 2703 CcTest::InitializeVM(); |
| 2705 v8::HandleScope scope(CcTest::isolate()); | 2704 v8::HandleScope scope(CcTest::isolate()); |
| 2706 static const int transitions_count = 256; | 2705 static const int transitions_count = 256; |
| 2707 | 2706 |
| 2708 CompileRun("function F() {}"); | 2707 CompileRun("function F() {}"); |
| 2709 { | 2708 { |
| 2710 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); | 2709 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); |
| 2711 for (int i = 0; i < transitions_count; i++) { | 2710 for (int i = 0; i < transitions_count; i++) { |
| 2712 EmbeddedVector<char, 64> buffer; | 2711 EmbeddedVector<char, 64> buffer; |
| 2713 OS::SNPrintF(buffer, "var o = new F; o.prop%d = %d;", i, i); | 2712 SNPrintF(buffer, "var o = new F; o.prop%d = %d;", i, i); |
| 2714 CompileRun(buffer.start()); | 2713 CompileRun(buffer.start()); |
| 2715 } | 2714 } |
| 2716 CompileRun("var root = new F;"); | 2715 CompileRun("var root = new F;"); |
| 2717 } | 2716 } |
| 2718 | 2717 |
| 2719 Handle<JSObject> root = | 2718 Handle<JSObject> root = |
| 2720 v8::Utils::OpenHandle( | 2719 v8::Utils::OpenHandle( |
| 2721 *v8::Handle<v8::Object>::Cast( | 2720 *v8::Handle<v8::Object>::Cast( |
| 2722 CcTest::global()->Get(v8_str("root")))); | 2721 CcTest::global()->Get(v8_str("root")))); |
| 2723 | 2722 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2735 CompileRun("%DebugPrint(root);"); | 2734 CompileRun("%DebugPrint(root);"); |
| 2736 CHECK_EQ(1, transitions_after); | 2735 CHECK_EQ(1, transitions_after); |
| 2737 } | 2736 } |
| 2738 | 2737 |
| 2739 | 2738 |
| 2740 #ifdef DEBUG | 2739 #ifdef DEBUG |
| 2741 static void AddTransitions(int transitions_count) { | 2740 static void AddTransitions(int transitions_count) { |
| 2742 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); | 2741 AlwaysAllocateScope always_allocate(CcTest::i_isolate()); |
| 2743 for (int i = 0; i < transitions_count; i++) { | 2742 for (int i = 0; i < transitions_count; i++) { |
| 2744 EmbeddedVector<char, 64> buffer; | 2743 EmbeddedVector<char, 64> buffer; |
| 2745 OS::SNPrintF(buffer, "var o = new F; o.prop%d = %d;", i, i); | 2744 SNPrintF(buffer, "var o = new F; o.prop%d = %d;", i, i); |
| 2746 CompileRun(buffer.start()); | 2745 CompileRun(buffer.start()); |
| 2747 } | 2746 } |
| 2748 } | 2747 } |
| 2749 | 2748 |
| 2750 | 2749 |
| 2751 static Handle<JSObject> GetByName(const char* name) { | 2750 static Handle<JSObject> GetByName(const char* name) { |
| 2752 return v8::Utils::OpenHandle( | 2751 return v8::Utils::OpenHandle( |
| 2753 *v8::Handle<v8::Object>::Cast( | 2752 *v8::Handle<v8::Object>::Cast( |
| 2754 CcTest::global()->Get(v8_str(name)))); | 2753 CcTest::global()->Get(v8_str(name)))); |
| 2755 } | 2754 } |
| (...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3974 v8::internal::Heap* heap = CcTest::heap(); | 3973 v8::internal::Heap* heap = CcTest::heap(); |
| 3975 | 3974 |
| 3976 if (!isolate->use_crankshaft()) return; | 3975 if (!isolate->use_crankshaft()) return; |
| 3977 HandleScope outer_scope(heap->isolate()); | 3976 HandleScope outer_scope(heap->isolate()); |
| 3978 for (int i = 0; i < 3; i++) { | 3977 for (int i = 0; i < 3; i++) { |
| 3979 SimulateIncrementalMarking(); | 3978 SimulateIncrementalMarking(); |
| 3980 { | 3979 { |
| 3981 LocalContext context; | 3980 LocalContext context; |
| 3982 HandleScope scope(heap->isolate()); | 3981 HandleScope scope(heap->isolate()); |
| 3983 EmbeddedVector<char, 256> source; | 3982 EmbeddedVector<char, 256> source; |
| 3984 OS::SNPrintF(source, | 3983 SNPrintF(source, |
| 3985 "function bar%d() {" | 3984 "function bar%d() {" |
| 3986 " return foo%d(1);" | 3985 " return foo%d(1);" |
| 3987 "};" | 3986 "};" |
| 3988 "function foo%d(x) { with (x) { return 1 + x; } };" | 3987 "function foo%d(x) { with (x) { return 1 + x; } };" |
| 3989 "bar%d();" | 3988 "bar%d();" |
| 3990 "bar%d();" | 3989 "bar%d();" |
| 3991 "bar%d();" | 3990 "bar%d();" |
| 3992 "%OptimizeFunctionOnNextCall(bar%d);" | 3991 "%%OptimizeFunctionOnNextCall(bar%d);" |
| 3993 "bar%d();", i, i, i, i, i, i, i, i); | 3992 "bar%d();", i, i, i, i, i, i, i, i); |
| 3994 CompileRun(source.start()); | 3993 CompileRun(source.start()); |
| 3995 } | 3994 } |
| 3996 heap->CollectAllGarbage(i::Heap::kNoGCFlags); | 3995 heap->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 3997 } | 3996 } |
| 3998 int elements = 0; | 3997 int elements = 0; |
| 3999 if (heap->weak_object_to_code_table()->IsHashTable()) { | 3998 if (heap->weak_object_to_code_table()->IsHashTable()) { |
| 4000 WeakHashTable* t = WeakHashTable::cast(heap->weak_object_to_code_table()); | 3999 WeakHashTable* t = WeakHashTable::cast(heap->weak_object_to_code_table()); |
| 4001 elements = t->NumberOfElements(); | 4000 elements = t->NumberOfElements(); |
| 4002 } | 4001 } |
| 4003 CHECK_EQ(0, elements); | 4002 CHECK_EQ(0, elements); |
| 4004 } | 4003 } |
| 4005 | 4004 |
| 4006 | 4005 |
| 4007 static Handle<JSFunction> OptimizeDummyFunction(const char* name) { | 4006 static Handle<JSFunction> OptimizeDummyFunction(const char* name) { |
| 4008 EmbeddedVector<char, 256> source; | 4007 EmbeddedVector<char, 256> source; |
| 4009 OS::SNPrintF(source, | 4008 SNPrintF(source, |
| 4010 "function %s() { return 0; }" | 4009 "function %s() { return 0; }" |
| 4011 "%s(); %s();" | 4010 "%s(); %s();" |
| 4012 "%%OptimizeFunctionOnNextCall(%s);" | 4011 "%%OptimizeFunctionOnNextCall(%s);" |
| 4013 "%s();", name, name, name, name, name); | 4012 "%s();", name, name, name, name, name); |
| 4014 CompileRun(source.start()); | 4013 CompileRun(source.start()); |
| 4015 Handle<JSFunction> fun = | 4014 Handle<JSFunction> fun = |
| 4016 v8::Utils::OpenHandle( | 4015 v8::Utils::OpenHandle( |
| 4017 *v8::Handle<v8::Function>::Cast( | 4016 *v8::Handle<v8::Function>::Cast( |
| 4018 CcTest::global()->Get(v8_str(name)))); | 4017 CcTest::global()->Get(v8_str(name)))); |
| 4019 return fun; | 4018 return fun; |
| 4020 } | 4019 } |
| 4021 | 4020 |
| 4022 | 4021 |
| 4023 static int GetCodeChainLength(Code* code) { | 4022 static int GetCodeChainLength(Code* code) { |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4332 #ifdef DEBUG | 4331 #ifdef DEBUG |
| 4333 TEST(PathTracer) { | 4332 TEST(PathTracer) { |
| 4334 CcTest::InitializeVM(); | 4333 CcTest::InitializeVM(); |
| 4335 v8::HandleScope scope(CcTest::isolate()); | 4334 v8::HandleScope scope(CcTest::isolate()); |
| 4336 | 4335 |
| 4337 v8::Local<v8::Value> result = CompileRun("'abc'"); | 4336 v8::Local<v8::Value> result = CompileRun("'abc'"); |
| 4338 Handle<Object> o = v8::Utils::OpenHandle(*result); | 4337 Handle<Object> o = v8::Utils::OpenHandle(*result); |
| 4339 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 4338 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
| 4340 } | 4339 } |
| 4341 #endif // DEBUG | 4340 #endif // DEBUG |
| OLD | NEW |