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

Unified Diff: src/runtime.cc

Issue 11477006: Object.observe: prevent observed objects from using fast elements. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed Michael's comment Created 8 years 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/objects-inl.h ('k') | test/mjsunit/harmony/object-observe.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 06a8458549104a088925775540e4a10e38d05c5a..dfb4245954a3ef61a652720dc300d19d10fe48d3 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -13384,6 +13384,13 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetIsObserved) {
if (!maybe->To(&map)) return maybe;
map->set_is_observed(is_observed);
obj->set_map(map);
+ if (is_observed && obj->IsJSObject() &&
+ !JSObject::cast(obj)->HasExternalArrayElements()) {
+ // Go to dictionary mode, so that we don't skip map checks.
+ maybe = JSObject::cast(obj)->NormalizeElements();
+ if (maybe->IsFailure()) return maybe;
+ ASSERT(!JSObject::cast(obj)->HasFastElements());
+ }
}
return isolate->heap()->undefined_value();
}
« no previous file with comments | « src/objects-inl.h ('k') | test/mjsunit/harmony/object-observe.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698