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

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

Issue 1697473002: [interpreter] Add bytecodes for JumpIfNotHole with constant (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 10 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
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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-register-allocator.h" 9 #include "src/interpreter/bytecode-register-allocator.h"
10 #include "test/unittests/test-utils.h" 10 #include "test/unittests/test-utils.h"
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 .CastAccumulatorToJSObject() 156 .CastAccumulatorToJSObject()
157 .CastAccumulatorToName(); 157 .CastAccumulatorToName();
158 158
159 // Emit control flow. Return must be the last instruction. 159 // Emit control flow. Return must be the last instruction.
160 BytecodeLabel start; 160 BytecodeLabel start;
161 builder.Bind(&start); 161 builder.Bind(&start);
162 // Short jumps with Imm8 operands 162 // Short jumps with Imm8 operands
163 builder.Jump(&start) 163 builder.Jump(&start)
164 .JumpIfNull(&start) 164 .JumpIfNull(&start)
165 .JumpIfUndefined(&start) 165 .JumpIfUndefined(&start)
166 .JumpIfHole(&start)
167 .JumpIfNotHole(&start); 166 .JumpIfNotHole(&start);
167
168 // Perform an operation that returns boolean value to 168 // Perform an operation that returns boolean value to
169 // generate JumpIfTrue/False 169 // generate JumpIfTrue/False
170 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK) 170 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
171 .JumpIfTrue(&start) 171 .JumpIfTrue(&start)
172 .CompareOperation(Token::Value::EQ, reg, Strength::WEAK) 172 .CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
173 .JumpIfFalse(&start); 173 .JumpIfFalse(&start);
174 // Perform an operation that returns a non-boolean operation to 174 // Perform an operation that returns a non-boolean operation to
175 // generate JumpIfToBooleanTrue/False. 175 // generate JumpIfToBooleanTrue/False.
176 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK) 176 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK)
177 .JumpIfTrue(&start) 177 .JumpIfTrue(&start)
178 .BinaryOperation(Token::Value::ADD, reg, Strength::WEAK) 178 .BinaryOperation(Token::Value::ADD, reg, Strength::WEAK)
179 .JumpIfFalse(&start); 179 .JumpIfFalse(&start);
180 // Insert dummy ops to force longer jumps 180 // Insert dummy ops to force longer jumps
181 for (int i = 0; i < 128; i++) { 181 for (int i = 0; i < 128; i++) {
182 builder.LoadTrue(); 182 builder.LoadTrue();
183 } 183 }
184 // Longer jumps requiring Constant operand 184 // Longer jumps requiring Constant operand
185 builder.Jump(&start).JumpIfNull(&start).JumpIfUndefined(&start); 185 builder.Jump(&start).JumpIfNull(&start).JumpIfUndefined(&start).JumpIfNotHole(
186 &start);
186 // Perform an operation that returns boolean value to 187 // Perform an operation that returns boolean value to
187 // generate JumpIfTrue/False 188 // generate JumpIfTrue/False
188 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK) 189 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
189 .JumpIfTrue(&start) 190 .JumpIfTrue(&start)
190 .CompareOperation(Token::Value::EQ, reg, Strength::WEAK) 191 .CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
191 .JumpIfFalse(&start); 192 .JumpIfFalse(&start);
192 // Perform an operation that returns a non-boolean operation to 193 // Perform an operation that returns a non-boolean operation to
193 // generate JumpIfToBooleanTrue/False. 194 // generate JumpIfToBooleanTrue/False.
194 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK) 195 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK)
195 .JumpIfTrue(&start) 196 .JumpIfTrue(&start)
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 false); 259 false);
259 builder.CreateClosure(shared_info2, NOT_TENURED); 260 builder.CreateClosure(shared_info2, NOT_TENURED);
260 261
261 // Emit wide variant of literal creation operations. 262 // Emit wide variant of literal creation operations.
262 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"), 263 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"),
263 0, 0) 264 0, 0)
264 .CreateArrayLiteral(factory->NewFixedArray(2), 0, 0) 265 .CreateArrayLiteral(factory->NewFixedArray(2), 0, 0)
265 .CreateObjectLiteral(factory->NewFixedArray(2), 0, 0); 266 .CreateObjectLiteral(factory->NewFixedArray(2), 0, 0);
266 267
267 // Longer jumps requiring ConstantWide operand 268 // Longer jumps requiring ConstantWide operand
268 builder.Jump(&start).JumpIfNull(&start).JumpIfUndefined(&start); 269 builder.Jump(&start).JumpIfNull(&start).JumpIfUndefined(&start).JumpIfNotHole(
270 &start);
269 // Perform an operation that returns boolean value to 271 // Perform an operation that returns boolean value to
270 // generate JumpIfTrue/False 272 // generate JumpIfTrue/False
271 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK) 273 builder.CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
272 .JumpIfTrue(&start) 274 .JumpIfTrue(&start)
273 .CompareOperation(Token::Value::EQ, reg, Strength::WEAK) 275 .CompareOperation(Token::Value::EQ, reg, Strength::WEAK)
274 .JumpIfFalse(&start); 276 .JumpIfFalse(&start);
275 // Perform an operation that returns a non-boolean operation to 277 // Perform an operation that returns a non-boolean operation to
276 // generate JumpIfToBooleanTrue/False. 278 // generate JumpIfToBooleanTrue/False.
277 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK) 279 builder.BinaryOperation(Token::Value::ADD, reg, Strength::WEAK)
278 .JumpIfTrue(&start) 280 .JumpIfTrue(&start)
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 iterator.Advance(); 660 iterator.Advance();
659 } 661 }
660 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 662 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
661 iterator.Advance(); 663 iterator.Advance();
662 CHECK(iterator.done()); 664 CHECK(iterator.done());
663 } 665 }
664 666
665 } // namespace interpreter 667 } // namespace interpreter
666 } // namespace internal 668 } // namespace internal
667 } // namespace v8 669 } // namespace v8
OLDNEW
« no previous file with comments | « test/mjsunit/mjsunit.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698