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

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

Issue 247863005: Revert "Insert checks before deferred calls and accesses." (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 | sdk/lib/_internal/compiler/implementation/deferred_load.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) 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 part of dart2js; 5 part of dart2js;
6 6
7 /// A [ConstantEnvironment] provides access for constants compiled for variable 7 /// A [ConstantEnvironment] provides access for constants compiled for variable
8 /// initializers. 8 /// initializers.
9 abstract class ConstantEnvironment { 9 abstract class ConstantEnvironment {
10 /// Returns the constant for the initializer of [element]. 10 /// Returns the constant for the initializer of [element].
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 Constant makeTypeConstant(TypeDeclarationElement element) { 410 Constant makeTypeConstant(TypeDeclarationElement element) {
411 DartType elementType = element.rawType; 411 DartType elementType = element.rawType;
412 DartType constantType = 412 DartType constantType =
413 compiler.backend.typeImplementation.computeType(compiler); 413 compiler.backend.typeImplementation.computeType(compiler);
414 return new TypeConstant(elementType, constantType); 414 return new TypeConstant(elementType, constantType);
415 } 415 }
416 416
417 /// Returns true if the prefix of the send resolves to a deferred import 417 /// Returns true if the prefix of the send resolves to a deferred import
418 /// prefix. 418 /// prefix.
419 bool isDeferredUse(Send send) { 419 bool isDeferredUse(Send send) {
420 // We handle:
421 // 1. Send(Send(Send(null, Prefix), className), staticName)
422 // 2. Send(Send(Prefix, Classname), staticName)
423 // 3. Send(Send(null, Prefix), staticName | className)
424 // 4. Send(Send(Prefix), staticName | className)
425 // Nodes of the forms 2,4 occur in metadata.
420 if (send == null) return false; 426 if (send == null) return false;
421 return compiler.deferredLoadTask 427 while (send.receiver is Send) {
422 .deferredPrefixElement(send, elements) != null; 428 send = send.receiver;
429 }
430 Identifier prefixNode;
431 if (send.receiver is Identifier) {
432 prefixNode = send.receiver;
433 } else if (send.receiver == null &&
434 send.selector is Identifier) {
435 prefixNode = send.selector;
436 }
437 if (prefixNode != null) {
438 Element maybePrefix = elements[prefixNode.asIdentifier()];
439 if (maybePrefix != null && maybePrefix.isPrefix() &&
440 (maybePrefix as PrefixElement).isDeferred) {
441 return true;
442 }
443 }
444 return false;
423 } 445 }
424 446
425 Constant visitIdentifier(Identifier node) { 447 Constant visitIdentifier(Identifier node) {
426 Element element = elements[node]; 448 Element element = elements[node];
427 if (Elements.isClass(element) || Elements.isTypedef(element)) { 449 if (Elements.isClass(element) || Elements.isTypedef(element)) {
428 return makeTypeConstant(element); 450 return makeTypeConstant(element);
429 } 451 }
430 return signalNotCompileTimeConstant(node); 452 return signalNotCompileTimeConstant(node);
431 } 453 }
432 454
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 if (fieldValue == null) { 989 if (fieldValue == null) {
968 // Use the default value. 990 // Use the default value.
969 fieldValue = handler.compileConstant(field); 991 fieldValue = handler.compileConstant(field);
970 } 992 }
971 jsNewArguments.add(fieldValue); 993 jsNewArguments.add(fieldValue);
972 }, 994 },
973 includeSuperAndInjectedMembers: true); 995 includeSuperAndInjectedMembers: true);
974 return jsNewArguments; 996 return jsNewArguments;
975 } 997 }
976 } 998 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/deferred_load.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698