Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index 3314c72efe8a016b79b7350f1873ae1c91e2eb9d..aada7b76da24b9540060435bf52e6701533a0227 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -11732,6 +11732,32 @@ RawFunction* ICData::GetTargetForReceiverClassId(intptr_t class_id) const { |
| } |
| +RawICData* ICData::AsUnaryClassChecksForCids( |
| + const GrowableArray<intptr_t>& cids, const Function& target) const { |
| + ASSERT(!IsNull()); |
| + const intptr_t kNumArgsTested = 1; |
| + ICData& result = ICData::Handle(ICData::NewFrom(*this, kNumArgsTested)); |
| + for (intptr_t i = 0; i < cids.length(); i++) { |
| + const intptr_t class_id = cids[i]; |
| + const intptr_t count = GetCountAt(0); |
|
Cutch
2015/05/27 02:53:55
We are creating a new ICData and filling it with c
srdjan
2015/05/27 19:10:57
The count is interesting as as it means different
|
| + // This will make sure that Smi is first if it exists. |
| + result.AddReceiverCheck(class_id, target, count); |
| + } |
| + return result.raw(); |
| +} |
| + |
| + |
| +RawICData* ICData::AsUnaryClassChecksForCid( |
| + intptr_t cid, const Function& target) const { |
| + ASSERT(!IsNull()); |
| + const intptr_t kNumArgsTested = 1; |
| + ICData& result = ICData::Handle(ICData::NewFrom(*this, kNumArgsTested)); |
| + |
| + result.AddReceiverCheck(cid, target, GetCountAt(0)); |
| + return result.raw(); |
| +} |
| + |
| + |
| RawICData* ICData::AsUnaryClassChecksForArgNr(intptr_t arg_nr) const { |
| ASSERT(!IsNull()); |
| ASSERT(NumArgsTested() > arg_nr); |
| @@ -11740,12 +11766,7 @@ RawICData* ICData::AsUnaryClassChecksForArgNr(intptr_t arg_nr) const { |
| return raw(); |
| } |
| const intptr_t kNumArgsTested = 1; |
| - ICData& result = ICData::Handle(ICData::New( |
| - Function::Handle(owner()), |
| - String::Handle(target_name()), |
| - Array::Handle(arguments_descriptor()), |
| - deopt_id(), |
| - kNumArgsTested)); |
| + ICData& result = ICData::Handle(ICData::NewFrom(*this, kNumArgsTested)); |
| const intptr_t len = NumberOfChecks(); |
| for (intptr_t i = 0; i < len; i++) { |
| const intptr_t class_id = GetClassIdAt(i, arg_nr); |
| @@ -11773,8 +11794,6 @@ RawICData* ICData::AsUnaryClassChecksForArgNr(intptr_t arg_nr) const { |
| count); |
| } |
| } |
| - // Copy deoptimization reasons. |
| - result.SetDeoptReasons(DeoptReasons()); |
| return result.raw(); |
| } |
| @@ -11897,6 +11916,19 @@ RawICData* ICData::New(const Function& owner, |
| } |
| +RawICData* ICData::NewFrom(const ICData& from, intptr_t num_args_tested) { |
| + const ICData& result = ICData::Handle(ICData::New( |
| + Function::Handle(from.owner()), |
| + String::Handle(from.target_name()), |
| + Array::Handle(from.arguments_descriptor()), |
| + from.deopt_id(), |
| + num_args_tested)); |
| + // Copy deoptimization reasons. |
| + result.SetDeoptReasons(from.DeoptReasons()); |
| + return result.raw(); |
| +} |
| + |
| + |
| void ICData::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| Object::PrintJSONImpl(stream, ref); |
| } |