Flutter Engine
The Flutter Engine
Namespaces | Macros | Functions
range_analysis_test.cc File Reference
#include "vm/compiler/backend/range_analysis.h"
#include "vm/compiler/backend/il_test_helper.h"
#include "vm/unit_test.h"

Go to the source code of this file.

Namespaces

namespace  dart
 

Macros

#define TEST_RANGE_OP_(Op, l_min, l_max, r_min, r_max, Clamp, res_min, res_max)
 
#define NO_CLAMP(b)   (b)
 
#define TEST_RANGE_OP(Op, l_min, l_max, r_min, r_max, result_min, result_max)
 
#define CLAMP_TO_SMI(b)   (b.Clamp(RangeBoundary::kRangeBoundarySmi))
 
#define TEST_RANGE_OP_SMI(Op, l_min, l_max, r_min, r_max, res_min, res_max)    TEST_RANGE_OP_(Op, l_min, l_max, r_min, r_max, CLAMP_TO_SMI, res_min, res_max)
 
#define TEST_RANGE_ADD(l_min, l_max, r_min, r_max, result_min, result_max)
 
#define TEST_RANGE_SUB(l_min, l_max, r_min, r_max, result_min, result_max)
 
#define TEST_RANGE_AND(l_min, l_max, r_min, r_max, result_min, result_max)
 

Functions

 dart::TEST_CASE (RangeTests)
 
 dart::TEST_CASE (RangeTestsInt64Range)
 
 dart::TEST_CASE (RangeUtils)
 
 dart::TEST_CASE (RangeBinaryOp)
 
 dart::TEST_CASE (RangeAdd)
 
 dart::TEST_CASE (RangeSub)
 
 dart::TEST_CASE (RangeAnd)
 
 dart::TEST_CASE (RangeIntersectionMinMax)
 
 dart::TEST_CASE (RangeJoinMinMax)
 
 dart::ISOLATE_UNIT_TEST_CASE (RangeAnalysis_LoadClassId)
 

Macro Definition Documentation

◆ CLAMP_TO_SMI

#define CLAMP_TO_SMI (   b)    (b.Clamp(RangeBoundary::kRangeBoundarySmi))

◆ NO_CLAMP

#define NO_CLAMP (   b)    (b)

◆ TEST_RANGE_ADD

#define TEST_RANGE_ADD (   l_min,
  l_max,
  r_min,
  r_max,
  result_min,
  result_max 
)
Value:
{ \
RangeBoundary min, max; \
Range* left_range = new Range(RangeBoundary::FromConstant(l_min), \
RangeBoundary::FromConstant(l_max)); \
Range* right_range = new Range(RangeBoundary::FromConstant(r_min), \
RangeBoundary::FromConstant(r_max)); \
EXPECT(left_range->min().ConstantValue() == l_min); \
EXPECT(left_range->max().ConstantValue() == l_max); \
EXPECT(right_range->min().ConstantValue() == r_min); \
EXPECT(right_range->max().ConstantValue() == r_max); \
Range::Add(left_range, right_range, &min, &max, nullptr); \
EXPECT(min.Equals(result_min)); \
if (FLAG_support_il_printer && !min.Equals(result_min)) { \
OS::PrintErr("%s != %s\n", min.ToCString(), result_min.ToCString()); \
} \
EXPECT(max.Equals(result_max)); \
if (FLAG_support_il_printer && !max.Equals(result_max)) { \
OS::PrintErr("%s != %s\n", max.ToCString(), result_max.ToCString()); \
} \
}
constexpr bool FLAG_support_il_printer
Definition: flag_list.h:48
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48

◆ TEST_RANGE_AND

