Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: src/code-stubs.h

Issue 223823002: Revert r20474 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/builtins.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 V(BinaryOpIC) \ 44 V(BinaryOpIC) \
45 V(BinaryOpICWithAllocationSite) \ 45 V(BinaryOpICWithAllocationSite) \
46 V(BinaryOpWithAllocationSite) \ 46 V(BinaryOpWithAllocationSite) \
47 V(StringAdd) \ 47 V(StringAdd) \
48 V(SubString) \ 48 V(SubString) \
49 V(StringCompare) \ 49 V(StringCompare) \
50 V(Compare) \ 50 V(Compare) \
51 V(CompareIC) \ 51 V(CompareIC) \
52 V(CompareNilIC) \ 52 V(CompareNilIC) \
53 V(MathPow) \ 53 V(MathPow) \
54 V(CallIC) \
55 V(FunctionPrototype) \ 54 V(FunctionPrototype) \
56 V(RecordWrite) \ 55 V(RecordWrite) \
57 V(StoreBufferOverflow) \ 56 V(StoreBufferOverflow) \
58 V(RegExpExec) \ 57 V(RegExpExec) \
59 V(Instanceof) \ 58 V(Instanceof) \
60 V(ConvertToDouble) \ 59 V(ConvertToDouble) \
61 V(WriteInt32ToHeapNumber) \ 60 V(WriteInt32ToHeapNumber) \
62 V(StackCheck) \ 61 V(StackCheck) \
63 V(Interrupt) \ 62 V(Interrupt) \
64 V(FastNewClosure) \ 63 V(FastNewClosure) \
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 832
834 virtual int MinorKey() { 833 virtual int MinorKey() {
835 return KindBits::encode(kind_); 834 return KindBits::encode(kind_);
836 } 835 }
837 836
838 private: 837 private:
839 Code::Kind kind_; 838 Code::Kind kind_;
840 }; 839 };
841 840
842 841
843 class CallICStub: public PlatformCodeStub {
844 public:
845 explicit CallICStub(const CallIC::State& state)
846 : state_(state) {}
847
848 bool CallAsMethod() const { return state_.CallAsMethod(); }
849 bool IsGeneric() const {
850 return state_.IsGeneric();
851 }
852 bool ArgumentsMustMatch() const {
853 return state_.ArgumentsMustMatch();
854 }
855 bool IsSloppy() const {
856 return state_.IsSloppy();
857 }
858
859 int arg_count() const { return state_.arg_count(); }
860
861 static int ExtractArgcFromMinorKey(int minor_key) {
862 CallIC::State state((ExtraICState) minor_key);
863 return state.arg_count();
864 }
865
866 virtual void Generate(MacroAssembler* masm);
867
868 virtual Code::Kind GetCodeKind() const V8_OVERRIDE {
869 return Code::CALL_IC;
870 }
871
872 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE {
873 return state_.GetICState();
874 }
875
876 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE {
877 return state_.GetExtraICState();
878 }
879
880 protected:
881 virtual int MinorKey() { return GetExtraICState(); }
882 virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE;
883
884 private:
885 virtual CodeStub::Major MajorKey() { return CallIC; }
886
887 // Code generation helpers.
888 void GenerateMonomorphicCall(MacroAssembler* masm);
889 void GenerateSlowCall(MacroAssembler* masm);
890 void GenerateMiss(MacroAssembler* masm);
891
892 CallIC::State state_;
893 };
894
895
896 class FunctionPrototypeStub: public ICStub { 842 class FunctionPrototypeStub: public ICStub {
897 public: 843 public:
898 explicit FunctionPrototypeStub(Code::Kind kind) : ICStub(kind) { } 844 explicit FunctionPrototypeStub(Code::Kind kind) : ICStub(kind) { }
899 virtual void Generate(MacroAssembler* masm); 845 virtual void Generate(MacroAssembler* masm);
900 846
901 private: 847 private:
902 virtual CodeStub::Major MajorKey() { return FunctionPrototype; } 848 virtual CodeStub::Major MajorKey() { return FunctionPrototype; }
903 }; 849 };
904 850
905 851
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
1677 }; 1623 };
1678 1624
1679 1625
1680 class CallFunctionStub: public PlatformCodeStub { 1626 class CallFunctionStub: public PlatformCodeStub {
1681 public: 1627 public:
1682 CallFunctionStub(int argc, CallFunctionFlags flags) 1628 CallFunctionStub(int argc, CallFunctionFlags flags)
1683 : argc_(argc), flags_(flags) { } 1629 : argc_(argc), flags_(flags) { }
1684 1630
1685 void Generate(MacroAssembler* masm); 1631 void Generate(MacroAssembler* masm);
1686 1632
1633 virtual void FinishCode(Handle<Code> code) {
1634 code->set_has_function_cache(RecordCallTarget());
1635 }
1636
1687 static int ExtractArgcFromMinorKey(int minor_key) { 1637 static int ExtractArgcFromMinorKey(int minor_key) {
1688 return ArgcBits::decode(minor_key); 1638 return ArgcBits::decode(minor_key);
1689 } 1639 }
1690 1640
1691 private: 1641 private:
1692 int argc_; 1642 int argc_;
1693 CallFunctionFlags flags_; 1643 CallFunctionFlags flags_;
1694 1644
1695 virtual void PrintName(StringStream* stream); 1645 virtual void PrintName(StringStream* stream);
1696 1646
1697 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. 1647 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
1698 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {}; 1648 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {};
1699 class ArgcBits: public BitField<unsigned, 2, 32 - 2> {}; 1649 class ArgcBits: public BitField<unsigned, 2, 32 - 2> {};
1700 1650
1701 Major MajorKey() { return CallFunction; } 1651 Major MajorKey() { return CallFunction; }
1702 int MinorKey() { 1652 int MinorKey() {
1703 // Encode the parameters in a unique 32 bit value. 1653 // Encode the parameters in a unique 32 bit value.
1704 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); 1654 return FlagBits::encode(flags_) | ArgcBits::encode(argc_);
1705 } 1655 }
1706 1656
1657 bool RecordCallTarget() {
1658 return flags_ == RECORD_CALL_TARGET;
1659 }
1660
1707 bool CallAsMethod() { 1661 bool CallAsMethod() {
1708 return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL; 1662 return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL;
1709 } 1663 }
1710 1664
1711 bool NeedsChecks() { 1665 bool NeedsChecks() {
1712 return flags_ != WRAP_AND_CALL; 1666 return flags_ != WRAP_AND_CALL;
1713 } 1667 }
1714 }; 1668 };
1715 1669
1716 1670
1717 class CallConstructStub: public PlatformCodeStub { 1671 class CallConstructStub: public PlatformCodeStub {
1718 public: 1672 public:
1719 explicit CallConstructStub(CallConstructorFlags flags) : flags_(flags) {} 1673 explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {}
1720 1674
1721 void Generate(MacroAssembler* masm); 1675 void Generate(MacroAssembler* masm);
1722 1676
1723 virtual void FinishCode(Handle<Code> code) { 1677 virtual void FinishCode(Handle<Code> code) {
1724 code->set_has_function_cache(RecordCallTarget()); 1678 code->set_has_function_cache(RecordCallTarget());
1725 } 1679 }
1726 1680
1727 private: 1681 private:
1728 CallConstructorFlags flags_; 1682 CallFunctionFlags flags_;
1729 1683
1730 virtual void PrintName(StringStream* stream); 1684 virtual void PrintName(StringStream* stream);
1731 1685
1732 Major MajorKey() { return CallConstruct; } 1686 Major MajorKey() { return CallConstruct; }
1733 int MinorKey() { return flags_; } 1687 int MinorKey() { return flags_; }
1734 1688
1735 bool RecordCallTarget() { 1689 bool RecordCallTarget() {
1736 return (flags_ & RECORD_CONSTRUCTOR_TARGET) != 0; 1690 return (flags_ & RECORD_CALL_TARGET) != 0;
1691 }
1692
1693 bool CallAsMethod() {
1694 return (flags_ & CALL_AS_METHOD) != 0;
1737 } 1695 }
1738 }; 1696 };
1739 1697
1740 1698
1741 enum StringIndexFlags { 1699 enum StringIndexFlags {
1742 // Accepts smis or heap numbers. 1700 // Accepts smis or heap numbers.
1743 STRING_INDEX_IS_NUMBER, 1701 STRING_INDEX_IS_NUMBER,
1744 1702
1745 // Accepts smis or heap numbers that are valid array indices 1703 // Accepts smis or heap numbers that are valid array indices
1746 // (ECMA-262 15.4). Invalid indices are reported as being out of 1704 // (ECMA-262 15.4). Invalid indices are reported as being out of
(...skipping 819 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 2524
2567 2525
2568 class CallDescriptors { 2526 class CallDescriptors {
2569 public: 2527 public:
2570 static void InitializeForIsolate(Isolate* isolate); 2528 static void InitializeForIsolate(Isolate* isolate);
2571 }; 2529 };
2572 2530
2573 } } // namespace v8::internal 2531 } } // namespace v8::internal
2574 2532
2575 #endif // V8_CODE_STUBS_H_ 2533 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698