Chromium Code Reviews| Index: src/type-info.cc |
| diff --git a/src/type-info.cc b/src/type-info.cc |
| index de6f5bf04294d2202dbb26c102fa38dedad92527..bb24b7a49de6a24335372ce0d360d2b1738f5e18 100644 |
| --- a/src/type-info.cc |
| +++ b/src/type-info.cc |
| @@ -28,6 +28,7 @@ |
| #include "v8.h" |
| #include "ast.h" |
| +#include "code-stubs.h" |
| #include "compiler.h" |
| #include "ic.h" |
| #include "macro-assembler.h" |
| @@ -88,6 +89,19 @@ bool TypeFeedbackOracle::LoadIsMonomorphicNormal(Property* expr) { |
| } |
| +bool TypeFeedbackOracle::LoadIsMegamorphicWithTypeInfo(Property* expr) { |
| + Handle<Object> map_or_code(GetInfo(expr->id())); |
| + if (map_or_code->IsCode()) { |
| + Handle<Code> code(Code::cast(*map_or_code)); |
|
fschneider
2011/06/15 12:11:46
This will allocate a fresh handle from the pointer
Jakob Kummerow
2011/06/15 12:28:58
Done.
|
| + Builtins* builtins = Isolate::Current()->builtins(); |
| + return code->is_keyed_load_stub() && |
| + *code != builtins->builtin(Builtins::kKeyedLoadIC_Generic) && |
| + code->ic_state() == MEGAMORPHIC; |
| + } |
| + return false; |
| +} |
| + |
| + |
| bool TypeFeedbackOracle::StoreIsMonomorphicNormal(Expression* expr) { |
| Handle<Object> map_or_code(GetInfo(expr->id())); |
| if (map_or_code->IsMap()) return true; |
| @@ -101,6 +115,19 @@ bool TypeFeedbackOracle::StoreIsMonomorphicNormal(Expression* expr) { |
| } |
| +bool TypeFeedbackOracle::StoreIsMegamorphicWithTypeInfo(Expression* expr) { |
| + Handle<Object> map_or_code(GetInfo(expr->id())); |
| + if (map_or_code->IsCode()) { |
| + Handle<Code> code(Code::cast(*map_or_code)); |
|
fschneider
2011/06/15 12:11:46
Same here. Write:
Handle<Code> code = Handle<Code
Jakob Kummerow
2011/06/15 12:28:58
Done.
|
| + Builtins* builtins = Isolate::Current()->builtins(); |
| + return code->is_keyed_store_stub() && |
| + *code != builtins->builtin(Builtins::kKeyedStoreIC_Generic) && |
| + code->ic_state() == MEGAMORPHIC; |
| + } |
| + return false; |
| +} |
| + |
| + |
| bool TypeFeedbackOracle::CallIsMonomorphic(Call* expr) { |
| Handle<Object> value = GetInfo(expr->id()); |
| return value->IsMap() || value->IsSmi(); |
| @@ -390,6 +417,27 @@ ZoneMapList* TypeFeedbackOracle::CollectReceiverTypes(unsigned ast_id, |
| } |
| +void TypeFeedbackOracle::CollectKeyedReceiverTypes( |
| + unsigned ast_id, |
| + ZoneMapList* types) { |
| + Handle<Object> object = GetInfo(ast_id); |
| + if (!object->IsCode()) return; |
| + Handle<Code> code = Handle<Code>::cast(object); |
| + if (code->kind() == Code::KEYED_LOAD_IC || |
| + code->kind() == Code::KEYED_STORE_IC) { |
| + AssertNoAllocation no_allocation; |
| + int mask = RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT); |
| + for (RelocIterator it(*code, mask); !it.done(); it.next()) { |
| + RelocInfo* info = it.rinfo(); |
| + Object* object = info->target_object(); |
| + if (object->IsMap()) { |
| + types->Add(Handle<Map>(Map::cast(object))); |
| + } |
| + } |
| + } |
| +} |
| + |
| + |
| void TypeFeedbackOracle::SetInfo(unsigned ast_id, Object* target) { |
| ASSERT(dictionary_->FindEntry(ast_id) == NumberDictionary::kNotFound); |
| MaybeObject* maybe_result = dictionary_->AtNumberPut(ast_id, target); |