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

Side by Side Diff: test/unittests/interpreter/bytecode-array-writer-unittest.cc

Issue 2393683004: [Interpreter] Optimize the Register Optimizer. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 return writer()->source_position_table_builder(); 50 return writer()->source_position_table_builder();
51 } 51 }
52 52
53 private: 53 private:
54 ConstantArrayBuilder constant_array_builder_; 54 ConstantArrayBuilder constant_array_builder_;
55 BytecodeArrayWriter bytecode_array_writer_; 55 BytecodeArrayWriter bytecode_array_writer_;
56 }; 56 };
57 57
58 void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, 58 void BytecodeArrayWriterUnittest::Write(Bytecode bytecode,
59 BytecodeSourceInfo info) { 59 BytecodeSourceInfo info) {
60 BytecodeNode node(bytecode, &info); 60 BytecodeNode node(bytecode, info);
61 writer()->Write(&node); 61 writer()->Write(&node);
62 } 62 }
63 63
64 void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0, 64 void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0,
65 BytecodeSourceInfo info) { 65 BytecodeSourceInfo info) {
66 BytecodeNode node(bytecode, operand0, &info); 66 BytecodeNode node(bytecode, operand0, info);
67 writer()->Write(&node); 67 writer()->Write(&node);
68 } 68 }
69 69
70 void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0, 70 void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0,
71 uint32_t operand1, 71 uint32_t operand1,
72 BytecodeSourceInfo info) { 72 BytecodeSourceInfo info) {
73 BytecodeNode node(bytecode, operand0, operand1, &info); 73 BytecodeNode node(bytecode, operand0, operand1, info);
74 writer()->Write(&node); 74 writer()->Write(&node);
75 } 75 }
76 76
77 void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0, 77 void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0,
78 uint32_t operand1, uint32_t operand2, 78 uint32_t operand1, uint32_t operand2,
79 BytecodeSourceInfo info) { 79 BytecodeSourceInfo info) {
80 BytecodeNode node(bytecode, operand0, operand1, operand2, &info); 80 BytecodeNode node(bytecode, operand0, operand1, operand2, info);
81 writer()->Write(&node); 81 writer()->Write(&node);
82 } 82 }
83 83
84 void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0, 84 void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0,
85 uint32_t operand1, uint32_t operand2, 85 uint32_t operand1, uint32_t operand2,
86 uint32_t operand3, 86 uint32_t operand3,
87 BytecodeSourceInfo info) { 87 BytecodeSourceInfo info) {
88 BytecodeNode node(bytecode, operand0, operand1, operand2, operand3, &info); 88 BytecodeNode node(bytecode, operand0, operand1, operand2, operand3, info);
89 writer()->Write(&node); 89 writer()->Write(&node);
90 } 90 }
91 91
92 void BytecodeArrayWriterUnittest::WriteJump(Bytecode bytecode, 92 void BytecodeArrayWriterUnittest::WriteJump(Bytecode bytecode,
93 BytecodeLabel* label, 93 BytecodeLabel* label,
94 BytecodeSourceInfo info) { 94 BytecodeSourceInfo info) {
95 BytecodeNode node(bytecode, 0, &info); 95 BytecodeNode node(bytecode, 0, info);
96 writer()->WriteJump(&node, label); 96 writer()->WriteJump(&node, label);
97 } 97 }
98 98
99 void BytecodeArrayWriterUnittest::WriteJumpLoop(Bytecode bytecode, 99 void BytecodeArrayWriterUnittest::WriteJumpLoop(Bytecode bytecode,
100 BytecodeLabel* label, int depth, 100 BytecodeLabel* label, int depth,
101 BytecodeSourceInfo info) { 101 BytecodeSourceInfo info) {
102 BytecodeNode node(bytecode, 0, depth, &info); 102 BytecodeNode node(bytecode, 0, depth, info);
103 writer()->WriteJump(&node, label); 103 writer()->WriteJump(&node, label);
104 } 104 }
105 105
106 TEST_F(BytecodeArrayWriterUnittest, SimpleExample) { 106 TEST_F(BytecodeArrayWriterUnittest, SimpleExample) {
107 CHECK_EQ(bytecodes()->size(), 0); 107 CHECK_EQ(bytecodes()->size(), 0);
108 108
109 Write(Bytecode::kStackCheck, {10, false}); 109 Write(Bytecode::kStackCheck, {10, false});
110 CHECK_EQ(bytecodes()->size(), 1); 110 CHECK_EQ(bytecodes()->size(), 1);
111 111
112 Write(Bytecode::kLdaSmi, 127, {55, true}); 112 Write(Bytecode::kLdaSmi, 127, {55, true});
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 CHECK_EQ(source_iterator.source_position(), expected.source_position); 225 CHECK_EQ(source_iterator.source_position(), expected.source_position);
226 CHECK_EQ(source_iterator.is_statement(), expected.is_statement); 226 CHECK_EQ(source_iterator.is_statement(), expected.is_statement);
227 source_iterator.Advance(); 227 source_iterator.Advance();
228 } 228 }
229 CHECK(source_iterator.done()); 229 CHECK(source_iterator.done());
230 } 230 }
231 231
232 } // namespace interpreter 232 } // namespace interpreter
233 } // namespace internal 233 } // namespace internal
234 } // namespace v8 234 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-register-optimizer.cc ('k') | test/unittests/interpreter/bytecode-dead-code-optimizer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698