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

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

Issue 1024563004: Compile implicit closures as dispatchers instead of duplicating the original method's code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: rebased Created 5 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/parser.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/cpu.h" 10 #include "vm/cpu.h"
(...skipping 6252 matching lines...) Expand 10 before | Expand all | Expand 10 after
6263 context_scope = LocalScope::CreateImplicitClosureScope(*this); 6263 context_scope = LocalScope::CreateImplicitClosureScope(*this);
6264 } 6264 }
6265 closure_function.set_context_scope(context_scope); 6265 closure_function.set_context_scope(context_scope);
6266 6266
6267 // Set closure function's result type to this result type. 6267 // Set closure function's result type to this result type.
6268 closure_function.set_result_type(AbstractType::Handle(result_type())); 6268 closure_function.set_result_type(AbstractType::Handle(result_type()));
6269 6269
6270 // Set closure function's end token to this end token. 6270 // Set closure function's end token to this end token.
6271 closure_function.set_end_token_pos(end_token_pos()); 6271 closure_function.set_end_token_pos(end_token_pos());
6272 6272
6273 // The closurized method stub just calls into the original method and should
6274 // therefore be skipped by the debugger and in stack traces.
6275 closure_function.set_is_debuggable(false);
6276 closure_function.set_is_visible(false);
6277
6273 // Set closure function's formal parameters to this formal parameters, 6278 // Set closure function's formal parameters to this formal parameters,
6274 // removing the receiver if this is an instance method and adding the closure 6279 // removing the receiver if this is an instance method and adding the closure
6275 // object as first parameter. 6280 // object as first parameter.
6276 const int kClosure = 1; 6281 const int kClosure = 1;
6277 const int has_receiver = is_static() ? 0 : 1; 6282 const int has_receiver = is_static() ? 0 : 1;
6278 const int num_fixed_params = kClosure - has_receiver + num_fixed_parameters(); 6283 const int num_fixed_params = kClosure - has_receiver + num_fixed_parameters();
6279 const int num_opt_params = NumOptionalParameters(); 6284 const int num_opt_params = NumOptionalParameters();
6280 const bool has_opt_pos_params = HasOptionalPositionalParameters(); 6285 const bool has_opt_pos_params = HasOptionalPositionalParameters();
6281 const int num_params = num_fixed_params + num_opt_params; 6286 const int num_params = num_fixed_params + num_opt_params;
6282 closure_function.set_num_fixed_parameters(num_fixed_params); 6287 closure_function.set_num_fixed_parameters(num_fixed_params);
(...skipping 14442 matching lines...) Expand 10 before | Expand all | Expand 10 after
20725 return tag_label.ToCString(); 20730 return tag_label.ToCString();
20726 } 20731 }
20727 20732
20728 20733
20729 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20734 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20730 Instance::PrintJSONImpl(stream, ref); 20735 Instance::PrintJSONImpl(stream, ref);
20731 } 20736 }
20732 20737
20733 20738
20734 } // namespace dart 20739 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698