| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 : TypeInfo::Double(); | 51 : TypeInfo::Double(); |
| 52 } else if (value->IsString()) { | 52 } else if (value->IsString()) { |
| 53 info = TypeInfo::String(); | 53 info = TypeInfo::String(); |
| 54 } else { | 54 } else { |
| 55 info = TypeInfo::Unknown(); | 55 info = TypeInfo::Unknown(); |
| 56 } | 56 } |
| 57 return info; | 57 return info; |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 STATIC_ASSERT(DEFAULT_STRING_STUB == Code::kNoExtraICState); | |
| 62 | |
| 63 | |
| 64 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, | 61 TypeFeedbackOracle::TypeFeedbackOracle(Handle<Code> code, |
| 65 Handle<Context> global_context) { | 62 Handle<Context> global_context) { |
| 66 global_context_ = global_context; | 63 global_context_ = global_context; |
| 67 PopulateMap(code); | 64 PopulateMap(code); |
| 68 ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue); | 65 ASSERT(reinterpret_cast<Address>(*dictionary_.location()) != kHandleZapValue); |
| 69 } | 66 } |
| 70 | 67 |
| 71 | 68 |
| 72 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { | 69 Handle<Object> TypeFeedbackOracle::GetInfo(unsigned ast_id) { |
| 73 int entry = dictionary_->FindEntry(ast_id); | 70 int entry = dictionary_->FindEntry(ast_id); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 136 |
| 140 | 137 |
| 141 ZoneMapList* TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, | 138 ZoneMapList* TypeFeedbackOracle::StoreReceiverTypes(Assignment* expr, |
| 142 Handle<String> name) { | 139 Handle<String> name) { |
| 143 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); | 140 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::STORE_IC, NORMAL); |
| 144 return CollectReceiverTypes(expr->id(), name, flags); | 141 return CollectReceiverTypes(expr->id(), name, flags); |
| 145 } | 142 } |
| 146 | 143 |
| 147 | 144 |
| 148 ZoneMapList* TypeFeedbackOracle::CallReceiverTypes(Call* expr, | 145 ZoneMapList* TypeFeedbackOracle::CallReceiverTypes(Call* expr, |
| 149 Handle<String> name) { | 146 Handle<String> name, |
| 147 ReceiverType receiver_type) { |
| 150 int arity = expr->arguments()->length(); | 148 int arity = expr->arguments()->length(); |
| 151 // Note: these flags won't let us get maps from stubs with | 149 |
| 152 // non-default extra ic state in the megamorphic case. In the more | 150 // Note: Currently we do not take string extra ic data into account |
| 153 // important monomorphic case the map is obtained directly, so it's | 151 // here. |
| 154 // not a problem until we decide to emit more polymorphic code. | 152 Code::ExtraICState extra_ic_state = |
| 153 CallIC::Contextual::encode(receiver_type == IMPLICIT_RECEIVER); |
| 154 |
| 155 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, | 155 Code::Flags flags = Code::ComputeMonomorphicFlags(Code::CALL_IC, |
| 156 NORMAL, | 156 NORMAL, |
| 157 Code::kNoExtraICState, | 157 extra_ic_state, |
| 158 OWN_MAP, | 158 OWN_MAP, |
| 159 NOT_IN_LOOP, | 159 NOT_IN_LOOP, |
| 160 arity); | 160 arity); |
| 161 return CollectReceiverTypes(expr->id(), name, flags); | 161 return CollectReceiverTypes(expr->id(), name, flags); |
| 162 } | 162 } |
| 163 | 163 |
| 164 | 164 |
| 165 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { | 165 CheckType TypeFeedbackOracle::GetCallCheckType(Call* expr) { |
| 166 Handle<Object> value = GetInfo(expr->id()); | 166 Handle<Object> value = GetInfo(expr->id()); |
| 167 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; | 167 if (!value->IsSmi()) return RECEIVER_MAP_CHECK; |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 static_cast<int>(info->pc() - code->instruction_start())); | 497 static_cast<int>(info->pc() - code->instruction_start())); |
| 498 ASSERT(ast_ids->length() == 0 || | 498 ASSERT(ast_ids->length() == 0 || |
| 499 (*ast_ids)[ast_ids->length()-1] != | 499 (*ast_ids)[ast_ids->length()-1] != |
| 500 static_cast<unsigned>(info->data())); | 500 static_cast<unsigned>(info->data())); |
| 501 ast_ids->Add(static_cast<unsigned>(info->data())); | 501 ast_ids->Add(static_cast<unsigned>(info->data())); |
| 502 } | 502 } |
| 503 } | 503 } |
| 504 } | 504 } |
| 505 | 505 |
| 506 } } // namespace v8::internal | 506 } } // namespace v8::internal |
| OLD | NEW |