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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart

Issue 2620123002: Fix for 27467 - dart2js error with re-entrant static initializer (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | sdk/lib/_internal/js_runtime/lib/js_helper.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library dart2js.js_emitter.full_emitter; 5 library dart2js.js_emitter.full_emitter;
6 6
7 import 'dart:collection' show HashMap; 7 import 'dart:collection' show HashMap;
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 // 'prototype' will be undefined except if we are doing an update 932 // 'prototype' will be undefined except if we are doing an update
933 // during incremental compilation. In this case we put the lazy 933 // during incremental compilation. In this case we put the lazy
934 // field directly on the isolate instead of the isolateProperties. 934 // field directly on the isolate instead of the isolateProperties.
935 prototype = prototype || $isolatePropertiesName; 935 prototype = prototype || $isolatePropertiesName;
936 var sentinelUndefined = {}; 936 var sentinelUndefined = {};
937 var sentinelInProgress = {}; 937 var sentinelInProgress = {};
938 prototype[fieldName] = sentinelUndefined; 938 prototype[fieldName] = sentinelUndefined;
939 939
940 prototype[getterName] = function () { 940 prototype[getterName] = function () {
941 var result = this[fieldName]; 941 var result = this[fieldName];
942 if (result == sentinelInProgress) {
943 // In minified mode, static name is not provided, so fall back
944 // to the minified fieldName.
945 #cyclicThrow(staticName || fieldName);
946 }
942 try { 947 try {
943 if (result === sentinelUndefined) { 948 if (result === sentinelUndefined) {
944 this[fieldName] = sentinelInProgress; 949 this[fieldName] = sentinelInProgress;
945
946 try { 950 try {
947 result = this[fieldName] = lazyValue(); 951 result = this[fieldName] = lazyValue();
948 } finally { 952 } finally {
949 // Use try-finally, not try-catch/throw as it destroys the 953 // Use try-finally, not try-catch/throw as it destroys the
950 // stack trace. 954 // stack trace.
951 if (result === sentinelUndefined) 955 if (result === sentinelUndefined)
952 this[fieldName] = null; 956 this[fieldName] = null;
953 } 957 }
954 } else {
955 if (result === sentinelInProgress)
956 // In minified mode, static name is not provided, so fall
957 // back to the minified fieldName.
958 #cyclicThrow(staticName || fieldName);
959 } 958 }
960
961 return result; 959 return result;
962 } finally { 960 } finally {
963 this[getterName] = function() { return this[fieldName]; }; 961 this[getterName] = function() { return this[fieldName]; };
964 } 962 }
965 } 963 }
966 } 964 }
967 } 965 }
968 966
969 // We replace the old Isolate function with a new one that initializes 967 // We replace the old Isolate function with a new one that initializes
970 // all its fields with the initial (and often final) value of all 968 // all its fields with the initial (and often final) value of all
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2180 if (cachedElements.isEmpty) return; 2178 if (cachedElements.isEmpty) return;
2181 for (Element element in backend.codegenEnqueuer.newlyEnqueuedElements) { 2179 for (Element element in backend.codegenEnqueuer.newlyEnqueuedElements) {
2182 if (element.isInstanceMember) { 2180 if (element.isInstanceMember) {
2183 cachedClassBuilders.remove(element.enclosingClass); 2181 cachedClassBuilders.remove(element.enclosingClass);
2184 2182
2185 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2183 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2186 } 2184 }
2187 } 2185 }
2188 } 2186 }
2189 } 2187 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/_internal/js_runtime/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698