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

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: Try harder with source positions. Created 4 years, 7 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 .StoreAccumulatorInRegister(param) 53 .StoreAccumulatorInRegister(param)
53 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0) 54 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0)
54 .ForInPrepare(reg_0) 55 .ForInPrepare(reg_0)
55 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) 56 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1)
56 .Debugger() 57 .Debugger()
57 .LoadGlobal(name, 0x10000000, TypeofMode::NOT_INSIDE_TYPEOF) 58 .LoadGlobal(name, 0x10000000, TypeofMode::NOT_INSIDE_TYPEOF)
58 .Return(); 59 .Return();
59 60
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 iterator.Advance(); 149 iterator.Advance();
149 150
150 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdar); 151 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdar);
151 CHECK_EQ(iterator.current_offset(), offset); 152 CHECK_EQ(iterator.current_offset(), offset);
152 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 153 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
153 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); 154 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
154 CHECK(!iterator.done()); 155 CHECK(!iterator.done());
155 offset += Bytecodes::Size(Bytecode::kLdar, OperandScale::kSingle); 156 offset += Bytecodes::Size(Bytecode::kLdar, OperandScale::kSingle);
156 iterator.Advance(); 157 iterator.Advance();
157 158
159 CHECK_EQ(iterator.current_bytecode(), Bytecode::kAdd);
160 CHECK_EQ(iterator.current_offset(), offset);
161 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
162 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
163 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
164 CHECK(!iterator.done());
165 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
166 iterator.Advance();
167
158 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); 168 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
159 CHECK_EQ(iterator.current_offset(), offset); 169 CHECK_EQ(iterator.current_offset(), offset);
160 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 170 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
161 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); 171 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index());
162 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); 172 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
163 CHECK(!iterator.done()); 173 CHECK(!iterator.done());
164 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); 174 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
165 iterator.Advance(); 175 iterator.Advance();
166 176
167 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLoadIC); 177 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLoadIC);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 CHECK_EQ(iterator.current_offset(), offset); 247 CHECK_EQ(iterator.current_offset(), offset);
238 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 248 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
239 CHECK(!iterator.done()); 249 CHECK(!iterator.done());
240 iterator.Advance(); 250 iterator.Advance();
241 CHECK(iterator.done()); 251 CHECK(iterator.done());
242 } 252 }
243 253
244 } // namespace interpreter 254 } // namespace interpreter
245 } // namespace internal 255 } // namespace internal
246 } // namespace v8 256 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698