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

Unified Diff: runtime/vm/compiler.cc

Issue 335173002: Save ICData of unoptimized code in the function, thus preserving it across repated unoptimized comp… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 6 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 | runtime/vm/flow_graph_compiler.h » ('j') | runtime/vm/flow_graph_compiler.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler.cc
===================================================================
--- runtime/vm/compiler.cc (revision 37375)
+++ runtime/vm/compiler.cc (working copy)
@@ -241,6 +241,22 @@
}
+static RawArray* ComputeICDataArray(const Function& function) {
Cutch 2014/06/16 21:39:42 Maybe, make this a method on Function and call it
srdjan 2014/06/16 21:58:08 Yes: SaveICDataMap and RestoreICDataMap.
+ const Array& saved_icd = Array::Handle(function.ic_data_array());
+ if (saved_icd.Length() == 0) {
+ return Array::empty_array().raw();
+ }
+ ICData& icd = ICData::Handle();
+ icd ^= saved_icd.At(saved_icd.Length() - 1);
+ const Array& result = Array::Handle(Array::New(icd.deopt_id() + 1));
+ for (intptr_t i = 0; i < saved_icd.Length(); i++) {
+ icd ^= saved_icd.At(i);
+ result.SetAt(icd.deopt_id(), icd);
+ }
+ return result.raw();
+}
+
+
// Return false if bailed out.
static bool CompileParsedFunctionHelper(ParsedFunction* parsed_function,
bool optimized,
@@ -283,9 +299,7 @@
// builder uses it to attach it to nodes.
ASSERT(function.deoptimization_counter() <
FLAG_deoptimization_counter_threshold);
- const Code& unoptimized_code =
- Code::Handle(function.unoptimized_code());
- ic_data_array = unoptimized_code.ExtractTypeFeedbackArray();
+ ic_data_array = ComputeICDataArray(function);
}
// Build the flow graph.
@@ -576,7 +590,10 @@
const Field* field = (*flow_graph->guarded_fields())[i];
field->RegisterDependentCode(code);
}
- } else {
+ } else { // not optimized.
+ if (function.ic_data_array() == Array::null()) {
+ function.SetSavedICData(graph_compiler.deopt_id_to_ic_data());
+ }
function.set_unoptimized_code(code);
function.AttachCode(code);
ASSERT(CodePatcher::CodeIsPatchable(code));
@@ -767,7 +784,7 @@
TIMERSCOPE(isolate, time_compilation);
Timer per_compile_timer(FLAG_trace_compiler, "Compilation time");
per_compile_timer.Start();
- ParsedFunction* parsed_function = new ParsedFunction(
+ ParsedFunction* parsed_function = new(isolate) ParsedFunction(
isolate, Function::ZoneHandle(isolate, function.raw()));
if (FLAG_trace_compiler) {
OS::Print("Compiling %s%sfunction: '%s' @ token %" Pd ", size %" Pd "\n",
« no previous file with comments | « no previous file | runtime/vm/flow_graph_compiler.h » ('j') | runtime/vm/flow_graph_compiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698