OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 void Generate(MacroAssembler* masm); | 436 void Generate(MacroAssembler* masm); |
437 | 437 |
438 private: | 438 private: |
439 int slots_; | 439 int slots_; |
440 | 440 |
441 Major MajorKey() { return FastNewBlockContext; } | 441 Major MajorKey() { return FastNewBlockContext; } |
442 int MinorKey() { return slots_; } | 442 int MinorKey() { return slots_; } |
443 }; | 443 }; |
444 | 444 |
445 | 445 |
446 class FastCloneShallowArrayStub : public PlatformCodeStub { | 446 class FastCloneShallowArrayStub : public HydrogenCodeStub { |
447 public: | 447 public: |
448 // Maximum length of copied elements array. | 448 // Maximum length of copied elements array. |
449 static const int kMaximumClonedLength = 8; | 449 static const int kMaximumClonedLength = 8; |
450 enum Mode { | 450 enum Mode { |
451 CLONE_ELEMENTS, | 451 CLONE_ELEMENTS, |
452 CLONE_DOUBLE_ELEMENTS, | 452 CLONE_DOUBLE_ELEMENTS, |
453 COPY_ON_WRITE_ELEMENTS, | 453 COPY_ON_WRITE_ELEMENTS, |
454 CLONE_ANY_ELEMENTS, | 454 CLONE_ANY_ELEMENTS, |
455 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS | 455 LAST_CLONE_MODE = CLONE_ANY_ELEMENTS |
456 }; | 456 }; |
457 | 457 |
458 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1; | 458 static const int kFastCloneModeCount = LAST_CLONE_MODE + 1; |
459 | 459 |
460 FastCloneShallowArrayStub(Mode mode, | 460 FastCloneShallowArrayStub(Mode mode, |
461 AllocationSiteMode allocation_site_mode, | 461 AllocationSiteMode allocation_site_mode, |
462 int length) | 462 int length) |
463 : mode_(mode), | 463 : mode_(mode), |
464 allocation_site_mode_(allocation_site_mode), | 464 allocation_site_mode_(allocation_site_mode), |
465 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { | 465 length_((mode == COPY_ON_WRITE_ELEMENTS) ? 0 : length) { |
466 ASSERT_GE(length_, 0); | 466 ASSERT_GE(length_, 0); |
467 ASSERT_LE(length_, kMaximumClonedLength); | 467 ASSERT_LE(length_, kMaximumClonedLength); |
468 } | 468 } |
469 | 469 |
470 void Generate(MacroAssembler* masm); | 470 Mode mode() const { return mode_; } |
| 471 int length() const { return length_; } |
| 472 AllocationSiteMode allocation_site_mode() const { |
| 473 return allocation_site_mode_; |
| 474 } |
| 475 |
| 476 ElementsKind ComputeElementsKind() const { |
| 477 switch (mode()) { |
| 478 case CLONE_ELEMENTS: |
| 479 case COPY_ON_WRITE_ELEMENTS: |
| 480 return FAST_ELEMENTS; |
| 481 case CLONE_DOUBLE_ELEMENTS: |
| 482 return FAST_DOUBLE_ELEMENTS; |
| 483 case CLONE_ANY_ELEMENTS: |
| 484 /*fall-through*/; |
| 485 } |
| 486 UNREACHABLE(); |
| 487 return LAST_ELEMENTS_KIND; |
| 488 } |
| 489 |
| 490 virtual Handle<Code> GenerateCode(); |
| 491 |
| 492 virtual void InitializeInterfaceDescriptor( |
| 493 Isolate* isolate, |
| 494 CodeStubInterfaceDescriptor* descriptor); |
471 | 495 |
472 private: | 496 private: |
473 Mode mode_; | 497 Mode mode_; |
474 AllocationSiteMode allocation_site_mode_; | 498 AllocationSiteMode allocation_site_mode_; |
475 int length_; | 499 int length_; |
476 | 500 |
477 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; | 501 class AllocationSiteModeBits: public BitField<AllocationSiteMode, 0, 1> {}; |
478 class ModeBits: public BitField<Mode, 1, 4> {}; | 502 class ModeBits: public BitField<Mode, 1, 4> {}; |
479 class LengthBits: public BitField<int, 5, 4> {}; | 503 class LengthBits: public BitField<int, 5, 4> {}; |
480 // Ensure data fits within available bits. | 504 // Ensure data fits within available bits. |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1597 | 1621 |
1598 bool fp_registers_; | 1622 bool fp_registers_; |
1599 | 1623 |
1600 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); | 1624 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); |
1601 }; | 1625 }; |
1602 | 1626 |
1603 | 1627 |
1604 class StubFailureTrampolineStub : public PlatformCodeStub { | 1628 class StubFailureTrampolineStub : public PlatformCodeStub { |
1605 public: | 1629 public: |
1606 explicit StubFailureTrampolineStub(StubFunctionMode function_mode) | 1630 explicit StubFailureTrampolineStub(StubFunctionMode function_mode) |
1607 : function_mode_(function_mode) {} | 1631 : fp_registers_(CanUseFPRegisters()), function_mode_(function_mode) {} |
1608 | 1632 |
1609 virtual bool IsPregenerated() { return true; } | 1633 virtual bool IsPregenerated() { return true; } |
1610 | 1634 |
1611 static void GenerateAheadOfTime(Isolate* isolate); | 1635 static void GenerateAheadOfTime(Isolate* isolate); |
1612 | 1636 |
1613 private: | 1637 private: |
| 1638 class FPRegisters: public BitField<bool, 0, 1> {}; |
| 1639 class FunctionModeField: public BitField<StubFunctionMode, 1, 1> {}; |
| 1640 |
1614 Major MajorKey() { return StubFailureTrampoline; } | 1641 Major MajorKey() { return StubFailureTrampoline; } |
1615 int MinorKey() { return static_cast<int>(function_mode_); } | 1642 int MinorKey() { |
| 1643 return FPRegisters::encode(fp_registers_) | |
| 1644 FunctionModeField::encode(function_mode_); |
| 1645 } |
1616 | 1646 |
1617 void Generate(MacroAssembler* masm); | 1647 void Generate(MacroAssembler* masm); |
1618 | 1648 |
| 1649 bool fp_registers_; |
1619 StubFunctionMode function_mode_; | 1650 StubFunctionMode function_mode_; |
1620 | 1651 |
1621 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); | 1652 DISALLOW_COPY_AND_ASSIGN(StubFailureTrampolineStub); |
1622 }; | 1653 }; |
1623 | 1654 |
1624 | 1655 |
1625 class ProfileEntryHookStub : public PlatformCodeStub { | 1656 class ProfileEntryHookStub : public PlatformCodeStub { |
1626 public: | 1657 public: |
1627 explicit ProfileEntryHookStub() {} | 1658 explicit ProfileEntryHookStub() {} |
1628 | 1659 |
(...skipping 21 matching lines...) Expand all Loading... |
1650 | 1681 |
1651 // The current function entry hook. | 1682 // The current function entry hook. |
1652 static FunctionEntryHook entry_hook_; | 1683 static FunctionEntryHook entry_hook_; |
1653 | 1684 |
1654 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 1685 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1655 }; | 1686 }; |
1656 | 1687 |
1657 } } // namespace v8::internal | 1688 } } // namespace v8::internal |
1658 | 1689 |
1659 #endif // V8_CODE_STUBS_H_ | 1690 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |