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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 Node* InterpreterAssembler::RegisterFrameOffset(Node* index) { | 104 Node* InterpreterAssembler::RegisterFrameOffset(Node* index) { |
105 return WordShl(index, kPointerSizeLog2); | 105 return WordShl(index, kPointerSizeLog2); |
106 } | 106 } |
107 | 107 |
108 | 108 |
109 Node* InterpreterAssembler::RegisterLocation(Node* reg_index) { | 109 Node* InterpreterAssembler::RegisterLocation(Node* reg_index) { |
110 return IntPtrAdd(RegisterFileRawPointer(), RegisterFrameOffset(reg_index)); | 110 return IntPtrAdd(RegisterFileRawPointer(), RegisterFrameOffset(reg_index)); |
111 } | 111 } |
112 | 112 |
113 | 113 |
| 114 Node* InterpreterAssembler::LoadRegister(interpreter::Register reg) { |
| 115 return raw_assembler_->Load( |
| 116 kMachAnyTagged, RegisterFileRawPointer(), |
| 117 RegisterFrameOffset(Int32Constant(reg.ToOperand()))); |
| 118 } |
| 119 |
| 120 |
114 Node* InterpreterAssembler::LoadRegister(Node* reg_index) { | 121 Node* InterpreterAssembler::LoadRegister(Node* reg_index) { |
115 return raw_assembler_->Load(kMachAnyTagged, RegisterFileRawPointer(), | 122 return raw_assembler_->Load(kMachAnyTagged, RegisterFileRawPointer(), |
116 RegisterFrameOffset(reg_index)); | 123 RegisterFrameOffset(reg_index)); |
117 } | 124 } |
118 | 125 |
119 | 126 |
120 Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) { | 127 Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) { |
121 return raw_assembler_->Store(kMachAnyTagged, RegisterFileRawPointer(), | 128 return raw_assembler_->Store(kMachAnyTagged, RegisterFileRawPointer(), |
122 RegisterFrameOffset(reg_index), value); | 129 RegisterFrameOffset(reg_index), value); |
123 } | 130 } |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, | 354 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, |
348 Node* target, Node** args) { | 355 Node* target, Node** args) { |
349 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | 356 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( |
350 isolate(), zone(), descriptor, 0, CallDescriptor::kNoFlags); | 357 isolate(), zone(), descriptor, 0, CallDescriptor::kNoFlags); |
351 return CallN(call_descriptor, target, args); | 358 return CallN(call_descriptor, target, args); |
352 } | 359 } |
353 | 360 |
354 | 361 |
355 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, | 362 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, |
356 Node* target, Node* arg1, Node* arg2, | 363 Node* target, Node* arg1, Node* arg2, |
| 364 Node* arg3) { |
| 365 Node** args = zone()->NewArray<Node*>(4); |
| 366 args[0] = arg1; |
| 367 args[1] = arg2; |
| 368 args[2] = arg3; |
| 369 args[3] = GetContext(); |
| 370 return CallIC(descriptor, target, args); |
| 371 } |
| 372 |
| 373 |
| 374 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, |
| 375 Node* target, Node* arg1, Node* arg2, |
357 Node* arg3, Node* arg4) { | 376 Node* arg3, Node* arg4) { |
358 Node** args = zone()->NewArray<Node*>(5); | 377 Node** args = zone()->NewArray<Node*>(5); |
359 args[0] = arg1; | 378 args[0] = arg1; |
360 args[1] = arg2; | 379 args[1] = arg2; |
361 args[2] = arg3; | 380 args[2] = arg3; |
362 args[3] = arg4; | 381 args[3] = arg4; |
363 args[4] = GetContext(); | 382 args[4] = GetContext(); |
364 return CallIC(descriptor, target, args); | 383 return CallIC(descriptor, target, args); |
365 } | 384 } |
366 | 385 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 return raw_assembler_->CallRuntime1(function_id, arg1, GetContext()); | 430 return raw_assembler_->CallRuntime1(function_id, arg1, GetContext()); |
412 } | 431 } |
413 | 432 |
414 | 433 |
415 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, | 434 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, |
416 Node* arg1, Node* arg2) { | 435 Node* arg1, Node* arg2) { |
417 return raw_assembler_->CallRuntime2(function_id, arg1, arg2, GetContext()); | 436 return raw_assembler_->CallRuntime2(function_id, arg1, arg2, GetContext()); |
418 } | 437 } |
419 | 438 |
420 | 439 |
| 440 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, |
| 441 Node* arg1, Node* arg2, Node* arg3, |
| 442 Node* arg4) { |
| 443 return raw_assembler_->CallRuntime4(function_id, arg1, arg2, arg3, arg4, |
| 444 GetContext()); |
| 445 } |
| 446 |
| 447 |
421 void InterpreterAssembler::Return() { | 448 void InterpreterAssembler::Return() { |
422 Node* exit_trampoline_code_object = | 449 Node* exit_trampoline_code_object = |
423 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); | 450 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); |
424 // If the order of the parameters you need to change the call signature below. | 451 // If the order of the parameters you need to change the call signature below. |
425 STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter); | 452 STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter); |
426 STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter); | 453 STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter); |
427 STATIC_ASSERT(2 == Linkage::kInterpreterBytecodeOffsetParameter); | 454 STATIC_ASSERT(2 == Linkage::kInterpreterBytecodeOffsetParameter); |
428 STATIC_ASSERT(3 == Linkage::kInterpreterBytecodeArrayParameter); | 455 STATIC_ASSERT(3 == Linkage::kInterpreterBytecodeArrayParameter); |
429 STATIC_ASSERT(4 == Linkage::kInterpreterDispatchTableParameter); | 456 STATIC_ASSERT(4 == Linkage::kInterpreterDispatchTableParameter); |
430 STATIC_ASSERT(5 == Linkage::kInterpreterContextParameter); | 457 STATIC_ASSERT(5 == Linkage::kInterpreterContextParameter); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 return raw_assembler_->schedule(); | 586 return raw_assembler_->schedule(); |
560 } | 587 } |
561 | 588 |
562 | 589 |
563 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } | 590 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } |
564 | 591 |
565 | 592 |
566 } // namespace compiler | 593 } // namespace compiler |
567 } // namespace internal | 594 } // namespace internal |
568 } // namespace v8 | 595 } // namespace v8 |
OLD | NEW |