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" | |
7 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
8 | 10 |
9 namespace v8 { | 11 namespace v8 { |
10 namespace internal { | 12 namespace internal { |
11 | 13 |
12 Handle<Code> Builtins::InterpreterPushArgsAndCall( | 14 Handle<Code> Builtins::InterpreterPushArgsAndCall( |
13 TailCallMode tail_call_mode, InterpreterPushArgsMode mode) { | 15 TailCallMode tail_call_mode, InterpreterPushArgsMode mode) { |
14 switch (mode) { | 16 switch (mode) { |
15 case InterpreterPushArgsMode::kJSFunction: | 17 case InterpreterPushArgsMode::kJSFunction: |
16 if (tail_call_mode == TailCallMode::kDisallow) { | 18 if (tail_call_mode == TailCallMode::kDisallow) { |
17 return InterpreterPushArgsAndCallFunction(); | 19 return InterpreterPushArgsAndCallFunction(); |
18 } else { | 20 } else { |
19 return InterpreterPushArgsAndTailCallFunction(); | 21 return InterpreterPushArgsAndTailCallFunction(); |
20 } | 22 } |
21 case InterpreterPushArgsMode::kWithFinalSpread: | 23 case InterpreterPushArgsMode::kWithFinalSpread: |
22 CHECK(tail_call_mode == TailCallMode::kDisallow); | 24 CHECK(tail_call_mode == TailCallMode::kDisallow); |
23 return InterpreterPushArgsAndCallWithFinalSpread(); | 25 return InterpreterPushArgsAndCallWithFinalSpread(); |
24 case InterpreterPushArgsMode::kOther: | 26 case InterpreterPushArgsMode::kOther: |
25 if (tail_call_mode == TailCallMode::kDisallow) { | 27 if (tail_call_mode == TailCallMode::kDisallow) { |
26 return InterpreterPushArgsAndCall(); | 28 return InterpreterPushArgsAndCall(); |
27 } else { | 29 } else { |
28 return InterpreterPushArgsAndTailCall(); | 30 return InterpreterPushArgsAndTailCall(); |
29 } | 31 } |
30 } | 32 } |
31 UNREACHABLE(); | 33 UNREACHABLE(); |
32 return Handle<Code>::null(); | 34 return Handle<Code>::null(); |
33 } | 35 } |
34 | 36 |
35 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | |
Jakob Kummerow
2017/03/21 16:38:00
Forgot to split this out before.
| |
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 | |
63 Handle<Code> Builtins::InterpreterPushArgsAndConstruct( | 37 Handle<Code> Builtins::InterpreterPushArgsAndConstruct( |
64 InterpreterPushArgsMode mode) { | 38 InterpreterPushArgsMode mode) { |
65 switch (mode) { | 39 switch (mode) { |
66 case InterpreterPushArgsMode::kJSFunction: | 40 case InterpreterPushArgsMode::kJSFunction: |
67 return InterpreterPushArgsAndConstructFunction(); | 41 return InterpreterPushArgsAndConstructFunction(); |
68 case InterpreterPushArgsMode::kWithFinalSpread: | 42 case InterpreterPushArgsMode::kWithFinalSpread: |
69 return InterpreterPushArgsAndConstructWithFinalSpread(); | 43 return InterpreterPushArgsAndConstructWithFinalSpread(); |
70 case InterpreterPushArgsMode::kOther: | 44 case InterpreterPushArgsMode::kOther: |
71 return InterpreterPushArgsAndConstruct(); | 45 return InterpreterPushArgsAndConstruct(); |
72 } | 46 } |
73 UNREACHABLE(); | 47 UNREACHABLE(); |
74 return Handle<Code>::null(); | 48 return Handle<Code>::null(); |
75 } | 49 } |
76 | 50 |
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 | |
94 } // namespace internal | 51 } // namespace internal |
95 } // namespace v8 | 52 } // namespace v8 |
OLD | NEW |