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

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

Issue 15470013: Remove the IC data array from the isolate. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8
9 #include "vm/ast_printer.h" 9 #include "vm/ast_printer.h"
10 #include "vm/code_generator.h" 10 #include "vm/code_generator.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 } 114 }
115 115
116 116
117 // Return false if bailed out. 117 // Return false if bailed out.
118 static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function, 118 static bool CompileParsedFunctionHelper(const ParsedFunction& parsed_function,
119 bool optimized) { 119 bool optimized) {
120 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer); 120 TimerScope timer(FLAG_compiler_stats, &CompilerStats::codegen_timer);
121 bool is_compiled = false; 121 bool is_compiled = false;
122 Isolate* isolate = Isolate::Current(); 122 Isolate* isolate = Isolate::Current();
123 HANDLESCOPE(isolate); 123 HANDLESCOPE(isolate);
124 ASSERT(isolate->ic_data_array() == Array::null()); // Must be reset to null.
125 const intptr_t prev_deopt_id = isolate->deopt_id(); 124 const intptr_t prev_deopt_id = isolate->deopt_id();
126 isolate->set_deopt_id(0); 125 isolate->set_deopt_id(0);
127 LongJump* old_base = isolate->long_jump_base(); 126 LongJump* old_base = isolate->long_jump_base();
128 LongJump bailout_jump; 127 LongJump bailout_jump;
129 isolate->set_long_jump_base(&bailout_jump); 128 isolate->set_long_jump_base(&bailout_jump);
130 if (setjmp(*bailout_jump.Set()) == 0) { 129 if (setjmp(*bailout_jump.Set()) == 0) {
131 FlowGraph* flow_graph = NULL; 130 FlowGraph* flow_graph = NULL;
132 // TimerScope needs an isolate to be properly terminated in case of a 131 // TimerScope needs an isolate to be properly terminated in case of a
133 // LongJump. 132 // LongJump.
134 { 133 {
135 TimerScope timer(FLAG_compiler_stats, 134 TimerScope timer(FLAG_compiler_stats,
136 &CompilerStats::graphbuilder_timer, 135 &CompilerStats::graphbuilder_timer,
137 isolate); 136 isolate);
137 Array& ic_data_array = Array::Handle();
138 if (optimized) { 138 if (optimized) {
139 ASSERT(parsed_function.function().HasCode()); 139 ASSERT(parsed_function.function().HasCode());
140 // Extract type feedback before the graph is built, as the graph 140 // Extract type feedback before the graph is built, as the graph
141 // builder uses it to attach it to nodes. 141 // builder uses it to attach it to nodes.
142 // Do not use type feedback to optimize a function that was 142 // Do not use type feedback to optimize a function that was
143 // deoptimized too often. 143 // deoptimized too often.
144 if (parsed_function.function().deoptimization_counter() < 144 if (parsed_function.function().deoptimization_counter() <
145 FLAG_deoptimization_counter_threshold) { 145 FLAG_deoptimization_counter_threshold) {
146 const Code& unoptimized_code = 146 const Code& unoptimized_code =
147 Code::Handle(parsed_function.function().unoptimized_code()); 147 Code::Handle(parsed_function.function().unoptimized_code());
148 isolate->set_ic_data_array( 148 ic_data_array = unoptimized_code.ExtractTypeFeedbackArray();
149 unoptimized_code.ExtractTypeFeedbackArray());
150 } 149 }
151 } 150 }
152 151
153 // Build the flow graph. 152 // Build the flow graph.
154 FlowGraphBuilder builder(parsed_function, NULL); // NULL = not inlining. 153 FlowGraphBuilder builder(parsed_function,
154 ic_data_array,
155 NULL); // NULL = not inlining.
155 flow_graph = builder.BuildGraph(); 156 flow_graph = builder.BuildGraph();
156 } 157 }
157 158
158 if (optimized) { 159 if (optimized) {
159 TimerScope timer(FLAG_compiler_stats, 160 TimerScope timer(FLAG_compiler_stats,
160 &CompilerStats::ssa_timer, 161 &CompilerStats::ssa_timer,
161 isolate); 162 isolate);
162 // Transform to SSA (virtual register 0 and no inlining arguments). 163 // Transform to SSA (virtual register 0 and no inlining arguments).
163 flow_graph->ComputeSSA(0, NULL); 164 flow_graph->ComputeSSA(0, NULL);
164 DEBUG_ASSERT(flow_graph->VerifyUseLists()); 165 DEBUG_ASSERT(flow_graph->VerifyUseLists());
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 isolate->object_store()->sticky_error()); 390 isolate->object_store()->sticky_error());
390 isolate->object_store()->clear_sticky_error(); 391 isolate->object_store()->clear_sticky_error();
391 if (FLAG_trace_bailout) { 392 if (FLAG_trace_bailout) {
392 OS::Print("%s\n", bailout_error.ToErrorCString()); 393 OS::Print("%s\n", bailout_error.ToErrorCString());
393 } 394 }
394 // We only bail out from generating ssa code. 395 // We only bail out from generating ssa code.
395 ASSERT(optimized); 396 ASSERT(optimized);
396 is_compiled = false; 397 is_compiled = false;
397 } 398 }
398 // Reset global isolate state. 399 // Reset global isolate state.
399 isolate->set_ic_data_array(Array::null());
400 isolate->set_long_jump_base(old_base); 400 isolate->set_long_jump_base(old_base);
401 isolate->set_deopt_id(prev_deopt_id); 401 isolate->set_deopt_id(prev_deopt_id);
402 return is_compiled; 402 return is_compiled;
403 } 403 }
404 404
405 405
406 static void DisassembleCode(const Function& function, bool optimized) { 406 static void DisassembleCode(const Function& function, bool optimized) {
407 const char* function_fullname = function.ToFullyQualifiedCString(); 407 const char* function_fullname = function.ToFullyQualifiedCString();
408 OS::Print("Code for %sfunction '%s' {\n", 408 OS::Print("Code for %sfunction '%s' {\n",
409 optimized ? "optimized " : "", 409 optimized ? "optimized " : "",
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
736 Object::Handle(isolate->object_store()->sticky_error()); 736 Object::Handle(isolate->object_store()->sticky_error());
737 isolate->object_store()->clear_sticky_error(); 737 isolate->object_store()->clear_sticky_error();
738 isolate->set_long_jump_base(base); 738 isolate->set_long_jump_base(base);
739 return result.raw(); 739 return result.raw();
740 } 740 }
741 UNREACHABLE(); 741 UNREACHABLE();
742 return Object::null(); 742 return Object::null();
743 } 743 }
744 744
745 } // namespace dart 745 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/flow_graph_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698