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

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

Issue 2732793002: Add NativeDataResolver (Closed)
Patch Set: Fix. Created 3 years, 9 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 '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem; 5 import '../common/codegen.dart' show CodegenRegistry, CodegenWorkItem;
6 import '../common/names.dart' show Selectors; 6 import '../common/names.dart' show Selectors;
7 import '../common/tasks.dart' show CompilerTask; 7 import '../common/tasks.dart' show CompilerTask;
8 import '../compiler.dart' show Compiler; 8 import '../compiler.dart' show Compiler;
9 import '../constants/constant_system.dart'; 9 import '../constants/constant_system.dart';
10 import '../constants/values.dart'; 10 import '../constants/values.dart';
(...skipping 2534 matching lines...) Expand 10 before | Expand all | Expand 10 after
2545 nonEscapingReceivers.add(instruction); 2545 nonEscapingReceivers.add(instruction);
2546 } 2546 }
2547 2547
2548 /** 2548 /**
2549 * Sets `receiver.element` to contain [value]. Kills all potential places that 2549 * Sets `receiver.element` to contain [value]. Kills all potential places that
2550 * may be affected by this update. 2550 * may be affected by this update.
2551 */ 2551 */
2552 void registerFieldValueUpdate( 2552 void registerFieldValueUpdate(
2553 MemberEntity element, HInstruction receiver, HInstruction value) { 2553 MemberEntity element, HInstruction receiver, HInstruction value) {
2554 assert(receiver == null || receiver == receiver.nonCheck()); 2554 assert(receiver == null || receiver == receiver.nonCheck());
2555 if (closedWorld.backendClasses.isNativeMember(element)) { 2555 if (closedWorld.nativeData.isNativeMember(element)) {
2556 return; // TODO(14955): Remove this restriction? 2556 return; // TODO(14955): Remove this restriction?
2557 } 2557 }
2558 // [value] is being set in some place in memory, we remove it from 2558 // [value] is being set in some place in memory, we remove it from
2559 // the non-escaping set. 2559 // the non-escaping set.
2560 nonEscapingReceivers.remove(value.nonCheck()); 2560 nonEscapingReceivers.remove(value.nonCheck());
2561 Map<HInstruction, HInstruction> map = 2561 Map<HInstruction, HInstruction> map =
2562 fieldValues.putIfAbsent(element, () => <HInstruction, HInstruction>{}); 2562 fieldValues.putIfAbsent(element, () => <HInstruction, HInstruction>{});
2563 map.forEach((key, value) { 2563 map.forEach((key, value) {
2564 if (mayAlias(receiver, key)) map[key] = null; 2564 if (mayAlias(receiver, key)) map[key] = null;
2565 }); 2565 });
2566 map[receiver] = value; 2566 map[receiver] = value;
2567 } 2567 }
2568 2568
2569 /** 2569 /**
2570 * Registers that `receiver.element` is now [value]. 2570 * Registers that `receiver.element` is now [value].
2571 */ 2571 */
2572 void registerFieldValue( 2572 void registerFieldValue(
2573 MemberEntity element, HInstruction receiver, HInstruction value) { 2573 MemberEntity element, HInstruction receiver, HInstruction value) {
2574 assert(receiver == null || receiver == receiver.nonCheck()); 2574 assert(receiver == null || receiver == receiver.nonCheck());
2575 if (closedWorld.backendClasses.isNativeMember(element)) { 2575 if (closedWorld.nativeData.isNativeMember(element)) {
2576 return; // TODO(14955): Remove this restriction? 2576 return; // TODO(14955): Remove this restriction?
2577 } 2577 }
2578 Map<HInstruction, HInstruction> map = 2578 Map<HInstruction, HInstruction> map =
2579 fieldValues.putIfAbsent(element, () => <HInstruction, HInstruction>{}); 2579 fieldValues.putIfAbsent(element, () => <HInstruction, HInstruction>{});
2580 map[receiver] = value; 2580 map[receiver] = value;
2581 } 2581 }
2582 2582
2583 /** 2583 /**
2584 * Returns the value stored in `receiver.element`. Returns `null` if we don't 2584 * Returns the value stored in `receiver.element`. Returns `null` if we don't
2585 * know. 2585 * know.
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
2781 2781
2782 keyedValues.forEach((receiver, values) { 2782 keyedValues.forEach((receiver, values) {
2783 result.keyedValues[receiver] = 2783 result.keyedValues[receiver] =
2784 new Map<HInstruction, HInstruction>.from(values); 2784 new Map<HInstruction, HInstruction>.from(values);
2785 }); 2785 });
2786 2786
2787 result.nonEscapingReceivers.addAll(nonEscapingReceivers); 2787 result.nonEscapingReceivers.addAll(nonEscapingReceivers);
2788 return result; 2788 return result;
2789 } 2789 }
2790 } 2790 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698