OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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" | |
6 #include "src/builtins/builtins.h" | 5 #include "src/builtins/builtins.h" |
| 6 #include "src/globals.h" |
7 #include "src/isolate.h" | 7 #include "src/isolate.h" |
8 #include "src/macro-assembler.h" | 8 #include "src/macro-assembler.h" |
9 #include "src/objects-inl.h" | |
10 | 9 |
11 namespace v8 { | 10 namespace v8 { |
12 namespace internal { | 11 namespace internal { |
13 | 12 |
14 Handle<Code> Builtins::CallFunction(ConvertReceiverMode mode, | |
15 TailCallMode tail_call_mode) { | |
16 switch (tail_call_mode) { | |
17 case TailCallMode::kDisallow: | |
18 switch (mode) { | |
19 case ConvertReceiverMode::kNullOrUndefined: | |
20 return CallFunction_ReceiverIsNullOrUndefined(); | |
21 case ConvertReceiverMode::kNotNullOrUndefined: | |
22 return CallFunction_ReceiverIsNotNullOrUndefined(); | |
23 case ConvertReceiverMode::kAny: | |
24 return CallFunction_ReceiverIsAny(); | |
25 } | |
26 break; | |
27 case TailCallMode::kAllow: | |
28 switch (mode) { | |
29 case ConvertReceiverMode::kNullOrUndefined: | |
30 return TailCallFunction_ReceiverIsNullOrUndefined(); | |
31 case ConvertReceiverMode::kNotNullOrUndefined: | |
32 return TailCallFunction_ReceiverIsNotNullOrUndefined(); | |
33 case ConvertReceiverMode::kAny: | |
34 return TailCallFunction_ReceiverIsAny(); | |
35 } | |
36 break; | |
37 } | |
38 UNREACHABLE(); | |
39 return Handle<Code>::null(); | |
40 } | |
41 | |
42 Handle<Code> Builtins::Call(ConvertReceiverMode mode, | |
43 TailCallMode tail_call_mode) { | |
44 switch (tail_call_mode) { | |
45 case TailCallMode::kDisallow: | |
46 switch (mode) { | |
47 case ConvertReceiverMode::kNullOrUndefined: | |
48 return Call_ReceiverIsNullOrUndefined(); | |
49 case ConvertReceiverMode::kNotNullOrUndefined: | |
50 return Call_ReceiverIsNotNullOrUndefined(); | |
51 case ConvertReceiverMode::kAny: | |
52 return Call_ReceiverIsAny(); | |
53 } | |
54 break; | |
55 case TailCallMode::kAllow: | |
56 switch (mode) { | |
57 case ConvertReceiverMode::kNullOrUndefined: | |
58 return TailCall_ReceiverIsNullOrUndefined(); | |
59 case ConvertReceiverMode::kNotNullOrUndefined: | |
60 return TailCall_ReceiverIsNotNullOrUndefined(); | |
61 case ConvertReceiverMode::kAny: | |
62 return TailCall_ReceiverIsAny(); | |
63 } | |
64 break; | |
65 } | |
66 UNREACHABLE(); | |
67 return Handle<Code>::null(); | |
68 } | |
69 | |
70 Handle<Code> Builtins::CallBoundFunction(TailCallMode tail_call_mode) { | |
71 switch (tail_call_mode) { | |
72 case TailCallMode::kDisallow: | |
73 return CallBoundFunction(); | |
74 case TailCallMode::kAllow: | |
75 return TailCallBoundFunction(); | |
76 } | |
77 UNREACHABLE(); | |
78 return Handle<Code>::null(); | |
79 } | |
80 | |
81 void Builtins::Generate_CallFunction_ReceiverIsNullOrUndefined( | 13 void Builtins::Generate_CallFunction_ReceiverIsNullOrUndefined( |
82 MacroAssembler* masm) { | 14 MacroAssembler* masm) { |
83 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined, | 15 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined, |
84 TailCallMode::kDisallow); | 16 TailCallMode::kDisallow); |
85 } | 17 } |
86 | 18 |
87 void Builtins::Generate_CallFunction_ReceiverIsNotNullOrUndefined( | 19 void Builtins::Generate_CallFunction_ReceiverIsNotNullOrUndefined( |
88 MacroAssembler* masm) { | 20 MacroAssembler* masm) { |
89 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined, | 21 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined, |
90 TailCallMode::kDisallow); | 22 TailCallMode::kDisallow); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 Generate_CallForwardVarargs(masm, masm->isolate()->builtins()->Call()); | 86 Generate_CallForwardVarargs(masm, masm->isolate()->builtins()->Call()); |
155 } | 87 } |
156 | 88 |
157 void Builtins::Generate_CallFunctionForwardVarargs(MacroAssembler* masm) { | 89 void Builtins::Generate_CallFunctionForwardVarargs(MacroAssembler* masm) { |
158 Generate_CallForwardVarargs(masm, | 90 Generate_CallForwardVarargs(masm, |
159 masm->isolate()->builtins()->CallFunction()); | 91 masm->isolate()->builtins()->CallFunction()); |
160 } | 92 } |
161 | 93 |
162 } // namespace internal | 94 } // namespace internal |
163 } // namespace v8 | 95 } // namespace v8 |
OLD | NEW |