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

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

Issue 1400753003: [Interpreter] Add array literal support. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_literal
Patch Set: Created 5 years, 2 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
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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 if (FitsInIdx8Operand(feedback_slot)) { 335 if (FitsInIdx8Operand(feedback_slot)) {
336 Output(bytecode, object.ToOperand(), key.ToOperand(), 336 Output(bytecode, object.ToOperand(), key.ToOperand(),
337 static_cast<uint8_t>(feedback_slot)); 337 static_cast<uint8_t>(feedback_slot));
338 } else { 338 } else {
339 UNIMPLEMENTED(); 339 UNIMPLEMENTED();
340 } 340 }
341 return *this; 341 return *this;
342 } 342 }
343 343
344 344
345 BytecodeArrayBuilder& BytecodeArrayBuilder::GenericStoreKeyedProperty(
346 Register object, Register key) {
347 Output(Bytecode::kKeyedStoreICGeneric, object.ToOperand(), key.ToOperand());
348 return *this;
349 }
350
351
345 BytecodeArrayBuilder& BytecodeArrayBuilder::PushContext(Register context) { 352 BytecodeArrayBuilder& BytecodeArrayBuilder::PushContext(Register context) {
346 Output(Bytecode::kPushContext, context.ToOperand()); 353 Output(Bytecode::kPushContext, context.ToOperand());
347 return *this; 354 return *this;
348 } 355 }
349 356
350 357
351 BytecodeArrayBuilder& BytecodeArrayBuilder::PopContext(Register context) { 358 BytecodeArrayBuilder& BytecodeArrayBuilder::PopContext(Register context) {
352 Output(Bytecode::kPopContext, context.ToOperand()); 359 Output(Bytecode::kPopContext, context.ToOperand());
353 return *this; 360 return *this;
354 } 361 }
355 362
356 363
364 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArrayLiteral(
365 int literal_index, int flags) {
366 DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bytes.
367 if (FitsInIdx8Operand(literal_index)) {
368 Output(Bytecode::kCreateArrayLiteral, static_cast<uint8_t>(literal_index),
369 static_cast<uint8_t>(flags));
370 } else {
371 UNIMPLEMENTED();
372 }
373 return *this;
374 }
375
376
357 BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToBoolean() { 377 BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToBoolean() {
358 if (LastBytecodeInSameBlock()) { 378 if (LastBytecodeInSameBlock()) {
359 // If the previous bytecode puts a boolean in the accumulator 379 // If the previous bytecode puts a boolean in the accumulator
360 // there is no need to emit an instruction. 380 // there is no need to emit an instruction.
361 switch (Bytecodes::FromByte(bytecodes()->at(last_bytecode_start_))) { 381 switch (Bytecodes::FromByte(bytecodes()->at(last_bytecode_start_))) {
362 case Bytecode::kToBoolean: 382 case Bytecode::kToBoolean:
363 UNREACHABLE(); 383 UNREACHABLE();
364 case Bytecode::kLdaTrue: 384 case Bytecode::kLdaTrue:
365 case Bytecode::kLdaFalse: 385 case Bytecode::kLdaFalse:
366 case Bytecode::kLogicalNot: 386 case Bytecode::kLogicalNot:
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
776 796
777 Register TemporaryRegisterScope::NewRegister() { 797 Register TemporaryRegisterScope::NewRegister() {
778 count_++; 798 count_++;
779 last_register_index_ = builder_->BorrowTemporaryRegister(); 799 last_register_index_ = builder_->BorrowTemporaryRegister();
780 return Register(last_register_index_); 800 return Register(last_register_index_);
781 } 801 }
782 802
783 } // namespace interpreter 803 } // namespace interpreter
784 } // namespace internal 804 } // namespace internal
785 } // namespace v8 805 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698