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