| 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 2783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2794 Class::ZoneHandle(Z, node->constructor().Owner()), | 2794 Class::ZoneHandle(Z, node->constructor().Owner()), |
| 2795 allocate_arguments); | 2795 allocate_arguments); |
| 2796 | 2796 |
| 2797 return Bind(allocation); | 2797 return Bind(allocation); |
| 2798 } | 2798 } |
| 2799 | 2799 |
| 2800 | 2800 |
| 2801 void EffectGraphVisitor::BuildConstructorCall( | 2801 void EffectGraphVisitor::BuildConstructorCall( |
| 2802 ConstructorCallNode* node, | 2802 ConstructorCallNode* node, |
| 2803 PushArgumentInstr* push_alloc_value) { | 2803 PushArgumentInstr* push_alloc_value) { |
| 2804 Value* ctor_arg = Bind(new(Z) ConstantInstr( | |
| 2805 Smi::ZoneHandle(Z, Smi::New(Function::kCtorPhaseAll)))); | |
| 2806 PushArgumentInstr* push_ctor_arg = PushArgument(ctor_arg); | |
| 2807 | 2804 |
| 2808 ZoneGrowableArray<PushArgumentInstr*>* arguments = | 2805 ZoneGrowableArray<PushArgumentInstr*>* arguments = |
| 2809 new(Z) ZoneGrowableArray<PushArgumentInstr*>(2); | 2806 new(Z) ZoneGrowableArray<PushArgumentInstr*>(2); |
| 2810 arguments->Add(push_alloc_value); | 2807 arguments->Add(push_alloc_value); |
| 2811 arguments->Add(push_ctor_arg); | |
| 2812 | 2808 |
| 2813 BuildPushArguments(*node->arguments(), arguments); | 2809 BuildPushArguments(*node->arguments(), arguments); |
| 2814 Do(new(Z) StaticCallInstr(node->token_pos(), | 2810 Do(new(Z) StaticCallInstr(node->token_pos(), |
| 2815 node->constructor(), | 2811 node->constructor(), |
| 2816 node->arguments()->names(), | 2812 node->arguments()->names(), |
| 2817 arguments, | 2813 arguments, |
| 2818 owner()->ic_data_array())); | 2814 owner()->ic_data_array())); |
| 2819 } | 2815 } |
| 2820 | 2816 |
| 2821 | 2817 |
| (...skipping 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4093 // create the stack check in order to allocate a deopt id. | 4089 // create the stack check in order to allocate a deopt id. |
| 4094 if (!owner()->IsInlining()) { | 4090 if (!owner()->IsInlining()) { |
| 4095 AddInstruction(check); | 4091 AddInstruction(check); |
| 4096 } | 4092 } |
| 4097 } | 4093 } |
| 4098 } | 4094 } |
| 4099 | 4095 |
| 4100 if (Isolate::Current()->flags().type_checks() && is_top_level_sequence) { | 4096 if (Isolate::Current()->flags().type_checks() && is_top_level_sequence) { |
| 4101 const int num_params = function.NumParameters(); | 4097 const int num_params = function.NumParameters(); |
| 4102 int pos = 0; | 4098 int pos = 0; |
| 4103 if (function.IsGenerativeConstructor()) { | 4099 if (function.IsFactory() || |
| 4104 // Skip type checking of receiver and phase for constructor functions. | 4100 function.IsDynamicFunction() || |
| 4105 pos = 2; | 4101 function.IsGenerativeConstructor()) { |
| 4106 } else if (function.IsFactory() || function.IsDynamicFunction()) { | |
| 4107 // Skip type checking of type arguments for factory functions. | 4102 // Skip type checking of type arguments for factory functions. |
| 4108 // Skip type checking of receiver for instance functions. | 4103 // Skip type checking of receiver for instance functions and constructors. |
| 4109 pos = 1; | 4104 pos = 1; |
| 4110 } | 4105 } |
| 4111 while (pos < num_params) { | 4106 while (pos < num_params) { |
| 4112 const LocalVariable& parameter = *scope->VariableAt(pos); | 4107 const LocalVariable& parameter = *scope->VariableAt(pos); |
| 4113 ASSERT(parameter.owner() == scope); | 4108 ASSERT(parameter.owner() == scope); |
| 4114 if (!CanSkipTypeCheck(parameter.token_pos(), | 4109 if (!CanSkipTypeCheck(parameter.token_pos(), |
| 4115 NULL, | 4110 NULL, |
| 4116 parameter.type(), | 4111 parameter.type(), |
| 4117 parameter.name())) { | 4112 parameter.name())) { |
| 4118 Value* parameter_value = Bind(BuildLoadLocal(parameter)); | 4113 Value* parameter_value = Bind(BuildLoadLocal(parameter)); |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4613 Report::MessageF(Report::kBailout, | 4608 Report::MessageF(Report::kBailout, |
| 4614 Script::Handle(function.script()), | 4609 Script::Handle(function.script()), |
| 4615 function.token_pos(), | 4610 function.token_pos(), |
| 4616 "FlowGraphBuilder Bailout: %s %s", | 4611 "FlowGraphBuilder Bailout: %s %s", |
| 4617 String::Handle(function.name()).ToCString(), | 4612 String::Handle(function.name()).ToCString(), |
| 4618 reason); | 4613 reason); |
| 4619 UNREACHABLE(); | 4614 UNREACHABLE(); |
| 4620 } | 4615 } |
| 4621 | 4616 |
| 4622 } // namespace dart | 4617 } // namespace dart |
| OLD | NEW |