Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: test/cctest/test-heap.cc

Issue 22378003: Added allocation folding support for old space allocations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« src/hydrogen-instructions.cc ('K') | « src/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2097 matching lines...) Expand 10 before | Expand all | Expand 10 after
2108 "f(4);"); 2108 "f(4);");
2109 CHECK_EQ(4, res->ToObject()->GetRealNamedProperty(v8_str("x"))->Int32Value()); 2109 CHECK_EQ(4, res->ToObject()->GetRealNamedProperty(v8_str("x"))->Int32Value());
2110 2110
2111 Handle<JSObject> o = 2111 Handle<JSObject> o =
2112 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res)); 2112 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
2113 2113
2114 CHECK(HEAP->InNewSpace(*o)); 2114 CHECK(HEAP->InNewSpace(*o));
2115 } 2115 }
2116 2116
2117 2117
2118 TEST(OptimizedPretenuringAllcoationFoldingDataSpace) {
2119 i::FLAG_allow_natives_syntax = true;
2120 CcTest::InitializeVM();
2121 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
2122 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
2123 v8::HandleScope scope(CcTest::isolate());
2124 HEAP->SetNewSpaceHighPromotionModeActive(true);
2125
2126 v8::Local<v8::Value> res = CompileRun(
2127 "function DataObject() {"
2128 " this.a = 1.1;"
2129 " this.b = [{}];"
2130 " this.c = 1.2;"
2131 " this.d = [{}];"
2132 " this.e = 1.3;"
2133 " this.f = [{}];"
2134 "}"
2135 "function f() {"
2136 " return new DataObject();"
2137 "};"
2138 "f(); f(); f();"
2139 "%OptimizeFunctionOnNextCall(f);"
2140 "f();");
2141
2142 Handle<JSObject> o =
2143 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
2144
2145 CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(0)));
2146 CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(1)));
2147 CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(2)));
2148 CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(3)));
2149 CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(4)));
2150 CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(5)));
2151 }
2152
2153
2118 TEST(OptimizedPretenuringObjectArrayLiterals) { 2154 TEST(OptimizedPretenuringObjectArrayLiterals) {
2119 i::FLAG_allow_natives_syntax = true; 2155 i::FLAG_allow_natives_syntax = true;
2120 CcTest::InitializeVM(); 2156 CcTest::InitializeVM();
2121 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return; 2157 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
2122 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; 2158 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
2123 v8::HandleScope scope(CcTest::isolate()); 2159 v8::HandleScope scope(CcTest::isolate());
2124 HEAP->SetNewSpaceHighPromotionModeActive(true); 2160 HEAP->SetNewSpaceHighPromotionModeActive(true);
2125 2161
2126 v8::Local<v8::Value> res = CompileRun( 2162 v8::Local<v8::Value> res = CompileRun(
2127 "function f() {" 2163 "function f() {"
(...skipping 1251 matching lines...) Expand 10 before | Expand all | Expand 10 after
3379 " var a = new Array(n);" 3415 " var a = new Array(n);"
3380 " for (var i = 0; i < n; i += 100) a[i] = i;" 3416 " for (var i = 0; i < n; i += 100) a[i] = i;"
3381 "};" 3417 "};"
3382 "f(10 * 1024 * 1024);"); 3418 "f(10 * 1024 * 1024);");
3383 IncrementalMarking* marking = HEAP->incremental_marking(); 3419 IncrementalMarking* marking = HEAP->incremental_marking();
3384 if (marking->IsStopped()) marking->Start(); 3420 if (marking->IsStopped()) marking->Start();
3385 // This big step should be sufficient to mark the whole array. 3421 // This big step should be sufficient to mark the whole array.
3386 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); 3422 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
3387 ASSERT(marking->IsComplete()); 3423 ASSERT(marking->IsComplete());
3388 } 3424 }
OLDNEW
« src/hydrogen-instructions.cc ('K') | « src/hydrogen-instructions.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698