| 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 CHECK_EQ(bytecodes()->at(i), expected_bytes[i]); | 141 CHECK_EQ(bytecodes()->at(i), expected_bytes[i]); |
| 142 } | 142 } |
| 143 | 143 |
| 144 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( | 144 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( |
| 145 isolate(), 0, 0, factory()->empty_fixed_array()); | 145 isolate(), 0, 0, factory()->empty_fixed_array()); |
| 146 CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); | 146 CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); |
| 147 | 147 |
| 148 PositionTableEntry expected_positions[] = { | 148 PositionTableEntry expected_positions[] = { |
| 149 {0, 10, false}, {1, 55, true}, {9, 70, true}}; | 149 {0, 10, false}, {1, 55, true}, {9, 70, true}}; |
| 150 SourcePositionTableIterator source_iterator( | 150 SourcePositionTableIterator source_iterator( |
| 151 bytecode_array->source_position_table()); | 151 bytecode_array->SourcePositionTable()); |
| 152 for (size_t i = 0; i < arraysize(expected_positions); ++i) { | 152 for (size_t i = 0; i < arraysize(expected_positions); ++i) { |
| 153 const PositionTableEntry& expected = expected_positions[i]; | 153 const PositionTableEntry& expected = expected_positions[i]; |
| 154 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); | 154 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); |
| 155 CHECK_EQ(source_iterator.source_position().ScriptOffset(), | 155 CHECK_EQ(source_iterator.source_position().ScriptOffset(), |
| 156 expected.source_position); | 156 expected.source_position); |
| 157 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); | 157 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); |
| 158 source_iterator.Advance(); | 158 source_iterator.Advance(); |
| 159 } | 159 } |
| 160 CHECK(source_iterator.done()); | 160 CHECK(source_iterator.done()); |
| 161 } | 161 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 226 |
| 227 CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); | 227 CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); |
| 228 for (size_t i = 0; i < arraysize(expected_bytes); ++i) { | 228 for (size_t i = 0; i < arraysize(expected_bytes); ++i) { |
| 229 CHECK_EQ(static_cast<int>(bytecodes()->at(i)), | 229 CHECK_EQ(static_cast<int>(bytecodes()->at(i)), |
| 230 static_cast<int>(expected_bytes[i])); | 230 static_cast<int>(expected_bytes[i])); |
| 231 } | 231 } |
| 232 | 232 |
| 233 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( | 233 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( |
| 234 isolate(), 0, 0, factory()->empty_fixed_array()); | 234 isolate(), 0, 0, factory()->empty_fixed_array()); |
| 235 SourcePositionTableIterator source_iterator( | 235 SourcePositionTableIterator source_iterator( |
| 236 bytecode_array->source_position_table()); | 236 bytecode_array->SourcePositionTable()); |
| 237 for (size_t i = 0; i < arraysize(expected_positions); ++i) { | 237 for (size_t i = 0; i < arraysize(expected_positions); ++i) { |
| 238 const PositionTableEntry& expected = expected_positions[i]; | 238 const PositionTableEntry& expected = expected_positions[i]; |
| 239 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); | 239 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); |
| 240 CHECK_EQ(source_iterator.source_position().ScriptOffset(), | 240 CHECK_EQ(source_iterator.source_position().ScriptOffset(), |
| 241 expected.source_position); | 241 expected.source_position); |
| 242 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); | 242 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); |
| 243 source_iterator.Advance(); | 243 source_iterator.Advance(); |
| 244 } | 244 } |
| 245 CHECK(source_iterator.done()); | 245 CHECK(source_iterator.done()); |
| 246 } | 246 } |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 278 |
| 279 CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); | 279 CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); |
| 280 for (size_t i = 0; i < arraysize(expected_bytes); ++i) { | 280 for (size_t i = 0; i < arraysize(expected_bytes); ++i) { |
| 281 CHECK_EQ(static_cast<int>(bytecodes()->at(i)), | 281 CHECK_EQ(static_cast<int>(bytecodes()->at(i)), |
| 282 static_cast<int>(expected_bytes[i])); | 282 static_cast<int>(expected_bytes[i])); |
| 283 } | 283 } |
| 284 | 284 |
| 285 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( | 285 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( |
| 286 isolate(), 0, 0, factory()->empty_fixed_array()); | 286 isolate(), 0, 0, factory()->empty_fixed_array()); |
| 287 SourcePositionTableIterator source_iterator( | 287 SourcePositionTableIterator source_iterator( |
| 288 bytecode_array->source_position_table()); | 288 bytecode_array->SourcePositionTable()); |
| 289 for (size_t i = 0; i < arraysize(expected_positions); ++i) { | 289 for (size_t i = 0; i < arraysize(expected_positions); ++i) { |
| 290 const PositionTableEntry& expected = expected_positions[i]; | 290 const PositionTableEntry& expected = expected_positions[i]; |
| 291 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); | 291 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); |
| 292 CHECK_EQ(source_iterator.source_position().ScriptOffset(), | 292 CHECK_EQ(source_iterator.source_position().ScriptOffset(), |
| 293 expected.source_position); | 293 expected.source_position); |
| 294 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); | 294 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); |
| 295 source_iterator.Advance(); | 295 source_iterator.Advance(); |
| 296 } | 296 } |
| 297 CHECK(source_iterator.done()); | 297 CHECK(source_iterator.done()); |
| 298 } | 298 } |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 344 |
| 345 CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); | 345 CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); |
| 346 for (size_t i = 0; i < arraysize(expected_bytes); ++i) { | 346 for (size_t i = 0; i < arraysize(expected_bytes); ++i) { |
| 347 CHECK_EQ(static_cast<int>(bytecodes()->at(i)), | 347 CHECK_EQ(static_cast<int>(bytecodes()->at(i)), |
| 348 static_cast<int>(expected_bytes[i])); | 348 static_cast<int>(expected_bytes[i])); |
| 349 } | 349 } |
| 350 | 350 |
| 351 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( | 351 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( |
| 352 isolate(), 0, 0, factory()->empty_fixed_array()); | 352 isolate(), 0, 0, factory()->empty_fixed_array()); |
| 353 SourcePositionTableIterator source_iterator( | 353 SourcePositionTableIterator source_iterator( |
| 354 bytecode_array->source_position_table()); | 354 bytecode_array->SourcePositionTable()); |
| 355 for (size_t i = 0; i < arraysize(expected_positions); ++i) { | 355 for (size_t i = 0; i < arraysize(expected_positions); ++i) { |
| 356 const PositionTableEntry& expected = expected_positions[i]; | 356 const PositionTableEntry& expected = expected_positions[i]; |
| 357 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); | 357 CHECK_EQ(source_iterator.code_offset(), expected.code_offset); |
| 358 CHECK_EQ(source_iterator.source_position().ScriptOffset(), | 358 CHECK_EQ(source_iterator.source_position().ScriptOffset(), |
| 359 expected.source_position); | 359 expected.source_position); |
| 360 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); | 360 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); |
| 361 source_iterator.Advance(); | 361 source_iterator.Advance(); |
| 362 } | 362 } |
| 363 CHECK(source_iterator.done()); | 363 CHECK(source_iterator.done()); |
| 364 } | 364 } |
| 365 | 365 |
| 366 } // namespace interpreter | 366 } // namespace interpreter |
| 367 } // namespace internal | 367 } // namespace internal |
| 368 } // namespace v8 | 368 } // namespace v8 |
| OLD | NEW |