From: rossberg@chromium.org Date: Tue, 5 Jun 2012 16:56:53 +0000 (+0000) Subject: Remove one more case behind --es5_readonly flag. X-Git-Tag: upstream/4.7.83~16606 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4ea1fc0d273661042614c6a32e3bc22f5ae2a7ec;p=platform%2Fupstream%2Fv8.git Remove one more case behind --es5_readonly flag. Plus add a couple of assertions. R=mstarzinger@chromium.org BUG= TEST= Review URL: https://chromiumcodereview.appspot.com/10535011 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11719 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 082b4ea..e2fbfb5 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( diff --git a/src/objects.cc b/src/objects.cc index 85a40f6..e5f0e49 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,6 +2551,7 @@ void JSObject::LookupRealNamedPropertyInPrototypes(String* name, return result->HandlerResult(JSProxy::cast(pt)); } JSObject::cast(pt)->LocalLookupRealNamedProperty(name, result); + ASSERT(!(result->IsProperty() && result->type() == INTERCEPTOR)); if (result->IsProperty()) return; } result->NotFound(); diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 218e830..b926a57 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -10260,6 +10260,7 @@ static v8::Handle ChildGetter(Local name, THREADED_TEST(Overriding) { + i::FLAG_es5_readonly = true; v8::HandleScope scope; LocalContext context; diff --git a/test/mjsunit/with-readonly.js b/test/mjsunit/with-readonly.js index 4358334..29982b3 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 = {};