| 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 | 20 |
| 21 class SourcePositionTableIterator; | 21 class SourcePositionTableIterator; |
| 22 | 22 |
| 23 namespace interpreter { | 23 namespace interpreter { |
| 24 | 24 |
| 25 class BytecodeArrayIterator; | 25 class BytecodeArrayIterator; |
| 26 | 26 |
| 27 class BytecodeExpectationsPrinter final { | 27 class BytecodeExpectationsPrinter final { |
| 28 public: | 28 public: |
| 29 enum class ConstantPoolType { | 29 explicit BytecodeExpectationsPrinter(v8::Isolate* i) |
| 30 kUnknown, | |
| 31 kString, | |
| 32 kNumber, | |
| 33 kMixed, | |
| 34 }; | |
| 35 | |
| 36 BytecodeExpectationsPrinter(v8::Isolate* i, | |
| 37 ConstantPoolType t = ConstantPoolType::kMixed) | |
| 38 : isolate_(i), | 30 : isolate_(i), |
| 39 const_pool_type_(t), | |
| 40 execute_(true), | 31 execute_(true), |
| 41 wrap_(true), | 32 wrap_(true), |
| 42 top_level_(false), | 33 top_level_(false), |
| 43 test_function_name_(kDefaultTopFunctionName) {} | 34 test_function_name_(kDefaultTopFunctionName) {} |
| 44 | 35 |
| 45 void PrintExpectation(std::ostream& stream, // NOLINT | 36 void PrintExpectation(std::ostream& stream, // NOLINT |
| 46 const std::string& snippet) const; | 37 const std::string& snippet) const; |
| 47 | 38 |
| 48 void set_constant_pool_type(ConstantPoolType const_pool_type) { | |
| 49 const_pool_type_ = const_pool_type; | |
| 50 } | |
| 51 ConstantPoolType const_pool_type() const { return const_pool_type_; } | |
| 52 | |
| 53 void set_execute(bool execute) { execute_ = execute; } | 39 void set_execute(bool execute) { execute_ = execute; } |
| 54 bool execute() const { return execute_; } | 40 bool execute() const { return execute_; } |
| 55 | 41 |
| 56 void set_wrap(bool wrap) { wrap_ = wrap; } | 42 void set_wrap(bool wrap) { wrap_ = wrap; } |
| 57 bool wrap() const { return wrap_; } | 43 bool wrap() const { return wrap_; } |
| 58 | 44 |
| 59 void set_top_level(bool top_level) { top_level_ = top_level; } | 45 void set_top_level(bool top_level) { top_level_ = top_level; } |
| 60 bool top_level() const { return top_level_; } | 46 bool top_level() const { return top_level_; } |
| 61 | 47 |
| 62 void set_test_function_name(const std::string& test_function_name) { | 48 void set_test_function_name(const std::string& test_function_name) { |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 i::Handle<i::BytecodeArray> GetBytecodeArrayForGlobal( | 89 i::Handle<i::BytecodeArray> GetBytecodeArrayForGlobal( |
| 104 const char* global_name) const; | 90 const char* global_name) const; |
| 105 i::Handle<v8::internal::BytecodeArray> GetBytecodeArrayForScript( | 91 i::Handle<v8::internal::BytecodeArray> GetBytecodeArrayForScript( |
| 106 v8::Local<v8::Script> script) const; | 92 v8::Local<v8::Script> script) const; |
| 107 | 93 |
| 108 i::Isolate* i_isolate() const { | 94 i::Isolate* i_isolate() const { |
| 109 return reinterpret_cast<i::Isolate*>(isolate_); | 95 return reinterpret_cast<i::Isolate*>(isolate_); |
| 110 } | 96 } |
| 111 | 97 |
| 112 v8::Isolate* isolate_; | 98 v8::Isolate* isolate_; |
| 113 ConstantPoolType const_pool_type_; | |
| 114 bool execute_; | 99 bool execute_; |
| 115 bool wrap_; | 100 bool wrap_; |
| 116 bool top_level_; | 101 bool top_level_; |
| 117 std::string test_function_name_; | 102 std::string test_function_name_; |
| 118 | 103 |
| 119 static const char* const kDefaultTopFunctionName; | 104 static const char* const kDefaultTopFunctionName; |
| 120 static const char* const kIndent; | 105 static const char* const kIndent; |
| 121 }; | 106 }; |
| 122 | 107 |
| 123 } // namespace interpreter | 108 } // namespace interpreter |
| 124 } // namespace internal | 109 } // namespace internal |
| 125 } // namespace v8 | 110 } // namespace v8 |
| 126 | 111 |
| 127 #endif // TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_ | 112 #endif // TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_ |
| OLD | NEW |