| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 CHECK_EQ(bytecodes()->at(i), bytes[i]); | 126 CHECK_EQ(bytecodes()->at(i), bytes[i]); |
| 127 } | 127 } |
| 128 | 128 |
| 129 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( | 129 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( |
| 130 isolate(), 0, 0, factory()->empty_fixed_array()); | 130 isolate(), 0, 0, factory()->empty_fixed_array()); |
| 131 CHECK_EQ(bytecodes()->size(), arraysize(bytes)); | 131 CHECK_EQ(bytecodes()->size(), arraysize(bytes)); |
| 132 | 132 |
| 133 PositionTableEntry expected_positions[] = { | 133 PositionTableEntry expected_positions[] = { |
| 134 {0, 10, false}, {1, 55, true}, {7, 70, true}}; | 134 {0, 10, false}, {1, 55, true}, {7, 70, true}}; |
| 135 SourcePositionTableIterator source_iterator( | 135 SourcePositionTableIterator source_iterator( |
| 136 bytecode_array->source_position_table()); | 136 bytecode_array->SourcePositionTable()); |
| 137 for (size_t i = 0; i < arraysize(expected_positions); ++i) { | 137 for (size_t i = 0; i < arraysize(expected_positions); ++i) { |
| 138 const PositionTableEntry& expected = expected_positions[i]; | 138 const PositionTableEntry& expected = expected_positions[i]; |
| 139 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); | 139 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); |
| 140 CHECK_EQ(source_iterator.source_position().ScriptOffset(), | 140 CHECK_EQ(source_iterator.source_position().ScriptOffset(), |
| 141 expected.source_position); | 141 expected.source_position); |
| 142 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); | 142 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); |
| 143 source_iterator.Advance(); | 143 source_iterator.Advance(); |
| 144 } | 144 } |
| 145 CHECK(source_iterator.done()); | 145 CHECK(source_iterator.done()); |
| 146 } | 146 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); | 214 CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); |
| 215 for (size_t i = 0; i < arraysize(expected_bytes); ++i) { | 215 for (size_t i = 0; i < arraysize(expected_bytes); ++i) { |
| 216 CHECK_EQ(static_cast<int>(bytecodes()->at(i)), | 216 CHECK_EQ(static_cast<int>(bytecodes()->at(i)), |
| 217 static_cast<int>(expected_bytes[i])); | 217 static_cast<int>(expected_bytes[i])); |
| 218 } | 218 } |
| 219 | 219 |
| 220 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( | 220 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( |
| 221 isolate(), 0, 0, factory()->empty_fixed_array()); | 221 isolate(), 0, 0, factory()->empty_fixed_array()); |
| 222 SourcePositionTableIterator source_iterator( | 222 SourcePositionTableIterator source_iterator( |
| 223 bytecode_array->source_position_table()); | 223 bytecode_array->SourcePositionTable()); |
| 224 for (size_t i = 0; i < arraysize(expected_positions); ++i) { | 224 for (size_t i = 0; i < arraysize(expected_positions); ++i) { |
| 225 const PositionTableEntry& expected = expected_positions[i]; | 225 const PositionTableEntry& expected = expected_positions[i]; |
| 226 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); | 226 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); |
| 227 CHECK_EQ(source_iterator.source_position().ScriptOffset(), | 227 CHECK_EQ(source_iterator.source_position().ScriptOffset(), |
| 228 expected.source_position); | 228 expected.source_position); |
| 229 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); | 229 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); |
| 230 source_iterator.Advance(); | 230 source_iterator.Advance(); |
| 231 } | 231 } |
| 232 CHECK(source_iterator.done()); | 232 CHECK(source_iterator.done()); |
| 233 } | 233 } |
| 234 | 234 |
| 235 } // namespace interpreter | 235 } // namespace interpreter |
| 236 } // namespace internal | 236 } // namespace internal |
| 237 } // namespace v8 | 237 } // namespace v8 |
| OLD | NEW |