Merge V8 5.3.332.45. DO NOT MERGE
Test: Manual
FPIIM-449
Change-Id: Id3254828b068abdea3cb10442e0172a8c9a98e03
(cherry picked from commit 13e2dadd00298019ed862f2b2fc5068bba730bcf)
diff --git a/src/interpreter/bytecode-traits.h b/src/interpreter/bytecode-traits.h
index e7d1432..ea3d5d4 100644
--- a/src/interpreter/bytecode-traits.h
+++ b/src/interpreter/bytecode-traits.h
@@ -30,13 +30,15 @@
template <OperandType>
struct OperandTraits {
- typedef OperandTypeInfoTraits<OperandTypeInfo::kNone> TypeInfo;
+ typedef OperandTypeInfoTraits<OperandTypeInfo::kNone> TypeInfoTraits;
+ static const OperandTypeInfo kOperandTypeInfo = OperandTypeInfo::kNone;
};
-#define DECLARE_OPERAND_TYPE_TRAITS(Name, InfoType) \
- template <> \
- struct OperandTraits<OperandType::k##Name> { \
- typedef OperandTypeInfoTraits<InfoType> TypeInfo; \
+#define DECLARE_OPERAND_TYPE_TRAITS(Name, InfoType) \
+ template <> \
+ struct OperandTraits<OperandType::k##Name> { \
+ typedef OperandTypeInfoTraits<InfoType> TypeInfoTraits; \
+ static const OperandTypeInfo kOperandTypeInfo = InfoType; \
};
OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE_TRAITS)
#undef DECLARE_OPERAND_TYPE_TRAITS
@@ -57,8 +59,8 @@
};
static const int kSize =
- Helper<OperandTraits<operand_type>::TypeInfo::kIsScalable,
- OperandTraits<operand_type>::TypeInfo::kUnscaledSize,
+ Helper<OperandTraits<operand_type>::TypeInfoTraits::kIsScalable,
+ OperandTraits<operand_type>::TypeInfoTraits::kUnscaledSize,
operand_scale>::kSize;
static const OperandSize kOperandSize = static_cast<OperandSize>(kSize);
};
@@ -89,7 +91,16 @@
return operand_types;
}
- static OperandSize GetOperandSize(int i, OperandScale operand_scale) {
+ static const OperandTypeInfo* GetOperandTypeInfos() {
+ static const OperandTypeInfo operand_type_infos[] = {
+ OperandTraits<operand_0>::kOperandTypeInfo,
+ OperandTraits<operand_1>::kOperandTypeInfo,
+ OperandTraits<operand_2>::kOperandTypeInfo,
+ OperandTraits<operand_3>::kOperandTypeInfo, OperandTypeInfo::kNone};
+ return operand_type_infos;
+ }
+
+ static const OperandSize* GetOperandSizes(OperandScale operand_scale) {
switch (operand_scale) {
#define CASE(Name, _) \
case OperandScale::k##Name: { \
@@ -99,14 +110,13 @@
OperandScaler<operand_2, OperandScale::k##Name>::kOperandSize, \
OperandScaler<operand_3, OperandScale::k##Name>::kOperandSize, \
}; \
- DCHECK_LT(static_cast<size_t>(i), arraysize(kOperandSizes)); \
- return kOperandSizes[i]; \
+ return kOperandSizes; \
}
OPERAND_SCALE_LIST(CASE)
#undef CASE
}
UNREACHABLE();
- return OperandSize::kNone;
+ return nullptr;
}
template <OperandType ot>
@@ -116,10 +126,10 @@
}
static inline bool IsScalable() {
- return (OperandTraits<operand_0>::TypeInfo::kIsScalable |
- OperandTraits<operand_1>::TypeInfo::kIsScalable |
- OperandTraits<operand_2>::TypeInfo::kIsScalable |
- OperandTraits<operand_3>::TypeInfo::kIsScalable);
+ return (OperandTraits<operand_0>::TypeInfoTraits::kIsScalable |
+ OperandTraits<operand_1>::TypeInfoTraits::kIsScalable |
+ OperandTraits<operand_2>::TypeInfoTraits::kIsScalable |
+ OperandTraits<operand_3>::TypeInfoTraits::kIsScalable);
}
static const AccumulatorUse kAccumulatorUse = accumulator_use;
@@ -145,7 +155,15 @@
return operand_types;
}
- static OperandSize GetOperandSize(int i, OperandScale operand_scale) {
+ static const OperandTypeInfo* GetOperandTypeInfos() {
+ static const OperandTypeInfo operand_type_infos[] = {
+ OperandTraits<operand_0>::kOperandTypeInfo,
+ OperandTraits<operand_1>::kOperandTypeInfo,
+ OperandTraits<operand_2>::kOperandTypeInfo, OperandTypeInfo::kNone};
+ return operand_type_infos;
+ }
+
+ static const OperandSize* GetOperandSizes(OperandScale operand_scale) {
switch (operand_scale) {
#define CASE(Name, _) \
case OperandScale::k##Name: { \
@@ -154,14 +172,13 @@
OperandScaler<operand_1, OperandScale::k##Name>::kOperandSize, \
OperandScaler<operand_2, OperandScale::k##Name>::kOperandSize, \
}; \
- DCHECK_LT(static_cast<size_t>(i), arraysize(kOperandSizes)); \
- return kOperandSizes[i]; \
+ return kOperandSizes; \
}
OPERAND_SCALE_LIST(CASE)
#undef CASE
}
UNREACHABLE();
- return OperandSize::kNone;
+ return nullptr;
}
template <OperandType ot>
@@ -170,9 +187,9 @@
}
static inline bool IsScalable() {
- return (OperandTraits<operand_0>::TypeInfo::kIsScalable |
- OperandTraits<operand_1>::TypeInfo::kIsScalable |
- OperandTraits<operand_2>::TypeInfo::kIsScalable);
+ return (OperandTraits<operand_0>::TypeInfoTraits::kIsScalable |
+ OperandTraits<operand_1>::TypeInfoTraits::kIsScalable |
+ OperandTraits<operand_2>::TypeInfoTraits::kIsScalable);
}
static const AccumulatorUse kAccumulatorUse = accumulator_use;
@@ -196,7 +213,14 @@
return operand_types;
}
- static OperandSize GetOperandSize(int i, OperandScale operand_scale) {
+ static const OperandTypeInfo* GetOperandTypeInfos() {
+ static const OperandTypeInfo operand_type_infos[] = {
+ OperandTraits<operand_0>::kOperandTypeInfo,
+ OperandTraits<operand_1>::kOperandTypeInfo, OperandTypeInfo::kNone};
+ return operand_type_infos;
+ }
+
+ static const OperandSize* GetOperandSizes(OperandScale operand_scale) {
switch (operand_scale) {
#define CASE(Name, _) \
case OperandScale::k##Name: { \
@@ -204,14 +228,13 @@
OperandScaler<operand_0, OperandScale::k##Name>::kOperandSize, \
OperandScaler<operand_1, OperandScale::k##Name>::kOperandSize, \
}; \
- DCHECK_LT(static_cast<size_t>(i), arraysize(kOperandSizes)); \
- return kOperandSizes[i]; \
+ return kOperandSizes; \
}
OPERAND_SCALE_LIST(CASE)
#undef CASE
}
UNREACHABLE();
- return OperandSize::kNone;
+ return nullptr;
}
template <OperandType ot>
@@ -220,8 +243,8 @@
}
static inline bool IsScalable() {
- return (OperandTraits<operand_0>::TypeInfo::kIsScalable |
- OperandTraits<operand_1>::TypeInfo::kIsScalable);
+ return (OperandTraits<operand_0>::TypeInfoTraits::kIsScalable |
+ OperandTraits<operand_1>::TypeInfoTraits::kIsScalable);
}
static const AccumulatorUse kAccumulatorUse = accumulator_use;
@@ -241,21 +264,26 @@
return operand_types;
}
- static OperandSize GetOperandSize(int i, OperandScale operand_scale) {
+ static const OperandTypeInfo* GetOperandTypeInfos() {
+ static const OperandTypeInfo operand_type_infos[] = {
+ OperandTraits<operand_0>::kOperandTypeInfo, OperandTypeInfo::kNone};
+ return operand_type_infos;
+ }
+
+ static const OperandSize* GetOperandSizes(OperandScale operand_scale) {
switch (operand_scale) {
#define CASE(Name, _) \
case OperandScale::k##Name: { \
static const OperandSize kOperandSizes[] = { \
OperandScaler<operand_0, OperandScale::k##Name>::kOperandSize, \
}; \
- DCHECK_LT(static_cast<size_t>(i), arraysize(kOperandSizes)); \
- return kOperandSizes[i]; \
+ return kOperandSizes; \
}
OPERAND_SCALE_LIST(CASE)
#undef CASE
}
UNREACHABLE();
- return OperandSize::kNone;
+ return nullptr;
}
template <OperandType ot>
@@ -264,7 +292,7 @@
}
static inline bool IsScalable() {
- return OperandTraits<operand_0>::TypeInfo::kIsScalable;
+ return OperandTraits<operand_0>::TypeInfoTraits::kIsScalable;
}
static const AccumulatorUse kAccumulatorUse = accumulator_use;
@@ -282,9 +310,14 @@
return operand_types;
}
- static OperandSize GetOperandSize(int i, OperandScale operand_scale) {
- UNREACHABLE();
- return OperandSize::kNone;
+ static const OperandTypeInfo* GetOperandTypeInfos() {
+ static const OperandTypeInfo operand_type_infos[] = {
+ OperandTypeInfo::kNone};
+ return operand_type_infos;
+ }
+
+ static const OperandSize* GetOperandSizes(OperandScale operand_scale) {
+ return nullptr;
}
template <OperandType ot>