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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // | 369 // |
370 // - AssertBoolean A | 370 // - AssertBoolean A |
371 // | 371 // |
372 // Assert that TOS is a boolean (A = 1) or that TOS is not null (A = 0). | 372 // Assert that TOS is a boolean (A = 1) or that TOS is not null (A = 0). |
373 // | 373 // |
374 // - TestSmi rA, rD | 374 // - TestSmi rA, rD |
375 // | 375 // |
376 // If FP[rA] & FP[rD] != 0, then skip the next instruction. FP[rA] and FP[rD] | 376 // If FP[rA] & FP[rD] != 0, then skip the next instruction. FP[rA] and FP[rD] |
377 // must be Smis. | 377 // must be Smis. |
378 // | 378 // |
| 379 // - TestCids rA, D |
| 380 // |
| 381 // The next D instructions must be Nops whose D field encodes a class id. If |
| 382 // the class id of FP[rA] matches, jump to PC + N + 1 if the matching Nop's |
| 383 // A != 0 or PC + N + 2 if the matching Nop's A = 0. If no match is found, |
| 384 // jump to PC + N. |
| 385 // |
379 // - CheckSmi rA | 386 // - CheckSmi rA |
380 // | 387 // |
381 // If FP[rA] is a Smi, then skip the next instruction. | 388 // If FP[rA] is a Smi, then skip the next instruction. |
382 // | 389 // |
383 // - CheckClassId rA, D | 390 // - CheckClassId rA, D |
384 // | 391 // |
385 // If the object at FP[rA]'s class id matches the class id D, then skip the | 392 // If the object at FP[rA]'s class id matches the class id D, then skip the |
386 // following instruction. | 393 // following instruction. |
387 // | 394 // |
388 // - CheckDenseSwitch rA, D | 395 // - CheckDenseSwitch rA, D |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
453 // reg register (unsigned FP relative local) | 460 // reg register (unsigned FP relative local) |
454 // xeg x-register (signed FP relative local) | 461 // xeg x-register (signed FP relative local) |
455 // tgt jump target relative to the PC of the current instruction | 462 // tgt jump target relative to the PC of the current instruction |
456 // | 463 // |
457 // TODO(vegorov) jump targets should be encoded relative to PC of the next | 464 // TODO(vegorov) jump targets should be encoded relative to PC of the next |
458 // instruction because PC is incremeted immediately after fetch | 465 // instruction because PC is incremeted immediately after fetch |
459 // and before decoding. | 466 // and before decoding. |
460 // | 467 // |
461 #define BYTECODES_LIST(V) \ | 468 #define BYTECODES_LIST(V) \ |
462 V(Trap, 0, ___, ___, ___) \ | 469 V(Trap, 0, ___, ___, ___) \ |
463 V(Nop, D, lit, ___, ___) \ | 470 V(Nop, A_D, num, lit, ___) \ |
464 V(Compile, 0, ___, ___, ___) \ | 471 V(Compile, 0, ___, ___, ___) \ |
465 V(HotCheck, A_D, num, num, ___) \ | 472 V(HotCheck, A_D, num, num, ___) \ |
466 V(Intrinsic, A, num, ___, ___) \ | 473 V(Intrinsic, A, num, ___, ___) \ |
467 V(Drop1, 0, ___, ___, ___) \ | 474 V(Drop1, 0, ___, ___, ___) \ |
468 V(DropR, A, num, ___, ___) \ | 475 V(DropR, A, num, ___, ___) \ |
469 V(Drop, A, num, ___, ___) \ | 476 V(Drop, A, num, ___, ___) \ |
470 V(Jump, T, tgt, ___, ___) \ | 477 V(Jump, T, tgt, ___, ___) \ |
471 V(Return, A, reg, ___, ___) \ | 478 V(Return, A, reg, ___, ___) \ |
472 V(ReturnTOS, 0, ___, ___, ___) \ | 479 V(ReturnTOS, 0, ___, ___, ___) \ |
473 V(Move, A_X, reg, xeg, ___) \ | 480 V(Move, A_X, reg, xeg, ___) \ |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
540 V(SetFrame, A, num, ___, num) \ | 547 V(SetFrame, A, num, ___, num) \ |
541 V(AllocateContext, D, num, ___, ___) \ | 548 V(AllocateContext, D, num, ___, ___) \ |
542 V(CloneContext, 0, ___, ___, ___) \ | 549 V(CloneContext, 0, ___, ___, ___) \ |
543 V(MoveSpecial, A_D, reg, num, ___) \ | 550 V(MoveSpecial, A_D, reg, num, ___) \ |
544 V(InstantiateType, D, lit, ___, ___) \ | 551 V(InstantiateType, D, lit, ___, ___) \ |
545 V(InstantiateTypeArgumentsTOS, A_D, num, lit, ___) \ | 552 V(InstantiateTypeArgumentsTOS, A_D, num, lit, ___) \ |
546 V(InstanceOf, A, num, ___, ___) \ | 553 V(InstanceOf, A, num, ___, ___) \ |
547 V(AssertAssignable, D, num, lit, ___) \ | 554 V(AssertAssignable, D, num, lit, ___) \ |
548 V(AssertBoolean, A, num, ___, ___) \ | 555 V(AssertBoolean, A, num, ___, ___) \ |
549 V(TestSmi, A_D, reg, reg, ___) \ | 556 V(TestSmi, A_D, reg, reg, ___) \ |
| 557 V(TestCids, A_D, reg, num, ___) \ |
550 V(CheckSmi, A, reg, ___, ___) \ | 558 V(CheckSmi, A, reg, ___, ___) \ |
551 V(CheckClassId, A_D, reg, num, ___) \ | 559 V(CheckClassId, A_D, reg, num, ___) \ |
552 V(CheckDenseSwitch, A_D, reg, num, ___) \ | 560 V(CheckDenseSwitch, A_D, reg, num, ___) \ |
553 V(CheckCids, A_B_C, reg, num, ___) \ | 561 V(CheckCids, A_B_C, reg, num, ___) \ |
554 V(CheckStack, 0, ___, ___, ___) \ | 562 V(CheckStack, 0, ___, ___, ___) \ |
555 V(DebugStep, 0, ___, ___, ___) \ | 563 V(DebugStep, 0, ___, ___, ___) \ |
556 V(DebugBreak, A, num, ___, ___) \ | 564 V(DebugBreak, A, num, ___, ___) \ |
557 V(Deopt, A_D, num, num, ___) \ | 565 V(Deopt, A_D, num, num, ___) \ |
558 | 566 |
559 typedef uint32_t Instr; | 567 typedef uint32_t Instr; |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 | 678 |
671 // After a comparison, the condition NEXT_IS_TRUE means the following | 679 // After a comparison, the condition NEXT_IS_TRUE means the following |
672 // instruction is executed if the comparision is true and skipped over overwise. | 680 // instruction is executed if the comparision is true and skipped over overwise. |
673 // Conidition NEXT_IS_FALSE means the following instruction is executed if the | 681 // Conidition NEXT_IS_FALSE means the following instruction is executed if the |
674 // comparison is false and skipped over otherwise. | 682 // comparison is false and skipped over otherwise. |
675 enum Condition { NEXT_IS_TRUE, NEXT_IS_FALSE }; | 683 enum Condition { NEXT_IS_TRUE, NEXT_IS_FALSE }; |
676 | 684 |
677 } // namespace dart | 685 } // namespace dart |
678 | 686 |
679 #endif // VM_CONSTANTS_DBC_H_ | 687 #endif // VM_CONSTANTS_DBC_H_ |
OLD | NEW |