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 | 2201 |
2202 Handle<JSObject> o = | 2202 Handle<JSObject> o = |
2203 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2203 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2204 | 2204 |
2205 CHECK(CcTest::heap()->InNewSpace(*o)); | 2205 CHECK(CcTest::heap()->InNewSpace(*o)); |
2206 } | 2206 } |
2207 | 2207 |
2208 | 2208 |
2209 TEST(OptimizedPretenuringAllocationFolding) { | 2209 TEST(OptimizedPretenuringAllocationFolding) { |
2210 i::FLAG_allow_natives_syntax = true; | 2210 i::FLAG_allow_natives_syntax = true; |
2211 i::FLAG_max_new_space_size = 2048; | 2211 i::FLAG_max_new_space_size = 2; |
2212 i::FLAG_allocation_site_pretenuring = false; | 2212 i::FLAG_allocation_site_pretenuring = false; |
2213 CcTest::InitializeVM(); | 2213 CcTest::InitializeVM(); |
2214 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2214 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2215 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2215 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2216 v8::HandleScope scope(CcTest::isolate()); | 2216 v8::HandleScope scope(CcTest::isolate()); |
2217 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2217 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
2218 | 2218 |
2219 v8::Local<v8::Value> res = CompileRun( | 2219 v8::Local<v8::Value> res = CompileRun( |
2220 "function DataObject() {" | 2220 "function DataObject() {" |
2221 " this.a = 1.1;" | 2221 " this.a = 1.1;" |
(...skipping 22 matching lines...) Expand all Loading... |
2244 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(1))); | 2244 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(1))); |
2245 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(2))); | 2245 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(2))); |
2246 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(3))); | 2246 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(3))); |
2247 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(4))); | 2247 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(4))); |
2248 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(5))); | 2248 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(5))); |
2249 } | 2249 } |
2250 | 2250 |
2251 | 2251 |
2252 TEST(OptimizedPretenuringAllocationFoldingBlocks) { | 2252 TEST(OptimizedPretenuringAllocationFoldingBlocks) { |
2253 i::FLAG_allow_natives_syntax = true; | 2253 i::FLAG_allow_natives_syntax = true; |
2254 i::FLAG_max_new_space_size = 2048; | 2254 i::FLAG_max_new_space_size = 2; |
2255 i::FLAG_allocation_site_pretenuring = false; | 2255 i::FLAG_allocation_site_pretenuring = false; |
2256 CcTest::InitializeVM(); | 2256 CcTest::InitializeVM(); |
2257 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2257 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2258 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2258 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2259 v8::HandleScope scope(CcTest::isolate()); | 2259 v8::HandleScope scope(CcTest::isolate()); |
2260 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2260 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
2261 | 2261 |
2262 v8::Local<v8::Value> res = CompileRun( | 2262 v8::Local<v8::Value> res = CompileRun( |
2263 "var number_elements = 30000;" | 2263 "var number_elements = 30000;" |
2264 "var elements = new Array(number_elements);" | 2264 "var elements = new Array(number_elements);" |
(...skipping 22 matching lines...) Expand all Loading... |
2287 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(1))); | 2287 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(1))); |
2288 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(2))); | 2288 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(2))); |
2289 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(3))); | 2289 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(3))); |
2290 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(4))); | 2290 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(4))); |
2291 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(5))); | 2291 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(5))); |
2292 } | 2292 } |
2293 | 2293 |
2294 | 2294 |
2295 TEST(OptimizedPretenuringObjectArrayLiterals) { | 2295 TEST(OptimizedPretenuringObjectArrayLiterals) { |
2296 i::FLAG_allow_natives_syntax = true; | 2296 i::FLAG_allow_natives_syntax = true; |
2297 i::FLAG_max_new_space_size = 2048; | 2297 i::FLAG_max_new_space_size = 2; |
2298 CcTest::InitializeVM(); | 2298 CcTest::InitializeVM(); |
2299 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2299 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2300 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2300 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2301 v8::HandleScope scope(CcTest::isolate()); | 2301 v8::HandleScope scope(CcTest::isolate()); |
2302 | 2302 |
2303 v8::Local<v8::Value> res = CompileRun( | 2303 v8::Local<v8::Value> res = CompileRun( |
2304 "var number_elements = 20000;" | 2304 "var number_elements = 20000;" |
2305 "var elements = new Array(number_elements);" | 2305 "var elements = new Array(number_elements);" |
2306 "function f() {" | 2306 "function f() {" |
2307 " for (var i = 0; i < number_elements; i++) {" | 2307 " for (var i = 0; i < number_elements; i++) {" |
2308 " elements[i] = [{}, {}, {}];" | 2308 " elements[i] = [{}, {}, {}];" |
2309 " }" | 2309 " }" |
2310 " return elements[number_elements - 1];" | 2310 " return elements[number_elements - 1];" |
2311 "};" | 2311 "};" |
2312 "f(); f(); f();" | 2312 "f(); f(); f();" |
2313 "%OptimizeFunctionOnNextCall(f);" | 2313 "%OptimizeFunctionOnNextCall(f);" |
2314 "f();"); | 2314 "f();"); |
2315 | 2315 |
2316 Handle<JSObject> o = | 2316 Handle<JSObject> o = |
2317 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2317 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2318 | 2318 |
2319 CHECK(CcTest::heap()->InOldPointerSpace(o->elements())); | 2319 CHECK(CcTest::heap()->InOldPointerSpace(o->elements())); |
2320 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2320 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
2321 } | 2321 } |
2322 | 2322 |
2323 | 2323 |
2324 TEST(OptimizedPretenuringMixedInObjectProperties) { | 2324 TEST(OptimizedPretenuringMixedInObjectProperties) { |
2325 i::FLAG_allow_natives_syntax = true; | 2325 i::FLAG_allow_natives_syntax = true; |
2326 i::FLAG_max_new_space_size = 2048; | 2326 i::FLAG_max_new_space_size = 2; |
2327 CcTest::InitializeVM(); | 2327 CcTest::InitializeVM(); |
2328 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2328 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2329 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2329 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2330 v8::HandleScope scope(CcTest::isolate()); | 2330 v8::HandleScope scope(CcTest::isolate()); |
2331 | 2331 |
2332 v8::Local<v8::Value> res = CompileRun( | 2332 v8::Local<v8::Value> res = CompileRun( |
2333 "var number_elements = 20000;" | 2333 "var number_elements = 20000;" |
2334 "var elements = new Array(number_elements);" | 2334 "var elements = new Array(number_elements);" |
2335 "function f() {" | 2335 "function f() {" |
2336 " for (var i = 0; i < number_elements; i++) {" | 2336 " for (var i = 0; i < number_elements; i++) {" |
(...skipping 14 matching lines...) Expand all Loading... |
2351 | 2351 |
2352 JSObject* inner_object = reinterpret_cast<JSObject*>(o->RawFastPropertyAt(0)); | 2352 JSObject* inner_object = reinterpret_cast<JSObject*>(o->RawFastPropertyAt(0)); |
2353 CHECK(CcTest::heap()->InOldPointerSpace(inner_object)); | 2353 CHECK(CcTest::heap()->InOldPointerSpace(inner_object)); |
2354 CHECK(CcTest::heap()->InOldDataSpace(inner_object->RawFastPropertyAt(0))); | 2354 CHECK(CcTest::heap()->InOldDataSpace(inner_object->RawFastPropertyAt(0))); |
2355 CHECK(CcTest::heap()->InOldPointerSpace(inner_object->RawFastPropertyAt(1))); | 2355 CHECK(CcTest::heap()->InOldPointerSpace(inner_object->RawFastPropertyAt(1))); |
2356 } | 2356 } |
2357 | 2357 |
2358 | 2358 |
2359 TEST(OptimizedPretenuringDoubleArrayProperties) { | 2359 TEST(OptimizedPretenuringDoubleArrayProperties) { |
2360 i::FLAG_allow_natives_syntax = true; | 2360 i::FLAG_allow_natives_syntax = true; |
2361 i::FLAG_max_new_space_size = 2048; | 2361 i::FLAG_max_new_space_size = 2; |
2362 CcTest::InitializeVM(); | 2362 CcTest::InitializeVM(); |
2363 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2363 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2364 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2364 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2365 v8::HandleScope scope(CcTest::isolate()); | 2365 v8::HandleScope scope(CcTest::isolate()); |
2366 | 2366 |
2367 v8::Local<v8::Value> res = CompileRun( | 2367 v8::Local<v8::Value> res = CompileRun( |
2368 "var number_elements = 30000;" | 2368 "var number_elements = 30000;" |
2369 "var elements = new Array(number_elements);" | 2369 "var elements = new Array(number_elements);" |
2370 "function f() {" | 2370 "function f() {" |
2371 " for (var i = 0; i < number_elements; i++) {" | 2371 " for (var i = 0; i < number_elements; i++) {" |
2372 " elements[i] = {a: 1.1, b: 2.2};" | 2372 " elements[i] = {a: 1.1, b: 2.2};" |
2373 " }" | 2373 " }" |
2374 " return elements[i - 1];" | 2374 " return elements[i - 1];" |
2375 "};" | 2375 "};" |
2376 "f(); f(); f();" | 2376 "f(); f(); f();" |
2377 "%OptimizeFunctionOnNextCall(f);" | 2377 "%OptimizeFunctionOnNextCall(f);" |
2378 "f();"); | 2378 "f();"); |
2379 | 2379 |
2380 Handle<JSObject> o = | 2380 Handle<JSObject> o = |
2381 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2381 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2382 | 2382 |
2383 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2383 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
2384 CHECK(CcTest::heap()->InOldDataSpace(o->properties())); | 2384 CHECK(CcTest::heap()->InOldDataSpace(o->properties())); |
2385 } | 2385 } |
2386 | 2386 |
2387 | 2387 |
2388 TEST(OptimizedPretenuringdoubleArrayLiterals) { | 2388 TEST(OptimizedPretenuringdoubleArrayLiterals) { |
2389 i::FLAG_allow_natives_syntax = true; | 2389 i::FLAG_allow_natives_syntax = true; |
2390 i::FLAG_max_new_space_size = 2048; | 2390 i::FLAG_max_new_space_size = 2; |
2391 CcTest::InitializeVM(); | 2391 CcTest::InitializeVM(); |
2392 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2392 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2393 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2393 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2394 v8::HandleScope scope(CcTest::isolate()); | 2394 v8::HandleScope scope(CcTest::isolate()); |
2395 | 2395 |
2396 v8::Local<v8::Value> res = CompileRun( | 2396 v8::Local<v8::Value> res = CompileRun( |
2397 "var number_elements = 30000;" | 2397 "var number_elements = 30000;" |
2398 "var elements = new Array(number_elements);" | 2398 "var elements = new Array(number_elements);" |
2399 "function f() {" | 2399 "function f() {" |
2400 " for (var i = 0; i < number_elements; i++) {" | 2400 " for (var i = 0; i < number_elements; i++) {" |
2401 " elements[i] = [1.1, 2.2, 3.3];" | 2401 " elements[i] = [1.1, 2.2, 3.3];" |
2402 " }" | 2402 " }" |
2403 " return elements[number_elements - 1];" | 2403 " return elements[number_elements - 1];" |
2404 "};" | 2404 "};" |
2405 "f(); f(); f();" | 2405 "f(); f(); f();" |
2406 "%OptimizeFunctionOnNextCall(f);" | 2406 "%OptimizeFunctionOnNextCall(f);" |
2407 "f();"); | 2407 "f();"); |
2408 | 2408 |
2409 Handle<JSObject> o = | 2409 Handle<JSObject> o = |
2410 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2410 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2411 | 2411 |
2412 CHECK(CcTest::heap()->InOldDataSpace(o->elements())); | 2412 CHECK(CcTest::heap()->InOldDataSpace(o->elements())); |
2413 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2413 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
2414 } | 2414 } |
2415 | 2415 |
2416 | 2416 |
2417 TEST(OptimizedPretenuringNestedMixedArrayLiterals) { | 2417 TEST(OptimizedPretenuringNestedMixedArrayLiterals) { |
2418 i::FLAG_allow_natives_syntax = true; | 2418 i::FLAG_allow_natives_syntax = true; |
2419 i::FLAG_max_new_space_size = 2048; | 2419 i::FLAG_max_new_space_size = 2; |
2420 CcTest::InitializeVM(); | 2420 CcTest::InitializeVM(); |
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 v8::Local<v8::Value> res = CompileRun( | 2425 v8::Local<v8::Value> res = CompileRun( |
2426 "var number_elements = 20000;" | 2426 "var number_elements = 20000;" |
2427 "var elements = new Array(number_elements);" | 2427 "var elements = new Array(number_elements);" |
2428 "function f() {" | 2428 "function f() {" |
2429 " for (var i = 0; i < number_elements; i++) {" | 2429 " for (var i = 0; i < number_elements; i++) {" |
(...skipping 17 matching lines...) Expand all Loading... |
2447 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2447 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
2448 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle)); | 2448 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle)); |
2449 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle->elements())); | 2449 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle->elements())); |
2450 CHECK(CcTest::heap()->InOldPointerSpace(*double_array_handle)); | 2450 CHECK(CcTest::heap()->InOldPointerSpace(*double_array_handle)); |
2451 CHECK(CcTest::heap()->InOldDataSpace(double_array_handle->elements())); | 2451 CHECK(CcTest::heap()->InOldDataSpace(double_array_handle->elements())); |
2452 } | 2452 } |
2453 | 2453 |
2454 | 2454 |
2455 TEST(OptimizedPretenuringNestedObjectLiterals) { | 2455 TEST(OptimizedPretenuringNestedObjectLiterals) { |
2456 i::FLAG_allow_natives_syntax = true; | 2456 i::FLAG_allow_natives_syntax = true; |
2457 i::FLAG_max_new_space_size = 2048; | 2457 i::FLAG_max_new_space_size = 2; |
2458 CcTest::InitializeVM(); | 2458 CcTest::InitializeVM(); |
2459 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2459 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2460 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2460 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2461 v8::HandleScope scope(CcTest::isolate()); | 2461 v8::HandleScope scope(CcTest::isolate()); |
2462 | 2462 |
2463 v8::Local<v8::Value> res = CompileRun( | 2463 v8::Local<v8::Value> res = CompileRun( |
2464 "var number_elements = 20000;" | 2464 "var number_elements = 20000;" |
2465 "var elements = new Array(number_elements);" | 2465 "var elements = new Array(number_elements);" |
2466 "function f() {" | 2466 "function f() {" |
2467 " for (var i = 0; i < number_elements; i++) {" | 2467 " for (var i = 0; i < number_elements; i++) {" |
(...skipping 17 matching lines...) Expand all Loading... |
2485 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2485 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
2486 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_1)); | 2486 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_1)); |
2487 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_1->elements())); | 2487 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_1->elements())); |
2488 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_2)); | 2488 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_2)); |
2489 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_2->elements())); | 2489 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_2->elements())); |
2490 } | 2490 } |
2491 | 2491 |
2492 | 2492 |
2493 TEST(OptimizedPretenuringNestedDoubleLiterals) { | 2493 TEST(OptimizedPretenuringNestedDoubleLiterals) { |
2494 i::FLAG_allow_natives_syntax = true; | 2494 i::FLAG_allow_natives_syntax = true; |
2495 i::FLAG_max_new_space_size = 2048; | 2495 i::FLAG_max_new_space_size = 2; |
2496 CcTest::InitializeVM(); | 2496 CcTest::InitializeVM(); |
2497 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2497 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2498 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2498 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2499 v8::HandleScope scope(CcTest::isolate()); | 2499 v8::HandleScope scope(CcTest::isolate()); |
2500 | 2500 |
2501 v8::Local<v8::Value> res = CompileRun( | 2501 v8::Local<v8::Value> res = CompileRun( |
2502 "var number_elements = 20000;" | 2502 "var number_elements = 20000;" |
2503 "var elements = new Array(number_elements);" | 2503 "var elements = new Array(number_elements);" |
2504 "function f() {" | 2504 "function f() {" |
2505 " for (var i = 0; i < number_elements; i++) {" | 2505 " for (var i = 0; i < number_elements; i++) {" |
(...skipping 25 matching lines...) Expand all Loading... |
2531 | 2531 |
2532 | 2532 |
2533 // Make sure pretenuring feedback is gathered for constructed objects as well | 2533 // Make sure pretenuring feedback is gathered for constructed objects as well |
2534 // as for literals. | 2534 // as for literals. |
2535 TEST(OptimizedPretenuringConstructorCalls) { | 2535 TEST(OptimizedPretenuringConstructorCalls) { |
2536 if (!FLAG_allocation_site_pretenuring || !i::FLAG_pretenuring_call_new) { | 2536 if (!FLAG_allocation_site_pretenuring || !i::FLAG_pretenuring_call_new) { |
2537 // FLAG_pretenuring_call_new needs to be synced with the snapshot. | 2537 // FLAG_pretenuring_call_new needs to be synced with the snapshot. |
2538 return; | 2538 return; |
2539 } | 2539 } |
2540 i::FLAG_allow_natives_syntax = true; | 2540 i::FLAG_allow_natives_syntax = true; |
2541 i::FLAG_max_new_space_size = 2048; | 2541 i::FLAG_max_new_space_size = 2; |
2542 CcTest::InitializeVM(); | 2542 CcTest::InitializeVM(); |
2543 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2543 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2544 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2544 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2545 v8::HandleScope scope(CcTest::isolate()); | 2545 v8::HandleScope scope(CcTest::isolate()); |
2546 | 2546 |
2547 v8::Local<v8::Value> res = CompileRun( | 2547 v8::Local<v8::Value> res = CompileRun( |
2548 "var number_elements = 20000;" | 2548 "var number_elements = 20000;" |
2549 "var elements = new Array(number_elements);" | 2549 "var elements = new Array(number_elements);" |
2550 "function foo() {" | 2550 "function foo() {" |
2551 " this.a = 3;" | 2551 " this.a = 3;" |
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4215 "array;"); | 4215 "array;"); |
4216 | 4216 |
4217 Handle<JSObject> o = | 4217 Handle<JSObject> o = |
4218 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); | 4218 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); |
4219 CHECK(heap->InOldPointerSpace(o->elements())); | 4219 CHECK(heap->InOldPointerSpace(o->elements())); |
4220 CHECK(heap->InOldPointerSpace(*o)); | 4220 CHECK(heap->InOldPointerSpace(*o)); |
4221 Page* page = Page::FromAddress(o->elements()->address()); | 4221 Page* page = Page::FromAddress(o->elements()->address()); |
4222 CHECK(page->WasSwept() || | 4222 CHECK(page->WasSwept() || |
4223 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); | 4223 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); |
4224 } | 4224 } |
OLD | NEW |