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

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

Issue 16732002: remove equality kind from compare nil ic (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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/arm/full-codegen-arm.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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 1147
1148 void Print(StringStream* stream) const; 1148 void Print(StringStream* stream) const;
1149 void TraceTransition(Types to) const; 1149 void TraceTransition(Types to) const;
1150 }; 1150 };
1151 1151
1152 // At most 6 different types can be distinguished, because the Code object 1152 // At most 6 different types can be distinguished, because the Code object
1153 // only has room for a single byte to hold a set and there are two more 1153 // only has room for a single byte to hold a set and there are two more
1154 // boolean flags we need to store. :-P 1154 // boolean flags we need to store. :-P
1155 STATIC_ASSERT(NUMBER_OF_TYPES <= 6); 1155 STATIC_ASSERT(NUMBER_OF_TYPES <= 6);
1156 1156
1157 CompareNilICStub(EqualityKind kind, NilValue nil, Types types = Types()) 1157 CompareNilICStub(NilValue nil, Types types = Types())
1158 : types_(types) { 1158 : types_(types) {
1159 equality_kind_ = kind;
1160 nil_value_ = nil; 1159 nil_value_ = nil;
1161 } 1160 }
1162 1161
1163 CompareNilICStub(Code::ExtraICState ic_state, 1162 CompareNilICStub(Code::ExtraICState ic_state,
1164 InitializationState init_state = INITIALIZED) 1163 InitializationState init_state = INITIALIZED)
1165 : HydrogenCodeStub(init_state) { 1164 : HydrogenCodeStub(init_state) {
1166 equality_kind_ = EqualityKindField::decode(ic_state);
1167 nil_value_ = NilValueField::decode(ic_state); 1165 nil_value_ = NilValueField::decode(ic_state);
1168 types_ = Types(ExtractTypesFromExtraICState(ic_state)); 1166 types_ = Types(ExtractTypesFromExtraICState(ic_state));
1169 } 1167 }
1170 1168
1171 static Handle<Code> GetUninitialized(Isolate* isolate, 1169 static Handle<Code> GetUninitialized(Isolate* isolate,
1172 EqualityKind kind,
1173 NilValue nil) { 1170 NilValue nil) {
1174 return CompareNilICStub(kind, nil, UNINITIALIZED).GetCode(isolate); 1171 return CompareNilICStub(nil, UNINITIALIZED).GetCode(isolate);
1175 } 1172 }
1176 1173
1177 virtual void InitializeInterfaceDescriptor( 1174 virtual void InitializeInterfaceDescriptor(
1178 Isolate* isolate, 1175 Isolate* isolate,
1179 CodeStubInterfaceDescriptor* descriptor); 1176 CodeStubInterfaceDescriptor* descriptor);
1180 1177
1181 static void InitializeForIsolate(Isolate* isolate) { 1178 static void InitializeForIsolate(Isolate* isolate) {
1182 CompareNilICStub compare_stub(kStrictEquality, kNullValue, UNINITIALIZED); 1179 CompareNilICStub compare_stub(kNullValue, UNINITIALIZED);
1183 compare_stub.InitializeInterfaceDescriptor( 1180 compare_stub.InitializeInterfaceDescriptor(
1184 isolate, 1181 isolate,
1185 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC)); 1182 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC));
1186 } 1183 }
1187 1184
1188 virtual InlineCacheState GetICState() { 1185 virtual InlineCacheState GetICState() {
1189 if (types_ == Types::FullCompare()) { 1186 if (types_ == Types::FullCompare()) {
1190 return MEGAMORPHIC; 1187 return MEGAMORPHIC;
1191 } else if (types_.Contains(MONOMORPHIC_MAP)) { 1188 } else if (types_.Contains(MONOMORPHIC_MAP)) {
1192 return MONOMORPHIC; 1189 return MONOMORPHIC;
1193 } else { 1190 } else {
1194 return PREMONOMORPHIC; 1191 return PREMONOMORPHIC;
1195 } 1192 }
1196 } 1193 }
1197 1194
1198 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; } 1195 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; }
1199 1196
1200 Handle<Code> GenerateCode(); 1197 Handle<Code> GenerateCode();
1201 1198
1202 // extra ic state = nil_value | equality_kind | type_n-1 | ... | type_0 1199 // extra ic state = nil_value | type_n-1 | ... | type_0
1203 virtual Code::ExtraICState GetExtraICState() { 1200 virtual Code::ExtraICState GetExtraICState() {
1204 return NilValueField::encode(nil_value_) | 1201 return NilValueField::encode(nil_value_) |
1205 EqualityKindField::encode(equality_kind_) |
1206 types_.ToIntegral(); 1202 types_.ToIntegral();
1207 } 1203 }
1208 static byte ExtractTypesFromExtraICState( 1204 static byte ExtractTypesFromExtraICState(
1209 Code::ExtraICState state) { 1205 Code::ExtraICState state) {
1210 return state & ((1 << NUMBER_OF_TYPES) - 1); 1206 return state & ((1 << NUMBER_OF_TYPES) - 1);
1211 } 1207 }
1212 1208
1213 void Record(Handle<Object> object); 1209 void Record(Handle<Object> object);
1214 1210
1215 bool IsMonomorphic() const { return types_.Contains(MONOMORPHIC_MAP); } 1211 bool IsMonomorphic() const { return types_.Contains(MONOMORPHIC_MAP); }
1216 EqualityKind GetKind() const { return equality_kind_; }
1217 NilValue GetNilValue() const { return nil_value_; } 1212 NilValue GetNilValue() const { return nil_value_; }
1218 Types GetTypes() const { return types_; } 1213 Types GetTypes() const { return types_; }
1219 void ClearTypes() { types_.RemoveAll(); } 1214 void ClearTypes() { types_.RemoveAll(); }
1220 void SetKind(EqualityKind kind) { equality_kind_ = kind; }
1221 1215
1222 virtual void PrintName(StringStream* stream); 1216 virtual void PrintName(StringStream* stream);
1223 1217
1224 private: 1218 private:
1225 friend class CompareNilIC; 1219 friend class CompareNilIC;
1226 1220
1227 CompareNilICStub(EqualityKind kind, NilValue nil, 1221 CompareNilICStub(NilValue nil, InitializationState init_state)
1228 InitializationState init_state)
1229 : HydrogenCodeStub(init_state) { 1222 : HydrogenCodeStub(init_state) {
1230 equality_kind_ = kind;
1231 nil_value_ = nil; 1223 nil_value_ = nil;
1232 } 1224 }
1233 1225
1234 class EqualityKindField : public BitField<EqualityKind, NUMBER_OF_TYPES, 1> { 1226 class NilValueField : public BitField<NilValue, NUMBER_OF_TYPES, 1> {};
1235 };
1236 class NilValueField : public BitField<NilValue, NUMBER_OF_TYPES+1, 1> {};
1237 1227
1238 virtual CodeStub::Major MajorKey() { return CompareNilIC; } 1228 virtual CodeStub::Major MajorKey() { return CompareNilIC; }
1239 virtual int NotMissMinorKey() { return GetExtraICState(); } 1229 virtual int NotMissMinorKey() { return GetExtraICState(); }
1240 1230
1241 EqualityKind equality_kind_;
1242 NilValue nil_value_; 1231 NilValue nil_value_;
1243 Types types_; 1232 Types types_;
1244 1233
1245 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); 1234 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub);
1246 }; 1235 };
1247 1236
1248 1237
1249 class CEntryStub : public PlatformCodeStub { 1238 class CEntryStub : public PlatformCodeStub {
1250 public: 1239 public:
1251 explicit CEntryStub(int result_size, 1240 explicit CEntryStub(int result_size,
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
2164 2153
2165 // The current function entry hook. 2154 // The current function entry hook.
2166 static FunctionEntryHook entry_hook_; 2155 static FunctionEntryHook entry_hook_;
2167 2156
2168 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 2157 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
2169 }; 2158 };
2170 2159
2171 } } // namespace v8::internal 2160 } } // namespace v8::internal
2172 2161
2173 #endif // V8_CODE_STUBS_H_ 2162 #endif // V8_CODE_STUBS_H_
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/code-stubs.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698