Chromium Code Reviews| 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/class_finalizer.h" | 10 #include "vm/class_finalizer.h" |
| (...skipping 2155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2166 ReturnValue(result_value); | 2166 ReturnValue(result_value); |
| 2167 } | 2167 } |
| 2168 } | 2168 } |
| 2169 | 2169 |
| 2170 | 2170 |
| 2171 void EffectGraphVisitor::VisitArrayNode(ArrayNode* node) { | 2171 void EffectGraphVisitor::VisitArrayNode(ArrayNode* node) { |
| 2172 const AbstractTypeArguments& type_args = | 2172 const AbstractTypeArguments& type_args = |
| 2173 AbstractTypeArguments::ZoneHandle(node->type().arguments()); | 2173 AbstractTypeArguments::ZoneHandle(node->type().arguments()); |
| 2174 Value* element_type = BuildInstantiatedTypeArguments(node->token_pos(), | 2174 Value* element_type = BuildInstantiatedTypeArguments(node->token_pos(), |
| 2175 type_args); | 2175 type_args); |
| 2176 Value* num_elements = | |
| 2177 Bind(new ConstantInstr(Smi::ZoneHandle(Smi::New(node->length())))); | |
|
srdjan
2014/01/30 17:55:23
Indent 4 spaces
Florian Schneider
2014/01/31 12:43:34
Done.
| |
| 2176 CreateArrayInstr* create = new CreateArrayInstr(node->token_pos(), | 2178 CreateArrayInstr* create = new CreateArrayInstr(node->token_pos(), |
| 2177 node->length(), | 2179 element_type, |
| 2178 node->type(), | 2180 num_elements); |
| 2179 element_type); | |
| 2180 Value* array_val = Bind(create); | 2181 Value* array_val = Bind(create); |
| 2181 | 2182 |
| 2182 { LocalVariable* tmp_var = EnterTempLocalScope(array_val); | 2183 { LocalVariable* tmp_var = EnterTempLocalScope(array_val); |
| 2183 const intptr_t class_id = create->Type()->ToCid(); | 2184 const intptr_t class_id = kArrayCid; |
| 2184 const intptr_t deopt_id = Isolate::kNoDeoptId; | 2185 const intptr_t deopt_id = Isolate::kNoDeoptId; |
| 2185 for (int i = 0; i < node->length(); ++i) { | 2186 for (int i = 0; i < node->length(); ++i) { |
| 2186 Value* array = Bind(new LoadLocalInstr(*tmp_var)); | 2187 Value* array = Bind(new LoadLocalInstr(*tmp_var)); |
| 2187 Value* index = Bind(new ConstantInstr(Smi::ZoneHandle(Smi::New(i)))); | 2188 Value* index = Bind(new ConstantInstr(Smi::ZoneHandle(Smi::New(i)))); |
| 2188 ValueGraphVisitor for_value(owner()); | 2189 ValueGraphVisitor for_value(owner()); |
| 2189 node->ElementAt(i)->Visit(&for_value); | 2190 node->ElementAt(i)->Visit(&for_value); |
| 2190 Append(for_value); | 2191 Append(for_value); |
| 2191 // No store barrier needed for constants. | 2192 // No store barrier needed for constants. |
| 2192 const StoreBarrierType emit_store_barrier = | 2193 const StoreBarrierType emit_store_barrier = |
| 2193 for_value.value()->BindsToConstant() | 2194 for_value.value()->BindsToConstant() |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2546 | 2547 |
| 2547 BuildPushArguments(*node->arguments(), arguments); | 2548 BuildPushArguments(*node->arguments(), arguments); |
| 2548 Do(new StaticCallInstr(node->token_pos(), | 2549 Do(new StaticCallInstr(node->token_pos(), |
| 2549 node->constructor(), | 2550 node->constructor(), |
| 2550 node->arguments()->names(), | 2551 node->arguments()->names(), |
| 2551 arguments, | 2552 arguments, |
| 2552 owner()->ic_data_array())); | 2553 owner()->ic_data_array())); |
| 2553 } | 2554 } |
| 2554 | 2555 |
| 2555 | 2556 |
| 2556 // Class that recognizes factories and returns corresponding result cid. | |
| 2557 class FactoryRecognizer : public AllStatic { | |
| 2558 public: | |
| 2559 // Return kDynamicCid if factory is not recognized. | |
| 2560 static intptr_t ResultCid(const Function& factory) { | |
| 2561 ASSERT(factory.IsFactory()); | |
| 2562 const Class& function_class = Class::Handle(factory.Owner()); | |
| 2563 const Library& lib = Library::Handle(function_class.library()); | |
| 2564 ASSERT((lib.raw() == Library::CoreLibrary()) || | |
| 2565 (lib.raw() == Library::TypedDataLibrary())); | |
| 2566 const String& factory_name = String::Handle(factory.name()); | |
| 2567 #define RECOGNIZE_FACTORY(test_factory_symbol, cid, fp) \ | |
| 2568 if (String::EqualsIgnoringPrivateKey( \ | |
| 2569 factory_name, Symbols::test_factory_symbol())) { \ | |
| 2570 ASSERT(factory.CheckSourceFingerprint(fp)); \ | |
| 2571 return cid; \ | |
| 2572 } \ | |
| 2573 | |
| 2574 RECOGNIZED_LIST_FACTORY_LIST(RECOGNIZE_FACTORY); | |
| 2575 #undef RECOGNIZE_FACTORY | |
| 2576 | |
| 2577 return kDynamicCid; | |
| 2578 } | |
| 2579 }; | |
| 2580 | |
| 2581 | |
| 2582 static intptr_t GetResultCidOfListFactory(ConstructorCallNode* node) { | 2557 static intptr_t GetResultCidOfListFactory(ConstructorCallNode* node) { |
| 2583 const Function& function = node->constructor(); | 2558 const Function& function = node->constructor(); |
| 2584 const Class& function_class = Class::Handle(function.Owner()); | 2559 const Class& function_class = Class::Handle(function.Owner()); |
| 2585 | 2560 |
| 2586 if ((function_class.library() != Library::CoreLibrary()) && | 2561 if ((function_class.library() != Library::CoreLibrary()) && |
| 2587 (function_class.library() != Library::TypedDataLibrary())) { | 2562 (function_class.library() != Library::TypedDataLibrary())) { |
| 2588 return kDynamicCid; | 2563 return kDynamicCid; |
| 2589 } | 2564 } |
| 2590 | 2565 |
| 2591 if (node->constructor().IsFactory()) { | 2566 if (node->constructor().IsFactory()) { |
| (...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4055 LanguageError::kError, | 4030 LanguageError::kError, |
| 4056 Heap::kNew, | 4031 Heap::kNew, |
| 4057 "FlowGraphBuilder Bailout: %s %s", | 4032 "FlowGraphBuilder Bailout: %s %s", |
| 4058 String::Handle(function.name()).ToCString(), | 4033 String::Handle(function.name()).ToCString(), |
| 4059 reason)); | 4034 reason)); |
| 4060 Isolate::Current()->long_jump_base()->Jump(1, error); | 4035 Isolate::Current()->long_jump_base()->Jump(1, error); |
| 4061 } | 4036 } |
| 4062 | 4037 |
| 4063 | 4038 |
| 4064 } // namespace dart | 4039 } // namespace dart |
| OLD | NEW |