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

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

Issue 1873823002: Update elements, nodes and visitors for serialization. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Rebased Created 4 years, 8 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/serialization/modelz.dart ('k') | pkg/compiler/lib/src/tree/nodes.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 4127 matching lines...) Expand 10 before | Expand all | Expand 10 after
4138 break; 4138 break;
4139 default: 4139 default:
4140 for (int i = 1; i < arguments.length; i++) { 4140 for (int i = 1; i < arguments.length; i++) {
4141 reporter.reportErrorMessage(arguments[i], MessageKind.GENERIC, 4141 reporter.reportErrorMessage(arguments[i], MessageKind.GENERIC,
4142 {'text': 'Error: Extra argument to JS_GET_NAME.'}); 4142 {'text': 'Error: Extra argument to JS_GET_NAME.'});
4143 } 4143 }
4144 return; 4144 return;
4145 } 4145 }
4146 Element element = elements[argument]; 4146 Element element = elements[argument];
4147 if (element == null || 4147 if (element == null ||
4148 element is! FieldElement || 4148 element is! EnumConstantElement ||
4149 element.enclosingClass != helpers.jsGetNameEnum) { 4149 element.enclosingClass != helpers.jsGetNameEnum) {
4150 reporter.reportErrorMessage(argument, MessageKind.GENERIC, 4150 reporter.reportErrorMessage(argument, MessageKind.GENERIC,
4151 {'text': 'Error: Expected a JsGetName enum value.'}); 4151 {'text': 'Error: Expected a JsGetName enum value.'});
4152 } 4152 }
4153 EnumClassElement enumClass = element.enclosingClass; 4153 EnumConstantElement enumConstant = element;
4154 int index = enumClass.enumValues.indexOf(element); 4154 int index = enumConstant.index;
4155 stack.add(addConstantStringFromName( 4155 stack.add(addConstantStringFromName(
4156 backend.namer.getNameForJsGetName(argument, JsGetName.values[index]))); 4156 backend.namer.getNameForJsGetName(argument, JsGetName.values[index])));
4157 } 4157 }
4158 4158
4159 void handleForeignJsBuiltin(ast.Send node) { 4159 void handleForeignJsBuiltin(ast.Send node) {
4160 List<ast.Node> arguments = node.arguments.toList(); 4160 List<ast.Node> arguments = node.arguments.toList();
4161 ast.Node argument; 4161 ast.Node argument;
4162 if (arguments.length < 2) { 4162 if (arguments.length < 2) {
4163 reporter.reportErrorMessage(node, MessageKind.GENERIC, 4163 reporter.reportErrorMessage(node, MessageKind.GENERIC,
4164 {'text': 'Error: Expected at least two arguments to JS_BUILTIN.'}); 4164 {'text': 'Error: Expected at least two arguments to JS_BUILTIN.'});
4165 } 4165 }
4166 4166
4167 Element builtinElement = elements[arguments[1]]; 4167 Element builtinElement = elements[arguments[1]];
4168 if (builtinElement == null || 4168 if (builtinElement == null ||
4169 (builtinElement is! FieldElement) || 4169 (builtinElement is! EnumConstantElement) ||
4170 builtinElement.enclosingClass != helpers.jsBuiltinEnum) { 4170 builtinElement.enclosingClass != helpers.jsBuiltinEnum) {
4171 reporter.reportErrorMessage(argument, MessageKind.GENERIC, 4171 reporter.reportErrorMessage(argument, MessageKind.GENERIC,
4172 {'text': 'Error: Expected a JsBuiltin enum value.'}); 4172 {'text': 'Error: Expected a JsBuiltin enum value.'});
4173 } 4173 }
4174 EnumClassElement enumClass = builtinElement.enclosingClass; 4174 EnumConstantElement enumConstant = builtinElement;
4175 int index = enumClass.enumValues.indexOf(builtinElement); 4175 int index = enumConstant.index;
4176 4176
4177 js.Template template = 4177 js.Template template =
4178 backend.emitter.builtinTemplateFor(JsBuiltin.values[index]); 4178 backend.emitter.builtinTemplateFor(JsBuiltin.values[index]);
4179 4179
4180 List<HInstruction> compiledArguments = <HInstruction>[]; 4180 List<HInstruction> compiledArguments = <HInstruction>[];
4181 for (int i = 2; i < arguments.length; i++) { 4181 for (int i = 2; i < arguments.length; i++) {
4182 visit(arguments[i]); 4182 visit(arguments[i]);
4183 compiledArguments.add(pop()); 4183 compiledArguments.add(pop());
4184 } 4184 }
4185 4185
(...skipping 4373 matching lines...) Expand 10 before | Expand all | Expand 10 after
8559 const _LoopTypeVisitor(); 8559 const _LoopTypeVisitor();
8560 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP; 8560 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP;
8561 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP; 8561 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP;
8562 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP; 8562 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP;
8563 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; 8563 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP;
8564 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; 8564 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP;
8565 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; 8565 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP;
8566 int visitSwitchStatement(ast.SwitchStatement node) => 8566 int visitSwitchStatement(ast.SwitchStatement node) =>
8567 HLoopBlockInformation.SWITCH_CONTINUE_LOOP; 8567 HLoopBlockInformation.SWITCH_CONTINUE_LOOP;
8568 } 8568 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/serialization/modelz.dart ('k') | pkg/compiler/lib/src/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698