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

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

Issue 2459513002: [ignition] Add bytecodes for loads/stores in the current context (Closed)
Patch Set: s/LocalContext/CurrentContext/g 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
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/OuterContextVariables.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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 .LoadGlobal(1, TypeofMode::INSIDE_TYPEOF) 81 .LoadGlobal(1, TypeofMode::INSIDE_TYPEOF)
82 .StoreGlobal(name, 1, LanguageMode::SLOPPY) 82 .StoreGlobal(name, 1, LanguageMode::SLOPPY)
83 .StoreGlobal(name, 1, LanguageMode::STRICT); 83 .StoreGlobal(name, 1, LanguageMode::STRICT);
84 84
85 // Emit context operations. 85 // Emit context operations.
86 builder.PushContext(reg) 86 builder.PushContext(reg)
87 .PopContext(reg) 87 .PopContext(reg)
88 .LoadContextSlot(reg, 1, 0) 88 .LoadContextSlot(reg, 1, 0)
89 .StoreContextSlot(reg, 1, 0); 89 .StoreContextSlot(reg, 1, 0);
90 90
91 // Emit context operations which operate on the local context.
92 builder.LoadContextSlot(Register::current_context(), 1, 0)
93 .StoreContextSlot(Register::current_context(), 1, 0);
94
91 // Emit load / store property operations. 95 // Emit load / store property operations.
92 builder.LoadNamedProperty(reg, name, 0) 96 builder.LoadNamedProperty(reg, name, 0)
93 .LoadKeyedProperty(reg, 0) 97 .LoadKeyedProperty(reg, 0)
94 .StoreNamedProperty(reg, name, 0, LanguageMode::SLOPPY) 98 .StoreNamedProperty(reg, name, 0, LanguageMode::SLOPPY)
95 .StoreKeyedProperty(reg, reg, 0, LanguageMode::SLOPPY) 99 .StoreKeyedProperty(reg, reg, 0, LanguageMode::SLOPPY)
96 .StoreNamedProperty(reg, name, 0, LanguageMode::STRICT) 100 .StoreNamedProperty(reg, name, 0, LanguageMode::STRICT)
97 .StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT); 101 .StoreKeyedProperty(reg, reg, 0, LanguageMode::STRICT);
98 102
99 // Emit load / store lookup slots. 103 // Emit load / store lookup slots.
100 builder.LoadLookupSlot(name, TypeofMode::NOT_INSIDE_TYPEOF) 104 builder.LoadLookupSlot(name, TypeofMode::NOT_INSIDE_TYPEOF)
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 .StoreLookupSlot(wide_name, LanguageMode::STRICT); 309 .StoreLookupSlot(wide_name, LanguageMode::STRICT);
306 310
307 // Emit loads which will be transformed to Ldr equivalents by the peephole 311 // Emit loads which will be transformed to Ldr equivalents by the peephole
308 // optimizer. 312 // optimizer.
309 builder.LoadNamedProperty(reg, name, 0) 313 builder.LoadNamedProperty(reg, name, 0)
310 .StoreAccumulatorInRegister(reg) 314 .StoreAccumulatorInRegister(reg)
311 .LoadKeyedProperty(reg, 0) 315 .LoadKeyedProperty(reg, 0)
312 .StoreAccumulatorInRegister(reg) 316 .StoreAccumulatorInRegister(reg)
313 .LoadContextSlot(reg, 1, 0) 317 .LoadContextSlot(reg, 1, 0)
314 .StoreAccumulatorInRegister(reg) 318 .StoreAccumulatorInRegister(reg)
319 .LoadContextSlot(Register::current_context(), 1, 0)
320 .StoreAccumulatorInRegister(reg)
315 .LoadGlobal(0, TypeofMode::NOT_INSIDE_TYPEOF) 321 .LoadGlobal(0, TypeofMode::NOT_INSIDE_TYPEOF)
316 .StoreAccumulatorInRegister(reg) 322 .StoreAccumulatorInRegister(reg)
317 .LoadUndefined() 323 .LoadUndefined()
318 .StoreAccumulatorInRegister(reg); 324 .StoreAccumulatorInRegister(reg);
319 325
320 // CreateClosureWide 326 // CreateClosureWide
321 builder.CreateClosure(1000, NOT_TENURED); 327 builder.CreateClosure(1000, NOT_TENURED);
322 328
323 // Emit wide variant of literal creation operations. 329 // Emit wide variant of literal creation operations.
324 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"), 330 builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("wide_literal"),
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 385
380 // Insert entry for nop bytecode as this often gets optimized out. 386 // Insert entry for nop bytecode as this often gets optimized out.
381 scorecard[Bytecodes::ToByte(Bytecode::kNop)] = 1; 387 scorecard[Bytecodes::ToByte(Bytecode::kNop)] = 1;
382 388
383 if (!FLAG_ignition_peephole) { 389 if (!FLAG_ignition_peephole) {
384 // Insert entries for bytecodes only emitted by peephole optimizer. 390 // Insert entries for bytecodes only emitted by peephole optimizer.
385 scorecard[Bytecodes::ToByte(Bytecode::kLdrNamedProperty)] = 1; 391 scorecard[Bytecodes::ToByte(Bytecode::kLdrNamedProperty)] = 1;
386 scorecard[Bytecodes::ToByte(Bytecode::kLdrKeyedProperty)] = 1; 392 scorecard[Bytecodes::ToByte(Bytecode::kLdrKeyedProperty)] = 1;
387 scorecard[Bytecodes::ToByte(Bytecode::kLdrGlobal)] = 1; 393 scorecard[Bytecodes::ToByte(Bytecode::kLdrGlobal)] = 1;
388 scorecard[Bytecodes::ToByte(Bytecode::kLdrContextSlot)] = 1; 394 scorecard[Bytecodes::ToByte(Bytecode::kLdrContextSlot)] = 1;
395 scorecard[Bytecodes::ToByte(Bytecode::kLdrCurrentContextSlot)] = 1;
389 scorecard[Bytecodes::ToByte(Bytecode::kLdrUndefined)] = 1; 396 scorecard[Bytecodes::ToByte(Bytecode::kLdrUndefined)] = 1;
390 scorecard[Bytecodes::ToByte(Bytecode::kLogicalNot)] = 1; 397 scorecard[Bytecodes::ToByte(Bytecode::kLogicalNot)] = 1;
391 scorecard[Bytecodes::ToByte(Bytecode::kJump)] = 1; 398 scorecard[Bytecodes::ToByte(Bytecode::kJump)] = 1;
392 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrue)] = 1; 399 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrue)] = 1;
393 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalse)] = 1; 400 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalse)] = 1;
394 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrueConstant)] = 1; 401 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfTrueConstant)] = 1;
395 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalseConstant)] = 1; 402 scorecard[Bytecodes::ToByte(Bytecode::kJumpIfFalseConstant)] = 1;
396 scorecard[Bytecodes::ToByte(Bytecode::kAddSmi)] = 1; 403 scorecard[Bytecodes::ToByte(Bytecode::kAddSmi)] = 1;
397 scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1; 404 scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1;
398 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1; 405 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1;
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 iterator.Advance(); 738 iterator.Advance();
732 } 739 }
733 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 740 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
734 iterator.Advance(); 741 iterator.Advance();
735 CHECK(iterator.done()); 742 CHECK(iterator.done());
736 } 743 }
737 744
738 } // namespace interpreter 745 } // namespace interpreter
739 } // namespace internal 746 } // namespace internal
740 } // namespace v8 747 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698