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

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

Issue 1143993003: Use shared container to manage imports/exports. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixed test for no-snap 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/debug-script.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 ab2391a875e88da54c1a2bddc8e82f54f0ed9187..2e5f180c91a07618968c58bf6f1a352cc8fb8aa7 100644
--- a/test/cctest/test-heap.cc
+++ b/test/cctest/test-heap.cc
@@ -5410,19 +5410,11 @@ TEST(PreprocessStackTrace) {
}
-static bool shared_has_been_collected = false;
-static bool builtin_exports_has_been_collected = false;
+static bool utils_has_been_collected = false;
-static void SharedHasBeenCollected(
+static void UtilsHasBeenCollected(
const v8::WeakCallbackInfo<v8::Persistent<v8::Object>>& data) {
- 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;
+ utils_has_been_collected = true;
data.GetParameter()->Reset();
}
@@ -5434,30 +5426,50 @@ TEST(BootstrappingExports) {
if (Snapshot::HaveASnapshotToStartFrom(CcTest::i_isolate())) return;
- shared_has_been_collected = false;
- builtin_exports_has_been_collected = false;
+ utils_has_been_collected = false;
- v8::Persistent<v8::Object> shared;
- v8::Persistent<v8::Object> builtin_exports;
+ v8::Persistent<v8::Object> utils;
{
v8::HandleScope scope(isolate);
v8::Handle<v8::Object> natives =
CcTest::global()->Get(v8_str("natives"))->ToObject(isolate);
- 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"));
+ utils.Reset(isolate, natives->Get(v8_str("utils"))->ToObject(isolate));
+ natives->Delete(v8_str("utils"));
}
- shared.SetWeak(&shared, SharedHasBeenCollected,
- v8::WeakCallbackType::kParameter);
- builtin_exports.SetWeak(&builtin_exports, BuiltinExportsHasBeenCollected,
- v8::WeakCallbackType::kParameter);
+ utils.SetWeak(&utils, UtilsHasBeenCollected,
+ v8::WeakCallbackType::kParameter);
CcTest::heap()->CollectAllAvailableGarbage("fire weak callbacks");
- CHECK(shared_has_been_collected);
- CHECK(builtin_exports_has_been_collected);
+ 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());
}
« no previous file with comments | « src/weak-collection.js ('k') | test/mjsunit/debug-script.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698