[ddc] Avoid calling addTypeCaches with new types

Some preparation for deleting all the old type system code.

Change-Id: I9319064100ce19a4122612c36781c7e4a71094aa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/352724
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
Nicholas Shahan 2024-02-15 18:28:49 +00:00 committed by Commit Queue
parent 0cb3fcca48
commit f6ffe00f28
2 changed files with 5 additions and 3 deletions

View file

@ -985,8 +985,9 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
];
body.add(runtimeStatement('addRtiResources(#, #)',
[className, js_ast.stringArray(implementedRecipes)]));
} else {
body.add(runtimeStatement('addTypeCaches(#)', [className]));
}
body.add(runtimeStatement('addTypeCaches(#)', [className]));
_emitClassSignature(c, className, body);
_initExtensionSymbols(c);

View file

@ -710,6 +710,8 @@ Object typeTagSymbol(String recipe) {
/// The first element of [interfaceRecipes] must always be the type recipe for
/// the type represented by [classRef].
void addRtiResources(Object classRef, JSArray<String> interfaceRecipes) {
// Create a rti object cache property used in dart:_rti.
JS('', '#[#] = null', classRef, rti.constructorRtiCachePropertyName);
// Attach the [classRef]'s own interface type recipe.
// The recipe is used in dart:_rti to create an [rti.Rti] instance when
// needed.
@ -731,8 +733,7 @@ void addRtiResources(Object classRef, JSArray<String> interfaceRecipes) {
/// monomorphic, which results in faster execution in V8.
addTypeCaches(type) {
if (JS_GET_FLAG('NEW_RUNTIME_TYPES')) {
// Create a rti object cache property used in dart:_rti.
JS('', '#[#] = null', type, rti.constructorRtiCachePropertyName);
throwUnimplementedInCurrentRti();
} else {
JS('', '#[#] = void 0', type, _cachedLegacy);
JS('', '#[#] = void 0', type, _cachedNullable);