Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(533)

Side by Side Diff: src/compiler/opcodes.cc

Issue 1147973002: [turbofan] Add streaming operator for opcodes to ease debugging. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/compiler/opcodes.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/opcodes.h" 5 #include "src/compiler/opcodes.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream>
8 9
9 #include "src/base/macros.h" 10 #include "src/base/macros.h"
10 11
11 namespace v8 { 12 namespace v8 {
12 namespace internal { 13 namespace internal {
13 namespace compiler { 14 namespace compiler {
14 15
15 namespace { 16 namespace {
16 17
17 char const* const kMnemonics[] = { 18 char const* const kMnemonics[] = {
18 #define DECLARE_MNEMONIC(x) #x, 19 #define DECLARE_MNEMONIC(x) #x,
19 ALL_OP_LIST(DECLARE_MNEMONIC) 20 ALL_OP_LIST(DECLARE_MNEMONIC)
20 #undef DECLARE_MNEMONIC 21 #undef DECLARE_MNEMONIC
21 "UnknownOpcode"}; 22 "UnknownOpcode"};
22 23
23 } // namespace 24 } // namespace
24 25
25 26
26 // static 27 // static
27 char const* IrOpcode::Mnemonic(Value value) { 28 char const* IrOpcode::Mnemonic(Value value) {
28 size_t const n = std::min<size_t>(value, arraysize(kMnemonics) - 1); 29 size_t const n = std::min<size_t>(value, arraysize(kMnemonics) - 1);
29 return kMnemonics[n]; 30 return kMnemonics[n];
30 } 31 }
31 32
33
34 std::ostream& operator<<(std::ostream& os, IrOpcode::Value opcode) {
35 return os << IrOpcode::Mnemonic(opcode);
36 }
37
32 } // namespace compiler 38 } // namespace compiler
33 } // namespace internal 39 } // namespace internal
34 } // namespace v8 40 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/opcodes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698