Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1235)

Unified Diff: runtime/vm/object.cc

Issue 1799793002: Precompilation: Have instances calls load the entry point and Code object from the ic data array in… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/precompiler.h » ('j') | runtime/vm/precompiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698