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

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

Issue 247373002: CallICStub with a "never patch" approach until customization. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: REBASE + code size multiplier. Created 6 years, 7 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 // 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 "allocation.h" 8 #include "allocation.h"
9 #include "assembler.h" 9 #include "assembler.h"
10 #include "codegen.h" 10 #include "codegen.h"
(...skipping 10 matching lines...) Expand all
21 V(BinaryOpIC) \ 21 V(BinaryOpIC) \
22 V(BinaryOpICWithAllocationSite) \ 22 V(BinaryOpICWithAllocationSite) \
23 V(BinaryOpWithAllocationSite) \ 23 V(BinaryOpWithAllocationSite) \
24 V(StringAdd) \ 24 V(StringAdd) \
25 V(SubString) \ 25 V(SubString) \
26 V(StringCompare) \ 26 V(StringCompare) \
27 V(Compare) \ 27 V(Compare) \
28 V(CompareIC) \ 28 V(CompareIC) \
29 V(CompareNilIC) \ 29 V(CompareNilIC) \
30 V(MathPow) \ 30 V(MathPow) \
31 V(CallIC) \
31 V(FunctionPrototype) \ 32 V(FunctionPrototype) \
32 V(RecordWrite) \ 33 V(RecordWrite) \
33 V(StoreBufferOverflow) \ 34 V(StoreBufferOverflow) \
34 V(RegExpExec) \ 35 V(RegExpExec) \
35 V(Instanceof) \ 36 V(Instanceof) \
36 V(ConvertToDouble) \ 37 V(ConvertToDouble) \
37 V(WriteInt32ToHeapNumber) \ 38 V(WriteInt32ToHeapNumber) \
38 V(StackCheck) \ 39 V(StackCheck) \
39 V(Interrupt) \ 40 V(Interrupt) \
40 V(FastNewClosure) \ 41 V(FastNewClosure) \
(...skipping 775 matching lines...) Expand 10 before | Expand all | Expand 10 after
816 817
817 virtual int MinorKey() { 818 virtual int MinorKey() {
818 return KindBits::encode(kind_); 819 return KindBits::encode(kind_);
819 } 820 }
820 821
821 private: 822 private:
822 Code::Kind kind_; 823 Code::Kind kind_;
823 }; 824 };
824 825
825 826
827 class CallICStub: public PlatformCodeStub {
828 public:
829 CallICStub(Isolate* isolate, const CallIC::State& state)
830 : PlatformCodeStub(isolate), state_(state) {}
831
832 bool CallAsMethod() const { return state_.CallAsMethod(); }
833
834 int arg_count() const { return state_.arg_count(); }
835
836 static int ExtractArgcFromMinorKey(int minor_key) {
837 CallIC::State state((ExtraICState) minor_key);
838 return state.arg_count();
839 }
840
841 virtual void Generate(MacroAssembler* masm);
842
843 virtual Code::Kind GetCodeKind() const V8_OVERRIDE {
844 return Code::CALL_IC;
845 }
846
847 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE {
848 return state_.GetICState();
849 }
850
851 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE {
852 return state_.GetExtraICState();
853 }
854
855 protected:
856 virtual int MinorKey() { return GetExtraICState(); }
857 virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE;
858
859 private:
860 virtual CodeStub::Major MajorKey() { return CallIC; }
861
862 // Code generation helpers.
863 void GenerateMiss(MacroAssembler* masm);
864
865 CallIC::State state_;
866 };
867
868
826 class FunctionPrototypeStub: public ICStub { 869 class FunctionPrototypeStub: public ICStub {
827 public: 870 public:
828 FunctionPrototypeStub(Isolate* isolate, Code::Kind kind) 871 FunctionPrototypeStub(Isolate* isolate, Code::Kind kind)
829 : ICStub(isolate, kind) { } 872 : ICStub(isolate, kind) { }
830 virtual void Generate(MacroAssembler* masm); 873 virtual void Generate(MacroAssembler* masm);
831 874
832 private: 875 private:
833 virtual CodeStub::Major MajorKey() { return FunctionPrototype; } 876 virtual CodeStub::Major MajorKey() { return FunctionPrototype; }
834 }; 877 };
835 878
(...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 }; 1636 };
1594 1637
1595 1638
1596 class CallFunctionStub: public PlatformCodeStub { 1639 class CallFunctionStub: public PlatformCodeStub {
1597 public: 1640 public:
1598 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags) 1641 CallFunctionStub(Isolate* isolate, int argc, CallFunctionFlags flags)
1599 : PlatformCodeStub(isolate), argc_(argc), flags_(flags) { } 1642 : PlatformCodeStub(isolate), argc_(argc), flags_(flags) { }
1600 1643
1601 void Generate(MacroAssembler* masm); 1644 void Generate(MacroAssembler* masm);
1602 1645
1603 virtual void FinishCode(Handle<Code> code) {
1604 code->set_has_function_cache(RecordCallTarget());
1605 }
1606
1607 static int ExtractArgcFromMinorKey(int minor_key) { 1646 static int ExtractArgcFromMinorKey(int minor_key) {
1608 return ArgcBits::decode(minor_key); 1647 return ArgcBits::decode(minor_key);
1609 } 1648 }
1610 1649
1611 private: 1650 private:
1612 int argc_; 1651 int argc_;
1613 CallFunctionFlags flags_; 1652 CallFunctionFlags flags_;
1614 1653
1615 virtual void PrintName(StringStream* stream); 1654 virtual void PrintName(StringStream* stream);
1616 1655
1617 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. 1656 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
1618 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {}; 1657 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {};
1619 class ArgcBits: public BitField<unsigned, 2, 32 - 2> {}; 1658 class ArgcBits: public BitField<unsigned, 2, 32 - 2> {};
1620 1659
1621 Major MajorKey() { return CallFunction; } 1660 Major MajorKey() { return CallFunction; }
1622 int MinorKey() { 1661 int MinorKey() {
1623 // Encode the parameters in a unique 32 bit value. 1662 // Encode the parameters in a unique 32 bit value.
1624 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); 1663 return FlagBits::encode(flags_) | ArgcBits::encode(argc_);
1625 } 1664 }
1626 1665
1627 bool RecordCallTarget() {
1628 return flags_ == RECORD_CALL_TARGET;
1629 }
1630
1631 bool CallAsMethod() { 1666 bool CallAsMethod() {
1632 return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL; 1667 return flags_ == CALL_AS_METHOD || flags_ == WRAP_AND_CALL;
1633 } 1668 }
1634 1669
1635 bool NeedsChecks() { 1670 bool NeedsChecks() {
1636 return flags_ != WRAP_AND_CALL; 1671 return flags_ != WRAP_AND_CALL;
1637 } 1672 }
1638 }; 1673 };
1639 1674
1640 1675
1641 class CallConstructStub: public PlatformCodeStub { 1676 class CallConstructStub: public PlatformCodeStub {
1642 public: 1677 public:
1643 CallConstructStub(Isolate* isolate, CallFunctionFlags flags) 1678 CallConstructStub(Isolate* isolate, CallConstructorFlags flags)
1644 : PlatformCodeStub(isolate), flags_(flags) {} 1679 : PlatformCodeStub(isolate), flags_(flags) {}
1645 1680
1646 void Generate(MacroAssembler* masm); 1681 void Generate(MacroAssembler* masm);
1647 1682
1648 virtual void FinishCode(Handle<Code> code) { 1683 virtual void FinishCode(Handle<Code> code) {
1649 code->set_has_function_cache(RecordCallTarget()); 1684 code->set_has_function_cache(RecordCallTarget());
1650 } 1685 }
1651 1686
1652 private: 1687 private:
1653 CallFunctionFlags flags_; 1688 CallConstructorFlags flags_;
1654 1689
1655 virtual void PrintName(StringStream* stream); 1690 virtual void PrintName(StringStream* stream);
1656 1691
1657 Major MajorKey() { return CallConstruct; } 1692 Major MajorKey() { return CallConstruct; }
1658 int MinorKey() { return flags_; } 1693 int MinorKey() { return flags_; }
1659 1694
1660 bool RecordCallTarget() { 1695 bool RecordCallTarget() {
1661 return (flags_ & RECORD_CALL_TARGET) != 0; 1696 return (flags_ & RECORD_CONSTRUCTOR_TARGET) != 0;
1662 }
1663
1664 bool CallAsMethod() {
1665 return (flags_ & CALL_AS_METHOD) != 0;
1666 } 1697 }
1667 }; 1698 };
1668 1699
1669 1700
1670 enum StringIndexFlags { 1701 enum StringIndexFlags {
1671 // Accepts smis or heap numbers. 1702 // Accepts smis or heap numbers.
1672 STRING_INDEX_IS_NUMBER, 1703 STRING_INDEX_IS_NUMBER,
1673 1704
1674 // Accepts smis or heap numbers that are valid array indices 1705 // Accepts smis or heap numbers that are valid array indices
1675 // (ECMA-262 15.4). Invalid indices are reported as being out of 1706 // (ECMA-262 15.4). Invalid indices are reported as being out of
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
2507 2538
2508 2539
2509 class CallDescriptors { 2540 class CallDescriptors {
2510 public: 2541 public:
2511 static void InitializeForIsolate(Isolate* isolate); 2542 static void InitializeForIsolate(Isolate* isolate);
2512 }; 2543 };
2513 2544
2514 } } // namespace v8::internal 2545 } } // namespace v8::internal
2515 2546
2516 #endif // V8_CODE_STUBS_H_ 2547 #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