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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/inferrer/node_tracer.dart

Issue 250553004: Always treat [call] members as closures during tracing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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 | tests/compiler/dart2js_extra/18383_test.dart » ('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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 part of type_graph_inferrer; 5 part of type_graph_inferrer;
6 6
7 // A set of selectors we know do not escape the elements inside the 7 // A set of selectors we know do not escape the elements inside the
8 // list. 8 // list.
9 Set<String> doesNotEscapeListSet = new Set<String>.from( 9 Set<String> doesNotEscapeListSet = new Set<String>.from(
10 const <String>[ 10 const <String>[
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 if (!element.isParameter()) return false; 326 if (!element.isParameter()) return false;
327 if (element.getEnclosingClass() != compiler.backend.mapImplementation) { 327 if (element.getEnclosingClass() != compiler.backend.mapImplementation) {
328 return false; 328 return false;
329 } 329 }
330 Element method = element.enclosingElement; 330 Element method = element.enclosingElement;
331 return (method.name == '[]='); 331 return (method.name == '[]=');
332 } 332 }
333 333
334 bool isClosure(Element element) { 334 bool isClosure(Element element) {
335 if (!element.isFunction()) return false; 335 if (!element.isFunction()) return false;
336 /// Creating an instance of a class that implements [Function] also
337 /// closurizes the corresponding [call] member. We do not currently
338 /// track these, thus the check for [isClosurized] on such a method will
339 /// return false. Instead we catch that case here for now.
340 // TODO(herhut): Handle creation of closures from instances of Function.
341 if (element.isInstanceMember() &&
342 element.name == Compiler.CALL_OPERATOR_NAME) {
343 return true;
344 }
336 Element outermost = element.getOutermostEnclosingMemberOrTopLevel(); 345 Element outermost = element.getOutermostEnclosingMemberOrTopLevel();
337 return outermost.declaration != element.declaration; 346 return outermost.declaration != element.declaration;
338 } 347 }
339 348
340 void visitElementTypeInformation(ElementTypeInformation info) { 349 void visitElementTypeInformation(ElementTypeInformation info) {
341 Element element = info.element; 350 Element element = info.element;
342 if (element.isParameter() 351 if (element.isParameter()
343 && inferrer.isNativeElement(element.enclosingElement)) { 352 && inferrer.isNativeElement(element.enclosingElement)) {
344 bailout('Passed to a native method'); 353 bailout('Passed to a native method');
345 } 354 }
346 if (info.isClosurized()) { 355 if (info.isClosurized()) {
347 bailout('Returned from a closurized method'); 356 bailout('Returned from a closurized method');
348 } 357 }
349 if (isClosure(info.element)) { 358 if (isClosure(info.element)) {
350 bailout('Returned from a closure'); 359 bailout('Returned from a closure');
351 } 360 }
352 if (compiler.backend.isNeededForReflection(info.element)) { 361 if (compiler.backend.isNeededForReflection(info.element)) {
353 bailout('Escape in reflection'); 362 bailout('Escape in reflection');
354 } 363 }
355 if (isParameterOfListAddingMethod(info.element) || 364 if (isParameterOfListAddingMethod(info.element) ||
356 isParameterOfMapAddingMethod(info.element)) { 365 isParameterOfMapAddingMethod(info.element)) {
357 // These elements are being handled in 366 // These elements are being handled in
358 // [visitDynamicCallSiteTypeInformation]. 367 // [visitDynamicCallSiteTypeInformation].
359 return; 368 return;
360 } 369 }
361 addNewEscapeInformation(info); 370 addNewEscapeInformation(info);
362 } 371 }
363 } 372 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js_extra/18383_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698