| 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 2173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2184 Handle<JSObject> o = | 2184 Handle<JSObject> o = |
| 2185 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); | 2185 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); |
| 2186 | 2186 |
| 2187 CHECK(CcTest::heap()->InNewSpace(*o)); | 2187 CHECK(CcTest::heap()->InNewSpace(*o)); |
| 2188 } | 2188 } |
| 2189 | 2189 |
| 2190 | 2190 |
| 2191 TEST(OptimizedPretenuringAllocationFolding) { | 2191 TEST(OptimizedPretenuringAllocationFolding) { |
| 2192 i::FLAG_allow_natives_syntax = true; | 2192 i::FLAG_allow_natives_syntax = true; |
| 2193 i::FLAG_max_new_space_size = 2048; | 2193 i::FLAG_max_new_space_size = 2048; |
| 2194 i::FLAG_allocation_site_pretenuring = false; |
| 2194 CcTest::InitializeVM(); | 2195 CcTest::InitializeVM(); |
| 2195 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2196 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2196 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2197 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2197 v8::HandleScope scope(CcTest::isolate()); | 2198 v8::HandleScope scope(CcTest::isolate()); |
| 2198 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2199 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 2199 | 2200 |
| 2200 v8::Local<v8::Value> res = CompileRun( | 2201 v8::Local<v8::Value> res = CompileRun( |
| 2201 "function DataObject() {" | 2202 "function DataObject() {" |
| 2202 " this.a = 1.1;" | 2203 " this.a = 1.1;" |
| 2203 " this.b = [{}];" | 2204 " this.b = [{}];" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 2226 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(2))); | 2227 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(2))); |
| 2227 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(3))); | 2228 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(3))); |
| 2228 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(4))); | 2229 CHECK(CcTest::heap()->InOldDataSpace(o->RawFastPropertyAt(4))); |
| 2229 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(5))); | 2230 CHECK(CcTest::heap()->InOldPointerSpace(o->RawFastPropertyAt(5))); |
| 2230 } | 2231 } |
| 2231 | 2232 |
| 2232 | 2233 |
| 2233 TEST(OptimizedPretenuringAllocationFoldingBlocks) { | 2234 TEST(OptimizedPretenuringAllocationFoldingBlocks) { |
| 2234 i::FLAG_allow_natives_syntax = true; | 2235 i::FLAG_allow_natives_syntax = true; |
| 2235 i::FLAG_max_new_space_size = 2048; | 2236 i::FLAG_max_new_space_size = 2048; |
| 2237 i::FLAG_allocation_site_pretenuring = false; |
| 2236 CcTest::InitializeVM(); | 2238 CcTest::InitializeVM(); |
| 2237 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; | 2239 if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return; |
| 2238 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; | 2240 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; |
| 2239 v8::HandleScope scope(CcTest::isolate()); | 2241 v8::HandleScope scope(CcTest::isolate()); |
| 2240 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); | 2242 CcTest::heap()->SetNewSpaceHighPromotionModeActive(true); |
| 2241 | 2243 |
| 2242 v8::Local<v8::Value> res = CompileRun( | 2244 v8::Local<v8::Value> res = CompileRun( |
| 2243 "var number_elements = 30000;" | 2245 "var number_elements = 30000;" |
| 2244 "var elements = new Array(number_elements);" | 2246 "var elements = new Array(number_elements);" |
| 2245 "function DataObject() {" | 2247 "function DataObject() {" |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3740 code = scope.CloseAndEscape(Handle<Code>(bar->code())); | 3742 code = scope.CloseAndEscape(Handle<Code>(bar->code())); |
| 3741 } | 3743 } |
| 3742 | 3744 |
| 3743 // Now make sure that a gc should get rid of the function | 3745 // Now make sure that a gc should get rid of the function |
| 3744 for (int i = 0; i < 4; i++) { | 3746 for (int i = 0; i < 4; i++) { |
| 3745 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); | 3747 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 3746 } | 3748 } |
| 3747 | 3749 |
| 3748 ASSERT(code->marked_for_deoptimization()); | 3750 ASSERT(code->marked_for_deoptimization()); |
| 3749 } | 3751 } |
| OLD | NEW |