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

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

Issue 23545008: Merged r16346, r16355 into trunk branch. (Closed) Base URL: https://v8.googlecode.com/svn/trunk
Patch Set: Created 7 years, 3 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
« no previous file with comments | « src/version.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(OptimizedPretenuringAllocationFolding) {
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
2154 TEST(OptimizedPretenuringAllocationFoldingBlocks) {
2155 i::FLAG_allow_natives_syntax = true;
2156 CcTest::InitializeVM();
2157 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
2158 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
2159 v8::HandleScope scope(CcTest::isolate());
2160 HEAP->SetNewSpaceHighPromotionModeActive(true);
2161
2162 v8::Local<v8::Value> res = CompileRun(
2163 "function DataObject() {"
2164 " this.a = [{}];"
2165 " this.b = [{}];"
2166 " this.c = 1.1;"
2167 " this.d = 1.2;"
2168 " this.e = [{}];"
2169 " this.f = 1.3;"
2170 "}"
2171 "function f() {"
2172 " return new DataObject();"
2173 "};"
2174 "f(); f(); f();"
2175 "%OptimizeFunctionOnNextCall(f);"
2176 "f();");
2177
2178 Handle<JSObject> o =
2179 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
2180
2181 CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(0)));
2182 CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(1)));
2183 CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(2)));
2184 CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(3)));
2185 CHECK(HEAP->InOldPointerSpace(o->RawFastPropertyAt(4)));
2186 CHECK(HEAP->InOldDataSpace(o->RawFastPropertyAt(5)));
2187 }
2188
2189
2118 TEST(OptimizedPretenuringObjectArrayLiterals) { 2190 TEST(OptimizedPretenuringObjectArrayLiterals) {
2119 i::FLAG_allow_natives_syntax = true; 2191 i::FLAG_allow_natives_syntax = true;
2120 CcTest::InitializeVM(); 2192 CcTest::InitializeVM();
2121 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return; 2193 if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
2122 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return; 2194 if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
2123 v8::HandleScope scope(CcTest::isolate()); 2195 v8::HandleScope scope(CcTest::isolate());
2124 HEAP->SetNewSpaceHighPromotionModeActive(true); 2196 HEAP->SetNewSpaceHighPromotionModeActive(true);
2125 2197
2126 v8::Local<v8::Value> res = CompileRun( 2198 v8::Local<v8::Value> res = CompileRun(
2127 "function f() {" 2199 "function f() {"
(...skipping 1246 matching lines...) Expand 10 before | Expand all | Expand 10 after
3374 " var a = new Array(n);" 3446 " var a = new Array(n);"
3375 " for (var i = 0; i < n; i += 100) a[i] = i;" 3447 " for (var i = 0; i < n; i += 100) a[i] = i;"
3376 "};" 3448 "};"
3377 "f(10 * 1024 * 1024);"); 3449 "f(10 * 1024 * 1024);");
3378 IncrementalMarking* marking = HEAP->incremental_marking(); 3450 IncrementalMarking* marking = HEAP->incremental_marking();
3379 if (marking->IsStopped()) marking->Start(); 3451 if (marking->IsStopped()) marking->Start();
3380 // This big step should be sufficient to mark the whole array. 3452 // This big step should be sufficient to mark the whole array.
3381 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); 3453 marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD);
3382 ASSERT(marking->IsComplete()); 3454 ASSERT(marking->IsComplete());
3383 } 3455 }
OLDNEW
« no previous file with comments | « src/version.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698