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 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2188 Handle<JSObject> o = | 2188 Handle<JSObject> o = |
2189 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2189 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2190 | 2190 |
2191 CHECK(CcTest::heap()->InNewSpace(*o)); | 2191 CHECK(CcTest::heap()->InNewSpace(*o)); |
2192 } | 2192 } |
2193 | 2193 |
2194 | 2194 |
2195 TEST(OptimizedPretenuringAllocationFolding) { | 2195 TEST(OptimizedPretenuringAllocationFolding) { |
2196 i::FLAG_allow_natives_syntax = true; | 2196 i::FLAG_allow_natives_syntax = true; |
2197 i::FLAG_expose_gc = true; | 2197 i::FLAG_expose_gc = true; |
2198 i::FLAG_min_semi_space_size = 8; | |
mvstanton
2014/06/02 13:31:25
Why is this being done? Probably worth a comment.
Hannes Payer (out of office)
2014/06/02 14:56:52
Done.
| |
2198 CcTest::InitializeVM(); | 2199 CcTest::InitializeVM(); |
2199 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2200 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2200 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2201 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2201 v8::HandleScope scope(CcTest::isolate()); | 2202 v8::HandleScope scope(CcTest::isolate()); |
2202 | 2203 |
2203 i::ScopedVector<char> source(1024); | 2204 i::ScopedVector<char> source(1024); |
2204 i::OS::SNPrintF( | 2205 i::OS::SNPrintF( |
2205 source, | 2206 source, |
2206 "var number_elements = %d;" | 2207 "var number_elements = %d;" |
2207 "var elements = new Array();" | 2208 "var elements = new Array();" |
(...skipping 24 matching lines...) Expand all Loading... | |
2232 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle)); | 2233 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle)); |
2233 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle->elements())); | 2234 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle->elements())); |
2234 CHECK(CcTest::heap()->InOldPointerSpace(*double_array_handle)); | 2235 CHECK(CcTest::heap()->InOldPointerSpace(*double_array_handle)); |
2235 CHECK(CcTest::heap()->InOldDataSpace(double_array_handle->elements())); | 2236 CHECK(CcTest::heap()->InOldDataSpace(double_array_handle->elements())); |
2236 } | 2237 } |
2237 | 2238 |
2238 | 2239 |
2239 TEST(OptimizedPretenuringObjectArrayLiterals) { | 2240 TEST(OptimizedPretenuringObjectArrayLiterals) { |
2240 i::FLAG_allow_natives_syntax = true; | 2241 i::FLAG_allow_natives_syntax = true; |
2241 i::FLAG_expose_gc = true; | 2242 i::FLAG_expose_gc = true; |
2243 i::FLAG_min_semi_space_size = 8; | |
2242 CcTest::InitializeVM(); | 2244 CcTest::InitializeVM(); |
2243 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2245 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2244 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2246 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2245 v8::HandleScope scope(CcTest::isolate()); | 2247 v8::HandleScope scope(CcTest::isolate()); |
2246 | 2248 |
2247 i::ScopedVector<char> source(1024); | 2249 i::ScopedVector<char> source(1024); |
2248 i::OS::SNPrintF( | 2250 i::OS::SNPrintF( |
2249 source, | 2251 source, |
2250 "var number_elements = %d;" | 2252 "var number_elements = %d;" |
2251 "var elements = new Array(number_elements);" | 2253 "var elements = new Array(number_elements);" |
(...skipping 15 matching lines...) Expand all Loading... | |
2267 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2269 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2268 | 2270 |
2269 CHECK(CcTest::heap()->InOldPointerSpace(o->elements())); | 2271 CHECK(CcTest::heap()->InOldPointerSpace(o->elements())); |
2270 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2272 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
2271 } | 2273 } |
2272 | 2274 |
2273 | 2275 |
2274 TEST(OptimizedPretenuringMixedInObjectProperties) { | 2276 TEST(OptimizedPretenuringMixedInObjectProperties) { |
2275 i::FLAG_allow_natives_syntax = true; | 2277 i::FLAG_allow_natives_syntax = true; |
2276 i::FLAG_expose_gc = true; | 2278 i::FLAG_expose_gc = true; |
2279 i::FLAG_min_semi_space_size = 8; | |
2277 CcTest::InitializeVM(); | 2280 CcTest::InitializeVM(); |
2278 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2281 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2279 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2282 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2280 v8::HandleScope scope(CcTest::isolate()); | 2283 v8::HandleScope scope(CcTest::isolate()); |
2281 | 2284 |
2282 i::ScopedVector<char> source(1024); | 2285 i::ScopedVector<char> source(1024); |
2283 i::OS::SNPrintF( | 2286 i::OS::SNPrintF( |
2284 source, | 2287 source, |
2285 "var number_elements = %d;" | 2288 "var number_elements = %d;" |
2286 "var elements = new Array(number_elements);" | 2289 "var elements = new Array(number_elements);" |
(...skipping 21 matching lines...) Expand all Loading... | |
2308 JSObject* inner_object = reinterpret_cast<JSObject*>(o->RawFastPropertyAt(0)); | 2311 JSObject* inner_object = reinterpret_cast<JSObject*>(o->RawFastPropertyAt(0)); |
2309 CHECK(CcTest::heap()->InOldPointerSpace(inner_object)); | 2312 CHECK(CcTest::heap()->InOldPointerSpace(inner_object)); |
2310 CHECK(CcTest::heap()->InOldDataSpace(inner_object->RawFastPropertyAt(0))); | 2313 CHECK(CcTest::heap()->InOldDataSpace(inner_object->RawFastPropertyAt(0))); |
2311 CHECK(CcTest::heap()->InOldPointerSpace(inner_object->RawFastPropertyAt(1))); | 2314 CHECK(CcTest::heap()->InOldPointerSpace(inner_object->RawFastPropertyAt(1))); |
2312 } | 2315 } |
2313 | 2316 |
2314 | 2317 |
2315 TEST(OptimizedPretenuringDoubleArrayProperties) { | 2318 TEST(OptimizedPretenuringDoubleArrayProperties) { |
2316 i::FLAG_allow_natives_syntax = true; | 2319 i::FLAG_allow_natives_syntax = true; |
2317 i::FLAG_expose_gc = true; | 2320 i::FLAG_expose_gc = true; |
2321 i::FLAG_min_semi_space_size = 8; | |
2318 CcTest::InitializeVM(); | 2322 CcTest::InitializeVM(); |
2319 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2323 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2320 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2324 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2321 v8::HandleScope scope(CcTest::isolate()); | 2325 v8::HandleScope scope(CcTest::isolate()); |
2322 | 2326 |
2323 i::ScopedVector<char> source(1024); | 2327 i::ScopedVector<char> source(1024); |
2324 i::OS::SNPrintF( | 2328 i::OS::SNPrintF( |
2325 source, | 2329 source, |
2326 "var number_elements = %d;" | 2330 "var number_elements = %d;" |
2327 "var elements = new Array(number_elements);" | 2331 "var elements = new Array(number_elements);" |
(...skipping 15 matching lines...) Expand all Loading... | |
2343 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2347 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2344 | 2348 |
2345 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2349 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
2346 CHECK(CcTest::heap()->InOldDataSpace(o->properties())); | 2350 CHECK(CcTest::heap()->InOldDataSpace(o->properties())); |
2347 } | 2351 } |
2348 | 2352 |
2349 | 2353 |
2350 TEST(OptimizedPretenuringdoubleArrayLiterals) { | 2354 TEST(OptimizedPretenuringdoubleArrayLiterals) { |
2351 i::FLAG_allow_natives_syntax = true; | 2355 i::FLAG_allow_natives_syntax = true; |
2352 i::FLAG_expose_gc = true; | 2356 i::FLAG_expose_gc = true; |
2357 i::FLAG_min_semi_space_size = 8; | |
2353 CcTest::InitializeVM(); | 2358 CcTest::InitializeVM(); |
2354 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2359 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2355 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2360 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2356 v8::HandleScope scope(CcTest::isolate()); | 2361 v8::HandleScope scope(CcTest::isolate()); |
2357 | 2362 |
2358 i::ScopedVector<char> source(1024); | 2363 i::ScopedVector<char> source(1024); |
2359 i::OS::SNPrintF( | 2364 i::OS::SNPrintF( |
2360 source, | 2365 source, |
2361 "var number_elements = %d;" | 2366 "var number_elements = %d;" |
2362 "var elements = new Array(number_elements);" | 2367 "var elements = new Array(number_elements);" |
(...skipping 15 matching lines...) Expand all Loading... | |
2378 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2383 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2379 | 2384 |
2380 CHECK(CcTest::heap()->InOldDataSpace(o->elements())); | 2385 CHECK(CcTest::heap()->InOldDataSpace(o->elements())); |
2381 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2386 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
2382 } | 2387 } |
2383 | 2388 |
2384 | 2389 |
2385 TEST(OptimizedPretenuringNestedMixedArrayLiterals) { | 2390 TEST(OptimizedPretenuringNestedMixedArrayLiterals) { |
2386 i::FLAG_allow_natives_syntax = true; | 2391 i::FLAG_allow_natives_syntax = true; |
2387 i::FLAG_expose_gc = true; | 2392 i::FLAG_expose_gc = true; |
2393 i::FLAG_min_semi_space_size = 8; | |
2388 CcTest::InitializeVM(); | 2394 CcTest::InitializeVM(); |
2389 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2395 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2390 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2396 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2391 v8::HandleScope scope(CcTest::isolate()); | 2397 v8::HandleScope scope(CcTest::isolate()); |
2392 | 2398 |
2393 i::ScopedVector<char> source(1024); | 2399 i::ScopedVector<char> source(1024); |
2394 i::OS::SNPrintF( | 2400 i::OS::SNPrintF( |
2395 source, | 2401 source, |
2396 "var number_elements = 100;" | 2402 "var number_elements = 100;" |
2397 "var elements = new Array(number_elements);" | 2403 "var elements = new Array(number_elements);" |
(...skipping 24 matching lines...) Expand all Loading... | |
2422 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle)); | 2428 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle)); |
2423 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle->elements())); | 2429 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle->elements())); |
2424 CHECK(CcTest::heap()->InOldPointerSpace(*double_array_handle)); | 2430 CHECK(CcTest::heap()->InOldPointerSpace(*double_array_handle)); |
2425 CHECK(CcTest::heap()->InOldDataSpace(double_array_handle->elements())); | 2431 CHECK(CcTest::heap()->InOldDataSpace(double_array_handle->elements())); |
2426 } | 2432 } |
2427 | 2433 |
2428 | 2434 |
2429 TEST(OptimizedPretenuringNestedObjectLiterals) { | 2435 TEST(OptimizedPretenuringNestedObjectLiterals) { |
2430 i::FLAG_allow_natives_syntax = true; | 2436 i::FLAG_allow_natives_syntax = true; |
2431 i::FLAG_expose_gc = true; | 2437 i::FLAG_expose_gc = true; |
2438 i::FLAG_min_semi_space_size = 8; | |
2432 CcTest::InitializeVM(); | 2439 CcTest::InitializeVM(); |
2433 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2440 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2434 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2441 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2435 v8::HandleScope scope(CcTest::isolate()); | 2442 v8::HandleScope scope(CcTest::isolate()); |
2436 | 2443 |
2437 i::ScopedVector<char> source(1024); | 2444 i::ScopedVector<char> source(1024); |
2438 i::OS::SNPrintF( | 2445 i::OS::SNPrintF( |
2439 source, | 2446 source, |
2440 "var number_elements = %d;" | 2447 "var number_elements = %d;" |
2441 "var elements = new Array(number_elements);" | 2448 "var elements = new Array(number_elements);" |
(...skipping 24 matching lines...) Expand all Loading... | |
2466 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_1)); | 2473 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_1)); |
2467 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_1->elements())); | 2474 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_1->elements())); |
2468 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_2)); | 2475 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_2)); |
2469 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_2->elements())); | 2476 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_2->elements())); |
2470 } | 2477 } |
2471 | 2478 |
2472 | 2479 |
2473 TEST(OptimizedPretenuringNestedDoubleLiterals) { | 2480 TEST(OptimizedPretenuringNestedDoubleLiterals) { |
2474 i::FLAG_allow_natives_syntax = true; | 2481 i::FLAG_allow_natives_syntax = true; |
2475 i::FLAG_expose_gc = true; | 2482 i::FLAG_expose_gc = true; |
2483 i::FLAG_min_semi_space_size = 8; | |
2476 CcTest::InitializeVM(); | 2484 CcTest::InitializeVM(); |
2477 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2485 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2478 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2486 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2479 v8::HandleScope scope(CcTest::isolate()); | 2487 v8::HandleScope scope(CcTest::isolate()); |
2480 | 2488 |
2481 i::ScopedVector<char> source(1024); | 2489 i::ScopedVector<char> source(1024); |
2482 i::OS::SNPrintF( | 2490 i::OS::SNPrintF( |
2483 source, | 2491 source, |
2484 "var number_elements = %d;" | 2492 "var number_elements = %d;" |
2485 "var elements = new Array(number_elements);" | 2493 "var elements = new Array(number_elements);" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2518 | 2526 |
2519 // Make sure pretenuring feedback is gathered for constructed objects as well | 2527 // Make sure pretenuring feedback is gathered for constructed objects as well |
2520 // as for literals. | 2528 // as for literals. |
2521 TEST(OptimizedPretenuringConstructorCalls) { | 2529 TEST(OptimizedPretenuringConstructorCalls) { |
2522 if (!i::FLAG_pretenuring_call_new) { | 2530 if (!i::FLAG_pretenuring_call_new) { |
2523 // FLAG_pretenuring_call_new needs to be synced with the snapshot. | 2531 // FLAG_pretenuring_call_new needs to be synced with the snapshot. |
2524 return; | 2532 return; |
2525 } | 2533 } |
2526 i::FLAG_allow_natives_syntax = true; | 2534 i::FLAG_allow_natives_syntax = true; |
2527 i::FLAG_expose_gc = true; | 2535 i::FLAG_expose_gc = true; |
2536 i::FLAG_min_semi_space_size = 8; | |
2528 CcTest::InitializeVM(); | 2537 CcTest::InitializeVM(); |
2529 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2538 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2530 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2539 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2531 v8::HandleScope scope(CcTest::isolate()); | 2540 v8::HandleScope scope(CcTest::isolate()); |
2532 | 2541 |
2533 i::ScopedVector<char> source(1024); | 2542 i::ScopedVector<char> source(1024); |
2534 // Call new is doing slack tracking for the first | 2543 // Call new is doing slack tracking for the first |
2535 // JSFunction::kGenerousAllocationCount allocations, and we can't find | 2544 // JSFunction::kGenerousAllocationCount allocations, and we can't find |
2536 // mementos during that time. | 2545 // mementos during that time. |
2537 i::OS::SNPrintF( | 2546 i::OS::SNPrintF( |
(...skipping 26 matching lines...) Expand all Loading... | |
2564 } | 2573 } |
2565 | 2574 |
2566 | 2575 |
2567 TEST(OptimizedPretenuringCallNew) { | 2576 TEST(OptimizedPretenuringCallNew) { |
2568 if (!i::FLAG_pretenuring_call_new) { | 2577 if (!i::FLAG_pretenuring_call_new) { |
2569 // FLAG_pretenuring_call_new needs to be synced with the snapshot. | 2578 // FLAG_pretenuring_call_new needs to be synced with the snapshot. |
2570 return; | 2579 return; |
2571 } | 2580 } |
2572 i::FLAG_allow_natives_syntax = true; | 2581 i::FLAG_allow_natives_syntax = true; |
2573 i::FLAG_expose_gc = true; | 2582 i::FLAG_expose_gc = true; |
2583 i::FLAG_min_semi_space_size = 8; | |
2574 CcTest::InitializeVM(); | 2584 CcTest::InitializeVM(); |
2575 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2585 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2576 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2586 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2577 v8::HandleScope scope(CcTest::isolate()); | 2587 v8::HandleScope scope(CcTest::isolate()); |
2578 | 2588 |
2579 i::ScopedVector<char> source(1024); | 2589 i::ScopedVector<char> source(1024); |
2580 // Call new is doing slack tracking for the first | 2590 // Call new is doing slack tracking for the first |
2581 // JSFunction::kGenerousAllocationCount allocations, and we can't find | 2591 // JSFunction::kGenerousAllocationCount allocations, and we can't find |
2582 // mementos during that time. | 2592 // mementos during that time. |
2583 i::OS::SNPrintF( | 2593 i::OS::SNPrintF( |
(...skipping 1693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4277 // Type cast checks fail because the path tracer abuses the map for marking. | 4287 // Type cast checks fail because the path tracer abuses the map for marking. |
4278 if (i::FLAG_enable_slow_asserts) return; | 4288 if (i::FLAG_enable_slow_asserts) return; |
4279 CcTest::InitializeVM(); | 4289 CcTest::InitializeVM(); |
4280 v8::HandleScope scope(CcTest::isolate()); | 4290 v8::HandleScope scope(CcTest::isolate()); |
4281 | 4291 |
4282 v8::Local<v8::Value> result = CompileRun("'abc'"); | 4292 v8::Local<v8::Value> result = CompileRun("'abc'"); |
4283 Handle<Object> o = v8::Utils::OpenHandle(*result); | 4293 Handle<Object> o = v8::Utils::OpenHandle(*result); |
4284 CcTest::i_isolate()->heap()->TracePathToObject(*o); | 4294 CcTest::i_isolate()->heap()->TracePathToObject(*o); |
4285 } | 4295 } |
4286 #endif // DEBUG | 4296 #endif // DEBUG |
OLD | NEW |