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

Side by Side Diff: runtime/vm/compiler.cc

Issue 10928232: Deoptimization support in inlined code. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/compiler.h" 5 #include "vm/compiler.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/code_generator.h" 9 #include "vm/code_generator.h"
10 #include "vm/code_patcher.h" 10 #include "vm/code_patcher.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const Function& function = Function::CheckedHandle(arguments.At(0)); 51 const Function& function = Function::CheckedHandle(arguments.At(0));
52 ASSERT(!function.HasCode()); 52 ASSERT(!function.HasCode());
53 const Error& error = Error::Handle(Compiler::CompileFunction(function)); 53 const Error& error = Error::Handle(Compiler::CompileFunction(function));
54 if (!error.IsNull()) { 54 if (!error.IsNull()) {
55 Exceptions::PropagateError(error); 55 Exceptions::PropagateError(error);
56 } 56 }
57 } 57 }
58 58
59 59
60 // Returns an array indexed by deopt id, containing the extracted ICData. 60 // Returns an array indexed by deopt id, containing the extracted ICData.
61 static RawArray* ExtractTypeFeedbackArray(const Code& code) { 61 RawArray* Compiler::ExtractTypeFeedbackArray(const Code& code) {
62 ASSERT(!code.IsNull() && !code.is_optimized()); 62 ASSERT(!code.IsNull() && !code.is_optimized());
63 GrowableArray<intptr_t> deopt_ids; 63 GrowableArray<intptr_t> deopt_ids;
64 const GrowableObjectArray& ic_data_objs = 64 const GrowableObjectArray& ic_data_objs =
65 GrowableObjectArray::Handle(GrowableObjectArray::New()); 65 GrowableObjectArray::Handle(GrowableObjectArray::New());
66 const intptr_t max_id = 66 const intptr_t max_id =
67 code.ExtractIcDataArraysAtCalls(&deopt_ids, ic_data_objs); 67 code.ExtractIcDataArraysAtCalls(&deopt_ids, ic_data_objs);
68 const Array& result = Array::Handle(Array::New(max_id + 1)); 68 const Array& result = Array::Handle(Array::New(max_id + 1));
69 for (intptr_t i = 0; i < deopt_ids.length(); i++) { 69 for (intptr_t i = 0; i < deopt_ids.length(); i++) {
70 intptr_t result_index = deopt_ids[i]; 70 intptr_t result_index = deopt_ids[i];
71 ASSERT(result.At(result_index) == Object::null()); 71 ASSERT(result.At(result_index) == Object::null());
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 ASSERT(!parsed_function.function().HasOptimizedCode()); 150 ASSERT(!parsed_function.function().HasOptimizedCode());
151 // Extract type feedback before the graph is built, as the graph 151 // Extract type feedback before the graph is built, as the graph
152 // builder uses it to attach it to nodes. 152 // builder uses it to attach it to nodes.
153 // Do not use type feedback to optimize a function that was 153 // Do not use type feedback to optimize a function that was
154 // deoptimized too often. 154 // deoptimized too often.
155 if (parsed_function.function().deoptimization_counter() < 155 if (parsed_function.function().deoptimization_counter() <
156 FLAG_deoptimization_counter_threshold) { 156 FLAG_deoptimization_counter_threshold) {
157 const Code& unoptimized_code = 157 const Code& unoptimized_code =
158 Code::Handle(parsed_function.function().unoptimized_code()); 158 Code::Handle(parsed_function.function().unoptimized_code());
159 isolate->set_ic_data_array( 159 isolate->set_ic_data_array(
160 ExtractTypeFeedbackArray(unoptimized_code)); 160 Compiler::ExtractTypeFeedbackArray(unoptimized_code));
161 } 161 }
162 } 162 }
163 163
164 // Build the flow graph. 164 // Build the flow graph.
165 FlowGraphBuilder builder(parsed_function); 165 FlowGraphBuilder builder(parsed_function);
166 flow_graph = builder.BuildGraph(FlowGraphBuilder::kNotInlining); 166 flow_graph = builder.BuildGraph(FlowGraphBuilder::kNotInlining);
167 167
168 // Transform to SSA. 168 // Transform to SSA.
169 if (optimized) flow_graph->ComputeSSA(0); // Start at virtual register 0. 169 if (optimized) flow_graph->ComputeSSA(0); // Start at virtual register 0.
170 170
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 result = isolate->object_store()->sticky_error(); 578 result = isolate->object_store()->sticky_error();
579 isolate->object_store()->clear_sticky_error(); 579 isolate->object_store()->clear_sticky_error();
580 isolate->set_long_jump_base(base); 580 isolate->set_long_jump_base(base);
581 return result.raw(); 581 return result.raw();
582 } 582 }
583 UNREACHABLE(); 583 UNREACHABLE();
584 return Object::null(); 584 return Object::null();
585 } 585 }
586 586
587 } // namespace dart 587 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698