v8/src/type-hints.cc
mvstanton b88d132f4c [TypeFeedbackVector] special ic slots for interpreter compare/binary ops.
Full code uses patching ICs for this feedback, and the interpreter uses
the type feedback vector. It's a good idea to code the vector slots
appropriately as ICs so that the runtime profiler can better gauge if
the function is ready for tiering up from Ignition to TurboFan.

As is, the feedback is stored in "general" slots which can't be
characterized by the runtime profiler into feedback states.

This CL addresses that problem. Note that it's also important to
carefully exclude these slots from the profiler's consideration when
determining if you want to optimize from Full code.

BUG=

Review-Url: https://codereview.chromium.org/2342853002
Cr-Commit-Position: refs/heads/master@{#39555}
2016-09-20 13:54:51 +00:00

92 lines
2.5 KiB
C++

// 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.
#include "src/type-hints.h"
namespace v8 {
namespace internal {
std::ostream& operator<<(std::ostream& os, BinaryOperationHint hint) {
switch (hint) {
case BinaryOperationHint::kNone:
return os << "None";
case BinaryOperationHint::kSignedSmall:
return os << "SignedSmall";
case BinaryOperationHint::kSigned32:
return os << "Signed32";
case BinaryOperationHint::kNumberOrOddball:
return os << "NumberOrOddball";
case BinaryOperationHint::kString:
return os << "String";
case BinaryOperationHint::kAny:
return os << "Any";
}
UNREACHABLE();
return os;
}
std::ostream& operator<<(std::ostream& os, CompareOperationHint hint) {
switch (hint) {
case CompareOperationHint::kNone:
return os << "None";
case CompareOperationHint::kSignedSmall:
return os << "SignedSmall";
case CompareOperationHint::kNumber:
return os << "Number";
case CompareOperationHint::kNumberOrOddball:
return os << "NumberOrOddball";
case CompareOperationHint::kAny:
return os << "Any";
}
UNREACHABLE();
return os;
}
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";
}
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;
for (ToBooleanHints::mask_type i = 0; i < sizeof(i) * 8; ++i) {
ToBooleanHint const hint = static_cast<ToBooleanHint>(1u << i);
if (hints & hint) {
if (!first) os << "|";
first = false;
os << hint;
}
}
return os;
}
} // namespace internal
} // namespace v8