OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/interpreter/interpreter-intrinsics.h" | 5 #include "src/interpreter/interpreter-intrinsics.h" |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 __ Goto(&end); | 215 __ Goto(&end); |
216 } | 216 } |
217 | 217 |
218 __ Bind(&end); | 218 __ Bind(&end); |
219 return return_value.value(); | 219 return return_value.value(); |
220 } | 220 } |
221 | 221 |
222 Node* IntrinsicsHelper::IntrinsicAsStubCall(Node* args_reg, Node* context, | 222 Node* IntrinsicsHelper::IntrinsicAsStubCall(Node* args_reg, Node* context, |
223 Callable const& callable) { | 223 Callable const& callable) { |
224 int param_count = callable.descriptor().GetParameterCount(); | 224 int param_count = callable.descriptor().GetParameterCount(); |
225 Node** args = zone()->NewArray<Node*>(param_count + 1); // 1 for context | 225 int input_count = param_count + 2; // +2 for target and context |
| 226 Node** args = zone()->NewArray<Node*>(input_count); |
| 227 int index = 0; |
| 228 args[index++] = __ HeapConstant(callable.code()); |
226 for (int i = 0; i < param_count; i++) { | 229 for (int i = 0; i < param_count; i++) { |
227 args[i] = __ LoadRegister(args_reg); | 230 args[index++] = __ LoadRegister(args_reg); |
228 args_reg = __ NextRegister(args_reg); | 231 args_reg = __ NextRegister(args_reg); |
229 } | 232 } |
230 args[param_count] = context; | 233 args[index++] = context; |
231 | 234 return __ CallStubN(callable.descriptor(), 1, input_count, args); |
232 return __ CallStubN(callable, args); | |
233 } | 235 } |
234 | 236 |
235 Node* IntrinsicsHelper::HasProperty(Node* input, Node* arg_count, | 237 Node* IntrinsicsHelper::HasProperty(Node* input, Node* arg_count, |
236 Node* context) { | 238 Node* context) { |
237 return IntrinsicAsStubCall(input, context, | 239 return IntrinsicAsStubCall(input, context, |
238 CodeFactory::HasProperty(isolate())); | 240 CodeFactory::HasProperty(isolate())); |
239 } | 241 } |
240 | 242 |
241 Node* IntrinsicsHelper::NewObject(Node* input, Node* arg_count, Node* context) { | 243 Node* IntrinsicsHelper::NewObject(Node* input, Node* arg_count, Node* context) { |
242 return IntrinsicAsStubCall(input, context, | 244 return IntrinsicAsStubCall(input, context, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); | 397 Node* comparison = __ Word32Equal(actual, __ Int32Constant(expected)); |
396 __ GotoIf(comparison, &match); | 398 __ GotoIf(comparison, &match); |
397 __ Abort(kWrongArgumentCountForInvokeIntrinsic); | 399 __ Abort(kWrongArgumentCountForInvokeIntrinsic); |
398 __ Goto(&match); | 400 __ Goto(&match); |
399 __ Bind(&match); | 401 __ Bind(&match); |
400 } | 402 } |
401 | 403 |
402 } // namespace interpreter | 404 } // namespace interpreter |
403 } // namespace internal | 405 } // namespace internal |
404 } // namespace v8 | 406 } // namespace v8 |
OLD | NEW |