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

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

Issue 2209633002: [Interpreter] Assign feedback slots for binary operations and use them in ignition. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased the patch. Created 4 years, 4 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 .StackCheck(0) 46 .StackCheck(0)
47 .StoreAccumulatorInRegister(reg_0) 47 .StoreAccumulatorInRegister(reg_0)
48 .LoadLiteral(smi_1) 48 .LoadLiteral(smi_1)
49 .StackCheck(1) 49 .StackCheck(1)
50 .StoreAccumulatorInRegister(reg_1) 50 .StoreAccumulatorInRegister(reg_1)
51 .LoadAccumulatorWithRegister(reg_0) 51 .LoadAccumulatorWithRegister(reg_0)
52 .BinaryOperation(Token::Value::ADD, reg_0) 52 .BinaryOperation(Token::Value::ADD, reg_0, 2)
53 .StoreAccumulatorInRegister(reg_1) 53 .StoreAccumulatorInRegister(reg_1)
54 .LoadNamedProperty(reg_1, name, feedback_slot) 54 .LoadNamedProperty(reg_1, name, feedback_slot)
55 .BinaryOperation(Token::Value::ADD, reg_0) 55 .BinaryOperation(Token::Value::ADD, reg_0, 3)
56 .StoreAccumulatorInRegister(param) 56 .StoreAccumulatorInRegister(param)
57 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0) 57 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0)
58 .ForInPrepare(reg_0, reg_0) 58 .ForInPrepare(reg_0, reg_0)
59 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) 59 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1)
60 .Debugger() 60 .Debugger()
61 .LoadGlobal(0x10000000, TypeofMode::NOT_INSIDE_TYPEOF) 61 .LoadGlobal(0x10000000, TypeofMode::NOT_INSIDE_TYPEOF)
62 .Return(); 62 .Return();
63 63
64 // Test iterator sees the expected output from the builder. 64 // Test iterator sees the expected output from the builder.
65 BytecodeArrayIterator iterator(builder.ToBytecodeArray()); 65 BytecodeArrayIterator iterator(builder.ToBytecodeArray());
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 CHECK(!iterator.done()); 174 CHECK(!iterator.done());
175 offset += Bytecodes::Size(Bytecode::kLdar, OperandScale::kSingle); 175 offset += Bytecodes::Size(Bytecode::kLdar, OperandScale::kSingle);
176 iterator.Advance(); 176 iterator.Advance();
177 177
178 CHECK_EQ(iterator.current_bytecode(), Bytecode::kAdd); 178 CHECK_EQ(iterator.current_bytecode(), Bytecode::kAdd);
179 CHECK_EQ(iterator.current_offset(), offset); 179 CHECK_EQ(iterator.current_offset(), offset);
180 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 180 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
181 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); 181 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
182 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); 182 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
183 CHECK(!iterator.done()); 183 CHECK(!iterator.done());
184 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); 184 offset += Bytecodes::Size(Bytecode::kAdd, OperandScale::kSingle);
185 iterator.Advance(); 185 iterator.Advance();
186 186
187 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); 187 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
188 CHECK_EQ(iterator.current_offset(), offset); 188 CHECK_EQ(iterator.current_offset(), offset);
189 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 189 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
190 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); 190 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
191 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); 191 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
192 CHECK(!iterator.done()); 192 CHECK(!iterator.done());
193 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); 193 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
194 iterator.Advance(); 194 iterator.Advance();
195 195
196 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaNamedProperty); 196 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaNamedProperty);
197 CHECK_EQ(iterator.current_offset(), offset); 197 CHECK_EQ(iterator.current_offset(), offset);
198 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 198 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
199 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); 199 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
200 CHECK_EQ(iterator.GetIndexOperand(1), name_index); 200 CHECK_EQ(iterator.GetIndexOperand(1), name_index);
201 CHECK_EQ(iterator.GetIndexOperand(2), feedback_slot); 201 CHECK_EQ(iterator.GetIndexOperand(2), feedback_slot);
202 CHECK(!iterator.done()); 202 CHECK(!iterator.done());
203 offset += Bytecodes::Size(Bytecode::kLdaNamedProperty, OperandScale::kSingle); 203 offset += Bytecodes::Size(Bytecode::kLdaNamedProperty, OperandScale::kSingle);
204 iterator.Advance(); 204 iterator.Advance();
205 205
206 CHECK_EQ(iterator.current_bytecode(), Bytecode::kAdd); 206 CHECK_EQ(iterator.current_bytecode(), Bytecode::kAdd);
207 CHECK_EQ(iterator.current_offset(), offset); 207 CHECK_EQ(iterator.current_offset(), offset);
208 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 208 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
209 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); 209 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
210 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); 210 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
211 CHECK(!iterator.done()); 211 CHECK(!iterator.done());
212 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); 212 offset += Bytecodes::Size(Bytecode::kAdd, OperandScale::kSingle);
213 iterator.Advance(); 213 iterator.Advance();
214 214
215 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); 215 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
216 CHECK_EQ(iterator.current_offset(), offset); 216 CHECK_EQ(iterator.current_offset(), offset);
217 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 217 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
218 CHECK_EQ(iterator.GetRegisterOperand(0).index(), param.index()); 218 CHECK_EQ(iterator.GetRegisterOperand(0).index(), param.index());
219 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); 219 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
220 CHECK(!iterator.done()); 220 CHECK(!iterator.done());
221 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); 221 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
222 iterator.Advance(); 222 iterator.Advance();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 CHECK_EQ(iterator.current_offset(), offset); 276 CHECK_EQ(iterator.current_offset(), offset);
277 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 277 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
278 CHECK(!iterator.done()); 278 CHECK(!iterator.done());
279 iterator.Advance(); 279 iterator.Advance();
280 CHECK(iterator.done()); 280 CHECK(iterator.done());
281 } 281 }
282 282
283 } // namespace interpreter 283 } // namespace interpreter
284 } // namespace internal 284 } // namespace internal
285 } // namespace v8 285 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698