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

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

Issue 2331033002: [interpreter] Merge {OsrPoll} with {Jump} bytecode. (Closed)
Patch Set: Fix for wide jumps. Created 4 years, 3 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 // Emit control flow. Return must be the last instruction. 193 // Emit control flow. Return must be the last instruction.
194 BytecodeLabel start; 194 BytecodeLabel start;
195 builder.Bind(&start); 195 builder.Bind(&start);
196 { 196 {
197 // Short jumps with Imm8 operands 197 // Short jumps with Imm8 operands
198 BytecodeLabel after_jump; 198 BytecodeLabel after_jump;
199 builder.Jump(&start) 199 builder.Jump(&start)
200 .Bind(&after_jump) 200 .Bind(&after_jump)
201 .JumpIfNull(&start) 201 .JumpIfNull(&start)
202 .JumpIfUndefined(&start) 202 .JumpIfUndefined(&start)
203 .JumpIfNotHole(&start); 203 .JumpIfNotHole(&start)
204 .JumpLoop(&start, 0);
204 } 205 }
205 206
206 // Longer jumps with constant operands 207 // Longer jumps with constant operands
207 BytecodeLabel end[8]; 208 BytecodeLabel end[8];
208 { 209 {
209 BytecodeLabel after_jump; 210 BytecodeLabel after_jump;
210 builder.Jump(&end[0]) 211 builder.Jump(&end[0])
211 .Bind(&after_jump) 212 .Bind(&after_jump)
212 .LoadTrue() 213 .LoadTrue()
213 .JumpIfTrue(&end[1]) 214 .JumpIfTrue(&end[1])
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 // generate JumpIfToBooleanTrue/False. 257 // generate JumpIfToBooleanTrue/False.
257 builder.BinaryOperation(Token::Value::ADD, reg, 1) 258 builder.BinaryOperation(Token::Value::ADD, reg, 1)
258 .JumpIfTrue(&start) 259 .JumpIfTrue(&start)
259 .BinaryOperation(Token::Value::ADD, reg, 2) 260 .BinaryOperation(Token::Value::ADD, reg, 2)
260 .JumpIfFalse(&start); 261 .JumpIfFalse(&start);
261 } 262 }
262 263
263 // Emit stack check bytecode. 264 // Emit stack check bytecode.
264 builder.StackCheck(0); 265 builder.StackCheck(0);
265 266
266 // Emit an OSR poll bytecode.
267 builder.OsrPoll(1);
268
269 // Emit throw and re-throw in it's own basic block so that the rest of the 267 // Emit throw and re-throw in it's own basic block so that the rest of the
270 // code isn't omitted due to being dead. 268 // code isn't omitted due to being dead.
271 BytecodeLabel after_throw; 269 BytecodeLabel after_throw;
272 builder.Throw().Bind(&after_throw); 270 builder.Throw().Bind(&after_throw);
273 BytecodeLabel after_rethrow; 271 BytecodeLabel after_rethrow;
274 builder.ReThrow().Bind(&after_rethrow); 272 builder.ReThrow().Bind(&after_rethrow);
275 273
276 builder.ForInPrepare(reg, reg) 274 builder.ForInPrepare(reg, reg)
277 .ForInContinue(reg, reg) 275 .ForInContinue(reg, reg)
278 .ForInNext(reg, reg, reg, 1) 276 .ForInNext(reg, reg, reg, 1)
(...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 iterator.Advance(); 853 iterator.Advance();
856 } 854 }
857 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 855 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
858 iterator.Advance(); 856 iterator.Advance();
859 CHECK(iterator.done()); 857 CHECK(iterator.done());
860 } 858 }
861 859
862 } // namespace interpreter 860 } // namespace interpreter
863 } // namespace internal 861 } // namespace internal
864 } // namespace v8 862 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698