Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(146)

Unified Diff: src/runtime/runtime-object.cc

Issue 1288923002: Revert of [runtime] Remove useless IN builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-numbers.cc ('k') | test/cctest/compiler/test-run-inlining.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « src/runtime/runtime-numbers.cc ('k') | test/cctest/compiler/test-run-inlining.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698