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

Unified Diff: test/cctest/test-heap.cc

Issue 96783002: Allocation site pretenuring. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-heap.cc
diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
index 8f664d5ad1ce5f2a5e0a1d1db90352fb84b42be0..d5fae581deb8fb96b8fda9270cfd5341ef76de80 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -2190,7 +2190,7 @@ TEST(OptimizedAllocationAlwaysInNewSpace) {
TEST(OptimizedPretenuringAllocationFolding) {
i::FLAG_allow_natives_syntax = true;
- i::FLAG_allocation_site_pretenuring = false;
+ i::FLAG_max_new_space_size = 2048;
CcTest::InitializeVM();
if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
@@ -2206,8 +2206,13 @@ TEST(OptimizedPretenuringAllocationFolding) {
" this.e = 1.3;"
" this.f = [{}];"
"}"
+ "var number_elements = 20000;"
+ "var elements = new Array();"
"function f() {"
- " return new DataObject();"
+ " for (var i = 0; i < 20000-1; i++) {"
+ " elements[i] = new DataObject();"
+ " }"
+ " return new DataObject()"
"};"
"f(); f(); f();"
"%OptimizeFunctionOnNextCall(f);"
@@ -2227,7 +2232,7 @@ TEST(OptimizedPretenuringAllocationFolding) {
TEST(OptimizedPretenuringAllocationFoldingBlocks) {
i::FLAG_allow_natives_syntax = true;
- i::FLAG_allocation_site_pretenuring = false;
+ i::FLAG_max_new_space_size = 2048;
CcTest::InitializeVM();
if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
@@ -2235,6 +2240,8 @@ TEST(OptimizedPretenuringAllocationFoldingBlocks) {
CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
v8::Local<v8::Value> res = CompileRun(
+ "var number_elements = 3000;"
+ "var elements = new Array(number_elements);"
"function DataObject() {"
" this.a = [{}];"
" this.b = [{}];"
@@ -2244,7 +2251,10 @@ TEST(OptimizedPretenuringAllocationFoldingBlocks) {
" this.f = 1.3;"
"}"
"function f() {"
- " return new DataObject();"
+ " for (var i = 0; i < number_elements; i++) {"
+ " elements[i] = new DataObject();"
+ " }"
+ " return elements[number_elements - 1];"
"};"
"f(); f(); f();"
"%OptimizeFunctionOnNextCall(f);"
@@ -2264,17 +2274,20 @@ TEST(OptimizedPretenuringAllocationFoldingBlocks) {
TEST(OptimizedPretenuringObjectArrayLiterals) {
i::FLAG_allow_natives_syntax = true;
- i::FLAG_allocation_site_pretenuring = false;
+ i::FLAG_max_new_space_size = 2048;
CcTest::InitializeVM();
if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
- CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
v8::Local<v8::Value> res = CompileRun(
+ "var number_elements = 20000;"
+ "var elements = new Array(number_elements);"
"function f() {"
- " var numbers = [{}, {}, {}];"
- " return numbers;"
+ " for (var i = 0; i < number_elements; i++) {"
+ " elements[i] = [{}, {}, {}];"
+ " }"
+ " return elements[number_elements - 1];"
"};"
"f(); f(); f();"
"%OptimizeFunctionOnNextCall(f);"
@@ -2290,17 +2303,20 @@ TEST(OptimizedPretenuringObjectArrayLiterals) {
TEST(OptimizedPretenuringMixedInObjectProperties) {
i::FLAG_allow_natives_syntax = true;
- i::FLAG_allocation_site_pretenuring = false;
+ i::FLAG_max_new_space_size = 2048;
CcTest::InitializeVM();
if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
- CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
v8::Local<v8::Value> res = CompileRun(
+ "var number_elements = 20000;"
+ "var elements = new Array(number_elements);"
"function f() {"
- " var numbers = {a: {c: 2.2, d: {}}, b: 1.1};"
- " return numbers;"
+ " for (var i = 0; i < number_elements; i++) {"
+ " elements[i] = {a: {c: 2.2, d: {}}, b: 1.1};"
+ " }"
+ " return elements[number_elements - 1];"
"};"
"f(); f(); f();"
"%OptimizeFunctionOnNextCall(f);"
@@ -2322,17 +2338,20 @@ TEST(OptimizedPretenuringMixedInObjectProperties) {
TEST(OptimizedPretenuringDoubleArrayProperties) {
i::FLAG_allow_natives_syntax = true;
- i::FLAG_allocation_site_pretenuring = false;
+ i::FLAG_max_new_space_size = 2048;
CcTest::InitializeVM();
if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
- CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
v8::Local<v8::Value> res = CompileRun(
+ "var number_elements = 20000;"
+ "var elements = new Array(number_elements);"
"function f() {"
- " var numbers = {a: 1.1, b: 2.2};"
- " return numbers;"
+ " for (var i = 0; i < number_elements; i++) {"
+ " elements[i] = {a: 1.1, b: 2.2};"
+ " }"
+ " return elements[i - 1];"
"};"
"f(); f(); f();"
"%OptimizeFunctionOnNextCall(f);"
@@ -2348,17 +2367,20 @@ TEST(OptimizedPretenuringDoubleArrayProperties) {
TEST(OptimizedPretenuringdoubleArrayLiterals) {
i::FLAG_allow_natives_syntax = true;
- i::FLAG_allocation_site_pretenuring = false;
+ i::FLAG_max_new_space_size = 2048;
CcTest::InitializeVM();
if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
- CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
v8::Local<v8::Value> res = CompileRun(
+ "var number_elements = 20000;"
+ "var elements = new Array(number_elements);"
"function f() {"
- " var numbers = [1.1, 2.2, 3.3];"
- " return numbers;"
+ " for (var i = 0; i < number_elements; i++) {"
+ " elements[i] = [1.1, 2.2, 3.3];"
+ " }"
+ " return elements[number_elements - 1];"
"};"
"f(); f(); f();"
"%OptimizeFunctionOnNextCall(f);"
@@ -2374,17 +2396,20 @@ TEST(OptimizedPretenuringdoubleArrayLiterals) {
TEST(OptimizedPretenuringNestedMixedArrayLiterals) {
i::FLAG_allow_natives_syntax = true;
- i::FLAG_allocation_site_pretenuring = false;
+ i::FLAG_max_new_space_size = 2048;
CcTest::InitializeVM();
if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
- CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
v8::Local<v8::Value> res = CompileRun(
+ "var number_elements = 20000;"
+ "var elements = new Array(number_elements);"
"function f() {"
- " var numbers = [[{}, {}, {}],[1.1, 2.2, 3.3]];"
- " return numbers;"
+ " for (var i = 0; i < number_elements; i++) {"
+ " elements[i] = [[{}, {}, {}], [1.1, 2.2, 3.3]];"
+ " }"
+ " return elements[number_elements - 1];"
"};"
"f(); f(); f();"
"%OptimizeFunctionOnNextCall(f);"
@@ -2409,17 +2434,20 @@ TEST(OptimizedPretenuringNestedMixedArrayLiterals) {
TEST(OptimizedPretenuringNestedObjectLiterals) {
i::FLAG_allow_natives_syntax = true;
- i::FLAG_allocation_site_pretenuring = false;
+ i::FLAG_max_new_space_size = 2048;
CcTest::InitializeVM();
if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
- CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
v8::Local<v8::Value> res = CompileRun(
+ "var number_elements = 20000;"
+ "var elements = new Array(number_elements);"
"function f() {"
- " var numbers = [[{}, {}, {}],[{}, {}, {}]];"
- " return numbers;"
+ " for (var i = 0; i < number_elements; i++) {"
+ " elements[i] = [[{}, {}, {}],[{}, {}, {}]];"
+ " }"
+ " return elements[number_elements - 1];"
"};"
"f(); f(); f();"
"%OptimizeFunctionOnNextCall(f);"
@@ -2444,17 +2472,20 @@ TEST(OptimizedPretenuringNestedObjectLiterals) {
TEST(OptimizedPretenuringNestedDoubleLiterals) {
i::FLAG_allow_natives_syntax = true;
- i::FLAG_allocation_site_pretenuring = false;
+ i::FLAG_max_new_space_size = 2048;
CcTest::InitializeVM();
if (!CcTest::i_isolate()->use_crankshaft() || i::FLAG_always_opt) return;
if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
v8::HandleScope scope(CcTest::isolate());
- CcTest::heap()->SetNewSpaceHighPromotionModeActive(true);
v8::Local<v8::Value> res = CompileRun(
+ "var number_elements = 20000;"
+ "var elements = new Array(number_elements);"
"function f() {"
- " var numbers = [[1.1, 1.2, 1.3],[2.1, 2.2, 2.3]];"
- " return numbers;"
+ " for (var i = 0; i < number_elements; i++) {"
+ " elements[i] = [[1.1, 1.2, 1.3],[2.1, 2.2, 2.3]];"
+ " }"
+ " return elements[number_elements - 1];"
"};"
"f(); f(); f();"
"%OptimizeFunctionOnNextCall(f);"
« no previous file with comments | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698