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

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

Issue 1502243002: [Interpreter] Local flow control in the bytecode graph builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Build fix. Created 5 years 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-iterator.h" 5 #include "src/interpreter/bytecode-array-iterator.h"
6 6
7 #include "src/objects-inl.h" 7 #include "src/objects-inl.h"
8 8
9 namespace v8 { 9 namespace v8 {
10 namespace internal { 10 namespace internal {
11 namespace interpreter { 11 namespace interpreter {
12 12
13 BytecodeArrayIterator::BytecodeArrayIterator( 13 BytecodeArrayIterator::BytecodeArrayIterator(
14 Handle<BytecodeArray> bytecode_array) 14 Handle<BytecodeArray> bytecode_array)
15 : bytecode_array_(bytecode_array), bytecode_offset_(0) {} 15 : bytecode_array_(bytecode_array), bytecode_offset_(0) {}
16 16
17 17
18 void BytecodeArrayIterator::Advance() { 18 void BytecodeArrayIterator::Advance() {
19 bytecode_offset_ += Bytecodes::Size(current_bytecode()); 19 bytecode_offset_ += Bytecodes::Size(current_bytecode());
20 } 20 }
21 21
22 22
23 void BytecodeArrayIterator::AdvanceToOffset(int offset) {
24 DCHECK_GE(offset, 0);
25 DCHECK_LE(offset, bytecode_array()->length());
26 bytecode_offset_ = offset;
27 }
28
29
23 bool BytecodeArrayIterator::done() const { 30 bool BytecodeArrayIterator::done() const {
24 return bytecode_offset_ >= bytecode_array()->length(); 31 return bytecode_offset_ >= bytecode_array()->length();
25 } 32 }
26 33
27 34
28 Bytecode BytecodeArrayIterator::current_bytecode() const { 35 Bytecode BytecodeArrayIterator::current_bytecode() const {
29 DCHECK(!done()); 36 DCHECK(!done());
30 uint8_t current_byte = bytecode_array()->get(bytecode_offset_); 37 uint8_t current_byte = bytecode_array()->get(bytecode_offset_);
31 return interpreter::Bytecodes::FromByte(current_byte); 38 return interpreter::Bytecodes::FromByte(current_byte);
32 } 39 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 98
92 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( 99 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand(
93 int operand_index) const { 100 int operand_index) const {
94 Handle<FixedArray> constants = handle(bytecode_array()->constant_pool()); 101 Handle<FixedArray> constants = handle(bytecode_array()->constant_pool());
95 return FixedArray::get(constants, GetIndexOperand(operand_index)); 102 return FixedArray::get(constants, GetIndexOperand(operand_index));
96 } 103 }
97 104
98 } // namespace interpreter 105 } // namespace interpreter
99 } // namespace internal 106 } // namespace internal
100 } // namespace v8 107 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698