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 2195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2206 "var number_elements = %d;" | 2206 "var number_elements = %d;" |
2207 "var elements = new Array();" | 2207 "var elements = new Array();" |
2208 "function f() {" | 2208 "function f() {" |
2209 " for (var i = 0; i < number_elements; i++) {" | 2209 " for (var i = 0; i < number_elements; i++) {" |
2210 " elements[i] = [[{}], [1.1]];" | 2210 " elements[i] = [[{}], [1.1]];" |
2211 " }" | 2211 " }" |
2212 " return elements[number_elements-1]" | 2212 " return elements[number_elements-1]" |
2213 "};" | 2213 "};" |
2214 "f(); gc();" | 2214 "f(); gc();" |
2215 "f(); f();" | 2215 "f(); f();" |
2216 "%OptimizeFunctionOnNextCall(f);" | 2216 "%%OptimizeFunctionOnNextCall(f);" |
2217 "f();", | 2217 "f();", |
2218 AllocationSite::kPretenureMinimumCreated); | 2218 AllocationSite::kPretenureMinimumCreated); |
2219 | 2219 |
2220 v8::Local<v8::Value> res = CompileRun(source.start()); | 2220 v8::Local<v8::Value> res = CompileRun(source.start()); |
2221 | 2221 |
2222 v8::Local<v8::Value> int_array = v8::Object::Cast(*res)->Get(v8_str("0")); | 2222 v8::Local<v8::Value> int_array = v8::Object::Cast(*res)->Get(v8_str("0")); |
2223 Handle<JSObject> int_array_handle = | 2223 Handle<JSObject> int_array_handle = |
2224 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array)); | 2224 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array)); |
2225 v8::Local<v8::Value> double_array = v8::Object::Cast(*res)->Get(v8_str("1")); | 2225 v8::Local<v8::Value> double_array = v8::Object::Cast(*res)->Get(v8_str("1")); |
2226 Handle<JSObject> double_array_handle = | 2226 Handle<JSObject> double_array_handle = |
(...skipping 23 matching lines...) Expand all Loading... |
2250 "var number_elements = %d;" | 2250 "var number_elements = %d;" |
2251 "var elements = new Array(number_elements);" | 2251 "var elements = new Array(number_elements);" |
2252 "function f() {" | 2252 "function f() {" |
2253 " for (var i = 0; i < number_elements; i++) {" | 2253 " for (var i = 0; i < number_elements; i++) {" |
2254 " elements[i] = [{}, {}, {}];" | 2254 " elements[i] = [{}, {}, {}];" |
2255 " }" | 2255 " }" |
2256 " return elements[number_elements - 1];" | 2256 " return elements[number_elements - 1];" |
2257 "};" | 2257 "};" |
2258 "f(); gc();" | 2258 "f(); gc();" |
2259 "f(); f();" | 2259 "f(); f();" |
2260 "%OptimizeFunctionOnNextCall(f);" | 2260 "%%OptimizeFunctionOnNextCall(f);" |
2261 "f();", | 2261 "f();", |
2262 AllocationSite::kPretenureMinimumCreated); | 2262 AllocationSite::kPretenureMinimumCreated); |
2263 | 2263 |
2264 v8::Local<v8::Value> res = CompileRun(source.start()); | 2264 v8::Local<v8::Value> res = CompileRun(source.start()); |
2265 | 2265 |
2266 Handle<JSObject> o = | 2266 Handle<JSObject> o = |
2267 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2267 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2268 | 2268 |
2269 CHECK(CcTest::heap()->InOldPointerSpace(o->elements())); | 2269 CHECK(CcTest::heap()->InOldPointerSpace(o->elements())); |
2270 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2270 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
(...skipping 14 matching lines...) Expand all Loading... |
2285 "var number_elements = %d;" | 2285 "var number_elements = %d;" |
2286 "var elements = new Array(number_elements);" | 2286 "var elements = new Array(number_elements);" |
2287 "function f() {" | 2287 "function f() {" |
2288 " for (var i = 0; i < number_elements; i++) {" | 2288 " for (var i = 0; i < number_elements; i++) {" |
2289 " elements[i] = {a: {c: 2.2, d: {}}, b: 1.1};" | 2289 " elements[i] = {a: {c: 2.2, d: {}}, b: 1.1};" |
2290 " }" | 2290 " }" |
2291 " return elements[number_elements - 1];" | 2291 " return elements[number_elements - 1];" |
2292 "};" | 2292 "};" |
2293 "f(); gc();" | 2293 "f(); gc();" |
2294 "f(); f();" | 2294 "f(); f();" |
2295 "%OptimizeFunctionOnNextCall(f);" | 2295 "%%OptimizeFunctionOnNextCall(f);" |
2296 "f();", | 2296 "f();", |
2297 AllocationSite::kPretenureMinimumCreated); | 2297 AllocationSite::kPretenureMinimumCreated); |
2298 | 2298 |
2299 v8::Local<v8::Value> res = CompileRun(source.start()); | 2299 v8::Local<v8::Value> res = CompileRun(source.start()); |
2300 | 2300 |
2301 Handle<JSObject> o = | 2301 Handle<JSObject> o = |
2302 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2302 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2303 | 2303 |
2304 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2304 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
2305 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(0))); | 2305 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(0))); |
(...skipping 20 matching lines...) Expand all Loading... |
2326 "var number_elements = %d;" | 2326 "var number_elements = %d;" |
2327 "var elements = new Array(number_elements);" | 2327 "var elements = new Array(number_elements);" |
2328 "function f() {" | 2328 "function f() {" |
2329 " for (var i = 0; i < number_elements; i++) {" | 2329 " for (var i = 0; i < number_elements; i++) {" |
2330 " elements[i] = {a: 1.1, b: 2.2};" | 2330 " elements[i] = {a: 1.1, b: 2.2};" |
2331 " }" | 2331 " }" |
2332 " return elements[i - 1];" | 2332 " return elements[i - 1];" |
2333 "};" | 2333 "};" |
2334 "f(); gc();" | 2334 "f(); gc();" |
2335 "f(); f();" | 2335 "f(); f();" |
2336 "%OptimizeFunctionOnNextCall(f);" | 2336 "%%OptimizeFunctionOnNextCall(f);" |
2337 "f();", | 2337 "f();", |
2338 AllocationSite::kPretenureMinimumCreated); | 2338 AllocationSite::kPretenureMinimumCreated); |
2339 | 2339 |
2340 v8::Local<v8::Value> res = CompileRun(source.start()); | 2340 v8::Local<v8::Value> res = CompileRun(source.start()); |
2341 | 2341 |
2342 Handle<JSObject> o = | 2342 Handle<JSObject> o = |
2343 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2343 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2344 | 2344 |
2345 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2345 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
2346 CHECK(CcTest::heap()->InOldDataSpace(o->properties())); | 2346 CHECK(CcTest::heap()->InOldDataSpace(o->properties())); |
(...skipping 14 matching lines...) Expand all Loading... |
2361 "var number_elements = %d;" | 2361 "var number_elements = %d;" |
2362 "var elements = new Array(number_elements);" | 2362 "var elements = new Array(number_elements);" |
2363 "function f() {" | 2363 "function f() {" |
2364 " for (var i = 0; i < number_elements; i++) {" | 2364 " for (var i = 0; i < number_elements; i++) {" |
2365 " elements[i] = [1.1, 2.2, 3.3];" | 2365 " elements[i] = [1.1, 2.2, 3.3];" |
2366 " }" | 2366 " }" |
2367 " return elements[number_elements - 1];" | 2367 " return elements[number_elements - 1];" |
2368 "};" | 2368 "};" |
2369 "f(); gc();" | 2369 "f(); gc();" |
2370 "f(); f();" | 2370 "f(); f();" |
2371 "%OptimizeFunctionOnNextCall(f);" | 2371 "%%OptimizeFunctionOnNextCall(f);" |
2372 "f();", | 2372 "f();", |
2373 AllocationSite::kPretenureMinimumCreated); | 2373 AllocationSite::kPretenureMinimumCreated); |
2374 | 2374 |
2375 v8::Local<v8::Value> res = CompileRun(source.start()); | 2375 v8::Local<v8::Value> res = CompileRun(source.start()); |
2376 | 2376 |
2377 Handle<JSObject> o = | 2377 Handle<JSObject> o = |
2378 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2378 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2379 | 2379 |
2380 CHECK(CcTest::heap()->InOldDataSpace(o->elements())); | 2380 CHECK(CcTest::heap()->InOldDataSpace(o->elements())); |
2381 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2381 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
(...skipping 14 matching lines...) Expand all Loading... |
2396 "var number_elements = 100;" | 2396 "var number_elements = 100;" |
2397 "var elements = new Array(number_elements);" | 2397 "var elements = new Array(number_elements);" |
2398 "function f() {" | 2398 "function f() {" |
2399 " for (var i = 0; i < number_elements; i++) {" | 2399 " for (var i = 0; i < number_elements; i++) {" |
2400 " elements[i] = [[{}, {}, {}], [1.1, 2.2, 3.3]];" | 2400 " elements[i] = [[{}, {}, {}], [1.1, 2.2, 3.3]];" |
2401 " }" | 2401 " }" |
2402 " return elements[number_elements - 1];" | 2402 " return elements[number_elements - 1];" |
2403 "};" | 2403 "};" |
2404 "f(); gc();" | 2404 "f(); gc();" |
2405 "f(); f();" | 2405 "f(); f();" |
2406 "%OptimizeFunctionOnNextCall(f);" | 2406 "%%OptimizeFunctionOnNextCall(f);" |
2407 "f();", | 2407 "f();", |
2408 AllocationSite::kPretenureMinimumCreated); | 2408 AllocationSite::kPretenureMinimumCreated); |
2409 | 2409 |
2410 v8::Local<v8::Value> res = CompileRun(source.start()); | 2410 v8::Local<v8::Value> res = CompileRun(source.start()); |
2411 | 2411 |
2412 v8::Local<v8::Value> int_array = v8::Object::Cast(*res)->Get(v8_str("0")); | 2412 v8::Local<v8::Value> int_array = v8::Object::Cast(*res)->Get(v8_str("0")); |
2413 Handle<JSObject> int_array_handle = | 2413 Handle<JSObject> int_array_handle = |
2414 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array)); | 2414 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array)); |
2415 v8::Local<v8::Value> double_array = v8::Object::Cast(*res)->Get(v8_str("1")); | 2415 v8::Local<v8::Value> double_array = v8::Object::Cast(*res)->Get(v8_str("1")); |
2416 Handle<JSObject> double_array_handle = | 2416 Handle<JSObject> double_array_handle = |
(...skipping 23 matching lines...) Expand all Loading... |
2440 "var number_elements = %d;" | 2440 "var number_elements = %d;" |
2441 "var elements = new Array(number_elements);" | 2441 "var elements = new Array(number_elements);" |
2442 "function f() {" | 2442 "function f() {" |
2443 " for (var i = 0; i < number_elements; i++) {" | 2443 " for (var i = 0; i < number_elements; i++) {" |
2444 " elements[i] = [[{}, {}, {}],[{}, {}, {}]];" | 2444 " elements[i] = [[{}, {}, {}],[{}, {}, {}]];" |
2445 " }" | 2445 " }" |
2446 " return elements[number_elements - 1];" | 2446 " return elements[number_elements - 1];" |
2447 "};" | 2447 "};" |
2448 "f(); gc();" | 2448 "f(); gc();" |
2449 "f(); f();" | 2449 "f(); f();" |
2450 "%OptimizeFunctionOnNextCall(f);" | 2450 "%%OptimizeFunctionOnNextCall(f);" |
2451 "f();", | 2451 "f();", |
2452 AllocationSite::kPretenureMinimumCreated); | 2452 AllocationSite::kPretenureMinimumCreated); |
2453 | 2453 |
2454 v8::Local<v8::Value> res = CompileRun(source.start()); | 2454 v8::Local<v8::Value> res = CompileRun(source.start()); |
2455 | 2455 |
2456 v8::Local<v8::Value> int_array_1 = v8::Object::Cast(*res)->Get(v8_str("0")); | 2456 v8::Local<v8::Value> int_array_1 = v8::Object::Cast(*res)->Get(v8_str("0")); |
2457 Handle<JSObject> int_array_handle_1 = | 2457 Handle<JSObject> int_array_handle_1 = |
2458 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array_1)); | 2458 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(int_array_1)); |
2459 v8::Local<v8::Value> int_array_2 = v8::Object::Cast(*res)->Get(v8_str("1")); | 2459 v8::Local<v8::Value> int_array_2 = v8::Object::Cast(*res)->Get(v8_str("1")); |
2460 Handle<JSObject> int_array_handle_2 = | 2460 Handle<JSObject> int_array_handle_2 = |
(...skipping 23 matching lines...) Expand all Loading... |
2484 "var number_elements = %d;" | 2484 "var number_elements = %d;" |
2485 "var elements = new Array(number_elements);" | 2485 "var elements = new Array(number_elements);" |
2486 "function f() {" | 2486 "function f() {" |
2487 " for (var i = 0; i < number_elements; i++) {" | 2487 " for (var i = 0; i < number_elements; i++) {" |
2488 " elements[i] = [[1.1, 1.2, 1.3],[2.1, 2.2, 2.3]];" | 2488 " elements[i] = [[1.1, 1.2, 1.3],[2.1, 2.2, 2.3]];" |
2489 " }" | 2489 " }" |
2490 " return elements[number_elements - 1];" | 2490 " return elements[number_elements - 1];" |
2491 "};" | 2491 "};" |
2492 "f(); gc();" | 2492 "f(); gc();" |
2493 "f(); f();" | 2493 "f(); f();" |
2494 "%OptimizeFunctionOnNextCall(f);" | 2494 "%%OptimizeFunctionOnNextCall(f);" |
2495 "f();", | 2495 "f();", |
2496 AllocationSite::kPretenureMinimumCreated); | 2496 AllocationSite::kPretenureMinimumCreated); |
2497 | 2497 |
2498 v8::Local<v8::Value> res = CompileRun(source.start()); | 2498 v8::Local<v8::Value> res = CompileRun(source.start()); |
2499 | 2499 |
2500 v8::Local<v8::Value> double_array_1 = | 2500 v8::Local<v8::Value> double_array_1 = |
2501 v8::Object::Cast(*res)->Get(v8_str("0")); | 2501 v8::Object::Cast(*res)->Get(v8_str("0")); |
2502 Handle<JSObject> double_array_handle_1 = | 2502 Handle<JSObject> double_array_handle_1 = |
2503 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(double_array_1)); | 2503 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(double_array_1)); |
2504 v8::Local<v8::Value> double_array_2 = | 2504 v8::Local<v8::Value> double_array_2 = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2540 " this.b = {};" | 2540 " this.b = {};" |
2541 "}" | 2541 "}" |
2542 "function f() {" | 2542 "function f() {" |
2543 " for (var i = 0; i < number_elements; i++) {" | 2543 " for (var i = 0; i < number_elements; i++) {" |
2544 " elements[i] = new foo();" | 2544 " elements[i] = new foo();" |
2545 " }" | 2545 " }" |
2546 " return elements[number_elements - 1];" | 2546 " return elements[number_elements - 1];" |
2547 "};" | 2547 "};" |
2548 "f(); gc();" | 2548 "f(); gc();" |
2549 "f(); f();" | 2549 "f(); f();" |
2550 "%OptimizeFunctionOnNextCall(f);" | 2550 "%%OptimizeFunctionOnNextCall(f);" |
2551 "f();", | 2551 "f();", |
2552 AllocationSite::kPretenureMinimumCreated); | 2552 AllocationSite::kPretenureMinimumCreated); |
2553 | 2553 |
2554 v8::Local<v8::Value> res = CompileRun(source.start()); | 2554 v8::Local<v8::Value> res = CompileRun(source.start()); |
2555 | 2555 |
2556 Handle<JSObject> o = | 2556 Handle<JSObject> o = |
2557 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2557 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2558 | 2558 |
2559 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2559 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
2560 } | 2560 } |
(...skipping 18 matching lines...) Expand all Loading... |
2579 "var elements = new Array(number_elements);" | 2579 "var elements = new Array(number_elements);" |
2580 "function g() { this.a = 0; }" | 2580 "function g() { this.a = 0; }" |
2581 "function f() {" | 2581 "function f() {" |
2582 " for (var i = 0; i < number_elements; i++) {" | 2582 " for (var i = 0; i < number_elements; i++) {" |
2583 " elements[i] = new g();" | 2583 " elements[i] = new g();" |
2584 " }" | 2584 " }" |
2585 " return elements[number_elements - 1];" | 2585 " return elements[number_elements - 1];" |
2586 "};" | 2586 "};" |
2587 "f(); gc();" | 2587 "f(); gc();" |
2588 "f(); f();" | 2588 "f(); f();" |
2589 "%OptimizeFunctionOnNextCall(f);" | 2589 "%%OptimizeFunctionOnNextCall(f);" |
2590 "f();", | 2590 "f();", |
2591 AllocationSite::kPretenureMinimumCreated); | 2591 AllocationSite::kPretenureMinimumCreated); |
2592 | 2592 |
2593 v8::Local<v8::Value> res = CompileRun(source.start()); | 2593 v8::Local<v8::Value> res = CompileRun(source.start()); |
2594 | 2594 |
2595 Handle<JSObject> o = | 2595 Handle<JSObject> o = |
2596 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2596 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2597 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2597 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
2598 } | 2598 } |
2599 | 2599 |
(...skipping 1655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4255 "array;"); | 4255 "array;"); |
4256 | 4256 |
4257 Handle<JSObject> o = | 4257 Handle<JSObject> o = |
4258 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); | 4258 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); |
4259 CHECK(heap->InOldPointerSpace(o->elements())); | 4259 CHECK(heap->InOldPointerSpace(o->elements())); |
4260 CHECK(heap->InOldPointerSpace(*o)); | 4260 CHECK(heap->InOldPointerSpace(*o)); |
4261 Page* page = Page::FromAddress(o->elements()->address()); | 4261 Page* page = Page::FromAddress(o->elements()->address()); |
4262 CHECK(page->WasSwept() || | 4262 CHECK(page->WasSwept() || |
4263 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); | 4263 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); |
4264 } | 4264 } |
OLD | NEW |