Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: runtime/vm/object.cc

Issue 2989563002: Preserve type variables in closure conversion. (Closed)
Patch Set: Update binary.md. Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/become.h" 10 #include "vm/become.h"
(...skipping 6860 matching lines...) Expand 10 before | Expand all | Expand 10 after
6871 // return (#contextParameter[1]).+( 6871 // return (#contextParameter[1]).+(
6872 // let final dynamic #t1 = #contextParameter[2] in 6872 // let final dynamic #t1 = #contextParameter[2] in
6873 // let final dynamic #t2 = #contextParameter[2] = #t1.+(1) in 6873 // let final dynamic #t2 = #contextParameter[2] = #t1.+(1) in
6874 // #t1 6874 // #t1
6875 // ); 6875 // );
6876 // } 6876 // }
6877 // 6877 //
6878 // Converted closure functions are used in VM Closure instances that represent 6878 // Converted closure functions are used in VM Closure instances that represent
6879 // the results of evaluation of [MakeClosure] primitive operations. 6879 // the results of evaluation of [MakeClosure] primitive operations.
6880 // 6880 //
6881 // Internally, converted closure functins are represented with the same Closure 6881 // Internally, converted closure functions are represented with the same Closure
6882 // class as implicit closure functions (that are used for dealing with 6882 // class as implicit closure functions (that are used for dealing with
6883 // tear-offs). The Closure class instances have two fields, one for the 6883 // tear-offs). The Closure class instances have two fields, one for the
6884 // function, and one for the captured context. Implicit closure functions have 6884 // function, and one for the captured context. Implicit closure functions have
6885 // pre-defined shape of the context: it's a single variable that is used as 6885 // pre-defined shape of the context: it's a single variable that is used as
6886 // 'this'. Converted closure functions use the context field to store the 6886 // 'this'. Converted closure functions use the context field to store the
6887 // vector of captured variables that will be supplied as the first argument 6887 // vector of captured variables that will be supplied as the first argument
6888 // during invocation. 6888 // during invocation.
6889 // 6889 //
6890 // The top-level functions used in converted closure functions are generated 6890 // The top-level functions used in converted closure functions are generated
6891 // during a front-end transformation in Kernel. Those functions have some 6891 // during a front-end transformation in Kernel. Those functions have some
6892 // common properties: 6892 // common properties:
6893 // * they expect the captured context to be passed as the first argument, 6893 // * they expect the captured context to be passed as the first argument,
6894 // * the first argument should be of [Vector] type (index-based storage), 6894 // * the first argument should be of [Vector] type (index-based storage),
6895 // * they retrieve the captured variables from [Vector] explicitly, so they 6895 // * they retrieve the captured variables from [Vector] explicitly, so they
6896 // don't need the variables from the context to be put into their current 6896 // don't need the variables from the context to be put into their current
6897 // scope. 6897 // scope.
6898 // 6898 //
6899 // During closure-conversion pass in Kernel, the contexts are generated 6899 // During closure-conversion pass in Kernel, the contexts are generated
6900 // explicitly and are represented as [Vector]s. Then they are paired together 6900 // explicitly and are represented as [Vector]s. Then they are paired together
6901 // with the top-level functions to form a closure. When the closure, created 6901 // with the top-level functions to form a closure. When the closure, created
6902 // this way, is invoked, it should receive the [Vector] as the first argument, 6902 // this way, is invoked, it should receive the [Vector] as the first argument,
6903 // and take the rest of the arguments from the invocation. 6903 // and take the rest of the arguments from the invocation.
6904 // 6904 //
6905 // Converted cosure functions in VM follow same discipline as implicit closure 6905 // Converted closure functions in VM follow same discipline as implicit closure
6906 // functions, because they are similar in many ways. For further deatils, please 6906 // functions, because they are similar in many ways. For further deatils, please
6907 // refer to the following methods: 6907 // refer to the following methods:
6908 // -> Function::ConvertedClosureFunction 6908 // -> Function::ConvertedClosureFunction
6909 // -> StreamingFlowGraphBuilder::BuildGraphOfConvertedClosureFunction 6909 // -> StreamingFlowGraphBuilder::BuildGraphOfConvertedClosureFunction
6910 // -> StreamingFlowGraphBuilder::BuildGraph (small change that calls 6910 // -> StreamingFlowGraphBuilder::BuildGraph (small change that calls
6911 // BuildGraphOfConvertedClosureFunction) 6911 // BuildGraphOfConvertedClosureFunction)
6912 // -> StreamingFlowGraphBuilder::BuildClosureCreation (converted closure 6912 // -> StreamingFlowGraphBuilder::BuildClosureCreation (converted closure
6913 // functions are created here) 6913 // functions are created here)
6914 // 6914 //
6915 // Function::ConvertedClosureFunction method follows the logic of 6915 // Function::ConvertedClosureFunction method follows the logic of
(...skipping 15608 matching lines...) Expand 10 before | Expand all | Expand 10 after
22524 } 22524 }
22525 return UserTag::null(); 22525 return UserTag::null();
22526 } 22526 }
22527 22527
22528 const char* UserTag::ToCString() const { 22528 const char* UserTag::ToCString() const {
22529 const String& tag_label = String::Handle(label()); 22529 const String& tag_label = String::Handle(label());
22530 return tag_label.ToCString(); 22530 return tag_label.ToCString();
22531 } 22531 }
22532 22532
22533 } // namespace dart 22533 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698