| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 } | 119 } |
| 120 return false; | 120 return false; |
| 121 } | 121 } |
| 122 | 122 |
| 123 | 123 |
| 124 bool TypeFeedbackOracle::StoreIsMonomorphicNormal(TypeFeedbackId ast_id) { | 124 bool TypeFeedbackOracle::StoreIsMonomorphicNormal(TypeFeedbackId ast_id) { |
| 125 Handle<Object> map_or_code = GetInfo(ast_id); | 125 Handle<Object> map_or_code = GetInfo(ast_id); |
| 126 if (map_or_code->IsMap()) return true; | 126 if (map_or_code->IsMap()) return true; |
| 127 if (map_or_code->IsCode()) { | 127 if (map_or_code->IsCode()) { |
| 128 Handle<Code> code = Handle<Code>::cast(map_or_code); | 128 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 129 bool allow_growth = | 129 bool standard_store = |
| 130 Code::GetKeyedAccessGrowMode(code->extra_ic_state()) == | 130 Code::GetKeyedAccessStoreMode(code->extra_ic_state()) == |
| 131 ALLOW_JSARRAY_GROWTH; | 131 STANDARD_STORE; |
| 132 bool preliminary_checks = | 132 bool preliminary_checks = |
| 133 code->is_keyed_store_stub() && | 133 code->is_keyed_store_stub() && |
| 134 !allow_growth && | 134 standard_store && |
| 135 code->ic_state() == MONOMORPHIC && | 135 code->ic_state() == MONOMORPHIC && |
| 136 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL; | 136 Code::ExtractTypeFromFlags(code->flags()) == Code::NORMAL; |
| 137 if (!preliminary_checks) return false; | 137 if (!preliminary_checks) return false; |
| 138 Map* map = code->FindFirstMap(); | 138 Map* map = code->FindFirstMap(); |
| 139 return map != NULL && !CanRetainOtherContext(map, *native_context_); | 139 return map != NULL && !CanRetainOtherContext(map, *native_context_); |
| 140 } | 140 } |
| 141 return false; | 141 return false; |
| 142 } | 142 } |
| 143 | 143 |
| 144 | 144 |
| 145 bool TypeFeedbackOracle::StoreIsPolymorphic(TypeFeedbackId ast_id) { | 145 bool TypeFeedbackOracle::StoreIsPolymorphic(TypeFeedbackId ast_id) { |
| 146 Handle<Object> map_or_code = GetInfo(ast_id); | 146 Handle<Object> map_or_code = GetInfo(ast_id); |
| 147 if (map_or_code->IsCode()) { | 147 if (map_or_code->IsCode()) { |
| 148 Handle<Code> code = Handle<Code>::cast(map_or_code); | 148 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 149 bool allow_growth = | 149 bool standard_store = |
| 150 Code::GetKeyedAccessGrowMode(code->extra_ic_state()) == | 150 Code::GetKeyedAccessStoreMode(code->extra_ic_state()) == |
| 151 ALLOW_JSARRAY_GROWTH; | 151 STANDARD_STORE; |
| 152 return code->is_keyed_store_stub() && !allow_growth && | 152 return code->is_keyed_store_stub() && standard_store && |
| 153 code->ic_state() == POLYMORPHIC; | 153 code->ic_state() == POLYMORPHIC; |
| 154 } | 154 } |
| 155 return false; | 155 return false; |
| 156 } | 156 } |
| 157 | 157 |
| 158 | 158 |
| 159 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { | 159 bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
| 160 Handle<Object> value = GetInfo(expr->CallFeedbackId()); | 160 Handle<Object> value = GetInfo(expr->CallFeedbackId()); |
| 161 return value->IsMap() || value->IsSmi() || value->IsJSFunction(); | 161 return value->IsMap() || value->IsSmi() || value->IsJSFunction(); |
| 162 } | 162 } |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 Map* first_map = code->FindFirstMap(); | 211 Map* first_map = code->FindFirstMap(); |
| 212 ASSERT(first_map != NULL); | 212 ASSERT(first_map != NULL); |
| 213 return CanRetainOtherContext(first_map, *native_context_) | 213 return CanRetainOtherContext(first_map, *native_context_) |
| 214 ? Handle<Map>::null() | 214 ? Handle<Map>::null() |
| 215 : Handle<Map>(first_map); | 215 : Handle<Map>(first_map); |
| 216 } | 216 } |
| 217 return Handle<Map>::cast(map_or_code); | 217 return Handle<Map>::cast(map_or_code); |
| 218 } | 218 } |
| 219 | 219 |
| 220 | 220 |
| 221 KeyedAccessStoreMode TypeFeedbackOracle::GetStoreMode( |
| 222 TypeFeedbackId ast_id) { |
| 223 Handle<Object> map_or_code = GetInfo(ast_id); |
| 224 if (map_or_code->IsCode()) { |
| 225 Handle<Code> code = Handle<Code>::cast(map_or_code); |
| 226 if (code->kind() == Code::KEYED_STORE_IC) { |
| 227 return Code::GetKeyedAccessStoreMode(code->extra_ic_state()); |
| 228 } |
| 229 } |
| 230 return STANDARD_STORE; |
| 231 } |
| 232 |
| 233 |
| 221 void TypeFeedbackOracle::LoadReceiverTypes(Property* expr, | 234 void TypeFeedbackOracle::LoadReceiverTypes(Property* expr, |
| 222 Handle<String> name, | 235 Handle<String> name, |
| 223 SmallMapList* types) { | 236 SmallMapList* types) { |
| 224 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC); | 237 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::LOAD_IC); |
| 225 CollectReceiverTypes(expr->PropertyFeedbackId(), name, flags, types); | 238 CollectReceiverTypes(expr->PropertyFeedbackId(), name, flags, types); |
| 226 } | 239 } |
| 227 | 240 |
| 228 | 241 |
| 229 void TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, | 242 void TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, |
| 230 Handle<String> name, | 243 Handle<String> name, |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 USE(maybe_result); | 759 USE(maybe_result); |
| 747 #ifdef DEBUG | 760 #ifdef DEBUG |
| 748 Object* result = NULL; | 761 Object* result = NULL; |
| 749 // Dictionary has been allocated with sufficient size for all elements. | 762 // Dictionary has been allocated with sufficient size for all elements. |
| 750 ASSERT(maybe_result->ToObject(&result)); | 763 ASSERT(maybe_result->ToObject(&result)); |
| 751 ASSERT(*dictionary_ == result); | 764 ASSERT(*dictionary_ == result); |
| 752 #endif | 765 #endif |
| 753 } | 766 } |
| 754 | 767 |
| 755 } } // namespace v8::internal | 768 } } // namespace v8::internal |
| OLD | NEW |