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

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

Issue 1295433002: [runtime] Remove useless IN builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE again. Remove unused ReplaceWithBuiltinCall. Created 5 years, 3 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 5945488831e9a705881845f988db47d91e5f9753..6287c98f3eb00e43a783a9df1edfe6d59301c246 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -753,28 +753,28 @@ RUNTIME_FUNCTION(Runtime_HasOwnProperty) {
}
+// ES6 section 12.9.3, operator in.
RUNTIME_FUNCTION(Runtime_HasProperty) {
HandleScope scope(isolate);
- DCHECK(args.length() == 2);
- CONVERT_ARG_HANDLE_CHECKED(JSReceiver, receiver, 0);
- CONVERT_ARG_HANDLE_CHECKED(Object, key, 1);
+ 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);
+ // Convert the {key} to a name.
Handle<Name> name;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, name,
Object::ToName(isolate, key));
- Maybe<bool> maybe = JSReceiver::HasProperty(receiver, name);
- 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);
+ // Lookup the {name} on {receiver}.
+ Maybe<bool> maybe = JSReceiver::HasProperty(receiver, name);
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