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

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

Issue 1294793002: [Interpreter] Add implementations for load immediate bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@interpreter_accum
Patch Set: Rebased 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/interpreter/interpreter.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/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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 RegisterFrameOffset(reg_index)); 103 RegisterFrameOffset(reg_index));
104 } 104 }
105 105
106 106
107 Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) { 107 Node* InterpreterAssembler::StoreRegister(Node* value, Node* reg_index) {
108 return raw_assembler_->Store(kMachPtr, RegisterFileRawPointer(), 108 return raw_assembler_->Store(kMachPtr, RegisterFileRawPointer(),
109 RegisterFrameOffset(reg_index), value); 109 RegisterFrameOffset(reg_index), value);
110 } 110 }
111 111
112 112
113 Node* InterpreterAssembler::BytecodeOperand(int delta) { 113 Node* InterpreterAssembler::BytecodeOperand(int operand_index) {
114 DCHECK_LT(delta, interpreter::Bytecodes::NumberOfOperands(bytecode_)); 114 DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_));
115 return raw_assembler_->Load( 115 return raw_assembler_->Load(
116 kMachUint8, BytecodeArrayTaggedPointer(), 116 kMachUint8, BytecodeArrayTaggedPointer(),
117 raw_assembler_->IntPtrAdd(BytecodeOffset(), Int32Constant(1 + delta))); 117 raw_assembler_->IntPtrAdd(BytecodeOffset(),
118 Int32Constant(1 + operand_index)));
118 } 119 }
119 120
120 121
121 Node* InterpreterAssembler::BytecodeOperandSignExtended(int delta) { 122 Node* InterpreterAssembler::BytecodeOperandSignExtended(int operand_index) {
122 DCHECK_LT(delta, interpreter::Bytecodes::NumberOfOperands(bytecode_)); 123 DCHECK_LT(operand_index, interpreter::Bytecodes::NumberOfOperands(bytecode_));
123 Node* load = raw_assembler_->Load( 124 Node* load = raw_assembler_->Load(
124 kMachInt8, BytecodeArrayTaggedPointer(), 125 kMachInt8, BytecodeArrayTaggedPointer(),
125 raw_assembler_->IntPtrAdd(BytecodeOffset(), Int32Constant(1 + delta))); 126 raw_assembler_->IntPtrAdd(BytecodeOffset(),
127 Int32Constant(1 + operand_index)));
126 // Ensure that we sign extend to full pointer size 128 // Ensure that we sign extend to full pointer size
127 if (kPointerSize == 8) { 129 if (kPointerSize == 8) {
128 load = raw_assembler_->ChangeInt32ToInt64(load); 130 load = raw_assembler_->ChangeInt32ToInt64(load);
129 } 131 }
130 return load; 132 return load;
131 } 133 }
132 134
133 135
136 Node* InterpreterAssembler::BytecodeOperandImm8(int operand_index) {
137 DCHECK_EQ(interpreter::OperandType::kImm8,
138 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index));
139 return BytecodeOperandSignExtended(operand_index);
140 }
141
142
143 Node* InterpreterAssembler::BytecodeOperandReg(int operand_index) {
144 DCHECK_EQ(interpreter::OperandType::kReg,
145 interpreter::Bytecodes::GetOperandType(bytecode_, operand_index));
146 return BytecodeOperandSignExtended(operand_index);
147 }
148
149
150 Node* InterpreterAssembler::Int32Constant(int value) {
151 return raw_assembler_->Int32Constant(value);
152 }
153
154
155 Node* InterpreterAssembler::NumberConstant(double value) {
156 return raw_assembler_->NumberConstant(value);
157 }
158
159
160 Node* InterpreterAssembler::HeapConstant(Unique<HeapObject> object) {
161 return raw_assembler_->HeapConstant(object);
162 }
163
164
165 Node* InterpreterAssembler::SmiShiftBitsConstant() {
166 return Int32Constant(kSmiShiftSize + kSmiTagSize);
167 }
168
169
170 Node* InterpreterAssembler::SmiTag(Node* value) {
171 return raw_assembler_->WordShl(value, SmiShiftBitsConstant());
172 }
173
174
175 Node* InterpreterAssembler::SmiUntag(Node* value) {
176 return raw_assembler_->WordSar(value, SmiShiftBitsConstant());
177 }
178
179
134 void InterpreterAssembler::Return() { 180 void InterpreterAssembler::Return() {
135 Node* exit_trampoline_code_object = 181 Node* exit_trampoline_code_object =
136 HeapConstant(Unique<HeapObject>::CreateImmovable( 182 HeapConstant(Unique<HeapObject>::CreateImmovable(
137 isolate()->builtins()->InterpreterExitTrampoline())); 183 isolate()->builtins()->InterpreterExitTrampoline()));
138 // If the order of the parameters you need to change the call signature below. 184 // If the order of the parameters you need to change the call signature below.
139 STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter); 185 STATIC_ASSERT(0 == Linkage::kInterpreterAccumulatorParameter);
140 STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter); 186 STATIC_ASSERT(1 == Linkage::kInterpreterRegisterFileParameter);
141 STATIC_ASSERT(2 == Linkage::kInterpreterBytecodeOffsetParameter); 187 STATIC_ASSERT(2 == Linkage::kInterpreterBytecodeOffsetParameter);
142 STATIC_ASSERT(3 == Linkage::kInterpreterBytecodeArrayParameter); 188 STATIC_ASSERT(3 == Linkage::kInterpreterBytecodeArrayParameter);
143 STATIC_ASSERT(4 == Linkage::kInterpreterDispatchTableParameter); 189 STATIC_ASSERT(4 == Linkage::kInterpreterDispatchTableParameter);
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 CallDescriptor* InterpreterAssembler::call_descriptor() const { 252 CallDescriptor* InterpreterAssembler::call_descriptor() const {
207 return raw_assembler_->call_descriptor(); 253 return raw_assembler_->call_descriptor();
208 } 254 }
209 255
210 256
211 Schedule* InterpreterAssembler::schedule() { 257 Schedule* InterpreterAssembler::schedule() {
212 return raw_assembler_->schedule(); 258 return raw_assembler_->schedule();
213 } 259 }
214 260
215 261
216 Node* InterpreterAssembler::Int32Constant(int value) {
217 return raw_assembler_->Int32Constant(value);
218 }
219
220
221 Node* InterpreterAssembler::NumberConstant(double value) {
222 return raw_assembler_->NumberConstant(value);
223 }
224
225
226 Node* InterpreterAssembler::HeapConstant(Unique<HeapObject> object) {
227 return raw_assembler_->HeapConstant(object);
228 }
229 262
230 } // namespace interpreter 263 } // namespace interpreter
231 } // namespace internal 264 } // namespace internal
232 } // namespace v8 265 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/interpreter-assembler.h ('k') | src/interpreter/interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698