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

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

Issue 141363005: A64: Synchronize with r15204. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/a64
Patch Set: Created 6 years, 11 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 // 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 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 Token::Value op_; 1125 Token::Value op_;
1126 CompareIC::State left_; 1126 CompareIC::State left_;
1127 CompareIC::State right_; 1127 CompareIC::State right_;
1128 CompareIC::State state_; 1128 CompareIC::State state_;
1129 Handle<Map> known_map_; 1129 Handle<Map> known_map_;
1130 }; 1130 };
1131 1131
1132 1132
1133 class CompareNilICStub : public HydrogenCodeStub { 1133 class CompareNilICStub : public HydrogenCodeStub {
1134 public: 1134 public:
1135 enum Type { 1135 enum CompareNilType {
1136 UNDEFINED, 1136 UNDEFINED,
1137 NULL_TYPE, 1137 NULL_TYPE,
1138 MONOMORPHIC_MAP, 1138 MONOMORPHIC_MAP,
1139 UNDETECTABLE, 1139 UNDETECTABLE,
1140 GENERIC,
1140 NUMBER_OF_TYPES 1141 NUMBER_OF_TYPES
1141 }; 1142 };
1142 1143
1143 class Types : public EnumSet<Type, byte> { 1144 class State : public EnumSet<CompareNilType, byte> {
1144 public: 1145 public:
1145 Types() : EnumSet<Type, byte>(0) { } 1146 State() : EnumSet<CompareNilType, byte>(0) { }
1146 explicit Types(byte bits) : EnumSet<Type, byte>(bits) { } 1147 explicit State(byte bits) : EnumSet<CompareNilType, byte>(bits) { }
1147 1148
1148 static Types FullCompare() { 1149 static State Generic() {
1149 Types set; 1150 State set;
1150 set.Add(UNDEFINED); 1151 set.Add(UNDEFINED);
1151 set.Add(NULL_TYPE); 1152 set.Add(NULL_TYPE);
1152 set.Add(UNDETECTABLE); 1153 set.Add(UNDETECTABLE);
1154 set.Add(GENERIC);
1153 return set; 1155 return set;
1154 } 1156 }
1155 1157
1156 void Print(StringStream* stream) const; 1158 void Print(StringStream* stream) const;
1157 void TraceTransition(Types to) const; 1159 void TraceTransition(State to) const;
1158 }; 1160 };
1159 1161
1162 static Handle<Type> StateToType(
1163 Isolate* isolate, State state, Handle<Map> map = Handle<Map>());
1164
1160 // At most 6 different types can be distinguished, because the Code object 1165 // At most 6 different types can be distinguished, because the Code object
1161 // only has room for a single byte to hold a set and there are two more 1166 // only has room for a single byte to hold a set and there are two more
1162 // boolean flags we need to store. :-P 1167 // boolean flags we need to store. :-P
1163 STATIC_ASSERT(NUMBER_OF_TYPES <= 6); 1168 STATIC_ASSERT(NUMBER_OF_TYPES <= 6);
1164 1169
1165 CompareNilICStub(NilValue nil, Types types = Types()) 1170 CompareNilICStub(NilValue nil, State state = State())
1166 : types_(types) { 1171 : nil_value_(nil), state_(state) {
1167 nil_value_ = nil;
1168 } 1172 }
1169 1173
1170 CompareNilICStub(Code::ExtraICState ic_state, 1174 CompareNilICStub(Code::ExtraICState ic_state,
1171 InitializationState init_state = INITIALIZED) 1175 InitializationState init_state = INITIALIZED)
1172 : HydrogenCodeStub(init_state) { 1176 : HydrogenCodeStub(init_state) {
1173 nil_value_ = NilValueField::decode(ic_state); 1177 nil_value_ = NilValueField::decode(ic_state);
1174 types_ = Types(ExtractTypesFromExtraICState(ic_state)); 1178 state_ = State(ExtractTypesFromExtraICState(ic_state));
1175 } 1179 }
1176 1180
1177 static Handle<Code> GetUninitialized(Isolate* isolate, 1181 static Handle<Code> GetUninitialized(Isolate* isolate,
1178 NilValue nil) { 1182 NilValue nil) {
1179 return CompareNilICStub(nil, UNINITIALIZED).GetCode(isolate); 1183 return CompareNilICStub(nil, UNINITIALIZED).GetCode(isolate);
1180 } 1184 }
1181 1185
1182 virtual void InitializeInterfaceDescriptor( 1186 virtual void InitializeInterfaceDescriptor(
1183 Isolate* isolate, 1187 Isolate* isolate,
1184 CodeStubInterfaceDescriptor* descriptor); 1188 CodeStubInterfaceDescriptor* descriptor);
1185 1189
1186 static void InitializeForIsolate(Isolate* isolate) { 1190 static void InitializeForIsolate(Isolate* isolate) {
1187 CompareNilICStub compare_stub(kNullValue, UNINITIALIZED); 1191 CompareNilICStub compare_stub(kNullValue, UNINITIALIZED);
1188 compare_stub.InitializeInterfaceDescriptor( 1192 compare_stub.InitializeInterfaceDescriptor(
1189 isolate, 1193 isolate,
1190 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC)); 1194 isolate->code_stub_interface_descriptor(CodeStub::CompareNilIC));
1191 } 1195 }
1192 1196
1193 virtual InlineCacheState GetICState() { 1197 virtual InlineCacheState GetICState() {
1194 if (types_ == Types::FullCompare()) { 1198 if (state_ == State::Generic()) {
1195 return MEGAMORPHIC; 1199 return MEGAMORPHIC;
1196 } else if (types_.Contains(MONOMORPHIC_MAP)) { 1200 } else if (state_.Contains(MONOMORPHIC_MAP)) {
1197 return MONOMORPHIC; 1201 return MONOMORPHIC;
1198 } else { 1202 } else {
1199 return PREMONOMORPHIC; 1203 return PREMONOMORPHIC;
1200 } 1204 }
1201 } 1205 }
1202 1206
1203 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; } 1207 virtual Code::Kind GetCodeKind() const { return Code::COMPARE_NIL_IC; }
1204 1208
1205 Handle<Code> GenerateCode(); 1209 Handle<Code> GenerateCode();
1206 1210
1207 // extra ic state = nil_value | type_n-1 | ... | type_0 1211 // extra ic state = nil_value | type_n-1 | ... | type_0
1208 virtual Code::ExtraICState GetExtraICState() { 1212 virtual Code::ExtraICState GetExtraICState() {
1209 return NilValueField::encode(nil_value_) | 1213 return NilValueField::encode(nil_value_) | state_.ToIntegral();
1210 types_.ToIntegral();
1211 } 1214 }
1212 static byte ExtractTypesFromExtraICState( 1215 static byte ExtractTypesFromExtraICState(Code::ExtraICState state) {
1213 Code::ExtraICState state) {
1214 return state & ((1 << NUMBER_OF_TYPES) - 1); 1216 return state & ((1 << NUMBER_OF_TYPES) - 1);
1215 } 1217 }
1216 1218
1217 void Record(Handle<Object> object); 1219 void Record(Handle<Object> object);
1218 1220
1219 bool IsMonomorphic() const { return types_.Contains(MONOMORPHIC_MAP); } 1221 bool IsMonomorphic() const { return state_.Contains(MONOMORPHIC_MAP); }
1220 NilValue GetNilValue() const { return nil_value_; } 1222 NilValue GetNilValue() const { return nil_value_; }
1221 Types GetTypes() const { return types_; } 1223 State GetState() const { return state_; }
1222 void ClearTypes() { types_.RemoveAll(); } 1224 void ClearState() { state_.RemoveAll(); }
1223 1225
1224 virtual void PrintName(StringStream* stream); 1226 virtual void PrintName(StringStream* stream);
1225 1227
1226 private: 1228 private:
1227 friend class CompareNilIC; 1229 friend class CompareNilIC;
1228 1230
1229 CompareNilICStub(NilValue nil, InitializationState init_state) 1231 CompareNilICStub(NilValue nil, InitializationState init_state)
1230 : HydrogenCodeStub(init_state) { 1232 : HydrogenCodeStub(init_state) {
1231 nil_value_ = nil; 1233 nil_value_ = nil;
1232 } 1234 }
1233 1235
1234 class NilValueField : public BitField<NilValue, NUMBER_OF_TYPES, 1> {}; 1236 class NilValueField : public BitField<NilValue, NUMBER_OF_TYPES, 1> {};
1235 1237
1236 virtual CodeStub::Major MajorKey() { return CompareNilIC; } 1238 virtual CodeStub::Major MajorKey() { return CompareNilIC; }
1237 virtual int NotMissMinorKey() { return GetExtraICState(); } 1239 virtual int NotMissMinorKey() { return GetExtraICState(); }
1238 1240
1239 NilValue nil_value_; 1241 NilValue nil_value_;
1240 Types types_; 1242 State state_;
1241 1243
1242 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub); 1244 DISALLOW_COPY_AND_ASSIGN(CompareNilICStub);
1243 }; 1245 };
1244 1246
1245 1247
1246 class CEntryStub : public PlatformCodeStub { 1248 class CEntryStub : public PlatformCodeStub {
1247 public: 1249 public:
1248 explicit CEntryStub(int result_size, 1250 explicit CEntryStub(int result_size,
1249 SaveFPRegsMode save_doubles = kDontSaveFPRegs) 1251 SaveFPRegsMode save_doubles = kDontSaveFPRegs)
1250 : result_size_(result_size), save_doubles_(save_doubles) { } 1252 : result_size_(result_size), save_doubles_(save_doubles) { }
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 2163
2162 // The current function entry hook. 2164 // The current function entry hook.
2163 static FunctionEntryHook entry_hook_; 2165 static FunctionEntryHook entry_hook_;
2164 2166
2165 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); 2167 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub);
2166 }; 2168 };
2167 2169
2168 } } // namespace v8::internal 2170 } } // namespace v8::internal
2169 2171
2170 #endif // V8_CODE_STUBS_H_ 2172 #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