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

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
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 7b847749a3bfe505facb5a68c5ae516c3a46cc04..a3a1a793371095b803a289da5c343c7652883786 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -12329,8 +12329,18 @@ 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 {
+ // Precompilation only, after all functions have been compiled.
+ ASSERT(target.HasCode());
+ const Code& code = Code::Handle(target.CurrentCode());
+ const Smi& entry_point =
+ Smi::Handle(Smi::FromAlignedAddress(code.EntryPoint()));
+ 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 +12414,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 +12424,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 raw_data->ptr()->data()[data_pos];
+}
+
+
void ICData::IncrementCountAt(intptr_t index, intptr_t value) const {
ASSERT(0 <= value);
ASSERT(value <= Smi::kMaxValue);
@@ -12432,6 +12452,7 @@ void ICData::SetCountAt(intptr_t index, intptr_t value) const {
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());
@@ -12450,6 +12471,24 @@ intptr_t ICData::AggregateCount() 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);
+}
+
+
RawFunction* ICData::GetTargetForReceiverClassId(intptr_t class_id) const {
const intptr_t len = NumberOfChecks();
for (intptr_t i = 0; i < len; i++) {
« no previous file with comments | « runtime/vm/object.h ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698