26 const Mint& mint = Mint::Cast(
i);
34 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
38 if (FLAG_trace_intrinsified_natives) {
39 OS::PrintErr(
"Integer_bitAndFromInteger %s & %s\n", right.ToCString(),
42 return left.BitOp(Token::kBIT_AND, right);
47 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
51 if (FLAG_trace_intrinsified_natives) {
52 OS::PrintErr(
"Integer_bitOrFromInteger %s | %s\n", left.ToCString(),
55 return left.BitOp(Token::kBIT_OR, right);
60 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
64 if (FLAG_trace_intrinsified_natives) {
65 OS::PrintErr(
"Integer_bitXorFromInteger %s ^ %s\n", left.ToCString(),
68 return left.BitOp(Token::kBIT_XOR, right);
73 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
77 if (FLAG_trace_intrinsified_natives) {
78 OS::PrintErr(
"Integer_addFromInteger %s + %s\n", left_int.ToCString(),
81 return left_int.ArithmeticOp(Token::kADD, right_int);
86 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
90 if (FLAG_trace_intrinsified_natives) {
91 OS::PrintErr(
"Integer_subFromInteger %s - %s\n", left_int.ToCString(),
94 return left_int.ArithmeticOp(Token::kSUB, right_int);
99 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
103 if (FLAG_trace_intrinsified_natives) {
104 OS::PrintErr(
"Integer_mulFromInteger %s * %s\n", left_int.ToCString(),
107 return left_int.ArithmeticOp(Token::kMUL, right_int);
112 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
117 return left_int.ArithmeticOp(Token::kTRUNCDIV, right_int);
122 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
126 if (FLAG_trace_intrinsified_natives) {
127 OS::PrintErr(
"Integer_moduloFromInteger %s mod %s\n", left_int.ToCString(),
134 return left_int.ArithmeticOp(Token::kMOD, right_int);
139 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
143 if (FLAG_trace_intrinsified_natives) {
144 OS::PrintErr(
"Integer_greaterThanFromInteger %s > %s\n", left.ToCString(),
151 const Integer& left = Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
155 if (FLAG_trace_intrinsified_natives) {
156 OS::PrintErr(
"Integer_equalToInteger %s == %s\n", left.ToCString(),
164 if (
value.IsOneByteString()) {
166 const intptr_t
len =
value.Length();
168 const char* cstr =
value.ToCString();
170 char* p_end =
nullptr;
171 const int64_t int_value = strtoll(cstr, &p_end, 10);
172 if (p_end == (cstr +
len)) {
173 if ((int_value != LLONG_MIN) && (int_value != LLONG_MAX)) {
194 if (!env_value.
IsNull()) {
200 return result.Canonicalize(thread);
203 return default_value.ptr();
217 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
221 if (FLAG_trace_intrinsified_natives) {
230 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
234 if (FLAG_trace_intrinsified_natives) {
243 Integer::CheckedHandle(zone, arguments->NativeArgAt(0));
247 if (FLAG_trace_intrinsified_natives) {
255 const Smi& operand = Smi::CheckedHandle(zone, arguments->NativeArgAt(0));
256 if (FLAG_trace_intrinsified_natives) {
259 intptr_t
result = ~operand.Value();
265 const Smi& operand = Smi::CheckedHandle(zone, arguments->NativeArgAt(0));
266 if (FLAG_trace_intrinsified_natives) {
278 uint64_t
value =
static_cast<uint64_t
>(ivalue);
279#if defined(ARCH_IS_64_BIT)
283 uint64_t
hash = lo ^ hi;
286 uint64_t
hash = res ^
static_cast<int64_t
>(res >> 64);
292 uint64_t value_lo32 =
value & 0xffffffff;
293 uint64_t value_hi32 =
value >> 32;
297 uint64_t prod_hi64 = ((value_hi32 *
magic_constant) >> 32) + carry;
298 uint64_t
hash = prod_hi64 ^ prod_lo64;
301 return hash & 0x3fffffff;
307 const Mint& operand = Mint::CheckedHandle(zone, arguments->NativeArgAt(0));
309 if (FLAG_trace_intrinsified_natives) {
312 int64_t
result = ~operand.value();
317 const Mint& operand = Mint::CheckedHandle(zone, arguments->NativeArgAt(0));
319 if (FLAG_trace_intrinsified_natives) {
static uint32_t hash(const SkShaderBase::GradientInfo &v)
static StringPtr GetEnvironmentValue(Thread *thread, const String &name)
static const Bool & Get(bool value)
static DART_NORETURN void ThrowArgumentError(const Instance &arg)
static IntegerPtr New(const String &str, Heap::Space space=Heap::kNew)
virtual int64_t AsInt64Value() const
virtual bool IsZero() const
virtual int64_t AsInt64Value() const
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
virtual const char * ToCString() const
static SmiPtr New(intptr_t value)
virtual int64_t AsInt64Value() const
static bool IsValid(int64_t value)
static constexpr size_t BitLength(int64_t value)
static IntegerPtr ShiftOperationHelper(Token::Kind kind, const Integer &value, const Integer &amount)
uint32_t Multiply64Hash(int64_t ivalue)
static IntegerPtr ParseInteger(const String &value)
DEFINE_NATIVE_ENTRY(List_allocate, 0, 2)
static bool CheckInteger(const Integer &i)
#define GET_NATIVE_ARGUMENT(type, name, value)
#define GET_NON_NULL_NATIVE_ARGUMENT(type, name, value)