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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 } | 143 } |
144 | 144 |
145 | 145 |
146 Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() { | 146 Handle<BytecodeArray> BytecodeArrayBuilder::ToBytecodeArray() { |
147 DCHECK_EQ(bytecode_generated_, false); | 147 DCHECK_EQ(bytecode_generated_, false); |
148 EnsureReturn(); | 148 EnsureReturn(); |
149 | 149 |
150 int bytecode_size = static_cast<int>(bytecodes_.size()); | 150 int bytecode_size = static_cast<int>(bytecodes_.size()); |
151 int register_count = fixed_register_count() + temporary_register_count_; | 151 int register_count = fixed_register_count() + temporary_register_count_; |
152 int frame_size = register_count * kPointerSize; | 152 int frame_size = register_count * kPointerSize; |
153 Factory* factory = isolate_->factory(); | 153 Handle<FixedArray> constant_pool = constant_array_builder()->ToFixedArray(); |
154 Handle<FixedArray> constant_pool = | |
155 constant_array_builder()->ToFixedArray(factory); | |
156 Handle<FixedArray> handler_table = handler_table_builder()->ToHandlerTable(); | 154 Handle<FixedArray> handler_table = handler_table_builder()->ToHandlerTable(); |
157 Handle<BytecodeArray> output = | 155 Handle<BytecodeArray> output = isolate_->factory()->NewBytecodeArray( |
158 factory->NewBytecodeArray(bytecode_size, &bytecodes_.front(), frame_size, | 156 bytecode_size, &bytecodes_.front(), frame_size, parameter_count(), |
159 parameter_count(), constant_pool); | 157 constant_pool); |
160 output->set_handler_table(*handler_table); | 158 output->set_handler_table(*handler_table); |
Michael Starzinger
2016/01/19 16:38:55
I could make the handler table and argument to the
| |
161 bytecode_generated_ = true; | 159 bytecode_generated_ = true; |
162 return output; | 160 return output; |
163 } | 161 } |
164 | 162 |
165 | 163 |
166 template <size_t N> | 164 template <size_t N> |
167 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint32_t(&operands)[N]) { | 165 void BytecodeArrayBuilder::Output(Bytecode bytecode, uint32_t(&operands)[N]) { |
168 // Don't output dead code. | 166 // Don't output dead code. |
169 if (exit_seen_in_block_) return; | 167 if (exit_seen_in_block_) return; |
170 | 168 |
(...skipping 1509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1680 | 1678 |
1681 | 1679 |
1682 // static | 1680 // static |
1683 bool BytecodeArrayBuilder::FitsInReg16Operand(Register value) { | 1681 bool BytecodeArrayBuilder::FitsInReg16Operand(Register value) { |
1684 return kMinInt16 <= value.index() && value.index() <= kMaxInt16; | 1682 return kMinInt16 <= value.index() && value.index() <= kMaxInt16; |
1685 } | 1683 } |
1686 | 1684 |
1687 } // namespace interpreter | 1685 } // namespace interpreter |
1688 } // namespace internal | 1686 } // namespace internal |
1689 } // namespace v8 | 1687 } // namespace v8 |
OLD | NEW |