| 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/compiler/interpreter-assembler.h" | 5 #include "src/compiler/interpreter-assembler.h" |
| 6 | 6 |
| 7 #include <ostream> | 7 #include <ostream> |
| 8 | 8 |
| 9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
| 10 #include "src/compiler/instruction-selector.h" | 10 #include "src/compiler/instruction-selector.h" |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 args[0] = arg1; | 264 args[0] = arg1; |
| 265 args[1] = arg2; | 265 args[1] = arg2; |
| 266 args[2] = arg3; | 266 args[2] = arg3; |
| 267 args[3] = arg4; | 267 args[3] = arg4; |
| 268 args[4] = arg5; | 268 args[4] = arg5; |
| 269 args[5] = ContextTaggedPointer(); | 269 args[5] = ContextTaggedPointer(); |
| 270 return CallIC(descriptor, target, args); | 270 return CallIC(descriptor, target, args); |
| 271 } | 271 } |
| 272 | 272 |
| 273 | 273 |
| 274 Node* InterpreterAssembler::CallJSBuiltin(int context_index, Node* receiver, | 274 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, |
| 275 Node** js_args, int js_arg_count) { | 275 Node* arg1, Node* arg2) { |
| 276 Node* global_object = LoadContextSlot(Context::GLOBAL_OBJECT_INDEX); | 276 return raw_assembler_->CallRuntime2(function_id, arg1, arg2, |
| 277 Node* native_context = | 277 ContextTaggedPointer()); |
| 278 LoadObjectField(global_object, GlobalObject::kNativeContextOffset); | |
| 279 Node* function = LoadContextSlot(native_context, context_index); | |
| 280 Node* context = LoadObjectField(function, JSFunction::kContextOffset); | |
| 281 | |
| 282 int index = 0; | |
| 283 Node** args = zone()->NewArray<Node*>(js_arg_count + 2); | |
| 284 args[index++] = receiver; | |
| 285 for (int i = 0; i < js_arg_count; i++) { | |
| 286 args[index++] = js_args[i]; | |
| 287 } | |
| 288 args[index++] = context; | |
| 289 | |
| 290 CallDescriptor* descriptor = Linkage::GetJSCallDescriptor( | |
| 291 zone(), false, js_arg_count + 1, CallDescriptor::kNoFlags); | |
| 292 return raw_assembler_->CallN(descriptor, function, args); | |
| 293 } | 278 } |
| 294 | 279 |
| 295 | 280 |
| 296 Node* InterpreterAssembler::CallJSBuiltin(int context_index, Node* receiver) { | |
| 297 return CallJSBuiltin(context_index, receiver, nullptr, 0); | |
| 298 } | |
| 299 | |
| 300 | |
| 301 Node* InterpreterAssembler::CallJSBuiltin(int context_index, Node* receiver, | |
| 302 Node* arg1) { | |
| 303 return CallJSBuiltin(context_index, receiver, &arg1, 1); | |
| 304 } | |
| 305 | |
| 306 | |
| 307 void InterpreterAssembler::Return() { | 281 void InterpreterAssembler::Return() { |
| 308 Node* exit_trampoline_code_object = | 282 Node* exit_trampoline_code_object = |
| 309 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); | 283 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); |
| 310 // If the order of the parameters you need to change the call signature below. | 284 // If the order of the parameters you need to change the call signature below. |
| 311 STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter); | 285 STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter); |
| 312 STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter); | 286 STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter); |
| 313 STATIC_ASSERT(2 == Linkage::kInterpreterBytecodeOffsetParameter); | 287 STATIC_ASSERT(2 == Linkage::kInterpreterBytecodeOffsetParameter); |
| 314 STATIC_ASSERT(3 == Linkage::kInterpreterBytecodeArrayParameter); | 288 STATIC_ASSERT(3 == Linkage::kInterpreterBytecodeArrayParameter); |
| 315 STATIC_ASSERT(4 == Linkage::kInterpreterDispatchTableParameter); | 289 STATIC_ASSERT(4 == Linkage::kInterpreterDispatchTableParameter); |
| 316 STATIC_ASSERT(5 == Linkage::kInterpreterContextParameter); | 290 STATIC_ASSERT(5 == Linkage::kInterpreterContextParameter); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 return raw_assembler_->schedule(); | 368 return raw_assembler_->schedule(); |
| 395 } | 369 } |
| 396 | 370 |
| 397 | 371 |
| 398 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } | 372 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } |
| 399 | 373 |
| 400 | 374 |
| 401 } // namespace interpreter | 375 } // namespace interpreter |
| 402 } // namespace internal | 376 } // namespace internal |
| 403 } // namespace v8 | 377 } // namespace v8 |
| OLD | NEW |