Revision: 9787
Author: [email protected]
Date: Wed Oct 26 02:31:40 2011
Log: Handle proxies in KeyedStoreIC::Store, instead of just ignoring
them.
[email protected]
BUG=v8:1543
TEST=
Review URL: http://codereview.chromium.org/8391005
http://code.google.com/p/v8/source/detail?r=9787
Modified:
/branches/bleeding_edge/src/ic.cc
/branches/bleeding_edge/test/mjsunit/harmony/proxies.js
=======================================
--- /branches/bleeding_edge/src/ic.cc Fri Oct 21 04:42:54 2011
+++ /branches/bleeding_edge/src/ic.cc Wed Oct 26 02:31:40 2011
@@ -1611,6 +1611,12 @@
bool force_generic) {
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.
=======================================
--- /branches/bleeding_edge/test/mjsunit/harmony/proxies.js Mon Oct 24
09:25:30 2011
+++ /branches/bleeding_edge/test/mjsunit/harmony/proxies.js Wed Oct 26
02:31:40 2011
@@ -135,6 +135,10 @@
assertEquals("b", key)
assertEquals(42, p[99])
assertEquals("99", key)
+ assertEquals(42, (function(n) { return p[n] })("c"))
+ assertEquals("c", key)
+ assertEquals(42, (function(n) { return p[n] })(101))
+ assertEquals("101", key)
var o = Object.create(p, {x: {value: 88}})
assertEquals(42, o.a)
@@ -145,6 +149,11 @@
assertEquals("99", key)
assertEquals(88, o.x)
assertEquals(88, o["x"])
+ assertEquals(42, (function(n) { return o[n] })("c"))
+ assertEquals("c", key)
+ assertEquals(42, (function(n) { return o[n] })(101))
+ assertEquals("101", key)
+ assertEquals(88, (function(n) { return o[n] })("x"))
}
TestGet({
@@ -198,6 +207,10 @@
assertEquals(55, p[101].call(p))
assertEquals(55, p.withargs(45, 5))
assertEquals(55, p.withargs.call(p, 11, 22))
+ assertEquals(55, (function(n) { return p[n]() })("f"))
+ assertEquals(55, (function(n) { return p[n].call(p) })("f"))
+ assertEquals(55, (function(n) { return p[n](15, 20) })("withargs"))
+ assertEquals(55, (function(n) { return p[n].call(p, 13, 21)
})("withargs"))
assertEquals("6655", "66" + p) // calls p.toString
var o = Object.create(p, {g: {value: function(x) { return x + 88 }}})
@@ -213,6 +226,13 @@
assertEquals(90, o.g(2))
assertEquals(91, o.g.call(o, 3))
assertEquals(92, o.g.call(p, 4))
+ assertEquals(55, (function(n) { return o[n]() })("f"))
+ assertEquals(55, (function(n) { return o[n].call(o) })("f"))
+ assertEquals(55, (function(n) { return o[n](15, 20) })("withargs"))
+ assertEquals(55, (function(n) { return o[n].call(o, 13, 21)
})("withargs"))
+ assertEquals(93, (function(n) { return o[n](5) })("g"))
+ assertEquals(94, (function(n) { return o[n].call(o, 6) })("g"))
+ assertEquals(95, (function(n) { return o[n].call(p, 7) })("g"))
assertEquals("6655", "66" + o) // calls o.toString
}
@@ -279,14 +299,15 @@
assertThrows(function(){ p.a }, "myexn")
assertThrows(function(){ p["b"] }, "myexn")
assertThrows(function(){ p[3] }, "myexn")
+ assertThrows(function(){ (function(n) { p[n] })("c") }, "myexn")
+ assertThrows(function(){ (function(n) { p[n] })(99) }, "myexn")
var o = Object.create(p, {x: {value: 88}, '4': {value: 89}})
assertThrows(function(){ o.a }, "myexn")
assertThrows(function(){ o["b"] }, "myexn")
assertThrows(function(){ o[3] }, "myexn")
- assertEquals(88, o.x)
- assertEquals(88, o["x"])
- assertEquals(89, o[4])
+ assertThrows(function(){ (function(n) { o[n] })("c") }, "myexn")
+ assertThrows(function(){ (function(n) { o[n] })(99) }, "myexn")
}
TestGetThrow({
@@ -350,6 +371,13 @@
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({
@@ -431,6 +459,8 @@
assertThrows(function(){ p.a = 42 }, "myexn")
assertThrows(function(){ p["b"] = 42 }, "myexn")
assertThrows(function(){ p[22] = 42 }, "myexn")
+ assertThrows(function(){ (function(n) { p[n] = 45 })("c") }, "myexn")
+ assertThrows(function(){ (function(n) { p[n] = 46 })(99) }, "myexn")
}
TestSetThrow({
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev