diff options
Diffstat (limited to 'src/builtins/builtins-interpreter.cc')
-rw-r--r-- | src/builtins/builtins-interpreter.cc | 67 |
1 files changed, 43 insertions, 24 deletions
diff --git a/src/builtins/builtins-interpreter.cc b/src/builtins/builtins-interpreter.cc index 16091848..3cfa57bc 100644 --- a/src/builtins/builtins-interpreter.cc +++ b/src/builtins/builtins-interpreter.cc @@ -2,24 +2,28 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "src/builtins/builtins.h" #include "src/builtins/builtins-utils.h" +#include "src/builtins/builtins.h" +#include "src/objects-inl.h" namespace v8 { namespace internal { -Handle<Code> Builtins::InterpreterPushArgsAndCall(TailCallMode tail_call_mode, - CallableType function_type) { - switch (tail_call_mode) { - case TailCallMode::kDisallow: - if (function_type == CallableType::kJSFunction) { +Handle<Code> Builtins::InterpreterPushArgsAndCall( + TailCallMode tail_call_mode, InterpreterPushArgsMode mode) { + switch (mode) { + case InterpreterPushArgsMode::kJSFunction: + if (tail_call_mode == TailCallMode::kDisallow) { return InterpreterPushArgsAndCallFunction(); } else { - return InterpreterPushArgsAndCall(); - } - case TailCallMode::kAllow: - if (function_type == CallableType::kJSFunction) { return InterpreterPushArgsAndTailCallFunction(); + } + case InterpreterPushArgsMode::kWithFinalSpread: + CHECK(tail_call_mode == TailCallMode::kDisallow); + return InterpreterPushArgsAndCallWithFinalSpread(); + case InterpreterPushArgsMode::kOther: + if (tail_call_mode == TailCallMode::kDisallow) { + return InterpreterPushArgsAndCall(); } else { return InterpreterPushArgsAndTailCall(); } @@ -29,33 +33,41 @@ Handle<Code> Builtins::InterpreterPushArgsAndCall(TailCallMode tail_call_mode, } void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { - return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kDisallow, - CallableType::kAny); + return Generate_InterpreterPushArgsAndCallImpl( + masm, TailCallMode::kDisallow, InterpreterPushArgsMode::kOther); } void Builtins::Generate_InterpreterPushArgsAndCallFunction( MacroAssembler* masm) { - return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kDisallow, - CallableType::kJSFunction); + return Generate_InterpreterPushArgsAndCallImpl( + masm, TailCallMode::kDisallow, InterpreterPushArgsMode::kJSFunction); +} + +void Builtins::Generate_InterpreterPushArgsAndCallWithFinalSpread( + MacroAssembler* masm) { + return Generate_InterpreterPushArgsAndCallImpl( + masm, TailCallMode::kDisallow, InterpreterPushArgsMode::kWithFinalSpread); } void Builtins::Generate_InterpreterPushArgsAndTailCall(MacroAssembler* masm) { - return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kAllow, - CallableType::kAny); + return Generate_InterpreterPushArgsAndCallImpl( + masm, TailCallMode::kAllow, InterpreterPushArgsMode::kOther); } void Builtins::Generate_InterpreterPushArgsAndTailCallFunction( MacroAssembler* masm) { - return Generate_InterpreterPushArgsAndCallImpl(masm, TailCallMode::kAllow, - CallableType::kJSFunction); + return Generate_InterpreterPushArgsAndCallImpl( + masm, TailCallMode::kAllow, InterpreterPushArgsMode::kJSFunction); } Handle<Code> Builtins::InterpreterPushArgsAndConstruct( - CallableType function_type) { - switch (function_type) { - case CallableType::kJSFunction: + InterpreterPushArgsMode mode) { + switch (mode) { + case InterpreterPushArgsMode::kJSFunction: return InterpreterPushArgsAndConstructFunction(); - case CallableType::kAny: + case InterpreterPushArgsMode::kWithFinalSpread: + return InterpreterPushArgsAndConstructWithFinalSpread(); + case InterpreterPushArgsMode::kOther: return InterpreterPushArgsAndConstruct(); } UNREACHABLE(); @@ -63,13 +75,20 @@ Handle<Code> Builtins::InterpreterPushArgsAndConstruct( } void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { - return Generate_InterpreterPushArgsAndConstructImpl(masm, CallableType::kAny); + return Generate_InterpreterPushArgsAndConstructImpl( + masm, InterpreterPushArgsMode::kOther); +} + +void Builtins::Generate_InterpreterPushArgsAndConstructWithFinalSpread( + MacroAssembler* masm) { + return Generate_InterpreterPushArgsAndConstructImpl( + masm, InterpreterPushArgsMode::kWithFinalSpread); } void Builtins::Generate_InterpreterPushArgsAndConstructFunction( MacroAssembler* masm) { return Generate_InterpreterPushArgsAndConstructImpl( - masm, CallableType::kJSFunction); + masm, InterpreterPushArgsMode::kJSFunction); } } // namespace internal |