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

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

Issue 1345983007: dart2js CPS: Clean up the S-Expression builder. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Cleanup. Created 5 years, 3 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 | pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.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) 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 3352 matching lines...) Expand 10 before | Expand all | Expand 10 after
3363 /// Call a helper method from the isolate library. The isolate library uses 3363 /// Call a helper method from the isolate library. The isolate library uses
3364 /// its own isolate structure, that encapsulates dart2js's isolate. 3364 /// its own isolate structure, that encapsulates dart2js's isolate.
3365 ir.Primitive buildIsolateHelperInvocation(String helperName, 3365 ir.Primitive buildIsolateHelperInvocation(String helperName,
3366 CallStructure callStructure) { 3366 CallStructure callStructure) {
3367 Element element = backend.isolateHelperLibrary.find(helperName); 3367 Element element = backend.isolateHelperLibrary.find(helperName);
3368 if (element == null) { 3368 if (element == null) {
3369 compiler.internalError(node, 3369 compiler.internalError(node,
3370 'Isolate library and compiler mismatch.'); 3370 'Isolate library and compiler mismatch.');
3371 } 3371 }
3372 List<ir.Primitive> arguments = translateStaticArguments(argumentList, 3372 List<ir.Primitive> arguments = translateStaticArguments(argumentList,
3373 element, CallStructure.TWO_ARGS); 3373 element, callStructure);
3374 return irBuilder.buildStaticFunctionInvocation(element, 3374 return irBuilder.buildStaticFunctionInvocation(element,
3375 CallStructure.TWO_ARGS, arguments, 3375 callStructure, arguments,
3376 sourceInformation: 3376 sourceInformation:
3377 sourceInformationBuilder.buildCall(node, node.selector)); 3377 sourceInformationBuilder.buildCall(node, node.selector));
3378 } 3378 }
3379 3379
3380 /// Lookup the value of the enum described by [node]. 3380 /// Lookup the value of the enum described by [node].
3381 getEnumValue(ast.Node node, EnumClassElement enumClass, List values) { 3381 getEnumValue(ast.Node node, EnumClassElement enumClass, List values) {
3382 Element element = elements[node]; 3382 Element element = elements[node];
3383 if (element is! FieldElement || element.enclosingClass != enumClass) { 3383 if (element is! FieldElement || element.enclosingClass != enumClass) {
3384 internalError(node, 'expected a JsBuiltin enum value'); 3384 internalError(node, 'expected a JsBuiltin enum value');
3385 } 3385 }
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
3514 validateArgumentCount(exactly: 2); 3514 validateArgumentCount(exactly: 2);
3515 List<ir.Primitive> arguments = argumentNodes.mapToList(visit); 3515 List<ir.Primitive> arguments = argumentNodes.mapToList(visit);
3516 return irBuilder.buildStringConcatenation(arguments); 3516 return irBuilder.buildStringConcatenation(arguments);
3517 3517
3518 case 'JS_CURRENT_ISOLATE_CONTEXT': 3518 case 'JS_CURRENT_ISOLATE_CONTEXT':
3519 validateArgumentCount(exactly: 0); 3519 validateArgumentCount(exactly: 0);
3520 3520
3521 if (!compiler.hasIsolateSupport) { 3521 if (!compiler.hasIsolateSupport) {
3522 // If the isolate library is not used, we just generate code 3522 // If the isolate library is not used, we just generate code
3523 // to fetch the current isolate. 3523 // to fetch the current isolate.
3524 continue GET_STATIC_STATE; 3524 continue getStaticState;
3525 } 3525 }
3526 return buildIsolateHelperInvocation('_currentIsolate', 3526 return buildIsolateHelperInvocation('_currentIsolate',
3527 CallStructure.NO_ARGS); 3527 CallStructure.NO_ARGS);
3528 3528
3529 GET_STATIC_STATE: case 'JS_GET_STATIC_STATE': 3529 getStaticState: case 'JS_GET_STATIC_STATE':
3530 validateArgumentCount(exactly: 0); 3530 validateArgumentCount(exactly: 0);
3531 3531
3532 return irBuilder.buildForeignCode( 3532 return irBuilder.buildForeignCode(
3533 js.js.parseForeignJS(backend.namer.staticStateHolder), 3533 js.js.parseForeignJS(backend.namer.staticStateHolder),
3534 const <ir.Primitive>[], 3534 const <ir.Primitive>[],
3535 NativeBehavior.PURE); 3535 NativeBehavior.PURE);
3536 3536
3537 case 'JS_SET_STATIC_STATE': 3537 case 'JS_SET_STATIC_STATE':
3538 validateArgumentCount(exactly: 1); 3538 validateArgumentCount(exactly: 1);
3539 3539
(...skipping 30 matching lines...) Expand all
3570 if (compiler.backend.isForeign(function)) { 3570 if (compiler.backend.isForeign(function)) {
3571 return handleForeignCode(node, function, argumentList, callStructure); 3571 return handleForeignCode(node, function, argumentList, callStructure);
3572 } else { 3572 } else {
3573 return irBuilder.buildStaticFunctionInvocation(function, callStructure, 3573 return irBuilder.buildStaticFunctionInvocation(function, callStructure,
3574 translateStaticArguments(argumentList, function, callStructure), 3574 translateStaticArguments(argumentList, function, callStructure),
3575 sourceInformation: 3575 sourceInformation:
3576 sourceInformationBuilder.buildCall(node, node.selector)); 3576 sourceInformationBuilder.buildCall(node, node.selector));
3577 } 3577 }
3578 } 3578 }
3579 } 3579 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_nodes_sexpr.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698