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

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

Issue 12299008: Stop resolving all of js_helper unconditionally. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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
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 ConstantEmitter { 7 class ConstantEmitter {
8 ConstantReferenceEmitter _referenceEmitter; 8 ConstantReferenceEmitter _referenceEmitter;
9 ConstantInitializerEmitter _initializerEmitter; 9 ConstantInitializerEmitter _initializerEmitter;
10 10
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 (constant.protoValue != null && emittedArgumentCount != 4)) { 287 (constant.protoValue != null && emittedArgumentCount != 4)) {
288 badFieldCountError(); 288 badFieldCountError();
289 } 289 }
290 290
291 return new jsAst.New( 291 return new jsAst.New(
292 new jsAst.VariableUse(getJsConstructor(classElement)), 292 new jsAst.VariableUse(getJsConstructor(classElement)),
293 arguments); 293 arguments);
294 } 294 }
295 295
296 jsAst.Expression visitType(TypeConstant constant) { 296 jsAst.Expression visitType(TypeConstant constant) {
297 SourceString helperSourceName = const SourceString('createRuntimeType');
298 Element helper = compiler.findHelper(helperSourceName);
299 JavaScriptBackend backend = compiler.backend; 297 JavaScriptBackend backend = compiler.backend;
298 Element helper = backend.getCreateRuntimeType();
300 String helperName = backend.namer.getName(helper); 299 String helperName = backend.namer.getName(helper);
301 DartType type = constant.representedType; 300 DartType type = constant.representedType;
302 Element element = type.element; 301 Element element = type.element;
303 String name = backend.rti.getRawTypeRepresentation(type); 302 String name = backend.rti.getRawTypeRepresentation(type);
304 jsAst.Expression typeName = new jsAst.LiteralString("'$name'"); 303 jsAst.Expression typeName = new jsAst.LiteralString("'$name'");
305 return new jsAst.Call( 304 return new jsAst.Call(
306 new jsAst.PropertyAccess.field( 305 new jsAst.PropertyAccess.field(
307 new jsAst.VariableUse(namer.CURRENT_ISOLATE), 306 new jsAst.VariableUse(namer.CURRENT_ISOLATE),
308 helperName), 307 helperName),
309 [typeName]); 308 [typeName]);
310 } 309 }
311 310
312 jsAst.Expression visitConstructed(ConstructedConstant constant) { 311 jsAst.Expression visitConstructed(ConstructedConstant constant) {
313 return new jsAst.New( 312 return new jsAst.New(
314 new jsAst.VariableUse(getJsConstructor(constant.type.element)), 313 new jsAst.VariableUse(getJsConstructor(constant.type.element)),
315 _array(constant.fields)); 314 _array(constant.fields));
316 } 315 }
317 316
318 List<jsAst.Expression> _array(List<Constant> values) { 317 List<jsAst.Expression> _array(List<Constant> values) {
319 List<jsAst.Expression> valueList = <jsAst.Expression>[]; 318 List<jsAst.Expression> valueList = <jsAst.Expression>[];
320 for (int i = 0; i < values.length; i++) { 319 for (int i = 0; i < values.length; i++) {
321 valueList.add(_reference(values[i])); 320 valueList.add(_reference(values[i]));
322 } 321 }
323 return valueList; 322 return valueList;
324 } 323 }
325 } 324 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698