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

Unified Diff: runtime/vm/object.cc

Issue 1402123004: VM: Speed up PC descriptor verification code used in DEBUG mode. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | 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 e2eaab4b34852b0e82e68b79445605391610597f..f755534b91f19031074c6e173a0e92fa9c314d6b 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -11404,18 +11404,22 @@ void PcDescriptors::PrintJSONImpl(JSONStream* stream, bool ref) const {
// finally blocks).
void PcDescriptors::Verify(const Function& function) const {
#if defined(DEBUG)
- // TODO(srdjan): Implement a more efficient way to check, currently drop
- // the check for too large number of descriptors.
- if (Length() > 3000) {
- if (FLAG_trace_compiler) {
- OS::Print("Not checking pc decriptors, length %" Pd "\n", Length());
- }
- return;
- }
// Only check ids for unoptimized code that is optimizable.
if (!function.IsOptimizable()) {
return;
}
+ intptr_t max_deopt_id = 0;
+ Iterator max_iter(*this,
+ RawPcDescriptors::kDeopt | RawPcDescriptors::kIcCall);
+ while (max_iter.MoveNext()) {
+ if (max_iter.DeoptId() > max_deopt_id) {
+ max_deopt_id = max_iter.DeoptId();
+ }
+ }
+
+ Zone* zone = Thread::Current()->zone();
+ BitVector* deopt_ids = new(zone) BitVector(zone, max_deopt_id + 1);
+ BitVector* iccall_ids = new(zone) BitVector(zone, max_deopt_id + 1);
Iterator iter(*this, RawPcDescriptors::kDeopt | RawPcDescriptors::kIcCall);
while (iter.MoveNext()) {
// 'deopt_id' is set for kDeopt and kIcCall and must be unique for one kind.
@@ -11425,12 +11429,12 @@ void PcDescriptors::Verify(const Function& function) const {
// lead to issues in the future. Fix that and enable verification.
continue;
}
-
- Iterator nested(iter);
- while (nested.MoveNext()) {
- if (iter.Kind() == nested.Kind()) {
- ASSERT(nested.DeoptId() != iter.DeoptId());
- }
+ if (iter.Kind() == RawPcDescriptors::kDeopt) {
+ ASSERT(!deopt_ids->Contains(iter.DeoptId()));
+ deopt_ids->Add(iter.DeoptId());
+ } else {
+ ASSERT(!iccall_ids->Contains(iter.DeoptId()));
+ iccall_ids->Add(iter.DeoptId());
}
}
#endif // DEBUG
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698