Chromium Code Reviews| Index: src/type-info.cc |
| diff --git a/src/type-info.cc b/src/type-info.cc |
| index 790d77cb19cd55b49a122d4ead43d4c69586e767..d84e44e436d80f958d0afc259db465ff67cc91d2 100644 |
| --- a/src/type-info.cc |
| +++ b/src/type-info.cc |
| @@ -140,6 +140,12 @@ bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
| } |
| +bool TypeFeedbackOracle::CallNewIsMonomorphic(CallNew* expr) { |
| + Handle<Object> value = GetInfo(expr->id()); |
| + return value->IsJSFunction(); |
| +} |
| + |
| + |
| Handle<Map> TypeFeedbackOracle::LoadMonomorphicReceiverType(Property* expr) { |
| ASSERT(LoadIsMonomorphicNormal(expr)); |
| Handle<Object> map_or_code = GetInfo(expr->id()); |
| @@ -541,6 +547,7 @@ void TypeFeedbackOracle::BuildDictionary(Handle<Code> code) { |
| GetRelocInfos(code, &infos); |
| CreateDictionary(code, &infos); |
| ProcessRelocInfos(&infos); |
| + ProcessTypeFeedbackCells(code); |
|
Erik Corry
2012/01/30 15:01:11
This call uses number dictionaries on the heap, an
Vyacheslav Egorov (Chromium)
2012/01/30 15:10:03
Good catch! Yeah, CreateDictionary should add leng
Michael Starzinger
2012/01/30 15:22:58
Nice catch! Fix: https://chromiumcodereview.appspo
|
| // Allocate handle in the parent scope. |
| dictionary_ = scope.CloseAndEscape(dictionary_); |
| } |
| @@ -619,18 +626,6 @@ void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) { |
| SetInfo(ast_id, target); |
| break; |
| - case Code::STUB: |
| - if (target->major_key() == CodeStub::CallFunction && |
| - target->has_function_cache()) { |
| - Object* value = CallFunctionStub::GetCachedValue(reloc_entry.pc()); |
| - if (value->IsJSFunction() && |
| - !CanRetainOtherContext(JSFunction::cast(value), |
| - *global_context_)) { |
| - SetInfo(ast_id, value); |
| - } |
| - } |
| - break; |
| - |
| default: |
| break; |
| } |
| @@ -638,6 +633,20 @@ void TypeFeedbackOracle::ProcessRelocInfos(ZoneList<RelocInfo>* infos) { |
| } |
| +void TypeFeedbackOracle::ProcessTypeFeedbackCells(Handle<Code> code) { |
| + Handle<TypeFeedbackCells> cache(code->type_feedback_cells()); |
| + for (int i = 0; i < cache->CellCount(); i++) { |
| + unsigned ast_id = cache->AstId(i)->value(); |
| + Object* value = cache->Cell(i)->value(); |
| + if (value->IsJSFunction() && |
| + !CanRetainOtherContext(JSFunction::cast(value), |
| + *global_context_)) { |
| + SetInfo(ast_id, value); |
| + } |
| + } |
| +} |
| + |
| + |
| void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) { |
| ASSERT(dictionary_->FindEntry(ast_id) == NumberDictionary::kNotFound); |
| MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target); |