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

Side by Side Diff: runtime/vm/constants_dbc.h

Issue 2481873005: clang-format runtime/vm (Closed)
Patch Set: Merge Created 4 years, 1 month 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 | « runtime/vm/constants_arm64.h ('k') | runtime/vm/constants_ia32.h » ('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 (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef RUNTIME_VM_CONSTANTS_DBC_H_ 5 #ifndef RUNTIME_VM_CONSTANTS_DBC_H_
6 #define RUNTIME_VM_CONSTANTS_DBC_H_ 6 #define RUNTIME_VM_CONSTANTS_DBC_H_
7 7
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
11 11
12 12
13 namespace dart { 13 namespace dart {
14 14
15 // clang-format off
15 // List of Dart Bytecode instructions. 16 // List of Dart Bytecode instructions.
16 // 17 //
17 // INTERPRETER STATE 18 // INTERPRETER STATE
18 // 19 //
19 // current frame info (see stack_frame_dbc.h for layout) 20 // current frame info (see stack_frame_dbc.h for layout)
20 // v-----^-----v 21 // v-----^-----v
21 // ~----+----~ ~----+-------+-------+-~ ~-+-------+-------+-~ 22 // ~----+----~ ~----+-------+-------+-~ ~-+-------+-------+-~
22 // ~ | ~ ~ | FP[0] | FP[1] | ~ ~ | SP[-1]| SP[0] | 23 // ~ | ~ ~ | FP[0] | FP[1] | ~ ~ | SP[-1]| SP[0] |
23 // ~----+----~ ~----+-------+-------+-~ ~-+-------+-------+-~ 24 // ~----+----~ ~----+-------+-------+-~ ~-+-------+-------+-~
24 // ^ ^ 25 // ^ ^
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 V(TestSmi, A_D, reg, reg, ___) \ 816 V(TestSmi, A_D, reg, reg, ___) \
816 V(TestCids, A_D, reg, num, ___) \ 817 V(TestCids, A_D, reg, num, ___) \
817 V(CheckSmi, A, reg, ___, ___) \ 818 V(CheckSmi, A, reg, ___, ___) \
818 V(CheckEitherNonSmi, A_D, reg, reg, ___) \ 819 V(CheckEitherNonSmi, A_D, reg, reg, ___) \
819 V(CheckClassId, A_D, reg, num, ___) \ 820 V(CheckClassId, A_D, reg, num, ___) \
820 V(CheckDenseSwitch, A_D, reg, num, ___) \ 821 V(CheckDenseSwitch, A_D, reg, num, ___) \
821 V(CheckCids, A_B_C, reg, num, num) \ 822 V(CheckCids, A_B_C, reg, num, num) \
822 V(CheckStack, 0, ___, ___, ___) \ 823 V(CheckStack, 0, ___, ___, ___) \
823 V(DebugStep, 0, ___, ___, ___) \ 824 V(DebugStep, 0, ___, ___, ___) \
824 V(DebugBreak, A, num, ___, ___) \ 825 V(DebugBreak, A, num, ___, ___) \
825 V(Deopt, A_D, num, num, ___) \ 826 V(Deopt, A_D, num, num, ___)
827
828 // clang-format on
826 829
827 typedef uint32_t Instr; 830 typedef uint32_t Instr;
828 831
829 class Bytecode { 832 class Bytecode {
830 public: 833 public:
831 enum Opcode { 834 enum Opcode {
832 #define DECLARE_BYTECODE(name, encoding, op1, op2, op3) k##name, 835 #define DECLARE_BYTECODE(name, encoding, op1, op2, op3) k##name,
833 BYTECODES_LIST(DECLARE_BYTECODE) 836 BYTECODES_LIST(DECLARE_BYTECODE)
834 #undef DECLARE_BYTECODE 837 #undef DECLARE_BYTECODE
835 }; 838 };
836 839
837 static const intptr_t kOpShift = 0; 840 static const intptr_t kOpShift = 0;
838 static const intptr_t kAShift = 8; 841 static const intptr_t kAShift = 8;
839 static const intptr_t kAMask = 0xFF; 842 static const intptr_t kAMask = 0xFF;
840 static const intptr_t kBShift = 16; 843 static const intptr_t kBShift = 16;
841 static const intptr_t kBMask = 0xFF; 844 static const intptr_t kBMask = 0xFF;
842 static const intptr_t kCShift = 24; 845 static const intptr_t kCShift = 24;
843 static const intptr_t kCMask = 0xFF; 846 static const intptr_t kCMask = 0xFF;
(...skipping 17 matching lines...) Expand all
861 ASSERT((a & kAMask) == a); 864 ASSERT((a & kAMask) == a);
862 ASSERT((x << kDShift) >> kDShift == x); 865 ASSERT((x << kDShift) >> kDShift == x);
863 return op | (a << kAShift) | (x << kDShift); 866 return op | (a << kAShift) | (x << kDShift);
864 } 867 }
865 868
866 static Instr EncodeSigned(Opcode op, intptr_t x) { 869 static Instr EncodeSigned(Opcode op, intptr_t x) {
867 ASSERT((x << kAShift) >> kAShift == x); 870 ASSERT((x << kAShift) >> kAShift == x);
868 return op | (x << kAShift); 871 return op | (x << kAShift);
869 } 872 }
870 873
871 static Instr Encode(Opcode op) { 874 static Instr Encode(Opcode op) { return op; }
872 return op;
873 }
874 875
875 DART_FORCE_INLINE static uint8_t DecodeA(Instr bc) { 876 DART_FORCE_INLINE static uint8_t DecodeA(Instr bc) {
876 return (bc >> kAShift) & kAMask; 877 return (bc >> kAShift) & kAMask;
877 } 878 }
878 879
879 DART_FORCE_INLINE static uint16_t DecodeD(Instr bc) { 880 DART_FORCE_INLINE static uint16_t DecodeD(Instr bc) {
880 return (bc >> kDShift) & kDMask; 881 return (bc >> kDShift) & kDMask;
881 } 882 }
882 883
883 DART_FORCE_INLINE static Opcode DecodeOpcode(Instr bc) { 884 DART_FORCE_INLINE static Opcode DecodeOpcode(Instr bc) {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 961
961 // After a comparison, the condition NEXT_IS_TRUE means the following 962 // After a comparison, the condition NEXT_IS_TRUE means the following
962 // instruction is executed if the comparision is true and skipped over overwise. 963 // instruction is executed if the comparision is true and skipped over overwise.
963 // Conidition NEXT_IS_FALSE means the following instruction is executed if the 964 // Conidition NEXT_IS_FALSE means the following instruction is executed if the
964 // comparison is false and skipped over otherwise. 965 // comparison is false and skipped over otherwise.
965 enum Condition { NEXT_IS_TRUE, NEXT_IS_FALSE }; 966 enum Condition { NEXT_IS_TRUE, NEXT_IS_FALSE };
966 967
967 } // namespace dart 968 } // namespace dart
968 969
969 #endif // RUNTIME_VM_CONSTANTS_DBC_H_ 970 #endif // RUNTIME_VM_CONSTANTS_DBC_H_
OLDNEW
« no previous file with comments | « runtime/vm/constants_arm64.h ('k') | runtime/vm/constants_ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698