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 VM_CONSTANTS_DBC_H_ | 5 #ifndef VM_CONSTANTS_DBC_H_ |
6 #define VM_CONSTANTS_DBC_H_ | 6 #define 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" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // | opcode | T | T: signed 24-bit operand | 76 // | opcode | T | T: signed 24-bit operand |
77 // +--------+--------+--------+--------+ | 77 // +--------+--------+--------+--------+ |
78 // | 78 // |
79 // | 79 // |
80 // INSTRUCTIONS | 80 // INSTRUCTIONS |
81 // | 81 // |
82 // - Trap | 82 // - Trap |
83 // | 83 // |
84 // Unreachable instruction. | 84 // Unreachable instruction. |
85 // | 85 // |
| 86 // - Nop |
| 87 // |
| 88 // This instuction does nothing. |
| 89 // |
86 // - Compile | 90 // - Compile |
87 // | 91 // |
88 // Compile current function and start executing newly produced code | 92 // Compile current function and start executing newly produced code |
89 // (used to implement LazyCompileStub); | 93 // (used to implement LazyCompileStub); |
90 // | 94 // |
91 // - Intrinsic id | 95 // - Intrinsic id |
92 // | 96 // |
93 // Execute intrinsic with the given id. If intrinsic returns true then | 97 // Execute intrinsic with the given id. If intrinsic returns true then |
94 // return from the current function to the caller passing value produced | 98 // return from the current function to the caller passing value produced |
95 // by the intrinsic as a result; | 99 // by the intrinsic as a result; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // Invoke native function SP[-1] with argc_tag SP[0]. | 157 // Invoke native function SP[-1] with argc_tag SP[0]. |
154 // | 158 // |
155 // - AddTOS; SubTOS; MulTOS; BitOrTOS; BitAndTOS; EqualTOS; LessThanTOS; | 159 // - AddTOS; SubTOS; MulTOS; BitOrTOS; BitAndTOS; EqualTOS; LessThanTOS; |
156 // GreaterThanTOS; | 160 // GreaterThanTOS; |
157 // | 161 // |
158 // Smi fast-path for a corresponding method. Checks if SP[0] and SP[-1] are | 162 // Smi fast-path for a corresponding method. Checks if SP[0] and SP[-1] are |
159 // both smis and result of SP[0] <op> SP[-1] is a smi - if this is true | 163 // both smis and result of SP[0] <op> SP[-1] is a smi - if this is true |
160 // then pops operands and pushes result on the stack and skips the next | 164 // then pops operands and pushes result on the stack and skips the next |
161 // instruction (which implements a slow path fallback). | 165 // instruction (which implements a slow path fallback). |
162 // | 166 // |
| 167 // - Add, Sub, Mul, Div, Mod, Shl, Shr rA, rB, rC |
| 168 // |
| 169 // Arithmetic operations on Smis. FP[rA] <- FP[rB] op FP[rC]. |
| 170 // If these instructions can trigger a deoptimization, the following |
| 171 // instruction should be Deopt. If no deoptimization should be triggered, |
| 172 // the immediately following instruction is skipped. These instructions |
| 173 // expect their operands to be Smis, but don't check that they are. |
| 174 // |
| 175 // - BitOr, BitAnd, BitXor rA, rB, rC |
| 176 // |
| 177 // FP[rA] <- FP[rB] op FP[rC]. These instructions expect their operands to be |
| 178 // Smis, but don't check that they are. |
| 179 // |
163 // - StoreStaticTOS D | 180 // - StoreStaticTOS D |
164 // | 181 // |
165 // Stores TOS into the static field PP[D]. | 182 // Stores TOS into the static field PP[D]. |
166 // | 183 // |
167 // - PushStatic | 184 // - PushStatic |
168 // | 185 // |
169 // Pushes value of the static field PP[D] on to the stack. | 186 // Pushes value of the static field PP[D] on to the stack. |
170 // | 187 // |
171 // - InitStaticTOS | 188 // - InitStaticTOS |
172 // | 189 // |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 // reg register (unsigned FP relative local) | 399 // reg register (unsigned FP relative local) |
383 // xeg x-register (signed FP relative local) | 400 // xeg x-register (signed FP relative local) |
384 // tgt jump target relative to the PC of the current instruction | 401 // tgt jump target relative to the PC of the current instruction |
385 // | 402 // |
386 // TODO(vegorov) jump targets should be encoded relative to PC of the next | 403 // TODO(vegorov) jump targets should be encoded relative to PC of the next |
387 // instruction because PC is incremeted immediately after fetch | 404 // instruction because PC is incremeted immediately after fetch |
388 // and before decoding. | 405 // and before decoding. |
389 // | 406 // |
390 #define BYTECODES_LIST(V) \ | 407 #define BYTECODES_LIST(V) \ |
391 V(Trap, 0, ___, ___, ___) \ | 408 V(Trap, 0, ___, ___, ___) \ |
| 409 V(Nop, 0, ___, ___, ___) \ |
392 V(Compile, 0, ___, ___, ___) \ | 410 V(Compile, 0, ___, ___, ___) \ |
393 V(HotCheck, A_D, num, num, ___) \ | 411 V(HotCheck, A_D, num, num, ___) \ |
394 V(Intrinsic, A, num, ___, ___) \ | 412 V(Intrinsic, A, num, ___, ___) \ |
395 V(Drop1, 0, ___, ___, ___) \ | 413 V(Drop1, 0, ___, ___, ___) \ |
396 V(DropR, A, num, ___, ___) \ | 414 V(DropR, A, num, ___, ___) \ |
397 V(Drop, A, num, ___, ___) \ | 415 V(Drop, A, num, ___, ___) \ |
398 V(Jump, T, tgt, ___, ___) \ | 416 V(Jump, T, tgt, ___, ___) \ |
399 V(Return, A, reg, ___, ___) \ | 417 V(Return, A, reg, ___, ___) \ |
400 V(ReturnTOS, 0, ___, ___, ___) \ | 418 V(ReturnTOS, 0, ___, ___, ___) \ |
401 V(Move, A_X, reg, xeg, ___) \ | 419 V(Move, A_X, reg, xeg, ___) \ |
(...skipping 13 matching lines...) Expand all Loading... |
415 V(NativeCall, 0, ___, ___, ___) \ | 433 V(NativeCall, 0, ___, ___, ___) \ |
416 V(NativeBootstrapCall, 0, ___, ___, ___) \ | 434 V(NativeBootstrapCall, 0, ___, ___, ___) \ |
417 V(AddTOS, 0, ___, ___, ___) \ | 435 V(AddTOS, 0, ___, ___, ___) \ |
418 V(SubTOS, 0, ___, ___, ___) \ | 436 V(SubTOS, 0, ___, ___, ___) \ |
419 V(MulTOS, 0, ___, ___, ___) \ | 437 V(MulTOS, 0, ___, ___, ___) \ |
420 V(BitOrTOS, 0, ___, ___, ___) \ | 438 V(BitOrTOS, 0, ___, ___, ___) \ |
421 V(BitAndTOS, 0, ___, ___, ___) \ | 439 V(BitAndTOS, 0, ___, ___, ___) \ |
422 V(EqualTOS, 0, ___, ___, ___) \ | 440 V(EqualTOS, 0, ___, ___, ___) \ |
423 V(LessThanTOS, 0, ___, ___, ___) \ | 441 V(LessThanTOS, 0, ___, ___, ___) \ |
424 V(GreaterThanTOS, 0, ___, ___, ___) \ | 442 V(GreaterThanTOS, 0, ___, ___, ___) \ |
| 443 V(Add, A_B_C, reg, reg, reg) \ |
| 444 V(Sub, A_B_C, reg, reg, reg) \ |
| 445 V(Mul, A_B_C, reg, reg, reg) \ |
| 446 V(Div, A_B_C, reg, reg, reg) \ |
| 447 V(Mod, A_B_C, reg, reg, reg) \ |
| 448 V(BitOr, A_B_C, reg, reg, reg) \ |
| 449 V(BitAnd, A_B_C, reg, reg, reg) \ |
| 450 V(BitXor, A_B_C, reg, reg, reg) \ |
| 451 V(Shl, A_B_C, reg, reg, reg) \ |
| 452 V(Shr, A_B_C, reg, reg, reg) \ |
425 V(StoreStaticTOS, D, lit, ___, ___) \ | 453 V(StoreStaticTOS, D, lit, ___, ___) \ |
426 V(PushStatic, D, lit, ___, ___) \ | 454 V(PushStatic, D, lit, ___, ___) \ |
427 V(InitStaticTOS, 0, ___, ___, ___) \ | 455 V(InitStaticTOS, 0, ___, ___, ___) \ |
428 V(IfNeStrictTOS, 0, ___, ___, ___) \ | 456 V(IfNeStrictTOS, 0, ___, ___, ___) \ |
429 V(IfEqStrictTOS, 0, ___, ___, ___) \ | 457 V(IfEqStrictTOS, 0, ___, ___, ___) \ |
430 V(IfNeStrictNumTOS, 0, ___, ___, ___) \ | 458 V(IfNeStrictNumTOS, 0, ___, ___, ___) \ |
431 V(IfEqStrictNumTOS, 0, ___, ___, ___) \ | 459 V(IfEqStrictNumTOS, 0, ___, ___, ___) \ |
432 V(IfNeStrict, A_D, reg, reg, ___) \ | 460 V(IfNeStrict, A_D, reg, reg, ___) \ |
433 V(IfEqStrict, A_D, reg, reg, ___) \ | 461 V(IfEqStrict, A_D, reg, reg, ___) \ |
434 V(IfNeStrictNum, A_D, reg, reg, ___) \ | 462 V(IfNeStrictNum, A_D, reg, reg, ___) \ |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
573 kNumberOfDummyFpuRegisters, | 601 kNumberOfDummyFpuRegisters, |
574 }; | 602 }; |
575 const FpuRegister FpuTMP = kFakeFpuRegister; | 603 const FpuRegister FpuTMP = kFakeFpuRegister; |
576 const intptr_t kNumberOfFpuRegisters = 1; | 604 const intptr_t kNumberOfFpuRegisters = 1; |
577 | 605 |
578 enum Condition { EQ, NE }; | 606 enum Condition { EQ, NE }; |
579 | 607 |
580 } // namespace dart | 608 } // namespace dart |
581 | 609 |
582 #endif // VM_CONSTANTS_DBC_H_ | 610 #endif // VM_CONSTANTS_DBC_H_ |
OLD | NEW |