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

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

Issue 1182913003: Split TypedSelector into Selector and TypeMask. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. 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, inputs, user.instructionType, interceptedClasses); 350 user.selector, user.mask,
351 inputs, user.instructionType, interceptedClasses);
351 oneShotInterceptor.sourceInformation = user.sourceInformation; 352 oneShotInterceptor.sourceInformation = user.sourceInformation;
352 oneShotInterceptor.sourceElement = user.sourceElement; 353 oneShotInterceptor.sourceElement = user.sourceElement;
353 return replaceUserWith(oneShotInterceptor); 354 return replaceUserWith(oneShotInterceptor);
354 } 355 }
355 } 356 }
356 357
357 return false; 358 return false;
358 } 359 }
359 360
360 bool rewriteToUseSelfAsInterceptor(HInterceptor node, HInstruction receiver) { 361 bool rewriteToUseSelfAsInterceptor(HInterceptor node, HInstruction receiver) {
(...skipping 12 matching lines...) Expand all
373 return false; 374 return false;
374 } 375 }
375 376
376 bool visitOneShotInterceptor(HOneShotInterceptor node) { 377 bool visitOneShotInterceptor(HOneShotInterceptor node) {
377 HInstruction constant = tryComputeConstantInterceptor( 378 HInstruction constant = tryComputeConstantInterceptor(
378 node.inputs[1], node.interceptedClasses); 379 node.inputs[1], node.interceptedClasses);
379 380
380 if (constant == null) return false; 381 if (constant == null) return false;
381 382
382 Selector selector = node.selector; 383 Selector selector = node.selector;
384 TypeMask mask = node.mask;
383 HInstruction instruction; 385 HInstruction instruction;
384 if (selector.isGetter) { 386 if (selector.isGetter) {
385 instruction = new HInvokeDynamicGetter( 387 instruction = new HInvokeDynamicGetter(
386 selector, 388 selector,
389 mask,
387 node.element, 390 node.element,
388 <HInstruction>[constant, node.inputs[1]], 391 <HInstruction>[constant, node.inputs[1]],
389 node.instructionType); 392 node.instructionType);
390 } else if (selector.isSetter) { 393 } else if (selector.isSetter) {
391 instruction = new HInvokeDynamicSetter( 394 instruction = new HInvokeDynamicSetter(
392 selector, 395 selector,
396 mask,
393 node.element, 397 node.element,
394 <HInstruction>[constant, node.inputs[1], node.inputs[2]], 398 <HInstruction>[constant, node.inputs[1], node.inputs[2]],
395 node.instructionType); 399 node.instructionType);
396 } else { 400 } else {
397 List<HInstruction> inputs = new List<HInstruction>.from(node.inputs); 401 List<HInstruction> inputs = new List<HInstruction>.from(node.inputs);
398 inputs[0] = constant; 402 inputs[0] = constant;
399 instruction = new HInvokeDynamicMethod( 403 instruction = new HInvokeDynamicMethod(
400 selector, inputs, node.instructionType, true); 404 selector, mask, inputs, node.instructionType, true);
401 } 405 }
402 406
403 HBasicBlock block = node.block; 407 HBasicBlock block = node.block;
404 block.addAfter(node, instruction); 408 block.addAfter(node, instruction);
405 block.rewrite(node, instruction); 409 block.rewrite(node, instruction);
406 return true; 410 return true;
407 } 411 }
408 } 412 }
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