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

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

Issue 2531303002: Decouple WorkItem from Compiler (Closed)
Patch Set: Updated cf. comments. Created 4 years 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/serialization/task.dart ('k') | pkg/compiler/lib/src/universe/use.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) 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 import 'dart:collection'; 5 import 'dart:collection';
6 6
7 import 'package:js_runtime/shared/embedded_names.dart'; 7 import 'package:js_runtime/shared/embedded_names.dart';
8 8
9 import '../closure.dart'; 9 import '../closure.dart';
10 import '../common.dart'; 10 import '../common.dart';
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
400 return compiledArguments; 400 return compiledArguments;
401 } 401 }
402 402
403 /** 403 /**
404 * Try to inline [element] within the correct context of the builder. The 404 * Try to inline [element] within the correct context of the builder. The
405 * insertion point is the state of the builder. 405 * insertion point is the state of the builder.
406 */ 406 */
407 bool tryInlineMethod(Element element, Selector selector, TypeMask mask, 407 bool tryInlineMethod(Element element, Selector selector, TypeMask mask,
408 List<HInstruction> providedArguments, ast.Node currentNode, 408 List<HInstruction> providedArguments, ast.Node currentNode,
409 {InterfaceType instanceType}) { 409 {InterfaceType instanceType}) {
410 // TODO(johnniwinther): Register this on the [registry]. Currently the 410 registry
411 // [CodegenRegistry] calls the enqueuer, but [element] should _not_ be 411 .addImpact(backend.registerStaticUse(element, forResolution: false));
412 // enqueued.
413 backend.registerStaticUse(compiler.enqueuer.codegen, element);
414 412
415 if (backend.isJsInterop(element) && !element.isFactoryConstructor) { 413 if (backend.isJsInterop(element) && !element.isFactoryConstructor) {
416 // We only inline factory JavaScript interop constructors. 414 // We only inline factory JavaScript interop constructors.
417 return false; 415 return false;
418 } 416 }
419 417
420 // Ensure that [element] is an implementation element. 418 // Ensure that [element] is an implementation element.
421 element = element.implementation; 419 element = element.implementation;
422 420
423 if (compiler.elementHasCompileTimeError(element)) return false; 421 if (compiler.elementHasCompileTimeError(element)) return false;
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
1490 // Otherwise it is a lazy initializer which does not have parameters. 1488 // Otherwise it is a lazy initializer which does not have parameters.
1491 assert(element is VariableElement); 1489 assert(element is VariableElement);
1492 } 1490 }
1493 1491
1494 insertTraceCall(element); 1492 insertTraceCall(element);
1495 insertCoverageCall(element); 1493 insertCoverageCall(element);
1496 } 1494 }
1497 1495
1498 insertTraceCall(Element element) { 1496 insertTraceCall(Element element) {
1499 if (JavaScriptBackend.TRACE_METHOD == 'console') { 1497 if (JavaScriptBackend.TRACE_METHOD == 'console') {
1500 if (element == backend.traceHelper) return; 1498 if (element == backend.helpers.traceHelper) return;
1501 n(e) => e == null ? '' : e.name; 1499 n(e) => e == null ? '' : e.name;
1502 String name = "${n(element.library)}:${n(element.enclosingClass)}." 1500 String name = "${n(element.library)}:${n(element.enclosingClass)}."
1503 "${n(element)}"; 1501 "${n(element)}";
1504 HConstant nameConstant = addConstantString(name); 1502 HConstant nameConstant = addConstantString(name);
1505 add(new HInvokeStatic(backend.traceHelper, <HInstruction>[nameConstant], 1503 add(new HInvokeStatic(backend.helpers.traceHelper,
1506 backend.dynamicType)); 1504 <HInstruction>[nameConstant], backend.dynamicType));
1507 } 1505 }
1508 } 1506 }
1509 1507
1510 insertCoverageCall(Element element) { 1508 insertCoverageCall(Element element) {
1511 if (JavaScriptBackend.TRACE_METHOD == 'post') { 1509 if (JavaScriptBackend.TRACE_METHOD == 'post') {
1512 if (element == backend.traceHelper) return; 1510 if (element == backend.helpers.traceHelper) return;
1513 // TODO(sigmund): create a better uuid for elements. 1511 // TODO(sigmund): create a better uuid for elements.
1514 HConstant idConstant = graph.addConstantInt(element.hashCode, compiler); 1512 HConstant idConstant = graph.addConstantInt(element.hashCode, compiler);
1515 HConstant nameConstant = addConstantString(element.name); 1513 HConstant nameConstant = addConstantString(element.name);
1516 add(new HInvokeStatic(backend.traceHelper, 1514 add(new HInvokeStatic(backend.helpers.traceHelper,
1517 <HInstruction>[idConstant, nameConstant], backend.dynamicType)); 1515 <HInstruction>[idConstant, nameConstant], backend.dynamicType));
1518 } 1516 }
1519 } 1517 }
1520 1518
1521 void assertIsSubtype( 1519 void assertIsSubtype(
1522 ast.Node node, DartType subtype, DartType supertype, String message) { 1520 ast.Node node, DartType subtype, DartType supertype, String message) {
1523 HInstruction subtypeInstruction = typeBuilder.analyzeTypeArgument( 1521 HInstruction subtypeInstruction = typeBuilder.analyzeTypeArgument(
1524 localsHandler.substInContext(subtype), sourceElement); 1522 localsHandler.substInContext(subtype), sourceElement);
1525 HInstruction supertypeInstruction = typeBuilder.analyzeTypeArgument( 1523 HInstruction supertypeInstruction = typeBuilder.analyzeTypeArgument(
1526 localsHandler.substInContext(supertype), sourceElement); 1524 localsHandler.substInContext(supertype), sourceElement);
(...skipping 5226 matching lines...) Expand 10 before | Expand all | Expand 10 after
6753 this.oldReturnLocal, 6751 this.oldReturnLocal,
6754 this.oldReturnType, 6752 this.oldReturnType,
6755 this.oldResolvedAst, 6753 this.oldResolvedAst,
6756 this.oldStack, 6754 this.oldStack,
6757 this.oldLocalsHandler, 6755 this.oldLocalsHandler,
6758 this.inTryStatement, 6756 this.inTryStatement,
6759 this.allFunctionsCalledOnce, 6757 this.allFunctionsCalledOnce,
6760 this.oldElementInferenceResults) 6758 this.oldElementInferenceResults)
6761 : super(function); 6759 : super(function);
6762 } 6760 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/task.dart ('k') | pkg/compiler/lib/src/universe/use.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698