OLD | NEW |
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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 if (FitsInIdx8Operand(literal_index)) { | 364 if (FitsInIdx8Operand(literal_index)) { |
365 Output(Bytecode::kCreateArrayLiteral, static_cast<uint8_t>(literal_index), | 365 Output(Bytecode::kCreateArrayLiteral, static_cast<uint8_t>(literal_index), |
366 static_cast<uint8_t>(flags)); | 366 static_cast<uint8_t>(flags)); |
367 } else { | 367 } else { |
368 UNIMPLEMENTED(); | 368 UNIMPLEMENTED(); |
369 } | 369 } |
370 return *this; | 370 return *this; |
371 } | 371 } |
372 | 372 |
373 | 373 |
| 374 BytecodeArrayBuilder& BytecodeArrayBuilder::CreateObjectLiteral( |
| 375 int literal_index, int flags) { |
| 376 DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bytes. |
| 377 if (FitsInIdx8Operand(literal_index)) { |
| 378 Output(Bytecode::kCreateObjectLiteral, static_cast<uint8_t>(literal_index), |
| 379 static_cast<uint8_t>(flags)); |
| 380 } else { |
| 381 UNIMPLEMENTED(); |
| 382 } |
| 383 return *this; |
| 384 } |
| 385 |
| 386 |
374 BytecodeArrayBuilder& BytecodeArrayBuilder::PushContext(Register context) { | 387 BytecodeArrayBuilder& BytecodeArrayBuilder::PushContext(Register context) { |
375 Output(Bytecode::kPushContext, context.ToOperand()); | 388 Output(Bytecode::kPushContext, context.ToOperand()); |
376 return *this; | 389 return *this; |
377 } | 390 } |
378 | 391 |
379 | 392 |
380 BytecodeArrayBuilder& BytecodeArrayBuilder::PopContext(Register context) { | 393 BytecodeArrayBuilder& BytecodeArrayBuilder::PopContext(Register context) { |
381 Output(Bytecode::kPopContext, context.ToOperand()); | 394 Output(Bytecode::kPopContext, context.ToOperand()); |
382 return *this; | 395 return *this; |
383 } | 396 } |
(...skipping 23 matching lines...) Expand all Loading... |
407 default: | 420 default: |
408 // Fall through to output kToBoolean. | 421 // Fall through to output kToBoolean. |
409 break; | 422 break; |
410 } | 423 } |
411 } | 424 } |
412 Output(Bytecode::kToBoolean); | 425 Output(Bytecode::kToBoolean); |
413 return *this; | 426 return *this; |
414 } | 427 } |
415 | 428 |
416 | 429 |
| 430 BytecodeArrayBuilder& BytecodeArrayBuilder::CastAccumulatorToName() { |
| 431 Output(Bytecode::kToName); |
| 432 return *this; |
| 433 } |
| 434 |
| 435 |
417 BytecodeArrayBuilder& BytecodeArrayBuilder::Bind(BytecodeLabel* label) { | 436 BytecodeArrayBuilder& BytecodeArrayBuilder::Bind(BytecodeLabel* label) { |
418 if (label->is_forward_target()) { | 437 if (label->is_forward_target()) { |
419 // An earlier jump instruction refers to this label. Update it's location. | 438 // An earlier jump instruction refers to this label. Update it's location. |
420 PatchJump(bytecodes()->end(), bytecodes()->begin() + label->offset()); | 439 PatchJump(bytecodes()->end(), bytecodes()->begin() + label->offset()); |
421 // Now treat as if the label will only be back referred to. | 440 // Now treat as if the label will only be back referred to. |
422 } | 441 } |
423 label->bind_to(bytecodes()->size()); | 442 label->bind_to(bytecodes()->size()); |
424 return *this; | 443 return *this; |
425 } | 444 } |
426 | 445 |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 | 836 |
818 Register TemporaryRegisterScope::NewRegister() { | 837 Register TemporaryRegisterScope::NewRegister() { |
819 count_++; | 838 count_++; |
820 last_register_index_ = builder_->BorrowTemporaryRegister(); | 839 last_register_index_ = builder_->BorrowTemporaryRegister(); |
821 return Register(last_register_index_); | 840 return Register(last_register_index_); |
822 } | 841 } |
823 | 842 |
824 } // namespace interpreter | 843 } // namespace interpreter |
825 } // namespace internal | 844 } // namespace internal |
826 } // namespace v8 | 845 } // namespace v8 |
OLD | NEW |