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

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: Fix LocalVariableElementZ.constant 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
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 4335 matching lines...) Expand 10 before | Expand all | Expand 10 after
4346 default: 4346 default:
4347 for (int i = 1; i < arguments.length; i++) { 4347 for (int i = 1; i < arguments.length; i++) {
4348 reporter.reportErrorMessage( 4348 reporter.reportErrorMessage(
4349 arguments[i], MessageKind.GENERIC, 4349 arguments[i], MessageKind.GENERIC,
4350 {'text': 'Error: Extra argument to JS_GET_NAME.'}); 4350 {'text': 'Error: Extra argument to JS_GET_NAME.'});
4351 } 4351 }
4352 return; 4352 return;
4353 } 4353 }
4354 Element element = elements[argument]; 4354 Element element = elements[argument];
4355 if (element == null || 4355 if (element == null ||
4356 element is! FieldElement || 4356 element is! EnumConstantElement ||
4357 element.enclosingClass != helpers.jsGetNameEnum) { 4357 element.enclosingClass != helpers.jsGetNameEnum) {
4358 reporter.reportErrorMessage( 4358 reporter.reportErrorMessage(
4359 argument, MessageKind.GENERIC, 4359 argument, MessageKind.GENERIC,
4360 {'text': 'Error: Expected a JsGetName enum value.'}); 4360 {'text': 'Error: Expected a JsGetName enum value.'});
4361 } 4361 }
4362 EnumClassElement enumClass = element.enclosingClass; 4362 EnumConstantElement enumConstant = element;
4363 int index = enumClass.enumValues.indexOf(element); 4363 int index = enumConstant.index;
4364 stack.add( 4364 stack.add(
4365 addConstantStringFromName( 4365 addConstantStringFromName(
4366 backend.namer.getNameForJsGetName( 4366 backend.namer.getNameForJsGetName(
4367 argument, JsGetName.values[index]))); 4367 argument, JsGetName.values[index])));
4368 } 4368 }
4369 4369
4370 void handleForeignJsBuiltin(ast.Send node) { 4370 void handleForeignJsBuiltin(ast.Send node) {
4371 List<ast.Node> arguments = node.arguments.toList(); 4371 List<ast.Node> arguments = node.arguments.toList();
4372 ast.Node argument; 4372 ast.Node argument;
4373 if (arguments.length < 2) { 4373 if (arguments.length < 2) {
4374 reporter.reportErrorMessage( 4374 reporter.reportErrorMessage(
4375 node, MessageKind.GENERIC, 4375 node, MessageKind.GENERIC,
4376 {'text': 'Error: Expected at least two arguments to JS_BUILTIN.'}); 4376 {'text': 'Error: Expected at least two arguments to JS_BUILTIN.'});
4377 } 4377 }
4378 4378
4379 Element builtinElement = elements[arguments[1]]; 4379 Element builtinElement = elements[arguments[1]];
4380 if (builtinElement == null || 4380 if (builtinElement == null ||
4381 (builtinElement is! FieldElement) || 4381 (builtinElement is! EnumConstantElement) ||
4382 builtinElement.enclosingClass != helpers.jsBuiltinEnum) { 4382 builtinElement.enclosingClass != helpers.jsBuiltinEnum) {
4383 reporter.reportErrorMessage( 4383 reporter.reportErrorMessage(
4384 argument, MessageKind.GENERIC, 4384 argument, MessageKind.GENERIC,
4385 {'text': 'Error: Expected a JsBuiltin enum value.'}); 4385 {'text': 'Error: Expected a JsBuiltin enum value.'});
4386 } 4386 }
4387 EnumClassElement enumClass = builtinElement.enclosingClass; 4387 EnumConstantElement enumConstant = builtinElement;
4388 int index = enumClass.enumValues.indexOf(builtinElement); 4388 int index = enumConstant.index;
4389 4389
4390 js.Template template = 4390 js.Template template =
4391 backend.emitter.builtinTemplateFor(JsBuiltin.values[index]); 4391 backend.emitter.builtinTemplateFor(JsBuiltin.values[index]);
4392 4392
4393 List<HInstruction> compiledArguments = <HInstruction>[]; 4393 List<HInstruction> compiledArguments = <HInstruction>[];
4394 for (int i = 2; i < arguments.length; i++) { 4394 for (int i = 2; i < arguments.length; i++) {
4395 visit(arguments[i]); 4395 visit(arguments[i]);
4396 compiledArguments.add(pop()); 4396 compiledArguments.add(pop());
4397 } 4397 }
4398 4398
(...skipping 4952 matching lines...) Expand 10 before | Expand all | Expand 10 after
9351 const _LoopTypeVisitor(); 9351 const _LoopTypeVisitor();
9352 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP; 9352 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP;
9353 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP; 9353 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP;
9354 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP; 9354 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP;
9355 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; 9355 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP;
9356 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; 9356 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP;
9357 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; 9357 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP;
9358 int visitSwitchStatement(ast.SwitchStatement node) => 9358 int visitSwitchStatement(ast.SwitchStatement node) =>
9359 HLoopBlockInformation.SWITCH_CONTINUE_LOOP; 9359 HLoopBlockInformation.SWITCH_CONTINUE_LOOP;
9360 } 9360 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698