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 2222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2233 TEST(OptimizedPretenuringAllocationFoldingBlocks) { | 2233 TEST(OptimizedPretenuringAllocationFoldingBlocks) { |
2234 i::FLAG_allow_natives_syntax = true; | 2234 i::FLAG_allow_natives_syntax = true; |
2235 i::FLAG_max_new_space_size = 2048; | 2235 i::FLAG_max_new_space_size = 2048; |
2236 CcTest::InitializeVM(); | 2236 CcTest::InitializeVM(); |
2237 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2237 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2238 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2238 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2239 v8::HandleScope scope(CcTest::isolate()); | 2239 v8::HandleScope scope(CcTest::isolate()); |
2240 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2240 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
2241 | 2241 |
2242 v8::Local<v8::Value> res = CompileRun( | 2242 v8::Local<v8::Value> res = CompileRun( |
2243 "var number_elements = 3000;" | 2243 "var number_elements = 10000;" |
2244 "var elements = new Array(number_elements);" | 2244 "var elements = new Array(number_elements);" |
2245 "function DataObject() {" | 2245 "function DataObject() {" |
2246 " this.a = [{}];" | 2246 " this.a = [{}];" |
2247 " this.b = [{}];" | 2247 " this.b = [{}];" |
2248 " this.c = 1.1;" | 2248 " this.c = 1.1;" |
2249 " this.d = 1.2;" | 2249 " this.d = 1.2;" |
2250 " this.e = [{}];" | 2250 " this.e = [{}];" |
2251 " this.f = 1.3;" | 2251 " this.f = 1.3;" |
2252 "}" | 2252 "}" |
2253 "function f() {" | 2253 "function f() {" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2342 CcTest::InitializeVM(); | 2342 CcTest::InitializeVM(); |
2343 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2343 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
2344 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2344 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
2345 v8::HandleScope scope(CcTest::isolate()); | 2345 v8::HandleScope scope(CcTest::isolate()); |
2346 | 2346 |
2347 v8::Local<v8::Value> res = CompileRun( | 2347 v8::Local<v8::Value> res = CompileRun( |
2348 "var number_elements = 20000;" | 2348 "var number_elements = 20000;" |
2349 "var elements = new Array(number_elements);" | 2349 "var elements = new Array(number_elements);" |
2350 "function f() {" | 2350 "function f() {" |
2351 " for (var i = 0; i < number_elements; i++) {" | 2351 " for (var i = 0; i < number_elements; i++) {" |
2352 " elements[i] = {a: 1.1, b: 2.2};" | 2352 " elements[i] = {a: 1.1, b: 2.2, c: 3.3};" |
2353 " }" | 2353 " }" |
2354 " return elements[i - 1];" | 2354 " return elements[i - 1];" |
2355 "};" | 2355 "};" |
2356 "f(); f(); f();" | 2356 "f(); f(); f();" |
2357 "%OptimizeFunctionOnNextCall(f);" | 2357 "%OptimizeFunctionOnNextCall(f);" |
2358 "f();"); | 2358 "f();"); |
2359 | 2359 |
2360 Handle<JSObject> o = | 2360 Handle<JSObject> o = |
2361 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2361 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
2362 | 2362 |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3657 for (int i = 0; i < 4; i++) { | 3657 for (int i = 0; i < 4; i++) { |
3658 heap->CollectAllGarbage(false); | 3658 heap->CollectAllGarbage(false); |
3659 } | 3659 } |
3660 | 3660 |
3661 // The site still exists because of our global handle, but the code is no | 3661 // The site still exists because of our global handle, but the code is no |
3662 // longer referred to by dependent_code(). | 3662 // longer referred to by dependent_code(). |
3663 DependentCode::GroupStartIndexes starts(site->dependent_code()); | 3663 DependentCode::GroupStartIndexes starts(site->dependent_code()); |
3664 int index = starts.at(DependentCode::kAllocationSiteTransitionChangedGroup); | 3664 int index = starts.at(DependentCode::kAllocationSiteTransitionChangedGroup); |
3665 CHECK(!(site->dependent_code()->is_code_at(index))); | 3665 CHECK(!(site->dependent_code()->is_code_at(index))); |
3666 } | 3666 } |
OLD | NEW |