OLD | NEW |
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/assert.h" | 8 #include "platform/assert.h" |
9 #include "platform/globals.h" | 9 #include "platform/globals.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 // Load value at index D from constant pool into FP[rA] or push it onto the | 139 // Load value at index D from constant pool into FP[rA] or push it onto the |
140 // stack. | 140 // stack. |
141 // | 141 // |
142 // - StoreLocal rX; PopLocal rX | 142 // - StoreLocal rX; PopLocal rX |
143 // | 143 // |
144 // Store top of the stack into FP[rX] and pop it if needed. | 144 // Store top of the stack into FP[rX] and pop it if needed. |
145 // | 145 // |
146 // - StaticCall ArgC, D | 146 // - StaticCall ArgC, D |
147 // | 147 // |
148 // Invoke function in SP[0] with arguments SP[-(1+ArgC)], ..., SP[-1] and | 148 // Invoke function in SP[0] with arguments SP[-(1+ArgC)], ..., SP[-1] and |
149 // argument descriptor PP[D]. | 149 // argument descriptor PP[D], which indicates whether the first argument |
| 150 // is a type argument vector. |
150 // | 151 // |
151 // - IndirectStaticCall ArgC, D | 152 // - IndirectStaticCall ArgC, D |
152 // | 153 // |
153 // Invoke the function given by the ICData in SP[0] with arguments | 154 // Invoke the function given by the ICData in SP[0] with arguments |
154 // SP[-(1+ArgC)], ..., SP[-1] and argument descriptor PP[D]. | 155 // SP[-(1+ArgC)], ..., SP[-1] and argument descriptor PP[D], which |
| 156 // indicates whether the first argument is a type argument vector. |
155 // | 157 // |
156 // - InstanceCall<N> ArgC, D; InstanceCall<N>Opt ArgC, D | 158 // - InstanceCall<N> ArgC, D; InstanceCall<N>Opt ArgC, D |
157 // | 159 // |
158 // Lookup and invoke method with N checked arguments using ICData in PP[D] | 160 // Lookup and invoke method with N checked arguments using ICData in PP[D] |
159 // with arguments SP[-(1+ArgC)], ..., SP[-1]. | 161 // with arguments SP[-(1+ArgC)], ..., SP[-1]. |
| 162 // The ICData indicates whether the first argument is a type argument vector. |
160 // | 163 // |
161 // - NativeBootstrapCall, NativeNoScopeCall, NativeAutoScopeCall | 164 // - NativeBootstrapCall, NativeNoScopeCall, NativeAutoScopeCall |
162 // | 165 // |
163 // Invoke native function SP[-1] with argc_tag SP[0]. | 166 // Invoke native function SP[-1] with argc_tag SP[0]. |
164 // | 167 // |
165 // - PushPolymorphicInstanceCall ArgC, D | 168 // - PushPolymorphicInstanceCall ArgC, D |
166 // | 169 // |
167 // Skips 2*D + 1 instructions and pushes a function object onto the stack | 170 // Skips 2*D + 1 instructions and pushes a function object onto the stack |
168 // if one can be found as follows. Otherwise skips only 2*D instructions. | 171 // if one can be found as follows. Otherwise skips only 2*D instructions. |
169 // The function is looked up in the IC data encoded in the following 2*D | 172 // The function is looked up in the IC data encoded in the following 2*D |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 // prologues are implemented on other architectures. | 488 // prologues are implemented on other architectures. |
486 // | 489 // |
487 // Note: Unlike Entry bytecode EntryOptional does not setup the frame for | 490 // Note: Unlike Entry bytecode EntryOptional does not setup the frame for |
488 // local variables this is done by a separate bytecode Frame. | 491 // local variables this is done by a separate bytecode Frame. |
489 // | 492 // |
490 // - EntryOptimized A, D | 493 // - EntryOptimized A, D |
491 // | 494 // |
492 // Function prologue for optimized functions with no optional or named | 495 // Function prologue for optimized functions with no optional or named |
493 // arguments. | 496 // arguments. |
494 // A - expected number of positional arguments; | 497 // A - expected number of positional arguments; |
495 // B - number of local slots to reserve for registers; | 498 // D - number of local slots to reserve for registers; |
496 // | 499 // |
497 // Note: reserved slots are not initialized because optimized code | 500 // Note: reserved slots are not initialized because optimized code |
498 // has stack maps attached to call sites. | 501 // has stack maps attached to call sites. |
499 // | 502 // |
500 // - HotCheck A, D | 503 // - HotCheck A, D |
501 // | 504 // |
502 // Increment current function's usage counter by A and check if it | 505 // Increment current function's usage counter by A and check if it |
503 // exceeds D. If it does trigger (re)optimization of the current | 506 // exceeds D. If it does trigger (re)optimization of the current |
504 // function. | 507 // function. |
505 // | 508 // |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 // 1, or if FP[rA]'s cid is found in the array of cid ranges encoded by the | 617 // 1, or if FP[rA]'s cid is found in the array of cid ranges encoded by the |
615 // following rC Nop instructions. The cid ranges from a inclusive to b | 618 // following rC Nop instructions. The cid ranges from a inclusive to b |
616 // exclusive are coded in pairs of (a, b - a). Otherwise skips only 2 | 619 // exclusive are coded in pairs of (a, b - a). Otherwise skips only 2 |
617 // instructions. | 620 // instructions. |
618 // | 621 // |
619 // - CheckStack | 622 // - CheckStack |
620 // | 623 // |
621 // Compare SP against isolate stack limit and call StackOverflow handler if | 624 // Compare SP against isolate stack limit and call StackOverflow handler if |
622 // necessary. | 625 // necessary. |
623 // | 626 // |
| 627 // - CheckStackAlwaysExit |
| 628 // |
| 629 // Unconditionally call StackOverflow handler. |
| 630 // |
| 631 // - CheckFunctionTypeArgs A, D |
| 632 // |
| 633 // Check for a passed-in type argument vector of length A and |
| 634 // store it at FP[D]. |
| 635 // |
624 // - DebugStep, DebugBreak A | 636 // - DebugStep, DebugBreak A |
625 // | 637 // |
626 // Debugger support. DebugBreak is bytecode that can be patched into the | 638 // Debugger support. DebugBreak is bytecode that can be patched into the |
627 // instruction stream to trigger in place breakpoint. | 639 // instruction stream to trigger in place breakpoint. |
628 // | 640 // |
629 // When patching instance or static call with DebugBreak we set A to | 641 // When patching instance or static call with DebugBreak we set A to |
630 // match patched call's argument count so that Return instructions continue | 642 // match patched call's argument count so that Return instructions continue |
631 // to work. | 643 // to work. |
632 // | 644 // |
633 // TODO(vegorov) the way we replace calls with DebugBreak does not work | 645 // TODO(vegorov) the way we replace calls with DebugBreak does not work |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 V(TestCids, A_D, reg, num, ___) \ | 857 V(TestCids, A_D, reg, num, ___) \ |
846 V(CheckSmi, A, reg, ___, ___) \ | 858 V(CheckSmi, A, reg, ___, ___) \ |
847 V(CheckEitherNonSmi, A_D, reg, reg, ___) \ | 859 V(CheckEitherNonSmi, A_D, reg, reg, ___) \ |
848 V(CheckClassId, A_D, reg, num, ___) \ | 860 V(CheckClassId, A_D, reg, num, ___) \ |
849 V(CheckClassIdRange, A_D, reg, num, ___) \ | 861 V(CheckClassIdRange, A_D, reg, num, ___) \ |
850 V(CheckBitTest, A_D, reg, num, ___) \ | 862 V(CheckBitTest, A_D, reg, num, ___) \ |
851 V(CheckCids, A_B_C, reg, num, num) \ | 863 V(CheckCids, A_B_C, reg, num, num) \ |
852 V(CheckCidsByRange, A_B_C, reg, num, num) \ | 864 V(CheckCidsByRange, A_B_C, reg, num, num) \ |
853 V(CheckStack, 0, ___, ___, ___) \ | 865 V(CheckStack, 0, ___, ___, ___) \ |
854 V(CheckStackAlwaysExit, 0, ___, ___, ___) \ | 866 V(CheckStackAlwaysExit, 0, ___, ___, ___) \ |
| 867 V(CheckFunctionTypeArgs, A_D, num, num, ___) \ |
855 V(DebugStep, 0, ___, ___, ___) \ | 868 V(DebugStep, 0, ___, ___, ___) \ |
856 V(DebugBreak, A, num, ___, ___) \ | 869 V(DebugBreak, A, num, ___, ___) \ |
857 V(Deopt, A_D, num, num, ___) \ | 870 V(Deopt, A_D, num, num, ___) \ |
858 V(DeoptRewind, 0, ___, ___, ___) | 871 V(DeoptRewind, 0, ___, ___, ___) |
859 | 872 |
860 // clang-format on | 873 // clang-format on |
861 | 874 |
862 typedef uint32_t Instr; | 875 typedef uint32_t Instr; |
863 | 876 |
864 class Bytecode { | 877 class Bytecode { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 | 1006 |
994 // After a comparison, the condition NEXT_IS_TRUE means the following | 1007 // After a comparison, the condition NEXT_IS_TRUE means the following |
995 // instruction is executed if the comparison is true and skipped over overwise. | 1008 // instruction is executed if the comparison is true and skipped over overwise. |
996 // Condition NEXT_IS_FALSE means the following instruction is executed if the | 1009 // Condition NEXT_IS_FALSE means the following instruction is executed if the |
997 // comparison is false and skipped over otherwise. | 1010 // comparison is false and skipped over otherwise. |
998 enum Condition { NEXT_IS_TRUE, NEXT_IS_FALSE, INVALID_CONDITION }; | 1011 enum Condition { NEXT_IS_TRUE, NEXT_IS_FALSE, INVALID_CONDITION }; |
999 | 1012 |
1000 } // namespace dart | 1013 } // namespace dart |
1001 | 1014 |
1002 #endif // RUNTIME_VM_CONSTANTS_DBC_H_ | 1015 #endif // RUNTIME_VM_CONSTANTS_DBC_H_ |
OLD | NEW |