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

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

Issue 716163003: Use one offsets table per generated irregexp matching function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: comments Created 6 years, 1 month 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/intermediate_language.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/block_scheduler.h" 10 #include "vm/block_scheduler.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return builder.BuildGraph(); 103 return builder.BuildGraph();
104 } 104 }
105 105
106 virtual void FinalizeCompilation() { } 106 virtual void FinalizeCompilation() { }
107 }; 107 };
108 108
109 109
110 class IrregexpCompilationPipeline : public DefaultCompilationPipeline { 110 class IrregexpCompilationPipeline : public DefaultCompilationPipeline {
111 public: 111 public:
112 explicit IrregexpCompilationPipeline(Isolate* isolate) 112 explicit IrregexpCompilationPipeline(Isolate* isolate)
113 : macro_assembler_(NULL), 113 : graph_entry_(NULL),
114 isolate_(isolate) { } 114 isolate_(isolate) { }
115 115
116 virtual void ParseFunction(ParsedFunction* parsed_function) { 116 virtual void ParseFunction(ParsedFunction* parsed_function) {
117 RegExpParser::ParseFunction(parsed_function); 117 RegExpParser::ParseFunction(parsed_function);
118 // Variables are allocated after compilation. 118 // Variables are allocated after compilation.
119 } 119 }
120 120
121 virtual FlowGraph* BuildFlowGraph( 121 virtual FlowGraph* BuildFlowGraph(
122 ParsedFunction* parsed_function, 122 ParsedFunction* parsed_function,
123 const ZoneGrowableArray<const ICData*>& ic_data_array, 123 const ZoneGrowableArray<const ICData*>& ic_data_array,
124 intptr_t osr_id) { 124 intptr_t osr_id) {
125 // Compile to the dart IR. 125 // Compile to the dart IR.
126 RegExpEngine::CompilationResult result = 126 RegExpEngine::CompilationResult result =
127 RegExpEngine::Compile(parsed_function->regexp_compile_data(), 127 RegExpEngine::Compile(parsed_function->regexp_compile_data(),
128 parsed_function, 128 parsed_function,
129 ic_data_array); 129 ic_data_array);
130 macro_assembler_ = result.macro_assembler;
131 130
132 // Allocate variables now that we know the number of locals. 131 // Allocate variables now that we know the number of locals.
133 parsed_function->AllocateIrregexpVariables(result.num_stack_locals); 132 parsed_function->AllocateIrregexpVariables(result.num_stack_locals);
134 133
135 // Build the flow graph. 134 // Build the flow graph.
136 FlowGraphBuilder builder(parsed_function, 135 FlowGraphBuilder builder(parsed_function,
137 ic_data_array, 136 ic_data_array,
138 NULL, // NULL = not inlining. 137 NULL, // NULL = not inlining.
139 osr_id); 138 osr_id);
140 139
140 // Store the graph entry for later finalization.
141 graph_entry_ = result.graph_entry;
142
141 return new(isolate_) FlowGraph(builder, 143 return new(isolate_) FlowGraph(builder,
142 result.graph_entry, 144 result.graph_entry,
143 result.num_blocks); 145 result.num_blocks);
144 } 146 }
145 147
146 virtual void FinalizeCompilation() { 148 virtual void FinalizeCompilation() {
147 macro_assembler_->FinalizeBlockOffsetTable(); 149 IRRegExpMacroAssembler::FinalizeBlockOffsetTable(isolate_, graph_entry_);
148 } 150 }
149 151
150 private: 152 private:
151 IRRegExpMacroAssembler* macro_assembler_; 153 GraphEntryInstr* graph_entry_;
152 Isolate* isolate_; 154 Isolate* isolate_;
153 }; 155 };
154 156
155 CompilationPipeline* CompilationPipeline::New(Isolate* isolate, 157 CompilationPipeline* CompilationPipeline::New(Isolate* isolate,
156 const Function& function) { 158 const Function& function) {
157 if (function.IsIrregexpFunction()) { 159 if (function.IsIrregexpFunction()) {
158 return new(isolate) IrregexpCompilationPipeline(isolate); 160 return new(isolate) IrregexpCompilationPipeline(isolate);
159 } else { 161 } else {
160 return new(isolate) DefaultCompilationPipeline(); 162 return new(isolate) DefaultCompilationPipeline();
161 } 163 }
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1175 const Object& result = 1177 const Object& result =
1176 PassiveObject::Handle(isolate->object_store()->sticky_error()); 1178 PassiveObject::Handle(isolate->object_store()->sticky_error());
1177 isolate->object_store()->clear_sticky_error(); 1179 isolate->object_store()->clear_sticky_error();
1178 return result.raw(); 1180 return result.raw();
1179 } 1181 }
1180 UNREACHABLE(); 1182 UNREACHABLE();
1181 return Object::null(); 1183 return Object::null();
1182 } 1184 }
1183 1185
1184 } // namespace dart 1186 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/intermediate_language.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698