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

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

Issue 1607373002: dart2js: switching isolate is not 'PURE' (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: fixed Created 4 years, 11 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/native/behavior.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 4180 matching lines...) Expand 10 before | Expand all | Expand 10 after
4191 void handleForeignJsCurrentIsolateContext(ast.Send node) { 4191 void handleForeignJsCurrentIsolateContext(ast.Send node) {
4192 if (!node.arguments.isEmpty) { 4192 if (!node.arguments.isEmpty) {
4193 reporter.internalError(node, 4193 reporter.internalError(node,
4194 'Too many arguments to JS_CURRENT_ISOLATE_CONTEXT.'); 4194 'Too many arguments to JS_CURRENT_ISOLATE_CONTEXT.');
4195 } 4195 }
4196 4196
4197 if (!compiler.hasIsolateSupport) { 4197 if (!compiler.hasIsolateSupport) {
4198 // If the isolate library is not used, we just generate code 4198 // If the isolate library is not used, we just generate code
4199 // to fetch the static state. 4199 // to fetch the static state.
4200 String name = backend.namer.staticStateHolder; 4200 String name = backend.namer.staticStateHolder;
4201 push(new HForeignCode(js.js.parseForeignJS(name), 4201 push(new HForeignCode(
4202 backend.dynamicType, 4202 js.js.parseForeignJS(name),
4203 <HInstruction>[])); 4203 backend.dynamicType,
4204 <HInstruction>[],
4205 nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
4204 } else { 4206 } else {
4205 // Call a helper method from the isolate library. The isolate 4207 // Call a helper method from the isolate library. The isolate
4206 // library uses its own isolate structure, that encapsulates 4208 // library uses its own isolate structure, that encapsulates
4207 // Leg's isolate. 4209 // Leg's isolate.
4208 Element element = helpers.currentIsolate; 4210 Element element = helpers.currentIsolate;
4209 if (element == null) { 4211 if (element == null) {
4210 reporter.internalError(node, 4212 reporter.internalError(node,
4211 'Isolate library and compiler mismatch.'); 4213 'Isolate library and compiler mismatch.');
4212 } 4214 }
4213 pushInvokeStatic(null, element, [], typeMask: backend.dynamicType); 4215 pushInvokeStatic(null, element, [], typeMask: backend.dynamicType);
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
4471 'Exactly one argument required.'); 4473 'Exactly one argument required.');
4472 } 4474 }
4473 visit(node.arguments.head); 4475 visit(node.arguments.head);
4474 String isolateName = backend.namer.staticStateHolder; 4476 String isolateName = backend.namer.staticStateHolder;
4475 SideEffects sideEffects = new SideEffects.empty(); 4477 SideEffects sideEffects = new SideEffects.empty();
4476 sideEffects.setAllSideEffects(); 4478 sideEffects.setAllSideEffects();
4477 push(new HForeignCode( 4479 push(new HForeignCode(
4478 js.js.parseForeignJS("$isolateName = #"), 4480 js.js.parseForeignJS("$isolateName = #"),
4479 backend.dynamicType, 4481 backend.dynamicType,
4480 <HInstruction>[pop()], 4482 <HInstruction>[pop()],
4481 nativeBehavior: native.NativeBehavior.PURE, 4483 nativeBehavior: native.NativeBehavior.CHANGES_OTHER,
4482 effects: sideEffects)); 4484 effects: sideEffects));
4483 } 4485 }
4484 4486
4485 void handleForeignJsGetStaticState(ast.Send node) { 4487 void handleForeignJsGetStaticState(ast.Send node) {
4486 if (!node.arguments.isEmpty) { 4488 if (!node.arguments.isEmpty) {
4487 reporter.internalError(node.argumentsNode, 'Too many arguments.'); 4489 reporter.internalError(node.argumentsNode, 'Too many arguments.');
4488 } 4490 }
4489 push(new HForeignCode(js.js.parseForeignJS(backend.namer.staticStateHolder), 4491 push(new HForeignCode(js.js.parseForeignJS(backend.namer.staticStateHolder),
4490 backend.dynamicType, 4492 backend.dynamicType,
4491 <HInstruction>[])); 4493 <HInstruction>[],
4494 nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
4492 } 4495 }
4493 4496
4494 void handleForeignSend(ast.Send node, FunctionElement element) { 4497 void handleForeignSend(ast.Send node, FunctionElement element) {
4495 String name = element.name; 4498 String name = element.name;
4496 if (name == 'JS') { 4499 if (name == 'JS') {
4497 handleForeignJs(node); 4500 handleForeignJs(node);
4498 } else if (name == 'JS_CURRENT_ISOLATE_CONTEXT') { 4501 } else if (name == 'JS_CURRENT_ISOLATE_CONTEXT') {
4499 handleForeignJsCurrentIsolateContext(node); 4502 handleForeignJsCurrentIsolateContext(node);
4500 } else if (name == 'JS_CALL_IN_ISOLATE') { 4503 } else if (name == 'JS_CALL_IN_ISOLATE') {
4501 handleForeignJsCallInIsolate(node); 4504 handleForeignJsCallInIsolate(node);
(...skipping 4681 matching lines...) Expand 10 before | Expand all | Expand 10 after
9183 if (unaliased is TypedefType) throw 'unable to unalias $type'; 9186 if (unaliased is TypedefType) throw 'unable to unalias $type';
9184 unaliased.accept(this, builder); 9187 unaliased.accept(this, builder);
9185 } 9188 }
9186 9189
9187 void visitDynamicType(DynamicType type, SsaBuilder builder) { 9190 void visitDynamicType(DynamicType type, SsaBuilder builder) {
9188 JavaScriptBackend backend = builder.compiler.backend; 9191 JavaScriptBackend backend = builder.compiler.backend;
9189 ClassElement cls = backend.helpers.DynamicRuntimeType; 9192 ClassElement cls = backend.helpers.DynamicRuntimeType;
9190 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld))); 9193 builder.push(new HDynamicType(type, new TypeMask.exact(cls, classWorld)));
9191 } 9194 }
9192 } 9195 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/native/behavior.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698