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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 ExtraICState GetExtraICState() const FINAL { | 820 ExtraICState GetExtraICState() const FINAL { |
821 return static_cast<ExtraICState>(minor_key_); | 821 return static_cast<ExtraICState>(minor_key_); |
822 } | 822 } |
823 | 823 |
824 protected: | 824 protected: |
825 bool CallAsMethod() const { | 825 bool CallAsMethod() const { |
826 return state().call_type() == CallICState::METHOD; | 826 return state().call_type() == CallICState::METHOD; |
827 } | 827 } |
828 | 828 |
829 int arg_count() const { return state().arg_count(); } | 829 int arg_count() const { return state().arg_count(); } |
| 830 bool is_spread() const { return state().is_spread(); } |
830 | 831 |
831 CallICState state() const { | 832 CallICState state() const { |
832 return CallICState(static_cast<ExtraICState>(minor_key_)); | 833 return CallICState(static_cast<ExtraICState>(minor_key_)); |
833 } | 834 } |
834 | 835 |
835 // Code generation helpers. | 836 // Code generation helpers. |
836 void GenerateMiss(MacroAssembler* masm); | 837 void GenerateMiss(MacroAssembler* masm); |
837 | 838 |
838 private: | 839 private: |
839 void PrintState(std::ostream& os) const OVERRIDE; // NOLINT | 840 void PrintState(std::ostream& os) const OVERRIDE; // NOLINT |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1645 static const int kIndex = 1; | 1646 static const int kIndex = 1; |
1646 static const int kInput = 2; | 1647 static const int kInput = 2; |
1647 | 1648 |
1648 DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpConstructResult); | 1649 DEFINE_CALL_INTERFACE_DESCRIPTOR(RegExpConstructResult); |
1649 DEFINE_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub); | 1650 DEFINE_HYDROGEN_CODE_STUB(RegExpConstructResult, HydrogenCodeStub); |
1650 }; | 1651 }; |
1651 | 1652 |
1652 | 1653 |
1653 class CallFunctionStub: public PlatformCodeStub { | 1654 class CallFunctionStub: public PlatformCodeStub { |
1654 public: | 1655 public: |
1655 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) | 1656 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags, |
| 1657 bool is_spread = false) |
1656 : PlatformCodeStub(isolate) { | 1658 : PlatformCodeStub(isolate) { |
1657 DCHECK(argc >= 0 && argc <= Code::kMaxArguments); | 1659 DCHECK(argc >= 0 && argc <= Code::kMaxArguments); |
1658 minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags); | 1660 minor_key_ = ArgcBits::encode(argc) | FlagBits::encode(flags) | |
| 1661 IsSpreadBits::encode(is_spread); |
1659 } | 1662 } |
1660 | 1663 |
1661 static int ExtractArgcFromMinorKey(int minor_key) { | 1664 static int ExtractArgcFromMinorKey(int minor_key) { |
1662 return ArgcBits::decode(minor_key); | 1665 return ArgcBits::decode(minor_key); |
1663 } | 1666 } |
1664 | 1667 |
1665 private: | 1668 private: |
1666 int argc() const { return ArgcBits::decode(minor_key_); } | 1669 int argc() const { return ArgcBits::decode(minor_key_); } |
1667 int flags() const { return FlagBits::decode(minor_key_); } | 1670 int flags() const { return FlagBits::decode(minor_key_); } |
1668 | 1671 |
1669 bool CallAsMethod() const { | 1672 bool CallAsMethod() const { |
1670 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; | 1673 return flags() == CALL_AS_METHOD || flags() == WRAP_AND_CALL; |
1671 } | 1674 } |
1672 | 1675 |
| 1676 bool is_spread() const { return IsSpreadBits::decode(minor_key_); } |
| 1677 |
1673 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } | 1678 bool NeedsChecks() const { return flags() != WRAP_AND_CALL; } |
1674 | 1679 |
1675 void PrintName(std::ostream& os) const OVERRIDE; // NOLINT | 1680 void PrintName(std::ostream& os) const OVERRIDE; // NOLINT |
1676 | 1681 |
1677 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. | 1682 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. |
1678 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {}; | 1683 class FlagBits : public BitField<CallFunctionFlags, 0, 2> {}; |
1679 class ArgcBits : public BitField<unsigned, 2, Code::kArgumentsBits> {}; | 1684 class IsSpreadBits : public BitField<bool, FlagBits::kNext, 1> {}; |
1680 STATIC_ASSERT(Code::kArgumentsBits + 2 <= kStubMinorKeyBits); | 1685 class ArgcBits : public BitField<unsigned, IsSpreadBits::kNext, |
| 1686 Code::kArgumentsBits> {}; |
| 1687 |
| 1688 STATIC_ASSERT(Code::kArgumentsBits + 3 <= kStubMinorKeyBits); |
1681 | 1689 |
1682 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction); | 1690 DEFINE_CALL_INTERFACE_DESCRIPTOR(CallFunction); |
1683 DEFINE_PLATFORM_CODE_STUB(CallFunction, PlatformCodeStub); | 1691 DEFINE_PLATFORM_CODE_STUB(CallFunction, PlatformCodeStub); |
1684 }; | 1692 }; |
1685 | 1693 |
1686 | 1694 |
1687 class CallConstructStub: public PlatformCodeStub { | 1695 class CallConstructStub: public PlatformCodeStub { |
1688 public: | 1696 public: |
1689 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) | 1697 CallConstructStub(Isolate* isolate, CallConstructorFlags flags) |
1690 : PlatformCodeStub(isolate) { | 1698 : PlatformCodeStub(isolate) { |
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2690 | 2698 |
2691 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR | 2699 #undef DEFINE_CALL_INTERFACE_DESCRIPTOR |
2692 #undef DEFINE_PLATFORM_CODE_STUB | 2700 #undef DEFINE_PLATFORM_CODE_STUB |
2693 #undef DEFINE_HANDLER_CODE_STUB | 2701 #undef DEFINE_HANDLER_CODE_STUB |
2694 #undef DEFINE_HYDROGEN_CODE_STUB | 2702 #undef DEFINE_HYDROGEN_CODE_STUB |
2695 #undef DEFINE_CODE_STUB | 2703 #undef DEFINE_CODE_STUB |
2696 #undef DEFINE_CODE_STUB_BASE | 2704 #undef DEFINE_CODE_STUB_BASE |
2697 } } // namespace v8::internal | 2705 } } // namespace v8::internal |
2698 | 2706 |
2699 #endif // V8_CODE_STUBS_H_ | 2707 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |