| OLD | NEW |
| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 } | 90 } |
| 91 | 91 |
| 92 | 92 |
| 93 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { | 93 bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { |
| 94 Handle<Object> map_or_code = GetInfo(expr->id()); | 94 Handle<Object> map_or_code = GetInfo(expr->id()); |
| 95 if (map_or_code->IsMap()) return true; | 95 if (map_or_code->IsMap()) return true; |
| 96 if (map_or_code->IsCode()) { | 96 if (map_or_code->IsCode()) { |
| 97 Handle<Code> code = Handle<Code>::cast(map_or_code); | 97 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 98 return code->is_keyed_load_stub() && | 98 return code->is_keyed_load_stub() && |
| 99 code->ic_state() == MONOMORPHIC && | 99 code->ic_state() == MONOMORPHIC && |
| 100 Code::ExtractTypeFromFlags(code->flags()) == NORMAL && | 100 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL && |
| 101 code->FindFirstMap() != NULL && | 101 code->FindFirstMap() != NULL && |
| 102 !CanRetainOtherContext(code->FindFirstMap(), *global_context_); | 102 !CanRetainOtherContext(code->FindFirstMap(), *global_context_); |
| 103 } | 103 } |
| 104 return false; | 104 return false; |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| 108 bool TypeFeedbackOracle::LoadIsMegamorphicWithTypeInfo(Property* expr) { | 108 bool TypeFeedbackOracle::LoadIsMegamorphicWithTypeInfo(Property* expr) { |
| 109 Handle<Object> map_or_code = GetInfo(expr->id()); | 109 Handle<Object> map_or_code = GetInfo(expr->id()); |
| 110 if (map_or_code->IsCode()) { | 110 if (map_or_code->IsCode()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 122 Handle<Object> map_or_code = GetInfo(expr->id()); | 122 Handle<Object> map_or_code = GetInfo(expr->id()); |
| 123 if (map_or_code->IsMap()) return true; | 123 if (map_or_code->IsMap()) return true; |
| 124 if (map_or_code->IsCode()) { | 124 if (map_or_code->IsCode()) { |
| 125 Handle<Code> code = Handle<Code>::cast(map_or_code); | 125 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 126 bool allow_growth = | 126 bool allow_growth = |
| 127 Code::GetKeyedAccessGrowMode(code->extra_ic_state()) == | 127 Code::GetKeyedAccessGrowMode(code->extra_ic_state()) == |
| 128 ALLOW_JSARRAY_GROWTH; | 128 ALLOW_JSARRAY_GROWTH; |
| 129 return code->is_keyed_store_stub() && | 129 return code->is_keyed_store_stub() && |
| 130 !allow_growth && | 130 !allow_growth && |
| 131 code->ic_state() == MONOMORPHIC && | 131 code->ic_state() == MONOMORPHIC && |
| 132 Code::ExtractTypeFromFlags(code->flags()) == NORMAL && | 132 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL && |
| 133 code->FindFirstMap() != NULL && | 133 code->FindFirstMap() != NULL && |
| 134 !CanRetainOtherContext(code->FindFirstMap(), *global_context_); | 134 !CanRetainOtherContext(code->FindFirstMap(), *global_context_); |
| 135 } | 135 } |
| 136 return false; | 136 return false; |
| 137 } | 137 } |
| 138 | 138 |
| 139 | 139 |
| 140 bool TypeFeedbackOracle::StoreIsMegamorphicWithTypeInfo(Expression* expr) { | 140 bool TypeFeedbackOracle::StoreIsMegamorphicWithTypeInfo(Expression* expr) { |
| 141 Handle<Object> map_or_code = GetInfo(expr->id()); | 141 Handle<Object> map_or_code = GetInfo(expr->id()); |
| 142 if (map_or_code->IsCode()) { | 142 if (map_or_code->IsCode()) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 ? Handle<Map>::null() | 207 ? Handle<Map>::null() |
| 208 : Handle<Map>(first_map); | 208 : Handle<Map>(first_map); |
| 209 } | 209 } |
| 210 return Handle<Map>::cast(map_or_code); | 210 return Handle<Map>::cast(map_or_code); |
| 211 } | 211 } |
| 212 | 212 |
| 213 | 213 |
| 214 void TypeFeedbackOracle::LoadReceiverTypes(Property* expr, | 214 void TypeFeedbackOracle::LoadReceiverTypes(Property* expr, |
| 215 Handle<String> name, | 215 Handle<String> name, |
| 216 SmallMapList* types) { | 216 SmallMapList* types) { |
| 217 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC, NORMAL); | 217 Code::Flags flags = |
| 218 Code::ComputeMonomorphicFlags(Code::LOAD_IC, Code::NORMAL); |
| 218 CollectReceiverTypes(expr->id(), name, flags, types); | 219 CollectReceiverTypes(expr->id(), name, flags, types); |
| 219 } | 220 } |
| 220 | 221 |
| 221 | 222 |
| 222 void TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, | 223 void TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, |
| 223 Handle<String> name, | 224 Handle<String> name, |
| 224 SmallMapList* types) { | 225 SmallMapList* types) { |
| 225 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); | 226 Code::Flags flags = |
| 227 Code::ComputeMonomorphicFlags(Code::STORE_IC, Code::NORMAL); |
| 226 CollectReceiverTypes(expr->id(), name, flags, types); | 228 CollectReceiverTypes(expr->id(), name, flags, types); |
| 227 } | 229 } |
| 228 | 230 |
| 229 | 231 |
| 230 void TypeFeedbackOracle::CallReceiverTypes(Call* expr, | 232 void TypeFeedbackOracle::CallReceiverTypes(Call* expr, |
| 231 Handle<String> name, | 233 Handle<String> name, |
| 232 CallKind call_kind, | 234 CallKind call_kind, |
| 233 SmallMapList* types) { | 235 SmallMapList* types) { |
| 234 int arity = expr->arguments()->length(); | 236 int arity = expr->arguments()->length(); |
| 235 | 237 |
| 236 // Note: Currently we do not take string extra ic data into account | 238 // Note: Currently we do not take string extra ic data into account |
| 237 // here. | 239 // here. |
| 238 Code::ExtraICState extra_ic_state = | 240 Code::ExtraICState extra_ic_state = |
| 239 CallIC::Contextual::encode(call_kind == CALL_AS_FUNCTION); | 241 CallIC::Contextual::encode(call_kind == CALL_AS_FUNCTION); |
| 240 | 242 |
| 241 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, | 243 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, |
| 242 NORMAL, | 244 Code::NORMAL, |
| 243 extra_ic_state, | 245 extra_ic_state, |
| 244 OWN_MAP, | 246 OWN_MAP, |
| 245 arity); | 247 arity); |
| 246 CollectReceiverTypes(expr->id(), name, flags, types); | 248 CollectReceiverTypes(expr->id(), name, flags, types); |
| 247 } | 249 } |
| 248 | 250 |
| 249 | 251 |
| 250 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { | 252 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { |
| 251 Handle<Object> value = GetInfo(expr->id()); | 253 Handle<Object> value = GetInfo(expr->id()); |
| 252 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; | 254 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 USE(maybe_result); | 717 USE(maybe_result); |
| 716 #ifdef DEBUG | 718 #ifdef DEBUG |
| 717 Object* result = NULL; | 719 Object* result = NULL; |
| 718 // Dictionary has been allocated with sufficient size for all elements. | 720 // Dictionary has been allocated with sufficient size for all elements. |
| 719 ASSERT(maybe_result->ToObject(&result)); | 721 ASSERT(maybe_result->ToObject(&result)); |
| 720 ASSERT(*dictionary_ == result); | 722 ASSERT(*dictionary_ == result); |
| 721 #endif | 723 #endif |
| 722 } | 724 } |
| 723 | 725 |
| 724 } } // namespace v8::internal | 726 } } // namespace v8::internal |
| OLD | NEW |