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

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

Issue 172523002: Create a function call IC (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Comments addressed. Created 6 years, 9 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
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(StringLength) \ 54 V(StringLength) \
55 V(CallIC) \
55 V(FunctionPrototype) \ 56 V(FunctionPrototype) \
56 V(StoreArrayLength) \ 57 V(StoreArrayLength) \
57 V(RecordWrite) \ 58 V(RecordWrite) \
58 V(StoreBufferOverflow) \ 59 V(StoreBufferOverflow) \
59 V(RegExpExec) \ 60 V(RegExpExec) \
60 V(Instanceof) \ 61 V(Instanceof) \
61 V(ConvertToDouble) \ 62 V(ConvertToDouble) \
62 V(WriteInt32ToHeapNumber) \ 63 V(WriteInt32ToHeapNumber) \
63 V(StackCheck) \ 64 V(StackCheck) \
64 V(Interrupt) \ 65 V(Interrupt) \
(...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 818
818 virtual int MinorKey() { 819 virtual int MinorKey() {
819 return KindBits::encode(kind_); 820 return KindBits::encode(kind_);
820 } 821 }
821 822
822 private: 823 private:
823 Code::Kind kind_; 824 Code::Kind kind_;
824 }; 825 };
825 826
826 827
828 class CallICStub: public PlatformCodeStub {
829 public:
830 explicit CallICStub(const CallIC::State& state)
831 : state_(state) {}
832
833 int arg_count() const { return state_.arg_count(); }
834 CallIC::CallType call_type() const { return state_.call_type(); }
835 CallIC::StubType stub_type() const { return state_.stub_type(); }
836 CallIC::ArgumentCheck argument_check() const {
837 return state_.argument_check();
838 }
839 CallIC::FunctionAttributes function_attributes() const {
840 return state_.function_attributes();
841 }
842
843 static int ExtractArgcFromMinorKey(int minor_key) {
844 CallIC::State state((ExtraICState) minor_key);
845 return state.arg_count();
846 }
847
848 virtual void Generate(MacroAssembler* masm);
849
850 virtual Code::Kind GetCodeKind() const V8_OVERRIDE {
851 return Code::CALL_IC;
852 }
853
854 virtual InlineCacheState GetICState() V8_FINAL V8_OVERRIDE {
855 return state_.GetICState();
856 }
857
858 virtual ExtraICState GetExtraICState() V8_FINAL V8_OVERRIDE {
859 return state_.GetExtraICState();
860 }
861
862 static void GenerateAheadOfTime(Isolate* isolate);
863
864 protected:
865 virtual int MinorKey() { return GetExtraICState(); }
866 virtual void PrintState(StringStream* stream) V8_FINAL V8_OVERRIDE;
867
868 private:
869 virtual CodeStub::Major MajorKey() { return CallIC; }
870
871 // Code generation helpers.
872 void GenerateCall(MacroAssembler* masm, CallIC::StubType stub_type,
873 CallIC::ArgumentCheck argument_check,
874 CallIC::FunctionAttributes attributes);
875 void GenerateMiss(MacroAssembler* masm);
876
877 CallIC::State state_;
878 };
879
880
827 class FunctionPrototypeStub: public ICStub { 881 class FunctionPrototypeStub: public ICStub {
828 public: 882 public:
829 explicit FunctionPrototypeStub(Code::Kind kind) : ICStub(kind) { } 883 explicit FunctionPrototypeStub(Code::Kind kind) : ICStub(kind) { }
830 virtual void Generate(MacroAssembler* masm); 884 virtual void Generate(MacroAssembler* masm);
831 885
832 private: 886 private:
833 virtual CodeStub::Major MajorKey() { return FunctionPrototype; } 887 virtual CodeStub::Major MajorKey() { return FunctionPrototype; }
834 }; 888 };
835 889
836 890
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
1579 static const int kInput = 2; 1633 static const int kInput = 2;
1580 1634
1581 private: 1635 private:
1582 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub); 1636 DISALLOW_COPY_AND_ASSIGN(RegExpConstructResultStub);
1583 }; 1637 };
1584 1638
1585 1639
1586 class CallFunctionStub: public PlatformCodeStub { 1640 class CallFunctionStub: public PlatformCodeStub {
1587 public: 1641 public:
1588 CallFunctionStub(int argc, CallFunctionFlags flags) 1642 CallFunctionStub(int argc, CallFunctionFlags flags)
1589 : argc_(argc), flags_(flags) { } 1643 : argc_(argc), flags_(flags) {
1644 // CallFunctionStub no longer supports RECORD_CALL_TARGET.
1645 ASSERT(flags != RECORD_CALL_TARGET);
1646 }
1590 1647
1591 void Generate(MacroAssembler* masm); 1648 void Generate(MacroAssembler* masm);
1592 1649
1593 virtual void FinishCode(Handle<Code> code) { 1650 virtual void FinishCode(Handle<Code> code) {
1594 code->set_has_function_cache(RecordCallTarget()); 1651 code->set_has_function_cache(RecordCallTarget());
1595 } 1652 }
1596 1653
1597 static int ExtractArgcFromMinorKey(int minor_key) { 1654 static int ExtractArgcFromMinorKey(int minor_key) {
1598 return ArgcBits::decode(minor_key); 1655 return ArgcBits::decode(minor_key);
1599 } 1656 }
(...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after
2477 2534
2478 2535
2479 class CallDescriptors { 2536 class CallDescriptors {
2480 public: 2537 public:
2481 static void InitializeForIsolate(Isolate* isolate); 2538 static void InitializeForIsolate(Isolate* isolate);
2482 }; 2539 };
2483 2540
2484 } } // namespace v8::internal 2541 } } // namespace v8::internal
2485 2542
2486 #endif // V8_CODE_STUBS_H_ 2543 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/code-stubs.cc » ('j') | src/ia32/code-stubs-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698