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

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

Issue 2154583002: dart2js: get:hashCode methods to avoid Object.hashCode (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: xxx Created 4 years, 5 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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } 75 }
76 76
77 /// A synthetic local variable only used with the SSA graph. 77 /// A synthetic local variable only used with the SSA graph.
78 /// 78 ///
79 /// For instance used for holding return value of function or the exception of a 79 /// For instance used for holding return value of function or the exception of a
80 /// try-catch statement. 80 /// try-catch statement.
81 class SyntheticLocal extends Local { 81 class SyntheticLocal extends Local {
82 final String name; 82 final String name;
83 final ExecutableElement executableContext; 83 final ExecutableElement executableContext;
84 84
85 // Avoid slow Object.hashCode.
86 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30);
87 static int _nextHashCode = 0;
88
85 SyntheticLocal(this.name, this.executableContext); 89 SyntheticLocal(this.name, this.executableContext);
86 90
87 toString() => 'SyntheticLocal($name)'; 91 toString() => 'SyntheticLocal($name)';
88 } 92 }
89 93
90 class SsaBuilderTask extends CompilerTask { 94 class SsaBuilderTask extends CompilerTask {
91 final CodeEmitterTask emitter; 95 final CodeEmitterTask emitter;
92 final JavaScriptBackend backend; 96 final JavaScriptBackend backend;
93 final SourceInformationStrategy sourceInformationFactory; 97 final SourceInformationStrategy sourceInformationFactory;
94 final Compiler compiler; 98 final Compiler compiler;
(...skipping 8531 matching lines...) Expand 10 before | Expand all | Expand 10 after
8626 const _LoopTypeVisitor(); 8630 const _LoopTypeVisitor();
8627 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP; 8631 int visitNode(ast.Node node) => HLoopBlockInformation.NOT_A_LOOP;
8628 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP; 8632 int visitWhile(ast.While node) => HLoopBlockInformation.WHILE_LOOP;
8629 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP; 8633 int visitFor(ast.For node) => HLoopBlockInformation.FOR_LOOP;
8630 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP; 8634 int visitDoWhile(ast.DoWhile node) => HLoopBlockInformation.DO_WHILE_LOOP;
8631 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; 8635 int visitAsyncForIn(ast.AsyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP;
8632 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP; 8636 int visitSyncForIn(ast.SyncForIn node) => HLoopBlockInformation.FOR_IN_LOOP;
8633 int visitSwitchStatement(ast.SwitchStatement node) => 8637 int visitSwitchStatement(ast.SwitchStatement node) =>
8634 HLoopBlockInformation.SWITCH_CONTINUE_LOOP; 8638 HLoopBlockInformation.SWITCH_CONTINUE_LOOP;
8635 } 8639 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/tree_elements.dart ('k') | pkg/compiler/lib/src/tree/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698