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

Side by Side Diff: src/interpreter/bytecode-array-builder.cc

Issue 1323463005: [Interpreter] Add support for JS calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add MIPS port contributed by akos.palfi@imgtec.com Created 5 years, 3 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/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.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/interpreter/bytecode-array-builder.h" 5 #include "src/interpreter/bytecode-array-builder.h"
6 6
7 namespace v8 { 7 namespace v8 {
8 namespace internal { 8 namespace internal {
9 namespace interpreter { 9 namespace interpreter {
10 10
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 return *this; 217 return *this;
218 } 218 }
219 219
220 220
221 BytecodeArrayBuilder& BytecodeArrayBuilder::Return() { 221 BytecodeArrayBuilder& BytecodeArrayBuilder::Return() {
222 Output(Bytecode::kReturn); 222 Output(Bytecode::kReturn);
223 return *this; 223 return *this;
224 } 224 }
225 225
226 226
227 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable,
228 Register receiver,
229 size_t arg_count) {
230 if (FitsInByteOperand(arg_count)) {
231 Output(Bytecode::kCall, callable.ToOperand(), receiver.ToOperand(),
232 static_cast<uint8_t>(arg_count));
233 } else {
234 UNIMPLEMENTED();
235 }
236 return *this;
237 }
238
239
227 size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) { 240 size_t BytecodeArrayBuilder::GetConstantPoolEntry(Handle<Object> object) {
228 // These constants shouldn't be added to the constant pool, the should use 241 // These constants shouldn't be added to the constant pool, the should use
229 // specialzed bytecodes instead. 242 // specialzed bytecodes instead.
230 DCHECK(!object.is_identical_to(isolate_->factory()->undefined_value())); 243 DCHECK(!object.is_identical_to(isolate_->factory()->undefined_value()));
231 DCHECK(!object.is_identical_to(isolate_->factory()->null_value())); 244 DCHECK(!object.is_identical_to(isolate_->factory()->null_value()));
232 DCHECK(!object.is_identical_to(isolate_->factory()->the_hole_value())); 245 DCHECK(!object.is_identical_to(isolate_->factory()->the_hole_value()));
233 DCHECK(!object.is_identical_to(isolate_->factory()->true_value())); 246 DCHECK(!object.is_identical_to(isolate_->factory()->true_value()));
234 DCHECK(!object.is_identical_to(isolate_->factory()->false_value())); 247 DCHECK(!object.is_identical_to(isolate_->factory()->false_value()));
235 248
236 size_t* entry = constants_map_.Find(object); 249 size_t* entry = constants_map_.Find(object);
(...skipping 23 matching lines...) Expand all
260 temporary_register_next_ = reg_index; 273 temporary_register_next_ = reg_index;
261 } 274 }
262 275
263 276
264 bool BytecodeArrayBuilder::OperandIsValid(Bytecode bytecode, int operand_index, 277 bool BytecodeArrayBuilder::OperandIsValid(Bytecode bytecode, int operand_index,
265 uint8_t operand_value) const { 278 uint8_t operand_value) const {
266 OperandType operand_type = Bytecodes::GetOperandType(bytecode, operand_index); 279 OperandType operand_type = Bytecodes::GetOperandType(bytecode, operand_index);
267 switch (operand_type) { 280 switch (operand_type) {
268 case OperandType::kNone: 281 case OperandType::kNone:
269 return false; 282 return false;
283 case OperandType::kCount:
270 case OperandType::kImm8: 284 case OperandType::kImm8:
271 case OperandType::kIdx: 285 case OperandType::kIdx:
272 return true; 286 return true;
273 case OperandType::kReg: { 287 case OperandType::kReg: {
274 Register reg = Register::FromOperand(operand_value); 288 Register reg = Register::FromOperand(operand_value);
275 if (reg.is_parameter()) { 289 if (reg.is_parameter()) {
276 int parameter_index = reg.ToParameterIndex(parameter_count_); 290 int parameter_index = reg.ToParameterIndex(parameter_count_);
277 return parameter_index >= 0 && parameter_index < parameter_count_; 291 return parameter_index >= 0 && parameter_index < parameter_count_;
278 } else { 292 } else {
279 return (reg.index() >= 0 && reg.index() < temporary_register_next_); 293 return (reg.index() >= 0 && reg.index() < temporary_register_next_);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 382
369 Register TemporaryRegisterScope::NewRegister() { 383 Register TemporaryRegisterScope::NewRegister() {
370 count_++; 384 count_++;
371 last_register_index_ = builder_->BorrowTemporaryRegister(); 385 last_register_index_ = builder_->BorrowTemporaryRegister();
372 return Register(last_register_index_); 386 return Register(last_register_index_);
373 } 387 }
374 388
375 } // namespace interpreter 389 } // namespace interpreter
376 } // namespace internal 390 } // namespace internal
377 } // namespace v8 391 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698