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

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

Issue 329463005: Revert 21720: "Introduce FieldIndex to unify and abstract property/field offset" (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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/bootstrapper.cc ('k') | src/code-stubs-hydrogen.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 "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 879 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 890
891 protected: 891 protected:
892 explicit HandlerStub(Isolate* isolate) : HICStub(isolate) { } 892 explicit HandlerStub(Isolate* isolate) : HICStub(isolate) { }
893 virtual int NotMissMinorKey() { return bit_field_; } 893 virtual int NotMissMinorKey() { return bit_field_; }
894 int bit_field_; 894 int bit_field_;
895 }; 895 };
896 896
897 897
898 class LoadFieldStub: public HandlerStub { 898 class LoadFieldStub: public HandlerStub {
899 public: 899 public:
900 LoadFieldStub(Isolate* isolate, FieldIndex index) 900 LoadFieldStub(Isolate* isolate,
901 : HandlerStub(isolate), index_(index) { 901 bool inobject,
902 Initialize(Code::LOAD_IC); 902 int index, Representation representation)
903 : HandlerStub(isolate) {
904 Initialize(Code::LOAD_IC, inobject, index, representation);
903 } 905 }
904 906
905 virtual Handle<Code> GenerateCode() V8_OVERRIDE; 907 virtual Handle<Code> GenerateCode() V8_OVERRIDE;
906 908
907 virtual void InitializeInterfaceDescriptor( 909 virtual void InitializeInterfaceDescriptor(
908 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 910 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
909 911
910 Representation representation() { 912 Representation representation() {
911 if (unboxed_double()) return Representation::Double(); 913 if (unboxed_double()) return Representation::Double();
912 return Representation::Tagged(); 914 return Representation::Tagged();
913 } 915 }
914 916
915 virtual Code::Kind kind() const { 917 virtual Code::Kind kind() const {
916 return KindBits::decode(bit_field_); 918 return KindBits::decode(bit_field_);
917 } 919 }
918 920
919 FieldIndex index() const { return index_; } 921 bool is_inobject() {
922 return InobjectBits::decode(bit_field_);
923 }
924
925 int offset() {
926 int index = IndexBits::decode(bit_field_);
927 int offset = index * kPointerSize;
928 if (is_inobject()) return offset;
929 return FixedArray::kHeaderSize + offset;
930 }
920 931
921 bool unboxed_double() { 932 bool unboxed_double() {
922 return index_.is_double(); 933 return UnboxedDoubleBits::decode(bit_field_);
923 } 934 }
924 935
925 virtual Code::StubType GetStubType() { return Code::FAST; } 936 virtual Code::StubType GetStubType() { return Code::FAST; }
926 937
927 protected: 938 protected:
928 explicit LoadFieldStub(Isolate* isolate); 939 explicit LoadFieldStub(Isolate* isolate) : HandlerStub(isolate) { }
929 940
930 void Initialize(Code::Kind kind) { 941 void Initialize(Code::Kind kind,
931 int property_index_key = index_.GetLoadFieldStubKey(); 942 bool inobject,
932 // Save a copy of the essence of the property index into the bit field to 943 int index,
933 // make sure that hashing of unique stubs works correctly.. 944 Representation representation) {
934 bit_field_ = KindBits::encode(kind) | 945 bit_field_ = KindBits::encode(kind)
935 EncodedLoadFieldByIndexBits::encode(property_index_key); 946 | InobjectBits::encode(inobject)
947 | IndexBits::encode(index)
948 | UnboxedDoubleBits::encode(representation.IsDouble());
936 } 949 }
937 950
938 private: 951 private:
939 STATIC_ASSERT(KindBits::kSize == 4); 952 STATIC_ASSERT(KindBits::kSize == 4);
940 class EncodedLoadFieldByIndexBits: public BitField<int, 4, 13> {}; 953 class InobjectBits: public BitField<bool, 4, 1> {};
954 class IndexBits: public BitField<int, 5, 11> {};
955 class UnboxedDoubleBits: public BitField<bool, 16, 1> {};
941 virtual CodeStub::Major MajorKey() { return LoadField; } 956 virtual CodeStub::Major MajorKey() { return LoadField; }
942 FieldIndex index_;
943 }; 957 };
944 958
945 959
946 class StringLengthStub: public HandlerStub { 960 class StringLengthStub: public HandlerStub {
947 public: 961 public:
948 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) { 962 explicit StringLengthStub(Isolate* isolate) : HandlerStub(isolate) {
949 Initialize(Code::LOAD_IC); 963 Initialize(Code::LOAD_IC);
950 } 964 }
951 virtual Handle<Code> GenerateCode() V8_OVERRIDE; 965 virtual Handle<Code> GenerateCode() V8_OVERRIDE;
952 virtual void InitializeInterfaceDescriptor( 966 virtual void InitializeInterfaceDescriptor(
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE; 1091 virtual void Generate(MacroAssembler* masm) V8_OVERRIDE;
1078 virtual Major MajorKey() V8_OVERRIDE { return CallApiGetter; } 1092 virtual Major MajorKey() V8_OVERRIDE { return CallApiGetter; }
1079 virtual int MinorKey() V8_OVERRIDE { return 0; } 1093 virtual int MinorKey() V8_OVERRIDE { return 0; }
1080 1094
1081 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub); 1095 DISALLOW_COPY_AND_ASSIGN(CallApiGetterStub);
1082 }; 1096 };
1083 1097
1084 1098
1085 class KeyedLoadFieldStub: public LoadFieldStub { 1099 class KeyedLoadFieldStub: public LoadFieldStub {
1086 public: 1100 public:
1087 KeyedLoadFieldStub(Isolate* isolate, FieldIndex index) 1101 KeyedLoadFieldStub(Isolate* isolate,
1088 : LoadFieldStub(isolate, index) { 1102 bool inobject,
1089 Initialize(Code::KEYED_LOAD_IC); 1103 int index, Representation representation)
1104 : LoadFieldStub(isolate) {
1105 Initialize(Code::KEYED_LOAD_IC, inobject, index, representation);
1090 } 1106 }
1091 1107
1092 virtual void InitializeInterfaceDescriptor( 1108 virtual void InitializeInterfaceDescriptor(
1093 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE; 1109 CodeStubInterfaceDescriptor* descriptor) V8_OVERRIDE;
1094 1110
1095 private: 1111 private:
1096 virtual CodeStub::Major MajorKey() { return KeyedLoadField; } 1112 virtual CodeStub::Major MajorKey() { return KeyedLoadField; }
1097 }; 1113 };
1098 1114
1099 1115
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
2459 2475
2460 2476
2461 class CallDescriptors { 2477 class CallDescriptors {
2462 public: 2478 public:
2463 static void InitializeForIsolate(Isolate* isolate); 2479 static void InitializeForIsolate(Isolate* isolate);
2464 }; 2480 };
2465 2481
2466 } } // namespace v8::internal 2482 } } // namespace v8::internal
2467 2483
2468 #endif // V8_CODE_STUBS_H_ 2484 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698