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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 10823308: Implement basic support for deferred slow path code with calls that save and restore live registers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
Index: runtime/vm/flow_graph_compiler.cc
diff --git a/runtime/vm/flow_graph_compiler.cc b/runtime/vm/flow_graph_compiler.cc
index 28b4a649502b0a875866fe37351f599d16bf778b..22ead877e9433fda4d31fc768f34a7494b281f73 100644
--- a/runtime/vm/flow_graph_compiler.cc
+++ b/runtime/vm/flow_graph_compiler.cc
@@ -205,7 +205,36 @@ bool FlowGraphCompiler::IsNextBlock(BlockEntryInstr* block_entry) const {
}
+void FlowGraphCompiler::SaveLiveRegisters(LocationSummary* locs) {
+ // TODO(vegorov): consider saving only caller save (volatile) registers.
+ for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; reg_idx++) {
+ Register reg = static_cast<Register>(reg_idx);
+ if (locs->live_registers()->Contains(reg)) {
+ assembler()->PushRegister(reg);
+ }
+ }
+}
+
+
+void FlowGraphCompiler::RestoreLiveRegisters(LocationSummary* locs) {
+ for (intptr_t reg_idx = 0; reg_idx < kNumberOfCpuRegisters; reg_idx++) {
+ Register reg = static_cast<Register>(reg_idx);
+ if (locs->live_registers()->Contains(reg)) {
+ assembler()->PopRegister(reg);
+ }
+ }
+}
+
+
+void FlowGraphCompiler::AddSlowPathCode(SlowPathCode* code) {
+ slow_path_code_.Add(code);
+}
+
+
void FlowGraphCompiler::GenerateDeferredCode() {
+ for (intptr_t i = 0; i < slow_path_code_.length(); i++) {
+ slow_path_code_[i]->EmitNativeCode(this);
+ }
for (intptr_t i = 0; i < deopt_stubs_.length(); i++) {
deopt_stubs_[i]->GenerateCode(this, i);
}
@@ -678,7 +707,8 @@ void FrameRegisterAllocator::AllocateRegisters(Instruction* instr) {
// If this instruction is call spill everything that was not consumed by
// input locations.
- if (locs->is_call() || instr->IsBranch() || instr->IsGoto()) {
+ if ((locs->contains_call() != LocationSummary::kNoCall) ||
+ instr->IsBranch() || instr->IsGoto()) {
Spill();
}

Powered by Google App Engine
This is Rietveld 408576698