OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #ifndef V8_CODE_STUBS_H_ | 5 #ifndef V8_CODE_STUBS_H_ |
6 #define V8_CODE_STUBS_H_ | 6 #define V8_CODE_STUBS_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1585 | 1585 |
1586 class ArgumentsAccessStub: public PlatformCodeStub { | 1586 class ArgumentsAccessStub: public PlatformCodeStub { |
1587 public: | 1587 public: |
1588 enum Type { | 1588 enum Type { |
1589 READ_ELEMENT, | 1589 READ_ELEMENT, |
1590 NEW_SLOPPY_FAST, | 1590 NEW_SLOPPY_FAST, |
1591 NEW_SLOPPY_SLOW, | 1591 NEW_SLOPPY_SLOW, |
1592 NEW_STRICT | 1592 NEW_STRICT |
1593 }; | 1593 }; |
1594 | 1594 |
1595 ArgumentsAccessStub(Isolate* isolate, Type type) : PlatformCodeStub(isolate) { | 1595 enum HasNewTarget { NO_NEW_TARGET, HAS_NEW_TARGET }; |
1596 minor_key_ = TypeBits::encode(type); | 1596 |
| 1597 ArgumentsAccessStub(Isolate* isolate, Type type, |
| 1598 HasNewTarget has_new_target = NO_NEW_TARGET) |
| 1599 : PlatformCodeStub(isolate) { |
| 1600 minor_key_ = |
| 1601 TypeBits::encode(type) | HasNewTargetBits::encode(has_new_target); |
1597 } | 1602 } |
1598 | 1603 |
1599 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { | 1604 CallInterfaceDescriptor GetCallInterfaceDescriptor() OVERRIDE { |
1600 if (type() == READ_ELEMENT) { | 1605 if (type() == READ_ELEMENT) { |
1601 return ArgumentsAccessReadDescriptor(isolate()); | 1606 return ArgumentsAccessReadDescriptor(isolate()); |
1602 } | 1607 } |
1603 return ContextOnlyDescriptor(isolate()); | 1608 return ContextOnlyDescriptor(isolate()); |
1604 } | 1609 } |
1605 | 1610 |
1606 private: | 1611 private: |
1607 Type type() const { return TypeBits::decode(minor_key_); } | 1612 Type type() const { return TypeBits::decode(minor_key_); } |
| 1613 bool has_new_target() const { |
| 1614 return HasNewTargetBits::decode(minor_key_) == HAS_NEW_TARGET; |
| 1615 } |
1608 | 1616 |
1609 void GenerateReadElement(MacroAssembler* masm); | 1617 void GenerateReadElement(MacroAssembler* masm); |
1610 void GenerateNewStrict(MacroAssembler* masm); | 1618 void GenerateNewStrict(MacroAssembler* masm); |
1611 void GenerateNewSloppyFast(MacroAssembler* masm); | 1619 void GenerateNewSloppyFast(MacroAssembler* masm); |
1612 void GenerateNewSloppySlow(MacroAssembler* masm); | 1620 void GenerateNewSloppySlow(MacroAssembler* masm); |
1613 | 1621 |
1614 void PrintName(std::ostream& os) const OVERRIDE; // NOLINT | 1622 void PrintName(std::ostream& os) const OVERRIDE; // NOLINT |
1615 | 1623 |
1616 class TypeBits : public BitField<Type, 0, 2> {}; | 1624 class TypeBits : public BitField<Type, 0, 2> {}; |
| 1625 class HasNewTargetBits : public BitField<HasNewTarget, 2, 1> {}; |
1617 | 1626 |
1618 DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub); | 1627 DEFINE_PLATFORM_CODE_STUB(ArgumentsAccess, PlatformCodeStub); |
1619 }; | 1628 }; |
1620 | 1629 |
1621 | 1630 |
1622 class RegExpExecStub: public PlatformCodeStub { | 1631 class RegExpExecStub: public PlatformCodeStub { |
1623 public: | 1632 public: |
1624 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } | 1633 explicit RegExpExecStub(Isolate* isolate) : PlatformCodeStub(isolate) { } |
1625 | 1634 |
1626 DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly); | 1635 DEFINE_CALL_INTERFACE_DESCRIPTOR(ContextOnly); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1688 code->set_has_function_cache(RecordCallTarget()); | 1697 code->set_has_function_cache(RecordCallTarget()); |
1689 } | 1698 } |
1690 | 1699 |
1691 private: | 1700 private: |
1692 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); } | 1701 CallConstructorFlags flags() const { return FlagBits::decode(minor_key_); } |
1693 | 1702 |
1694 bool RecordCallTarget() const { | 1703 bool RecordCallTarget() const { |
1695 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0; | 1704 return (flags() & RECORD_CONSTRUCTOR_TARGET) != 0; |
1696 } | 1705 } |
1697 | 1706 |
| 1707 bool IsSuperConstructorCall() const { |
| 1708 return (flags() & SUPER_CONSTRUCTOR_CALL) != 0; |
| 1709 } |
| 1710 |
1698 void PrintName(std::ostream& os) const OVERRIDE; // NOLINT | 1711 void PrintName(std::ostream& os) const OVERRIDE; // NOLINT |
1699 | 1712 |
1700 class FlagBits : public BitField<CallConstructorFlags, 0, 1> {}; | 1713 class FlagBits : public BitField<CallConstructorFlags, 0, 2> {}; |
1701 | 1714 |
1702 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallConstruct); | 1715 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallConstruct); |
1703 DEFINE_PLATFORM_CODE_STUB(CallConstruct, PlatformCodeStub); | 1716 DEFINE_PLATFORM_CODE_STUB(CallConstruct, PlatformCodeStub); |
1704 }; | 1717 }; |
1705 | 1718 |
1706 | 1719 |
1707 enum StringIndexFlags { | 1720 enum StringIndexFlags { |
1708 // Accepts smis or heap numbers. | 1721 // Accepts smis or heap numbers. |
1709 STRING_INDEX_IS_NUMBER, | 1722 STRING_INDEX_IS_NUMBER, |
1710 | 1723 |
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 | 2692 |
2680 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2693 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2681 #undef DEFINE_PLATFORM_CODE_STUB | 2694 #undef DEFINE_PLATFORM_CODE_STUB |
2682 #undef DEFINE_HANDLER_CODE_STUB | 2695 #undef DEFINE_HANDLER_CODE_STUB |
2683 #undef DEFINE_HYDROGEN_CODE_STUB | 2696 #undef DEFINE_HYDROGEN_CODE_STUB |
2684 #undef DEFINE_CODE_STUB | 2697 #undef DEFINE_CODE_STUB |
2685 #undef DEFINE_CODE_STUB_BASE | 2698 #undef DEFINE_CODE_STUB_BASE |
2686 } } // namespace v8::internal | 2699 } } // namespace v8::internal |
2687 | 2700 |
2688 #endif // V8_CODE_STUBS_H_ | 2701 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |