Chromium Code Reviews

Unified Diff: src/builtins.cc

Issue 1819813002: [es6] Faster implementation of OrdinaryHasInstance. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Revert flag-flip again. Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« no previous file with comments | « src/builtins.h ('k') | src/code-stubs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/builtins.cc
diff --git a/src/builtins.cc b/src/builtins.cc
index 1c27415907854b1751275958b4cda49e350674f4..c5581515656c7b583b38fa6f33693f1685969d6d 100644
--- a/src/builtins.cc
+++ b/src/builtins.cc
@@ -3725,46 +3725,6 @@ BUILTIN(GeneratorFunctionConstructor) {
return *result;
}
-// ES6 section 19.2.3.6 Function.prototype[@@hasInstance](V)
-BUILTIN(FunctionHasInstance) {
- HandleScope scope(isolate);
- Handle<Object> callable = args.receiver();
- Handle<Object> object = args.atOrUndefined(isolate, 1);
-
- // {callable} must have a [[Call]] internal method.
- if (!callable->IsCallable()) {
- return isolate->heap()->false_value();
- }
- // If {object} is not a receiver, return false.
- if (!object->IsJSReceiver()) {
- return isolate->heap()->false_value();
- }
- // Check if {callable} is bound, if so, get [[BoundTargetFunction]] from it
- // and use that instead of {callable}.
- while (callable->IsJSBoundFunction()) {
- callable =
- handle(Handle<JSBoundFunction>::cast(callable)->bound_target_function(),
- isolate);
- }
- DCHECK(callable->IsCallable());
- // Get the "prototype" of {callable}; raise an error if it's not a receiver.
- Handle<Object> prototype;
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, prototype,
- JSReceiver::GetProperty(Handle<JSReceiver>::cast(callable),
- isolate->factory()->prototype_string()));
- if (!prototype->IsJSReceiver()) {
- THROW_NEW_ERROR_RETURN_FAILURE(
- isolate,
- NewTypeError(MessageTemplate::kInstanceofNonobjectProto, prototype));
- }
- // Return whether or not {prototype} is in the prototype chain of {object}.
- Handle<JSReceiver> receiver = Handle<JSReceiver>::cast(object);
- Maybe<bool> result =
- JSReceiver::HasInPrototypeChain(isolate, receiver, prototype);
- MAYBE_RETURN(result, isolate->heap()->exception());
- return isolate->heap()->ToBoolean(result.FromJust());
-}
// ES6 section 19.4.1.1 Symbol ( [ description ] ) for the [[Call]] case.
BUILTIN(SymbolConstructor) {
« no previous file with comments | « src/builtins.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine