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

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

Issue 2041913002: [interpreter] Remove OperandScale from front stages of pipeline. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: test/unittests/interpreter/bytecode-array-writer-unittest.cc
diff --git a/test/unittests/interpreter/bytecode-array-writer-unittest.cc b/test/unittests/interpreter/bytecode-array-writer-unittest.cc
index 7accfc9ebcdea75cea07c29fd712cd68b7225330..f625edfdafd1e1739194ea1515b35b1e65dbe606 100644
--- a/test/unittests/interpreter/bytecode-array-writer-unittest.cc
+++ b/test/unittests/interpreter/bytecode-array-writer-unittest.cc
@@ -29,20 +29,20 @@ class BytecodeArrayWriterUnittest : public TestWithIsolateAndZone {
void Write(BytecodeNode* node, const BytecodeSourceInfo& info);
void Write(Bytecode bytecode,
const BytecodeSourceInfo& info = BytecodeSourceInfo());
- void Write(Bytecode bytecode, uint32_t operand0, OperandScale operand_scale,
+ void Write(Bytecode bytecode, uint32_t operand0,
const BytecodeSourceInfo& info = BytecodeSourceInfo());
void Write(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
- OperandScale operand_scale,
+
const BytecodeSourceInfo& info = BytecodeSourceInfo());
void Write(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
- uint32_t operand2, OperandScale operand_scale,
+ uint32_t operand2,
const BytecodeSourceInfo& info = BytecodeSourceInfo());
void Write(Bytecode bytecode, uint32_t operand0, uint32_t operand1,
- uint32_t operand2, uint32_t operand3, OperandScale operand_scale,
+ uint32_t operand2, uint32_t operand3,
const BytecodeSourceInfo& info = BytecodeSourceInfo());
void WriteJump(Bytecode bytecode, BytecodeLabel* label,
- OperandScale operand_scale,
+
const BytecodeSourceInfo& info = BytecodeSourceInfo());
BytecodeArrayWriter* writer() { return &bytecode_array_writer_; }
@@ -72,43 +72,37 @@ void BytecodeArrayWriterUnittest::Write(Bytecode bytecode,
}
void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0,
- OperandScale operand_scale,
const BytecodeSourceInfo& info) {
- BytecodeNode node(bytecode, operand0, operand_scale);
+ BytecodeNode node(bytecode, operand0);
Write(&node, info);
}
void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0,
uint32_t operand1,
- OperandScale operand_scale,
const BytecodeSourceInfo& info) {
- BytecodeNode node(bytecode, operand0, operand1, operand_scale);
+ BytecodeNode node(bytecode, operand0, operand1);
Write(&node, info);
}
void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0,
uint32_t operand1, uint32_t operand2,
- OperandScale operand_scale,
const BytecodeSourceInfo& info) {
- BytecodeNode node(bytecode, operand0, operand1, operand2, operand_scale);
+ BytecodeNode node(bytecode, operand0, operand1, operand2);
Write(&node, info);
}
void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0,
uint32_t operand1, uint32_t operand2,
uint32_t operand3,
- OperandScale operand_scale,
const BytecodeSourceInfo& info) {
- BytecodeNode node(bytecode, operand0, operand1, operand2, operand3,
- operand_scale);
+ BytecodeNode node(bytecode, operand0, operand1, operand2, operand3);
Write(&node, info);
}
void BytecodeArrayWriterUnittest::WriteJump(Bytecode bytecode,
BytecodeLabel* label,
- OperandScale operand_scale,
const BytecodeSourceInfo& info) {
- BytecodeNode node(bytecode, 0, operand_scale);
+ BytecodeNode node(bytecode, 0);
if (info.is_valid()) {
node.source_info().Update(info);
}
@@ -122,20 +116,20 @@ TEST_F(BytecodeArrayWriterUnittest, SimpleExample) {
CHECK_EQ(bytecodes()->size(), 1);
CHECK_EQ(max_register_count(), 0);
- Write(Bytecode::kLdaSmi, 0xff, OperandScale::kSingle, {55, true});
+ Write(Bytecode::kLdaSmi, 127, {55, true});
CHECK_EQ(bytecodes()->size(), 3);
CHECK_EQ(max_register_count(), 0);
- Write(Bytecode::kLdar, Register(1).ToOperand(), OperandScale::kDouble);
+ Write(Bytecode::kLdar, Register(200).ToOperand());
CHECK_EQ(bytecodes()->size(), 7);
- CHECK_EQ(max_register_count(), 2);
+ CHECK_EQ(max_register_count(), 201);
Write(Bytecode::kReturn, {70, true});
CHECK_EQ(bytecodes()->size(), 8);
- CHECK_EQ(max_register_count(), 2);
+ CHECK_EQ(max_register_count(), 201);
- static const uint8_t bytes[] = {B(StackCheck), B(LdaSmi), U8(0xff), B(Wide),
- B(Ldar), R16(1), B(Return)};
+ static const uint8_t bytes[] = {B(StackCheck), B(LdaSmi), U8(127), B(Wide),
+ B(Ldar), R16(200), B(Return)};
CHECK_EQ(bytecodes()->size(), arraysize(bytes));
for (size_t i = 0; i < arraysize(bytes); ++i) {
CHECK_EQ(bytecodes()->at(i), bytes[i]);
@@ -197,38 +191,37 @@ TEST_F(BytecodeArrayWriterUnittest, ComplexExample) {
#define R(i) static_cast<uint32_t>(Register(i).ToOperand())
Write(Bytecode::kStackCheck, {30, false});
- Write(Bytecode::kLdaConstant, U8(0), OperandScale::kSingle, {42, true});
+ Write(Bytecode::kLdaConstant, U8(0), {42, true});
CHECK_EQ(max_register_count(), 0);
- Write(Bytecode::kStar, R(1), OperandScale::kSingle, {42, false});
+ Write(Bytecode::kStar, R(1), {42, false});
CHECK_EQ(max_register_count(), 2);
- WriteJump(Bytecode::kJumpIfUndefined, &jump_end_1, OperandScale::kSingle,
- {68, true});
- WriteJump(Bytecode::kJumpIfNull, &jump_end_2, OperandScale::kSingle);
+ WriteJump(Bytecode::kJumpIfUndefined, &jump_end_1, {68, true});
+ WriteJump(Bytecode::kJumpIfNull, &jump_end_2);
Write(Bytecode::kToObject);
CHECK_EQ(max_register_count(), 2);
- Write(Bytecode::kStar, R(3), OperandScale::kSingle);
+ Write(Bytecode::kStar, R(3));
CHECK_EQ(max_register_count(), 4);
- Write(Bytecode::kForInPrepare, R(4), OperandScale::kSingle);
+ Write(Bytecode::kForInPrepare, R(4));
CHECK_EQ(max_register_count(), 7);
Write(Bytecode::kLdaZero);
CHECK_EQ(max_register_count(), 7);
- Write(Bytecode::kStar, R(7), OperandScale::kSingle);
+ Write(Bytecode::kStar, R(7));
CHECK_EQ(max_register_count(), 8);
writer()->BindLabel(&back_jump);
- Write(Bytecode::kForInDone, R(7), R(6), OperandScale::kSingle, {63, true});
+ Write(Bytecode::kForInDone, R(7), R(6), {63, true});
CHECK_EQ(max_register_count(), 8);
- WriteJump(Bytecode::kJumpIfTrue, &jump_end_3, OperandScale::kSingle);
- Write(Bytecode::kForInNext, R(3), R(7), R(4), U8(1), OperandScale::kSingle);
- WriteJump(Bytecode::kJumpIfUndefined, &jump_for_in, OperandScale::kSingle);
- Write(Bytecode::kStar, R(0), OperandScale::kSingle);
+ WriteJump(Bytecode::kJumpIfTrue, &jump_end_3);
+ Write(Bytecode::kForInNext, R(3), R(7), R(4), U8(1));
+ WriteJump(Bytecode::kJumpIfUndefined, &jump_for_in);
+ Write(Bytecode::kStar, R(0));
Write(Bytecode::kStackCheck, {54, false});
- Write(Bytecode::kLdar, R(0), OperandScale::kSingle);
- Write(Bytecode::kStar, R(2), OperandScale::kSingle);
+ Write(Bytecode::kLdar, R(0));
+ Write(Bytecode::kStar, R(2));
Write(Bytecode::kReturn, {85, true});
writer()->BindLabel(&jump_for_in);
- Write(Bytecode::kForInStep, R(7), OperandScale::kSingle);
- Write(Bytecode::kStar, R(7), OperandScale::kSingle);
- WriteJump(Bytecode::kJump, &back_jump, OperandScale::kSingle);
+ Write(Bytecode::kForInStep, R(7));
+ Write(Bytecode::kStar, R(7));
+ WriteJump(Bytecode::kJump, &back_jump);
writer()->BindLabel(&jump_end_1);
writer()->BindLabel(&jump_end_2);
writer()->BindLabel(&jump_end_3);

Powered by Google App Engine
This is Rietveld 408576698