Chromium Code Reviews| 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", |