| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/builtins/builtins-utils.h" | 5 #include "src/builtins/builtins-utils.h" |
| 6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
| 7 #include "src/globals.h" | |
| 8 #include "src/handles-inl.h" | |
| 9 #include "src/objects-inl.h" | 7 #include "src/objects-inl.h" |
| 10 | 8 |
| 11 namespace v8 { | 9 namespace v8 { |
| 12 namespace internal { | 10 namespace internal { |
| 13 | 11 |
| 14 Handle<Code> Builtins::InterpreterPushArgsAndCall( | 12 Handle<Code> Builtins::InterpreterPushArgsAndCall( |
| 15 TailCallMode tail_call_mode, InterpreterPushArgsMode mode) { | 13 TailCallMode tail_call_mode, InterpreterPushArgsMode mode) { |
| 16 switch (mode) { | 14 switch (mode) { |
| 17 case InterpreterPushArgsMode::kJSFunction: | 15 case InterpreterPushArgsMode::kJSFunction: |
| 18 if (tail_call_mode == TailCallMode::kDisallow) { | 16 if (tail_call_mode == TailCallMode::kDisallow) { |
| 19 return InterpreterPushArgsAndCallFunction(); | 17 return InterpreterPushArgsAndCallFunction(); |
| 20 } else { | 18 } else { |
| 21 return InterpreterPushArgsAndTailCallFunction(); | 19 return InterpreterPushArgsAndTailCallFunction(); |
| 22 } | 20 } |
| 23 case InterpreterPushArgsMode::kWithFinalSpread: | 21 case InterpreterPushArgsMode::kWithFinalSpread: |
| 24 CHECK(tail_call_mode == TailCallMode::kDisallow); | 22 CHECK(tail_call_mode == TailCallMode::kDisallow); |
| 25 return InterpreterPushArgsAndCallWithFinalSpread(); | 23 return InterpreterPushArgsAndCallWithFinalSpread(); |
| 26 case InterpreterPushArgsMode::kOther: | 24 case InterpreterPushArgsMode::kOther: |
| 27 if (tail_call_mode == TailCallMode::kDisallow) { | 25 if (tail_call_mode == TailCallMode::kDisallow) { |
| 28 return InterpreterPushArgsAndCall(); | 26 return InterpreterPushArgsAndCall(); |
| 29 } else { | 27 } else { |
| 30 return InterpreterPushArgsAndTailCall(); | 28 return InterpreterPushArgsAndTailCall(); |
| 31 } | 29 } |
| 32 } | 30 } |
| 33 UNREACHABLE(); | 31 UNREACHABLE(); |
| 34 return Handle<Code>::null(); | 32 return Handle<Code>::null(); |
| 35 } | 33 } |
| 36 | 34 |
| 35 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { |
| 36 return Generate_InterpreterPushArgsAndCallImpl( |
| 37 masm, TailCallMode::kDisallow, InterpreterPushArgsMode::kOther); |
| 38 } |
| 39 |
| 40 void Builtins::Generate_InterpreterPushArgsAndCallFunction( |
| 41 MacroAssembler* masm) { |
| 42 return Generate_InterpreterPushArgsAndCallImpl( |
| 43 masm, TailCallMode::kDisallow, InterpreterPushArgsMode::kJSFunction); |
| 44 } |
| 45 |
| 46 void Builtins::Generate_InterpreterPushArgsAndCallWithFinalSpread( |
| 47 MacroAssembler* masm) { |
| 48 return Generate_InterpreterPushArgsAndCallImpl( |
| 49 masm, TailCallMode::kDisallow, InterpreterPushArgsMode::kWithFinalSpread); |
| 50 } |
| 51 |
| 52 void Builtins::Generate_InterpreterPushArgsAndTailCall(MacroAssembler* masm) { |
| 53 return Generate_InterpreterPushArgsAndCallImpl( |
| 54 masm, TailCallMode::kAllow, InterpreterPushArgsMode::kOther); |
| 55 } |
| 56 |
| 57 void Builtins::Generate_InterpreterPushArgsAndTailCallFunction( |
| 58 MacroAssembler* masm) { |
| 59 return Generate_InterpreterPushArgsAndCallImpl( |
| 60 masm, TailCallMode::kAllow, InterpreterPushArgsMode::kJSFunction); |
| 61 } |
| 62 |
| 37 Handle<Code> Builtins::InterpreterPushArgsAndConstruct( | 63 Handle<Code> Builtins::InterpreterPushArgsAndConstruct( |
| 38 InterpreterPushArgsMode mode) { | 64 InterpreterPushArgsMode mode) { |
| 39 switch (mode) { | 65 switch (mode) { |
| 40 case InterpreterPushArgsMode::kJSFunction: | 66 case InterpreterPushArgsMode::kJSFunction: |
| 41 return InterpreterPushArgsAndConstructFunction(); | 67 return InterpreterPushArgsAndConstructFunction(); |
| 42 case InterpreterPushArgsMode::kWithFinalSpread: | 68 case InterpreterPushArgsMode::kWithFinalSpread: |
| 43 return InterpreterPushArgsAndConstructWithFinalSpread(); | 69 return InterpreterPushArgsAndConstructWithFinalSpread(); |
| 44 case InterpreterPushArgsMode::kOther: | 70 case InterpreterPushArgsMode::kOther: |
| 45 return InterpreterPushArgsAndConstruct(); | 71 return InterpreterPushArgsAndConstruct(); |
| 46 } | 72 } |
| 47 UNREACHABLE(); | 73 UNREACHABLE(); |
| 48 return Handle<Code>::null(); | 74 return Handle<Code>::null(); |
| 49 } | 75 } |
| 50 | 76 |
| 77 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
| 78 return Generate_InterpreterPushArgsAndConstructImpl( |
| 79 masm, InterpreterPushArgsMode::kOther); |
| 80 } |
| 81 |
| 82 void Builtins::Generate_InterpreterPushArgsAndConstructWithFinalSpread( |
| 83 MacroAssembler* masm) { |
| 84 return Generate_InterpreterPushArgsAndConstructImpl( |
| 85 masm, InterpreterPushArgsMode::kWithFinalSpread); |
| 86 } |
| 87 |
| 88 void Builtins::Generate_InterpreterPushArgsAndConstructFunction( |
| 89 MacroAssembler* masm) { |
| 90 return Generate_InterpreterPushArgsAndConstructImpl( |
| 91 masm, InterpreterPushArgsMode::kJSFunction); |
| 92 } |
| 93 |
| 51 } // namespace internal | 94 } // namespace internal |
| 52 } // namespace v8 | 95 } // namespace v8 |
| OLD | NEW |