OLD | NEW |
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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 .LoadKeyedProperty(reg, 2056) | 332 .LoadKeyedProperty(reg, 2056) |
333 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY) | 333 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::SLOPPY) |
334 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY) | 334 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::SLOPPY) |
335 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::STRICT) | 335 .StoreNamedProperty(reg, wide_name, 0, LanguageMode::STRICT) |
336 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT) | 336 .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT) |
337 .StoreNamedOwnProperty(reg, wide_name, 0); | 337 .StoreNamedOwnProperty(reg, wide_name, 0); |
338 | 338 |
339 builder.StoreDataPropertyInLiteral(reg, reg, | 339 builder.StoreDataPropertyInLiteral(reg, reg, |
340 DataPropertyInLiteralFlag::kNoFlags, 0); | 340 DataPropertyInLiteralFlag::kNoFlags, 0); |
341 | 341 |
| 342 builder.CollectTypeProfile(reg, reg, 0); |
| 343 |
342 // Emit wide context operations. | 344 // Emit wide context operations. |
343 builder.LoadContextSlot(reg, 1024, 0, BytecodeArrayBuilder::kMutableSlot) | 345 builder.LoadContextSlot(reg, 1024, 0, BytecodeArrayBuilder::kMutableSlot) |
344 .StoreContextSlot(reg, 1024, 0); | 346 .StoreContextSlot(reg, 1024, 0); |
345 | 347 |
346 // Emit wide load / store lookup slots. | 348 // Emit wide load / store lookup slots. |
347 builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF) | 349 builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF) |
348 .LoadLookupSlot(wide_name, TypeofMode::INSIDE_TYPEOF) | 350 .LoadLookupSlot(wide_name, TypeofMode::INSIDE_TYPEOF) |
349 .StoreLookupSlot(wide_name, LanguageMode::SLOPPY) | 351 .StoreLookupSlot(wide_name, LanguageMode::SLOPPY) |
350 .StoreLookupSlot(wide_name, LanguageMode::STRICT); | 352 .StoreLookupSlot(wide_name, LanguageMode::STRICT); |
351 | 353 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1; | 436 scorecard[Bytecodes::ToByte(Bytecode::kSubSmi)] = 1; |
435 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1; | 437 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseAndSmi)] = 1; |
436 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseOrSmi)] = 1; | 438 scorecard[Bytecodes::ToByte(Bytecode::kBitwiseOrSmi)] = 1; |
437 scorecard[Bytecodes::ToByte(Bytecode::kShiftLeftSmi)] = 1; | 439 scorecard[Bytecodes::ToByte(Bytecode::kShiftLeftSmi)] = 1; |
438 scorecard[Bytecodes::ToByte(Bytecode::kShiftRightSmi)] = 1; | 440 scorecard[Bytecodes::ToByte(Bytecode::kShiftRightSmi)] = 1; |
439 scorecard[Bytecodes::ToByte(Bytecode::kTestUndetectable)] = 1; | 441 scorecard[Bytecodes::ToByte(Bytecode::kTestUndetectable)] = 1; |
440 scorecard[Bytecodes::ToByte(Bytecode::kTestUndefined)] = 1; | 442 scorecard[Bytecodes::ToByte(Bytecode::kTestUndefined)] = 1; |
441 scorecard[Bytecodes::ToByte(Bytecode::kTestNull)] = 1; | 443 scorecard[Bytecodes::ToByte(Bytecode::kTestNull)] = 1; |
442 } | 444 } |
443 | 445 |
| 446 if (!FLAG_type_profile) { |
| 447 // Insert entry for bytecodes only emitted when |
| 448 // Type Information for DevTools is turned on. |
| 449 scorecard[Bytecodes::ToByte(Bytecode::kCollectTypeProfile)] = 1; |
| 450 } |
| 451 |
444 // Check return occurs at the end and only once in the BytecodeArray. | 452 // Check return occurs at the end and only once in the BytecodeArray. |
445 CHECK_EQ(final_bytecode, Bytecode::kReturn); | 453 CHECK_EQ(final_bytecode, Bytecode::kReturn); |
446 CHECK_EQ(scorecard[Bytecodes::ToByte(final_bytecode)], 1); | 454 CHECK_EQ(scorecard[Bytecodes::ToByte(final_bytecode)], 1); |
447 | 455 |
448 #define CHECK_BYTECODE_PRESENT(Name, ...) \ | 456 #define CHECK_BYTECODE_PRESENT(Name, ...) \ |
449 /* Check Bytecode is marked in scorecard, unless it's a debug break */ \ | 457 /* Check Bytecode is marked in scorecard, unless it's a debug break */ \ |
450 if (!Bytecodes::IsDebugBreak(Bytecode::k##Name)) { \ | 458 if (!Bytecodes::IsDebugBreak(Bytecode::k##Name)) { \ |
451 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); \ | 459 CHECK_GE(scorecard[Bytecodes::ToByte(Bytecode::k##Name)], 1); \ |
452 } | 460 } |
453 BYTECODE_LIST(CHECK_BYTECODE_PRESENT) | 461 BYTECODE_LIST(CHECK_BYTECODE_PRESENT) |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 iterator.Advance(); | 784 iterator.Advance(); |
777 } | 785 } |
778 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); | 786 CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); |
779 iterator.Advance(); | 787 iterator.Advance(); |
780 CHECK(iterator.done()); | 788 CHECK(iterator.done()); |
781 } | 789 } |
782 | 790 |
783 } // namespace interpreter | 791 } // namespace interpreter |
784 } // namespace internal | 792 } // namespace internal |
785 } // namespace v8 | 793 } // namespace v8 |
OLD | NEW |