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 #include "vm/flow_graph_builder.h" | 5 #include "vm/flow_graph_builder.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/ast_printer.h" | 8 #include "vm/ast_printer.h" |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 intptr_t len = sizeof(kCommonDoubleConstants) / sizeof(double); // NOLINT | 69 intptr_t len = sizeof(kCommonDoubleConstants) / sizeof(double); // NOLINT |
70 for (intptr_t i = 0; i < len; i++) { | 70 for (intptr_t i = 0; i < len; i++) { |
71 if (Utils::DoublesBitEqual(value, kCommonDoubleConstants[i])) { | 71 if (Utils::DoublesBitEqual(value, kCommonDoubleConstants[i])) { |
72 return reinterpret_cast<uword>(&kCommonDoubleConstants[i]); | 72 return reinterpret_cast<uword>(&kCommonDoubleConstants[i]); |
73 } | 73 } |
74 } | 74 } |
75 return 0; | 75 return 0; |
76 } | 76 } |
77 | 77 |
78 | 78 |
79 #define RECOGNIZE_FACTORY(test_factory_symbol, cid, fp) \ | 79 #define RECOGNIZE_FACTORY(symbol, class_name, constructor_name, cid, fp) \ |
80 {Symbols::k##test_factory_symbol##Id, cid, fp, \ | 80 {Symbols::k##symbol##Id, cid, fp, #symbol ", " #cid}, // NOLINT |
81 #test_factory_symbol ", " #cid}, // NOLINT | |
82 | 81 |
83 static struct { | 82 static struct { |
84 intptr_t symbold_id; | 83 intptr_t symbol_id; |
85 intptr_t cid; | 84 intptr_t cid; |
86 intptr_t finger_print; | 85 intptr_t finger_print; |
87 const char* name; | 86 const char* name; |
88 } factory_recognizer_list[] = {RECOGNIZED_LIST_FACTORY_LIST(RECOGNIZE_FACTORY){ | 87 } factory_recognizer_list[] = {RECOGNIZED_LIST_FACTORY_LIST(RECOGNIZE_FACTORY){ |
89 Symbols::kIllegal, -1, -1, NULL}}; | 88 Symbols::kIllegal, -1, -1, NULL}}; |
90 | 89 |
91 #undef RECOGNIZE_FACTORY | 90 #undef RECOGNIZE_FACTORY |
92 | 91 |
93 intptr_t FactoryRecognizer::ResultCid(const Function& factory) { | 92 intptr_t FactoryRecognizer::ResultCid(const Function& factory) { |
94 ASSERT(factory.IsFactory()); | 93 ASSERT(factory.IsFactory()); |
95 const Class& function_class = Class::Handle(factory.Owner()); | 94 const Class& function_class = Class::Handle(factory.Owner()); |
96 const Library& lib = Library::Handle(function_class.library()); | 95 const Library& lib = Library::Handle(function_class.library()); |
97 ASSERT((lib.raw() == Library::CoreLibrary()) || | 96 ASSERT((lib.raw() == Library::CoreLibrary()) || |
98 (lib.raw() == Library::TypedDataLibrary())); | 97 (lib.raw() == Library::TypedDataLibrary())); |
99 const String& factory_name = String::Handle(factory.name()); | 98 const String& factory_name = String::Handle(factory.name()); |
100 for (intptr_t i = 0; | 99 for (intptr_t i = 0; |
101 factory_recognizer_list[i].symbold_id != Symbols::kIllegal; i++) { | 100 factory_recognizer_list[i].symbol_id != Symbols::kIllegal; i++) { |
102 if (String::EqualsIgnoringPrivateKey( | 101 if (String::EqualsIgnoringPrivateKey( |
103 factory_name, | 102 factory_name, |
104 Symbols::Symbol(factory_recognizer_list[i].symbold_id))) { | 103 Symbols::Symbol(factory_recognizer_list[i].symbol_id))) { |
105 return factory_recognizer_list[i].cid; | 104 return factory_recognizer_list[i].cid; |
106 } | 105 } |
107 } | 106 } |
108 return kDynamicCid; | 107 return kDynamicCid; |
109 } | 108 } |
110 | 109 |
111 | 110 |
112 // Base class for a stack of enclosing statements of interest (e.g., | 111 // Base class for a stack of enclosing statements of interest (e.g., |
113 // blocks (breakable) and loops (continuable)). | 112 // blocks (breakable) and loops (continuable)). |
114 class NestedStatement : public ValueObject { | 113 class NestedStatement : public ValueObject { |
(...skipping 4234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4349 graph_entry_->PruneUnreachable(graph_entry_, NULL, osr_id_, block_marks); | 4348 graph_entry_->PruneUnreachable(graph_entry_, NULL, osr_id_, block_marks); |
4350 ASSERT(found); | 4349 ASSERT(found); |
4351 } | 4350 } |
4352 | 4351 |
4353 | 4352 |
4354 void FlowGraphBuilder::Bailout(const char* reason) const { | 4353 void FlowGraphBuilder::Bailout(const char* reason) const { |
4355 parsed_function_.Bailout("FlowGraphBuilder", reason); | 4354 parsed_function_.Bailout("FlowGraphBuilder", reason); |
4356 } | 4355 } |
4357 | 4356 |
4358 } // namespace dart | 4357 } // namespace dart |
OLD | NEW |