Index: src/runtime/runtime-object.cc |
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc |
index 59aac4800b609abc6fb73f862c6cc37cdcfe19d9..064e4c216291dc7d56261dc195a0db1d6d2f54ab 100644 |
--- a/src/runtime/runtime-object.cc |
+++ b/src/runtime/runtime-object.cc |
@@ -779,36 +779,25 @@ |
} |
-// ES6 section 12.9.3, operator in. |
RUNTIME_FUNCTION(Runtime_HasProperty) { |
HandleScope scope(isolate); |
- DCHECK_EQ(2, args.length()); |
- CONVERT_ARG_HANDLE_CHECKED(Object, key, 0); |
- CONVERT_ARG_HANDLE_CHECKED(Object, object, 1); |
- |
- // Check that {object} is actually a receiver. |
- if (!object->IsJSReceiver()) { |
- THROW_NEW_ERROR_RETURN_FAILURE( |
- isolate, |
- NewTypeError(MessageTemplate::kInvalidInOperatorUse, key, object)); |
- } |
- Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object); |
- |
- // Check for fast element case. |
- uint32_t index = 0; |
- if (key->ToArrayIndex(&index)) { |
- Maybe<bool> maybe = JSReceiver::HasElement(receiver, index); |
- if (!maybe.IsJust()) return isolate->heap()->exception(); |
- return isolate->heap()->ToBoolean(maybe.FromJust()); |
- } |
- |
- // Convert {key} to a Name first. |
- Handle<Name> name; |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name, |
- Runtime::ToName(isolate, key)); |
- |
- // Lookup property by {name} on {receiver}. |
- Maybe<bool> maybe = JSReceiver::HasProperty(receiver, name); |
+ DCHECK(args.length() == 2); |
+ CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); |
+ CONVERT_ARG_HANDLE_CHECKED(Name, key, 1); |
+ |
+ Maybe<bool> maybe = JSReceiver::HasProperty(receiver, key); |
+ if (!maybe.IsJust()) return isolate->heap()->exception(); |
+ return isolate->heap()->ToBoolean(maybe.FromJust()); |
+} |
+ |
+ |
+RUNTIME_FUNCTION(Runtime_HasElement) { |
+ HandleScope scope(isolate); |
+ DCHECK(args.length() == 2); |
+ CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0); |
+ CONVERT_SMI_ARG_CHECKED(index, 1); |
+ |
+ Maybe<bool> maybe = JSReceiver::HasElement(receiver, index); |
if (!maybe.IsJust()) return isolate->heap()->exception(); |
return isolate->heap()->ToBoolean(maybe.FromJust()); |
} |