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

Unified Diff: test/cctest/test-object-observe.cc

Issue 11361172: Fix InternalObjectHashTable to properly update table ref in observationState (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added test case Created 8 years, 1 month 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/object-observe.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-object-observe.cc
diff --git a/test/cctest/test-object-observe.cc b/test/cctest/test-object-observe.cc
index 2321bb22ffb202a678368f810d5f6eb0b238c6ee..4a21eb2c427873bc8fdafd6c52b6684acba8e0ca 100644
--- a/test/cctest/test-object-observe.cc
+++ b/test/cctest/test-object-observe.cc
@@ -165,3 +165,32 @@ TEST(DeliveryOrderingReentrant) {
CHECK_EQ(1, CompileRun("ordering[3]")->Int32Value());
CHECK_EQ(2, CompileRun("ordering[1]")->Int32Value());
}
+
+TEST(ObjectHashTableGrowth) {
+ HarmonyIsolate isolate;
+ HandleScope scope;
+ // Initializing this context sets up initial hash tables.
+ LocalContext context;
+ Handle<Value> obj = CompileRun("obj = {};");
+ Handle<Value> observer = CompileRun(
+ "var ran = false;"
+ "(function() { ran = true })");
+ {
+ // As does initializing this context.
+ LocalContext context2;
+ context2->Global()->Set(String::New("obj"), obj);
+ context2->Global()->Set(String::New("observer"), observer);
+ CompileRun(
+ "var objArr = [];"
+ // 100 objects should be enough to make the hash table grow
+ // (and thus relocate).
+ "for (var i = 0; i < 100; ++i) {"
+ " objArr.push({});"
+ " Object.observe(objArr[objArr.length-1], function(){});"
+ "}"
+ "Object.observe(obj, observer);");
+ }
+ // obj is now marked "is_observed", but our map has moved.
+ CompileRun("obj.foo = 'bar'");
+ CHECK(CompileRun("ran")->BooleanValue());
+}
« no previous file with comments | « src/object-observe.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698