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

Unified Diff: runtime/vm/locations.cc

Issue 517343002: Ensure that BoxInt32 input is correctly preserved on the slow-path. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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/locations.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/locations.cc
diff --git a/runtime/vm/locations.cc b/runtime/vm/locations.cc
index c0ef26eb45da68f255f52516be7c44b94b312ef9..b180f46b2d657c83b57124410462c094c7622144 100644
--- a/runtime/vm/locations.cc
+++ b/runtime/vm/locations.cc
@@ -32,6 +32,9 @@ LocationSummary::LocationSummary(Isolate* isolate,
stack_bitmap_(NULL),
contains_call_(contains_call),
live_registers_() {
+#if defined(DEBUG)
+ writable_inputs_ = 0;
+#endif
input_locations_ = isolate->current_zone()->Alloc<Location>(num_inputs_);
temp_locations_ = isolate->current_zone()->Alloc<Location>(num_temps_);
}
@@ -257,4 +260,34 @@ void LocationSummary::PrintTo(BufferFormatter* f) const {
if (always_calls()) f->Print(" C");
}
+
+#if defined(DEBUG)
+void LocationSummary::DiscoverWritableInputs() {
+ if (!HasCallOnSlowPath()) {
+ return;
+ }
+
+ for (intptr_t i = 0; i < input_count(); i++) {
+ if (in(i).IsUnallocated() &&
+ (in(i).policy() == Location::kWritableRegister)) {
+ writable_inputs_ |= 1 << i;
+ }
+ }
+}
+
+
+void LocationSummary::CheckWritableInputs() {
+ ASSERT(HasCallOnSlowPath());
+ for (intptr_t i = 0; i < input_count(); i++) {
+ if ((writable_inputs_ & (1 << i)) != 0) {
+ // Writable registers have to be manually preserved because
+ // with the right representation because register allocator does not know
+ // how they are used within the instruction template.
+ ASSERT(in(i).IsMachineRegister());
+ ASSERT(live_registers()->Contains(in(i)));
+ }
+ }
+}
+#endif
+
} // namespace dart
« no previous file with comments | « runtime/vm/locations.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698