blob: 7cf983861cbf0c395a88026bbddb9066d786da2f [file] [log] [blame]
// Copyright 2014 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/bailout-reason.h"
#include "src/base/logging.h"
namespace v8 {
namespace internal {
#define ERROR_MESSAGES_TEXTS(C, T) T,
const char* GetBailoutReason(BailoutReason reason) {
DCHECK_LT(reason, BailoutReason::kLastErrorMessage);
DCHECK_GE(reason, BailoutReason::kNoReason);
static const char* error_messages_[] = {
BAILOUT_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)};
return error_messages_[static_cast<int>(reason)];
}
const char* GetAbortReason(AbortReason reason) {
DCHECK_LT(reason, AbortReason::kLastErrorMessage);
DCHECK_GE(reason, AbortReason::kNoReason);
static const char* error_messages_[] = {
ABORT_MESSAGES_LIST(ERROR_MESSAGES_TEXTS)};
return error_messages_[static_cast<int>(reason)];
}
#undef ERROR_MESSAGES_TEXTS
} // namespace internal
} // namespace v8