| 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 16 matching lines...) Expand all Loading... |
| 27 | 27 |
| 28 InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone, | 28 InterpreterAssembler::InterpreterAssembler(Isolate* isolate, Zone* zone, |
| 29 interpreter::Bytecode bytecode) | 29 interpreter::Bytecode bytecode) |
| 30 : bytecode_(bytecode), | 30 : bytecode_(bytecode), |
| 31 raw_assembler_(new RawMachineAssembler( | 31 raw_assembler_(new RawMachineAssembler( |
| 32 isolate, new (zone) Graph(zone), | 32 isolate, new (zone) Graph(zone), |
| 33 Linkage::GetInterpreterDispatchDescriptor(zone), kMachPtr, | 33 Linkage::GetInterpreterDispatchDescriptor(zone), kMachPtr, |
| 34 InstructionSelector::SupportedMachineOperatorFlags())), | 34 InstructionSelector::SupportedMachineOperatorFlags())), |
| 35 accumulator_( | 35 accumulator_( |
| 36 raw_assembler_->Parameter(Linkage::kInterpreterAccumulatorParameter)), | 36 raw_assembler_->Parameter(Linkage::kInterpreterAccumulatorParameter)), |
| 37 bytecode_offset_(raw_assembler_->Parameter( |
| 38 Linkage::kInterpreterBytecodeOffsetParameter)), |
| 37 context_( | 39 context_( |
| 38 raw_assembler_->Parameter(Linkage::kInterpreterContextParameter)), | 40 raw_assembler_->Parameter(Linkage::kInterpreterContextParameter)), |
| 39 code_generated_(false) {} | 41 code_generated_(false) {} |
| 40 | 42 |
| 41 | 43 |
| 42 InterpreterAssembler::~InterpreterAssembler() {} | 44 InterpreterAssembler::~InterpreterAssembler() {} |
| 43 | 45 |
| 44 | 46 |
| 45 Handle<Code> InterpreterAssembler::GenerateCode() { | 47 Handle<Code> InterpreterAssembler::GenerateCode() { |
| 46 DCHECK(!code_generated_); | 48 DCHECK(!code_generated_); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 73 | 75 |
| 74 void InterpreterAssembler::SetAccumulator(Node* value) { accumulator_ = value; } | 76 void InterpreterAssembler::SetAccumulator(Node* value) { accumulator_ = value; } |
| 75 | 77 |
| 76 | 78 |
| 77 Node* InterpreterAssembler::GetContext() { return context_; } | 79 Node* InterpreterAssembler::GetContext() { return context_; } |
| 78 | 80 |
| 79 | 81 |
| 80 void InterpreterAssembler::SetContext(Node* value) { context_ = value; } | 82 void InterpreterAssembler::SetContext(Node* value) { context_ = value; } |
| 81 | 83 |
| 82 | 84 |
| 85 Node* InterpreterAssembler::BytecodeOffset() { return bytecode_offset_; } |
| 86 |
| 87 |
| 83 Node* InterpreterAssembler::RegisterFileRawPointer() { | 88 Node* InterpreterAssembler::RegisterFileRawPointer() { |
| 84 return raw_assembler_->Parameter(Linkage::kInterpreterRegisterFileParameter); | 89 return raw_assembler_->Parameter(Linkage::kInterpreterRegisterFileParameter); |
| 85 } | 90 } |
| 86 | 91 |
| 87 | 92 |
| 88 Node* InterpreterAssembler::BytecodeArrayTaggedPointer() { | 93 Node* InterpreterAssembler::BytecodeArrayTaggedPointer() { |
| 89 return raw_assembler_->Parameter(Linkage::kInterpreterBytecodeArrayParameter); | 94 return raw_assembler_->Parameter(Linkage::kInterpreterBytecodeArrayParameter); |
| 90 } | 95 } |
| 91 | 96 |
| 92 | 97 |
| 93 Node* InterpreterAssembler::BytecodeOffset() { | |
| 94 return raw_assembler_->Parameter( | |
| 95 Linkage::kInterpreterBytecodeOffsetParameter); | |
| 96 } | |
| 97 | |
| 98 | |
| 99 Node* InterpreterAssembler::DispatchTableRawPointer() { | 98 Node* InterpreterAssembler::DispatchTableRawPointer() { |
| 100 return raw_assembler_->Parameter(Linkage::kInterpreterDispatchTableParameter); | 99 return raw_assembler_->Parameter(Linkage::kInterpreterDispatchTableParameter); |
| 101 } | 100 } |
| 102 | 101 |
| 103 | 102 |
| 103 Node* InterpreterAssembler::RegisterLocation(Node* reg_index) { |
| 104 return IntPtrAdd(RegisterFileRawPointer(), RegisterFrameOffset(reg_index)); |
| 105 } |
| 106 |
| 107 |
| 108 Node* InterpreterAssembler::LoadRegister(int offset) { |
| 109 return raw_assembler_->Load(kMachAnyTagged, RegisterFileRawPointer(), |
| 110 Int32Constant(offset)); |
| 111 } |
| 112 |
| 113 |
| 114 Node* InterpreterAssembler::LoadRegister(interpreter::Register reg) { |
| 115 return LoadRegister(reg.ToOperand() << kPointerSizeLog2); |
| 116 } |
| 117 |
| 118 |
| 104 Node* InterpreterAssembler::RegisterFrameOffset(Node* index) { | 119 Node* InterpreterAssembler::RegisterFrameOffset(Node* index) { |
| 105 return WordShl(index, kPointerSizeLog2); | 120 return WordShl(index, kPointerSizeLog2); |
| 106 } | 121 } |
| 107 | 122 |
| 108 | 123 |
| 109 Node* InterpreterAssembler::RegisterLocation(Node* reg_index) { | |
| 110 return IntPtrAdd(RegisterFileRawPointer(), RegisterFrameOffset(reg_index)); | |
| 111 } | |
| 112 | |
| 113 | |
| 114 Node* InterpreterAssembler::LoadRegister(interpreter::Register reg) { | |
| 115 return raw_assembler_->Load( | |
| 116 kMachAnyTagged, RegisterFileRawPointer(), | |
| 117 RegisterFrameOffset(Int32Constant(reg.ToOperand()))); | |
| 118 } | |
| 119 | |
| 120 | |
| 121 Node* InterpreterAssembler::LoadRegister(Node* reg_index) { | 124 Node* InterpreterAssembler::LoadRegister(Node* reg_index) { |
| 122 return raw_assembler_->Load(kMachAnyTagged, RegisterFileRawPointer(), | 125 return raw_assembler_->Load(kMachAnyTagged, RegisterFileRawPointer(), |
| 123 RegisterFrameOffset(reg_index)); | 126 RegisterFrameOffset(reg_index)); |
| 124 } | 127 } |
| 125 | 128 |
| 126 | 129 |
| 130 Node* InterpreterAssembler::StoreRegister(Node* value, int offset) { |
| 131 return raw_assembler_->Store(kMachAnyTagged, RegisterFileRawPointer(), |
| 132 Int32Constant(offset), value, kNoWriteBarrier); |
| 133 } |
| 134 |
| 135 |
| 136 Node* InterpreterAssembler::StoreRegister(Node* value, |
| 137 interpreter::Register reg) { |
| 138 return StoreRegister(value, reg.ToOperand() << kPointerSizeLog2); |
| 139 } |
| 140 |
| 141 |
| 127 Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) { | 142 Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) { |
| 128 return raw_assembler_->Store(kMachAnyTagged, RegisterFileRawPointer(), | 143 return raw_assembler_->Store(kMachAnyTagged, RegisterFileRawPointer(), |
| 129 RegisterFrameOffset(reg_index), value, | 144 RegisterFrameOffset(reg_index), value, |
| 130 kNoWriteBarrier); | 145 kNoWriteBarrier); |
| 131 } | 146 } |
| 132 | 147 |
| 133 | 148 |
| 134 Node* InterpreterAssembler::BytecodeOperand(int operand_index) { | 149 Node* InterpreterAssembler::BytecodeOperand(int operand_index) { |
| 135 DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_)); | 150 DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_)); |
| 136 DCHECK_EQ(interpreter::OperandSize::kByte, | 151 DCHECK_EQ(interpreter::OperandSize::kByte, |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 387 |
| 373 Node* code_target = HeapConstant(callable.code()); | 388 Node* code_target = HeapConstant(callable.code()); |
| 374 | 389 |
| 375 Node** args = zone()->NewArray<Node*>(5); | 390 Node** args = zone()->NewArray<Node*>(5); |
| 376 args[0] = arg_count; | 391 args[0] = arg_count; |
| 377 args[1] = new_target; | 392 args[1] = new_target; |
| 378 args[2] = constructor; | 393 args[2] = constructor; |
| 379 args[3] = first_arg; | 394 args[3] = first_arg; |
| 380 args[4] = GetContext(); | 395 args[4] = GetContext(); |
| 381 | 396 |
| 382 return CallN(descriptor, code_target, args); | 397 return CallN(descriptor, code_target, args, |
| 398 SaveAccumulatorMode::kClobberAccumulator); |
| 399 } |
| 400 |
| 401 |
| 402 void InterpreterAssembler::CallPrologue( |
| 403 SaveAccumulatorMode save_accumulator_mode) { |
| 404 if (save_accumulator_mode == SaveAccumulatorMode::kSaveAccumulator) { |
| 405 StoreRegister( |
| 406 accumulator_, |
| 407 InterpreterFrameConstants::kSavedAccumulatorFromRegisterPointer); |
| 408 } else { |
| 409 DCHECK(save_accumulator_mode == SaveAccumulatorMode::kClobberAccumulator); |
| 410 } |
| 411 |
| 412 StoreRegister(SmiTag(bytecode_offset_), |
| 413 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer); |
| 414 } |
| 415 |
| 416 |
| 417 void InterpreterAssembler::CallEpilogue( |
| 418 SaveAccumulatorMode save_accumulator_mode) { |
| 419 // Restore the bytecode offset from the stack frame. |
| 420 bytecode_offset_ = SmiUntag(LoadRegister( |
| 421 InterpreterFrameConstants::kBytecodeOffsetFromRegisterPointer)); |
| 422 |
| 423 if (save_accumulator_mode == SaveAccumulatorMode::kSaveAccumulator) { |
| 424 // Restore accumulator from stack frame. |
| 425 accumulator_ = LoadRegister( |
| 426 InterpreterFrameConstants::kSavedAccumulatorFromRegisterPointer); |
| 427 } else { |
| 428 // Clobber the accumulator. |
| 429 DCHECK(save_accumulator_mode == SaveAccumulatorMode::kClobberAccumulator); |
| 430 accumulator_ = nullptr; |
| 431 } |
| 383 } | 432 } |
| 384 | 433 |
| 385 | 434 |
| 386 Node* InterpreterAssembler::CallN(CallDescriptor* descriptor, Node* code_target, | 435 Node* InterpreterAssembler::CallN(CallDescriptor* descriptor, Node* code_target, |
| 387 Node** args) { | 436 Node** args, |
| 437 SaveAccumulatorMode save_accumulator_mode) { |
| 438 CallPrologue(save_accumulator_mode); |
| 439 |
| 388 Node* stack_pointer_before_call = nullptr; | 440 Node* stack_pointer_before_call = nullptr; |
| 389 if (FLAG_debug_code) { | 441 if (FLAG_debug_code) { |
| 390 stack_pointer_before_call = raw_assembler_->LoadStackPointer(); | 442 stack_pointer_before_call = raw_assembler_->LoadStackPointer(); |
| 391 } | 443 } |
| 392 Node* return_val = raw_assembler_->CallN(descriptor, code_target, args); | 444 Node* return_val = raw_assembler_->CallN(descriptor, code_target, args); |
| 393 if (FLAG_debug_code) { | 445 if (FLAG_debug_code) { |
| 394 Node* stack_pointer_after_call = raw_assembler_->LoadStackPointer(); | 446 Node* stack_pointer_after_call = raw_assembler_->LoadStackPointer(); |
| 395 AbortIfWordNotEqual(stack_pointer_before_call, stack_pointer_after_call, | 447 AbortIfWordNotEqual(stack_pointer_before_call, stack_pointer_after_call, |
| 396 kUnexpectedStackPointer); | 448 kUnexpectedStackPointer); |
| 397 } | 449 } |
| 450 |
| 451 CallEpilogue(save_accumulator_mode); |
| 398 return return_val; | 452 return return_val; |
| 399 } | 453 } |
| 400 | 454 |
| 401 | 455 |
| 402 Node* InterpreterAssembler::CallJS(Node* function, Node* first_arg, | 456 Node* InterpreterAssembler::CallJS(Node* function, Node* first_arg, |
| 403 Node* arg_count) { | 457 Node* arg_count) { |
| 404 Callable callable = CodeFactory::InterpreterPushArgsAndCall(isolate()); | 458 Callable callable = CodeFactory::InterpreterPushArgsAndCall(isolate()); |
| 405 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | 459 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
| 406 isolate(), zone(), callable.descriptor(), 0, CallDescriptor::kNoFlags); | 460 isolate(), zone(), callable.descriptor(), 0, CallDescriptor::kNoFlags); |
| 407 | 461 |
| 408 Node* code_target = HeapConstant(callable.code()); | 462 Node* code_target = HeapConstant(callable.code()); |
| 409 | 463 |
| 410 Node** args = zone()->NewArray<Node*>(4); | 464 Node** args = zone()->NewArray<Node*>(4); |
| 411 args[0] = arg_count; | 465 args[0] = arg_count; |
| 412 args[1] = first_arg; | 466 args[1] = first_arg; |
| 413 args[2] = function; | 467 args[2] = function; |
| 414 args[3] = GetContext(); | 468 args[3] = GetContext(); |
| 415 | 469 |
| 416 return CallN(descriptor, code_target, args); | 470 return CallN(descriptor, code_target, args, |
| 471 SaveAccumulatorMode::kClobberAccumulator); |
| 417 } | 472 } |
| 418 | 473 |
| 419 | 474 |
| 420 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, | 475 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, |
| 421 Node* target, Node** args) { | 476 Node* target, Node** args, |
| 477 SaveAccumulatorMode save_accumulator_mode) { |
| 422 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( | 478 CallDescriptor* call_descriptor = Linkage::GetStubCallDescriptor( |
| 423 isolate(), zone(), descriptor, 0, CallDescriptor::kNoFlags); | 479 isolate(), zone(), descriptor, 0, CallDescriptor::kNoFlags); |
| 424 return CallN(call_descriptor, target, args); | 480 return CallN(call_descriptor, target, args, save_accumulator_mode); |
| 425 } | 481 } |
| 426 | 482 |
| 427 | 483 |
| 428 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, | 484 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, |
| 429 Node* target, Node* arg1, Node* arg2, | 485 Node* target, Node* arg1, Node* arg2, |
| 430 Node* arg3) { | 486 Node* arg3, |
| 487 SaveAccumulatorMode save_accumulator_mode) { |
| 431 Node** args = zone()->NewArray<Node*>(4); | 488 Node** args = zone()->NewArray<Node*>(4); |
| 432 args[0] = arg1; | 489 args[0] = arg1; |
| 433 args[1] = arg2; | 490 args[1] = arg2; |
| 434 args[2] = arg3; | 491 args[2] = arg3; |
| 435 args[3] = GetContext(); | 492 args[3] = GetContext(); |
| 436 return CallIC(descriptor, target, args); | 493 return CallIC(descriptor, target, args, save_accumulator_mode); |
| 437 } | 494 } |
| 438 | 495 |
| 439 | 496 |
| 440 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, | 497 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, |
| 441 Node* target, Node* arg1, Node* arg2, | 498 Node* target, Node* arg1, Node* arg2, |
| 442 Node* arg3, Node* arg4) { | 499 Node* arg3, Node* arg4, |
| 500 SaveAccumulatorMode save_accumulator_mode) { |
| 443 Node** args = zone()->NewArray<Node*>(5); | 501 Node** args = zone()->NewArray<Node*>(5); |
| 444 args[0] = arg1; | 502 args[0] = arg1; |
| 445 args[1] = arg2; | 503 args[1] = arg2; |
| 446 args[2] = arg3; | 504 args[2] = arg3; |
| 447 args[3] = arg4; | 505 args[3] = arg4; |
| 448 args[4] = GetContext(); | 506 args[4] = GetContext(); |
| 449 return CallIC(descriptor, target, args); | 507 return CallIC(descriptor, target, args, save_accumulator_mode); |
| 450 } | 508 } |
| 451 | 509 |
| 452 | 510 |
| 453 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, | 511 Node* InterpreterAssembler::CallIC(CallInterfaceDescriptor descriptor, |
| 454 Node* target, Node* arg1, Node* arg2, | 512 Node* target, Node* arg1, Node* arg2, |
| 455 Node* arg3, Node* arg4, Node* arg5) { | 513 Node* arg3, Node* arg4, Node* arg5, |
| 514 SaveAccumulatorMode save_accumulator_mode) { |
| 456 Node** args = zone()->NewArray<Node*>(6); | 515 Node** args = zone()->NewArray<Node*>(6); |
| 457 args[0] = arg1; | 516 args[0] = arg1; |
| 458 args[1] = arg2; | 517 args[1] = arg2; |
| 459 args[2] = arg3; | 518 args[2] = arg3; |
| 460 args[3] = arg4; | 519 args[3] = arg4; |
| 461 args[4] = arg5; | 520 args[4] = arg5; |
| 462 args[5] = GetContext(); | 521 args[5] = GetContext(); |
| 463 return CallIC(descriptor, target, args); | 522 return CallIC(descriptor, target, args, save_accumulator_mode); |
| 464 } | 523 } |
| 465 | 524 |
| 466 | 525 |
| 467 Node* InterpreterAssembler::CallRuntime(Node* function_id, Node* first_arg, | 526 Node* InterpreterAssembler::CallRuntime( |
| 468 Node* arg_count) { | 527 Node* function_id, Node* first_arg, Node* arg_count, |
| 528 SaveAccumulatorMode save_accumulator_mode) { |
| 469 Callable callable = CodeFactory::InterpreterCEntry(isolate()); | 529 Callable callable = CodeFactory::InterpreterCEntry(isolate()); |
| 470 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( | 530 CallDescriptor* descriptor = Linkage::GetStubCallDescriptor( |
| 471 isolate(), zone(), callable.descriptor(), 0, CallDescriptor::kNoFlags); | 531 isolate(), zone(), callable.descriptor(), 0, CallDescriptor::kNoFlags); |
| 472 | 532 |
| 473 Node* code_target = HeapConstant(callable.code()); | 533 Node* code_target = HeapConstant(callable.code()); |
| 474 | 534 |
| 475 // Get the function entry from the function id. | 535 // Get the function entry from the function id. |
| 476 Node* function_table = raw_assembler_->ExternalConstant( | 536 Node* function_table = raw_assembler_->ExternalConstant( |
| 477 ExternalReference::runtime_function_table_address(isolate())); | 537 ExternalReference::runtime_function_table_address(isolate())); |
| 478 Node* function_offset = raw_assembler_->Int32Mul( | 538 Node* function_offset = raw_assembler_->Int32Mul( |
| 479 function_id, Int32Constant(sizeof(Runtime::Function))); | 539 function_id, Int32Constant(sizeof(Runtime::Function))); |
| 480 Node* function = IntPtrAdd(function_table, function_offset); | 540 Node* function = IntPtrAdd(function_table, function_offset); |
| 481 Node* function_entry = raw_assembler_->Load( | 541 Node* function_entry = raw_assembler_->Load( |
| 482 kMachPtr, function, Int32Constant(offsetof(Runtime::Function, entry))); | 542 kMachPtr, function, Int32Constant(offsetof(Runtime::Function, entry))); |
| 483 | 543 |
| 484 Node** args = zone()->NewArray<Node*>(4); | 544 Node** args = zone()->NewArray<Node*>(4); |
| 485 args[0] = arg_count; | 545 args[0] = arg_count; |
| 486 args[1] = first_arg; | 546 args[1] = first_arg; |
| 487 args[2] = function_entry; | 547 args[2] = function_entry; |
| 488 args[3] = GetContext(); | 548 args[3] = GetContext(); |
| 489 | 549 |
| 490 return CallN(descriptor, code_target, args); | 550 return CallN(descriptor, code_target, args, save_accumulator_mode); |
| 491 } | 551 } |
| 492 | 552 |
| 493 | 553 |
| 494 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, | 554 Node* InterpreterAssembler::CallRuntime( |
| 495 Node* arg1) { | 555 Runtime::FunctionId function_id, Node* arg1, |
| 496 return raw_assembler_->CallRuntime1(function_id, arg1, GetContext()); | 556 SaveAccumulatorMode save_accumulator_mode) { |
| 557 CallPrologue(save_accumulator_mode); |
| 558 Node* return_val = |
| 559 raw_assembler_->CallRuntime1(function_id, arg1, GetContext()); |
| 560 CallEpilogue(save_accumulator_mode); |
| 561 return return_val; |
| 497 } | 562 } |
| 498 | 563 |
| 499 | 564 |
| 500 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, | 565 Node* InterpreterAssembler::CallRuntime( |
| 501 Node* arg1, Node* arg2) { | 566 Runtime::FunctionId function_id, Node* arg1, Node* arg2, |
| 502 return raw_assembler_->CallRuntime2(function_id, arg1, arg2, GetContext()); | 567 SaveAccumulatorMode save_accumulator_mode) { |
| 568 CallPrologue(save_accumulator_mode); |
| 569 Node* return_val = |
| 570 raw_assembler_->CallRuntime2(function_id, arg1, arg2, GetContext()); |
| 571 CallEpilogue(save_accumulator_mode); |
| 572 return return_val; |
| 503 } | 573 } |
| 504 | 574 |
| 505 | 575 |
| 506 Node* InterpreterAssembler::CallRuntime(Runtime::FunctionId function_id, | 576 Node* InterpreterAssembler::CallRuntime( |
| 507 Node* arg1, Node* arg2, Node* arg3, | 577 Runtime::FunctionId function_id, Node* arg1, Node* arg2, Node* arg3, |
| 508 Node* arg4) { | 578 Node* arg4, SaveAccumulatorMode save_accumulator_mode) { |
| 509 return raw_assembler_->CallRuntime4(function_id, arg1, arg2, arg3, arg4, | 579 CallPrologue(save_accumulator_mode); |
| 510 GetContext()); | 580 Node* return_val = raw_assembler_->CallRuntime4(function_id, arg1, arg2, arg3, |
| 581 arg4, GetContext()); |
| 582 CallEpilogue(save_accumulator_mode); |
| 583 return return_val; |
| 511 } | 584 } |
| 512 | 585 |
| 513 | 586 |
| 514 void InterpreterAssembler::Return() { | 587 void InterpreterAssembler::Return() { |
| 515 Node* exit_trampoline_code_object = | 588 Node* exit_trampoline_code_object = |
| 516 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); | 589 HeapConstant(isolate()->builtins()->InterpreterExitTrampoline()); |
| 517 // If the order of the parameters you need to change the call signature below. | 590 // If the order of the parameters you need to change the call signature below. |
| 518 STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter); | 591 STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter); |
| 519 STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter); | 592 STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter); |
| 520 STATIC_ASSERT(2 == Linkage::kInterpreterBytecodeOffsetParameter); | 593 STATIC_ASSERT(2 == Linkage::kInterpreterBytecodeOffsetParameter); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 new_bytecode_offset, | 657 new_bytecode_offset, |
| 585 BytecodeArrayTaggedPointer(), | 658 BytecodeArrayTaggedPointer(), |
| 586 DispatchTableRawPointer(), | 659 DispatchTableRawPointer(), |
| 587 GetContext() }; | 660 GetContext() }; |
| 588 raw_assembler_->TailCallN(call_descriptor(), target_code_object, args); | 661 raw_assembler_->TailCallN(call_descriptor(), target_code_object, args); |
| 589 } | 662 } |
| 590 | 663 |
| 591 | 664 |
| 592 void InterpreterAssembler::Abort(BailoutReason bailout_reason) { | 665 void InterpreterAssembler::Abort(BailoutReason bailout_reason) { |
| 593 Node* abort_id = SmiTag(Int32Constant(bailout_reason)); | 666 Node* abort_id = SmiTag(Int32Constant(bailout_reason)); |
| 594 CallRuntime(Runtime::kAbort, abort_id); | 667 Node* ret_value = CallRuntime(Runtime::kAbort, abort_id); |
| 595 Return(); | 668 // Unreached, but keeps turbofan happy. |
| 669 raw_assembler_->Return(ret_value); |
| 596 } | 670 } |
| 597 | 671 |
| 598 | 672 |
| 599 void InterpreterAssembler::AbortIfWordNotEqual(Node* lhs, Node* rhs, | 673 void InterpreterAssembler::AbortIfWordNotEqual(Node* lhs, Node* rhs, |
| 600 BailoutReason bailout_reason) { | 674 BailoutReason bailout_reason) { |
| 601 RawMachineLabel match, no_match; | 675 RawMachineLabel match, no_match; |
| 602 Node* condition = raw_assembler_->WordEqual(lhs, rhs); | 676 Node* condition = raw_assembler_->WordEqual(lhs, rhs); |
| 603 raw_assembler_->Branch(condition, &match, &no_match); | 677 raw_assembler_->Branch(condition, &match, &no_match); |
| 604 raw_assembler_->Bind(&no_match); | 678 raw_assembler_->Bind(&no_match); |
| 605 Abort(bailout_reason); | 679 Abort(bailout_reason); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 632 return raw_assembler_->call_descriptor(); | 706 return raw_assembler_->call_descriptor(); |
| 633 } | 707 } |
| 634 | 708 |
| 635 | 709 |
| 636 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } | 710 Zone* InterpreterAssembler::zone() { return raw_assembler_->zone(); } |
| 637 | 711 |
| 638 | 712 |
| 639 } // namespace compiler | 713 } // namespace compiler |
| 640 } // namespace internal | 714 } // namespace internal |
| 641 } // namespace v8 | 715 } // namespace v8 |
| OLD | NEW |