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

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

Issue 1144163002: Revert of Use shared container to manage imports/exports. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/weak-collection.js ('k') | test/mjsunit/regress/regress-1878.js » ('j') | 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 2e5f180c91a07618968c58bf6f1a352cc8fb8aa7..ab2391a875e88da54c1a2bddc8e82f54f0ed9187 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -5410,11 +5410,19 @@
}
-static bool utils_has_been_collected = false;
-
-static void UtilsHasBeenCollected(
+static bool shared_has_been_collected = false;
+static bool builtin_exports_has_been_collected = false;
+
+static void SharedHasBeenCollected(
const v8::WeakCallbackInfo<v8::Persistent<v8::Object>>& data) {
- utils_has_been_collected = true;
+ shared_has_been_collected = true;
+ data.GetParameter()->Reset();
+}
+
+
+static void BuiltinExportsHasBeenCollected(
+ const v8::WeakCallbackInfo<v8::Persistent<v8::Object>>& data) {
+ builtin_exports_has_been_collected = true;
data.GetParameter()->Reset();
}
@@ -5426,50 +5434,30 @@
if (Snapshot::HaveASnapshotToStartFrom(CcTest::i_isolate())) return;
- utils_has_been_collected = false;
-
- v8::Persistent<v8::Object> utils;
+ shared_has_been_collected = false;
+ builtin_exports_has_been_collected = false;
+
+ v8::Persistent<v8::Object> shared;
+ v8::Persistent<v8::Object> builtin_exports;
{
v8::HandleScope scope(isolate);
v8::Handle<v8::Object> natives =
CcTest::global()->Get(v8_str("natives"))->ToObject(isolate);
- utils.Reset(isolate, natives->Get(v8_str("utils"))->ToObject(isolate));
- natives->Delete(v8_str("utils"));
- }
-
- utils.SetWeak(&utils, UtilsHasBeenCollected,
- v8::WeakCallbackType::kParameter);
+ shared.Reset(isolate, natives->Get(v8_str("shared"))->ToObject(isolate));
+ natives->Delete(v8_str("shared"));
+ builtin_exports.Reset(
+ isolate, natives->Get(v8_str("builtin_exports"))->ToObject(isolate));
+ natives->Delete(v8_str("builtin_exports"));
+ }
+
+ shared.SetWeak(&shared, SharedHasBeenCollected,
+ v8::WeakCallbackType::kParameter);
+ builtin_exports.SetWeak(&builtin_exports, BuiltinExportsHasBeenCollected,
+ v8::WeakCallbackType::kParameter);
CcTest::heap()->CollectAllAvailableGarbage("fire weak callbacks");
- CHECK(utils_has_been_collected);
-}
-
-
-TEST(Regress1878) {
- FLAG_allow_natives_syntax = true;
- CcTest::InitializeVM();
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::Function> constructor =
- v8::Utils::ToLocal(CcTest::i_isolate()->internal_array_function());
- CcTest::global()->Set(v8_str("InternalArray"), constructor);
-
- v8::TryCatch try_catch;
-
- CompileRun(
- "var a = Array();"
- "for (var i = 0; i < 1000; i++) {"
- " var ai = new InternalArray(10000);"
- " if (%HaveSameMap(ai, a)) throw Error();"
- " if (!%HasFastObjectElements(ai)) throw Error();"
- "}"
- "for (var i = 0; i < 1000; i++) {"
- " var ai = new InternalArray(10000);"
- " if (%HaveSameMap(ai, a)) throw Error();"
- " if (!%HasFastObjectElements(ai)) throw Error();"
- "}");
-
- CHECK(!try_catch.HasCaught());
-}
+ CHECK(shared_has_been_collected);
+ CHECK(builtin_exports_has_been_collected);
+}
« no previous file with comments | « src/weak-collection.js ('k') | test/mjsunit/regress/regress-1878.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698