fpizlo@apple.com | a00b4d8 | 2015-10-28 23:57:04 +0000 | [diff] [blame] | 1 | /* |
fpizlo@apple.com | 8f47e9e | 2016-01-21 03:12:55 +0000 | [diff] [blame] | 2 | * Copyright (C) 2015-2016 Apple Inc. All rights reserved. |
fpizlo@apple.com | a00b4d8 | 2015-10-28 23:57:04 +0000 | [diff] [blame] | 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * |
| 13 | * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY |
| 14 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 16 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR |
| 17 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 18 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 19 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 20 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 21 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | */ |
| 25 | |
ryanhaddad@apple.com | 22104f5 | 2016-09-28 17:08:17 +0000 | [diff] [blame] | 26 | #pragma once |
fpizlo@apple.com | a00b4d8 | 2015-10-28 23:57:04 +0000 | [diff] [blame] | 27 | |
| 28 | #if ENABLE(B3_JIT) |
| 29 | |
| 30 | #include "B3Value.h" |
| 31 | |
| 32 | namespace JSC { namespace B3 { |
| 33 | |
ross.kirsling@sony.com | 8e3c2ed | 2020-05-12 18:48:02 +0000 | [diff] [blame] | 34 | class JS_EXPORT_PRIVATE ConstDoubleValue final : public Value { |
fpizlo@apple.com | a00b4d8 | 2015-10-28 23:57:04 +0000 | [diff] [blame] | 35 | public: |
fpizlo@apple.com | 11fa009 | 2016-09-29 18:44:53 +0000 | [diff] [blame] | 36 | static bool accepts(Kind kind) { return kind == ConstDouble; } |
fpizlo@apple.com | a00b4d8 | 2015-10-28 23:57:04 +0000 | [diff] [blame] | 37 | |
ross.kirsling@sony.com | 8e3c2ed | 2020-05-12 18:48:02 +0000 | [diff] [blame] | 38 | ~ConstDoubleValue() final; |
fpizlo@apple.com | a00b4d8 | 2015-10-28 23:57:04 +0000 | [diff] [blame] | 39 | |
| 40 | double value() const { return m_value; } |
| 41 | |
ross.kirsling@sony.com | 8e3c2ed | 2020-05-12 18:48:02 +0000 | [diff] [blame] | 42 | Value* negConstant(Procedure&) const final; |
| 43 | Value* addConstant(Procedure&, int32_t other) const final; |
| 44 | Value* addConstant(Procedure&, const Value* other) const final; |
| 45 | Value* subConstant(Procedure&, const Value* other) const final; |
| 46 | Value* divConstant(Procedure&, const Value* other) const final; |
| 47 | Value* modConstant(Procedure&, const Value* other) const final; |
| 48 | Value* mulConstant(Procedure&, const Value* other) const final; |
| 49 | Value* bitAndConstant(Procedure&, const Value* other) const final; |
| 50 | Value* bitOrConstant(Procedure&, const Value* other) const final; |
| 51 | Value* bitXorConstant(Procedure&, const Value* other) const final; |
| 52 | Value* bitwiseCastConstant(Procedure&) const final; |
| 53 | Value* doubleToFloatConstant(Procedure&) const final; |
| 54 | Value* absConstant(Procedure&) const final; |
| 55 | Value* ceilConstant(Procedure&) const final; |
| 56 | Value* floorConstant(Procedure&) const final; |
| 57 | Value* sqrtConstant(Procedure&) const final; |
sbarati@apple.com | b424906 | 2021-12-16 23:30:22 +0000 | [diff] [blame] | 58 | Value* fMinConstant(Procedure&, const Value* other) const final; |
| 59 | Value* fMaxConstant(Procedure&, const Value* other) const final; |
fpizlo@apple.com | 2ba7f07 | 2015-11-05 21:51:05 +0000 | [diff] [blame] | 60 | |
ross.kirsling@sony.com | 8e3c2ed | 2020-05-12 18:48:02 +0000 | [diff] [blame] | 61 | TriState equalConstant(const Value* other) const final; |
| 62 | TriState notEqualConstant(const Value* other) const final; |
| 63 | TriState lessThanConstant(const Value* other) const final; |
| 64 | TriState greaterThanConstant(const Value* other) const final; |
| 65 | TriState lessEqualConstant(const Value* other) const final; |
| 66 | TriState greaterEqualConstant(const Value* other) const final; |
| 67 | TriState equalOrUnorderedConstant(const Value* other) const final; |
fpizlo@apple.com | a00b4d8 | 2015-10-28 23:57:04 +0000 | [diff] [blame] | 68 | |
rmorisset@apple.com | a28790a | 2019-04-15 23:53:23 +0000 | [diff] [blame] | 69 | B3_SPECIALIZE_VALUE_FOR_NO_CHILDREN |
fpizlo@apple.com | 8f47e9e | 2016-01-21 03:12:55 +0000 | [diff] [blame] | 70 | |
fpizlo@apple.com | a00b4d8 | 2015-10-28 23:57:04 +0000 | [diff] [blame] | 71 | private: |
| 72 | friend class Procedure; |
rmorisset@apple.com | a28790a | 2019-04-15 23:53:23 +0000 | [diff] [blame] | 73 | friend class Value; |
| 74 | |
ross.kirsling@sony.com | 8e3c2ed | 2020-05-12 18:48:02 +0000 | [diff] [blame] | 75 | void dumpMeta(CommaPrinter&, PrintStream&) const final; |
rmorisset@apple.com | a28790a | 2019-04-15 23:53:23 +0000 | [diff] [blame] | 76 | |
| 77 | static Opcode opcodeFromConstructor(Origin, double) { return ConstDouble; } |
fpizlo@apple.com | a00b4d8 | 2015-10-28 23:57:04 +0000 | [diff] [blame] | 78 | |
fpizlo@apple.com | db42314 | 2016-02-02 23:21:12 +0000 | [diff] [blame] | 79 | ConstDoubleValue(Origin origin, double value) |
rmorisset@apple.com | a28790a | 2019-04-15 23:53:23 +0000 | [diff] [blame] | 80 | : Value(CheckedOpcode, ConstDouble, Double, Zero, origin) |
fpizlo@apple.com | a00b4d8 | 2015-10-28 23:57:04 +0000 | [diff] [blame] | 81 | , m_value(value) |
| 82 | { |
| 83 | } |
| 84 | |
| 85 | double m_value; |
| 86 | }; |
| 87 | |
| 88 | } } // namespace JSC::B3 |
| 89 | |
| 90 | #endif // ENABLE(B3_JIT) |