#define TEST_RANGE_AND (   l_min,
  l_max,
  r_min,
  r_max,
  result_min,
  result_max 
)
Value:
{ \
RangeBoundary min, max; \
Range* left_range = new Range(RangeBoundary::FromConstant(l_min), \
RangeBoundary::FromConstant(l_max)); \
Range* right_range = new Range(RangeBoundary::FromConstant(r_min), \
RangeBoundary::FromConstant(r_max)); \
EXPECT(left_range->min().ConstantValue() == l_min); \
EXPECT(left_range->max().ConstantValue() == l_max); \
EXPECT(right_range->min().ConstantValue() == r_min); \
EXPECT(right_range->max().ConstantValue() == r_max); \
Range::And(left_range, right_range, &min, &max); \
EXPECT(min.Equals(result_min)); \
if (FLAG_support_il_printer && !min.Equals(result_min)) { \
OS::PrintErr("%s != %s\n", min.ToCString(), result_min.ToCString()); \
} \
EXPECT(max.Equals(result_max)); \
if (FLAG_support_il_printer && !max.Equals(result_max)) { \
OS::PrintErr("%s != %s\n", max.ToCString(), result_max.ToCString()); \
} \
}

◆ TEST_RANGE_OP

#define TEST_RANGE_OP (   Op,
  l_min,
  l_max,
  r_min,
  r_max,
  result_min,
  result_max 
)
Value:
TEST_RANGE_OP_(Op, l_min, l_max, r_min, r_max, NO_CLAMP, result_min, \
result_max)
#define TEST_RANGE_OP_(Op, l_min, l_max, r_min, r_max, Clamp, res_min, res_max)
#define NO_CLAMP(b)

◆ TEST_RANGE_OP_

#define TEST_RANGE_OP_ (   Op,
  l_min,
  l_max,
  r_min,
  r_max,
  Clamp,
  res_min,
  res_max 
)
Value:
{ \
RangeBoundary min, max; \
Range* left_range = new Range(RangeBoundary::FromConstant(l_min), \
RangeBoundary::FromConstant(l_max)); \
Range* shift_range = new Range(RangeBoundary::FromConstant(r_min), \
RangeBoundary::FromConstant(r_max)); \
Op(left_range, shift_range, &min, &max); \
min = Clamp(min); \
max = Clamp(max); \
EXPECT(min.Equals(res_min)); \
if (FLAG_support_il_printer && !min.Equals(res_min)) { \
OS::PrintErr("%s\n", min.ToCString()); \
} \
EXPECT(max.Equals(res_max)); \
if (FLAG_support_il_printer && !max.Equals(res_max)) { \
OS::PrintErr("%s\n", max.ToCString()); \
} \
}

◆ TEST_RANGE_OP_SMI

#define TEST_RANGE_OP_SMI (   Op,
  l_min,
  l_max,
  r_min,
  r_max,
  res_min,
  res_max 
)     TEST_RANGE_OP_(Op, l_min, l_max, r_min, r_max, CLAMP_TO_SMI, res_min, res_max)

◆ TEST_RANGE_SUB

#define TEST_RANGE_SUB (   l_min,
  l_max,
  r_min,
  r_max,
  result_min,
  result_max 
)
Value:
{ \
RangeBoundary min, max; \
Range* left_range = new Range(RangeBoundary::FromConstant(l_min), \
RangeBoundary::FromConstant(l_max)); \
Range* right_range = new Range(RangeBoundary::FromConstant(r_min), \
RangeBoundary::FromConstant(r_max)); \
EXPECT(left_range->min().ConstantValue() == l_min); \
EXPECT(left_range->max().ConstantValue() == l_max); \
EXPECT(right_range->min().ConstantValue() == r_min); \
EXPECT(right_range->max().ConstantValue() == r_max); \
Range::Sub(left_range, right_range, &min, &max, nullptr); \
EXPECT(min.Equals(result_min)); \
if (FLAG_support_il_printer && !min.Equals(result_min)) { \
OS::PrintErr("%s != %s\n", min.ToCString(), result_min.ToCString()); \
} \
EXPECT(max.Equals(result_max)); \
if (FLAG_support_il_printer && !max.Equals(result_max)) { \
OS::PrintErr("%s != %s\n", max.ToCString(), result_max.ToCString()); \
} \
}