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

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

Issue 2844383007: Add HCreateBox (Closed)
Patch Set: Created 3 years, 7 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/ssa/codegen.dart ('k') | pkg/compiler/lib/src/ssa/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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 '../closure.dart'; 5 import '../closure.dart';
6 import '../common.dart'; 6 import '../common.dart';
7 import '../elements/resolution_types.dart'; 7 import '../elements/resolution_types.dart';
8 import '../elements/elements.dart'; 8 import '../elements/elements.dart';
9 import '../elements/entities.dart'; 9 import '../elements/entities.dart';
10 import '../io/source_information.dart'; 10 import '../io/source_information.dart';
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 119
120 /// Redirects accesses from element [from] to element [to]. The [to] element 120 /// Redirects accesses from element [from] to element [to]. The [to] element
121 /// must be a boxed variable or a variable that is stored in a closure-field. 121 /// must be a boxed variable or a variable that is stored in a closure-field.
122 void redirectElement(Local from, CapturedVariable to) { 122 void redirectElement(Local from, CapturedVariable to) {
123 assert(redirectionMapping[from] == null); 123 assert(redirectionMapping[from] == null);
124 redirectionMapping[from] = to; 124 redirectionMapping[from] = to;
125 assert(isStoredInClosureField(from) || isBoxed(from)); 125 assert(isStoredInClosureField(from) || isBoxed(from));
126 } 126 }
127 127
128 HInstruction createBox() { 128 HInstruction createBox() {
129 // TODO(floitsch): Clean up this hack. Should we create a box-object by 129 HInstruction box = new HCreateBox(commonMasks.nonNullType);
130 // just creating an empty object literal?
131 HInstruction box = new HForeignCode(
132 js.js.parseForeignJS('{}'), commonMasks.nonNullType, <HInstruction>[],
133 nativeBehavior: native.NativeBehavior.PURE_ALLOCATION);
134 builder.add(box); 130 builder.add(box);
135 return box; 131 return box;
136 } 132 }
137 133
138 /// If the scope (function or loop) [node] has captured variables then this 134 /// If the scope (function or loop) [node] has captured variables then this
139 /// method creates a box and sets up the redirections. 135 /// method creates a box and sets up the redirections.
140 void enterScope(ast.Node node, Element element) { 136 void enterScope(ast.Node node, Element element) {
141 // See if any variable in the top-scope of the function is captured. If yes 137 // See if any variable in the top-scope of the function is captured. If yes
142 // we need to create a box-object. 138 // we need to create a box-object.
143 ClosureScope scopeData = closureData.capturingScopes[node]; 139 ClosureScope scopeData = closureData.capturingScopes[node];
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); 674 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30);
679 static int _nextHashCode = 0; 675 static int _nextHashCode = 0;
680 676
681 SyntheticLocal(this.name, this.executableContext); 677 SyntheticLocal(this.name, this.executableContext);
682 678
683 @override 679 @override
684 MemberElement get memberContext => executableContext.memberContext; 680 MemberElement get memberContext => executableContext.memberContext;
685 681
686 toString() => 'SyntheticLocal($name)'; 682 toString() => 'SyntheticLocal($name)';
687 } 683 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/ssa/nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698