Chromium Code Reviews| Index: src/type-info.cc |
| diff --git a/src/type-info.cc b/src/type-info.cc |
| index 1059c7aecd8796e4f31d0a9f4a9e3ff3354f4719..087e1db148b22f2c9943571ebde21d3223656c4a 100644 |
| --- a/src/type-info.cc |
| +++ b/src/type-info.cc |
| @@ -52,12 +52,7 @@ Handle<Object> TypeFeedbackOracle::GetInfo(TypeFeedbackId ast_id) { |
| Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorSlot slot) { |
| DCHECK(slot.ToInt() >= 0 && slot.ToInt() < feedback_vector_->length()); |
| Object* obj = feedback_vector_->Get(slot); |
| - if (!obj->IsJSFunction() || |
| - !CanRetainOtherContext(JSFunction::cast(obj), *native_context_)) { |
| - DCHECK(!obj->IsMap()); |
| - return Handle<Object>(obj, isolate()); |
| - } |
| - return Handle<Object>::cast(isolate()->factory()->undefined_value()); |
| + return Handle<Object>(obj, isolate()); |
| } |
| @@ -75,9 +70,7 @@ Handle<Object> TypeFeedbackOracle::GetInfo(FeedbackVectorICSlot slot) { |
| obj = cell->value(); |
| } |
| - if ((obj->IsJSFunction() && |
| - !CanRetainOtherContext(JSFunction::cast(obj), *native_context_)) || |
| - obj->IsAllocationSite() || obj->IsSymbol()) { |
| + if (obj->IsJSFunction() || obj->IsAllocationSite() || obj->IsSymbol()) { |
| return Handle<Object>(obj, isolate()); |
| } |
| @@ -248,12 +241,7 @@ void TypeFeedbackOracle::CompareType(TypeFeedbackId id, |
| Handle<Map> map; |
| Map* raw_map = code->FindFirstMap(); |
| - if (raw_map != NULL) { |
| - if (Map::TryUpdate(handle(raw_map)).ToHandle(&map) && |
| - CanRetainOtherContext(*map, *native_context_)) { |
| - map = Handle<Map>::null(); |
| - } |
| - } |
| + if (raw_map != NULL) Map::TryUpdate(handle(raw_map)).ToHandle(&map); |
| if (code->is_compare_ic_stub()) { |
| CompareICStub stub(code->stub_key(), isolate()); |
| @@ -419,43 +407,6 @@ void TypeFeedbackOracle::CollectReceiverTypes(T* obj, Handle<Name> name, |
| } |
| -// Check if a map originates from a given native context. We use this |
| -// information to filter out maps from different context to avoid |
| -// retaining objects from different tabs in Chrome via optimized code. |
| -bool TypeFeedbackOracle::CanRetainOtherContext(Map* map, |
| - Context* native_context) { |
| - Object* constructor = NULL; |
| - while (!map->prototype()->IsNull()) { |
| - constructor = map->GetConstructor(); |
| - if (!constructor->IsNull()) { |
| - // If the constructor is not null or a JSFunction, we have to |
| - // conservatively assume that it may retain a native context. |
| - if (!constructor->IsJSFunction()) return true; |
| - // Check if the constructor directly references a foreign context. |
| - if (CanRetainOtherContext(JSFunction::cast(constructor), |
| - native_context)) { |
| - return true; |
| - } |
| - } |
| - map = HeapObject::cast(map->prototype())->map(); |
| - } |
| - constructor = map->GetConstructor(); |
| - if (constructor->IsNull()) return false; |
| - // If the constructor is not null or a JSFunction, we have to conservatively |
| - // assume that it may retain a native context. |
| - if (!constructor->IsJSFunction()) return true; |
| - JSFunction* function = JSFunction::cast(constructor); |
| - return CanRetainOtherContext(function, native_context); |
| -} |
| - |
| - |
| -bool TypeFeedbackOracle::CanRetainOtherContext(JSFunction* function, |
| - Context* native_context) { |
| - return function->context()->global_object() != native_context->global_object() |
| - && function->context()->global_object() != native_context->builtins(); |
| -} |
| - |
| - |
| void TypeFeedbackOracle::CollectReceiverTypes(TypeFeedbackId ast_id, |
| SmallMapList* types) { |
| Handle<Object> object = GetInfo(ast_id); |
| @@ -479,8 +430,8 @@ void TypeFeedbackOracle::CollectReceiverTypes(T* obj, SmallMapList* types) { |
| types->Reserve(maps.length(), zone()); |
| for (int i = 0; i < maps.length(); i++) { |
| Handle<Map> map(maps.at(i)); |
|
Erik Corry
2015/03/26 11:20:57
Perhaps you don't need this variable if it's only
|
| - if (!CanRetainOtherContext(*map, *native_context_)) { |
| - types->AddMapIfMissing(map, zone()); |
| + if (IsRelevantFeedback(*map, *native_context_)) { |
| + types->AddMapIfMissing(maps.at(i), zone()); |
| } |
| } |
| } |