| 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 #include "vm/intermediate_language.h" | 5 #include "vm/intermediate_language.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/constant_propagator.h" | 8 #include "vm/constant_propagator.h" |
| 9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
| 10 #include "vm/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 3502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3513 default: | 3513 default: |
| 3514 UNREACHABLE(); | 3514 UNREACHABLE(); |
| 3515 } | 3515 } |
| 3516 return 0; | 3516 return 0; |
| 3517 } | 3517 } |
| 3518 | 3518 |
| 3519 // Use expected function signatures to help MSVC compiler resolve overloading. | 3519 // Use expected function signatures to help MSVC compiler resolve overloading. |
| 3520 typedef double (*UnaryMathCFunction) (double x); | 3520 typedef double (*UnaryMathCFunction) (double x); |
| 3521 typedef double (*BinaryMathCFunction) (double x, double y); | 3521 typedef double (*BinaryMathCFunction) (double x, double y); |
| 3522 | 3522 |
| 3523 extern const RuntimeEntry kPowRuntimeEntry( | 3523 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcPow, 2, true /* is_float */, |
| 3524 "libc_pow", reinterpret_cast<RuntimeFunction>( | 3524 reinterpret_cast<RuntimeFunction>( |
| 3525 static_cast<BinaryMathCFunction>(&pow)), 2, true, true); | 3525 static_cast<BinaryMathCFunction>(&pow))); |
| 3526 | 3526 |
| 3527 extern const RuntimeEntry kModRuntimeEntry( | 3527 DEFINE_RAW_LEAF_RUNTIME_ENTRY(DartModulo, 2, true /* is_float */, |
| 3528 "DartModulo", reinterpret_cast<RuntimeFunction>( | 3528 reinterpret_cast<RuntimeFunction>( |
| 3529 static_cast<BinaryMathCFunction>(&DartModulo)), 2, true, true); | 3529 static_cast<BinaryMathCFunction>(&DartModulo))); |
| 3530 | 3530 |
| 3531 extern const RuntimeEntry kFloorRuntimeEntry( | 3531 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcFloor, 1, true /* is_float */, |
| 3532 "libc_floor", reinterpret_cast<RuntimeFunction>( | 3532 reinterpret_cast<RuntimeFunction>( |
| 3533 static_cast<UnaryMathCFunction>(&floor)), 1, true, true); | 3533 static_cast<UnaryMathCFunction>(&floor))); |
| 3534 | 3534 |
| 3535 extern const RuntimeEntry kCeilRuntimeEntry( | 3535 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcCeil, 1, true /* is_float */, |
| 3536 "libc_ceil", reinterpret_cast<RuntimeFunction>( | 3536 reinterpret_cast<RuntimeFunction>( |
| 3537 static_cast<UnaryMathCFunction>(&ceil)), 1, true, true); | 3537 static_cast<UnaryMathCFunction>(&ceil))); |
| 3538 | 3538 |
| 3539 extern const RuntimeEntry kTruncRuntimeEntry( | 3539 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcTrunc, 1, true /* is_float */, |
| 3540 "libc_trunc", reinterpret_cast<RuntimeFunction>( | 3540 reinterpret_cast<RuntimeFunction>( |
| 3541 static_cast<UnaryMathCFunction>(&trunc)), 1, true, true); | 3541 static_cast<UnaryMathCFunction>(&trunc))); |
| 3542 | 3542 |
| 3543 extern const RuntimeEntry kRoundRuntimeEntry( | 3543 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcRound, 1, true /* is_float */, |
| 3544 "libc_round", reinterpret_cast<RuntimeFunction>( | 3544 reinterpret_cast<RuntimeFunction>( |
| 3545 static_cast<UnaryMathCFunction>(&round)), 1, true, true); | 3545 static_cast<UnaryMathCFunction>(&round))); |
| 3546 | 3546 |
| 3547 | 3547 |
| 3548 const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const { | 3548 const RuntimeEntry& InvokeMathCFunctionInstr::TargetFunction() const { |
| 3549 switch (recognized_kind_) { | 3549 switch (recognized_kind_) { |
| 3550 case MethodRecognizer::kDoubleTruncate: | 3550 case MethodRecognizer::kDoubleTruncate: |
| 3551 return kTruncRuntimeEntry; | 3551 return kLibcTruncRuntimeEntry; |
| 3552 case MethodRecognizer::kDoubleRound: | 3552 case MethodRecognizer::kDoubleRound: |
| 3553 return kRoundRuntimeEntry; | 3553 return kLibcRoundRuntimeEntry; |
| 3554 case MethodRecognizer::kDoubleFloor: | 3554 case MethodRecognizer::kDoubleFloor: |
| 3555 return kFloorRuntimeEntry; | 3555 return kLibcFloorRuntimeEntry; |
| 3556 case MethodRecognizer::kDoubleCeil: | 3556 case MethodRecognizer::kDoubleCeil: |
| 3557 return kCeilRuntimeEntry; | 3557 return kLibcCeilRuntimeEntry; |
| 3558 case MethodRecognizer::kMathDoublePow: | 3558 case MethodRecognizer::kMathDoublePow: |
| 3559 return kPowRuntimeEntry; | 3559 return kLibcPowRuntimeEntry; |
| 3560 case MethodRecognizer::kDoubleMod: | 3560 case MethodRecognizer::kDoubleMod: |
| 3561 return kModRuntimeEntry; | 3561 return kDartModuloRuntimeEntry; |
| 3562 default: | 3562 default: |
| 3563 UNREACHABLE(); | 3563 UNREACHABLE(); |
| 3564 } | 3564 } |
| 3565 return kPowRuntimeEntry; | 3565 return kLibcPowRuntimeEntry; |
| 3566 } | 3566 } |
| 3567 | 3567 |
| 3568 | 3568 |
| 3569 extern const RuntimeEntry kCosRuntimeEntry( | 3569 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcCos, 1, true /* is_float */, |
| 3570 "libc_cos", reinterpret_cast<RuntimeFunction>( | 3570 reinterpret_cast<RuntimeFunction>( |
| 3571 static_cast<UnaryMathCFunction>(&cos)), 1, true, true); | 3571 static_cast<UnaryMathCFunction>(&cos))); |
| 3572 | 3572 |
| 3573 extern const RuntimeEntry kSinRuntimeEntry( | 3573 DEFINE_RAW_LEAF_RUNTIME_ENTRY(LibcSin, 1, true /* is_float */, |
| 3574 "libc_sin", reinterpret_cast<RuntimeFunction>( | 3574 reinterpret_cast<RuntimeFunction>( |
| 3575 static_cast<UnaryMathCFunction>(&sin)), 1, true, true); | 3575 static_cast<UnaryMathCFunction>(&sin))); |
| 3576 | 3576 |
| 3577 | 3577 |
| 3578 const RuntimeEntry& MathUnaryInstr::TargetFunction() const { | 3578 const RuntimeEntry& MathUnaryInstr::TargetFunction() const { |
| 3579 switch (kind()) { | 3579 switch (kind()) { |
| 3580 case MathUnaryInstr::kSin: | 3580 case MathUnaryInstr::kSin: |
| 3581 return kSinRuntimeEntry; | 3581 return kLibcSinRuntimeEntry; |
| 3582 case MathUnaryInstr::kCos: | 3582 case MathUnaryInstr::kCos: |
| 3583 return kCosRuntimeEntry; | 3583 return kLibcCosRuntimeEntry; |
| 3584 default: | 3584 default: |
| 3585 UNREACHABLE(); | 3585 UNREACHABLE(); |
| 3586 } | 3586 } |
| 3587 return kSinRuntimeEntry; | 3587 return kLibcSinRuntimeEntry; |
| 3588 } | 3588 } |
| 3589 | 3589 |
| 3590 | 3590 |
| 3591 const char* MathUnaryInstr::KindToCString(MathUnaryKind kind) { | 3591 const char* MathUnaryInstr::KindToCString(MathUnaryKind kind) { |
| 3592 switch (kind) { | 3592 switch (kind) { |
| 3593 case kIllegal: return "illegal"; | 3593 case kIllegal: return "illegal"; |
| 3594 case kSin: return "sin"; | 3594 case kSin: return "sin"; |
| 3595 case kCos: return "cos"; | 3595 case kCos: return "cos"; |
| 3596 case kSqrt: return "sqrt"; | 3596 case kSqrt: return "sqrt"; |
| 3597 case kDoubleSquare: return "double-square"; | 3597 case kDoubleSquare: return "double-square"; |
| 3598 } | 3598 } |
| 3599 UNREACHABLE(); | 3599 UNREACHABLE(); |
| 3600 return ""; | 3600 return ""; |
| 3601 } | 3601 } |
| 3602 | 3602 |
| 3603 typedef RawBool* (*CaseInsensitiveCompareUC16Function) ( | |
| 3604 RawString* string_raw, | |
| 3605 RawSmi* lhs_index_raw, | |
| 3606 RawSmi* rhs_index_raw, | |
| 3607 RawSmi* length_raw); | |
| 3608 | |
| 3609 | |
| 3610 extern const RuntimeEntry kCaseInsensitiveCompareUC16RuntimeEntry( | |
| 3611 "CaseInsensitiveCompareUC16", reinterpret_cast<RuntimeFunction>( | |
| 3612 static_cast<CaseInsensitiveCompareUC16Function>( | |
| 3613 &IRRegExpMacroAssembler::CaseInsensitiveCompareUC16)), 4, true, false); | |
| 3614 | |
| 3615 | 3603 |
| 3616 const RuntimeEntry& CaseInsensitiveCompareUC16Instr::TargetFunction() const { | 3604 const RuntimeEntry& CaseInsensitiveCompareUC16Instr::TargetFunction() const { |
| 3617 return kCaseInsensitiveCompareUC16RuntimeEntry; | 3605 return kCaseInsensitiveCompareUC16RuntimeEntry; |
| 3618 } | 3606 } |
| 3619 | 3607 |
| 3620 | 3608 |
| 3621 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, | 3609 MergedMathInstr::MergedMathInstr(ZoneGrowableArray<Value*>* inputs, |
| 3622 intptr_t deopt_id, | 3610 intptr_t deopt_id, |
| 3623 MergedMathInstr::Kind kind) | 3611 MergedMathInstr::Kind kind) |
| 3624 : PureDefinition(deopt_id), | 3612 : PureDefinition(deopt_id), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 3647 case Token::kTRUNCDIV: return 0; | 3635 case Token::kTRUNCDIV: return 0; |
| 3648 case Token::kMOD: return 1; | 3636 case Token::kMOD: return 1; |
| 3649 default: UNIMPLEMENTED(); return -1; | 3637 default: UNIMPLEMENTED(); return -1; |
| 3650 } | 3638 } |
| 3651 } | 3639 } |
| 3652 | 3640 |
| 3653 | 3641 |
| 3654 #undef __ | 3642 #undef __ |
| 3655 | 3643 |
| 3656 } // namespace dart | 3644 } // namespace dart |
| OLD | NEW |