Reviewers: Michael Starzinger,

Description:
Handle proxies in KeyedStoreIC::Store, instead of just ignoring them.

[email protected]
BUG=v8:1543
TEST=


Please review this at http://codereview.chromium.org/8391005/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/ic.cc
  M test/mjsunit/harmony/proxies.js


Index: src/ic.cc
diff --git a/src/ic.cc b/src/ic.cc
index 55d2d0b42c173cafe3daf7faac40f1bbf7894bc2..fbe77b09d23fa7daccabb0a842ae49221adf9b77 100644
--- a/src/ic.cc
+++ b/src/ic.cc
@@ -1612,6 +1612,12 @@ MaybeObject* KeyedStoreIC::Store(State state,
   if (key->IsSymbol()) {
     Handle<String> name = Handle<String>::cast(key);

+    // Handle proxies.
+    if (object->IsJSProxy()) {
+      return JSProxy::cast(*object)->SetProperty(
+          *name, *value, NONE, strict_mode);
+    }
+
     // If the object is undefined or null it's illegal to try to set any
     // properties on it; throw a TypeError in that case.
     if (object->IsUndefined() || object->IsNull()) {
Index: test/mjsunit/harmony/proxies.js
diff --git a/test/mjsunit/harmony/proxies.js b/test/mjsunit/harmony/proxies.js index 401fa0d9281ce5582988d6cc004654486bd12078..13ce32b7c219e09505055f3d399a1e874aab2a90 100644
--- a/test/mjsunit/harmony/proxies.js
+++ b/test/mjsunit/harmony/proxies.js
@@ -350,6 +350,13 @@ function TestSet2(create, handler) {
   assertEquals(44, p[77] = 44)
   assertEquals("77", key)
   assertEquals(44, val)
+
+  assertEquals(45, (function(n) { return p[n] = 45 })("c"))
+  assertEquals("c", key)
+  assertEquals(45, val)
+  assertEquals(46, (function(n) { return p[n] = 46 })(99))
+  assertEquals("99", key)
+  assertEquals(46, val)
 }

 TestSet({


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to