OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 part of ssa; | 5 part of ssa; |
6 | 6 |
7 /** | 7 /** |
8 * This phase simplifies interceptors in multiple ways: | 8 * This phase simplifies interceptors in multiple ways: |
9 * | 9 * |
10 * 1) If the interceptor is for an object whose type is known, it | 10 * 1) If the interceptor is for an object whose type is known, it |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 if (constant == null) return false; | 261 if (constant == null) return false; |
262 | 262 |
263 Selector selector = node.selector; | 263 Selector selector = node.selector; |
264 HInstruction instruction; | 264 HInstruction instruction; |
265 if (selector.isGetter()) { | 265 if (selector.isGetter()) { |
266 instruction = new HInvokeDynamicGetter( | 266 instruction = new HInvokeDynamicGetter( |
267 selector, | 267 selector, |
268 node.element, | 268 node.element, |
269 <HInstruction>[constant, node.inputs[1]], | 269 <HInstruction>[constant, node.inputs[1]], |
270 node.instructionType); | 270 node.instructionType); |
271 } else if (node.selector.isSetter()) { | 271 } else if (selector.isSetter()) { |
272 instruction = new HInvokeDynamicSetter( | 272 instruction = new HInvokeDynamicSetter( |
273 selector, | 273 selector, |
274 node.element, | 274 node.element, |
275 <HInstruction>[constant, node.inputs[1], node.inputs[2]], | 275 <HInstruction>[constant, node.inputs[1], node.inputs[2]], |
276 node.instructionType); | 276 node.instructionType); |
277 } else { | 277 } else { |
278 List<HInstruction> inputs = new List<HInstruction>.from(node.inputs); | 278 List<HInstruction> inputs = new List<HInstruction>.from(node.inputs); |
279 inputs[0] = constant; | 279 inputs[0] = constant; |
280 instruction = new HInvokeDynamicMethod( | 280 instruction = new HInvokeDynamicMethod( |
281 selector, inputs, node.instructionType, true); | 281 selector, inputs, node.instructionType, true); |
282 } | 282 } |
283 | 283 |
284 HBasicBlock block = node.block; | 284 HBasicBlock block = node.block; |
285 block.addAfter(node, instruction); | 285 block.addAfter(node, instruction); |
286 block.rewrite(node, instruction); | 286 block.rewrite(node, instruction); |
287 return true; | 287 return true; |
288 } | 288 } |
289 } | 289 } |
OLD | NEW |