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

Unified Diff: src/ic.cc

Issue 299403008: Fix storing to primitive objects by applying ToObject. This is necessary to ensure that we properly… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Adding test Created 6 years, 7 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 | « no previous file | test/mjsunit/assign-primitive-property.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index 0f1c3b416e97dd7264c0b24d85b396420086f403..d8e274272fc7d60cc48b251ab70e252800834df1 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -1275,8 +1275,23 @@ MaybeHandle<Object> StoreIC::Store(Handle<Object> object,
}
// Ignore other stores where the receiver is not a JSObject.
- // TODO(1475): Must check prototype chains of object wrappers.
- if (!object->IsJSObject()) return value;
+ if (!object->IsJSObject()) {
+ // Proxies are already handled above.
+ ASSERT(!object->IsJSReceiver());
+ Handle<JSReceiver> receiver;
+ Handle<Context> native_context(isolate()->context()->native_context());
+ if (Object::ToObject(
+ isolate(), object, native_context).ToHandle(&receiver)) {
+ Handle<Object> result;
+ ASSIGN_RETURN_ON_EXCEPTION(
+ isolate(),
+ result,
+ JSReceiver::SetProperty(
+ receiver, name, value, NONE, strict_mode(), store_mode),
+ Object);
+ }
+ return value;
+ }
Handle<JSObject> receiver = Handle<JSObject>::cast(object);
« no previous file with comments | « no previous file | test/mjsunit/assign-primitive-property.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698