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

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

Issue 1182053010: Revert "Split TypedSelector into Selector and TypeMask." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 6 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) 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 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 return replaceUserWith(instanceofCheck); 340 return replaceUserWith(instanceofCheck);
341 } 341 }
342 } 342 }
343 } else if (user is HInvokeDynamic) { 343 } else if (user is HInvokeDynamic) {
344 if (node == user.inputs[0]) { 344 if (node == user.inputs[0]) {
345 // Replace the user with a [HOneShotInterceptor]. 345 // Replace the user with a [HOneShotInterceptor].
346 HConstant nullConstant = graph.addConstantNull(compiler); 346 HConstant nullConstant = graph.addConstantNull(compiler);
347 List<HInstruction> inputs = new List<HInstruction>.from(user.inputs); 347 List<HInstruction> inputs = new List<HInstruction>.from(user.inputs);
348 inputs[0] = nullConstant; 348 inputs[0] = nullConstant;
349 HOneShotInterceptor oneShotInterceptor = new HOneShotInterceptor( 349 HOneShotInterceptor oneShotInterceptor = new HOneShotInterceptor(
350 user.selector, user.mask, 350 user.selector, inputs, user.instructionType, interceptedClasses);
351 inputs, user.instructionType, interceptedClasses);
352 oneShotInterceptor.sourceInformation = user.sourceInformation; 351 oneShotInterceptor.sourceInformation = user.sourceInformation;
353 oneShotInterceptor.sourceElement = user.sourceElement; 352 oneShotInterceptor.sourceElement = user.sourceElement;
354 return replaceUserWith(oneShotInterceptor); 353 return replaceUserWith(oneShotInterceptor);
355 } 354 }
356 } 355 }
357 356
358 return false; 357 return false;
359 } 358 }
360 359
361 bool rewriteToUseSelfAsInterceptor(HInterceptor node, HInstruction receiver) { 360 bool rewriteToUseSelfAsInterceptor(HInterceptor node, HInstruction receiver) {
(...skipping 12 matching lines...) Expand all
374 return false; 373 return false;
375 } 374 }
376 375
377 bool visitOneShotInterceptor(HOneShotInterceptor node) { 376 bool visitOneShotInterceptor(HOneShotInterceptor node) {
378 HInstruction constant = tryComputeConstantInterceptor( 377 HInstruction constant = tryComputeConstantInterceptor(
379 node.inputs[1], node.interceptedClasses); 378 node.inputs[1], node.interceptedClasses);
380 379
381 if (constant == null) return false; 380 if (constant == null) return false;
382 381
383 Selector selector = node.selector; 382 Selector selector = node.selector;
384 TypeMask mask = node.mask;
385 HInstruction instruction; 383 HInstruction instruction;
386 if (selector.isGetter) { 384 if (selector.isGetter) {
387 instruction = new HInvokeDynamicGetter( 385 instruction = new HInvokeDynamicGetter(
388 selector, 386 selector,
389 mask,
390 node.element, 387 node.element,
391 <HInstruction>[constant, node.inputs[1]], 388 <HInstruction>[constant, node.inputs[1]],
392 node.instructionType); 389 node.instructionType);
393 } else if (selector.isSetter) { 390 } else if (selector.isSetter) {
394 instruction = new HInvokeDynamicSetter( 391 instruction = new HInvokeDynamicSetter(
395 selector, 392 selector,
396 mask,
397 node.element, 393 node.element,
398 <HInstruction>[constant, node.inputs[1], node.inputs[2]], 394 <HInstruction>[constant, node.inputs[1], node.inputs[2]],
399 node.instructionType); 395 node.instructionType);
400 } else { 396 } else {
401 List<HInstruction> inputs = new List<HInstruction>.from(node.inputs); 397 List<HInstruction> inputs = new List<HInstruction>.from(node.inputs);
402 inputs[0] = constant; 398 inputs[0] = constant;
403 instruction = new HInvokeDynamicMethod( 399 instruction = new HInvokeDynamicMethod(
404 selector, mask, inputs, node.instructionType, true); 400 selector, inputs, node.instructionType, true);
405 } 401 }
406 402
407 HBasicBlock block = node.block; 403 HBasicBlock block = node.block;
408 block.addAfter(node, instruction); 404 block.addAfter(node, instruction);
409 block.rewrite(node, instruction); 405 block.rewrite(node, instruction);
410 return true; 406 return true;
411 } 407 }
412 } 408 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen_helpers.dart ('k') | pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698