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

Side by Side Diff: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart

Issue 2675103003: Refactor BackendHelpers to be reusageable with KernelWorldBuilder (Closed)
Patch Set: Updated cf. comments Created 3 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/ssa/types.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 import 'package:js_runtime/shared/embedded_names.dart'; 5 import 'package:js_runtime/shared/embedded_names.dart';
6 import 'package:kernel/ast.dart' as ir; 6 import 'package:kernel/ast.dart' as ir;
7 7
8 import '../common.dart'; 8 import '../common.dart';
9 import '../compiler.dart'; 9 import '../compiler.dart';
10 import '../constants/expressions.dart'; 10 import '../constants/expressions.dart';
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 TypeMask get traceFromExceptionType => 371 TypeMask get traceFromExceptionType =>
372 TypeMaskFactory.inferredReturnTypeForElement( 372 TypeMaskFactory.inferredReturnTypeForElement(
373 _backend.helpers.traceFromException, _globalInferenceResults); 373 _backend.helpers.traceFromException, _globalInferenceResults);
374 374
375 ir.Procedure get streamIteratorConstructor => 375 ir.Procedure get streamIteratorConstructor =>
376 kernel.functions[_backend.helpers.streamIteratorConstructor]; 376 kernel.functions[_backend.helpers.streamIteratorConstructor];
377 377
378 TypeMask get streamIteratorConstructorType => 378 TypeMask get streamIteratorConstructorType =>
379 TypeMaskFactory.inferredReturnTypeForElement( 379 TypeMaskFactory.inferredReturnTypeForElement(
380 _backend.helpers.streamIteratorConstructor, _globalInferenceResults); 380 _backend.helpers.streamIteratorConstructor as FunctionEntity,
381 _globalInferenceResults);
381 382
382 ir.Procedure get fallThroughError => 383 ir.Procedure get fallThroughError =>
383 kernel.functions[_backend.helpers.fallThroughError]; 384 kernel.functions[_backend.helpers.fallThroughError];
384 385
385 TypeMask get fallThroughErrorType => 386 TypeMask get fallThroughErrorType =>
386 TypeMaskFactory.inferredReturnTypeForElement( 387 TypeMaskFactory.inferredReturnTypeForElement(
387 _backend.helpers.fallThroughError, _globalInferenceResults); 388 _backend.helpers.fallThroughError, _globalInferenceResults);
388 389
389 ir.Procedure get mapLiteralUntypedMaker => 390 ir.Procedure get mapLiteralUntypedMaker =>
390 kernel.functions[_backend.helpers.mapLiteralUntypedMaker]; 391 kernel.functions[_backend.helpers.mapLiteralUntypedMaker];
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 477 }
477 478
478 js.Template getJsBuiltinTemplate(ConstantValue constant) { 479 js.Template getJsBuiltinTemplate(ConstantValue constant) {
479 int index = _extractEnumIndexFromConstantValue( 480 int index = _extractEnumIndexFromConstantValue(
480 constant, _backend.helpers.jsBuiltinEnum); 481 constant, _backend.helpers.jsBuiltinEnum);
481 if (index == null) return null; 482 if (index == null) return null;
482 return _backend.emitter.builtinTemplateFor(JsBuiltin.values[index]); 483 return _backend.emitter.builtinTemplateFor(JsBuiltin.values[index]);
483 } 484 }
484 485
485 int _extractEnumIndexFromConstantValue( 486 int _extractEnumIndexFromConstantValue(
486 ConstantValue constant, Element classElement) { 487 ConstantValue constant, ClassEntity classElement) {
487 if (constant is ConstructedConstantValue) { 488 if (constant is ConstructedConstantValue) {
488 if (constant.type.element == classElement) { 489 if (constant.type.element == classElement) {
489 assert(constant.fields.length == 1); 490 assert(constant.fields.length == 1);
490 ConstantValue indexConstant = constant.fields.values.single; 491 ConstantValue indexConstant = constant.fields.values.single;
491 if (indexConstant is IntConstantValue) { 492 if (indexConstant is IntConstantValue) {
492 return indexConstant.primitiveValue; 493 return indexConstant.primitiveValue;
493 } 494 }
494 } 495 }
495 } 496 }
496 return null; 497 return null;
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 JumpTarget continueTarget = 819 JumpTarget continueTarget =
819 astAdapter.getJumpTarget(switchCase, isContinueTarget: true); 820 astAdapter.getJumpTarget(switchCase, isContinueTarget: true);
820 assert(continueTarget is KernelJumpTarget); 821 assert(continueTarget is KernelJumpTarget);
821 targetIndexMap[continueTarget] = switchIndex; 822 targetIndexMap[continueTarget] = switchIndex;
822 assert(builder.jumpTargets[continueTarget] == null); 823 assert(builder.jumpTargets[continueTarget] == null);
823 builder.jumpTargets[continueTarget] = this; 824 builder.jumpTargets[continueTarget] = this;
824 switchIndex++; 825 switchIndex++;
825 } 826 }
826 } 827 }
827 } 828 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/ssa/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698