| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/code_generator.h" | 5 #include "vm/code_generator.h" |
| 6 | 6 |
| 7 #include "vm/code_index_table.h" | 7 #include "vm/code_index_table.h" |
| 8 #include "vm/code_patcher.h" | 8 #include "vm/code_patcher.h" |
| 9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
| 10 #include "vm/dart_api_impl.h" | 10 #include "vm/dart_api_impl.h" |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 // we are trying to create an implicit closure of an instance function. | 542 // we are trying to create an implicit closure of an instance function. |
| 543 arguments.SetReturn(closure); | 543 arguments.SetReturn(closure); |
| 544 return; | 544 return; |
| 545 } | 545 } |
| 546 Function& implicit_closure_function = | 546 Function& implicit_closure_function = |
| 547 Function::Handle(function.ImplicitClosureFunction()); | 547 Function::Handle(function.ImplicitClosureFunction()); |
| 548 // Create a closure object for the implicit closure function. | 548 // Create a closure object for the implicit closure function. |
| 549 const Context& context = Context::Handle(Context::New(1)); | 549 const Context& context = Context::Handle(Context::New(1)); |
| 550 context.SetAt(0, receiver); | 550 context.SetAt(0, receiver); |
| 551 closure = Closure::New(implicit_closure_function, context); | 551 closure = Closure::New(implicit_closure_function, context); |
| 552 if (receiver_class.HasTypeArguments()) { |
| 553 const TypeArguments& type_arguments = |
| 554 TypeArguments::Handle(receiver.GetTypeArguments()); |
| 555 closure.SetTypeArguments(type_arguments); |
| 556 } |
| 552 arguments.SetReturn(closure); | 557 arguments.SetReturn(closure); |
| 553 } | 558 } |
| 554 | 559 |
| 555 | 560 |
| 556 // Resolve an implicit closure by invoking getter and checking if the return | 561 // Resolve an implicit closure by invoking getter and checking if the return |
| 557 // value from getter is a closure. | 562 // value from getter is a closure. |
| 558 // Arg0: receiver object. | 563 // Arg0: receiver object. |
| 559 // Arg1: ic-data array. | 564 // Arg1: ic-data array. |
| 560 // Returns: Closure object or NULL (closure not found). | 565 // Returns: Closure object or NULL (closure not found). |
| 561 // This is called by the megamorphic stub when it is unable to resolve an | 566 // This is called by the megamorphic stub when it is unable to resolve an |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 } | 948 } |
| 944 } | 949 } |
| 945 } | 950 } |
| 946 // The cache is null terminated, therefore the loop above should never | 951 // The cache is null terminated, therefore the loop above should never |
| 947 // terminate by itself. | 952 // terminate by itself. |
| 948 UNREACHABLE(); | 953 UNREACHABLE(); |
| 949 return Code::null(); | 954 return Code::null(); |
| 950 } | 955 } |
| 951 | 956 |
| 952 } // namespace dart | 957 } // namespace dart |
| OLD | NEW |