Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: src/interpreter/interpreter-assembler.cc

Issue 1882073002: [Interpreter] Make dispatch table point to code entry instead of code objects. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix visiting dispatch table. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/interpreter-assembler.h ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-assembler.h" 5 #include "src/interpreter/interpreter-assembler.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "src/code-factory.h" 10 #include "src/code-factory.h"
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 Node* target_bytecode = Load( 552 Node* target_bytecode = Load(
553 MachineType::Uint8(), BytecodeArrayTaggedPointer(), new_bytecode_offset); 553 MachineType::Uint8(), BytecodeArrayTaggedPointer(), new_bytecode_offset);
554 if (kPointerSize == 8) { 554 if (kPointerSize == 8) {
555 target_bytecode = ChangeUint32ToUint64(target_bytecode); 555 target_bytecode = ChangeUint32ToUint64(target_bytecode);
556 } 556 }
557 557
558 if (FLAG_trace_ignition_dispatches) { 558 if (FLAG_trace_ignition_dispatches) {
559 TraceBytecodeDispatch(target_bytecode); 559 TraceBytecodeDispatch(target_bytecode);
560 } 560 }
561 561
562 // TODO(rmcilroy): Create a code target dispatch table to avoid conversion 562 Node* target_code_entry =
563 // from code object on every dispatch.
564 Node* target_code_object =
565 Load(MachineType::Pointer(), DispatchTableRawPointer(), 563 Load(MachineType::Pointer(), DispatchTableRawPointer(),
566 WordShl(target_bytecode, IntPtrConstant(kPointerSizeLog2))); 564 WordShl(target_bytecode, IntPtrConstant(kPointerSizeLog2)));
567 565
568 DispatchToBytecodeHandler(target_code_object, new_bytecode_offset); 566 DispatchToBytecodeHandlerEntry(target_code_entry, new_bytecode_offset);
569 } 567 }
570 568
571 void InterpreterAssembler::DispatchToBytecodeHandler(Node* handler, 569 void InterpreterAssembler::DispatchToBytecodeHandler(Node* handler,
572 Node* bytecode_offset) { 570 Node* bytecode_offset) {
571 Node* handler_entry =
572 IntPtrAdd(handler, IntPtrConstant(Code::kHeaderSize - kHeapObjectTag));
573 DispatchToBytecodeHandlerEntry(handler_entry, bytecode_offset);
574 }
575
576 void InterpreterAssembler::DispatchToBytecodeHandlerEntry(
577 Node* handler_entry, Node* bytecode_offset) {
573 if (FLAG_trace_ignition) { 578 if (FLAG_trace_ignition) {
574 TraceBytecode(Runtime::kInterpreterTraceBytecodeExit); 579 TraceBytecode(Runtime::kInterpreterTraceBytecodeExit);
575 } 580 }
576 581
577 InterpreterDispatchDescriptor descriptor(isolate()); 582 InterpreterDispatchDescriptor descriptor(isolate());
578 Node* args[] = {GetAccumulatorUnchecked(), RegisterFileRawPointer(), 583 Node* args[] = {GetAccumulatorUnchecked(), RegisterFileRawPointer(),
579 bytecode_offset, BytecodeArrayTaggedPointer(), 584 bytecode_offset, BytecodeArrayTaggedPointer(),
580 DispatchTableRawPointer(), GetContext()}; 585 DispatchTableRawPointer(), GetContext()};
581 TailCall(descriptor, handler, args, 0); 586 TailCallBytecodeDispatch(descriptor, handler_entry, args);
582 } 587 }
583 588
584 void InterpreterAssembler::DispatchWide(OperandScale operand_scale) { 589 void InterpreterAssembler::DispatchWide(OperandScale operand_scale) {
585 // Dispatching a wide bytecode requires treating the prefix 590 // Dispatching a wide bytecode requires treating the prefix
586 // bytecode a base pointer into the dispatch table and dispatching 591 // bytecode a base pointer into the dispatch table and dispatching
587 // the bytecode that follows relative to this base. 592 // the bytecode that follows relative to this base.
588 // 593 //
589 // Indices 0-255 correspond to bytecodes with operand_scale == 0 594 // Indices 0-255 correspond to bytecodes with operand_scale == 0
590 // Indices 256-511 correspond to bytecodes with operand_scale == 1 595 // Indices 256-511 correspond to bytecodes with operand_scale == 1
591 // Indices 512-767 correspond to bytecodes with operand_scale == 2 596 // Indices 512-767 correspond to bytecodes with operand_scale == 2
(...skipping 14 matching lines...) Expand all
606 base_index = IntPtrConstant(1 << kBitsPerByte); 611 base_index = IntPtrConstant(1 << kBitsPerByte);
607 break; 612 break;
608 case OperandScale::kQuadruple: 613 case OperandScale::kQuadruple:
609 base_index = IntPtrConstant(2 << kBitsPerByte); 614 base_index = IntPtrConstant(2 << kBitsPerByte);
610 break; 615 break;
611 default: 616 default:
612 UNREACHABLE(); 617 UNREACHABLE();
613 base_index = nullptr; 618 base_index = nullptr;
614 } 619 }
615 Node* target_index = IntPtrAdd(base_index, next_bytecode); 620 Node* target_index = IntPtrAdd(base_index, next_bytecode);
616 Node* target_code_object = 621 Node* target_code_entry =
617 Load(MachineType::Pointer(), DispatchTableRawPointer(), 622 Load(MachineType::Pointer(), DispatchTableRawPointer(),
618 WordShl(target_index, kPointerSizeLog2)); 623 WordShl(target_index, kPointerSizeLog2));
619 624
620 DispatchToBytecodeHandler(target_code_object, next_bytecode_offset); 625 DispatchToBytecodeHandlerEntry(target_code_entry, next_bytecode_offset);
621 } 626 }
622 627
623 void InterpreterAssembler::InterpreterReturn() { 628 void InterpreterAssembler::InterpreterReturn() {
624 // TODO(rmcilroy): Investigate whether it is worth supporting self 629 // TODO(rmcilroy): Investigate whether it is worth supporting self
625 // optimization of primitive functions like FullCodegen. 630 // optimization of primitive functions like FullCodegen.
626 631
627 // Update profiling count by -BytecodeOffset to simulate backedge to start of 632 // Update profiling count by -BytecodeOffset to simulate backedge to start of
628 // function. 633 // function.
629 Node* profiling_weight = 634 Node* profiling_weight =
630 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize), 635 Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize),
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 V8_TARGET_ARCH_S390 727 V8_TARGET_ARCH_S390
723 return true; 728 return true;
724 #else 729 #else
725 #error "Unknown Architecture" 730 #error "Unknown Architecture"
726 #endif 731 #endif
727 } 732 }
728 733
729 } // namespace interpreter 734 } // namespace interpreter
730 } // namespace internal 735 } // namespace internal
731 } // namespace v8 736 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter-assembler.h ('k') | src/mips/builtins-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698