Revision: 19891
Author: [email protected]
Date: Thu Mar 13 11:55:31 2014 UTC
Log: Handlify PropertyAttribute lookups.
[email protected]
Review URL: https://codereview.chromium.org/197813004
http://code.google.com/p/v8/source/detail?r=19891
Modified:
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/contexts.cc
/branches/bleeding_edge/src/objects-inl.h
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/src/runtime.cc
=======================================
--- /branches/bleeding_edge/src/api.cc Thu Mar 13 09:14:16 2014 UTC
+++ /branches/bleeding_edge/src/api.cc Thu Mar 13 11:55:31 2014 UTC
@@ -3120,7 +3120,8 @@
EXCEPTION_BAILOUT_CHECK(isolate, static_cast<PropertyAttribute>(NONE));
}
i::Handle<i::Name> key_name = i::Handle<i::Name>::cast(key_obj);
- PropertyAttributes result = self->GetPropertyAttribute(*key_name);
+ PropertyAttributes result =
+ i::JSReceiver::GetPropertyAttribute(self, key_name);
if (result == ABSENT) return static_cast<PropertyAttribute>(NONE);
return static_cast<PropertyAttribute>(result);
}
=======================================
--- /branches/bleeding_edge/src/contexts.cc Tue Mar 11 14:41:22 2014 UTC
+++ /branches/bleeding_edge/src/contexts.cc Thu Mar 13 11:55:31 2014 UTC
@@ -131,9 +131,9 @@
// to only do a local lookup for context extension objects.
if ((flags & FOLLOW_PROTOTYPE_CHAIN) == 0 ||
object->IsJSContextExtensionObject()) {
- *attributes = object->GetLocalPropertyAttribute(*name);
+ *attributes = JSReceiver::GetLocalPropertyAttribute(object, name);
} else {
- *attributes = object->GetPropertyAttribute(*name);
+ *attributes = JSReceiver::GetPropertyAttribute(object, name);
}
if (isolate->has_pending_exception()) return Handle<Object>();
=======================================
--- /branches/bleeding_edge/src/objects-inl.h Tue Mar 11 20:52:00 2014 UTC
+++ /branches/bleeding_edge/src/objects-inl.h Thu Mar 13 11:55:31 2014 UTC
@@ -6177,7 +6177,7 @@
Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
return JSProxy::HasPropertyWithHandler(proxy, name);
}
- return object->GetPropertyAttribute(*name) != ABSENT;
+ return GetPropertyAttribute(object, name) != ABSENT;
}
@@ -6187,25 +6187,28 @@
Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
return JSProxy::HasPropertyWithHandler(proxy, name);
}
- return object->GetLocalPropertyAttribute(*name) != ABSENT;
+ return GetLocalPropertyAttribute(object, name) != ABSENT;
}
-PropertyAttributes JSReceiver::GetPropertyAttribute(Name* key) {
+PropertyAttributes JSReceiver::GetPropertyAttribute(Handle<JSReceiver>
object,
+ Handle<Name> key) {
uint32_t index;
- if (IsJSObject() && key->AsArrayIndex(&index)) {
- return GetElementAttribute(index);
+ if (object->IsJSObject() && key->AsArrayIndex(&index)) {
+ return GetElementAttribute(object, index);
}
- return GetPropertyAttributeWithReceiver(this, key);
+ return GetPropertyAttributeWithReceiver(object, object, key);
}
-PropertyAttributes JSReceiver::GetElementAttribute(uint32_t index) {
- if (IsJSProxy()) {
- return JSProxy::cast(this)->GetElementAttributeWithHandler(this,
index);
+PropertyAttributes JSReceiver::GetElementAttribute(Handle<JSReceiver>
object,
+ uint32_t index) {
+ if (object->IsJSProxy()) {
+ return JSProxy::GetElementAttributeWithHandler(
+ Handle<JSProxy>::cast(object), object, index);
}
- return JSObject::cast(this)->GetElementAttributeWithReceiver(
- this, index, true);
+ return JSObject::GetElementAttributeWithReceiver(
+ Handle<JSObject>::cast(object), object, index, true);
}
@@ -6238,8 +6241,8 @@
Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
return JSProxy::HasElementWithHandler(proxy, index);
}
- return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver(
- *object, index, true) != ABSENT;
+ return JSObject::GetElementAttributeWithReceiver(
+ Handle<JSObject>::cast(object), object, index, true) != ABSENT;
}
@@ -6248,17 +6251,19 @@
Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
return JSProxy::HasElementWithHandler(proxy, index);
}
- return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver(
- *object, index, false) != ABSENT;
+ return JSObject::GetElementAttributeWithReceiver(
+ Handle<JSObject>::cast(object), object, index, false) != ABSENT;
}
-PropertyAttributes JSReceiver::GetLocalElementAttribute(uint32_t index) {
- if (IsJSProxy()) {
- return JSProxy::cast(this)->GetElementAttributeWithHandler(this,
index);
+PropertyAttributes JSReceiver::GetLocalElementAttribute(
+ Handle<JSReceiver> object, uint32_t index) {
+ if (object->IsJSProxy()) {
+ return JSProxy::GetElementAttributeWithHandler(
+ Handle<JSProxy>::cast(object), object, index);
}
- return JSObject::cast(this)->GetElementAttributeWithReceiver(
- this, index, false);
+ return JSObject::GetElementAttributeWithReceiver(
+ Handle<JSObject>::cast(object), object, index, false);
}
=======================================
--- /branches/bleeding_edge/src/objects.cc Thu Mar 13 00:20:06 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc Thu Mar 13 11:55:31 2014 UTC
@@ -622,22 +622,22 @@
PropertyAttributes JSObject::GetPropertyAttributeWithFailedAccessCheck(
- Object* receiver,
+ Handle<JSObject> object,
LookupResult* result,
- Name* name,
+ Handle<Name> name,
bool continue_search) {
if (result->IsProperty()) {
switch (result->type()) {
case CALLBACKS: {
// Only allow API accessors.
- Object* obj = result->GetCallbackObject();
+ Handle<Object> obj(result->GetCallbackObject(),
object->GetIsolate());
if (obj->IsAccessorInfo()) {
- AccessorInfo* info = AccessorInfo::cast(obj);
+ Handle<AccessorInfo> info = Handle<AccessorInfo>::cast(obj);
if (info->all_can_read()) {
return result->GetAttributes();
}
} else if (obj->IsAccessorPair()) {
- AccessorPair* pair = AccessorPair::cast(obj);
+ Handle<AccessorPair> pair = Handle<AccessorPair>::cast(obj);
if (pair->all_can_read()) {
return result->GetAttributes();
}
@@ -650,13 +650,11 @@
case CONSTANT: {
if (!continue_search) break;
// Search ALL_CAN_READ accessors in prototype chain.
- LookupResult r(GetIsolate());
- result->holder()->LookupRealNamedPropertyInPrototypes(name, &r);
+ LookupResult r(object->GetIsolate());
+ result->holder()->LookupRealNamedPropertyInPrototypes(*name, &r);
if (r.IsProperty()) {
- return GetPropertyAttributeWithFailedAccessCheck(receiver,
- &r,
- name,
-
continue_search);
+ return GetPropertyAttributeWithFailedAccessCheck(
+ object, &r, name, continue_search);
}
break;
}
@@ -664,17 +662,15 @@
case INTERCEPTOR: {
// If the object has an interceptor, try real named properties.
// No access check in GetPropertyAttributeWithInterceptor.
- LookupResult r(GetIsolate());
+ LookupResult r(object->GetIsolate());
if (continue_search) {
- result->holder()->LookupRealNamedProperty(name, &r);
+ result->holder()->LookupRealNamedProperty(*name, &r);
} else {
- result->holder()->LocalLookupRealNamedProperty(name, &r);
+ result->holder()->LocalLookupRealNamedProperty(*name, &r);
}
if (!r.IsFound()) break;
- return GetPropertyAttributeWithFailedAccessCheck(receiver,
- &r,
- name,
- continue_search);
+ return GetPropertyAttributeWithFailedAccessCheck(
+ object, &r, name, continue_search);
}
case HANDLER:
@@ -684,7 +680,7 @@
}
}
- GetIsolate()->ReportFailedAccessCheck(this, v8::ACCESS_HAS);
+ object->GetIsolate()->ReportFailedAccessCheckWrapper(object,
v8::ACCESS_HAS);
return ABSENT;
}
@@ -3062,9 +3058,8 @@
*done = result.IsReadOnly();
break;
case INTERCEPTOR: {
- PropertyAttributes attr =
- result.holder()->GetPropertyAttributeWithInterceptor(
- *object, *name, true);
+ PropertyAttributes attr = GetPropertyAttributeWithInterceptor(
+ handle(result.holder()), object, name, true);
*done = !!(attr & READ_ONLY);
break;
}
@@ -3707,21 +3702,18 @@
}
-MUST_USE_RESULT PropertyAttributes
JSProxy::GetPropertyAttributeWithHandler(
- JSReceiver* receiver_raw,
- Name* name_raw) {
- Isolate* isolate = GetIsolate();
+PropertyAttributes JSProxy::GetPropertyAttributeWithHandler(
+ Handle<JSProxy> proxy,
+ Handle<JSReceiver> receiver,
+ Handle<Name> name) {
+ Isolate* isolate = proxy->GetIsolate();
HandleScope scope(isolate);
- Handle<JSProxy> proxy(this);
- Handle<Object> handler(this->handler(), isolate); // Trap might morph
proxy.
- Handle<JSReceiver> receiver(receiver_raw);
- Handle<Object> name(name_raw, isolate);
// TODO(rossberg): adjust once there is a story for symbols vs proxies.
if (name->IsSymbol()) return ABSENT;
Handle<Object> args[] = { name };
- Handle<Object> result = CallTrap(
+ Handle<Object> result = proxy->CallTrap(
"getPropertyDescriptor", Handle<Object>(), ARRAY_SIZE(args), args);
if (isolate->has_pending_exception()) return NONE;
@@ -3756,6 +3748,7 @@
}
if (configurable->IsFalse()) {
+ Handle<Object> handler(proxy->handler(), isolate);
Handle<String> trap = isolate->factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("getPropertyDescriptor"));
Handle<Object> args[] = { handler, trap, name };
@@ -3773,15 +3766,13 @@
}
-MUST_USE_RESULT PropertyAttributes JSProxy::GetElementAttributeWithHandler(
- JSReceiver* receiver_raw,
+PropertyAttributes JSProxy::GetElementAttributeWithHandler(
+ Handle<JSProxy> proxy,
+ Handle<JSReceiver> receiver,
uint32_t index) {
- Isolate* isolate = GetIsolate();
- HandleScope scope(isolate);
- Handle<JSProxy> proxy(this);
- Handle<JSReceiver> receiver(receiver_raw);
+ Isolate* isolate = proxy->GetIsolate();
Handle<String> name = isolate->factory()->Uint32ToString(index);
- return proxy->GetPropertyAttributeWithHandler(*receiver, *name);
+ return GetPropertyAttributeWithHandler(proxy, receiver, name);
}
@@ -4266,20 +4257,22 @@
PropertyAttributes JSObject::GetPropertyAttributePostInterceptor(
- JSObject* receiver,
- Name* name,
- bool continue_search) {
+ Handle<JSObject> object,
+ Handle<JSObject> receiver,
+ Handle<Name> name,
+ bool continue_search) {
// Check local property, ignore interceptor.
- LookupResult result(GetIsolate());
- LocalLookupRealNamedProperty(name, &result);
+ Isolate* isolate = object->GetIsolate();
+ LookupResult result(isolate);
+ object->LocalLookupRealNamedProperty(*name, &result);
if (result.IsFound()) return result.GetAttributes();
if (continue_search) {
// Continue searching via the prototype chain.
- Object* pt = GetPrototype();
- if (!pt->IsNull()) {
- return JSObject::cast(pt)->
- GetPropertyAttributeWithReceiver(receiver, name);
+ Handle<Object> proto(object->GetPrototype(), isolate);
+ if (!proto->IsNull()) {
+ return JSReceiver::GetPropertyAttributeWithReceiver(
+ Handle<JSObject>::cast(proto), receiver, name);
}
}
return ABSENT;
@@ -4287,31 +4280,30 @@
PropertyAttributes JSObject::GetPropertyAttributeWithInterceptor(
- JSObject* receiver,
- Name* name,
- bool continue_search) {
+ Handle<JSObject> object,
+ Handle<JSObject> receiver,
+ Handle<Name> name,
+ bool continue_search) {
// TODO(rossberg): Support symbols in the API.
if (name->IsSymbol()) return ABSENT;
- Isolate* isolate = GetIsolate();
+ Isolate* isolate = object->GetIsolate();
HandleScope scope(isolate);
// Make sure that the top context does not change when doing
// callbacks or interceptor calls.
AssertNoContextChange ncc(isolate);
- Handle<InterceptorInfo> interceptor(GetNamedInterceptor());
- Handle<JSObject> receiver_handle(receiver);
- Handle<JSObject> holder_handle(this);
- Handle<String> name_handle(String::cast(name));
- PropertyCallbackArguments args(isolate, interceptor->data(), receiver,
this);
+ Handle<InterceptorInfo> interceptor(object->GetNamedInterceptor());
+ PropertyCallbackArguments args(
+ isolate, interceptor->data(), *receiver, *object);
if (!interceptor->query()->IsUndefined()) {
v8::NamedPropertyQueryCallback query =
v8::ToCData<v8::NamedPropertyQueryCallback>(interceptor->query());
LOG(isolate,
- ApiNamedPropertyAccess("interceptor-named-has", *holder_handle,
name));
+ ApiNamedPropertyAccess("interceptor-named-has", *object, *name));
v8::Handle<v8::Integer> result =
- args.Call(query, v8::Utils::ToLocal(name_handle));
+ args.Call(query, v8::Utils::ToLocal(Handle<String>::cast(name)));
if (!result.IsEmpty()) {
ASSERT(result->IsInt32());
return static_cast<PropertyAttributes>(result->Int32Value());
@@ -4320,44 +4312,45 @@
v8::NamedPropertyGetterCallback getter =
v8::ToCData<v8::NamedPropertyGetterCallback>(interceptor->getter());
LOG(isolate,
- ApiNamedPropertyAccess("interceptor-named-get-has", this, name));
+ ApiNamedPropertyAccess("interceptor-named-get-has", *object,
*name));
v8::Handle<v8::Value> result =
- args.Call(getter, v8::Utils::ToLocal(name_handle));
+ args.Call(getter, v8::Utils::ToLocal(Handle<String>::cast(name)));
if (!result.IsEmpty()) return DONT_ENUM;
}
- return
holder_handle->GetPropertyAttributePostInterceptor(*receiver_handle,
- *name_handle,
-
continue_search);
+ return GetPropertyAttributePostInterceptor(
+ object, receiver, name, continue_search);
}
PropertyAttributes JSReceiver::GetPropertyAttributeWithReceiver(
- JSReceiver* receiver,
- Name* key) {
+ Handle<JSReceiver> object,
+ Handle<JSReceiver> receiver,
+ Handle<Name> key) {
uint32_t index = 0;
- if (IsJSObject() && key->AsArrayIndex(&index)) {
- return JSObject::cast(this)->GetElementAttributeWithReceiver(
- receiver, index, true);
+ if (object->IsJSObject() && key->AsArrayIndex(&index)) {
+ return JSObject::GetElementAttributeWithReceiver(
+ Handle<JSObject>::cast(object), receiver, index, true);
}
// Named property.
- LookupResult lookup(GetIsolate());
- Lookup(key, &lookup);
- return GetPropertyAttributeForResult(receiver, &lookup, key, true);
+ LookupResult lookup(object->GetIsolate());
+ object->Lookup(*key, &lookup);
+ return GetPropertyAttributeForResult(object, receiver, &lookup, key,
true);
}
PropertyAttributes JSReceiver::GetPropertyAttributeForResult(
- JSReceiver* receiver,
+ Handle<JSReceiver> object,
+ Handle<JSReceiver> receiver,
LookupResult* lookup,
- Name* name,
+ Handle<Name> name,
bool continue_search) {
// Check access rights if needed.
- if (IsAccessCheckNeeded()) {
- JSObject* this_obj = JSObject::cast(this);
- Heap* heap = GetHeap();
- if (!heap->isolate()->MayNamedAccess(this_obj, name, v8::ACCESS_HAS)) {
- return this_obj->GetPropertyAttributeWithFailedAccessCheck(
- receiver, lookup, name, continue_search);
+ if (object->IsAccessCheckNeeded()) {
+ Heap* heap = object->GetHeap();
+ Handle<JSObject> obj = Handle<JSObject>::cast(object);
+ if (!heap->isolate()->MayNamedAccessWrapper(obj, name,
v8::ACCESS_HAS)) {
+ return JSObject::GetPropertyAttributeWithFailedAccessCheck(
+ obj, lookup, name, continue_search);
}
}
if (lookup->IsFound()) {
@@ -4368,12 +4361,15 @@
case CALLBACKS:
return lookup->GetAttributes();
case HANDLER: {
- return
JSProxy::cast(lookup->proxy())->GetPropertyAttributeWithHandler(
- receiver, name);
+ return JSProxy::GetPropertyAttributeWithHandler(
+ handle(lookup->proxy()), receiver, name);
}
case INTERCEPTOR:
- return lookup->holder()->GetPropertyAttributeWithInterceptor(
- JSObject::cast(receiver), name, continue_search);
+ return JSObject::GetPropertyAttributeWithInterceptor(
+ handle(lookup->holder()),
+ Handle<JSObject>::cast(receiver),
+ name,
+ continue_search);
case TRANSITION:
case NONEXISTENT:
UNREACHABLE();
@@ -4383,67 +4379,74 @@
}
-PropertyAttributes JSReceiver::GetLocalPropertyAttribute(Name* name) {
+PropertyAttributes JSReceiver::GetLocalPropertyAttribute(
+ Handle<JSReceiver> object, Handle<Name> name) {
// Check whether the name is an array index.
uint32_t index = 0;
- if (IsJSObject() && name->AsArrayIndex(&index)) {
- return GetLocalElementAttribute(index);
+ if (object->IsJSObject() && name->AsArrayIndex(&index)) {
+ return GetLocalElementAttribute(object, index);
}
// Named property.
- LookupResult lookup(GetIsolate());
- LocalLookup(name, &lookup, true);
- return GetPropertyAttributeForResult(this, &lookup, name, false);
+ LookupResult lookup(object->GetIsolate());
+ object->LocalLookup(*name, &lookup, true);
+ return GetPropertyAttributeForResult(object, object, &lookup, name,
false);
}
PropertyAttributes JSObject::GetElementAttributeWithReceiver(
- JSReceiver* receiver, uint32_t index, bool continue_search) {
- Isolate* isolate = GetIsolate();
+ Handle<JSObject> object,
+ Handle<JSReceiver> receiver,
+ uint32_t index,
+ bool continue_search) {
+ Isolate* isolate = object->GetIsolate();
// Check access rights if needed.
- if (IsAccessCheckNeeded()) {
- if (!isolate->MayIndexedAccess(this, index, v8::ACCESS_HAS)) {
- isolate->ReportFailedAccessCheck(this, v8::ACCESS_HAS);
+ if (object->IsAccessCheckNeeded()) {
+ if (!isolate->MayIndexedAccessWrapper(object, index, v8::ACCESS_HAS)) {
+ isolate->ReportFailedAccessCheckWrapper(object, v8::ACCESS_HAS);
return ABSENT;
}
}
- if (IsJSGlobalProxy()) {
- Object* proto = GetPrototype();
+ if (object->IsJSGlobalProxy()) {
+ Handle<Object> proto(object->GetPrototype(), isolate);
if (proto->IsNull()) return ABSENT;
ASSERT(proto->IsJSGlobalObject());
- return JSObject::cast(proto)->GetElementAttributeWithReceiver(
- receiver, index, continue_search);
+ return JSObject::GetElementAttributeWithReceiver(
+ Handle<JSObject>::cast(proto), receiver, index, continue_search);
}
// Check for lookup interceptor except when bootstrapping.
- if (HasIndexedInterceptor() && !isolate->bootstrapper()->IsActive()) {
- return GetElementAttributeWithInterceptor(receiver, index,
continue_search);
+ if (object->HasIndexedInterceptor()
&& !isolate->bootstrapper()->IsActive()) {
+ return JSObject::GetElementAttributeWithInterceptor(
+ object, receiver, index, continue_search);
}
return GetElementAttributeWithoutInterceptor(
- receiver, index, continue_search);
+ object, receiver, index, continue_search);
}
PropertyAttributes JSObject::GetElementAttributeWithInterceptor(
- JSReceiver* receiver, uint32_t index, bool continue_search) {
- Isolate* isolate = GetIsolate();
+ Handle<JSObject> object,
+ Handle<JSReceiver> receiver,
+ uint32_t index,
+ bool continue_search) {
+ Isolate* isolate = object->GetIsolate();
HandleScope scope(isolate);
// Make sure that the top context does not change when doing
// callbacks or interceptor calls.
AssertNoContextChange ncc(isolate);
- Handle<InterceptorInfo> interceptor(GetIndexedInterceptor());
- Handle<JSReceiver> hreceiver(receiver);
- Handle<JSObject> holder(this);
- PropertyCallbackArguments args(isolate, interceptor->data(), receiver,
this);
+ Handle<InterceptorInfo> interceptor(object->GetIndexedInterceptor());
+ PropertyCallbackArguments args(
+ isolate, interceptor->data(), *receiver, *object);
if (!interceptor->query()->IsUndefined()) {
v8::IndexedPropertyQueryCallback query =
v8::ToCData<v8::IndexedPropertyQueryCallback>(interceptor->query());
LOG(isolate,
- ApiIndexedPropertyAccess("interceptor-indexed-has", this, index));
+ ApiIndexedPropertyAccess("interceptor-indexed-has", *object,
index));
v8::Handle<v8::Integer> result = args.Call(query, index);
if (!result.IsEmpty())
return static_cast<PropertyAttributes>(result->Int32Value());
@@ -4451,37 +4454,42 @@
v8::IndexedPropertyGetterCallback getter =
v8::ToCData<v8::IndexedPropertyGetterCallback>(interceptor->getter());
LOG(isolate,
- ApiIndexedPropertyAccess("interceptor-indexed-get-has", this,
index));
+ ApiIndexedPropertyAccess(
+ "interceptor-indexed-get-has", *object, index));
v8::Handle<v8::Value> result = args.Call(getter, index);
if (!result.IsEmpty()) return NONE;
}
- return holder->GetElementAttributeWithoutInterceptor(
- *hreceiver, index, continue_search);
+ return GetElementAttributeWithoutInterceptor(
+ object, receiver, index, continue_search);
}
PropertyAttributes JSObject::GetElementAttributeWithoutInterceptor(
- JSReceiver* receiver, uint32_t index, bool continue_search) {
- PropertyAttributes attr = GetElementsAccessor()->GetAttributes(
- receiver, this, index);
+ Handle<JSObject> object,
+ Handle<JSReceiver> receiver,
+ uint32_t index,
+ bool continue_search) {
+ PropertyAttributes attr = object->GetElementsAccessor()->GetAttributes(
+ *receiver, *object, index);
if (attr != ABSENT) return attr;
// Handle [] on String objects.
- if (IsStringObjectWithCharacterAt(index)) {
+ if (object->IsStringObjectWithCharacterAt(index)) {
return static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
}
if (!continue_search) return ABSENT;
- Object* pt = GetPrototype();
- if (pt->IsJSProxy()) {
+ Handle<Object> proto(object->GetPrototype(), object->GetIsolate());
+ if (proto->IsJSProxy()) {
// We need to follow the spec and simulate a call to
[[GetOwnProperty]].
- return JSProxy::cast(pt)->GetElementAttributeWithHandler(receiver,
index);
+ return JSProxy::GetElementAttributeWithHandler(
+ Handle<JSProxy>::cast(proto), receiver, index);
}
- if (pt->IsNull()) return ABSENT;
- return JSObject::cast(pt)->GetElementAttributeWithReceiver(
- receiver, index, true);
+ if (proto->IsNull()) return ABSENT;
+ return GetElementAttributeWithReceiver(
+ Handle<JSObject>::cast(proto), receiver, index, true);
}
@@ -4940,10 +4948,10 @@
}
-bool JSObject::HasHiddenProperties() {
- return GetPropertyAttributePostInterceptor(this,
- GetHeap()->hidden_string(),
- false) != ABSENT;
+bool JSObject::HasHiddenProperties(Handle<JSObject> object) {
+ Handle<Name> hidden = object->GetIsolate()->factory()->hidden_string();
+ return GetPropertyAttributePostInterceptor(
+ object, object, hidden, false) != ABSENT;
}
@@ -5024,7 +5032,7 @@
// We can store the identity hash inline iff there is no backing store
// for hidden properties yet.
- ASSERT(object->HasHiddenProperties() != value->IsSmi());
+ ASSERT(JSObject::HasHiddenProperties(object) != value->IsSmi());
if (object->HasFastProperties()) {
// If the object has fast properties, check whether the first slot
// in the descriptor array matches the hidden string. Since the
@@ -5774,7 +5782,7 @@
ASSERT(names->get(i)->IsString());
Handle<String> key_string(String::cast(names->get(i)));
PropertyAttributes attributes =
- copy->GetLocalPropertyAttribute(*key_string);
+ JSReceiver::GetLocalPropertyAttribute(copy, key_string);
// Only deep copy fields from the object literal expression.
// In particular, don't try to copy the length attribute of
// an array.
@@ -11347,7 +11355,8 @@
uint32_t index,
List<Handle<Object> >* old_values,
List<uint32_t>* indices) {
- PropertyAttributes attributes = object->GetLocalElementAttribute(index);
+ PropertyAttributes attributes =
+ JSReceiver::GetLocalElementAttribute(object, index);
ASSERT(attributes != ABSENT);
if (attributes == DONT_DELETE) return false;
old_values->Add(object->GetLocalElementAccessorPair(index) == NULL
@@ -12550,7 +12559,8 @@
set_mode);
}
- PropertyAttributes old_attributes =
object->GetLocalElementAttribute(index);
+ PropertyAttributes old_attributes =
+ JSReceiver::GetLocalElementAttribute(object, index);
Handle<Object> old_value = isolate->factory()->the_hole_value();
Handle<Object> old_length_handle;
Handle<Object> new_length_handle;
@@ -12576,7 +12586,7 @@
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, Handle<Object>());
Handle<String> name = isolate->factory()->Uint32ToString(index);
- PropertyAttributes new_attributes =
object->GetLocalElementAttribute(index);
+ PropertyAttributes new_attributes = GetLocalElementAttribute(object,
index);
if (old_attributes == ABSENT) {
if (object->IsJSArray() &&
!old_length_handle->SameValue(
@@ -13349,7 +13359,7 @@
bool JSObject::HasRealElementProperty(Handle<JSObject> object, uint32_t
index) {
Isolate* isolate = object->GetIsolate();
- SealHandleScope shs(isolate);
+ HandleScope scope(isolate);
// Check access rights if needed.
if (object->IsAccessCheckNeeded()) {
if (!isolate->MayIndexedAccessWrapper(object, index, v8::ACCESS_HAS)) {
@@ -13366,8 +13376,8 @@
return HasRealElementProperty(Handle<JSObject>::cast(proto), index);
}
- return object->GetElementAttributeWithoutInterceptor(
- *object, index, false) != ABSENT;
+ return GetElementAttributeWithoutInterceptor(
+ object, object, index, false) != ABSENT;
}
=======================================
--- /branches/bleeding_edge/src/objects.h Wed Mar 12 13:29:42 2014 UTC
+++ /branches/bleeding_edge/src/objects.h Thu Mar 13 11:55:31 2014 UTC
@@ -2076,13 +2076,23 @@
// function that was used to instantiate the object).
String* constructor_name();
- inline PropertyAttributes GetPropertyAttribute(Name* name);
- PropertyAttributes GetPropertyAttributeWithReceiver(JSReceiver* receiver,
- Name* name);
- PropertyAttributes GetLocalPropertyAttribute(Name* name);
+ static inline PropertyAttributes GetPropertyAttribute(
+ Handle<JSReceiver> object,
+ Handle<Name> name);
+ static PropertyAttributes GetPropertyAttributeWithReceiver(
+ Handle<JSReceiver> object,
+ Handle<JSReceiver> receiver,
+ Handle<Name> name);
+ static PropertyAttributes GetLocalPropertyAttribute(
+ Handle<JSReceiver> object,
+ Handle<Name> name);
- inline PropertyAttributes GetElementAttribute(uint32_t index);
- inline PropertyAttributes GetLocalElementAttribute(uint32_t index);
+ static inline PropertyAttributes GetElementAttribute(
+ Handle<JSReceiver> object,
+ uint32_t index);
+ static inline PropertyAttributes GetLocalElementAttribute(
+ Handle<JSReceiver> object,
+ uint32_t index);
// Return the object's prototype (might be Heap::null_value()).
inline Object* GetPrototype();
@@ -2113,10 +2123,12 @@
Handle<Object> value);
private:
- PropertyAttributes GetPropertyAttributeForResult(JSReceiver* receiver,
- LookupResult* result,
- Name* name,
- bool continue_search);
+ static PropertyAttributes GetPropertyAttributeForResult(
+ Handle<JSReceiver> object,
+ Handle<JSReceiver> receiver,
+ LookupResult* result,
+ Handle<Name> name,
+ bool continue_search);
static Handle<Object> SetProperty(Handle<JSReceiver> receiver,
LookupResult* result,
@@ -2307,20 +2319,26 @@
InterceptorInfo* GetIndexedInterceptor();
// Used from JSReceiver.
- PropertyAttributes GetPropertyAttributePostInterceptor(JSObject*
receiver,
- Name* name,
- bool
continue_search);
- PropertyAttributes GetPropertyAttributeWithInterceptor(JSObject*
receiver,
- Name* name,
- bool
continue_search);
- PropertyAttributes GetPropertyAttributeWithFailedAccessCheck(
- Object* receiver,
+ static PropertyAttributes GetPropertyAttributePostInterceptor(
+ Handle<JSObject> object,
+ Handle<JSObject> receiver,
+ Handle<Name> name,
+ bool continue_search);
+ static PropertyAttributes GetPropertyAttributeWithInterceptor(
+ Handle<JSObject> object,
+ Handle<JSObject> receiver,
+ Handle<Name> name,
+ bool continue_search);
+ static PropertyAttributes GetPropertyAttributeWithFailedAccessCheck(
+ Handle<JSObject> object,
LookupResult* result,
- Name* name,
+ Handle<Name> name,
bool continue_search);
- PropertyAttributes GetElementAttributeWithReceiver(JSReceiver* receiver,
- uint32_t index,
- bool continue_search);
+ static PropertyAttributes GetElementAttributeWithReceiver(
+ Handle<JSObject> object,
+ Handle<JSReceiver> receiver,
+ uint32_t index,
+ bool continue_search);
// Retrieves an AccessorPair property from the given object. Might return
// undefined if the property doesn't exist or is of a different kind.
@@ -2384,7 +2402,7 @@
static void DeleteHiddenProperty(Handle<JSObject> object,
Handle<Name> key);
// Returns true if the object has a property with the hidden string as
name.
- bool HasHiddenProperties();
+ static bool HasHiddenProperties(Handle<JSObject> object);
static void SetIdentityHash(Handle<JSObject> object, Handle<Smi> hash);
@@ -2757,12 +2775,14 @@
Object* structure,
uint32_t index,
Object* holder);
- MUST_USE_RESULT PropertyAttributes GetElementAttributeWithInterceptor(
- JSReceiver* receiver,
+ static PropertyAttributes GetElementAttributeWithInterceptor(
+ Handle<JSObject> object,
+ Handle<JSReceiver> receiver,
uint32_t index,
bool continue_search);
- MUST_USE_RESULT PropertyAttributes GetElementAttributeWithoutInterceptor(
- JSReceiver* receiver,
+ static PropertyAttributes GetElementAttributeWithoutInterceptor(
+ Handle<JSObject> object,
+ Handle<JSReceiver> receiver,
uint32_t index,
bool continue_search);
static Handle<Object> SetElementWithCallback(
@@ -9598,11 +9618,13 @@
StrictMode strict_mode,
bool* done);
- MUST_USE_RESULT PropertyAttributes GetPropertyAttributeWithHandler(
- JSReceiver* receiver,
- Name* name);
- MUST_USE_RESULT PropertyAttributes GetElementAttributeWithHandler(
- JSReceiver* receiver,
+ static PropertyAttributes GetPropertyAttributeWithHandler(
+ Handle<JSProxy> proxy,
+ Handle<JSReceiver> receiver,
+ Handle<Name> name);
+ static PropertyAttributes GetElementAttributeWithHandler(
+ Handle<JSProxy> proxy,
+ Handle<JSReceiver> receiver,
uint32_t index);
// Turn the proxy into an (empty) JSObject.
=======================================
--- /branches/bleeding_edge/src/runtime.cc Thu Mar 13 00:20:06 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc Thu Mar 13 11:55:31 2014 UTC
@@ -1813,7 +1813,7 @@
case ACCESS_ABSENT: return factory->undefined_value();
}
- PropertyAttributes attrs = obj->GetLocalPropertyAttribute(*name);
+ PropertyAttributes attrs = JSReceiver::GetLocalPropertyAttribute(obj,
name);
if (attrs == ABSENT) {
RETURN_HANDLE_IF_SCHEDULED_EXCEPTION(isolate, Object);
return factory->undefined_value();
@@ -2061,8 +2061,7 @@
// We found an existing property. Unless it was an interceptor
// that claims the property is absent, skip this declaration.
if (!lookup.IsInterceptor()) continue;
- PropertyAttributes attributes =
global->GetPropertyAttribute(*name);
- if (attributes != ABSENT) continue;
+ if (JSReceiver::GetPropertyAttribute(global, name) != ABSENT)
continue;
// Fall-through and introduce the absent property by using
// SetProperty.
}
@@ -2252,15 +2251,15 @@
LookupResult lookup(isolate);
isolate->context()->global_object()->LocalLookup(*name, &lookup, true);
if (lookup.IsInterceptor()) {
+ Handle<JSObject> holder(lookup.holder());
PropertyAttributes intercepted =
- lookup.holder()->GetPropertyAttribute(*name);
+ JSReceiver::GetPropertyAttribute(holder, name);
if (intercepted != ABSENT && (intercepted & READ_ONLY) == 0) {
// Found an interceptor that's not read only.
if (assign) {
CONVERT_ARG_HANDLE_CHECKED(Object, value, 2);
Handle<Object> result = JSObject::SetPropertyForResult(
- handle(lookup.holder()), &lookup, name, value, attributes,
- strict_mode);
+ holder, &lookup, name, value, attributes, strict_mode);
RETURN_IF_EMPTY_HANDLE(isolate, result);
return *result;
} else {
@@ -5644,13 +5643,13 @@
RUNTIME_FUNCTION(MaybeObject*, Runtime_IsPropertyEnumerable) {
- SealHandleScope shs(isolate);
+ HandleScope scope(isolate);
ASSERT(args.length() == 2);
- CONVERT_ARG_CHECKED(JSObject, object, 0);
- CONVERT_ARG_CHECKED(Name, key, 1);
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
+ CONVERT_ARG_HANDLE_CHECKED(Name, key, 1);
- PropertyAttributes att = object->GetLocalPropertyAttribute(key);
+ PropertyAttributes att = JSReceiver::GetLocalPropertyAttribute(object,
key);
if (att == ABSENT || (att & DONT_ENUM) != 0) {
RETURN_IF_SCHEDULED_EXCEPTION(isolate);
return isolate->heap()->false_value();
@@ -5800,7 +5799,7 @@
next_copy_index += local_property_count[i];
// Hidden properties only show up if the filter does not skip strings.
- if ((filter & STRING) == 0 && jsproto->HasHiddenProperties()) {
+ if ((filter & STRING) == 0 && JSObject::HasHiddenProperties(jsproto)) {
hidden_strings++;
}
if (i < length - 1) {
@@ -9339,7 +9338,7 @@
// Set the property if it's not read only or doesn't yet exist.
if ((attributes & READ_ONLY) == 0 ||
- (object->GetLocalPropertyAttribute(*name) == ABSENT)) {
+ (JSReceiver::GetLocalPropertyAttribute(object, name) == ABSENT)) {
RETURN_IF_EMPTY_HANDLE(
isolate,
JSReceiver::SetProperty(object, name, value, NONE, strict_mode));
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.