9a8efd8a4e
Change-Id: I20ed35a7fb5104a9cc66bb54fa8966589c43d7f9 Reviewed-on: https://chromium-review.googlesource.com/507287 Reviewed-by: Andreas Haas <ahaas@chromium.org> Reviewed-by: Benedikt Meurer <bmeurer@chromium.org> Reviewed-by: Daniel Clifford <danno@chromium.org> Reviewed-by: Jakob Gruber <jgruber@chromium.org> Reviewed-by: Marja Hölttä <marja@chromium.org> Reviewed-by: Jochen Eisinger <jochen@chromium.org> Commit-Queue: Wiktor Garbacz <wiktorg@google.com> Cr-Commit-Position: refs/heads/master@{#45458}
38 lines
1.0 KiB
C++
38 lines
1.0 KiB
C++
// Copyright 2016 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/deoptimize-reason.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
std::ostream& operator<<(std::ostream& os, DeoptimizeReason reason) {
|
|
switch (reason) {
|
|
#define DEOPTIMIZE_REASON(Name, message) \
|
|
case DeoptimizeReason::k##Name: \
|
|
return os << #Name;
|
|
DEOPTIMIZE_REASON_LIST(DEOPTIMIZE_REASON)
|
|
#undef DEOPTIMIZE_REASON
|
|
}
|
|
UNREACHABLE();
|
|
}
|
|
|
|
size_t hash_value(DeoptimizeReason reason) {
|
|
return static_cast<uint8_t>(reason);
|
|
}
|
|
|
|
char const* DeoptimizeReasonToString(DeoptimizeReason reason) {
|
|
static char const* kDeoptimizeReasonStrings[] = {
|
|
#define DEOPTIMIZE_REASON(Name, message) message,
|
|
DEOPTIMIZE_REASON_LIST(DEOPTIMIZE_REASON)
|
|
#undef DEOPTIMIZE_REASON
|
|
};
|
|
size_t const index = static_cast<size_t>(reason);
|
|
DCHECK_LT(index, arraysize(kDeoptimizeReasonStrings));
|
|
return kDeoptimizeReasonStrings[index];
|
|
}
|
|
|
|
} // namespace internal
|
|
} // namespace v8
|