OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/api.h" | 7 #include "src/api.h" |
8 #include "src/factory.h" | 8 #include "src/factory.h" |
9 #include "src/interpreter/bytecode-array-writer.h" | 9 #include "src/interpreter/bytecode-array-writer.h" |
10 #include "src/interpreter/bytecode-label.h" | 10 #include "src/interpreter/bytecode-label.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 Write(Bytecode::kReturn, {85, true}); | 228 Write(Bytecode::kReturn, {85, true}); |
229 CHECK_EQ(max_register_count(), 8); | 229 CHECK_EQ(max_register_count(), 8); |
230 #undef R | 230 #undef R |
231 | 231 |
232 CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); | 232 CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); |
233 for (size_t i = 0; i < arraysize(expected_bytes); ++i) { | 233 for (size_t i = 0; i < arraysize(expected_bytes); ++i) { |
234 CHECK_EQ(static_cast<int>(bytecodes()->at(i)), | 234 CHECK_EQ(static_cast<int>(bytecodes()->at(i)), |
235 static_cast<int>(expected_bytes[i])); | 235 static_cast<int>(expected_bytes[i])); |
236 } | 236 } |
237 | 237 |
238 Handle<ByteArray> source_positions = | 238 Handle<BytecodeArray> bytecode_array = |
239 source_position_table_builder()->ToSourcePositionTable(); | 239 writer()->ToBytecodeArray(0, 0, factory()->empty_fixed_array()); |
240 SourcePositionTableIterator source_iterator(*source_positions); | 240 SourcePositionTableIterator source_iterator( |
| 241 bytecode_array->source_position_table()); |
241 for (size_t i = 0; i < arraysize(expected_positions); ++i) { | 242 for (size_t i = 0; i < arraysize(expected_positions); ++i) { |
242 const PositionTableEntry& expected = expected_positions[i]; | 243 const PositionTableEntry& expected = expected_positions[i]; |
243 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); | 244 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); |
244 CHECK_EQ(source_iterator.source_position(), expected.source_position); | 245 CHECK_EQ(source_iterator.source_position(), expected.source_position); |
245 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); | 246 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); |
246 source_iterator.Advance(); | 247 source_iterator.Advance(); |
247 } | 248 } |
248 CHECK(source_iterator.done()); | 249 CHECK(source_iterator.done()); |
249 } | 250 } |
250 | 251 |
251 } // namespace interpreter | 252 } // namespace interpreter |
252 } // namespace internal | 253 } // namespace internal |
253 } // namespace v8 | 254 } // namespace v8 |
OLD | NEW |