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