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

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

Issue 1313753004: Wrap Import uses in deferred_load.dart (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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 | « pkg/compiler/lib/src/deferred_load.dart ('k') | no next file » | 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 part of ssa; 5 part of ssa;
6 6
7 class SsaFunctionCompiler implements FunctionCompiler { 7 class SsaFunctionCompiler implements FunctionCompiler {
8 final SsaCodeGeneratorTask generator; 8 final SsaCodeGeneratorTask generator;
9 final SsaBuilderTask builder; 9 final SsaBuilderTask builder;
10 final SsaOptimizerTask optimizer; 10 final SsaOptimizerTask optimizer;
(...skipping 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after
3331 pushInvokeDynamic(send, selector, mask, [receiver], 3331 pushInvokeDynamic(send, selector, mask, [receiver],
3332 sourceInformation: sourceInformationBuilder.buildGet(send)); 3332 sourceInformation: sourceInformationBuilder.buildGet(send));
3333 } 3333 }
3334 3334
3335 /// Inserts a call to checkDeferredIsLoaded for [prefixElement]. 3335 /// Inserts a call to checkDeferredIsLoaded for [prefixElement].
3336 /// If [prefixElement] is [null] ndo nothing. 3336 /// If [prefixElement] is [null] ndo nothing.
3337 void generateIsDeferredLoadedCheckIfNeeded(PrefixElement prefixElement, 3337 void generateIsDeferredLoadedCheckIfNeeded(PrefixElement prefixElement,
3338 ast.Node location) { 3338 ast.Node location) {
3339 if (prefixElement == null) return; 3339 if (prefixElement == null) return;
3340 String loadId = 3340 String loadId =
3341 compiler.deferredLoadTask.importDeferName[prefixElement.deferredImport]; 3341 compiler.deferredLoadTask.getImportDeferName(location, prefixElement);
3342 HInstruction loadIdConstant = addConstantString(loadId); 3342 HInstruction loadIdConstant = addConstantString(loadId);
3343 String uri = prefixElement.deferredImport.uri.dartString.slowToString(); 3343 String uri = prefixElement.deferredImport.uri.dartString.slowToString();
3344 HInstruction uriConstant = addConstantString(uri); 3344 HInstruction uriConstant = addConstantString(uri);
3345 Element helper = backend.getCheckDeferredIsLoaded(); 3345 Element helper = backend.getCheckDeferredIsLoaded();
3346 pushInvokeStatic(location, helper, [loadIdConstant, uriConstant]); 3346 pushInvokeStatic(location, helper, [loadIdConstant, uriConstant]);
3347 pop(); 3347 pop();
3348 } 3348 }
3349 3349
3350 /// Inserts a call to checkDeferredIsLoaded if the send has a prefix that 3350 /// Inserts a call to checkDeferredIsLoaded if the send has a prefix that
3351 /// resolves to a deferred library. 3351 /// resolves to a deferred library.
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
4406 } 4406 }
4407 } 4407 }
4408 4408
4409 generateDeferredLoaderGet(ast.Send node, 4409 generateDeferredLoaderGet(ast.Send node,
4410 FunctionElement deferredLoader, 4410 FunctionElement deferredLoader,
4411 SourceInformation sourceInformation) { 4411 SourceInformation sourceInformation) {
4412 // Until now we only handle these as getters. 4412 // Until now we only handle these as getters.
4413 invariant(node, deferredLoader.isDeferredLoaderGetter); 4413 invariant(node, deferredLoader.isDeferredLoaderGetter);
4414 Element loadFunction = compiler.loadLibraryFunction; 4414 Element loadFunction = compiler.loadLibraryFunction;
4415 PrefixElement prefixElement = deferredLoader.enclosingElement; 4415 PrefixElement prefixElement = deferredLoader.enclosingElement;
4416 String loadId = compiler.deferredLoadTask 4416 String loadId =
4417 .importDeferName[prefixElement.deferredImport]; 4417 compiler.deferredLoadTask.getImportDeferName(node, prefixElement);
4418 var inputs = [graph.addConstantString( 4418 var inputs = [graph.addConstantString(
4419 new ast.DartString.literal(loadId), compiler)]; 4419 new ast.DartString.literal(loadId), compiler)];
4420 push(new HInvokeStatic(loadFunction, inputs, backend.nonNullType, 4420 push(new HInvokeStatic(loadFunction, inputs, backend.nonNullType,
4421 targetCanThrow: false) 4421 targetCanThrow: false)
4422 ..sourceInformation = sourceInformation); 4422 ..sourceInformation = sourceInformation);
4423 } 4423 }
4424 4424
4425 generateSuperNoSuchMethodSend(ast.Send node, 4425 generateSuperNoSuchMethodSend(ast.Send node,
4426 Selector selector, 4426 Selector selector,
4427 List<HInstruction> arguments) { 4427 List<HInstruction> arguments) {
(...skipping 4511 matching lines...) Expand 10 before | Expand all | Expand 10 after
8939 if (unaliased is TypedefType) throw 'unable to unalias $type'; 8939 if (unaliased is TypedefType) throw 'unable to unalias $type';
8940 unaliased.accept(this, builder); 8940 unaliased.accept(this, builder);
8941 } 8941 }
8942 8942
8943 void visitDynamicType(DynamicType type, SsaBuilder builder) { 8943 void visitDynamicType(DynamicType type, SsaBuilder builder) {
8944 JavaScriptBackend backend = builder.compiler.backend; 8944 JavaScriptBackend backend = builder.compiler.backend;
8945 ClassElement cls = backend.findHelper('DynamicRuntimeType'); 8945 ClassElement cls = backend.findHelper('DynamicRuntimeType');
8946 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 8946 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
8947 } 8947 }
8948 } 8948 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/deferred_load.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698