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

Side by Side Diff: test/unittests/interpreter/bytecodes-unittest.cc

Issue 2024123002: Fix bytecode operand values (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 <vector> 5 #include <vector>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/interpreter/bytecodes.h" 9 #include "src/interpreter/bytecodes.h"
10 #include "test/unittests/interpreter/bytecode-utils.h" 10 #include "test/unittests/interpreter/bytecode-utils.h"
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 175
176 TEST(Bytecodes, DecodeBytecodeAndOperands) { 176 TEST(Bytecodes, DecodeBytecodeAndOperands) {
177 struct BytecodesAndResult { 177 struct BytecodesAndResult {
178 const uint8_t bytecode[32]; 178 const uint8_t bytecode[32];
179 const size_t length; 179 const size_t length;
180 int parameter_count; 180 int parameter_count;
181 const char* output; 181 const char* output;
182 }; 182 };
183 183
184 const BytecodesAndResult cases[] = { 184 const BytecodesAndResult cases[] = {
185 {{B(LdaSmi), U8(0x01)}, 2, 0, " LdaSmi [1]"}, 185 {{B(LdaSmi), U8(1)}, 2, 0, " LdaSmi [1]"},
186 {{B(Wide), B(LdaSmi), U16(1000)}, 4, 0, " LdaSmi.Wide [1000]"}, 186 {{B(Wide), B(LdaSmi), U16(1000)}, 4, 0, " LdaSmi.Wide [1000]"},
187 {{B(ExtraWide), B(LdaSmi), U32(100000)}, 187 {{B(ExtraWide), B(LdaSmi), U32(100000)},
188 6, 188 6,
189 0, 189 0,
190 "LdaSmi.ExtraWide [100000]"}, 190 "LdaSmi.ExtraWide [100000]"},
191 {{B(LdaSmi), 0xff}, 2, 0, " LdaSmi [-1]"}, 191 {{B(LdaSmi), U8(-1)}, 2, 0, " LdaSmi [-1]"},
192 {{B(Wide), B(LdaSmi), 0x18, 0xfc}, 4, 0, " LdaSmi.Wide [-1000]"}, 192 {{B(Wide), B(LdaSmi), U16(-1000)}, 4, 0, " LdaSmi.Wide [-1000]"},
193 {{B(ExtraWide), B(LdaSmi), U32(-100000)}, 193 {{B(ExtraWide), B(LdaSmi), U32(-100000)},
194 6, 194 6,
195 0, 195 0,
196 "LdaSmi.ExtraWide [-100000]"}, 196 "LdaSmi.ExtraWide [-100000]"},
197 {{B(Star), R8(5)}, 2, 0, " Star r5"}, 197 {{B(Star), R8(5)}, 2, 0, " Star r5"},
198 {{B(Wide), B(Star), R16(136)}, 4, 0, " Star.Wide r136"}, 198 {{B(Wide), B(Star), R16(136)}, 4, 0, " Star.Wide r136"},
199 {{B(Wide), B(Call), R16(134), R16(135), U16(0x02), U16(177)}, 199 {{B(Wide), B(Call), R16(134), R16(135), U16(2), U16(177)},
200 10, 200 10,
201 0, 201 0,
202 "Call.Wide r134, r135, #2, [177]"}, 202 "Call.Wide r134, r135, #2, [177]"},
203 {{B(Ldar), 203 {{B(Ldar),
204 static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())}, 204 static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())},
205 2, 205 2,
206 3, 206 3,
207 " Ldar a1"}, 207 " Ldar a1"},
208 {{B(Wide), B(CreateObjectLiteral), U16(513), U16(1027), U16(165)}, 208 {{B(Wide), B(CreateObjectLiteral), U16(513), U16(1027), U16(165)},
209 7, 209 7,
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 std::set<std::string> names; 391 std::set<std::string> names;
392 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kNone)); 392 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kNone));
393 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kRead)); 393 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kRead));
394 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kWrite)); 394 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kWrite));
395 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kReadWrite)); 395 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kReadWrite));
396 CHECK_EQ(names.size(), 4); 396 CHECK_EQ(names.size(), 4);
397 } 397 }
398 } // namespace interpreter 398 } // namespace interpreter
399 } // namespace internal 399 } // namespace internal
400 } // namespace v8 400 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698