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

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

Issue 1997653002: [interpreter] Bytecode register optimizer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Decouple a test from implementation. 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
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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/interpreter/bytecode-array-builder.h" 7 #include "src/interpreter/bytecode-array-builder.h"
8 #include "src/interpreter/bytecode-array-iterator.h" 8 #include "src/interpreter/bytecode-array-iterator.h"
9 #include "test/unittests/test-utils.h" 9 #include "test/unittests/test-utils.h"
10 10
(...skipping 29 matching lines...) Expand all
40 .StoreAccumulatorInRegister(reg_0) 40 .StoreAccumulatorInRegister(reg_0)
41 .LoadLiteral(heap_num_1) 41 .LoadLiteral(heap_num_1)
42 .StoreAccumulatorInRegister(reg_0) 42 .StoreAccumulatorInRegister(reg_0)
43 .LoadLiteral(zero) 43 .LoadLiteral(zero)
44 .StoreAccumulatorInRegister(reg_0) 44 .StoreAccumulatorInRegister(reg_0)
45 .LoadLiteral(smi_0) 45 .LoadLiteral(smi_0)
46 .StoreAccumulatorInRegister(reg_0) 46 .StoreAccumulatorInRegister(reg_0)
47 .LoadLiteral(smi_1) 47 .LoadLiteral(smi_1)
48 .StoreAccumulatorInRegister(reg_1) 48 .StoreAccumulatorInRegister(reg_1)
49 .LoadAccumulatorWithRegister(reg_0) 49 .LoadAccumulatorWithRegister(reg_0)
50 .BinaryOperation(Token::Value::ADD, reg_0)
50 .StoreAccumulatorInRegister(reg_1) 51 .StoreAccumulatorInRegister(reg_1)
51 .LoadNamedProperty(reg_1, name, feedback_slot) 52 .LoadNamedProperty(reg_1, name, feedback_slot)
52 .BinaryOperation(Token::Value::ADD, reg_0) 53 .BinaryOperation(Token::Value::ADD, reg_0)
53 .StoreAccumulatorInRegister(param) 54 .StoreAccumulatorInRegister(param)
54 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0) 55 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0)
55 .ForInPrepare(reg_0) 56 .ForInPrepare(reg_0)
56 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) 57 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1)
57 .Debugger() 58 .Debugger()
58 .LoadGlobal(name, 0x10000000, TypeofMode::NOT_INSIDE_TYPEOF) 59 .LoadGlobal(name, 0x10000000, TypeofMode::NOT_INSIDE_TYPEOF)
59 .Return(); 60 .Return();
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 iterator.Advance(); 150 iterator.Advance();
150 151
151 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdar); 152 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdar);
152 CHECK_EQ(iterator.current_offset(), offset); 153 CHECK_EQ(iterator.current_offset(), offset);
153 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 154 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
154 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); 155 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
155 CHECK(!iterator.done()); 156 CHECK(!iterator.done());
156 offset += Bytecodes::Size(Bytecode::kLdar, OperandScale::kSingle); 157 offset += Bytecodes::Size(Bytecode::kLdar, OperandScale::kSingle);
157 iterator.Advance(); 158 iterator.Advance();
158 159
160 CHECK_EQ(iterator.current_bytecode(), Bytecode::kAdd);
161 CHECK_EQ(iterator.current_offset(), offset);
162 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
163 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
164 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
165 CHECK(!iterator.done());
166 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
167 iterator.Advance();
168
159 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); 169 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
160 CHECK_EQ(iterator.current_offset(), offset); 170 CHECK_EQ(iterator.current_offset(), offset);
161 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 171 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
162 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); 172 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
163 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); 173 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
164 CHECK(!iterator.done()); 174 CHECK(!iterator.done());
165 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); 175 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
166 iterator.Advance(); 176 iterator.Advance();
167 177
168 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaNamedProperty); 178 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaNamedProperty);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 CHECK_EQ(iterator.current_offset(), offset); 257 CHECK_EQ(iterator.current_offset(), offset);
248 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 258 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
249 CHECK(!iterator.done()); 259 CHECK(!iterator.done());
250 iterator.Advance(); 260 iterator.Advance();
251 CHECK(iterator.done()); 261 CHECK(iterator.done());
252 } 262 }
253 263
254 } // namespace interpreter 264 } // namespace interpreter
255 } // namespace internal 265 } // namespace internal
256 } // namespace v8 266 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698