| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 t == kNonPrimitive); | 113 t == kNonPrimitive); |
| 114 return TypeInfo(t); | 114 return TypeInfo(t); |
| 115 } | 115 } |
| 116 | 116 |
| 117 // Return the weakest (least precise) common type. | 117 // Return the weakest (least precise) common type. |
| 118 static TypeInfo Combine(TypeInfo a, TypeInfo b) { | 118 static TypeInfo Combine(TypeInfo a, TypeInfo b) { |
| 119 return TypeInfo(static_cast<Type>(a.type_ & b.type_)); | 119 return TypeInfo(static_cast<Type>(a.type_ & b.type_)); |
| 120 } | 120 } |
| 121 | 121 |
| 122 | 122 |
| 123 // Integer32 is an integer that can be represented as either a signed | 123 // Integer32 is an integer that can be represented as a signed |
| 124 // 32-bit integer or as an unsigned 32-bit integer. It has to be | 124 // 32-bit integer. It has to be |
| 125 // in the range [-2^31, 2^32 - 1]. We also have to check for negative 0 | 125 // in the range [-2^31, 2^31 - 1]. We also have to check for negative 0 |
| 126 // as it is not an Integer32. | 126 // as it is not an Integer32. |
| 127 static inline bool IsInt32Double(double value) { | 127 static inline bool IsInt32Double(double value) { |
| 128 const DoubleRepresentation minus_zero(-0.0); | 128 const DoubleRepresentation minus_zero(-0.0); |
| 129 DoubleRepresentation rep(value); | 129 DoubleRepresentation rep(value); |
| 130 if (rep.bits == minus_zero.bits) return false; | 130 if (rep.bits == minus_zero.bits) return false; |
| 131 if (value >= kMinInt && value <= kMaxInt && | 131 if (value >= kMinInt && value <= kMaxInt && |
| 132 value == static_cast<int32_t>(value)) { | 132 value == static_cast<int32_t>(value)) { |
| 133 return true; | 133 return true; |
| 134 } | 134 } |
| 135 return false; | 135 return false; |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 class Assignment; | 229 class Assignment; |
| 230 class BinaryOperation; | 230 class BinaryOperation; |
| 231 class Call; | 231 class Call; |
| 232 class CompareOperation; | 232 class CompareOperation; |
| 233 class CompilationInfo; | 233 class CompilationInfo; |
| 234 class Property; | 234 class Property; |
| 235 class CaseClause; | 235 class CaseClause; |
| 236 | 236 |
| 237 class TypeFeedbackOracle BASE_EMBEDDED { | 237 class TypeFeedbackOracle BASE_EMBEDDED { |
| 238 public: | 238 public: |
| 239 enum Side { | |
| 240 LEFT, | |
| 241 RIGHT, | |
| 242 RESULT | |
| 243 }; | |
| 244 | |
| 245 TypeFeedbackOracle(Handle<Code> code, Handle<Context> global_context); | 239 TypeFeedbackOracle(Handle<Code> code, Handle<Context> global_context); |
| 246 | 240 |
| 247 bool LoadIsMonomorphic(Property* expr); | 241 bool LoadIsMonomorphic(Property* expr); |
| 248 bool StoreIsMonomorphic(Assignment* expr); | 242 bool StoreIsMonomorphic(Assignment* expr); |
| 249 bool CallIsMonomorphic(Call* expr); | 243 bool CallIsMonomorphic(Call* expr); |
| 250 | 244 |
| 251 Handle<Map> LoadMonomorphicReceiverType(Property* expr); | 245 Handle<Map> LoadMonomorphicReceiverType(Property* expr); |
| 252 Handle<Map> StoreMonomorphicReceiverType(Assignment* expr); | 246 Handle<Map> StoreMonomorphicReceiverType(Assignment* expr); |
| 253 | 247 |
| 254 ZoneMapList* LoadReceiverTypes(Property* expr, Handle<String> name); | 248 ZoneMapList* LoadReceiverTypes(Property* expr, Handle<String> name); |
| 255 ZoneMapList* StoreReceiverTypes(Assignment* expr, Handle<String> name); | 249 ZoneMapList* StoreReceiverTypes(Assignment* expr, Handle<String> name); |
| 256 ZoneMapList* CallReceiverTypes(Call* expr, Handle<String> name); | 250 ZoneMapList* CallReceiverTypes(Call* expr, Handle<String> name); |
| 257 | 251 |
| 258 CheckType GetCallCheckType(Call* expr); | 252 CheckType GetCallCheckType(Call* expr); |
| 259 Handle<JSObject> GetPrototypeForPrimitiveCheck(CheckType check); | 253 Handle<JSObject> GetPrototypeForPrimitiveCheck(CheckType check); |
| 260 | 254 |
| 261 bool LoadIsBuiltin(Property* expr, Builtins::Name id); | 255 bool LoadIsBuiltin(Property* expr, Builtins::Name id); |
| 262 | 256 |
| 263 // Get type information for arithmetic operations and compares. | 257 // Get type information for arithmetic operations and compares. |
| 264 TypeInfo BinaryType(BinaryOperation* expr, Side side); | 258 TypeInfo BinaryType(BinaryOperation* expr); |
| 265 TypeInfo CompareType(CompareOperation* expr, Side side); | 259 TypeInfo CompareType(CompareOperation* expr); |
| 266 TypeInfo SwitchType(CaseClause* clause); | 260 TypeInfo SwitchType(CaseClause* clause); |
| 267 | 261 |
| 268 private: | 262 private: |
| 269 void Initialize(Handle<Code> code); | 263 void Initialize(Handle<Code> code); |
| 270 | 264 |
| 271 ZoneMapList* CollectReceiverTypes(int position, | 265 ZoneMapList* CollectReceiverTypes(int position, |
| 272 Handle<String> name, | 266 Handle<String> name, |
| 273 Code::Flags flags); | 267 Code::Flags flags); |
| 274 | 268 |
| 275 void PopulateMap(Handle<Code> code); | 269 void PopulateMap(Handle<Code> code); |
| 276 | 270 |
| 277 void CollectPositions(Code* code, | 271 void CollectPositions(Code* code, |
| 278 List<int>* code_positions, | 272 List<int>* code_positions, |
| 279 List<int>* source_positions); | 273 List<int>* source_positions); |
| 280 | 274 |
| 281 Handle<Context> global_context_; | 275 Handle<Context> global_context_; |
| 282 Handle<JSObject> map_; | 276 Handle<JSObject> map_; |
| 283 | 277 |
| 284 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); | 278 DISALLOW_COPY_AND_ASSIGN(TypeFeedbackOracle); |
| 285 }; | 279 }; |
| 286 | 280 |
| 287 } } // namespace v8::internal | 281 } } // namespace v8::internal |
| 288 | 282 |
| 289 #endif // V8_TYPE_INFO_H_ | 283 #endif // V8_TYPE_INFO_H_ |
| OLD | NEW |