Reviewers: Michael Starzinger,
Description:
Remove one more case behind --es5_readonly flag.
Plus add a couple of assertions.
[email protected]
BUG=
TEST=
Please review this at https://chromiumcodereview.appspot.com/10535011/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/hydrogen.cc
M src/objects.cc
M test/cctest/test-api.cc
M test/mjsunit/with-readonly.js
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
082b4ea7f17b8fd0c7a0f7c365e2af4705c5d924..e2fbfb59c4b6fbf3462ba1343b7e8fcb1354997e
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -4684,6 +4684,7 @@ HInstruction*
HGraphBuilder::BuildStoreNamedField(HValue* object,
} else {
// Otherwise, find the top prototype.
while (proto->GetPrototype()->IsJSObject()) proto =
proto->GetPrototype();
+ ASSERT(proto->GetPrototype()->IsNull());
}
ASSERT(proto->IsJSObject());
AddInstruction(new(zone()) HCheckPrototypeMaps(
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
85a40f6be6f0a996fe9ba90cca0eda3ad96e6087..d5127f8a29f2d3ea757cdc273ca15951ea2ee2fb
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -2117,6 +2117,7 @@ MaybeObject* JSObject::SetPropertyViaPrototypes(
break;
}
case CALLBACKS: {
+ if (!FLAG_es5_readonly && result.IsReadOnly()) break;
*done = true;
return SetPropertyWithCallback(result.GetCallbackObject(),
name, value, result.holder(), strict_mode);
@@ -2550,7 +2551,10 @@ void
JSObject::LookupRealNamedPropertyInPrototypes(String* name,
return result->HandlerResult(JSProxy::cast(pt));
}
JSObject::cast(pt)->LocalLookupRealNamedProperty(name, result);
- if (result->IsProperty()) return;
+ if (result->IsProperty()) {
+ ASSERT(result->type() != INTERCEPTOR);
+ return;
+ }
}
result->NotFound();
}
Index: test/cctest/test-api.cc
diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc
index
218e8300b3d9f5b486f412257945399cd50aa939..b926a57791d4d259ecbe07bfa55251f325f34d1d
100644
--- a/test/cctest/test-api.cc
+++ b/test/cctest/test-api.cc
@@ -10260,6 +10260,7 @@ static v8::Handle<Value> ChildGetter(Local<String>
name,
THREADED_TEST(Overriding) {
+ i::FLAG_es5_readonly = true;
v8::HandleScope scope;
LocalContext context;
Index: test/mjsunit/with-readonly.js
diff --git a/test/mjsunit/with-readonly.js b/test/mjsunit/with-readonly.js
index
43583348e95e9a59c617bad912b1413774ff33b4..29982b34746dd0136808154c5d5ad58960cb5212
100644
--- a/test/mjsunit/with-readonly.js
+++ b/test/mjsunit/with-readonly.js
@@ -27,6 +27,8 @@
// Test that readonly variables are treated correctly.
+// Flags: --es5_readonly
+
// Create an object with a read-only length property in the prototype
// chain by putting the string split function in the prototype chain.
var o = {};
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev