| 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 #ifndef TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_ | 5 #ifndef TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_ |
| 6 #define TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_ | 6 #define TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_ |
| 7 | 7 |
| 8 #include <iostream> | 8 #include <iostream> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "src/interpreter/bytecodes.h" | 12 #include "src/interpreter/bytecodes.h" |
| 13 #include "src/objects.h" | 13 #include "src/objects.h" |
| 14 | 14 |
| 15 namespace v8 { | 15 namespace v8 { |
| 16 | 16 |
| 17 class Isolate; | 17 class Isolate; |
| 18 | 18 |
| 19 namespace internal { | 19 namespace internal { |
| 20 namespace interpreter { | 20 namespace interpreter { |
| 21 | 21 |
| 22 class BytecodeArrayIterator; | 22 class BytecodeArrayIterator; |
| 23 class SourcePositionTableIterator; |
| 23 | 24 |
| 24 class BytecodeExpectationsPrinter final { | 25 class BytecodeExpectationsPrinter final { |
| 25 public: | 26 public: |
| 26 enum class ConstantPoolType { | 27 enum class ConstantPoolType { |
| 27 kUnknown, | 28 kUnknown, |
| 28 kString, | 29 kString, |
| 29 kNumber, | 30 kNumber, |
| 30 kMixed, | 31 kMixed, |
| 31 }; | 32 }; |
| 32 | 33 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 58 | 59 |
| 59 void set_test_function_name(const std::string& test_function_name) { | 60 void set_test_function_name(const std::string& test_function_name) { |
| 60 test_function_name_ = test_function_name; | 61 test_function_name_ = test_function_name; |
| 61 } | 62 } |
| 62 std::string test_function_name() const { return test_function_name_; } | 63 std::string test_function_name() const { return test_function_name_; } |
| 63 | 64 |
| 64 private: | 65 private: |
| 65 void PrintEscapedString(std::ostream& stream, // NOLINT | 66 void PrintEscapedString(std::ostream& stream, // NOLINT |
| 66 const std::string& string) const; | 67 const std::string& string) const; |
| 67 void PrintBytecodeOperand(std::ostream& stream, // NOLINT | 68 void PrintBytecodeOperand(std::ostream& stream, // NOLINT |
| 68 const BytecodeArrayIterator& bytecode_iter, | 69 const BytecodeArrayIterator& bytecode_iterator, |
| 69 const Bytecode& bytecode, int op_index, | 70 const Bytecode& bytecode, int op_index, |
| 70 int parameter_count) const; | 71 int parameter_count) const; |
| 71 void PrintBytecode(std::ostream& stream, // NOLINT | 72 void PrintBytecode(std::ostream& stream, // NOLINT |
| 72 const BytecodeArrayIterator& bytecode_iter, | 73 const BytecodeArrayIterator& bytecode_iterator, |
| 73 int parameter_count) const; | 74 int parameter_count) const; |
| 75 void PrintSourcePosition(std::ostream& stream, // NOLINT |
| 76 SourcePositionTableIterator& source_iterator, |
| 77 int bytecode_offset) const; |
| 74 void PrintV8String(std::ostream& stream, // NOLINT | 78 void PrintV8String(std::ostream& stream, // NOLINT |
| 75 i::String* string) const; | 79 i::String* string) const; |
| 76 void PrintConstant(std::ostream& stream, // NOLINT | 80 void PrintConstant(std::ostream& stream, // NOLINT |
| 77 i::Handle<i::Object> constant) const; | 81 i::Handle<i::Object> constant) const; |
| 78 void PrintFrameSize(std::ostream& stream, // NOLINT | 82 void PrintFrameSize(std::ostream& stream, // NOLINT |
| 79 i::Handle<i::BytecodeArray> bytecode_array) const; | 83 i::Handle<i::BytecodeArray> bytecode_array) const; |
| 80 void PrintBytecodeSequence(std::ostream& stream, // NOLINT | 84 void PrintBytecodeSequence(std::ostream& stream, // NOLINT |
| 81 i::Handle<i::BytecodeArray> bytecode_array) const; | 85 i::Handle<i::BytecodeArray> bytecode_array) const; |
| 82 void PrintConstantPool(std::ostream& stream, // NOLINT | 86 void PrintConstantPool(std::ostream& stream, // NOLINT |
| 83 i::FixedArray* constant_pool) const; | 87 i::FixedArray* constant_pool) const; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 104 } | 108 } |
| 105 | 109 |
| 106 v8::Isolate* isolate_; | 110 v8::Isolate* isolate_; |
| 107 ConstantPoolType const_pool_type_; | 111 ConstantPoolType const_pool_type_; |
| 108 bool execute_; | 112 bool execute_; |
| 109 bool wrap_; | 113 bool wrap_; |
| 110 bool top_level_; | 114 bool top_level_; |
| 111 std::string test_function_name_; | 115 std::string test_function_name_; |
| 112 | 116 |
| 113 static const char* const kDefaultTopFunctionName; | 117 static const char* const kDefaultTopFunctionName; |
| 118 static const char* const kIndent; |
| 114 }; | 119 }; |
| 115 | 120 |
| 116 } // namespace interpreter | 121 } // namespace interpreter |
| 117 } // namespace internal | 122 } // namespace internal |
| 118 } // namespace v8 | 123 } // namespace v8 |
| 119 | 124 |
| 120 #endif // TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_ | 125 #endif // TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_ |
| OLD | NEW |