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

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

Issue 878243002: Cleanup: use const reference for ParsedFunction where possible. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 11 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 | « runtime/vm/intrinsifier.h ('k') | runtime/vm/parser.cc » ('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 // Class for intrinsifying functions. 4 // Class for intrinsifying functions.
5 5
6 #include "vm/assembler.h" 6 #include "vm/assembler.h"
7 #include "vm/intrinsifier.h" 7 #include "vm/intrinsifier.h"
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/object.h" 9 #include "vm/object.h"
10 #include "vm/symbols.h" 10 #include "vm/symbols.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 ASSERT(instr->locs() != NULL); 116 ASSERT(instr->locs() != NULL);
117 // Calls are not supported in intrinsics code. 117 // Calls are not supported in intrinsics code.
118 ASSERT(!instr->locs()->always_calls()); 118 ASSERT(!instr->locs()->always_calls());
119 instr->EmitNativeCode(compiler); 119 instr->EmitNativeCode(compiler);
120 } 120 }
121 } 121 }
122 } 122 }
123 } 123 }
124 124
125 125
126 bool Intrinsifier::GraphIntrinsify(ParsedFunction* parsed_function, 126 bool Intrinsifier::GraphIntrinsify(const ParsedFunction& parsed_function,
127 FlowGraphCompiler* compiler) { 127 FlowGraphCompiler* compiler) {
128 ZoneGrowableArray<const ICData*>* ic_data_array = 128 ZoneGrowableArray<const ICData*>* ic_data_array =
129 new ZoneGrowableArray<const ICData*>(); 129 new ZoneGrowableArray<const ICData*>();
130 FlowGraphBuilder builder(parsed_function, 130 FlowGraphBuilder builder(parsed_function,
131 *ic_data_array, 131 *ic_data_array,
132 NULL, // NULL = not inlining. 132 NULL, // NULL = not inlining.
133 Isolate::kNoDeoptId); // No OSR id. 133 Isolate::kNoDeoptId); // No OSR id.
134 134
135 intptr_t block_id = builder.AllocateBlockId(); 135 intptr_t block_id = builder.AllocateBlockId();
136 TargetEntryInstr* normal_entry = 136 TargetEntryInstr* normal_entry =
137 new TargetEntryInstr(block_id, 137 new TargetEntryInstr(block_id,
138 CatchClauseNode::kInvalidTryIndex); 138 CatchClauseNode::kInvalidTryIndex);
139 GraphEntryInstr* graph_entry = new GraphEntryInstr( 139 GraphEntryInstr* graph_entry = new GraphEntryInstr(
140 parsed_function, normal_entry, Isolate::kNoDeoptId); // No OSR id. 140 parsed_function, normal_entry, Isolate::kNoDeoptId); // No OSR id.
141 FlowGraph* graph = new FlowGraph(parsed_function, graph_entry, block_id); 141 FlowGraph* graph = new FlowGraph(parsed_function, graph_entry, block_id);
142 const Function& function = parsed_function->function(); 142 const Function& function = parsed_function.function();
143 switch (function.recognized_kind()) { 143 switch (function.recognized_kind()) {
144 #define EMIT_CASE(class_name, function_name, enum_name, fp) \ 144 #define EMIT_CASE(class_name, function_name, enum_name, fp) \
145 case MethodRecognizer::k##enum_name: \ 145 case MethodRecognizer::k##enum_name: \
146 CHECK_FINGERPRINT3(function, class_name, function_name, enum_name, fp); \ 146 CHECK_FINGERPRINT3(function, class_name, function_name, enum_name, fp); \
147 if (!Build_##enum_name(graph)) return false; \ 147 if (!Build_##enum_name(graph)) return false; \
148 break; 148 break;
149 149
150 GRAPH_INTRINSICS_LIST(EMIT_CASE); 150 GRAPH_INTRINSICS_LIST(EMIT_CASE);
151 default: 151 default:
152 return false; 152 return false;
(...skipping 13 matching lines...) Expand all
166 if (FLAG_print_flow_graph) { 166 if (FLAG_print_flow_graph) {
167 OS::Print("Intrinsic graph after\n"); 167 OS::Print("Intrinsic graph after\n");
168 FlowGraphPrinter printer(*graph); 168 FlowGraphPrinter printer(*graph);
169 printer.PrintBlocks(); 169 printer.PrintBlocks();
170 } 170 }
171 EmitCodeFor(compiler, graph); 171 EmitCodeFor(compiler, graph);
172 return true; 172 return true;
173 } 173 }
174 174
175 175
176 void Intrinsifier::Intrinsify(ParsedFunction* parsed_function, 176 void Intrinsifier::Intrinsify(const ParsedFunction& parsed_function,
177 FlowGraphCompiler* compiler) { 177 FlowGraphCompiler* compiler) {
178 const Function& function = parsed_function->function(); 178 const Function& function = parsed_function.function();
179 if (!CanIntrinsify(function)) { 179 if (!CanIntrinsify(function)) {
180 return; 180 return;
181 } 181 }
182 182
183 ASSERT(!compiler->flow_graph().IsCompiledForOsr()); 183 ASSERT(!compiler->flow_graph().IsCompiledForOsr());
184 if (GraphIntrinsify(parsed_function, compiler)) { 184 if (GraphIntrinsify(parsed_function, compiler)) {
185 return; 185 return;
186 } 186 }
187 187
188 #define EMIT_CASE(class_name, function_name, enum_name, fp) \ 188 #define EMIT_CASE(class_name, function_name, enum_name, fp) \
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 new LoadFieldInstr(new Value(backing_store), 559 new LoadFieldInstr(new Value(backing_store),
560 Array::length_offset(), 560 Array::length_offset(),
561 Type::ZoneHandle(), 561 Type::ZoneHandle(),
562 builder.TokenPos())); 562 builder.TokenPos()));
563 builder.AddIntrinsicReturn(new Value(capacity)); 563 builder.AddIntrinsicReturn(new Value(capacity));
564 return true; 564 return true;
565 } 565 }
566 566
567 567
568 } // namespace dart 568 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intrinsifier.h ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698