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

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: get tests passing 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
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 .CompareOperation(Token::Value::INSTANCEOF, reg, 8) 195 .CompareOperation(Token::Value::INSTANCEOF, reg, 8)
196 .CompareOperation(Token::Value::IN, reg, 9); 196 .CompareOperation(Token::Value::IN, reg, 9);
197 197
198 // Emit conversion operator invocations. 198 // Emit conversion operator invocations.
199 builder.ConvertAccumulatorToNumber(reg) 199 builder.ConvertAccumulatorToNumber(reg)
200 .ConvertAccumulatorToObject(reg) 200 .ConvertAccumulatorToObject(reg)
201 .ConvertAccumulatorToName(reg); 201 .ConvertAccumulatorToName(reg);
202 202
203 // Short jumps with Imm8 operands 203 // Short jumps with Imm8 operands
204 { 204 {
205 BytecodeLabel start, after_jump1, after_jump2, after_jump3, after_jump4; 205 BytecodeLabel start, after_jump1, after_jump2, after_jump3, after_jump4,
206 after_jump5;
206 builder.Bind(&start) 207 builder.Bind(&start)
207 .Jump(&after_jump1) 208 .Jump(&after_jump1)
208 .Bind(&after_jump1) 209 .Bind(&after_jump1)
209 .JumpIfNull(&after_jump2) 210 .JumpIfNull(&after_jump2)
210 .Bind(&after_jump2) 211 .Bind(&after_jump2)
211 .JumpIfUndefined(&after_jump3) 212 .JumpIfUndefined(&after_jump3)
212 .Bind(&after_jump3) 213 .Bind(&after_jump3)
213 .JumpIfNotHole(&after_jump4) 214 .JumpIfNotHole(&after_jump4)
214 .Bind(&after_jump4) 215 .Bind(&after_jump4)
216 .JumpIfJSReceiver(&after_jump5)
217 .Bind(&after_jump5)
215 .JumpLoop(&start, 0); 218 .JumpLoop(&start, 0);
216 } 219 }
217 220
218 // Longer jumps with constant operands 221 // Longer jumps with constant operands
219 BytecodeLabel end[8]; 222 BytecodeLabel end[9];
220 { 223 {
221 BytecodeLabel after_jump; 224 BytecodeLabel after_jump;
222 builder.Jump(&end[0]) 225 builder.Jump(&end[0])
223 .Bind(&after_jump) 226 .Bind(&after_jump)
224 .LoadTrue() 227 .LoadTrue()
225 .JumpIfTrue(&end[1]) 228 .JumpIfTrue(&end[1])
226 .LoadTrue() 229 .LoadTrue()
227 .JumpIfFalse(&end[2]) 230 .JumpIfFalse(&end[2])
228 .LoadLiteral(Smi::kZero) 231 .LoadLiteral(Smi::kZero)
229 .JumpIfTrue(&end[3]) 232 .JumpIfTrue(&end[3])
230 .LoadLiteral(Smi::kZero) 233 .LoadLiteral(Smi::kZero)
231 .JumpIfFalse(&end[4]) 234 .JumpIfFalse(&end[4])
232 .JumpIfNull(&end[5]) 235 .JumpIfNull(&end[5])
233 .JumpIfUndefined(&end[6]) 236 .JumpIfUndefined(&end[6])
234 .JumpIfNotHole(&end[7]); 237 .JumpIfNotHole(&end[7])
238 .LoadLiteral(factory->prototype_string())
rmcilroy 2016/12/06 15:02:28 nit - no need to load the literal here (the code i
caitp 2016/12/06 15:14:58 Acknowledged.
239 .JumpIfJSReceiver(&end[8]);
235 } 240 }
236 241
237 // Perform an operation that returns boolean value to 242 // Perform an operation that returns boolean value to
238 // generate JumpIfTrue/False 243 // generate JumpIfTrue/False
239 { 244 {
240 BytecodeLabel after_jump1, after_jump2; 245 BytecodeLabel after_jump1, after_jump2;
241 builder.CompareOperation(Token::Value::EQ, reg, 1) 246 builder.CompareOperation(Token::Value::EQ, reg, 1)
242 .JumpIfTrue(&after_jump1) 247 .JumpIfTrue(&after_jump1)
243 .Bind(&after_jump1) 248 .Bind(&after_jump1)
244 .CompareOperation(Token::Value::EQ, reg, 2) 249 .CompareOperation(Token::Value::EQ, reg, 2)
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 iterator.Advance(); 735 iterator.Advance();
731 } 736 }
732 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 737 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
733 iterator.Advance(); 738 iterator.Advance();
734 CHECK(iterator.done()); 739 CHECK(iterator.done());
735 } 740 }
736 741
737 } // namespace interpreter 742 } // namespace interpreter
738 } // namespace internal 743 } // namespace internal
739 } // namespace v8 744 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698