Chromium Code Reviews| Index: runtime/vm/compiler.cc |
| =================================================================== |
| --- runtime/vm/compiler.cc (revision 9088) |
| +++ runtime/vm/compiler.cc (working copy) |
| @@ -20,7 +20,6 @@ |
| #include "vm/longjump.h" |
| #include "vm/object.h" |
| #include "vm/object_store.h" |
| -#include "vm/opt_code_generator.h" |
| #include "vm/os.h" |
| #include "vm/parser.h" |
| #include "vm/scanner.h" |
| @@ -51,35 +50,6 @@ |
| } |
| -// Extracts IC data associated with a node id. |
| -// TODO(srdjan): Check performance impact of node id search loop. |
| -static void ExtractTypeFeedback(const Code& code, |
| - SequenceNode* sequence_node) { |
| - ASSERT(!code.IsNull() && !code.is_optimized()); |
| - GrowableArray<AstNode*> all_nodes; |
| - sequence_node->CollectAllNodes(&all_nodes); |
| - GrowableArray<intptr_t> node_ids; |
| - const GrowableObjectArray& ic_data_objs = |
| - GrowableObjectArray::Handle(GrowableObjectArray::New()); |
| - code.ExtractIcDataArraysAtCalls(&node_ids, ic_data_objs); |
| - ICData& ic_data_obj = ICData::Handle(); |
| - for (intptr_t i = 0; i < node_ids.length(); i++) { |
| - intptr_t node_id = node_ids[i]; |
| - bool found_node = false; |
| - for (intptr_t n = 0; n < all_nodes.length(); n++) { |
| - if (all_nodes[n]->id() == node_id) { |
| - found_node = true; |
| - // Make sure we assign ic data array only once. |
| - ASSERT(all_nodes[n]->ic_data().IsNull()); |
| - ic_data_obj ^= ic_data_objs.At(i); |
| - all_nodes[n]->set_ic_data(ic_data_obj); |
| - } |
| - } |
| - ASSERT(found_node); |
| - } |
| -} |
| - |
| - |
| // Returns an array indexed by computation id, containing the extracted ICData. |
| static RawArray* ExtractTypeFeedbackArray(const Code& code) { |
| ASSERT(!code.IsNull() && !code.is_optimized()); |
| @@ -146,10 +116,9 @@ |
| } |
| -// Return false if bailed out. |
| -static bool CompileWithNewCompiler( |
| +static void CompileParsedFunctionHelper( |
| const ParsedFunction& parsed_function, bool optimized) { |
| - bool is_compiled = false; |
| + TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); |
| Isolate* isolate = Isolate::Current(); |
| ASSERT(isolate->ic_data_array() == Array::null()); // Must be reset to null. |
| const intptr_t prev_cid = isolate->computation_id(); |
| @@ -244,119 +213,16 @@ |
| ASSERT(CodePatcher::CodeIsPatchable(code)); |
| } |
| } |
| - is_compiled = true; |
| } else { |
| - // We bailed out. |
| - Error& bailout_error = Error::Handle( |
| - isolate->object_store()->sticky_error()); |
| - isolate->object_store()->clear_sticky_error(); |
| - if (FLAG_trace_bailout) { |
| - OS::Print("%s\n", bailout_error.ToErrorCString()); |
| - } |
| - is_compiled = false; |
| + UNREACHABLE(); |
|
srdjan
2012/06/26 16:06:51
We can bailout of optimized code (e.g., during ssa
|
| } |
| // Reset global isolate state. |
| isolate->set_ic_data_array(Array::null()); |
| isolate->set_long_jump_base(old_base); |
| isolate->set_computation_id(prev_cid); |
| - return is_compiled; |
| } |
| -static void CompileWithOldCompiler( |
| - const ParsedFunction& parsed_function, bool optimized) { |
| - const Function& function = parsed_function.function(); |
| - Assembler assembler; |
| - if (optimized) { |
| - // Transition to optimized code only from unoptimized code ... |
| - // for now. |
| - ASSERT(function.HasCode()); |
| - ASSERT(!function.HasOptimizedCode()); |
| - // Do not use type feedback to optimize a function that was |
| - // deoptimized too often. |
| - if (parsed_function.function().deoptimization_counter() < |
| - FLAG_deoptimization_counter_threshold) { |
| - TimerScope timer(FLAG_compiler_stats, |
| - &CompilerStats::graphbuilder_timer); |
| - ExtractTypeFeedback( |
| - Code::Handle(parsed_function.function().unoptimized_code()), |
| - parsed_function.node_sequence()); |
| - } |
| - OptimizingCodeGenerator code_gen(&assembler, parsed_function); |
| - { |
| - TimerScope timer(FLAG_compiler_stats, |
| - &CompilerStats::graphcompiler_timer); |
| - code_gen.GenerateCode(); |
| - } |
| - { |
| - TimerScope timer(FLAG_compiler_stats, |
| - &CompilerStats::codefinalizer_timer); |
| - Code& code = Code::Handle(Code::FinalizeCode(function, &assembler)); |
| - code.set_is_optimized(true); |
| - code_gen.FinalizePcDescriptors(code); |
| - code_gen.FinalizeStackmaps(code); |
| - code_gen.FinalizeExceptionHandlers(code); |
| - code_gen.FinalizeComments(code); |
| - function.SetCode(code); |
| - CodePatcher::PatchEntry(Code::Handle(function.unoptimized_code())); |
| - } |
| - if (FLAG_trace_compiler) { |
| - OS::Print("--> patching entry 0x%x\n", |
| - Code::Handle(function.unoptimized_code()).EntryPoint()); |
| - } |
| - } else { |
| - // Compile unoptimized code. |
| - ASSERT(!function.HasCode()); |
| - // Compiling first time. |
| - CodeGenerator code_gen(&assembler, parsed_function); |
| - { |
| - TimerScope timer(FLAG_compiler_stats, |
| - &CompilerStats::graphcompiler_timer); |
| - code_gen.GenerateCode(); |
| - } |
| - { |
| - TimerScope timer(FLAG_compiler_stats, |
| - &CompilerStats::codefinalizer_timer); |
| - const Code& code = Code::Handle(Code::FinalizeCode(function, &assembler)); |
| - code.set_is_optimized(false); |
| - code_gen.FinalizePcDescriptors(code); |
| - code_gen.FinalizeStackmaps(code); |
| - code_gen.FinalizeVarDescriptors(code); |
| - code_gen.FinalizeExceptionHandlers(code); |
| - code_gen.FinalizeComments(code); |
| - function.set_unoptimized_code(code); |
| - function.SetCode(code); |
| - ASSERT(CodePatcher::CodeIsPatchable(code)); |
| - } |
| - } |
| -} |
| - |
| -static void CompileParsedFunctionHelper( |
| - const ParsedFunction& parsed_function, bool optimized) { |
| - TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); |
| - bool is_compiled = false; |
| - // TODO(srdjan): Remove once the old compiler has been ripped out. |
| -#if defined(TARGET_ARCH_X64) |
| - const bool use_new_compiler = true; |
| -#else |
| - const bool use_new_compiler = FLAG_use_new_compiler; |
| -#endif |
| - if (use_new_compiler) { |
| - is_compiled = CompileWithNewCompiler(parsed_function, optimized); |
| - if (!is_compiled && optimized) { |
| - // When bailing out from the optimizing compiler, mark function as |
| - // non-optimizable and return. |
| - parsed_function.function().set_is_optimizable(false); |
| - return; |
| - } |
| - } |
| - |
| - if (!is_compiled) { |
| - CompileWithOldCompiler(parsed_function, optimized); |
| - } |
| -} |
| - |
| - |
| static RawError* CompileFunctionHelper(const Function& function, |
| bool optimized) { |
| Isolate* isolate = Isolate::Current(); |