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 * [InvokeDynamicSpecializer] and its subclasses are helpers to | 8 * [InvokeDynamicSpecializer] and its subclasses are helpers to |
9 * optimize intercepted dynamic calls. It knows what input types | 9 * optimize intercepted dynamic calls. It knows what input types |
10 * would be beneficial for performance, and how to change a invoke | 10 * would be beneficial for performance, and how to change a invoke |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 if (inputsArePositiveIntegers(instruction, compiler)) { | 362 if (inputsArePositiveIntegers(instruction, compiler)) { |
363 JavaScriptBackend backend = compiler.backend; | 363 JavaScriptBackend backend = compiler.backend; |
364 return backend.positiveIntType; | 364 return backend.positiveIntType; |
365 } | 365 } |
366 return super.computeTypeFromInputTypes(instruction, compiler); | 366 return super.computeTypeFromInputTypes(instruction, compiler); |
367 } | 367 } |
368 | 368 |
369 bool isNotZero(HInstruction instruction, Compiler compiler) { | 369 bool isNotZero(HInstruction instruction, Compiler compiler) { |
370 if (!instruction.isConstantInteger()) return false; | 370 if (!instruction.isConstantInteger()) return false; |
371 HConstant rightConstant = instruction; | 371 HConstant rightConstant = instruction; |
372 IntConstant intConstant = rightConstant.constant; | 372 IntConstantValue intConstant = rightConstant.constant; |
373 int count = intConstant.value; | 373 int count = intConstant.primitiveValue; |
374 return count != 0; | 374 return count != 0; |
375 } | 375 } |
376 | 376 |
377 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, | 377 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, |
378 Compiler compiler) { | 378 Compiler compiler) { |
379 HInstruction left = instruction.inputs[1]; | 379 HInstruction left = instruction.inputs[1]; |
380 HInstruction right = instruction.inputs[2]; | 380 HInstruction right = instruction.inputs[2]; |
381 if (isBuiltin(instruction, compiler)) { | 381 if (isBuiltin(instruction, compiler)) { |
382 if (right.isPositiveInteger(compiler) && isNotZero(right, compiler)) { | 382 if (right.isPositiveInteger(compiler) && isNotZero(right, compiler)) { |
383 if (left.isUInt31(compiler)) { | 383 if (left.isUInt31(compiler)) { |
(...skipping 28 matching lines...) Expand all Loading... |
412 JavaScriptBackend backend = compiler.backend; | 412 JavaScriptBackend backend = compiler.backend; |
413 if (left.isPrimitiveOrNull(compiler)) { | 413 if (left.isPrimitiveOrNull(compiler)) { |
414 return backend.uint32Type; | 414 return backend.uint32Type; |
415 } | 415 } |
416 return super.computeTypeFromInputTypes(instruction, compiler); | 416 return super.computeTypeFromInputTypes(instruction, compiler); |
417 } | 417 } |
418 | 418 |
419 bool argumentLessThan32(HInstruction instruction) { | 419 bool argumentLessThan32(HInstruction instruction) { |
420 if (!instruction.isConstantInteger()) return false; | 420 if (!instruction.isConstantInteger()) return false; |
421 HConstant rightConstant = instruction; | 421 HConstant rightConstant = instruction; |
422 IntConstant intConstant = rightConstant.constant; | 422 IntConstantValue intConstant = rightConstant.constant; |
423 int count = intConstant.value; | 423 int count = intConstant.primitiveValue; |
424 return count >= 0 && count <= 31; | 424 return count >= 0 && count <= 31; |
425 } | 425 } |
426 | 426 |
427 bool isPositive(HInstruction instruction, Compiler compiler) { | 427 bool isPositive(HInstruction instruction, Compiler compiler) { |
428 // TODO: We should use the value range analysis. Currently, ranges | 428 // TODO: We should use the value range analysis. Currently, ranges |
429 // are discarded just after the analysis. | 429 // are discarded just after the analysis. |
430 return instruction.isPositiveInteger(compiler); | 430 return instruction.isPositiveInteger(compiler); |
431 } | 431 } |
432 } | 432 } |
433 | 433 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 } | 719 } |
720 | 720 |
721 HInstruction newBuiltinVariant(HInvokeDynamic instruction, | 721 HInstruction newBuiltinVariant(HInvokeDynamic instruction, |
722 Compiler compiler) { | 722 Compiler compiler) { |
723 JavaScriptBackend backend = compiler.backend; | 723 JavaScriptBackend backend = compiler.backend; |
724 return new HLessEqual( | 724 return new HLessEqual( |
725 instruction.inputs[1], instruction.inputs[2], | 725 instruction.inputs[1], instruction.inputs[2], |
726 instruction.selector, backend.boolType); | 726 instruction.selector, backend.boolType); |
727 } | 727 } |
728 } | 728 } |
OLD | NEW |