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

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

Issue 2557593004: [ignition] desugar GetIterator() via bytecode rather than via AST (Closed)
Patch Set: georg's comments Created 4 years 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/cctest/interpreter/bytecode_expectations/Modules.golden ('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-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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 .LoadNull() 202 .LoadNull()
203 .CompareOperation(Token::Value::EQ, reg, 1); 203 .CompareOperation(Token::Value::EQ, reg, 1);
204 204
205 // Emit conversion operator invocations. 205 // Emit conversion operator invocations.
206 builder.ConvertAccumulatorToNumber(reg) 206 builder.ConvertAccumulatorToNumber(reg)
207 .ConvertAccumulatorToObject(reg) 207 .ConvertAccumulatorToObject(reg)
208 .ConvertAccumulatorToName(reg); 208 .ConvertAccumulatorToName(reg);
209 209
210 // Short jumps with Imm8 operands 210 // Short jumps with Imm8 operands
211 { 211 {
212 BytecodeLabel start, after_jump1, after_jump2, after_jump3, after_jump4; 212 BytecodeLabel start, after_jump1, after_jump2, after_jump3, after_jump4,
213 after_jump5;
213 builder.Bind(&start) 214 builder.Bind(&start)
214 .Jump(&after_jump1) 215 .Jump(&after_jump1)
215 .Bind(&after_jump1) 216 .Bind(&after_jump1)
216 .JumpIfNull(&after_jump2) 217 .JumpIfNull(&after_jump2)
217 .Bind(&after_jump2) 218 .Bind(&after_jump2)
218 .JumpIfUndefined(&after_jump3) 219 .JumpIfUndefined(&after_jump3)
219 .Bind(&after_jump3) 220 .Bind(&after_jump3)
220 .JumpIfNotHole(&after_jump4) 221 .JumpIfNotHole(&after_jump4)
221 .Bind(&after_jump4) 222 .Bind(&after_jump4)
223 .JumpIfJSReceiver(&after_jump5)
224 .Bind(&after_jump5)
222 .JumpLoop(&start, 0); 225 .JumpLoop(&start, 0);
223 } 226 }
224 227
225 // Longer jumps with constant operands 228 // Longer jumps with constant operands
226 BytecodeLabel end[8]; 229 BytecodeLabel end[9];
227 { 230 {
228 BytecodeLabel after_jump; 231 BytecodeLabel after_jump;
229 builder.Jump(&end[0]) 232 builder.Jump(&end[0])
230 .Bind(&after_jump) 233 .Bind(&after_jump)
231 .LoadTrue() 234 .LoadTrue()
232 .JumpIfTrue(&end[1]) 235 .JumpIfTrue(&end[1])
233 .LoadTrue() 236 .LoadTrue()
234 .JumpIfFalse(&end[2]) 237 .JumpIfFalse(&end[2])
235 .LoadLiteral(Smi::kZero) 238 .LoadLiteral(Smi::kZero)
236 .JumpIfTrue(&end[3]) 239 .JumpIfTrue(&end[3])
237 .LoadLiteral(Smi::kZero) 240 .LoadLiteral(Smi::kZero)
238 .JumpIfFalse(&end[4]) 241 .JumpIfFalse(&end[4])
239 .JumpIfNull(&end[5]) 242 .JumpIfNull(&end[5])
240 .JumpIfUndefined(&end[6]) 243 .JumpIfUndefined(&end[6])
241 .JumpIfNotHole(&end[7]); 244 .JumpIfNotHole(&end[7])
245 .LoadLiteral(factory->prototype_string())
246 .JumpIfJSReceiver(&end[8]);
242 } 247 }
243 248
244 // Perform an operation that returns boolean value to 249 // Perform an operation that returns boolean value to
245 // generate JumpIfTrue/False 250 // generate JumpIfTrue/False
246 { 251 {
247 BytecodeLabel after_jump1, after_jump2; 252 BytecodeLabel after_jump1, after_jump2;
248 builder.CompareOperation(Token::Value::EQ, reg, 1) 253 builder.CompareOperation(Token::Value::EQ, reg, 1)
249 .JumpIfTrue(&after_jump1) 254 .JumpIfTrue(&after_jump1)
250 .Bind(&after_jump1) 255 .Bind(&after_jump1)
251 .CompareOperation(Token::Value::EQ, reg, 2) 256 .CompareOperation(Token::Value::EQ, reg, 2)
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 iterator.Advance(); 743 iterator.Advance();
739 } 744 }
740 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 745 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
741 iterator.Advance(); 746 iterator.Advance();
742 CHECK(iterator.done()); 747 CHECK(iterator.done());
743 } 748 }
744 749
745 } // namespace interpreter 750 } // namespace interpreter
746 } // namespace internal 751 } // namespace internal
747 } // namespace v8 752 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/Modules.golden ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698