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

Unified Diff: runtime/vm/flow_graph_compiler.cc

Issue 10823131: Add deopt info to code object and print it (Closed) Base URL: http://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
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_ia32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_compiler.cc
===================================================================
--- runtime/vm/flow_graph_compiler.cc (revision 10302)
+++ runtime/vm/flow_graph_compiler.cc (working copy)
@@ -8,6 +8,7 @@
#include "vm/dart_entry.h"
#include "vm/debugger.h"
+#include "vm/deopt_instructions.h"
#include "vm/il_printer.h"
#include "vm/intrinsifier.h"
#include "vm/locations.h"
@@ -28,7 +29,37 @@
DECLARE_FLAG(bool, trace_functions);
DECLARE_FLAG(int, optimization_counter_threshold);
+RawDeoptInfo* DeoptimizationStub::CreateDeoptInfo(FlowGraphCompiler* compiler) {
+ if (deoptimization_env_ == NULL) return DeoptInfo::null();
+ const intptr_t fixed_parameter_count =
+ deoptimization_env_->fixed_parameter_count();
+ DeoptInfoBuilder builder(compiler->object_table(), fixed_parameter_count);
+ const Function& function = compiler->parsed_function().function();
+ intptr_t slot_ix = 0;
+ builder.AddReturnAddress(function, deopt_id_, slot_ix++);
+
+ // All locals between TOS and PC-marker.
+ const GrowableArray<Value*>& values = deoptimization_env_->values();
+ // const intptr_t local_slot_count = values.length() - fixed_parameter_count;
+ for (intptr_t i = values.length() - 1; i >= fixed_parameter_count; i--) {
+ builder.AddCopy(deoptimization_env_->LocationAt(i), *values[i], slot_ix++);
+ }
+
+ // PC marker, caller-fp, caller-pc.
+ builder.AddPcMarker(function, slot_ix++);
+ builder.AddCallerFp(slot_ix++);
+ builder.AddCallerPc(slot_ix++);
+ // Incoming arguments.
+ for (intptr_t i = fixed_parameter_count - 1; i >= 0; i--) {
+ builder.AddCopy(deoptimization_env_->LocationAt(i), *values[i], slot_ix++);
+ }
+
+ const DeoptInfo& deopt_info = DeoptInfo::Handle(builder.CreateDeoptInfo());
+ return deopt_info.raw();
+}
+
+
FlowGraphCompiler::FlowGraphCompiler(
Assembler* assembler,
const ParsedFunction& parsed_function,
@@ -45,6 +76,7 @@
stackmap_table_builder_(NULL),
block_info_(block_order.length()),
deopt_stubs_(),
+ object_table_(GrowableObjectArray::Handle(GrowableObjectArray::New())),
is_optimizing_(is_optimizing),
is_ssa_(is_ssa),
is_dart_leaf_(is_leaf),
@@ -165,7 +197,7 @@
void FlowGraphCompiler::GenerateDeferredCode() {
for (intptr_t i = 0; i < deopt_stubs_.length(); i++) {
- deopt_stubs_[i]->GenerateCode(this);
+ deopt_stubs_[i]->GenerateCode(this, i);
}
}
@@ -232,6 +264,20 @@
}
+void FlowGraphCompiler::FinalizeDeoptInfo(const Code& code) {
+ const Array& array =
+ Array::Handle(Array::New(deopt_stubs_.length(), Heap::kOld));
+ DeoptInfo& info = DeoptInfo::Handle();
+ for (intptr_t i = 0; i < deopt_stubs_.length(); i++) {
+ info = deopt_stubs_[i]->CreateDeoptInfo(this);
+ array.SetAt(i, info);
+ }
+ code.set_deopt_info_array(array);
+ const Array& object_array = Array::Handle(Array::MakeArray(object_table_));
+ code.set_object_table(object_array);
+}
+
+
void FlowGraphCompiler::FinalizeStackmaps(const Code& code) {
if (stackmap_table_builder_ == NULL) {
// The unoptimizing compiler has no stack maps.
« no previous file with comments | « runtime/vm/flow_graph_compiler.h ('k') | runtime/vm/flow_graph_compiler_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698