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

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

Issue 2384123002: [Interpreter] Use RegisterList for kRegTriple and kRegPair operands. (Closed)
Patch Set: Rebase Created 4 years, 2 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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/interpreter/bytecode-label.h" 9 #include "src/interpreter/bytecode-label.h"
10 #include "src/interpreter/bytecode-register-allocator.h" 10 #include "src/interpreter/bytecode-register-allocator.h"
(...skipping 16 matching lines...) Expand all
27 Factory* factory = isolate()->factory(); 27 Factory* factory = isolate()->factory();
28 28
29 CHECK_EQ(builder.locals_count(), 131); 29 CHECK_EQ(builder.locals_count(), 131);
30 CHECK_EQ(builder.context_count(), 1); 30 CHECK_EQ(builder.context_count(), 1);
31 CHECK_EQ(builder.fixed_register_count(), 132); 31 CHECK_EQ(builder.fixed_register_count(), 132);
32 32
33 Register reg(0); 33 Register reg(0);
34 Register other(reg.index() + 1); 34 Register other(reg.index() + 1);
35 Register wide(128); 35 Register wide(128);
36 RegisterList reg_list; 36 RegisterList reg_list;
37 RegisterList pair(0, 2), triple(0, 3);
37 38
38 // Emit argument creation operations. 39 // Emit argument creation operations.
39 builder.CreateArguments(CreateArgumentsType::kMappedArguments) 40 builder.CreateArguments(CreateArgumentsType::kMappedArguments)
40 .CreateArguments(CreateArgumentsType::kUnmappedArguments) 41 .CreateArguments(CreateArgumentsType::kUnmappedArguments)
41 .CreateArguments(CreateArgumentsType::kRestParameter); 42 .CreateArguments(CreateArgumentsType::kRestParameter);
42 43
43 // Emit constant loads. 44 // Emit constant loads.
44 builder.LoadLiteral(Smi::FromInt(0)) 45 builder.LoadLiteral(Smi::FromInt(0))
45 .StoreAccumulatorInRegister(reg) 46 .StoreAccumulatorInRegister(reg)
46 .LoadLiteral(Smi::FromInt(8)) 47 .LoadLiteral(Smi::FromInt(8))
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 121
121 // Emit literal creation operations. 122 // Emit literal creation operations.
122 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("a"), 0, 0) 123 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("a"), 0, 0)
123 .CreateArrayLiteral(factory->NewFixedArray(1), 0, 0) 124 .CreateArrayLiteral(factory->NewFixedArray(1), 0, 0)
124 .CreateObjectLiteral(factory->NewFixedArray(1), 0, 0, reg); 125 .CreateObjectLiteral(factory->NewFixedArray(1), 0, 0, reg);
125 126
126 // Call operations. 127 // Call operations.
127 builder.Call(reg, reg_list, 1) 128 builder.Call(reg, reg_list, 1)
128 .Call(reg, reg_list, 1, TailCallMode::kAllow) 129 .Call(reg, reg_list, 1, TailCallMode::kAllow)
129 .CallRuntime(Runtime::kIsArray, reg) 130 .CallRuntime(Runtime::kIsArray, reg)
130 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, reg_list, other) 131 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, reg_list, pair)
131 .CallJSRuntime(Context::SPREAD_ITERABLE_INDEX, reg_list); 132 .CallJSRuntime(Context::SPREAD_ITERABLE_INDEX, reg_list);
132 133
133 // Emit binary operator invocations. 134 // Emit binary operator invocations.
134 builder.BinaryOperation(Token::Value::ADD, reg, 1) 135 builder.BinaryOperation(Token::Value::ADD, reg, 1)
135 .BinaryOperation(Token::Value::SUB, reg, 2) 136 .BinaryOperation(Token::Value::SUB, reg, 2)
136 .BinaryOperation(Token::Value::MUL, reg, 3) 137 .BinaryOperation(Token::Value::MUL, reg, 3)
137 .BinaryOperation(Token::Value::DIV, reg, 4) 138 .BinaryOperation(Token::Value::DIV, reg, 4)
138 .BinaryOperation(Token::Value::MOD, reg, 5); 139 .BinaryOperation(Token::Value::MOD, reg, 5);
139 140
140 // Emit bitwise operator invocations 141 // Emit bitwise operator invocations
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 // Emit stack check bytecode. 255 // Emit stack check bytecode.
255 builder.StackCheck(0); 256 builder.StackCheck(0);
256 257
257 // Emit throw and re-throw in it's own basic block so that the rest of the 258 // Emit throw and re-throw in it's own basic block so that the rest of the
258 // code isn't omitted due to being dead. 259 // code isn't omitted due to being dead.
259 BytecodeLabel after_throw; 260 BytecodeLabel after_throw;
260 builder.Throw().Bind(&after_throw); 261 builder.Throw().Bind(&after_throw);
261 BytecodeLabel after_rethrow; 262 BytecodeLabel after_rethrow;
262 builder.ReThrow().Bind(&after_rethrow); 263 builder.ReThrow().Bind(&after_rethrow);
263 264
264 builder.ForInPrepare(reg, reg) 265 builder.ForInPrepare(reg, triple)
265 .ForInContinue(reg, reg) 266 .ForInContinue(reg, reg)
266 .ForInNext(reg, reg, reg, 1) 267 .ForInNext(reg, reg, pair, 1)
267 .ForInStep(reg);
268 builder.ForInPrepare(reg, wide)
269 .ForInContinue(reg, other)
270 .ForInNext(wide, wide, wide, 1024)
271 .ForInStep(reg); 268 .ForInStep(reg);
272 269
273 // Wide constant pool loads 270 // Wide constant pool loads
274 for (int i = 0; i < 256; i++) { 271 for (int i = 0; i < 256; i++) {
275 // Emit junk in constant pool to force wide constant pool index. 272 // Emit junk in constant pool to force wide constant pool index.
276 builder.LoadLiteral(factory->NewNumber(2.5321 + i)); 273 builder.LoadLiteral(factory->NewNumber(2.5321 + i));
277 } 274 }
278 builder.LoadLiteral(Smi::FromInt(20000000)); 275 builder.LoadLiteral(Smi::FromInt(20000000));
279 Handle<String> wide_name = factory->NewStringFromStaticChars("var_wide_name"); 276 Handle<String> wide_name = factory->NewStringFromStaticChars("var_wide_name");
280 277
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after
732 iterator.Advance(); 729 iterator.Advance();
733 } 730 }
734 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 731 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
735 iterator.Advance(); 732 iterator.Advance();
736 CHECK(iterator.done()); 733 CHECK(iterator.done());
737 } 734 }
738 735
739 } // namespace interpreter 736 } // namespace interpreter
740 } // namespace internal 737 } // namespace internal
741 } // namespace v8 738 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-generator.cc ('k') | test/unittests/interpreter/bytecode-array-iterator-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698