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

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

Issue 1254293006: [interpreter] Change interpreter to use an BytecodeArray pointer and and offset. (Closed) Base URL: ssh://rmcilroy.lon.corp.google.com///usr/local/google/code/v8_full/v8@master
Patch Set: Fix MIPS merge error Created 5 years, 4 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/compiler/interpreter-assembler.h ('k') | src/compiler/linkage.h » ('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/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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 code->Disassemble(interpreter::Bytecodes::ToString(bytecode_), os); 53 code->Disassemble(interpreter::Bytecodes::ToString(bytecode_), os);
54 os << std::flush; 54 os << std::flush;
55 } 55 }
56 #endif 56 #endif
57 57
58 code_generated_ = true; 58 code_generated_ = true;
59 return code; 59 return code;
60 } 60 }
61 61
62 62
63 Node* InterpreterAssembler::BytecodePointer() { 63 Node* InterpreterAssembler::BytecodeArrayPointer() {
64 return raw_assembler_->Parameter(Linkage::kInterpreterBytecodeParameter); 64 return raw_assembler_->Parameter(Linkage::kInterpreterBytecodeArrayParameter);
65 } 65 }
66 66
67 67
68 Node* InterpreterAssembler::BytecodeOffset() {
69 return raw_assembler_->Parameter(
70 Linkage::kInterpreterBytecodeOffsetParameter);
71 }
72
73
68 Node* InterpreterAssembler::DispatchTablePointer() { 74 Node* InterpreterAssembler::DispatchTablePointer() {
69 return raw_assembler_->Parameter(Linkage::kInterpreterDispatchTableParameter); 75 return raw_assembler_->Parameter(Linkage::kInterpreterDispatchTableParameter);
70 } 76 }
71 77
72 78
73 Node* InterpreterAssembler::FramePointer() { 79 Node* InterpreterAssembler::FramePointer() {
74 return raw_assembler_->LoadFramePointer(); 80 return raw_assembler_->LoadFramePointer();
75 } 81 }
76 82
77 83
78 Node* InterpreterAssembler::RegisterFrameOffset(int index) { 84 Node* InterpreterAssembler::RegisterFrameOffset(int index) {
79 DCHECK_LE(index, kMaxRegisterIndex); 85 DCHECK_LE(index, kMaxRegisterIndex);
80 return Int32Constant(kFirstRegisterOffsetFromFp - 86 return Int32Constant(kFirstRegisterOffsetFromFp -
81 (index << kPointerSizeLog2)); 87 (index << kPointerSizeLog2));
82 } 88 }
83 89
84 90
85 Node* InterpreterAssembler::RegisterFrameOffset(Node* index) { 91 Node* InterpreterAssembler::RegisterFrameOffset(Node* index) {
86 return raw_assembler_->Int32Sub( 92 return raw_assembler_->Int32Sub(
87 Int32Constant(kFirstRegisterOffsetFromFp), 93 Int32Constant(kFirstRegisterOffsetFromFp),
88 raw_assembler_->Word32Shl(index, Int32Constant(kPointerSizeLog2))); 94 raw_assembler_->Word32Shl(index, Int32Constant(kPointerSizeLog2)));
89 } 95 }
90 96
91 97
92 Node* InterpreterAssembler::BytecodeArg(int delta) { 98 Node* InterpreterAssembler::BytecodeArg(int delta) {
93 DCHECK_LT(delta, interpreter::Bytecodes::NumberOfArguments(bytecode_)); 99 DCHECK_LT(delta, interpreter::Bytecodes::NumberOfArguments(bytecode_));
94 return raw_assembler_->Load(kMachUint8, BytecodePointer(), 100 return raw_assembler_->Load(
95 Int32Constant(1 + delta)); 101 kMachUint8, BytecodeArrayPointer(),
102 raw_assembler_->IntPtrAdd(BytecodeOffset(), Int32Constant(1 + delta)));
96 } 103 }
97 104
98 105
99 Node* InterpreterAssembler::LoadRegister(int index) { 106 Node* InterpreterAssembler::LoadRegister(int index) {
100 return raw_assembler_->Load(kMachPtr, FramePointer(), 107 return raw_assembler_->Load(kMachPtr, FramePointer(),
101 RegisterFrameOffset(index)); 108 RegisterFrameOffset(index));
102 } 109 }
103 110
104 111
105 Node* InterpreterAssembler::LoadRegister(Node* index) { 112 Node* InterpreterAssembler::LoadRegister(Node* index) {
106 return raw_assembler_->Load(kMachPtr, FramePointer(), 113 return raw_assembler_->Load(kMachPtr, FramePointer(),
107 RegisterFrameOffset(index)); 114 RegisterFrameOffset(index));
108 } 115 }
109 116
110 117
111 Node* InterpreterAssembler::StoreRegister(Node* value, int index) { 118 Node* InterpreterAssembler::StoreRegister(Node* value, int index) {
112 return raw_assembler_->Store(kMachPtr, FramePointer(), 119 return raw_assembler_->Store(kMachPtr, FramePointer(),
113 RegisterFrameOffset(index), value); 120 RegisterFrameOffset(index), value);
114 } 121 }
115 122
116 123
117 Node* InterpreterAssembler::StoreRegister(Node* value, Node* index) { 124 Node* InterpreterAssembler::StoreRegister(Node* value, Node* index) {
118 return raw_assembler_->Store(kMachPtr, FramePointer(), 125 return raw_assembler_->Store(kMachPtr, FramePointer(),
119 RegisterFrameOffset(index), value); 126 RegisterFrameOffset(index), value);
120 } 127 }
121 128
122 129
123 Node* InterpreterAssembler::Advance(int delta) { 130 Node* InterpreterAssembler::Advance(int delta) {
124 return raw_assembler_->IntPtrAdd(BytecodePointer(), Int32Constant(delta)); 131 return raw_assembler_->IntPtrAdd(BytecodeOffset(), Int32Constant(delta));
125 } 132 }
126 133
127 134
128 void InterpreterAssembler::Dispatch() { 135 void InterpreterAssembler::Dispatch() {
129 Node* new_bytecode_pointer = Advance(interpreter::Bytecodes::Size(bytecode_)); 136 Node* new_bytecode_offset = Advance(interpreter::Bytecodes::Size(bytecode_));
130 Node* target_bytecode = 137 Node* target_bytecode = raw_assembler_->Load(
131 raw_assembler_->Load(kMachUint8, new_bytecode_pointer); 138 kMachUint8, BytecodeArrayPointer(), new_bytecode_offset);
132 139
133 // TODO(rmcilroy): Create a code target dispatch table to avoid conversion 140 // TODO(rmcilroy): Create a code target dispatch table to avoid conversion
134 // from code object on every dispatch. 141 // from code object on every dispatch.
135 Node* target_code_object = raw_assembler_->Load( 142 Node* target_code_object = raw_assembler_->Load(
136 kMachPtr, DispatchTablePointer(), 143 kMachPtr, DispatchTablePointer(),
137 raw_assembler_->Word32Shl(target_bytecode, 144 raw_assembler_->Word32Shl(target_bytecode,
138 Int32Constant(kPointerSizeLog2))); 145 Int32Constant(kPointerSizeLog2)));
139 146
140 // If the order of the parameters you need to change the call signature below. 147 // If the order of the parameters you need to change the call signature below.
141 STATIC_ASSERT(0 == Linkage::kInterpreterBytecodeParameter); 148 STATIC_ASSERT(0 == Linkage::kInterpreterBytecodeOffsetParameter);
142 STATIC_ASSERT(1 == Linkage::kInterpreterDispatchTableParameter); 149 STATIC_ASSERT(1 == Linkage::kInterpreterBytecodeArrayParameter);
143 Node* tail_call = graph()->NewNode(common()->TailCall(call_descriptor()), 150 STATIC_ASSERT(2 == Linkage::kInterpreterDispatchTableParameter);
144 target_code_object, new_bytecode_pointer, 151 Node* tail_call = graph()->NewNode(
145 DispatchTablePointer(), graph()->start(), 152 common()->TailCall(call_descriptor()), target_code_object,
146 graph()->start()); 153 new_bytecode_offset, BytecodeArrayPointer(), DispatchTablePointer(),
154 graph()->start(), graph()->start());
147 schedule()->AddTailCall(raw_assembler_->CurrentBlock(), tail_call); 155 schedule()->AddTailCall(raw_assembler_->CurrentBlock(), tail_call);
148 156
149 // This should always be the end node. 157 // This should always be the end node.
150 SetEndInput(tail_call); 158 SetEndInput(tail_call);
151 } 159 }
152 160
153 161
154 void InterpreterAssembler::SetEndInput(Node* input) { 162 void InterpreterAssembler::SetEndInput(Node* input) {
155 DCHECK(!end_node_); 163 DCHECK(!end_node_);
156 end_node_ = input; 164 end_node_ = input;
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 206
199 207
200 Node* InterpreterAssembler::NumberConstant(double value) { 208 Node* InterpreterAssembler::NumberConstant(double value) {
201 return raw_assembler_->NumberConstant(value); 209 return raw_assembler_->NumberConstant(value);
202 } 210 }
203 211
204 212
205 } // namespace interpreter 213 } // namespace interpreter
206 } // namespace internal 214 } // namespace internal
207 } // namespace v8 215 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/interpreter-assembler.h ('k') | src/compiler/linkage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698