Commit 32228ff2 authored by mlippautz's avatar mlippautz Committed by Commit bot

Fix api test IndependentWeakHandle

BUG=v8:5865

Review-Url: https://codereview.chromium.org/2640363003
Cr-Commit-Position: refs/heads/master@{#42525}
parent c70ec473
...@@ -7459,7 +7459,8 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) { ...@@ -7459,7 +7459,8 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) {
FlagAndPersistent object_a, object_b; FlagAndPersistent object_a, object_b;
size_t big_heap_size; size_t big_heap_size = 0;
size_t big_array_size = 0;
{ {
v8::HandleScope handle_scope(iso); v8::HandleScope handle_scope(iso);
...@@ -7476,9 +7477,13 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) { ...@@ -7476,9 +7477,13 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) {
} else { } else {
CcTest::CollectGarbage(i::NEW_SPACE); CcTest::CollectGarbage(i::NEW_SPACE);
} }
// We are relying on this creating a big flag array and reserving the space v8::Local<Value> big_array = v8::Array::New(CcTest::isolate(), 5000);
// up front. // Verify that we created an array where the space was reserved up front.
v8::Local<Value> big_array = CompileRun("new Array(5000)"); big_array_size =
v8::internal::JSArray::cast(*v8::Utils::OpenHandle(*big_array))
->elements()
->Size();
CHECK_LE(20000, big_array_size);
a->Set(context, v8_str("y"), big_array).FromJust(); a->Set(context, v8_str("y"), big_array).FromJust();
big_heap_size = CcTest::heap()->SizeOfObjects(); big_heap_size = CcTest::heap()->SizeOfObjects();
} }
...@@ -7500,8 +7505,7 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) { ...@@ -7500,8 +7505,7 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) {
} }
// A single GC should be enough to reclaim the memory, since we are using // A single GC should be enough to reclaim the memory, since we are using
// phantom handles. // phantom handles.
// BUG(5865): --expose-wasm with no snapshot builds requires a limit change. CHECK_GT(big_heap_size - big_array_size, CcTest::heap()->SizeOfObjects());
CHECK_LT(CcTest::heap()->SizeOfObjects(), big_heap_size - 19000);
CHECK(object_a.flag); CHECK(object_a.flag);
CHECK(object_b.flag); CHECK(object_b.flag);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment