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

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

Issue 1399773002: [Interpreter] Adds logical and, logical or and comma operators to interpreter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Added a new bytecode to jump by casting the value to boolean. This reduces code size for logical op… 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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 // static 419 // static
420 Bytecode BytecodeArrayBuilder::GetJumpWithConstantOperand( 420 Bytecode BytecodeArrayBuilder::GetJumpWithConstantOperand(
421 Bytecode jump_bytecode) { 421 Bytecode jump_bytecode) {
422 switch (jump_bytecode) { 422 switch (jump_bytecode) {
423 case Bytecode::kJump: 423 case Bytecode::kJump:
424 return Bytecode::kJumpConstant; 424 return Bytecode::kJumpConstant;
425 case Bytecode::kJumpIfTrue: 425 case Bytecode::kJumpIfTrue:
426 return Bytecode::kJumpIfTrueConstant; 426 return Bytecode::kJumpIfTrueConstant;
427 case Bytecode::kJumpIfFalse: 427 case Bytecode::kJumpIfFalse:
428 return Bytecode::kJumpIfFalseConstant; 428 return Bytecode::kJumpIfFalseConstant;
429 case Bytecode::kJumpIfToBooleanTrue:
430 return Bytecode::kJumpIfToBooleanTrueConstant;
431 case Bytecode::kJumpIfToBooleanFalse:
432 return Bytecode::kJumpIfToBooleanFalseConstant;
429 default: 433 default:
430 UNREACHABLE(); 434 UNREACHABLE();
431 return Bytecode::kJumpConstant; 435 return Bytecode::kJumpConstant;
432 } 436 }
433 } 437 }
434 438
435 439
436 void BytecodeArrayBuilder::PatchJump( 440 void BytecodeArrayBuilder::PatchJump(
437 const ZoneVector<uint8_t>::iterator& jump_target, 441 const ZoneVector<uint8_t>::iterator& jump_target,
438 ZoneVector<uint8_t>::iterator jump_location) { 442 ZoneVector<uint8_t>::iterator jump_location) {
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfTrue(BytecodeLabel* label) { 511 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfTrue(BytecodeLabel* label) {
508 return OutputJump(Bytecode::kJumpIfTrue, label); 512 return OutputJump(Bytecode::kJumpIfTrue, label);
509 } 513 }
510 514
511 515
512 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfFalse(BytecodeLabel* label) { 516 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfFalse(BytecodeLabel* label) {
513 return OutputJump(Bytecode::kJumpIfFalse, label); 517 return OutputJump(Bytecode::kJumpIfFalse, label);
514 } 518 }
515 519
516 520
521 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfToBooleanTrue(
522 BytecodeLabel* label) {
523 return OutputJump(Bytecode::kJumpIfToBooleanTrue, label);
524 }
525
526
527 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfToBooleanFalse(
528 BytecodeLabel* label) {
529 return OutputJump(Bytecode::kJumpIfToBooleanFalse, label);
530 }
531
532
517 BytecodeArrayBuilder& BytecodeArrayBuilder::Return() { 533 BytecodeArrayBuilder& BytecodeArrayBuilder::Return() {
518 Output(Bytecode::kReturn); 534 Output(Bytecode::kReturn);
519 return_seen_in_block_ = true; 535 return_seen_in_block_ = true;
520 return *this; 536 return *this;
521 } 537 }
522 538
523 539
524 BytecodeArrayBuilder& BytecodeArrayBuilder::EnterBlock() { return *this; } 540 BytecodeArrayBuilder& BytecodeArrayBuilder::EnterBlock() { return *this; }
525 541
526 542
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 813
798 Register TemporaryRegisterScope::NewRegister() { 814 Register TemporaryRegisterScope::NewRegister() {
799 count_++; 815 count_++;
800 last_register_index_ = builder_->BorrowTemporaryRegister(); 816 last_register_index_ = builder_->BorrowTemporaryRegister();
801 return Register(last_register_index_); 817 return Register(last_register_index_);
802 } 818 }
803 819
804 } // namespace interpreter 820 } // namespace interpreter
805 } // namespace internal 821 } // namespace internal
806 } // namespace v8 822 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698