| 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/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
| 9 #include "vm/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
| 10 #include "vm/locations.h" | 10 #include "vm/locations.h" |
| (...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 | 501 |
| 502 RawAbstractType* ClosureCallComp::StaticType() const { | 502 RawAbstractType* ClosureCallComp::StaticType() const { |
| 503 // The closure is the first argument to the call. | 503 // The closure is the first argument to the call. |
| 504 const AbstractType& function_type = | 504 const AbstractType& function_type = |
| 505 AbstractType::Handle(ArgumentAt(0)->StaticType()); | 505 AbstractType::Handle(ArgumentAt(0)->StaticType()); |
| 506 if (function_type.IsDynamicType() || function_type.IsFunctionInterface()) { | 506 if (function_type.IsDynamicType() || function_type.IsFunctionInterface()) { |
| 507 // The function type is not statically known or simply Function. | 507 // The function type is not statically known or simply Function. |
| 508 return Type::DynamicType(); | 508 return Type::DynamicType(); |
| 509 } | 509 } |
| 510 const Class& signature_class = Class::Handle(function_type.type_class()); | 510 const Class& signature_class = Class::Handle(function_type.type_class()); |
| 511 ASSERT(signature_class.IsSignatureClass()); | |
| 512 const Function& signature_function = | 511 const Function& signature_function = |
| 513 Function::Handle(signature_class.signature_function()); | 512 Function::Handle(signature_class.signature_function()); |
| 513 if (signature_function.IsNull()) { |
| 514 // Attempting to invoke a non-closure object. |
| 515 return Type::DynamicType(); |
| 516 } |
| 514 // TODO(regis): The result type may be generic. Consider upper bounds. | 517 // TODO(regis): The result type may be generic. Consider upper bounds. |
| 515 return signature_function.result_type(); | 518 return signature_function.result_type(); |
| 516 } | 519 } |
| 517 | 520 |
| 518 | 521 |
| 519 RawAbstractType* InstanceCallComp::StaticType() const { | 522 RawAbstractType* InstanceCallComp::StaticType() const { |
| 520 return Type::DynamicType(); | 523 return Type::DynamicType(); |
| 521 } | 524 } |
| 522 | 525 |
| 523 | 526 |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1196 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); | 1199 const ExternalLabel label(closure_function.ToCString(), stub.EntryPoint()); |
| 1197 compiler->GenerateCall(token_index(), try_index(), &label, | 1200 compiler->GenerateCall(token_index(), try_index(), &label, |
| 1198 PcDescriptors::kOther); | 1201 PcDescriptors::kOther); |
| 1199 __ Drop(2); // Discard type arguments and receiver. | 1202 __ Drop(2); // Discard type arguments and receiver. |
| 1200 } | 1203 } |
| 1201 | 1204 |
| 1202 | 1205 |
| 1203 #undef __ | 1206 #undef __ |
| 1204 | 1207 |
| 1205 } // namespace dart | 1208 } // namespace dart |
| OLD | NEW |