Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index 7b847749a3bfe505facb5a68c5ae516c3a46cc04..12fd8919daaf79b28efd95ff675c3f2a580e13d0 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -12329,8 +12329,16 @@ void ICData::AddReceiverCheck(intptr_t receiver_class_id, |
| data_pos = 0; |
| } |
| data.SetAt(data_pos, Smi::Handle(Smi::New(receiver_class_id))); |
| - data.SetAt(data_pos + 1, target); |
| - data.SetAt(data_pos + 2, Smi::Handle(Smi::New(count))); |
| + if (Isolate::Current()->compilation_allowed()) { |
| + data.SetAt(data_pos + 1, target); |
| + data.SetAt(data_pos + 2, Smi::Handle(Smi::New(count))); |
| + } else { |
|
srdjan
2016/03/15 19:15:48
Add a comment, that this is for precompilation onl
rmacnak
2016/03/16 18:21:31
Done.
|
| + const Code& code = Code::Handle(target.CurrentCode()); |
| + const Smi& entry_point = |
| + Smi::Handle(reinterpret_cast<RawSmi*>(code.EntryPoint())); |
|
srdjan
2016/03/15 19:15:48
Add check that this is a valid Smi value.
rmacnak
2016/03/16 18:21:31
Added Smi::FromAlignedAddress.
|
| + data.SetAt(data_pos + 1, code); |
| + data.SetAt(data_pos + 2, entry_point); |
| + } |
| // Multithreaded access to ICData requires setting of array to be the last |
| // operation. |
| set_ic_data_array(data); |
| @@ -12404,6 +12412,7 @@ intptr_t ICData::GetReceiverClassIdAt(intptr_t index) const { |
| RawFunction* ICData::GetTargetAt(intptr_t index) const { |
| + ASSERT(Isolate::Current()->compilation_allowed()); |
| const intptr_t data_pos = index * TestEntryLength() + NumArgsTested(); |
| ASSERT(Object::Handle(Array::Handle(ic_data()).At(data_pos)).IsFunction()); |
| @@ -12413,6 +12422,15 @@ RawFunction* ICData::GetTargetAt(intptr_t index) const { |
| } |
| +RawObject* ICData::GetTargetOrCodeAt(intptr_t index) const { |
| + const intptr_t data_pos = index * TestEntryLength() + NumArgsTested(); |
| + |
| + NoSafepointScope no_safepoint; |
| + RawArray* raw_data = ic_data(); |
| + return reinterpret_cast<RawObject*>(raw_data->ptr()->data()[data_pos]); |
|
srdjan
2016/03/15 19:15:48
Do you need the cast? Isn't raw_data->ptr()->data(
rmacnak
2016/03/16 18:21:31
No, removed.
|
| +} |
| + |
| + |
| void ICData::IncrementCountAt(intptr_t index, intptr_t value) const { |
| ASSERT(0 <= value); |
| ASSERT(value <= Smi::kMaxValue); |
| @@ -12431,7 +12449,26 @@ void ICData::SetCountAt(intptr_t index, intptr_t value) const { |
| } |
| +void ICData::SetCodeAt(intptr_t index, const Code& value) const { |
| + ASSERT(!Isolate::Current()->compilation_allowed()); |
| + const Array& data = Array::Handle(ic_data()); |
| + const intptr_t data_pos = index * TestEntryLength() + |
| + CodeIndexFor(NumArgsTested()); |
| + data.SetAt(data_pos, value); |
| +} |
| + |
| + |
| +void ICData::SetEntryPointAt(intptr_t index, const Smi& value) const { |
| + ASSERT(!Isolate::Current()->compilation_allowed()); |
| + const Array& data = Array::Handle(ic_data()); |
| + const intptr_t data_pos = index * TestEntryLength() + |
| + EntryPointIndexFor(NumArgsTested()); |
| + data.SetAt(data_pos, value); |
|
srdjan
2016/03/15 19:15:48
Maybe put this two functions after all count funct
rmacnak
2016/03/16 18:21:31
Done.
|
| +} |
| + |
| + |
| intptr_t ICData::GetCountAt(intptr_t index) const { |
| + ASSERT(Isolate::Current()->compilation_allowed()); |
| const Array& data = Array::Handle(ic_data()); |
| const intptr_t data_pos = index * TestEntryLength() + |
| CountIndexFor(NumArgsTested()); |