Skip to content

Commit db17f1f

Browse files
mkustermanncommit-bot@chromium.org
authored andcommitted
[VM] Introduction of type testing stubs - Part 2
This CL starts building type testing stubs specialzed for [Type] objects we test against. More specifically, it adds support for: * Handling obvious fast cases on the call sites (while still having a call to stub for negative case) * Handling type tests against type parameters, by loading the value of the type parameter on the call sites and invoking it's type testing stub. * Specialzed type testing stubs for instantiated types where we can do [CidRange]-based subtype-checks. ==> e.g. String/List<dynamic> * Specialzed type testing stubs for instantiated types where we can do [CidRange]-based subclass-checks for the class and [CidRange]-based subtype-checks for the type arguments. ==> e.g. Widget<State>, where we know [Widget] is only extended and not implemented. * Specialzed type testing stubs for certain non-instantiated types where we can do [CidRange]-based subclass-checks for the class and [CidRange]-based subtype-checks for the instantiated type arguments and cid based comparisons for type parameters. (Note that this fast-case migth result in some false-negatives!) ==> e.g. _HashMapEntry<K, V>, where we know [_HashMapEntry] is only extended and not implemented. This optimizes cases where the caller uses `new HashMap<A, B>()` and only uses `A` and `B` as key/values (and not subclasses of it). The false-negative can occur when subtypes of A or B are used. In such cases we fall back to the [SubtypeTestCache]-based imlementation. Issue dart-lang#31798 Change-Id: Ic1853977bf55d815755b0d652ec8e20e51efb4cf Reviewed-on: https://dart-review.googlesource.com/44788 Reviewed-by: Vyacheslav Egorov <[email protected]> Reviewed-by: Régis Crelier <[email protected]>
1 parent fe572ec commit db17f1f

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

assembler_arm64.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,11 @@ class Assembler : public ValueObject {
440440

441441
void LoadField(Register dst, FieldAddress address) { ldr(dst, address); }
442442

443+
void CompareWithFieldValue(Register value, FieldAddress address) {
444+
ldr(TMP, address);
445+
cmp(value, Operand(TMP));
446+
}
447+
443448
// Misc. functionality
444449
intptr_t CodeSize() const { return buffer_.Size(); }
445450
intptr_t prologue_offset() const { return prologue_offset_; }

assembler_ia32.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@ class Assembler : public ValueObject {
566566

567567
void CompareRegisters(Register a, Register b);
568568
void BranchIf(Condition condition, Label* label) { j(condition, label); }
569+
void LoadField(Register dst, FieldAddress address) { movw(dst, address); }
569570

570571
// Issues a move instruction if 'to' is not the same as 'from'.
571572
void MoveRegister(Register to, Register from);

0 commit comments

Comments
 (0)