| Index: test/cctest/test-heap.cc
|
| diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc
|
| index 8f77dddb5948d890b5111183e6e767c744230ea5..5ec9f8e7486de46853b033d5ae453c2b4dbdaa8e 100644
|
| --- a/test/cctest/test-heap.cc
|
| +++ b/test/cctest/test-heap.cc
|
| @@ -3090,7 +3090,7 @@ TEST(Regression144230) {
|
| HandleScope inner_scope(isolate);
|
| AlwaysAllocateScope always_allocate;
|
| SimulateFullSpace(heap->code_space());
|
| - isolate->stub_cache()->ComputeCallInitialize(9, NOT_CONTEXTUAL);
|
| + isolate->stub_cache()->ComputeCallInitialize(9);
|
| }
|
|
|
| // Second compile a CallIC and execute it once so that it gets patched to
|
| @@ -3532,8 +3532,7 @@ TEST(DeferredHandles) {
|
| Isolate* isolate = CcTest::i_isolate();
|
| Heap* heap = isolate->heap();
|
| v8::HandleScope scope(reinterpret_cast<v8::Isolate*>(isolate));
|
| - v8::ImplementationUtilities::HandleScopeData* data =
|
| - isolate->handle_scope_data();
|
| + HandleScopeData* data = isolate->handle_scope_data();
|
| Handle<Object> init(heap->empty_string(), isolate);
|
| while (data->next < data->limit) {
|
| Handle<Object> obj(heap->empty_string(), isolate);
|
| @@ -3664,3 +3663,87 @@ TEST(EnsureAllocationSiteDependentCodesProcessed) {
|
| int index = starts.at(DependentCode::kAllocationSiteTransitionChangedGroup);
|
| CHECK(!(site->dependent_code()->is_code_at(index)));
|
| }
|
| +
|
| +
|
| +TEST(CellsInOptimizedCodeAreWeak) {
|
| + if (i::FLAG_always_opt || !i::FLAG_crankshaft) return;
|
| + i::FLAG_weak_embedded_objects_in_optimized_code = true;
|
| + i::FLAG_allow_natives_syntax = true;
|
| + CcTest::InitializeVM();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| + v8::internal::Heap* heap = CcTest::heap();
|
| +
|
| + if (!isolate->use_crankshaft()) return;
|
| + HandleScope outer_scope(heap->isolate());
|
| + Handle<Code> code;
|
| + {
|
| + LocalContext context;
|
| + HandleScope scope(heap->isolate());
|
| +
|
| + CompileRun("bar = (function() {"
|
| + " function bar() {"
|
| + " return foo(1);"
|
| + " };"
|
| + " var foo = function(x) { with (x) { return 1 + x; } };"
|
| + " bar(foo);"
|
| + " bar(foo);"
|
| + " bar(foo);"
|
| + " %OptimizeFunctionOnNextCall(bar);"
|
| + " bar(foo);"
|
| + " return bar;})();");
|
| +
|
| + Handle<JSFunction> bar =
|
| + v8::Utils::OpenHandle(
|
| + *v8::Handle<v8::Function>::Cast(
|
| + CcTest::global()->Get(v8_str("bar"))));
|
| + code = scope.CloseAndEscape(Handle<Code>(bar->code()));
|
| + }
|
| +
|
| + // Now make sure that a gc should get rid of the function
|
| + for (int i = 0; i < 4; i++) {
|
| + heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| + }
|
| +
|
| + ASSERT(code->marked_for_deoptimization());
|
| +}
|
| +
|
| +
|
| +TEST(ObjectsInOptimizedCodeAreWeak) {
|
| + if (i::FLAG_always_opt || !i::FLAG_crankshaft) return;
|
| + i::FLAG_weak_embedded_objects_in_optimized_code = true;
|
| + i::FLAG_allow_natives_syntax = true;
|
| + CcTest::InitializeVM();
|
| + Isolate* isolate = CcTest::i_isolate();
|
| + v8::internal::Heap* heap = CcTest::heap();
|
| +
|
| + if (!isolate->use_crankshaft()) return;
|
| + HandleScope outer_scope(heap->isolate());
|
| + Handle<Code> code;
|
| + {
|
| + LocalContext context;
|
| + HandleScope scope(heap->isolate());
|
| +
|
| + CompileRun("function bar() {"
|
| + " return foo(1);"
|
| + "};"
|
| + "function foo(x) { with (x) { return 1 + x; } };"
|
| + "bar();"
|
| + "bar();"
|
| + "bar();"
|
| + "%OptimizeFunctionOnNextCall(bar);"
|
| + "bar();");
|
| +
|
| + Handle<JSFunction> bar =
|
| + v8::Utils::OpenHandle(
|
| + *v8::Handle<v8::Function>::Cast(
|
| + CcTest::global()->Get(v8_str("bar"))));
|
| + code = scope.CloseAndEscape(Handle<Code>(bar->code()));
|
| + }
|
| +
|
| + // Now make sure that a gc should get rid of the function
|
| + for (int i = 0; i < 4; i++) {
|
| + heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
|
| + }
|
| +
|
| + ASSERT(code->marked_for_deoptimization());
|
| +}
|
|
|