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

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

Issue 2677163003: WIP: type profiling. (Closed)
Patch Set: Rebaseline. Created 3 years, 10 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
« no previous file with comments | « test/mjsunit/debug-collect-type-profile.js ('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/ast/scopes.h" 7 #include "src/ast/scopes.h"
8 #include "src/interpreter/bytecode-array-builder.h" 8 #include "src/interpreter/bytecode-array-builder.h"
9 #include "src/interpreter/bytecode-array-iterator.h" 9 #include "src/interpreter/bytecode-array-iterator.h"
10 #include "src/interpreter/bytecode-label.h" 10 #include "src/interpreter/bytecode-label.h"
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 builder.LoadNamedProperty(reg, wide_name, 0) 330 builder.LoadNamedProperty(reg, wide_name, 0)
331 .LoadKeyedProperty(reg, 2056) 331 .LoadKeyedProperty(reg, 2056)
332 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY) 332 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY)
333 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY) 333 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY)
334 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::STRICT) 334 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::STRICT)
335 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT); 335 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT);
336 336
337 builder.StoreDataPropertyInLiteral(reg, reg, 337 builder.StoreDataPropertyInLiteral(reg, reg,
338 DataPropertyInLiteralFlag::kNoFlags, 0); 338 DataPropertyInLiteralFlag::kNoFlags, 0);
339 339
340 builder.CollectTypeProfile(reg, reg, 0);
341
340 // Emit wide context operations. 342 // Emit wide context operations.
341 builder.LoadContextSlot(reg, 1024, 0, BytecodeArrayBuilder::kMutableSlot) 343 builder.LoadContextSlot(reg, 1024, 0, BytecodeArrayBuilder::kMutableSlot)
342 .StoreContextSlot(reg, 1024, 0); 344 .StoreContextSlot(reg, 1024, 0);
343 345
344 // Emit wide load / store lookup slots. 346 // Emit wide load / store lookup slots.
345 builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF) 347 builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF)
346 .LoadLookupSlot(wide_name, TypeofMode::INSIDE_TYPEOF) 348 .LoadLookupSlot(wide_name, TypeofMode::INSIDE_TYPEOF)
347 .StoreLookupSlot(wide_name, LanguageMode::SLOPPY) 349 .StoreLookupSlot(wide_name, LanguageMode::SLOPPY)
348 .StoreLookupSlot(wide_name, LanguageMode::STRICT); 350 .StoreLookupSlot(wide_name, LanguageMode::STRICT);
349 351
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1; 434 scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1;
433 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1; 435 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1;
434 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseOrSmi)] = 1; 436 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseOrSmi)] = 1;
435 scorecard[Bytecodes::ToByte(Bytecode::kShiftLeftSmi)] = 1; 437 scorecard[Bytecodes::ToByte(Bytecode::kShiftLeftSmi)] = 1;
436 scorecard[Bytecodes::ToByte(Bytecode::kShiftRightSmi)] = 1; 438 scorecard[Bytecodes::ToByte(Bytecode::kShiftRightSmi)] = 1;
437 scorecard[Bytecodes::ToByte(Bytecode::kTestUndetectable)] = 1; 439 scorecard[Bytecodes::ToByte(Bytecode::kTestUndetectable)] = 1;
438 scorecard[Bytecodes::ToByte(Bytecode::kTestUndefined)] = 1; 440 scorecard[Bytecodes::ToByte(Bytecode::kTestUndefined)] = 1;
439 scorecard[Bytecodes::ToByte(Bytecode::kTestNull)] = 1; 441 scorecard[Bytecodes::ToByte(Bytecode::kTestNull)] = 1;
440 } 442 }
441 443
444 if (!FLAG_type_profile) {
445 // Insert entry for bytecodes only emitted when
446 // Type Information for DevTools is turned on.
447 scorecard[Bytecodes::ToByte(Bytecode::kCollectTypeProfile)] = 1;
448 }
449
442 // Check return occurs at the end and only once in the BytecodeArray. 450 // Check return occurs at the end and only once in the BytecodeArray.
443 CHECK_EQ(final_bytecode, Bytecode::kReturn); 451 CHECK_EQ(final_bytecode, Bytecode::kReturn);
444 CHECK_EQ(scorecard[Bytecodes::ToByte(final_bytecode)], 1); 452 CHECK_EQ(scorecard[Bytecodes::ToByte(final_bytecode)], 1);
445 453
446 #define CHECK_BYTECODE_PRESENT(Name, ...) \ 454 #define CHECK_BYTECODE_PRESENT(Name, ...) \
447 /* Check Bytecode is marked in scorecard, unless it's a debug break */ \ 455 /* Check Bytecode is marked in scorecard, unless it's a debug break */ \
448 if (!Bytecodes::IsDebugBreak(Bytecode::k##Name)) { \ 456 if (!Bytecodes::IsDebugBreak(Bytecode::k##Name)) { \
449 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); \ 457 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); \
450 } 458 }
451 BYTECODE_LIST(CHECK_BYTECODE_PRESENT) 459 BYTECODE_LIST(CHECK_BYTECODE_PRESENT)
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 iterator.Advance(); 782 iterator.Advance();
775 } 783 }
776 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); 784 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
777 iterator.Advance(); 785 iterator.Advance();
778 CHECK(iterator.done()); 786 CHECK(iterator.done());
779 } 787 }
780 788
781 } // namespace interpreter 789 } // namespace interpreter
782 } // namespace internal 790 } // namespace internal
783 } // namespace v8 791 } // namespace v8
OLDNEW
« no previous file with comments | « test/mjsunit/debug-collect-type-profile.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698