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

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

Issue 818203002: [turbofan] Turn IrOpcode::Mnemonic() into a table lookup. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 | « BUILD.gn ('k') | src/compiler/opcodes.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 #ifndef V8_COMPILER_OPCODES_H_ 5 #ifndef V8_COMPILER_OPCODES_H_
6 #define V8_COMPILER_OPCODES_H_ 6 #define V8_COMPILER_OPCODES_H_
7 7
8 // Opcodes for control operators. 8 // Opcodes for control operators.
9 #define INNER_CONTROL_OP_LIST(V) \ 9 #define INNER_CONTROL_OP_LIST(V) \
10 V(Dead) \ 10 V(Dead) \
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 #define DECLARE_OPCODE(x) k##x, 261 #define DECLARE_OPCODE(x) k##x,
262 ALL_OP_LIST(DECLARE_OPCODE) 262 ALL_OP_LIST(DECLARE_OPCODE)
263 #undef DECLARE_OPCODE 263 #undef DECLARE_OPCODE
264 kLast = -1 264 kLast = -1
265 #define COUNT_OPCODE(x) +1 265 #define COUNT_OPCODE(x) +1
266 ALL_OP_LIST(COUNT_OPCODE) 266 ALL_OP_LIST(COUNT_OPCODE)
267 #undef COUNT_OPCODE 267 #undef COUNT_OPCODE
268 }; 268 };
269 269
270 // Returns the mnemonic name of an opcode. 270 // Returns the mnemonic name of an opcode.
271 static const char* Mnemonic(Value val) { 271 static char const* Mnemonic(Value value);
272 // TODO(turbofan): make this a table lookup.
273 switch (val) {
274 #define RETURN_NAME(x) \
275 case k##x: \
276 return #x;
277 ALL_OP_LIST(RETURN_NAME)
278 #undef RETURN_NAME
279 default:
280 return "UnknownOpcode";
281 }
282 }
283 272
284 static bool IsJsOpcode(Value val) { 273 static bool IsJsOpcode(Value val) {
285 switch (val) { 274 switch (val) {
286 // TODO(turbofan): make this a range check. 275 // TODO(turbofan): make this a range check.
287 #define RETURN_NAME(x) \ 276 #define RETURN_NAME(x) \
288 case k##x: \ 277 case k##x: \
289 return true; 278 return true;
290 JS_OP_LIST(RETURN_NAME) 279 JS_OP_LIST(RETURN_NAME)
291 #undef RETURN_NAME 280 #undef RETURN_NAME
292 default: 281 default:
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 return false; 322 return false;
334 } 323 }
335 } 324 }
336 }; 325 };
337 326
338 } // namespace compiler 327 } // namespace compiler
339 } // namespace internal 328 } // namespace internal
340 } // namespace v8 329 } // namespace v8
341 330
342 #endif // V8_COMPILER_OPCODES_H_ 331 #endif // V8_COMPILER_OPCODES_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/compiler/opcodes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698