| 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 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2177 | 2177 |
| 2178 Handle<JSObject> o = | 2178 Handle<JSObject> o = |
| 2179 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2179 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
| 2180 | 2180 |
| 2181 CHECK(CcTest::heap()->InNewSpace(*o)); | 2181 CHECK(CcTest::heap()->InNewSpace(*o)); |
| 2182 } | 2182 } |
| 2183 | 2183 |
| 2184 | 2184 |
| 2185 TEST(OptimizedPretenuringAllocationFolding) { | 2185 TEST(OptimizedPretenuringAllocationFolding) { |
| 2186 i::FLAG_allow_natives_syntax = true; | 2186 i::FLAG_allow_natives_syntax = true; |
| 2187 i::FLAG_allocation_site_pretenuring = false; |
| 2187 CcTest::InitializeVM(); | 2188 CcTest::InitializeVM(); |
| 2188 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2189 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2189 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2190 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2190 v8::HandleScope scope(CcTest::isolate()); | 2191 v8::HandleScope scope(CcTest::isolate()); |
| 2191 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2192 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 2192 | 2193 |
| 2193 v8::Local<v8::Value> res = CompileRun( | 2194 v8::Local<v8::Value> res = CompileRun( |
| 2194 "function DataObject() {" | 2195 "function DataObject() {" |
| 2195 " this.a = 1.1;" | 2196 " this.a = 1.1;" |
| 2196 " this.b = [{}];" | 2197 " this.b = [{}];" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2213 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(1))); | 2214 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(1))); |
| 2214 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(2))); | 2215 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(2))); |
| 2215 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(3))); | 2216 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(3))); |
| 2216 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(4))); | 2217 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(4))); |
| 2217 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(5))); | 2218 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(5))); |
| 2218 } | 2219 } |
| 2219 | 2220 |
| 2220 | 2221 |
| 2221 TEST(OptimizedPretenuringAllocationFoldingBlocks) { | 2222 TEST(OptimizedPretenuringAllocationFoldingBlocks) { |
| 2222 i::FLAG_allow_natives_syntax = true; | 2223 i::FLAG_allow_natives_syntax = true; |
| 2224 i::FLAG_allocation_site_pretenuring = false; |
| 2223 CcTest::InitializeVM(); | 2225 CcTest::InitializeVM(); |
| 2224 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2226 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2225 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2227 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2226 v8::HandleScope scope(CcTest::isolate()); | 2228 v8::HandleScope scope(CcTest::isolate()); |
| 2227 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2229 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 2228 | 2230 |
| 2229 v8::Local<v8::Value> res = CompileRun( | 2231 v8::Local<v8::Value> res = CompileRun( |
| 2230 "function DataObject() {" | 2232 "function DataObject() {" |
| 2231 " this.a = [{}];" | 2233 " this.a = [{}];" |
| 2232 " this.b = [{}];" | 2234 " this.b = [{}];" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2249 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(1))); | 2251 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(1))); |
| 2250 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(2))); | 2252 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(2))); |
| 2251 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(3))); | 2253 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(3))); |
| 2252 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(4))); | 2254 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(4))); |
| 2253 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(5))); | 2255 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(5))); |
| 2254 } | 2256 } |
| 2255 | 2257 |
| 2256 | 2258 |
| 2257 TEST(OptimizedPretenuringObjectArrayLiterals) { | 2259 TEST(OptimizedPretenuringObjectArrayLiterals) { |
| 2258 i::FLAG_allow_natives_syntax = true; | 2260 i::FLAG_allow_natives_syntax = true; |
| 2261 i::FLAG_allocation_site_pretenuring = false; |
| 2259 CcTest::InitializeVM(); | 2262 CcTest::InitializeVM(); |
| 2260 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2263 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2261 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2264 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2262 v8::HandleScope scope(CcTest::isolate()); | 2265 v8::HandleScope scope(CcTest::isolate()); |
| 2263 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2266 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 2264 | 2267 |
| 2265 v8::Local<v8::Value> res = CompileRun( | 2268 v8::Local<v8::Value> res = CompileRun( |
| 2266 "function f() {" | 2269 "function f() {" |
| 2267 " var numbers = [{}, {}, {}];" | 2270 " var numbers = [{}, {}, {}];" |
| 2268 " return numbers;" | 2271 " return numbers;" |
| 2269 "};" | 2272 "};" |
| 2270 "f(); f(); f();" | 2273 "f(); f(); f();" |
| 2271 "%OptimizeFunctionOnNextCall(f);" | 2274 "%OptimizeFunctionOnNextCall(f);" |
| 2272 "f();"); | 2275 "f();"); |
| 2273 | 2276 |
| 2274 Handle<JSObject> o = | 2277 Handle<JSObject> o = |
| 2275 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2278 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
| 2276 | 2279 |
| 2277 CHECK(CcTest::heap()->InOldPointerSpace(o->elements())); | 2280 CHECK(CcTest::heap()->InOldPointerSpace(o->elements())); |
| 2278 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2281 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
| 2279 } | 2282 } |
| 2280 | 2283 |
| 2281 | 2284 |
| 2282 TEST(OptimizedPretenuringMixedInObjectProperties) { | 2285 TEST(OptimizedPretenuringMixedInObjectProperties) { |
| 2283 i::FLAG_allow_natives_syntax = true; | 2286 i::FLAG_allow_natives_syntax = true; |
| 2287 i::FLAG_allocation_site_pretenuring = false; |
| 2284 CcTest::InitializeVM(); | 2288 CcTest::InitializeVM(); |
| 2285 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2289 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2286 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2290 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2287 v8::HandleScope scope(CcTest::isolate()); | 2291 v8::HandleScope scope(CcTest::isolate()); |
| 2288 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2292 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 2289 | 2293 |
| 2290 v8::Local<v8::Value> res = CompileRun( | 2294 v8::Local<v8::Value> res = CompileRun( |
| 2291 "function f() {" | 2295 "function f() {" |
| 2292 " var numbers = {a: {c: 2.2, d: {}}, b: 1.1};" | 2296 " var numbers = {a: {c: 2.2, d: {}}, b: 1.1};" |
| 2293 " return numbers;" | 2297 " return numbers;" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2305 | 2309 |
| 2306 JSObject* inner_object = reinterpret_cast<JSObject*>(o->RawFastPropertyAt(0)); | 2310 JSObject* inner_object = reinterpret_cast<JSObject*>(o->RawFastPropertyAt(0)); |
| 2307 CHECK(CcTest::heap()->InOldPointerSpace(inner_object)); | 2311 CHECK(CcTest::heap()->InOldPointerSpace(inner_object)); |
| 2308 CHECK(CcTest::heap()->InOldDataSpace(inner_object->RawFastPropertyAt(0))); | 2312 CHECK(CcTest::heap()->InOldDataSpace(inner_object->RawFastPropertyAt(0))); |
| 2309 CHECK(CcTest::heap()->InOldPointerSpace(inner_object->RawFastPropertyAt(1))); | 2313 CHECK(CcTest::heap()->InOldPointerSpace(inner_object->RawFastPropertyAt(1))); |
| 2310 } | 2314 } |
| 2311 | 2315 |
| 2312 | 2316 |
| 2313 TEST(OptimizedPretenuringDoubleArrayProperties) { | 2317 TEST(OptimizedPretenuringDoubleArrayProperties) { |
| 2314 i::FLAG_allow_natives_syntax = true; | 2318 i::FLAG_allow_natives_syntax = true; |
| 2319 i::FLAG_allocation_site_pretenuring = false; |
| 2315 CcTest::InitializeVM(); | 2320 CcTest::InitializeVM(); |
| 2316 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2321 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2317 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2322 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2318 v8::HandleScope scope(CcTest::isolate()); | 2323 v8::HandleScope scope(CcTest::isolate()); |
| 2319 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2324 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 2320 | 2325 |
| 2321 v8::Local<v8::Value> res = CompileRun( | 2326 v8::Local<v8::Value> res = CompileRun( |
| 2322 "function f() {" | 2327 "function f() {" |
| 2323 " var numbers = {a: 1.1, b: 2.2};" | 2328 " var numbers = {a: 1.1, b: 2.2};" |
| 2324 " return numbers;" | 2329 " return numbers;" |
| 2325 "};" | 2330 "};" |
| 2326 "f(); f(); f();" | 2331 "f(); f(); f();" |
| 2327 "%OptimizeFunctionOnNextCall(f);" | 2332 "%OptimizeFunctionOnNextCall(f);" |
| 2328 "f();"); | 2333 "f();"); |
| 2329 | 2334 |
| 2330 Handle<JSObject> o = | 2335 Handle<JSObject> o = |
| 2331 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2336 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
| 2332 | 2337 |
| 2333 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2338 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
| 2334 CHECK(CcTest::heap()->InOldDataSpace(o->properties())); | 2339 CHECK(CcTest::heap()->InOldDataSpace(o->properties())); |
| 2335 } | 2340 } |
| 2336 | 2341 |
| 2337 | 2342 |
| 2338 TEST(OptimizedPretenuringdoubleArrayLiterals) { | 2343 TEST(OptimizedPretenuringdoubleArrayLiterals) { |
| 2339 i::FLAG_allow_natives_syntax = true; | 2344 i::FLAG_allow_natives_syntax = true; |
| 2345 i::FLAG_allocation_site_pretenuring = false; |
| 2340 CcTest::InitializeVM(); | 2346 CcTest::InitializeVM(); |
| 2341 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2347 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2342 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2348 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2343 v8::HandleScope scope(CcTest::isolate()); | 2349 v8::HandleScope scope(CcTest::isolate()); |
| 2344 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2350 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 2345 | 2351 |
| 2346 v8::Local<v8::Value> res = CompileRun( | 2352 v8::Local<v8::Value> res = CompileRun( |
| 2347 "function f() {" | 2353 "function f() {" |
| 2348 " var numbers = [1.1, 2.2, 3.3];" | 2354 " var numbers = [1.1, 2.2, 3.3];" |
| 2349 " return numbers;" | 2355 " return numbers;" |
| 2350 "};" | 2356 "};" |
| 2351 "f(); f(); f();" | 2357 "f(); f(); f();" |
| 2352 "%OptimizeFunctionOnNextCall(f);" | 2358 "%OptimizeFunctionOnNextCall(f);" |
| 2353 "f();"); | 2359 "f();"); |
| 2354 | 2360 |
| 2355 Handle<JSObject> o = | 2361 Handle<JSObject> o = |
| 2356 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2362 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
| 2357 | 2363 |
| 2358 CHECK(CcTest::heap()->InOldDataSpace(o->elements())); | 2364 CHECK(CcTest::heap()->InOldDataSpace(o->elements())); |
| 2359 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2365 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
| 2360 } | 2366 } |
| 2361 | 2367 |
| 2362 | 2368 |
| 2363 TEST(OptimizedPretenuringNestedMixedArrayLiterals) { | 2369 TEST(OptimizedPretenuringNestedMixedArrayLiterals) { |
| 2364 i::FLAG_allow_natives_syntax = true; | 2370 i::FLAG_allow_natives_syntax = true; |
| 2371 i::FLAG_allocation_site_pretenuring = false; |
| 2365 CcTest::InitializeVM(); | 2372 CcTest::InitializeVM(); |
| 2366 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2373 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2367 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2374 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2368 v8::HandleScope scope(CcTest::isolate()); | 2375 v8::HandleScope scope(CcTest::isolate()); |
| 2369 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2376 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 2370 | 2377 |
| 2371 v8::Local<v8::Value> res = CompileRun( | 2378 v8::Local<v8::Value> res = CompileRun( |
| 2372 "function f() {" | 2379 "function f() {" |
| 2373 " var numbers = [[{}, {}, {}],[1.1, 2.2, 3.3]];" | 2380 " var numbers = [[{}, {}, {}],[1.1, 2.2, 3.3]];" |
| 2374 " return numbers;" | 2381 " return numbers;" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2389 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2396 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
| 2390 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle)); | 2397 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle)); |
| 2391 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle->elements())); | 2398 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle->elements())); |
| 2392 CHECK(CcTest::heap()->InOldPointerSpace(*double_array_handle)); | 2399 CHECK(CcTest::heap()->InOldPointerSpace(*double_array_handle)); |
| 2393 CHECK(CcTest::heap()->InOldDataSpace(double_array_handle->elements())); | 2400 CHECK(CcTest::heap()->InOldDataSpace(double_array_handle->elements())); |
| 2394 } | 2401 } |
| 2395 | 2402 |
| 2396 | 2403 |
| 2397 TEST(OptimizedPretenuringNestedObjectLiterals) { | 2404 TEST(OptimizedPretenuringNestedObjectLiterals) { |
| 2398 i::FLAG_allow_natives_syntax = true; | 2405 i::FLAG_allow_natives_syntax = true; |
| 2406 i::FLAG_allocation_site_pretenuring = false; |
| 2399 CcTest::InitializeVM(); | 2407 CcTest::InitializeVM(); |
| 2400 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2408 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2401 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2409 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2402 v8::HandleScope scope(CcTest::isolate()); | 2410 v8::HandleScope scope(CcTest::isolate()); |
| 2403 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2411 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 2404 | 2412 |
| 2405 v8::Local<v8::Value> res = CompileRun( | 2413 v8::Local<v8::Value> res = CompileRun( |
| 2406 "function f() {" | 2414 "function f() {" |
| 2407 " var numbers = [[{}, {}, {}],[{}, {}, {}]];" | 2415 " var numbers = [[{}, {}, {}],[{}, {}, {}]];" |
| 2408 " return numbers;" | 2416 " return numbers;" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2423 CHECK(CcTest::heap()->InOldPointerSpace(*o)); | 2431 CHECK(CcTest::heap()->InOldPointerSpace(*o)); |
| 2424 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_1)); | 2432 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_1)); |
| 2425 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_1->elements())); | 2433 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_1->elements())); |
| 2426 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_2)); | 2434 CHECK(CcTest::heap()->InOldPointerSpace(*int_array_handle_2)); |
| 2427 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_2->elements())); | 2435 CHECK(CcTest::heap()->InOldPointerSpace(int_array_handle_2->elements())); |
| 2428 } | 2436 } |
| 2429 | 2437 |
| 2430 | 2438 |
| 2431 TEST(OptimizedPretenuringNestedDoubleLiterals) { | 2439 TEST(OptimizedPretenuringNestedDoubleLiterals) { |
| 2432 i::FLAG_allow_natives_syntax = true; | 2440 i::FLAG_allow_natives_syntax = true; |
| 2441 i::FLAG_allocation_site_pretenuring = false; |
| 2433 CcTest::InitializeVM(); | 2442 CcTest::InitializeVM(); |
| 2434 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2443 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2435 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2444 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2436 v8::HandleScope scope(CcTest::isolate()); | 2445 v8::HandleScope scope(CcTest::isolate()); |
| 2437 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2446 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 2438 | 2447 |
| 2439 v8::Local<v8::Value> res = CompileRun( | 2448 v8::Local<v8::Value> res = CompileRun( |
| 2440 "function f() {" | 2449 "function f() {" |
| 2441 " var numbers = [[1.1, 1.2, 1.3],[2.1, 2.2, 2.3]];" | 2450 " var numbers = [[1.1, 1.2, 1.3],[2.1, 2.2, 2.3]];" |
| 2442 " return numbers;" | 2451 " return numbers;" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2486 | 2495 |
| 2487 Handle<JSObject> o = | 2496 Handle<JSObject> o = |
| 2488 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2497 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
| 2489 | 2498 |
| 2490 CHECK(CcTest::heap()->InNewSpace(o->elements())); | 2499 CHECK(CcTest::heap()->InNewSpace(o->elements())); |
| 2491 } | 2500 } |
| 2492 | 2501 |
| 2493 | 2502 |
| 2494 TEST(OptimizedPretenuringCallNew) { | 2503 TEST(OptimizedPretenuringCallNew) { |
| 2495 i::FLAG_allow_natives_syntax = true; | 2504 i::FLAG_allow_natives_syntax = true; |
| 2505 i::FLAG_allocation_site_pretenuring = false; |
| 2496 i::FLAG_pretenuring_call_new = true; | 2506 i::FLAG_pretenuring_call_new = true; |
| 2497 CcTest::InitializeVM(); | 2507 CcTest::InitializeVM(); |
| 2498 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2508 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2499 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2509 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2500 v8::HandleScope scope(CcTest::isolate()); | 2510 v8::HandleScope scope(CcTest::isolate()); |
| 2501 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2511 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 2502 | 2512 |
| 2503 AlwaysAllocateScope always_allocate; | 2513 AlwaysAllocateScope always_allocate; |
| 2504 v8::Local<v8::Value> res = CompileRun( | 2514 v8::Local<v8::Value> res = CompileRun( |
| 2505 "function g() { this.a = 0; }" | 2515 "function g() { this.a = 0; }" |
| (...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3610 for (int i = 0; i < 4; i++) { | 3620 for (int i = 0; i < 4; i++) { |
| 3611 heap->CollectAllGarbage(false); | 3621 heap->CollectAllGarbage(false); |
| 3612 } | 3622 } |
| 3613 | 3623 |
| 3614 // The site still exists because of our global handle, but the code is no | 3624 // The site still exists because of our global handle, but the code is no |
| 3615 // longer referred to by dependent_code(). | 3625 // longer referred to by dependent_code(). |
| 3616 DependentCode::GroupStartIndexes starts(site->dependent_code()); | 3626 DependentCode::GroupStartIndexes starts(site->dependent_code()); |
| 3617 int index = starts.at(DependentCode::kAllocationSiteTransitionChangedGroup); | 3627 int index = starts.at(DependentCode::kAllocationSiteTransitionChangedGroup); |
| 3618 CHECK(!(site->dependent_code()->is_code_at(index))); | 3628 CHECK(!(site->dependent_code()->is_code_at(index))); |
| 3619 } | 3629 } |
| OLD | NEW |