| Index: runtime/vm/precompiler.cc
|
| diff --git a/runtime/vm/precompiler.cc b/runtime/vm/precompiler.cc
|
| index ce07486c707488878bde0cd3312493e488848a53..9f8cbca6f794e9939def5c4e67c1a55388c9f351 100644
|
| --- a/runtime/vm/precompiler.cc
|
| +++ b/runtime/vm/precompiler.cc
|
| @@ -830,6 +830,7 @@ void Precompiler::AddCalleesOf(const Function& function) {
|
| #endif
|
|
|
| const ObjectPool& pool = ObjectPool::Handle(Z, code.GetObjectPool());
|
| + ObjectPoolInfo pool_info(pool);
|
| ICData& call_site = ICData::Handle(Z);
|
| MegamorphicCache& cache = MegamorphicCache::Handle(Z);
|
| String& selector = String::Handle(Z);
|
| @@ -838,7 +839,7 @@ void Precompiler::AddCalleesOf(const Function& function) {
|
| Instance& instance = Instance::Handle(Z);
|
| Code& target_code = Code::Handle(Z);
|
| for (intptr_t i = 0; i < pool.Length(); i++) {
|
| - if (pool.InfoAt(i) == ObjectPool::kTaggedObject) {
|
| + if (pool_info.InfoAt(i) == ObjectPool::kTaggedObject) {
|
| entry = pool.ObjectAt(i);
|
| if (entry.IsICData()) {
|
| // A dynamic call.
|
| @@ -1032,6 +1033,9 @@ void Precompiler::AddConstObject(const Instance& instance) {
|
| // argument descriptors.
|
| if (!instance.IsCanonical()) return;
|
|
|
| + // Constants are canonicalized and we avoid repeated processing of them.
|
| + if (consts_to_retain_.Lookup(&instance) != NULL) return;
|
| +
|
| consts_to_retain_.Insert(&Instance::ZoneHandle(Z, instance.raw()));
|
|
|
| if (cls.NumTypeArguments() > 0) {
|
| @@ -1077,6 +1081,8 @@ void Precompiler::AddClosureCall(const Array& arguments_descriptor) {
|
|
|
|
|
| void Precompiler::AddField(const Field& field) {
|
| + if (fields_to_retain_.Lookup(&field) != NULL) return;
|
| +
|
| fields_to_retain_.Insert(&Field::ZoneHandle(Z, field.raw()));
|
|
|
| if (field.is_static()) {
|
| @@ -2095,6 +2101,7 @@ void Precompiler::SwitchICCalls() {
|
| code_(Code::Handle(zone)),
|
| pool_(ObjectPool::Handle(zone)),
|
| entry_(Object::Handle(zone)),
|
| + info_array_(TypedData::Handle(zone)),
|
| ic_(ICData::Handle(zone)),
|
| target_name_(String::Handle(zone)),
|
| args_descriptor_(Array::Handle(zone)),
|
| @@ -2109,8 +2116,10 @@ void Precompiler::SwitchICCalls() {
|
|
|
| code_ = function.CurrentCode();
|
| pool_ = code_.object_pool();
|
| + info_array_ = pool_.info_array();
|
| + ObjectPoolInfo pool_info(info_array_);
|
| for (intptr_t i = 0; i < pool_.Length(); i++) {
|
| - if (pool_.InfoAt(i) != ObjectPool::kTaggedObject) continue;
|
| + if (pool_info.InfoAt(i) != ObjectPool::kTaggedObject) continue;
|
| entry_ = pool_.ObjectAt(i);
|
| if (entry_.IsICData()) {
|
| // The only IC calls generated by precompilation are for switchable
|
| @@ -2150,6 +2159,7 @@ void Precompiler::SwitchICCalls() {
|
| Code& code_;
|
| ObjectPool& pool_;
|
| Object& entry_;
|
| + TypedData& info_array_;
|
| ICData& ic_;
|
| String& target_name_;
|
| Array& args_descriptor_;
|
|
|