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

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

Issue 2493183002: [ignition] Fix more -Wsign-compare warnings. (Closed)
Patch Set: Address comment 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(), 0u);
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(), 1u);
111 111
112 Write(Bytecode::kLdaSmi, 127, {55, true}); 112 Write(Bytecode::kLdaSmi, 127, {55, true});
113 CHECK_EQ(bytecodes()->size(), 3); 113 CHECK_EQ(bytecodes()->size(), 3u);
114 114
115 Write(Bytecode::kLdar, Register(200).ToOperand()); 115 Write(Bytecode::kLdar, Register(200).ToOperand());
116 CHECK_EQ(bytecodes()->size(), 7); 116 CHECK_EQ(bytecodes()->size(), 7u);
117 117
118 Write(Bytecode::kReturn, {70, true}); 118 Write(Bytecode::kReturn, {70, true});
119 CHECK_EQ(bytecodes()->size(), 8); 119 CHECK_EQ(bytecodes()->size(), 8u);
120 120
121 static const uint8_t bytes[] = {B(StackCheck), B(LdaSmi), U8(127), B(Wide), 121 static const uint8_t bytes[] = {B(StackCheck), B(LdaSmi), U8(127), B(Wide),
122 B(Ldar), R16(200), B(Return)}; 122 B(Ldar), R16(200), B(Return)};
123 CHECK_EQ(bytecodes()->size(), arraysize(bytes)); 123 CHECK_EQ(bytecodes()->size(), arraysize(bytes));
124 for (size_t i = 0; i < arraysize(bytes); ++i) { 124 for (size_t i = 0; i < arraysize(bytes); ++i) {
125 CHECK_EQ(bytecodes()->at(i), bytes[i]); 125 CHECK_EQ(bytecodes()->at(i), bytes[i]);
126 } 126 }
127 127
128 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray( 128 Handle<BytecodeArray> bytecode_array = writer()->ToBytecodeArray(
129 isolate(), 0, 0, factory()->empty_fixed_array()); 129 isolate(), 0, 0, factory()->empty_fixed_array());
(...skipping 95 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

Powered by Google App Engine
This is Rietveld 408576698