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

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

Issue 1410863002: [Interpreter] Add support for Throw. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
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
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.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/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
11 BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone) 11 BytecodeArrayBuilder::BytecodeArrayBuilder(Isolate* isolate, Zone* zone)
12 : isolate_(isolate), 12 : isolate_(isolate),
13 zone_(zone), 13 zone_(zone),
14 bytecodes_(zone), 14 bytecodes_(zone),
15 bytecode_generated_(false), 15 bytecode_generated_(false),
16 last_block_end_(0), 16 last_block_end_(0),
17 last_bytecode_start_(~0), 17 last_bytecode_start_(~0),
18 return_seen_in_block_(false), 18 exit_seen_in_block_(false),
19 constants_map_(isolate->heap(), zone), 19 constants_map_(isolate->heap(), zone),
20 constants_(zone), 20 constants_(zone),
21 parameter_count_(-1), 21 parameter_count_(-1),
22 local_register_count_(-1), 22 local_register_count_(-1),
23 context_register_count_(-1), 23 context_register_count_(-1),
24 temporary_register_count_(0), 24 temporary_register_count_(0),
25 temporary_register_next_(0) {} 25 temporary_register_next_(0) {}
26 26
27 27
28 void BytecodeArrayBuilder::set_locals_count(int number_of_locals) { 28 void BytecodeArrayBuilder::set_locals_count(int number_of_locals) {
(...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 return OutputJump(Bytecode::kJumpIfToBooleanTrue, label); 557 return OutputJump(Bytecode::kJumpIfToBooleanTrue, label);
558 } 558 }
559 559
560 560
561 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfToBooleanFalse( 561 BytecodeArrayBuilder& BytecodeArrayBuilder::JumpIfToBooleanFalse(
562 BytecodeLabel* label) { 562 BytecodeLabel* label) {
563 return OutputJump(Bytecode::kJumpIfToBooleanFalse, label); 563 return OutputJump(Bytecode::kJumpIfToBooleanFalse, label);
564 } 564 }
565 565
566 566
567 BytecodeArrayBuilder& BytecodeArrayBuilder::Throw() {
568 Output(Bytecode::kThrow);
569 exit_seen_in_block_ = true;
570 return *this;
571 }
572
573
567 BytecodeArrayBuilder& BytecodeArrayBuilder::Return() { 574 BytecodeArrayBuilder& BytecodeArrayBuilder::Return() {
568 Output(Bytecode::kReturn); 575 Output(Bytecode::kReturn);
569 return_seen_in_block_ = true; 576 exit_seen_in_block_ = true;
570 return *this; 577 return *this;
571 } 578 }
572 579
573 580
574 BytecodeArrayBuilder& BytecodeArrayBuilder::EnterBlock() { return *this; } 581 BytecodeArrayBuilder& BytecodeArrayBuilder::EnterBlock() { return *this; }
575 582
576 583
577 BytecodeArrayBuilder& BytecodeArrayBuilder::LeaveBlock() { 584 BytecodeArrayBuilder& BytecodeArrayBuilder::LeaveBlock() {
578 last_block_end_ = bytecodes()->size(); 585 last_block_end_ = bytecodes()->size();
579 return_seen_in_block_ = false; 586 exit_seen_in_block_ = false;
580 return *this; 587 return *this;
581 } 588 }
582 589
583 590
584 void BytecodeArrayBuilder::EnsureReturn() { 591 void BytecodeArrayBuilder::EnsureReturn() {
585 if (!return_seen_in_block_) { 592 if (!exit_seen_in_block_) {
586 LoadUndefined(); 593 LoadUndefined();
587 Return(); 594 Return();
588 } 595 }
589 } 596 }
590 597
591 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable, 598 BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable,
592 Register receiver, 599 Register receiver,
593 size_t arg_count) { 600 size_t arg_count) {
594 if (FitsInIdx8Operand(arg_count)) { 601 if (FitsInIdx8Operand(arg_count)) {
595 Output(Bytecode::kCall, callable.ToOperand(), receiver.ToOperand(), 602 Output(Bytecode::kCall, callable.ToOperand(), receiver.ToOperand(),
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 880
874 Register TemporaryRegisterScope::NewRegister() { 881 Register TemporaryRegisterScope::NewRegister() {
875 count_++; 882 count_++;
876 last_register_index_ = builder_->BorrowTemporaryRegister(); 883 last_register_index_ = builder_->BorrowTemporaryRegister();
877 return Register(last_register_index_); 884 return Register(last_register_index_);
878 } 885 }
879 886
880 } // namespace interpreter 887 } // namespace interpreter
881 } // namespace internal 888 } // namespace internal
882 } // namespace v8 889 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698