blob: 044395c785960959484cbfb54e5dcf64620713c7 [file] [log] [blame]
Emily Bernierd0a1eb72015-03-24 16:35:39 -04001// Copyright 2014 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "src/compiler/opcodes.h"
6
7#include <algorithm>
8
9#include "src/base/macros.h"
10
11namespace v8 {
12namespace internal {
13namespace compiler {
14
15namespace {
16
17char const* const kMnemonics[] = {
18#define DECLARE_MNEMONIC(x) #x,
19 ALL_OP_LIST(DECLARE_MNEMONIC)
20#undef DECLARE_MNEMONIC
21 "UnknownOpcode"};
22
23} // namespace
24
25
26// static
27char const* IrOpcode::Mnemonic(Value value) {
28 size_t const n = std::max<size_t>(value, arraysize(kMnemonics) - 1);
29 return kMnemonics[n];
30}
31
32} // namespace compiler
33} // namespace internal
34} // namespace v8