Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: test/cctest/interpreter/bytecode-expectations-printer.h

Issue 1688383003: [Interpreter] Change the output format of generate-bytecode-expectations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix MSVC on Windows compiler error. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/cctest.gyp ('k') | test/cctest/interpreter/bytecode-expectations-printer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_
6 #define TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_
7
8 #include <iostream>
9 #include <string>
10
11 #include "src/interpreter/bytecodes.h"
12 #include "src/objects.h"
13
14 namespace v8 {
15
16 class Isolate;
17
18 namespace internal {
19 namespace interpreter {
20
21 class BytecodeArrayIterator;
22
23 class BytecodeExpectationsPrinter final {
24 public:
25 enum class ConstantPoolType {
26 kUnknown,
27 kString,
28 kInteger,
29 kDouble,
30 kMixed,
31 };
32
33 BytecodeExpectationsPrinter(v8::Isolate* i,
34 ConstantPoolType t = ConstantPoolType::kMixed)
35 : isolate_(i), const_pool_type_(t) {}
36
37 void PrintExpectation(std::ostream& stream, // NOLINT
38 const std::string& snippet) const;
39
40 void set_constant_pool_type(ConstantPoolType t) { const_pool_type_ = t; }
41 ConstantPoolType constant_pool_type() const { return const_pool_type_; }
42
43 private:
44 void PrintEscapedString(std::ostream& stream, // NOLINT
45 const std::string& string) const;
46 void PrintBytecodeOperand(std::ostream& stream, // NOLINT
47 const BytecodeArrayIterator& bytecode_iter,
48 const Bytecode& bytecode, int op_index) const;
49 void PrintBytecode(std::ostream& stream, // NOLINT
50 const BytecodeArrayIterator& bytecode_iter) const;
51 void PrintV8String(std::ostream& stream, // NOLINT
52 i::String* string) const;
53 void PrintConstant(std::ostream& stream, // NOLINT
54 i::Handle<i::Object> constant) const;
55 void PrintFrameSize(std::ostream& stream, // NOLINT
56 i::Handle<i::BytecodeArray> bytecode_array) const;
57 void PrintBytecodeSequence(std::ostream& stream, // NOLINT
58 i::Handle<i::BytecodeArray> bytecode_array) const;
59 void PrintConstantPool(std::ostream& stream, // NOLINT
60 i::FixedArray* constant_pool) const;
61 void PrintCodeSnippet(std::ostream& stream, // NOLINT
62 const std::string& body) const;
63 void PrintBytecodeArray(std::ostream& stream, // NOLINT
64 const std::string& body,
65 i::Handle<i::BytecodeArray> bytecode_array) const;
66
67 v8::Local<v8::String> V8StringFromUTF8(const char* data) const;
68 std::string WrapCodeInFunction(const char* function_name,
69 const std::string& function_body) const;
70
71 v8::Local<v8::Value> CompileAndRun(const char* program) const;
72 i::Handle<i::BytecodeArray> GetBytecodeArrayForGlobal(
73 const char* global_name) const;
74
75 i::Isolate* i_isolate() const {
76 return reinterpret_cast<i::Isolate*>(isolate_);
77 }
78
79 v8::Isolate* isolate_;
80 ConstantPoolType const_pool_type_;
81 };
82
83 } // namespace interpreter
84 } // namespace internal
85 } // namespace v8
86
87 #endif // TEST_CCTEST_INTERPRETER_BYTECODE_EXPECTATIONS_PRINTER_H_
OLDNEW
« no previous file with comments | « test/cctest/cctest.gyp ('k') | test/cctest/interpreter/bytecode-expectations-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698