| 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/code-factory.h" | 9 #include "src/code-factory.h" |
| 10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 Node* shared_info = | 309 Node* shared_info = |
| 310 LoadObjectField(function, JSFunction::kSharedFunctionInfoOffset); | 310 LoadObjectField(function, JSFunction::kSharedFunctionInfoOffset); |
| 311 Node* vector = | 311 Node* vector = |
| 312 LoadObjectField(shared_info, SharedFunctionInfo::kFeedbackVectorOffset); | 312 LoadObjectField(shared_info, SharedFunctionInfo::kFeedbackVectorOffset); |
| 313 return vector; | 313 return vector; |
| 314 } | 314 } |
| 315 | 315 |
| 316 | 316 |
| 317 Node* InterpreterAssembler::CallJS(Node* function, Node* first_arg, | 317 Node* InterpreterAssembler::CallJS(Node* function, Node* first_arg, |
| 318 Node* arg_count) { | 318 Node* arg_count) { |
| 319 Callable callable = CodeFactory::InterpreterPushArgsAndCall(isolate()); | 319 Callable builtin = CodeFactory::PushArgsAndCall(isolate()); |
| 320 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | 320 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
| 321 isolate(), zone(), callable.descriptor(), 0, CallDescriptor::kNoFlags); | 321 isolate(), zone(), builtin.descriptor(), 0, CallDescriptor::kNoFlags); |
| 322 | 322 |
| 323 Node* code_target = HeapConstant(callable.code()); | 323 Node* code_target = HeapConstant(builtin.code()); |
| 324 | 324 |
| 325 Node** args = zone()->NewArray<Node*>(4); | 325 Node** args = zone()->NewArray<Node*>(4); |
| 326 args[0] = arg_count; | 326 args[0] = arg_count; |
| 327 args[1] = first_arg; | 327 args[1] = first_arg; |
| 328 args[2] = function; | 328 args[2] = function; |
| 329 args[3] = ContextTaggedPointer(); | 329 args[3] = ContextTaggedPointer(); |
| 330 | 330 |
| 331 return raw_assembler_->CallN(descriptor, code_target, args); | 331 return raw_assembler_->CallN(descriptor, code_target, args); |
| 332 } | 332 } |
| 333 | 333 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 360 args[0] = arg1; | 360 args[0] = arg1; |
| 361 args[1] = arg2; | 361 args[1] = arg2; |
| 362 args[2] = arg3; | 362 args[2] = arg3; |
| 363 args[3] = arg4; | 363 args[3] = arg4; |
| 364 args[4] = arg5; | 364 args[4] = arg5; |
| 365 args[5] = ContextTaggedPointer(); | 365 args[5] = ContextTaggedPointer(); |
| 366 return CallIC(descriptor, target, args); | 366 return CallIC(descriptor, target, args); |
| 367 } | 367 } |
| 368 | 368 |
| 369 | 369 |
| 370 Node* InterpreterAssembler::CallRuntime(Node* function_id, Node* first_arg, | |
| 371 Node* arg_count) { | |
| 372 Callable callable = CodeFactory::InterpreterCEntry(isolate()); | |
| 373 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | |
| 374 isolate(), zone(), callable.descriptor(), 0, CallDescriptor::kNoFlags); | |
| 375 | |
| 376 Node* code_target = HeapConstant(callable.code()); | |
| 377 | |
| 378 // Get the function entry from the function id. | |
| 379 Node* function_table = raw_assembler_->ExternalConstant( | |
| 380 ExternalReference::runtime_function_table_address(isolate())); | |
| 381 Node* function_offset = raw_assembler_->Int32Mul( | |
| 382 function_id, Int32Constant(sizeof(Runtime::Function))); | |
| 383 Node* function = IntPtrAdd(function_table, function_offset); | |
| 384 Node* function_entry = raw_assembler_->Load( | |
| 385 kMachPtr, function, Int32Constant(offsetof(Runtime::Function, entry))); | |
| 386 | |
| 387 Node** args = zone()->NewArray<Node*>(4); | |
| 388 args[0] = arg_count; | |
| 389 args[1] = first_arg; | |
| 390 args[2] = function_entry; | |
| 391 args[3] = ContextTaggedPointer(); | |
| 392 | |
| 393 return raw_assembler_->CallN(descriptor, code_target, args); | |
| 394 } | |
| 395 | |
| 396 | |
| 397 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, | 370 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, |
| 398 Node* arg1) { | 371 Node* arg1) { |
| 399 return raw_assembler_->CallRuntime1(function_id, arg1, | 372 return raw_assembler_->CallRuntime1(function_id, arg1, |
| 400 ContextTaggedPointer()); | 373 ContextTaggedPointer()); |
| 401 } | 374 } |
| 402 | 375 |
| 403 | 376 |
| 404 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, | 377 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, |
| 405 Node* arg1, Node* arg2) { | 378 Node* arg1, Node* arg2) { |
| 406 return raw_assembler_->CallRuntime2(function_id, arg1, arg2, | 379 return raw_assembler_->CallRuntime2(function_id, arg1, arg2, |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 return raw_assembler_->schedule(); | 509 return raw_assembler_->schedule(); |
| 537 } | 510 } |
| 538 | 511 |
| 539 | 512 |
| 540 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } | 513 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } |
| 541 | 514 |
| 542 | 515 |
| 543 } // namespace compiler | 516 } // namespace compiler |
| 544 } // namespace internal | 517 } // namespace internal |
| 545 } // namespace v8 | 518 } // namespace v8 |
| OLD | NEW |