13 case Token::kTRUNCDIV:
17 if (right.AsInt64Value() == 0) {
26 return left.ArithmeticOp(token_kind, right,
Heap::kOld);
32 if (right.AsInt64Value() >= 0) {
33 return left.ShiftOp(token_kind, right,
Heap::kOld);
41 return left.BitOp(token_kind, right,
Heap::kOld);
61 }
else if (
value.IsMint()) {
74 }
else if (
value.IsMint()) {
84 const intptr_t kTruncateBits =
105 if (!left.IsInteger() || !right.IsInteger()) {
109 const Integer& left_int = Integer::Cast(left);
110 const Integer& right_int = Integer::Cast(right);
116 const int64_t truncated =
120 result, representation,
true));
122 result, representation,
true)) {
139 if (!
value.IsInteger()) {
167 if (!
value.IsInteger()) {
198 if (representation == kUnboxedDouble) {
199 switch (token_kind) {
208 case Token::kTRUNCATE:
212 case Token::kCEILING:
218 ASSERT(representation == kUnboxedFloat);
219 switch (token_kind) {
221 return fabsf(
static_cast<float>(
value));
223 return -
static_cast<float>(
value);
224 case Token::kRECIPROCAL:
225 return 1.0f /
static_cast<float>(
value);
226 case Token::kRECIPROCAL_SQRT:
227 return sqrtf(1.0f /
static_cast<float>(
value));
229 return sqrtf(
static_cast<float>(
value));
231 return static_cast<float>(
value) *
static_cast<float>(
value);
242 if (representation == kUnboxedDouble) {
243 switch (token_kind) {
253 return fmin(left, right);
255 return fmax(left, right);
260 ASSERT(representation == kUnboxedFloat);
261 switch (token_kind) {
263 return static_cast<float>(left) +
static_cast<float>(right);
265 return static_cast<float>(left) -
static_cast<float>(right);
267 return static_cast<float>(left) *
static_cast<float>(right);
270 static_cast<float>(right));
272 return fminf(
static_cast<float>(left),
static_cast<float>(right));
274 return fmaxf(
static_cast<float>(left),
static_cast<float>(right));
282 if (!
value->BindsToConstant()) {
284 if (unbox !=
nullptr) {
305 if (constant.IsDouble()) {
306 const Double& double_constant = Double::Cast(constant);
307 *
result = Utils::SafeDoubleToInt<int64_t>(double_constant.
value());
308 return (
static_cast<double>(*
result) == double_constant.
value());
309 }
else if (constant.IsSmi()) {
310 *
result = Smi::Cast(constant).Value();
312 }
else if (constant.IsMint()) {
313 *
result = Mint::Cast(constant).value();
static int64_t TruncateTo(int64_t v, Representation r)
static IntegerPtr BitLengthEvaluate(const Object &value, Representation representation, Thread *thread)
static double EvaluateUnaryDoubleOp(const double value, Token::Kind token_kind, Representation representation)
static IntegerPtr UnaryIntegerEvaluate(const Object &value, Token::Kind token_kind, Representation representation, Thread *thread)
static IntegerPtr BinaryIntegerEvaluate(const Object &left, const Object &right, Token::Kind token_kind, bool is_truncating, Representation representation, Thread *thread)
static double EvaluateBinaryDoubleOp(const double left, const double right, Token::Kind token_kind, Representation representation)
static bool ToIntegerConstant(Value *value, int64_t *result)
static bool IsConstantRepresentable(const Object &value, Representation target_rep, bool tagged_value_must_be_smi)
static IntegerPtr New(const String &str, Heap::Space space=Heap::kNew)
static SmiPtr New(intptr_t value)
virtual Representation representation() const
static constexpr size_t BitLength(int64_t value)
static float DivideAllowZero(float a, float b)
static int64_t ShiftLeftWithTruncation(int64_t a, int64_t b)
constexpr intptr_t kSmiBits
static IntegerPtr BinaryIntegerEvaluateRaw(const Integer &left, const Integer &right, Token::Kind token_kind)
constexpr uint32_t kMaxUint32
static IntegerPtr BitLengthEvaluateRaw(const Integer &value, Zone *zone)
constexpr intptr_t kBitsPerInt32
static IntegerPtr UnaryIntegerEvaluateRaw(const Integer &value, Token::Kind token_kind, Zone *zone)
constexpr intptr_t kBitsPerInt64
SIN Vec< N, float > trunc(const Vec< N, float > &x)
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
SIN Vec< N, float > floor(const Vec< N, float > &x)
SIN Vec< N, float > ceil(const Vec< N, float > &x)