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/handles-inl.h" |
7 #include "src/isolate.h" | 8 #include "src/isolate.h" |
8 #include "src/macro-assembler.h" | |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 | 10 |
11 namespace v8 { | 11 namespace v8 { |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 Handle<Code> Builtins::CallFunction(ConvertReceiverMode mode, | 14 Handle<Code> Builtins::CallFunction(ConvertReceiverMode mode, |
15 TailCallMode tail_call_mode) { | 15 TailCallMode tail_call_mode) { |
16 switch (tail_call_mode) { | 16 switch (tail_call_mode) { |
17 case TailCallMode::kDisallow: | 17 case TailCallMode::kDisallow: |
18 switch (mode) { | 18 switch (mode) { |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 switch (tail_call_mode) { | 71 switch (tail_call_mode) { |
72 case TailCallMode::kDisallow: | 72 case TailCallMode::kDisallow: |
73 return CallBoundFunction(); | 73 return CallBoundFunction(); |
74 case TailCallMode::kAllow: | 74 case TailCallMode::kAllow: |
75 return TailCallBoundFunction(); | 75 return TailCallBoundFunction(); |
76 } | 76 } |
77 UNREACHABLE(); | 77 UNREACHABLE(); |
78 return Handle<Code>::null(); | 78 return Handle<Code>::null(); |
79 } | 79 } |
80 | 80 |
81 void Builtins::Generate_CallFunction_ReceiverIsNullOrUndefined( | |
82 MacroAssembler* masm) { | |
83 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined, | |
84 TailCallMode::kDisallow); | |
85 } | |
86 | |
87 void Builtins::Generate_CallFunction_ReceiverIsNotNullOrUndefined( | |
88 MacroAssembler* masm) { | |
89 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined, | |
90 TailCallMode::kDisallow); | |
91 } | |
92 | |
93 void Builtins::Generate_CallFunction_ReceiverIsAny(MacroAssembler* masm) { | |
94 Generate_CallFunction(masm, ConvertReceiverMode::kAny, | |
95 TailCallMode::kDisallow); | |
96 } | |
97 | |
98 void Builtins::Generate_TailCallFunction_ReceiverIsNullOrUndefined( | |
99 MacroAssembler* masm) { | |
100 Generate_CallFunction(masm, ConvertReceiverMode::kNullOrUndefined, | |
101 TailCallMode::kAllow); | |
102 } | |
103 | |
104 void Builtins::Generate_TailCallFunction_ReceiverIsNotNullOrUndefined( | |
105 MacroAssembler* masm) { | |
106 Generate_CallFunction(masm, ConvertReceiverMode::kNotNullOrUndefined, | |
107 TailCallMode::kAllow); | |
108 } | |
109 | |
110 void Builtins::Generate_TailCallFunction_ReceiverIsAny(MacroAssembler* masm) { | |
111 Generate_CallFunction(masm, ConvertReceiverMode::kAny, TailCallMode::kAllow); | |
112 } | |
113 | |
114 void Builtins::Generate_CallBoundFunction(MacroAssembler* masm) { | |
115 Generate_CallBoundFunctionImpl(masm, TailCallMode::kDisallow); | |
116 } | |
117 | |
118 void Builtins::Generate_TailCallBoundFunction(MacroAssembler* masm) { | |
119 Generate_CallBoundFunctionImpl(masm, TailCallMode::kAllow); | |
120 } | |
121 | |
122 void Builtins::Generate_Call_ReceiverIsNullOrUndefined(MacroAssembler* masm) { | |
123 Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined, | |
124 TailCallMode::kDisallow); | |
125 } | |
126 | |
127 void Builtins::Generate_Call_ReceiverIsNotNullOrUndefined( | |
128 MacroAssembler* masm) { | |
129 Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined, | |
130 TailCallMode::kDisallow); | |
131 } | |
132 | |
133 void Builtins::Generate_Call_ReceiverIsAny(MacroAssembler* masm) { | |
134 Generate_Call(masm, ConvertReceiverMode::kAny, TailCallMode::kDisallow); | |
135 } | |
136 | |
137 void Builtins::Generate_TailCall_ReceiverIsNullOrUndefined( | |
138 MacroAssembler* masm) { | |
139 Generate_Call(masm, ConvertReceiverMode::kNullOrUndefined, | |
140 TailCallMode::kAllow); | |
141 } | |
142 | |
143 void Builtins::Generate_TailCall_ReceiverIsNotNullOrUndefined( | |
144 MacroAssembler* masm) { | |
145 Generate_Call(masm, ConvertReceiverMode::kNotNullOrUndefined, | |
146 TailCallMode::kAllow); | |
147 } | |
148 | |
149 void Builtins::Generate_TailCall_ReceiverIsAny(MacroAssembler* masm) { | |
150 Generate_Call(masm, ConvertReceiverMode::kAny, TailCallMode::kAllow); | |
151 } | |
152 | |
153 void Builtins::Generate_CallForwardVarargs(MacroAssembler* masm) { | |
154 Generate_CallForwardVarargs(masm, masm->isolate()->builtins()->Call()); | |
155 } | |
156 | |
157 void Builtins::Generate_CallFunctionForwardVarargs(MacroAssembler* masm) { | |
158 Generate_CallForwardVarargs(masm, | |
159 masm->isolate()->builtins()->CallFunction()); | |
160 } | |
161 | |
162 } // namespace internal | 81 } // namespace internal |
163 } // namespace v8 | 82 } // namespace v8 |
OLD | NEW |