Index: src/runtime/runtime-object.cc |
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc |
index 45a49925bd248e076a1f0a855f7cd4db8a3cf634..17436aaf0e2486bc6be1c71caf93c5f8ec234cb5 100644 |
--- a/src/runtime/runtime-object.cc |
+++ b/src/runtime/runtime-object.cc |
@@ -532,85 +532,6 @@ RUNTIME_FUNCTION(Runtime_DeleteProperty_Strict) { |
} |
-static Object* HasOwnPropertyImplementation(Isolate* isolate, |
- Handle<JSObject> object, |
- Handle<Name> key) { |
- Maybe<bool> maybe = JSReceiver::HasOwnProperty(object, key); |
- if (!maybe.IsJust()) return isolate->heap()->exception(); |
- if (maybe.FromJust()) return isolate->heap()->true_value(); |
- // Handle hidden prototypes. If there's a hidden prototype above this thing |
- // then we have to check it for properties, because they are supposed to |
- // look like they are on this object. |
- if (object->map()->has_hidden_prototype()) { |
- PrototypeIterator iter(isolate, object); |
- DCHECK(!iter.IsAtEnd()); |
- |
- // TODO(verwaest): The recursion is not necessary for keys that are array |
- // indices. Removing this. |
- // Casting to JSObject is fine because JSProxies are never used as |
- // hidden prototypes. |
- return HasOwnPropertyImplementation( |
- isolate, PrototypeIterator::GetCurrent<JSObject>(iter), key); |
- } |
- RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
- return isolate->heap()->false_value(); |
-} |
- |
- |
-RUNTIME_FUNCTION(Runtime_HasOwnProperty) { |
- HandleScope scope(isolate); |
- DCHECK(args.length() == 2); |
- CONVERT_ARG_HANDLE_CHECKED(Object, object, 0) |
- CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); |
- |
- uint32_t index; |
- const bool key_is_array_index = key->AsArrayIndex(&index); |
- |
- // Only JS objects can have properties. |
- if (object->IsJSObject()) { |
- Handle<JSObject> js_obj = Handle<JSObject>::cast(object); |
- // Fast case: either the key is a real named property or it is not |
- // an array index and there are no interceptors or hidden |
- // prototypes. |
- // TODO(jkummerow): Make JSReceiver::HasOwnProperty fast enough to |
- // handle all cases directly (without this custom fast path). |
- Maybe<bool> maybe = Nothing<bool>(); |
- if (key_is_array_index) { |
- LookupIterator it(js_obj->GetIsolate(), js_obj, index, |
- LookupIterator::HIDDEN); |
- maybe = JSReceiver::HasProperty(&it); |
- } else { |
- maybe = JSObject::HasRealNamedProperty(js_obj, key); |
- } |
- if (!maybe.IsJust()) return isolate->heap()->exception(); |
- DCHECK(!isolate->has_pending_exception()); |
- if (maybe.FromJust()) { |
- return isolate->heap()->true_value(); |
- } |
- Map* map = js_obj->map(); |
- if (!key_is_array_index && !map->has_named_interceptor() && |
- !map->has_hidden_prototype()) { |
- return isolate->heap()->false_value(); |
- } |
- // Slow case. |
- return HasOwnPropertyImplementation(isolate, Handle<JSObject>(js_obj), |
- Handle<Name>(key)); |
- } else if (object->IsString() && key_is_array_index) { |
- // Well, there is one exception: Handle [] on strings. |
- Handle<String> string = Handle<String>::cast(object); |
- if (index < static_cast<uint32_t>(string->length())) { |
- return isolate->heap()->true_value(); |
- } |
- } else if (object->IsJSProxy()) { |
- Maybe<bool> result = |
- JSReceiver::HasOwnProperty(Handle<JSProxy>::cast(object), key); |
- if (!result.IsJust()) return isolate->heap()->exception(); |
- return isolate->heap()->ToBoolean(result.FromJust()); |
- } |
- return isolate->heap()->false_value(); |
-} |
- |
- |
// ES6 section 12.9.3, operator in. |
RUNTIME_FUNCTION(Runtime_HasProperty) { |
HandleScope scope(isolate); |