2015-12-01 09:03:10 +00:00
|
|
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2016-09-20 13:53:32 +00:00
|
|
|
#include "src/type-hints.h"
|
2015-12-01 09:03:10 +00:00
|
|
|
|
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
|
|
|
|
2016-08-09 18:11:56 +00:00
|
|
|
std::ostream& operator<<(std::ostream& os, BinaryOperationHint hint) {
|
2015-12-01 09:03:10 +00:00
|
|
|
switch (hint) {
|
2016-08-09 18:11:56 +00:00
|
|
|
case BinaryOperationHint::kNone:
|
2015-12-01 09:03:10 +00:00
|
|
|
return os << "None";
|
2016-08-09 18:11:56 +00:00
|
|
|
case BinaryOperationHint::kSignedSmall:
|
2015-12-01 09:03:10 +00:00
|
|
|
return os << "SignedSmall";
|
2016-08-09 18:11:56 +00:00
|
|
|
case BinaryOperationHint::kSigned32:
|
2015-12-01 09:03:10 +00:00
|
|
|
return os << "Signed32";
|
2016-08-09 18:11:56 +00:00
|
|
|
case BinaryOperationHint::kNumberOrOddball:
|
2016-07-13 12:59:19 +00:00
|
|
|
return os << "NumberOrOddball";
|
2016-09-20 11:00:11 +00:00
|
|
|
case BinaryOperationHint::kString:
|
|
|
|
return os << "String";
|
2016-08-09 18:11:56 +00:00
|
|
|
case BinaryOperationHint::kAny:
|
2015-12-01 09:03:10 +00:00
|
|
|
return os << "Any";
|
|
|
|
}
|
|
|
|
UNREACHABLE();
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
2016-08-09 18:11:56 +00:00
|
|
|
std::ostream& operator<<(std::ostream& os, CompareOperationHint hint) {
|
2016-06-16 06:34:48 +00:00
|
|
|
switch (hint) {
|
2016-08-09 18:11:56 +00:00
|
|
|
case CompareOperationHint::kNone:
|
2016-06-16 06:34:48 +00:00
|
|
|
return os << "None";
|
2016-08-09 18:11:56 +00:00
|
|
|
case CompareOperationHint::kSignedSmall:
|
2016-06-16 06:34:48 +00:00
|
|
|
return os << "SignedSmall";
|
2016-08-09 18:11:56 +00:00
|
|
|
case CompareOperationHint::kNumber:
|
2016-08-08 11:09:44 +00:00
|
|
|
return os << "Number";
|
2016-08-09 18:11:56 +00:00
|
|
|
case CompareOperationHint::kNumberOrOddball:
|
2016-07-13 12:59:19 +00:00
|
|
|
return os << "NumberOrOddball";
|
2016-11-17 14:45:18 +00:00
|
|
|
case CompareOperationHint::kString:
|
|
|
|
return os << "String";
|
2016-08-09 18:11:56 +00:00
|
|
|
case CompareOperationHint::kAny:
|
2016-06-16 06:34:48 +00:00
|
|
|
return os << "Any";
|
|
|
|
}
|
|
|
|
UNREACHABLE();
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
2015-12-03 16:48:06 +00:00
|
|
|
std::ostream& operator<<(std::ostream& os, ToBooleanHint hint) {
|
|
|
|
switch (hint) {
|
|
|
|
case ToBooleanHint::kNone:
|
|
|
|
return os << "None";
|
|
|
|
case ToBooleanHint::kUndefined:
|
|
|
|
return os << "Undefined";
|
|
|
|
case ToBooleanHint::kBoolean:
|
|
|
|
return os << "Boolean";
|
|
|
|
case ToBooleanHint::kNull:
|
|
|
|
return os << "Null";
|
|
|
|
case ToBooleanHint::kSmallInteger:
|
|
|
|
return os << "SmallInteger";
|
|
|
|
case ToBooleanHint::kReceiver:
|
|
|
|
return os << "Receiver";
|
|
|
|
case ToBooleanHint::kString:
|
|
|
|
return os << "String";
|
|
|
|
case ToBooleanHint::kSymbol:
|
|
|
|
return os << "Symbol";
|
|
|
|
case ToBooleanHint::kHeapNumber:
|
|
|
|
return os << "HeapNumber";
|
|
|
|
case ToBooleanHint::kSimdValue:
|
|
|
|
return os << "SimdValue";
|
|
|
|
case ToBooleanHint::kAny:
|
|
|
|
return os << "Any";
|
2016-11-11 10:50:09 +00:00
|
|
|
case ToBooleanHint::kNeedsMap:
|
|
|
|
return os << "NeedsMap";
|
2015-12-03 16:48:06 +00:00
|
|
|
}
|
|
|
|
UNREACHABLE();
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream& operator<<(std::ostream& os, ToBooleanHints hints) {
|
|
|
|
if (hints == ToBooleanHint::kAny) return os << "Any";
|
|
|
|
if (hints == ToBooleanHint::kNone) return os << "None";
|
|
|
|
bool first = true;
|
2016-08-09 18:11:56 +00:00
|
|
|
for (ToBooleanHints::mask_type i = 0; i < sizeof(i) * 8; ++i) {
|
2015-12-03 16:48:06 +00:00
|
|
|
ToBooleanHint const hint = static_cast<ToBooleanHint>(1u << i);
|
|
|
|
if (hints & hint) {
|
|
|
|
if (!first) os << "|";
|
|
|
|
first = false;
|
|
|
|
os << hint;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
2016-11-11 10:50:09 +00:00
|
|
|
std::ostream& operator<<(std::ostream& os, const StringAddFlags& flags) {
|
|
|
|
switch (flags) {
|
|
|
|
case STRING_ADD_CHECK_NONE:
|
|
|
|
return os << "CheckNone";
|
|
|
|
case STRING_ADD_CHECK_LEFT:
|
|
|
|
return os << "CheckLeft";
|
|
|
|
case STRING_ADD_CHECK_RIGHT:
|
|
|
|
return os << "CheckRight";
|
|
|
|
case STRING_ADD_CHECK_BOTH:
|
|
|
|
return os << "CheckBoth";
|
|
|
|
case STRING_ADD_CONVERT_LEFT:
|
|
|
|
return os << "ConvertLeft";
|
|
|
|
case STRING_ADD_CONVERT_RIGHT:
|
|
|
|
return os << "ConvertRight";
|
|
|
|
case STRING_ADD_CONVERT:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
UNREACHABLE();
|
|
|
|
return os;
|
|
|
|
}
|
|
|
|
|
2015-12-01 09:03:10 +00:00
|
|
|
} // namespace internal
|
|
|
|
} // namespace v8
|