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

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

Issue 8932004: Implement target cache for constructor calls. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Vyacheslav Egorov. Created 8 years, 10 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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 20 matching lines...) Expand all
31 #include "allocation.h" 31 #include "allocation.h"
32 #include "globals.h" 32 #include "globals.h"
33 #include "codegen.h" 33 #include "codegen.h"
34 34
35 namespace v8 { 35 namespace v8 {
36 namespace internal { 36 namespace internal {
37 37
38 // List of code stubs used on all platforms. 38 // List of code stubs used on all platforms.
39 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \ 39 #define CODE_STUB_LIST_ALL_PLATFORMS(V) \
40 V(CallFunction) \ 40 V(CallFunction) \
41 V(CallConstruct) \
41 V(UnaryOp) \ 42 V(UnaryOp) \
42 V(BinaryOp) \ 43 V(BinaryOp) \
43 V(StringAdd) \ 44 V(StringAdd) \
44 V(SubString) \ 45 V(SubString) \
45 V(StringCompare) \ 46 V(StringCompare) \
46 V(Compare) \ 47 V(Compare) \
47 V(CompareIC) \ 48 V(CompareIC) \
48 V(MathPow) \ 49 V(MathPow) \
49 V(RecordWrite) \ 50 V(RecordWrite) \
50 V(StoreBufferOverflow) \ 51 V(StoreBufferOverflow) \
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 }; 732 };
732 733
733 734
734 class CallFunctionStub: public CodeStub { 735 class CallFunctionStub: public CodeStub {
735 public: 736 public:
736 CallFunctionStub(int argc, CallFunctionFlags flags) 737 CallFunctionStub(int argc, CallFunctionFlags flags)
737 : argc_(argc), flags_(flags) { } 738 : argc_(argc), flags_(flags) { }
738 739
739 void Generate(MacroAssembler* masm); 740 void Generate(MacroAssembler* masm);
740 741
741 virtual void FinishCode(Handle<Code> code);
742
743 static void Clear(Heap* heap, Address address);
744
745 static Object* GetCachedValue(Address address);
746
747 static int ExtractArgcFromMinorKey(int minor_key) { 742 static int ExtractArgcFromMinorKey(int minor_key) {
748 return ArgcBits::decode(minor_key); 743 return ArgcBits::decode(minor_key);
749 } 744 }
750 745
751 // The object that indicates an uninitialized cache.
752 static Handle<Object> UninitializedSentinel(Isolate* isolate) {
753 return isolate->factory()->the_hole_value();
754 }
755
756 // A raw version of the uninitialized sentinel that's safe to read during
757 // garbage collection (e.g., for patching the cache).
758 static Object* RawUninitializedSentinel(Heap* heap) {
759 return heap->raw_unchecked_the_hole_value();
760 }
761
762 // The object that indicates a megamorphic state.
763 static Handle<Object> MegamorphicSentinel(Isolate* isolate) {
764 return isolate->factory()->undefined_value();
765 }
766
767 private: 746 private:
768 int argc_; 747 int argc_;
769 CallFunctionFlags flags_; 748 CallFunctionFlags flags_;
770 749
771 virtual void PrintName(StringStream* stream); 750 virtual void PrintName(StringStream* stream);
772 751
773 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>. 752 // Minor key encoding in 32 bits with Bitfield <Type, shift, size>.
774 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {}; 753 class FlagBits: public BitField<CallFunctionFlags, 0, 2> {};
775 class ArgcBits: public BitField<unsigned, 2, 32 - 2> {}; 754 class ArgcBits: public BitField<unsigned, 2, 32 - 2> {};
776 755
777 Major MajorKey() { return CallFunction; } 756 Major MajorKey() { return CallFunction; }
778 int MinorKey() { 757 int MinorKey() {
779 // Encode the parameters in a unique 32 bit value. 758 // Encode the parameters in a unique 32 bit value.
780 return FlagBits::encode(flags_) | ArgcBits::encode(argc_); 759 return FlagBits::encode(flags_) | ArgcBits::encode(argc_);
781 } 760 }
782 761
783 bool ReceiverMightBeImplicit() { 762 bool ReceiverMightBeImplicit() {
784 return (flags_ & RECEIVER_MIGHT_BE_IMPLICIT) != 0; 763 return (flags_ & RECEIVER_MIGHT_BE_IMPLICIT) != 0;
785 } 764 }
786 765
787 bool RecordCallTarget() { 766 bool RecordCallTarget() {
788 return (flags_ & RECORD_CALL_TARGET) != 0; 767 return (flags_ & RECORD_CALL_TARGET) != 0;
789 } 768 }
790 }; 769 };
791 770
792 771
772 class CallConstructStub: public CodeStub {
773 public:
774 explicit CallConstructStub(CallFunctionFlags flags) : flags_(flags) {}
775
776 void Generate(MacroAssembler* masm);
777
778 private:
779 CallFunctionFlags flags_;
780
781 virtual void PrintName(StringStream* stream);
782
783 Major MajorKey() { return CallConstruct; }
784 int MinorKey() { return flags_; }
785
786 bool RecordCallTarget() {
787 return (flags_ & RECORD_CALL_TARGET) != 0;
788 }
789 };
790
791
793 enum StringIndexFlags { 792 enum StringIndexFlags {
794 // Accepts smis or heap numbers. 793 // Accepts smis or heap numbers.
795 STRING_INDEX_IS_NUMBER, 794 STRING_INDEX_IS_NUMBER,
796 795
797 // Accepts smis or heap numbers that are valid array indices 796 // Accepts smis or heap numbers that are valid array indices
798 // (ECMA-262 15.4). Invalid indices are reported as being out of 797 // (ECMA-262 15.4). Invalid indices are reported as being out of
799 // range. 798 // range.
800 STRING_INDEX_IS_ARRAY_INDEX 799 STRING_INDEX_IS_ARRAY_INDEX
801 }; 800 };
802 801
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 int MinorKey() { return 0; } 1108 int MinorKey() { return 0; }
1110 1109
1111 void Generate(MacroAssembler* masm); 1110 void Generate(MacroAssembler* masm);
1112 1111
1113 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub); 1112 DISALLOW_COPY_AND_ASSIGN(StoreArrayLiteralElementStub);
1114 }; 1113 };
1115 1114
1116 } } // namespace v8::internal 1115 } } // namespace v8::internal
1117 1116
1118 #endif // V8_CODE_STUBS_H_ 1117 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/code-stubs.cc » ('j') | src/type-info.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698