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

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

Issue 2489513005: [Interpreter] Remove all Ldr style bytecodes and replace with Star lookahead. (Closed)
Patch Set: Created 4 years, 1 month 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 .LoadLiteral(Smi::FromInt(8)) 47 .LoadLiteral(Smi::FromInt(8))
48 .CompareOperation(Token::Value::NE, reg, 48 .CompareOperation(Token::Value::NE, reg,
49 1) // Prevent peephole optimization 49 1) // Prevent peephole optimization
50 // LdaSmi, Star -> LdrSmi. 50 // LdaSmi, Star -> LdrSmi.
51 .StoreAccumulatorInRegister(reg) 51 .StoreAccumulatorInRegister(reg)
52 .LoadLiteral(Smi::FromInt(10000000)) 52 .LoadLiteral(Smi::FromInt(10000000))
53 .StoreAccumulatorInRegister(reg) 53 .StoreAccumulatorInRegister(reg)
54 .LoadLiteral(factory->NewStringFromStaticChars("A constant")) 54 .LoadLiteral(factory->NewStringFromStaticChars("A constant"))
55 .StoreAccumulatorInRegister(reg) 55 .StoreAccumulatorInRegister(reg)
56 .LoadUndefined() 56 .LoadUndefined()
57 .Debugger() // Prevent peephole optimization LdaNull, Star -> LdrNull. 57 .StoreAccumulatorInRegister(reg)
58 .LoadNull() 58 .LoadNull()
59 .StoreAccumulatorInRegister(reg) 59 .StoreAccumulatorInRegister(reg)
60 .LoadTheHole() 60 .LoadTheHole()
61 .StoreAccumulatorInRegister(reg) 61 .StoreAccumulatorInRegister(reg)
62 .LoadTrue() 62 .LoadTrue()
63 .StoreAccumulatorInRegister(reg) 63 .StoreAccumulatorInRegister(reg)
64 .LoadFalse() 64 .LoadFalse()
65 .StoreAccumulatorInRegister(wide); 65 .StoreAccumulatorInRegister(wide);
66 66
67 // Emit Ldar and Star taking care to foil the register optimizer. 67 // Emit Ldar and Star taking care to foil the register optimizer.
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 301
302 // Emit wide context operations. 302 // Emit wide context operations.
303 builder.LoadContextSlot(reg, 1024, 0).StoreContextSlot(reg, 1024, 0); 303 builder.LoadContextSlot(reg, 1024, 0).StoreContextSlot(reg, 1024, 0);
304 304
305 // Emit wide load / store lookup slots. 305 // Emit wide load / store lookup slots.
306 builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF) 306 builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF)
307 .LoadLookupSlot(wide_name, TypeofMode::INSIDE_TYPEOF) 307 .LoadLookupSlot(wide_name, TypeofMode::INSIDE_TYPEOF)
308 .StoreLookupSlot(wide_name, LanguageMode::SLOPPY) 308 .StoreLookupSlot(wide_name, LanguageMode::SLOPPY)
309 .StoreLookupSlot(wide_name, LanguageMode::STRICT); 309 .StoreLookupSlot(wide_name, LanguageMode::STRICT);
310 310
311 // Emit loads which will be transformed to Ldr equivalents by the peephole
312 // optimizer.
313 builder.LoadContextSlot(reg, 1, 0)
314 .StoreAccumulatorInRegister(reg)
315 .LoadContextSlot(Register::current_context(), 1, 0)
316 .StoreAccumulatorInRegister(reg)
317 .LoadGlobal(0, TypeofMode::NOT_INSIDE_TYPEOF)
318 .StoreAccumulatorInRegister(reg)
319 .LoadUndefined()
320 .StoreAccumulatorInRegister(reg);
321
322 // CreateClosureWide 311 // CreateClosureWide
323 builder.CreateClosure(1000, NOT_TENURED); 312 builder.CreateClosure(1000, NOT_TENURED);
324 313
325 // Emit wide variant of literal creation operations. 314 // Emit wide variant of literal creation operations.
326 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"), 315 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"),
327 0, 0) 316 0, 0)
328 .CreateArrayLiteral(factory->NewFixedArray(2), 0, 0) 317 .CreateArrayLiteral(factory->NewFixedArray(2), 0, 0)
329 .CreateObjectLiteral(factory->NewFixedArray(2), 0, 0, reg); 318 .CreateObjectLiteral(factory->NewFixedArray(2), 0, 0, reg);
330 319
331 // Emit load and store operations for module variables. 320 // Emit load and store operations for module variables.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 } 374 }
386 375
387 // Insert entry for illegal bytecode as this is never willingly emitted. 376 // Insert entry for illegal bytecode as this is never willingly emitted.
388 scorecard[Bytecodes::ToByte(Bytecode::kIllegal)] = 1; 377 scorecard[Bytecodes::ToByte(Bytecode::kIllegal)] = 1;
389 378
390 // Insert entry for nop bytecode as this often gets optimized out. 379 // Insert entry for nop bytecode as this often gets optimized out.
391 scorecard[Bytecodes::ToByte(Bytecode::kNop)] = 1; 380 scorecard[Bytecodes::ToByte(Bytecode::kNop)] = 1;
392 381
393 if (!FLAG_ignition_peephole) { 382 if (!FLAG_ignition_peephole) {
394 // Insert entries for bytecodes only emitted by peephole optimizer. 383 // Insert entries for bytecodes only emitted by peephole optimizer.
395 scorecard[Bytecodes::ToByte(Bytecode::kLdrGlobal)] = 1;
396 scorecard[Bytecodes::ToByte(Bytecode::kLdrContextSlot)] = 1;
397 scorecard[Bytecodes::ToByte(Bytecode::kLdrCurrentContextSlot)] = 1;
398 scorecard[Bytecodes::ToByte(Bytecode::kLdrUndefined)] = 1;
399 scorecard[Bytecodes::ToByte(Bytecode::kLogicalNot)] = 1; 384 scorecard[Bytecodes::ToByte(Bytecode::kLogicalNot)] = 1;
400 scorecard[Bytecodes::ToByte(Bytecode::kJump)] = 1; 385 scorecard[Bytecodes::ToByte(Bytecode::kJump)] = 1;
401 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrue)] = 1; 386 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrue)] = 1;
402 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalse)] = 1; 387 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalse)] = 1;
403 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrueConstant)] = 1; 388 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrueConstant)] = 1;
404 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalseConstant)] = 1; 389 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalseConstant)] = 1;
405 scorecard[Bytecodes::ToByte(Bytecode::kAddSmi)] = 1; 390 scorecard[Bytecodes::ToByte(Bytecode::kAddSmi)] = 1;
406 scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1; 391 scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1;
407 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1; 392 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1;
408 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseOrSmi)] = 1; 393 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseOrSmi)] = 1;
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 iterator.Advance(); 725 iterator.Advance();
741 } 726 }
742 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 727 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
743 iterator.Advance(); 728 iterator.Advance();
744 CHECK(iterator.done()); 729 CHECK(iterator.done());
745 } 730 }
746 731
747 } // namespace interpreter 732 } // namespace interpreter
748 } // namespace internal 733 } // namespace internal
749 } // namespace v8 734 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698