Get rid of all non-IC uses of LookupOwnRealNamedProperty

BUG=
R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/491023002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23262 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2014-08-21 08:26:42 +00:00
parent 49e4aebb98
commit 2d2396a8a8
3 changed files with 17 additions and 35 deletions

View File

@ -20,7 +20,10 @@ JSReceiver* LookupIterator::NextHolder(Map* map) {
next->map()->is_hidden_prototype());
if (!check_derived() &&
!(check_hidden() && next->map()->is_hidden_prototype())) {
!(check_hidden() && next->map()->is_hidden_prototype()) &&
// Always lookup behind the JSGlobalProxy into the JSGlobalObject, even
// when not checking other hidden prototypes.
!(map->IsJSGlobalProxyMap() && next->IsJSGlobalObject())) {
return NULL;
}

View File

@ -12944,11 +12944,11 @@ bool JSArray::WouldChangeReadOnlyLength(Handle<JSArray> array,
uint32_t length = 0;
CHECK(array->length()->ToArrayIndex(&length));
if (length <= index) {
Isolate* isolate = array->GetIsolate();
LookupResult lookup(isolate);
Handle<Name> length_string = isolate->factory()->length_string();
array->LookupOwnRealNamedProperty(length_string, &lookup);
return lookup.IsReadOnly();
LookupIterator it(array, array->GetIsolate()->factory()->length_string(),
LookupIterator::CHECK_PROPERTY);
CHECK(it.IsFound());
CHECK(it.HasProperty());
return it.IsReadOnly();
}
return false;
}
@ -13332,20 +13332,10 @@ MaybeHandle<JSObject> JSObject::GetKeysForIndexedInterceptor(
Maybe<bool> JSObject::HasRealNamedProperty(Handle<JSObject> object,
Handle<Name> key) {
Isolate* isolate = object->GetIsolate();
SealHandleScope shs(isolate);
// Check access rights if needed.
if (object->IsAccessCheckNeeded()) {
if (!isolate->MayNamedAccess(object, key, v8::ACCESS_HAS)) {
isolate->ReportFailedAccessCheck(object, v8::ACCESS_HAS);
RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Maybe<bool>());
return maybe(false);
}
}
LookupResult result(isolate);
object->LookupOwnRealNamedProperty(key, &result);
return maybe(result.IsFound() && !result.IsInterceptor());
LookupIterator it(object, key, LookupIterator::CHECK_ACCESS_CHECK);
Maybe<PropertyAttributes> maybe_result = GetPropertyAttributes(&it);
if (!maybe_result.has_value) return Maybe<bool>();
return maybe(it.IsFound());
}
@ -13380,20 +13370,10 @@ Maybe<bool> JSObject::HasRealElementProperty(Handle<JSObject> object,
Maybe<bool> JSObject::HasRealNamedCallbackProperty(Handle<JSObject> object,
Handle<Name> key) {
Isolate* isolate = object->GetIsolate();
SealHandleScope shs(isolate);
// Check access rights if needed.
if (object->IsAccessCheckNeeded()) {
if (!isolate->MayNamedAccess(object, key, v8::ACCESS_HAS)) {
isolate->ReportFailedAccessCheck(object, v8::ACCESS_HAS);
RETURN_VALUE_IF_SCHEDULED_EXCEPTION(isolate, Maybe<bool>());
return maybe(false);
}
}
LookupResult result(isolate);
object->LookupOwnRealNamedProperty(key, &result);
return maybe(result.IsPropertyCallbacks());
LookupIterator it(object, key, LookupIterator::CHECK_ACCESS_CHECK);
Maybe<PropertyAttributes> maybe_result = GetPropertyAttributes(&it);
if (!maybe_result.has_value) return Maybe<bool>();
return maybe(it.IsFound() && it.property_kind() == LookupIterator::ACCESSOR);
}

View File

@ -21771,7 +21771,6 @@ TEST(AccessCheckThrows) {
// Create a context and set an x property on it's global object.
LocalContext context0(NULL, global_template);
context0->Global()->Set(v8_str("x"), v8_num(42));
v8::Handle<v8::Object> global0 = context0->Global();
// Create a context with a different security token so that the