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

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

Issue 2098573004: DBC: CheckClassInstr (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Clean up comment Created 4 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 unified diff | Download patch
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 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
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 86 // - Nop D
87 // 87 //
88 // This instuction does nothing. 88 // This instuction does nothing. It may refer to an object in the constant
89 // pool that may be decoded by other instructions.
89 // 90 //
90 // - Compile 91 // - Compile
91 // 92 //
92 // Compile current function and start executing newly produced code 93 // Compile current function and start executing newly produced code
93 // (used to implement LazyCompileStub); 94 // (used to implement LazyCompileStub);
94 // 95 //
95 // - Intrinsic id 96 // - Intrinsic id
96 // 97 //
97 // Execute intrinsic with the given id. If intrinsic returns true then 98 // Execute intrinsic with the given id. If intrinsic returns true then
98 // return from the current function to the caller passing value produced 99 // return from the current function to the caller passing value produced
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // 206 //
206 // Skips the next instruction unless the given condition holds. 'Num' 207 // Skips the next instruction unless the given condition holds. 'Num'
207 // variants perform number check while non-Num variants just compare 208 // variants perform number check while non-Num variants just compare
208 // RawObject pointers. 209 // RawObject pointers.
209 // 210 //
210 // Used to implement conditional jump: 211 // Used to implement conditional jump:
211 // 212 //
212 // IfNeStrictTOS 213 // IfNeStrictTOS
213 // Jump T ;; jump if not equal 214 // Jump T ;; jump if not equal
214 // 215 //
216 // - If<Cond>Null rA
217 //
218 // Cond is Eq or Ne. Skips the next instruction unless the given condition
219 // holds.
220 //
215 // - CreateArrayTOS 221 // - CreateArrayTOS
216 // 222 //
217 // Allocate array of length SP[0] with type arguments SP[-1]. 223 // Allocate array of length SP[0] with type arguments SP[-1].
218 // 224 //
219 // - Allocate D 225 // - Allocate D
220 // 226 //
221 // Allocate object of class PP[D] with no type arguments. 227 // Allocate object of class PP[D] with no type arguments.
222 // 228 //
223 // - AllocateT 229 // - AllocateT
224 // 230 //
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // 357 //
352 // - CheckSmi rA 358 // - CheckSmi rA
353 // 359 //
354 // If FP[rA] is a Smi, then skip the next instruction. 360 // If FP[rA] is a Smi, then skip the next instruction.
355 // 361 //
356 // - CheckClassId rA, D 362 // - CheckClassId rA, D
357 // 363 //
358 // If the object at FP[rA]'s class id matches hthe class id in PP[D], then 364 // If the object at FP[rA]'s class id matches hthe class id in PP[D], then
359 // skip the following instruction. 365 // skip the following instruction.
360 // 366 //
367 // - CheckDenseSwitch rA, D
368 //
369 // Skips the next 3 instructions if the object at FP[rA] is a valid class for
370 // a dense switch with low cid encoded in the following Nop instruction, and
371 // the cid mask encoded in the Nop instruction after that, or if D == 1 and
372 // FP[rA] is a Smi. Skips 2 instructions otherwise.
373 //
374 // - CheckCid rA, D
Vyacheslav Egorov (Google) 2016/06/29 17:11:06 32bit build allocates only 16bits for a CID. I thi
zra 2016/06/29 22:19:17 Done.
375 //
376 // Skips the next two instructions if the object at FP[rA] is a Smi and
377 // D == 1, or if FP[rA] has cid equal to the cid encoded by the following
378 // Nop instruction. Otherwise skips 1 instruction.
379 //
380 // - CheckCids rA, D
381 //
382 // Skips the next two instructions if the object at FP[rA] is a Smi and
383 // D == 1, or if FP[rA]'s cid is found in the array of cids encoded by the
384 // following Nop instruction. Otherwise skips 1 instruction.
385 //
361 // - CheckStack 386 // - CheckStack
362 // 387 //
363 // Compare SP against isolate stack limit and call StackOverflow handler if 388 // Compare SP against isolate stack limit and call StackOverflow handler if
364 // necessary. 389 // necessary.
365 // 390 //
366 // - DebugStep, DebugBreak A 391 // - DebugStep, DebugBreak A
367 // 392 //
368 // Debugger support. DebugBreak is bytecode that can be patched into the 393 // Debugger support. DebugBreak is bytecode that can be patched into the
369 // instruction stream to trigger in place breakpoint. 394 // instruction stream to trigger in place breakpoint.
370 // 395 //
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 // reg register (unsigned FP relative local) 438 // reg register (unsigned FP relative local)
414 // xeg x-register (signed FP relative local) 439 // xeg x-register (signed FP relative local)
415 // tgt jump target relative to the PC of the current instruction 440 // tgt jump target relative to the PC of the current instruction
416 // 441 //
417 // TODO(vegorov) jump targets should be encoded relative to PC of the next 442 // TODO(vegorov) jump targets should be encoded relative to PC of the next
418 // instruction because PC is incremeted immediately after fetch 443 // instruction because PC is incremeted immediately after fetch
419 // and before decoding. 444 // and before decoding.
420 // 445 //
421 #define BYTECODES_LIST(V) \ 446 #define BYTECODES_LIST(V) \
422 V(Trap, 0, ___, ___, ___) \ 447 V(Trap, 0, ___, ___, ___) \
423 V(Nop, 0, ___, ___, ___) \ 448 V(Nop, D, lit, ___, ___) \
424 V(Compile, 0, ___, ___, ___) \ 449 V(Compile, 0, ___, ___, ___) \
425 V(HotCheck, A_D, num, num, ___) \ 450 V(HotCheck, A_D, num, num, ___) \
426 V(Intrinsic, A, num, ___, ___) \ 451 V(Intrinsic, A, num, ___, ___) \
427 V(Drop1, 0, ___, ___, ___) \ 452 V(Drop1, 0, ___, ___, ___) \
428 V(DropR, A, num, ___, ___) \ 453 V(DropR, A, num, ___, ___) \
429 V(Drop, A, num, ___, ___) \ 454 V(Drop, A, num, ___, ___) \
430 V(Jump, T, tgt, ___, ___) \ 455 V(Jump, T, tgt, ___, ___) \
431 V(Return, A, reg, ___, ___) \ 456 V(Return, A, reg, ___, ___) \
432 V(ReturnTOS, 0, ___, ___, ___) \ 457 V(ReturnTOS, 0, ___, ___, ___) \
433 V(Move, A_X, reg, xeg, ___) \ 458 V(Move, A_X, reg, xeg, ___) \
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 V(PushStatic, D, lit, ___, ___) \ 495 V(PushStatic, D, lit, ___, ___) \
471 V(InitStaticTOS, 0, ___, ___, ___) \ 496 V(InitStaticTOS, 0, ___, ___, ___) \
472 V(IfNeStrictTOS, 0, ___, ___, ___) \ 497 V(IfNeStrictTOS, 0, ___, ___, ___) \
473 V(IfEqStrictTOS, 0, ___, ___, ___) \ 498 V(IfEqStrictTOS, 0, ___, ___, ___) \
474 V(IfNeStrictNumTOS, 0, ___, ___, ___) \ 499 V(IfNeStrictNumTOS, 0, ___, ___, ___) \
475 V(IfEqStrictNumTOS, 0, ___, ___, ___) \ 500 V(IfEqStrictNumTOS, 0, ___, ___, ___) \
476 V(IfNeStrict, A_D, reg, reg, ___) \ 501 V(IfNeStrict, A_D, reg, reg, ___) \
477 V(IfEqStrict, A_D, reg, reg, ___) \ 502 V(IfEqStrict, A_D, reg, reg, ___) \
478 V(IfNeStrictNum, A_D, reg, reg, ___) \ 503 V(IfNeStrictNum, A_D, reg, reg, ___) \
479 V(IfEqStrictNum, A_D, reg, reg, ___) \ 504 V(IfEqStrictNum, A_D, reg, reg, ___) \
505 V(IfEqNull, A, reg, ___, ___) \
506 V(IfNeNull, A, reg, ___, ___) \
480 V(CreateArrayTOS, 0, ___, ___, ___) \ 507 V(CreateArrayTOS, 0, ___, ___, ___) \
481 V(Allocate, D, lit, ___, ___) \ 508 V(Allocate, D, lit, ___, ___) \
482 V(AllocateT, 0, ___, ___, ___) \ 509 V(AllocateT, 0, ___, ___, ___) \
483 V(StoreIndexedTOS, 0, ___, ___, ___) \ 510 V(StoreIndexedTOS, 0, ___, ___, ___) \
484 V(StoreIndexed, A_B_C, reg, reg, reg) \ 511 V(StoreIndexed, A_B_C, reg, reg, reg) \
485 V(StoreField, A_B_C, reg, num, reg) \ 512 V(StoreField, A_B_C, reg, num, reg) \
486 V(StoreFieldTOS, D, num, ___, ___) \ 513 V(StoreFieldTOS, D, num, ___, ___) \
487 V(LoadField, A_B_C, reg, reg, num) \ 514 V(LoadField, A_B_C, reg, reg, num) \
488 V(LoadFieldTOS, D, num, ___, ___) \ 515 V(LoadFieldTOS, D, num, ___, ___) \
489 V(BooleanNegateTOS, 0, ___, ___, ___) \ 516 V(BooleanNegateTOS, 0, ___, ___, ___) \
490 V(BooleanNegate, A_D, reg, reg, ___) \ 517 V(BooleanNegate, A_D, reg, reg, ___) \
491 V(Throw, A, num, ___, ___) \ 518 V(Throw, A, num, ___, ___) \
492 V(Entry, A_B_C, num, num, num) \ 519 V(Entry, A_B_C, num, num, num) \
493 V(EntryOptional, A_B_C, num, num, num) \ 520 V(EntryOptional, A_B_C, num, num, num) \
494 V(EntryOptimized, A_D, num, num, ___) \ 521 V(EntryOptimized, A_D, num, num, ___) \
495 V(Frame, D, num, ___, ___) \ 522 V(Frame, D, num, ___, ___) \
496 V(SetFrame, A, num, ___, num) \ 523 V(SetFrame, A, num, ___, num) \
497 V(AllocateContext, D, num, ___, ___) \ 524 V(AllocateContext, D, num, ___, ___) \
498 V(CloneContext, 0, ___, ___, ___) \ 525 V(CloneContext, 0, ___, ___, ___) \
499 V(MoveSpecial, A_D, reg, num, ___) \ 526 V(MoveSpecial, A_D, reg, num, ___) \
500 V(InstantiateType, D, lit, ___, ___) \ 527 V(InstantiateType, D, lit, ___, ___) \
501 V(InstantiateTypeArgumentsTOS, A_D, num, lit, ___) \ 528 V(InstantiateTypeArgumentsTOS, A_D, num, lit, ___) \
502 V(AssertAssignable, D, num, lit, ___) \ 529 V(AssertAssignable, D, num, lit, ___) \
503 V(AssertBoolean, A, num, ___, ___) \ 530 V(AssertBoolean, A, num, ___, ___) \
504 V(CheckSmi, A, reg, ___, ___) \ 531 V(CheckSmi, A, reg, ___, ___) \
505 V(CheckClassId, A_D, reg, lit, ___) \ 532 V(CheckClassId, A_D, reg, lit, ___) \
533 V(CheckDenseSwitch, A_D, reg, num, ___) \
534 V(CheckCid, A_D, reg, num, ___) \
535 V(CheckCids, A_D, reg, num, ___) \
506 V(CheckStack, 0, ___, ___, ___) \ 536 V(CheckStack, 0, ___, ___, ___) \
507 V(DebugStep, 0, ___, ___, ___) \ 537 V(DebugStep, 0, ___, ___, ___) \
508 V(DebugBreak, A, num, ___, ___) \ 538 V(DebugBreak, A, num, ___, ___) \
509 V(Deopt, A_D, num, num, ___) \ 539 V(Deopt, A_D, num, num, ___) \
510 540
511 typedef uint32_t Instr; 541 typedef uint32_t Instr;
512 542
513 class Bytecode { 543 class Bytecode {
514 public: 544 public:
515 enum Opcode { 545 enum Opcode {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 kNumberOfDummyFpuRegisters, 648 kNumberOfDummyFpuRegisters,
619 }; 649 };
620 const FpuRegister FpuTMP = kFakeFpuRegister; 650 const FpuRegister FpuTMP = kFakeFpuRegister;
621 const intptr_t kNumberOfFpuRegisters = 1; 651 const intptr_t kNumberOfFpuRegisters = 1;
622 652
623 enum Condition { EQ, NE }; 653 enum Condition { EQ, NE };
624 654
625 } // namespace dart 655 } // namespace dart
626 656
627 #endif // VM_CONSTANTS_DBC_H_ 657 #endif // VM_CONSTANTS_DBC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698