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

Unified Diff: src/compiler/opcodes.h

Issue 426233002: Land the Fan (disabled) (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback, rebase and "git cl format" Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/node-properties-inl.h ('k') | src/compiler/operator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/opcodes.h
diff --git a/src/compiler/opcodes.h b/src/compiler/opcodes.h
new file mode 100644
index 0000000000000000000000000000000000000000..ea107c9c7da07cad6c6cb3a40a859eda8e4bc8ca
--- /dev/null
+++ b/src/compiler/opcodes.h
@@ -0,0 +1,294 @@
+// Copyright 2013 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.
+
+#ifndef V8_COMPILER_OPCODES_H_
+#define V8_COMPILER_OPCODES_H_
+
+// Opcodes for control operators.
+#define CONTROL_OP_LIST(V) \
+ V(Start) \
+ V(Dead) \
+ V(Loop) \
+ V(End) \
+ V(Branch) \
+ V(IfTrue) \
+ V(IfFalse) \
+ V(Merge) \
+ V(Return) \
+ V(Throw) \
+ V(Continuation) \
+ V(LazyDeoptimization) \
+ V(Deoptimize)
+
+// Opcodes for common operators.
+#define LEAF_OP_LIST(V) \
+ V(Parameter) \
+ V(Int32Constant) \
+ V(Int64Constant) \
+ V(Float64Constant) \
+ V(ExternalConstant) \
+ V(NumberConstant) \
+ V(HeapConstant)
+
+#define INNER_OP_LIST(V) \
+ V(Phi) \
+ V(EffectPhi) \
+ V(FrameState) \
+ V(Call) \
+ V(Projection)
+
+#define COMMON_OP_LIST(V) \
+ LEAF_OP_LIST(V) \
+ INNER_OP_LIST(V)
+
+// Opcodes for JavaScript operators.
+#define JS_COMPARE_BINOP_LIST(V) \
+ V(JSEqual) \
+ V(JSNotEqual) \
+ V(JSStrictEqual) \
+ V(JSStrictNotEqual) \
+ V(JSLessThan) \
+ V(JSGreaterThan) \
+ V(JSLessThanOrEqual) \
+ V(JSGreaterThanOrEqual)
+
+#define JS_BITWISE_BINOP_LIST(V) \
+ V(JSBitwiseOr) \
+ V(JSBitwiseXor) \
+ V(JSBitwiseAnd) \
+ V(JSShiftLeft) \
+ V(JSShiftRight) \
+ V(JSShiftRightLogical)
+
+#define JS_ARITH_BINOP_LIST(V) \
+ V(JSAdd) \
+ V(JSSubtract) \
+ V(JSMultiply) \
+ V(JSDivide) \
+ V(JSModulus)
+
+#define JS_SIMPLE_BINOP_LIST(V) \
+ JS_COMPARE_BINOP_LIST(V) \
+ JS_BITWISE_BINOP_LIST(V) \
+ JS_ARITH_BINOP_LIST(V)
+
+#define JS_LOGIC_UNOP_LIST(V) V(JSUnaryNot)
+
+#define JS_CONVERSION_UNOP_LIST(V) \
+ V(JSToBoolean) \
+ V(JSToNumber) \
+ V(JSToString) \
+ V(JSToName) \
+ V(JSToObject)
+
+#define JS_OTHER_UNOP_LIST(V) V(JSTypeOf)
+
+#define JS_SIMPLE_UNOP_LIST(V) \
+ JS_LOGIC_UNOP_LIST(V) \
+ JS_CONVERSION_UNOP_LIST(V) \
+ JS_OTHER_UNOP_LIST(V)
+
+#define JS_OBJECT_OP_LIST(V) \
+ V(JSCreate) \
+ V(JSLoadProperty) \
+ V(JSLoadNamed) \
+ V(JSStoreProperty) \
+ V(JSStoreNamed) \
+ V(JSDeleteProperty) \
+ V(JSHasProperty) \
+ V(JSInstanceOf)
+
+#define JS_CONTEXT_OP_LIST(V) \
+ V(JSLoadContext) \
+ V(JSStoreContext) \
+ V(JSCreateFunctionContext) \
+ V(JSCreateCatchContext) \
+ V(JSCreateWithContext) \
+ V(JSCreateBlockContext) \
+ V(JSCreateModuleContext) \
+ V(JSCreateGlobalContext)
+
+#define JS_OTHER_OP_LIST(V) \
+ V(JSCallConstruct) \
+ V(JSCallFunction) \
+ V(JSCallRuntime) \
+ V(JSYield) \
+ V(JSDebugger)
+
+#define JS_OP_LIST(V) \
+ JS_SIMPLE_BINOP_LIST(V) \
+ JS_SIMPLE_UNOP_LIST(V) \
+ JS_OBJECT_OP_LIST(V) \
+ JS_CONTEXT_OP_LIST(V) \
+ JS_OTHER_OP_LIST(V)
+
+// Opcodes for VirtuaMachine-level operators.
+#define SIMPLIFIED_OP_LIST(V) \
+ V(BooleanNot) \
+ V(NumberEqual) \
+ V(NumberLessThan) \
+ V(NumberLessThanOrEqual) \
+ V(NumberAdd) \
+ V(NumberSubtract) \
+ V(NumberMultiply) \
+ V(NumberDivide) \
+ V(NumberModulus) \
+ V(NumberToInt32) \
+ V(NumberToUint32) \
+ V(ReferenceEqual) \
+ V(StringEqual) \
+ V(StringLessThan) \
+ V(StringLessThanOrEqual) \
+ V(StringAdd) \
+ V(ChangeTaggedToInt32) \
+ V(ChangeTaggedToUint32) \
+ V(ChangeTaggedToFloat64) \
+ V(ChangeInt32ToTagged) \
+ V(ChangeUint32ToTagged) \
+ V(ChangeFloat64ToTagged) \
+ V(ChangeBoolToBit) \
+ V(ChangeBitToBool) \
+ V(LoadField) \
+ V(LoadElement) \
+ V(StoreField) \
+ V(StoreElement)
+
+// Opcodes for Machine-level operators.
+#define MACHINE_OP_LIST(V) \
+ V(Load) \
+ V(Store) \
+ V(Word32And) \
+ V(Word32Or) \
+ V(Word32Xor) \
+ V(Word32Shl) \
+ V(Word32Shr) \
+ V(Word32Sar) \
+ V(Word32Equal) \
+ V(Word64And) \
+ V(Word64Or) \
+ V(Word64Xor) \
+ V(Word64Shl) \
+ V(Word64Shr) \
+ V(Word64Sar) \
+ V(Word64Equal) \
+ V(Int32Add) \
+ V(Int32Sub) \
+ V(Int32Mul) \
+ V(Int32Div) \
+ V(Int32UDiv) \
+ V(Int32Mod) \
+ V(Int32UMod) \
+ V(Int32LessThan) \
+ V(Int32LessThanOrEqual) \
+ V(Uint32LessThan) \
+ V(Uint32LessThanOrEqual) \
+ V(Int64Add) \
+ V(Int64Sub) \
+ V(Int64Mul) \
+ V(Int64Div) \
+ V(Int64UDiv) \
+ V(Int64Mod) \
+ V(Int64UMod) \
+ V(Int64LessThan) \
+ V(Int64LessThanOrEqual) \
+ V(ConvertInt64ToInt32) \
+ V(ConvertInt32ToInt64) \
+ V(ConvertInt32ToFloat64) \
+ V(ConvertUint32ToFloat64) \
+ V(ConvertFloat64ToInt32) \
+ V(ConvertFloat64ToUint32) \
+ V(Float64Add) \
+ V(Float64Sub) \
+ V(Float64Mul) \
+ V(Float64Div) \
+ V(Float64Mod) \
+ V(Float64Equal) \
+ V(Float64LessThan) \
+ V(Float64LessThanOrEqual)
+
+#define VALUE_OP_LIST(V) \
+ COMMON_OP_LIST(V) \
+ SIMPLIFIED_OP_LIST(V) \
+ MACHINE_OP_LIST(V) \
+ JS_OP_LIST(V)
+
+// The combination of all operators at all levels and the common operators.
+#define ALL_OP_LIST(V) \
+ CONTROL_OP_LIST(V) \
+ VALUE_OP_LIST(V)
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+// Declare an enumeration with all the opcodes at all levels so that they
+// can be globally, uniquely numbered.
+class IrOpcode {
+ public:
+ enum Value {
+#define DECLARE_OPCODE(x) k##x,
+ ALL_OP_LIST(DECLARE_OPCODE)
+#undef DECLARE_OPCODE
+ kLast = -1
+#define COUNT_OPCODE(x) +1
+ ALL_OP_LIST(COUNT_OPCODE)
+#undef COUNT_OPCODE
+ };
+
+ // Returns the mnemonic name of an opcode.
+ static const char* Mnemonic(Value val) {
+ switch (val) {
+#define RETURN_NAME(x) \
+ case k##x: \
+ return #x;
+ ALL_OP_LIST(RETURN_NAME)
+#undef RETURN_NAME
+ default:
+ return "UnknownOpcode";
+ }
+ }
+
+ static bool IsJsOpcode(Value val) {
+ switch (val) {
+#define RETURN_NAME(x) \
+ case k##x: \
+ return true;
+ JS_OP_LIST(RETURN_NAME)
+#undef RETURN_NAME
+ default:
+ return false;
+ }
+ }
+
+ static bool IsControlOpcode(Value val) {
+ switch (val) {
+#define RETURN_NAME(x) \
+ case k##x: \
+ return true;
+ CONTROL_OP_LIST(RETURN_NAME)
+#undef RETURN_NAME
+ default:
+ return false;
+ }
+ }
+
+ static bool IsCommonOpcode(Value val) {
+ switch (val) {
+#define RETURN_NAME(x) \
+ case k##x: \
+ return true;
+ CONTROL_OP_LIST(RETURN_NAME)
+ COMMON_OP_LIST(RETURN_NAME)
+#undef RETURN_NAME
+ default:
+ return false;
+ }
+ }
+};
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
+
+#endif // V8_COMPILER_OPCODES_H_
« no previous file with comments | « src/compiler/node-properties-inl.h ('k') | src/compiler/operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698