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