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

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

Issue 11419119: Don't use 'new Function' for lazily initialized getter. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart ('k') | no next file » | 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 js_backend; 5 part of js_backend;
6 6
7 class CodeEmitterNoEvalTask extends CodeEmitterTask { 7 class CodeEmitterNoEvalTask extends CodeEmitterTask {
8 CodeEmitterNoEvalTask(Compiler compiler, 8 CodeEmitterNoEvalTask(Compiler compiler,
9 Namer namer, 9 Namer namer,
10 bool generateSourceMap) 10 bool generateSourceMap)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 ForceEfficientMap.prototype = this; 52 ForceEfficientMap.prototype = this;
53 new ForceEfficientMap; 53 new ForceEfficientMap;
54 } 54 }
55 Isolate.prototype = oldIsolate.prototype; 55 Isolate.prototype = oldIsolate.prototype;
56 Isolate.prototype.constructor = Isolate; 56 Isolate.prototype.constructor = Isolate;
57 Isolate.${namer.ISOLATE_PROPERTIES} = isolateProperties; 57 Isolate.${namer.ISOLATE_PROPERTIES} = isolateProperties;
58 return Isolate; 58 return Isolate;
59 }"""; 59 }""";
60 } 60 }
61 61
62 String get lazyInitializerFunction {
63 return """
64 function(prototype, staticName, fieldName, getterName, lazyValue, getter) {
65 $lazyInitializerLogic
66 }""";
67 }
68
69 void emitLazyInitializedGetter(VariableElement element, CodeBuffer buffer) {
70 String isolate = namer.CURRENT_ISOLATE;
71 buffer.add(', function() { return $isolate.${namer.getName(element)}; }');
72 }
73
62 void emitBoundClosureClassHeader(String mangledName, 74 void emitBoundClosureClassHeader(String mangledName,
63 String superName, 75 String superName,
64 String extraArgument, 76 String extraArgument,
65 CodeBuffer buffer) { 77 CodeBuffer buffer) {
66 if (!extraArgument.isEmpty) { 78 if (!extraArgument.isEmpty) {
67 buffer.add(""" 79 buffer.add("""
68 $classesCollector.$mangledName = {'': function $mangledName( 80 $classesCollector.$mangledName = {'': function $mangledName(
69 self, $extraArgument, target) { 81 self, $extraArgument, target) {
70 this.self = self; 82 this.self = self;
71 this.$extraArgument = $extraArgument, 83 this.$extraArgument = $extraArgument,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 generateSetter(member, name, accessorName, buffer); 162 generateSetter(member, name, accessorName, buffer);
151 } 163 }
152 if (needsCheckedSetter) { 164 if (needsCheckedSetter) {
153 assert(!needsSetter); 165 assert(!needsSetter);
154 emitComma(); 166 emitComma();
155 generateCheckedSetter(member, name, accessorName, buffer); 167 generateCheckedSetter(member, name, accessorName, buffer);
156 } 168 }
157 }); 169 });
158 } 170 }
159 } 171 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698