Commit 8eb70425 authored by rossberg@chromium.org's avatar rossberg@chromium.org

Object.observe: Fixed missing case for turning off ICs.

R=mstarzinger@chromium.org
BUG=

Review URL: https://codereview.chromium.org/11358122

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12901 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent fbc6e0d8
......@@ -1920,8 +1920,10 @@ MaybeObject* KeyedStoreIC::Store(State state,
}
// 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) {
......
......@@ -10292,7 +10292,7 @@ MaybeObject* JSObject::SetElement(uint32_t index,
// 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);
......
......@@ -332,3 +332,35 @@ observer.assertCallbackRecords([
{ 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" },
]);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment