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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart

Issue 1397043002: Introduce BackendImpact to separate enqueueing from data. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 2 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.ir_builder_task; 5 library dart2js.ir_builder_task;
6 6
7 import '../closure.dart' as closurelib; 7 import '../closure.dart' as closurelib;
8 import '../closure.dart' hide ClosureScope; 8 import '../closure.dart' hide ClosureScope;
9 import '../common/names.dart' show 9 import '../common/names.dart' show
10 Names, 10 Names,
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 if (labelOrCase is ast.CaseMatch) { 496 if (labelOrCase is ast.CaseMatch) {
497 ir.Primitive constant = translateConstant(labelOrCase.expression); 497 ir.Primitive constant = translateConstant(labelOrCase.expression);
498 caseInfo.addConstant(constant); 498 caseInfo.addConstant(constant);
499 } 499 }
500 } 500 }
501 } 501 }
502 } 502 }
503 ir.Primitive value = visit(node.expression); 503 ir.Primitive value = visit(node.expression);
504 JumpTarget target = elements.getTargetDefinition(node); 504 JumpTarget target = elements.getTargetDefinition(node);
505 Element error = 505 Element error =
506 (compiler.backend as JavaScriptBackend).getFallThroughError(); 506 (compiler.backend as JavaScriptBackend).helpers.fallThroughError;
507 irBuilder.buildSimpleSwitch(target, value, cases, defaultCase, error, 507 irBuilder.buildSimpleSwitch(target, value, cases, defaultCase, error,
508 sourceInformationBuilder.buildGeneric(node)); 508 sourceInformationBuilder.buildGeneric(node));
509 } 509 }
510 510
511 visitTryStatement(ast.TryStatement node) { 511 visitTryStatement(ast.TryStatement node) {
512 List<CatchClauseInfo> catchClauseInfos = <CatchClauseInfo>[]; 512 List<CatchClauseInfo> catchClauseInfos = <CatchClauseInfo>[];
513 for (ast.CatchBlock catchClause in node.catchBlocks.nodes) { 513 for (ast.CatchBlock catchClause in node.catchBlocks.nodes) {
514 LocalVariableElement exceptionVariable; 514 LocalVariableElement exceptionVariable;
515 if (catchClause.exception != null) { 515 if (catchClause.exception != null) {
516 exceptionVariable = elements[catchClause.exception]; 516 exceptionVariable = elements[catchClause.exception];
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
2485 2485
2486 GlobalProgramInformation(this._compiler); 2486 GlobalProgramInformation(this._compiler);
2487 2487
2488 /// Returns [true], if the analysis could not determine that the type 2488 /// Returns [true], if the analysis could not determine that the type
2489 /// arguments for the class [cls] are never used in the program. 2489 /// arguments for the class [cls] are never used in the program.
2490 bool requiresRuntimeTypesFor(ClassElement cls) { 2490 bool requiresRuntimeTypesFor(ClassElement cls) {
2491 return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls); 2491 return cls.typeVariables.isNotEmpty && _backend.classNeedsRti(cls);
2492 } 2492 }
2493 2493
2494 FunctionElement get stringifyFunction { 2494 FunctionElement get stringifyFunction {
2495 return _backend.getStringInterpolationHelper(); 2495 return _backend.helpers.stringInterpolationHelper;
2496 } 2496 }
2497 2497
2498 FunctionElement get throwTypeErrorHelper => _backend.getThrowTypeError(); 2498 FunctionElement get throwTypeErrorHelper => _backend.helpers.throwTypeError;
2499 2499
2500 ClassElement get nullClass => _compiler.nullClass; 2500 ClassElement get nullClass => _compiler.nullClass;
2501 2501
2502 DartType unaliasType(DartType type) => type.unalias(_compiler.resolution); 2502 DartType unaliasType(DartType type) => type.unalias(_compiler.resolution);
2503 2503
2504 TypeMask getTypeMaskForForeign(NativeBehavior behavior) { 2504 TypeMask getTypeMaskForForeign(NativeBehavior behavior) {
2505 if (behavior == null) { 2505 if (behavior == null) {
2506 return _backend.dynamicType; 2506 return _backend.dynamicType;
2507 } 2507 }
2508 return TypeMaskFactory.fromNativeBehavior(behavior, _compiler); 2508 return TypeMaskFactory.fromNativeBehavior(behavior, _compiler);
2509 } 2509 }
2510 2510
2511 FieldElement locateSingleField(Selector selector, TypeMask type) { 2511 FieldElement locateSingleField(Selector selector, TypeMask type) {
2512 return _compiler.world.locateSingleField(selector, type); 2512 return _compiler.world.locateSingleField(selector, type);
2513 } 2513 }
2514 2514
2515 Element get closureConverter { 2515 Element get closureConverter {
2516 return _backend.getClosureConverter(); 2516 return _backend.helpers.closureConverter;
2517 } 2517 }
2518 2518
2519 void addNativeMethod(FunctionElement function) { 2519 void addNativeMethod(FunctionElement function) {
2520 _backend.emitter.nativeEmitter.nativeMethods.add(function); 2520 _backend.emitter.nativeEmitter.nativeMethods.add(function);
2521 } 2521 }
2522 } 2522 }
2523 2523
2524 /// IR builder specific to the JavaScript backend, coupled to the [JsIrBuilder]. 2524 /// IR builder specific to the JavaScript backend, coupled to the [JsIrBuilder].
2525 class JsIrBuilderVisitor extends IrBuilderVisitor { 2525 class JsIrBuilderVisitor extends IrBuilderVisitor {
2526 JavaScriptBackend get backend => compiler.backend; 2526 JavaScriptBackend get backend => compiler.backend;
(...skipping 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
3281 target, 3281 target,
3282 callStructure, 3282 callStructure,
3283 constructor.computeEffectiveTargetType(type), 3283 constructor.computeEffectiveTargetType(type),
3284 arguments, 3284 arguments,
3285 sourceInformationBuilder.buildNew(node)); 3285 sourceInformationBuilder.buildNew(node));
3286 } 3286 }
3287 3287
3288 @override 3288 @override
3289 ir.Primitive buildStaticNoSuchMethod(Selector selector, 3289 ir.Primitive buildStaticNoSuchMethod(Selector selector,
3290 List<ir.Primitive> arguments) { 3290 List<ir.Primitive> arguments) {
3291 Element thrower = backend.getThrowNoSuchMethod(); 3291 Element thrower = backend.helpers.throwNoSuchMethod;
3292 ir.Primitive receiver = irBuilder.buildStringConstant(''); 3292 ir.Primitive receiver = irBuilder.buildStringConstant('');
3293 ir.Primitive name = irBuilder.buildStringConstant(selector.name); 3293 ir.Primitive name = irBuilder.buildStringConstant(selector.name);
3294 ir.Primitive argumentList = irBuilder.buildListLiteral(null, arguments); 3294 ir.Primitive argumentList = irBuilder.buildListLiteral(null, arguments);
3295 ir.Primitive expectedArgumentNames = irBuilder.buildNullConstant(); 3295 ir.Primitive expectedArgumentNames = irBuilder.buildNullConstant();
3296 return irBuilder.buildStaticFunctionInvocation( 3296 return irBuilder.buildStaticFunctionInvocation(
3297 thrower, 3297 thrower,
3298 new CallStructure.unnamed(4), 3298 new CallStructure.unnamed(4),
3299 [receiver, name, argumentList, expectedArgumentNames]); 3299 [receiver, name, argumentList, expectedArgumentNames]);
3300 } 3300 }
3301 3301
3302 @override 3302 @override
3303 ir.Primitive buildInstanceNoSuchMethod(Selector selector, 3303 ir.Primitive buildInstanceNoSuchMethod(Selector selector,
3304 TypeMask mask, 3304 TypeMask mask,
3305 List<ir.Primitive> arguments) { 3305 List<ir.Primitive> arguments) {
3306 return irBuilder.buildDynamicInvocation( 3306 return irBuilder.buildDynamicInvocation(
3307 irBuilder.buildThis(), 3307 irBuilder.buildThis(),
3308 Selectors.noSuchMethod_, 3308 Selectors.noSuchMethod_,
3309 mask, 3309 mask,
3310 [irBuilder.buildInvocationMirror(selector, arguments)]); 3310 [irBuilder.buildInvocationMirror(selector, arguments)]);
3311 } 3311 }
3312 3312
3313 @override 3313 @override
3314 ir.Primitive buildRuntimeError(String message) { 3314 ir.Primitive buildRuntimeError(String message) {
3315 return irBuilder.buildStaticFunctionInvocation( 3315 return irBuilder.buildStaticFunctionInvocation(
3316 backend.getThrowRuntimeError(), 3316 backend.helpers.throwRuntimeError,
3317 new CallStructure.unnamed(1), 3317 new CallStructure.unnamed(1),
3318 [irBuilder.buildStringConstant(message)]); 3318 [irBuilder.buildStringConstant(message)]);
3319 } 3319 }
3320 3320
3321 @override 3321 @override
3322 ir.Primitive buildAbstractClassInstantiationError(ClassElement element) { 3322 ir.Primitive buildAbstractClassInstantiationError(ClassElement element) {
3323 return irBuilder.buildStaticFunctionInvocation( 3323 return irBuilder.buildStaticFunctionInvocation(
3324 backend.getThrowAbstractClassInstantiationError(), 3324 backend.helpers.throwAbstractClassInstantiationError,
3325 new CallStructure.unnamed(1), 3325 new CallStructure.unnamed(1),
3326 [irBuilder.buildStringConstant(element.name)]); 3326 [irBuilder.buildStringConstant(element.name)]);
3327 } 3327 }
3328 3328
3329 @override 3329 @override
3330 ir.Primitive handleStaticFieldGet(ast.Send node, FieldElement field, _) { 3330 ir.Primitive handleStaticFieldGet(ast.Send node, FieldElement field, _) {
3331 SourceInformation src = sourceInformationBuilder.buildGet(node); 3331 SourceInformation src = sourceInformationBuilder.buildGet(node);
3332 return buildStaticFieldGet(field, src); 3332 return buildStaticFieldGet(field, src);
3333 } 3333 }
3334 3334
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
3579 if (compiler.backend.isForeign(function)) { 3579 if (compiler.backend.isForeign(function)) {
3580 return handleForeignCode(node, function, argumentList, callStructure); 3580 return handleForeignCode(node, function, argumentList, callStructure);
3581 } else { 3581 } else {
3582 return irBuilder.buildStaticFunctionInvocation(function, callStructure, 3582 return irBuilder.buildStaticFunctionInvocation(function, callStructure,
3583 translateStaticArguments(argumentList, function, callStructure), 3583 translateStaticArguments(argumentList, function, callStructure),
3584 sourceInformation: 3584 sourceInformation:
3585 sourceInformationBuilder.buildCall(node, node.selector)); 3585 sourceInformationBuilder.buildCall(node, node.selector));
3586 } 3586 }
3587 } 3587 }
3588 } 3588 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/resolution.dart ('k') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698