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

Unified Diff: src/runtime.cc

Issue 11276028: Object.observe: implement map bit and functions to access it. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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/runtime.h ('k') | no next file » | 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 b0a6b5e81427e1588a89f1c269a2b1e90c78f98b..6d3412b7fd246a25bea2622b8330a0d41f6bc5c2 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -13222,6 +13222,29 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_HaveSameMap) {
return isolate->heap()->ToBoolean(obj1->map() == obj2->map());
}
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_IsObserved) {
+ ASSERT(args.length() == 1);
+ CONVERT_ARG_CHECKED(JSReceiver, obj, 0);
+ return isolate->heap()->ToBoolean(obj->map()->is_observed());
+}
+
+
+RUNTIME_FUNCTION(MaybeObject*, Runtime_SetIsObserved) {
+ ASSERT(args.length() == 2);
+ CONVERT_ARG_CHECKED(JSReceiver, obj, 0);
+ CONVERT_BOOLEAN_ARG_CHECKED(is_observed, 1);
+ if (obj->map()->is_observed() != is_observed) {
+ MaybeObject* maybe = obj->map()->Copy();
+ Map* map;
+ if (!maybe->To<Map>(&map)) return maybe;
+ map->set_is_observed(is_observed);
+ obj->set_map(map);
+ }
+ return isolate->heap()->undefined_value();
+}
+
+
// ----------------------------------------------------------------------------
// Implementation of Runtime
« no previous file with comments | « src/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698