OLD | NEW |
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) |
11 : super(compiler, namer, generateSourceMap); | 11 : super(compiler, namer, generateSourceMap); |
12 | 12 |
13 bool get getterAndSetterCanBeImplementedByFieldSpec => false; | 13 bool get getterAndSetterCanBeImplementedByFieldSpec => false; |
| 14 bool get generateTrivialNsmHandlers => false; |
14 | 15 |
15 void emitSuper(String superName, ClassBuilder builder) { | 16 void emitSuper(String superName, ClassBuilder builder) { |
16 if (superName != '') { | 17 if (superName != '') { |
17 builder.addProperty('super', js.string(superName)); | 18 builder.addProperty('super', js.string(superName)); |
18 } | 19 } |
19 } | 20 } |
20 | 21 |
21 void emitBoundClosureClassHeader(String mangledName, | 22 void emitBoundClosureClassHeader(String mangledName, |
22 String superName, | 23 String superName, |
23 List<String> fieldNames, | 24 List<String> fieldNames, |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // | 109 // |
109 // We also copy over old values like the prototype, and the | 110 // We also copy over old values like the prototype, and the |
110 // isolateProperties themselves. | 111 // isolateProperties themselves. |
111 return js.fun('oldIsolate', [ | 112 return js.fun('oldIsolate', [ |
112 js['var isolateProperties = oldIsolate.${namer.isolatePropertiesName}'], | 113 js['var isolateProperties = oldIsolate.${namer.isolatePropertiesName}'], |
113 new jsAst.FunctionDeclaration( | 114 new jsAst.FunctionDeclaration( |
114 new jsAst.VariableDeclaration('Isolate'), | 115 new jsAst.VariableDeclaration('Isolate'), |
115 js.fun([], [ | 116 js.fun([], [ |
116 js['var hasOwnProperty = Object.prototype.hasOwnProperty'], | 117 js['var hasOwnProperty = Object.prototype.hasOwnProperty'], |
117 js.forIn('staticName', 'isolateProperties', | 118 js.forIn('staticName', 'isolateProperties', |
118 js.if_(js['hasOwnProperty.call(isolateProperties, staticName)'], | 119 js.if_('hasOwnProperty.call(isolateProperties, staticName)', |
119 js['this[staticName] = isolateProperties[staticName]'])), | 120 js['this[staticName] = isolateProperties[staticName]'])), |
120 // Use the newly created object as prototype. In Chrome, | 121 // Use the newly created object as prototype. In Chrome, |
121 // this creates a hidden class for the object and makes | 122 // this creates a hidden class for the object and makes |
122 // sure it is fast to access. | 123 // sure it is fast to access. |
123 new jsAst.FunctionDeclaration( | 124 new jsAst.FunctionDeclaration( |
124 new jsAst.VariableDeclaration('ForceEfficientMap'), | 125 new jsAst.VariableDeclaration('ForceEfficientMap'), |
125 js.fun([], [])), | 126 js.fun([], [])), |
126 js['ForceEfficientMap.prototype = this'], | 127 js['ForceEfficientMap.prototype = this'], |
127 js['new ForceEfficientMap()']])), | 128 js['new ForceEfficientMap()']])), |
128 js['Isolate.prototype = oldIsolate.prototype'], | 129 js['Isolate.prototype = oldIsolate.prototype'], |
129 js['Isolate.prototype.constructor = Isolate'], | 130 js['Isolate.prototype.constructor = Isolate'], |
130 js['Isolate.${namer.isolatePropertiesName} = isolateProperties'], | 131 js['Isolate.${namer.isolatePropertiesName} = isolateProperties'], |
131 js.return_('Isolate')]); | 132 js.return_('Isolate')]); |
132 } | 133 } |
133 } | 134 } |
OLD | NEW |