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 "test/cctest/interpreter/bytecode-expectations-printer.h" | 5 #include "test/cctest/interpreter/bytecode-expectations-printer.h" |
6 | 6 |
7 #include <iomanip> | 7 #include <iomanip> |
8 #include <iostream> | 8 #include <iostream> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "include/libplatform/libplatform.h" | 11 #include "include/libplatform/libplatform.h" |
12 #include "include/v8.h" | 12 #include "include/v8.h" |
13 | 13 |
14 #include "src/base/logging.h" | 14 #include "src/base/logging.h" |
15 #include "src/base/smart-pointers.h" | 15 #include "src/base/smart-pointers.h" |
16 #include "src/compiler.h" | 16 #include "src/compiler.h" |
17 #include "src/runtime/runtime.h" | 17 #include "src/runtime/runtime.h" |
18 | 18 |
19 #include "src/interpreter/bytecode-array-iterator.h" | 19 #include "src/interpreter/bytecode-array-iterator.h" |
20 #include "src/interpreter/bytecode-generator.h" | 20 #include "src/interpreter/bytecode-generator.h" |
21 #include "src/interpreter/bytecodes.h" | 21 #include "src/interpreter/bytecodes.h" |
22 #include "src/interpreter/interpreter-intrinsics.h" | 22 #include "src/interpreter/interpreter-intrinsics.h" |
23 #include "src/interpreter/interpreter.h" | 23 #include "src/interpreter/interpreter.h" |
24 #include "src/interpreter/source-position-table.h" | 24 #include "src/source-position-table.h" |
25 | 25 |
26 namespace v8 { | 26 namespace v8 { |
27 namespace internal { | 27 namespace internal { |
28 namespace interpreter { | 28 namespace interpreter { |
29 | 29 |
30 // static | 30 // static |
31 const char* const BytecodeExpectationsPrinter::kDefaultTopFunctionName = | 31 const char* const BytecodeExpectationsPrinter::kDefaultTopFunctionName = |
32 "__genbckexp_wrapper__"; | 32 "__genbckexp_wrapper__"; |
33 const char* const BytecodeExpectationsPrinter::kIndent = " "; | 33 const char* const BytecodeExpectationsPrinter::kIndent = " "; |
34 | 34 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 PrintBytecodeOperand(stream, bytecode_iterator, bytecode, op_index, | 194 PrintBytecodeOperand(stream, bytecode_iterator, bytecode, op_index, |
195 parameter_count); | 195 parameter_count); |
196 } | 196 } |
197 } | 197 } |
198 | 198 |
199 void BytecodeExpectationsPrinter::PrintSourcePosition( | 199 void BytecodeExpectationsPrinter::PrintSourcePosition( |
200 std::ostream& stream, SourcePositionTableIterator& source_iterator, | 200 std::ostream& stream, SourcePositionTableIterator& source_iterator, |
201 int bytecode_offset) const { | 201 int bytecode_offset) const { |
202 static const size_t kPositionWidth = 4; | 202 static const size_t kPositionWidth = 4; |
203 if (!source_iterator.done() && | 203 if (!source_iterator.done() && |
204 source_iterator.bytecode_offset() == bytecode_offset) { | 204 source_iterator.code_offset() == bytecode_offset) { |
205 stream << "/* " << std::setw(kPositionWidth) | 205 stream << "/* " << std::setw(kPositionWidth) |
206 << source_iterator.source_position(); | 206 << source_iterator.source_position(); |
207 if (source_iterator.is_statement()) { | 207 if (source_iterator.is_statement()) { |
208 stream << " S> */ "; | 208 stream << " S> */ "; |
209 } else { | 209 } else { |
210 stream << " E> */ "; | 210 stream << " E> */ "; |
211 } | 211 } |
212 source_iterator.Advance(); | 212 source_iterator.Advance(); |
213 } else { | 213 } else { |
214 stream << " " << std::setw(kPositionWidth) << ' ' << " "; | 214 stream << " " << std::setw(kPositionWidth) << ' ' << " "; |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 346 |
347 stream << "---\n"; | 347 stream << "---\n"; |
348 PrintCodeSnippet(stream, snippet); | 348 PrintCodeSnippet(stream, snippet); |
349 PrintBytecodeArray(stream, bytecode_array); | 349 PrintBytecodeArray(stream, bytecode_array); |
350 stream << '\n'; | 350 stream << '\n'; |
351 } | 351 } |
352 | 352 |
353 } // namespace interpreter | 353 } // namespace interpreter |
354 } // namespace internal | 354 } // namespace internal |
355 } // namespace v8 | 355 } // namespace v8 |
OLD | NEW |