Revision: 12901
Author: [email protected]
Date: Thu Nov 8 05:15:54 2012
Log: Object.observe: Fixed missing case for turning off ICs.
[email protected]
BUG=
Review URL: https://codereview.chromium.org/11358122
http://code.google.com/p/v8/source/detail?r=12901
Modified:
/branches/bleeding_edge/src/ic.cc
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/test/mjsunit/harmony/object-observe.js
=======================================
--- /branches/bleeding_edge/src/ic.cc Tue Nov 6 04:32:36 2012
+++ /branches/bleeding_edge/src/ic.cc Thu Nov 8 05:15:54 2012
@@ -1920,8 +1920,10 @@
}
// Do not use ICs for objects that require access checks (including
- // the global object).
- bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded();
+ // the global object), or are observed.
+ bool use_ic = FLAG_use_ic && !object->IsAccessCheckNeeded() &&
+ !(FLAG_harmony_observation && object->IsJSObject() &&
+ JSObject::cast(*object)->map()->is_observed());
ASSERT(!(use_ic && object->IsJSGlobalProxy()));
if (use_ic) {
=======================================
--- /branches/bleeding_edge/src/objects.cc Thu Nov 8 04:58:08 2012
+++ /branches/bleeding_edge/src/objects.cc Thu Nov 8 05:15:54 2012
@@ -10292,7 +10292,7 @@
// From here on, everything has to be handlified.
Handle<String> name;
Handle<Object> old_value(isolate->heap()->the_hole_value());
- PropertyAttributes old_attributes;
+ PropertyAttributes old_attributes = ABSENT;
bool preexists = false;
if (FLAG_harmony_observation && map()->is_observed()) {
name = isolate->factory()->Uint32ToString(index);
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/object-observe.js Thu Nov
8 04:58:08 2012
+++ /branches/bleeding_edge/test/mjsunit/harmony/object-observe.js Thu Nov
8 05:15:54 2012
@@ -332,3 +332,35 @@
{ object: obj, name: "1", type: "deleted", oldValue: 10 },
{ object: obj, name: "1", type: "new" },
]);
+
+
+// Assignments in loops (checking different IC states).
+reset();
+var obj = {};
+Object.observe(obj, observer.callback);
+for (var i = 0; i < 5; i++) {
+ obj["a" + i] = i;
+}
+Object.deliverChangeRecords(observer.callback);
+observer.assertCallbackRecords([
+ { object: obj, name: "a0", type: "new" },
+ { object: obj, name: "a1", type: "new" },
+ { object: obj, name: "a2", type: "new" },
+ { object: obj, name: "a3", type: "new" },
+ { object: obj, name: "a4", type: "new" },
+]);
+
+reset();
+var obj = {};
+Object.observe(obj, observer.callback);
+for (var i = 0; i < 5; i++) {
+ obj[i] = i;
+}
+Object.deliverChangeRecords(observer.callback);
+observer.assertCallbackRecords([
+ { object: obj, name: "0", type: "new" },
+ { object: obj, name: "1", type: "new" },
+ { object: obj, name: "2", type: "new" },
+ { object: obj, name: "3", type: "new" },
+ { object: obj, name: "4", type: "new" },
+]);
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev