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

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

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