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

Side by Side Diff: runtime/vm/intermediate_language.h

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 | « runtime/vm/compiler.cc ('k') | runtime/vm/intermediate_language.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 #ifndef VM_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 1314 matching lines...) Expand 10 before | Expand all | Expand 10 after
1325 } 1325 }
1326 1326
1327 const GrowableArray<CatchBlockEntryInstr*>& catch_entries() const { 1327 const GrowableArray<CatchBlockEntryInstr*>& catch_entries() const {
1328 return catch_entries_; 1328 return catch_entries_;
1329 } 1329 }
1330 1330
1331 const GrowableArray<IndirectEntryInstr*>& indirect_entries() const { 1331 const GrowableArray<IndirectEntryInstr*>& indirect_entries() const {
1332 return indirect_entries_; 1332 return indirect_entries_;
1333 } 1333 }
1334 1334
1335 void set_indirect_entry_offsets(GrowableObjectArray* offsets) {
1336 ASSERT(offsets != NULL);
1337 ASSERT(indirect_entry_offsets_ == NULL);
1338 indirect_entry_offsets_ = offsets;
1339 }
1340
1341 GrowableObjectArray* indirect_entry_offsets() const {
1342 ASSERT(indirect_entry_offsets_ != NULL);
1343 return indirect_entry_offsets_;
1344 }
1345
1335 virtual void PrintTo(BufferFormatter* f) const; 1346 virtual void PrintTo(BufferFormatter* f) const;
1336 1347
1337 private: 1348 private:
1338 virtual void ClearPredecessors() {} 1349 virtual void ClearPredecessors() {}
1339 virtual void AddPredecessor(BlockEntryInstr* predecessor) { UNREACHABLE(); } 1350 virtual void AddPredecessor(BlockEntryInstr* predecessor) { UNREACHABLE(); }
1340 1351
1341 const ParsedFunction* parsed_function_; 1352 const ParsedFunction* parsed_function_;
1342 TargetEntryInstr* normal_entry_; 1353 TargetEntryInstr* normal_entry_;
1343 GrowableArray<CatchBlockEntryInstr*> catch_entries_; 1354 GrowableArray<CatchBlockEntryInstr*> catch_entries_;
1344 // Indirect targets are blocks reachable only through indirect gotos. 1355 // Indirect targets are blocks reachable only through indirect gotos.
1345 GrowableArray<IndirectEntryInstr*> indirect_entries_; 1356 GrowableArray<IndirectEntryInstr*> indirect_entries_;
1357 GrowableObjectArray* indirect_entry_offsets_;
1346 GrowableArray<Definition*> initial_definitions_; 1358 GrowableArray<Definition*> initial_definitions_;
1347 const intptr_t osr_id_; 1359 const intptr_t osr_id_;
1348 intptr_t entry_count_; 1360 intptr_t entry_count_;
1349 intptr_t spill_slot_count_; 1361 intptr_t spill_slot_count_;
1350 intptr_t fixed_slot_count_; // For try-catch in optimized code. 1362 intptr_t fixed_slot_count_; // For try-catch in optimized code.
1351 1363
1352 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr); 1364 DISALLOW_COPY_AND_ASSIGN(GraphEntryInstr);
1353 }; 1365 };
1354 1366
1355 1367
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
2184 }; 2196 };
2185 2197
2186 2198
2187 // IndirectGotoInstr represents a dynamically computed jump. Only 2199 // IndirectGotoInstr represents a dynamically computed jump. Only
2188 // IndirectEntryInstr targets are valid targets of an indirect goto. The 2200 // IndirectEntryInstr targets are valid targets of an indirect goto. The
2189 // concrete target to jump to is given as a parameter to the indirect goto. 2201 // concrete target to jump to is given as a parameter to the indirect goto.
2190 // 2202 //
2191 // In order to preserve split-edge form, an indirect goto does not itself point 2203 // In order to preserve split-edge form, an indirect goto does not itself point
2192 // to its targets. Instead, for each possible target, the successors_ field 2204 // to its targets. Instead, for each possible target, the successors_ field
2193 // will contain an ordinary goto instruction that jumps to the target. 2205 // will contain an ordinary goto instruction that jumps to the target.
2194 //
2195 // Byte offsets of all possible targets are stored in the offsets_ array. The
2196 // desired offset is looked up while the generated code is executing, and passed
2197 // to IndirectGoto as an input.
2198 class IndirectGotoInstr : public TemplateInstruction<1, NoThrow> { 2206 class IndirectGotoInstr : public TemplateInstruction<1, NoThrow> {
2199 public: 2207 public:
2200 IndirectGotoInstr(GrowableObjectArray* offsets, 2208 explicit IndirectGotoInstr(Value* offset_from_start) {
2201 Value* offset_from_start)
2202 : offsets_(*offsets) {
2203 SetInputAt(0, offset_from_start); 2209 SetInputAt(0, offset_from_start);
2204 } 2210 }
2205 2211
2206 DECLARE_INSTRUCTION(IndirectGoto) 2212 DECLARE_INSTRUCTION(IndirectGoto)
2207 2213
2208 virtual intptr_t ArgumentCount() const { return 0; } 2214 virtual intptr_t ArgumentCount() const { return 0; }
2209 2215
2210 void AddSuccessor(TargetEntryInstr* successor) { 2216 void AddSuccessor(TargetEntryInstr* successor) {
2211 ASSERT(successor->next()->IsGoto()); 2217 ASSERT(successor->next()->IsGoto());
2212 ASSERT(successor->next()->AsGoto()->successor()->IsIndirectEntry()); 2218 ASSERT(successor->next()->AsGoto()->successor()->IsIndirectEntry());
2213 successors_.Add(successor); 2219 successors_.Add(successor);
2214 } 2220 }
2215 2221
2216 virtual intptr_t SuccessorCount() const { return successors_.length(); } 2222 virtual intptr_t SuccessorCount() const { return successors_.length(); }
2217 virtual TargetEntryInstr* SuccessorAt(intptr_t index) const { 2223 virtual TargetEntryInstr* SuccessorAt(intptr_t index) const {
2218 ASSERT(index < SuccessorCount()); 2224 ASSERT(index < SuccessorCount());
2219 return successors_[index]; 2225 return successors_[index];
2220 } 2226 }
2221 2227
2222 virtual bool CanDeoptimize() const { return false; } 2228 virtual bool CanDeoptimize() const { return false; }
2223 virtual bool CanBecomeDeoptimizationTarget() const { return false; } 2229 virtual bool CanBecomeDeoptimizationTarget() const { return false; }
2224 2230
2225 virtual EffectSet Effects() const { return EffectSet::None(); } 2231 virtual EffectSet Effects() const { return EffectSet::None(); }
2226 2232
2227 virtual void PrintTo(BufferFormatter* f) const; 2233 virtual void PrintTo(BufferFormatter* f) const;
2228 2234
2229 const GrowableObjectArray& offsets() const { return offsets_; }
2230 void SetOffsetCount(Isolate* isolate, intptr_t count) {
2231 if (offsets_.Capacity() < count) {
2232 offsets_.Grow(count, Heap::kOld);
2233 }
2234 if (offsets_.Length() < count) {
2235 offsets_.SetLength(count);
2236 }
2237 }
2238 void SetOffsetAt(Isolate* isolate, intptr_t index, intptr_t offset) {
2239 offsets_.SetAt(index, Smi::ZoneHandle(isolate, Smi::New(offset)));
2240 }
2241
2242 private: 2235 private:
2243 GrowableArray<TargetEntryInstr*> successors_; 2236 GrowableArray<TargetEntryInstr*> successors_;
2244 GrowableObjectArray& offsets_;
2245 }; 2237 };
2246 2238
2247 2239
2248 class ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> { 2240 class ComparisonInstr : public TemplateDefinition<2, NoThrow, Pure> {
2249 public: 2241 public:
2250 Value* left() const { return inputs_[0]; } 2242 Value* left() const { return inputs_[0]; }
2251 Value* right() const { return inputs_[1]; } 2243 Value* right() const { return inputs_[1]; }
2252 2244
2253 virtual intptr_t token_pos() const { return token_pos_; } 2245 virtual intptr_t token_pos() const { return token_pos_; }
2254 Token::Kind kind() const { return kind_; } 2246 Token::Kind kind() const { return kind_; }
(...skipping 5727 matching lines...) Expand 10 before | Expand all | Expand 10 after
7982 Isolate* isolate, bool opt) const { \ 7974 Isolate* isolate, bool opt) const { \
7983 UNIMPLEMENTED(); \ 7975 UNIMPLEMENTED(); \
7984 return NULL; \ 7976 return NULL; \
7985 } \ 7977 } \
7986 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } 7978 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); }
7987 7979
7988 7980
7989 } // namespace dart 7981 } // namespace dart
7990 7982
7991 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 7983 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/intermediate_language.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698