| Index: test/cctest/test-heap.cc
|
| diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
|
| index 8967ff594c9ada9e8c739416efecfed54009583c..ab4783c3ceb69dfae28384cb07b3274070701f7a 100644
|
| --- a/test/cctest/test-heap.cc
|
| +++ b/test/cctest/test-heap.cc
|
| @@ -2126,6 +2126,32 @@ TEST(OptimizedPretenuringSimpleArrayLiterals) {
|
| }
|
|
|
|
|
| +TEST(OptimizedPretenuringObjectAllocation) {
|
| + i::FLAG_allow_natives_syntax = true;
|
| + i::FLAG_pretenure_hallocateobject = true;
|
| + CcTest::InitializeVM();
|
| + if (!i::V8::UseCrankshaft() || i::FLAG_always_opt) return;
|
| + if (i::FLAG_gc_global || i::FLAG_stress_compaction) return;
|
| + v8::HandleScope scope(CcTest::isolate());
|
| + HEAP->SetNewSpaceHighPromotionModeActive(true);
|
| +
|
| + AlwaysAllocateScope always_allocate;
|
| + v8::Local<v8::Value> res = CompileRun(
|
| + "function g() { this.a = 0; }"
|
| + "function f() {"
|
| + " return new g();"
|
| + "};"
|
| + "f(); f(); f();"
|
| + "%OptimizeFunctionOnNextCall(f);"
|
| + "f();");
|
| +
|
| + Handle<JSObject> o =
|
| + v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(res));
|
| +
|
| + CHECK(HEAP->InOldPointerSpace(*o));
|
| +}
|
| +
|
| +
|
| // Test regular array literals allocation.
|
| TEST(OptimizedAllocationArrayLiterals) {
|
| i::FLAG_allow_natives_syntax = true;
|
|
|