OLD | NEW |
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 #ifndef VM_FLOW_GRAPH_BUILDER_H_ | 5 #ifndef VM_FLOW_GRAPH_BUILDER_H_ |
6 #define VM_FLOW_GRAPH_BUILDER_H_ | 6 #define VM_FLOW_GRAPH_BUILDER_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 V(_Uint16ArrayFactory, kTypedDataUint16ArrayCid, 480982704) \ | 42 V(_Uint16ArrayFactory, kTypedDataUint16ArrayCid, 480982704) \ |
43 V(_Int32ArrayFactory, kTypedDataInt32ArrayCid, 1876611964) \ | 43 V(_Int32ArrayFactory, kTypedDataInt32ArrayCid, 1876611964) \ |
44 V(_Uint32ArrayFactory, kTypedDataUint32ArrayCid, 1811693442) \ | 44 V(_Uint32ArrayFactory, kTypedDataUint32ArrayCid, 1811693442) \ |
45 V(_Int64ArrayFactory, kTypedDataInt64ArrayCid, 958749261) \ | 45 V(_Int64ArrayFactory, kTypedDataInt64ArrayCid, 958749261) \ |
46 V(_Uint64ArrayFactory, kTypedDataUint64ArrayCid, 767338823) \ | 46 V(_Uint64ArrayFactory, kTypedDataUint64ArrayCid, 767338823) \ |
47 V(_Float64ArrayFactory, kTypedDataFloat64ArrayCid, 1599078532) \ | 47 V(_Float64ArrayFactory, kTypedDataFloat64ArrayCid, 1599078532) \ |
48 V(_Float32ArrayFactory, kTypedDataFloat32ArrayCid, 1721244151) \ | 48 V(_Float32ArrayFactory, kTypedDataFloat32ArrayCid, 1721244151) \ |
49 V(_Float32x4ArrayFactory, kTypedDataFloat32x4ArrayCid, 879975401) \ | 49 V(_Float32x4ArrayFactory, kTypedDataFloat32x4ArrayCid, 879975401) \ |
50 | 50 |
51 | 51 |
| 52 // Class that recognizes factories and returns corresponding result cid. |
| 53 class FactoryRecognizer : public AllStatic { |
| 54 public: |
| 55 // Return kDynamicCid if factory is not recognized. |
| 56 static intptr_t ResultCid(const Function& factory) { |
| 57 ASSERT(factory.IsFactory()); |
| 58 const Class& function_class = Class::Handle(factory.Owner()); |
| 59 const Library& lib = Library::Handle(function_class.library()); |
| 60 ASSERT((lib.raw() == Library::CoreLibrary()) || |
| 61 (lib.raw() == Library::TypedDataLibrary())); |
| 62 const String& factory_name = String::Handle(factory.name()); |
| 63 #define RECOGNIZE_FACTORY(test_factory_symbol, cid, fp) \ |
| 64 if (String::EqualsIgnoringPrivateKey( \ |
| 65 factory_name, Symbols::test_factory_symbol())) { \ |
| 66 ASSERT(factory.CheckSourceFingerprint(fp)); \ |
| 67 return cid; \ |
| 68 } \ |
| 69 |
| 70 RECOGNIZED_LIST_FACTORY_LIST(RECOGNIZE_FACTORY); |
| 71 #undef RECOGNIZE_FACTORY |
| 72 |
| 73 return kDynamicCid; |
| 74 } |
| 75 }; |
| 76 |
| 77 |
52 // A class to collect the exits from an inlined function during graph | 78 // A class to collect the exits from an inlined function during graph |
53 // construction so they can be plugged into the caller's flow graph. | 79 // construction so they can be plugged into the caller's flow graph. |
54 class InlineExitCollector: public ZoneAllocated { | 80 class InlineExitCollector: public ZoneAllocated { |
55 public: | 81 public: |
56 InlineExitCollector(FlowGraph* caller_graph, Definition* call) | 82 InlineExitCollector(FlowGraph* caller_graph, Definition* call) |
57 : caller_graph_(caller_graph), call_(call), exits_(4) { } | 83 : caller_graph_(caller_graph), call_(call), exits_(4) { } |
58 | 84 |
59 void AddExit(ReturnInstr* exit); | 85 void AddExit(ReturnInstr* exit); |
60 | 86 |
61 void Union(const InlineExitCollector* other); | 87 void Union(const InlineExitCollector* other); |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 // Output parameters. | 568 // Output parameters. |
543 GrowableArray<TargetEntryInstr**> true_successor_addresses_; | 569 GrowableArray<TargetEntryInstr**> true_successor_addresses_; |
544 GrowableArray<TargetEntryInstr**> false_successor_addresses_; | 570 GrowableArray<TargetEntryInstr**> false_successor_addresses_; |
545 | 571 |
546 intptr_t condition_token_pos_; | 572 intptr_t condition_token_pos_; |
547 }; | 573 }; |
548 | 574 |
549 } // namespace dart | 575 } // namespace dart |
550 | 576 |
551 #endif // VM_FLOW_GRAPH_BUILDER_H_ | 577 #endif // VM_FLOW_GRAPH_BUILDER_H_ |
OLD | NEW |