[JS IR] make old Ir2Js pass all tests
This commit is contained in:
committed by
TeamCityServer
parent
d565cc4262
commit
1ae042edc3
@@ -379,7 +379,8 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
|||||||
messageCollector
|
messageCollector
|
||||||
),
|
),
|
||||||
lowerPerModule = icCaches.isNotEmpty(),
|
lowerPerModule = icCaches.isNotEmpty(),
|
||||||
granularity = granularity
|
granularity = granularity,
|
||||||
|
icCompatibleIr2Js = arguments.irNewIr2Js,
|
||||||
)
|
)
|
||||||
|
|
||||||
val compiledModule: CompilerResult = if (arguments.irNewIr2Js) {
|
val compiledModule: CompilerResult = if (arguments.irNewIr2Js) {
|
||||||
|
|||||||
@@ -60,6 +60,7 @@ class JsIrBackendContext(
|
|||||||
val safeExternalBooleanDiagnostic: RuntimeDiagnostic? = null,
|
val safeExternalBooleanDiagnostic: RuntimeDiagnostic? = null,
|
||||||
override val mapping: JsMapping = JsMapping(symbolTable.irFactory),
|
override val mapping: JsMapping = JsMapping(symbolTable.irFactory),
|
||||||
val granularity: JsGenerationGranularity = JsGenerationGranularity.WHOLE_PROGRAM,
|
val granularity: JsGenerationGranularity = JsGenerationGranularity.WHOLE_PROGRAM,
|
||||||
|
val icCompatibleIr2Js: Boolean = false,
|
||||||
) : JsCommonBackendContext {
|
) : JsCommonBackendContext {
|
||||||
val fileToInitializationFuns: MutableMap<IrFile, IrSimpleFunction?> = mutableMapOf()
|
val fileToInitializationFuns: MutableMap<IrFile, IrSimpleFunction?> = mutableMapOf()
|
||||||
val fileToInitializerPureness: MutableMap<IrFile, Boolean> = mutableMapOf()
|
val fileToInitializerPureness: MutableMap<IrFile, Boolean> = mutableMapOf()
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ fun compile(
|
|||||||
safeExternalBooleanDiagnostic: RuntimeDiagnostic? = null,
|
safeExternalBooleanDiagnostic: RuntimeDiagnostic? = null,
|
||||||
filesToLower: Set<String>? = null,
|
filesToLower: Set<String>? = null,
|
||||||
granularity: JsGenerationGranularity = JsGenerationGranularity.WHOLE_PROGRAM,
|
granularity: JsGenerationGranularity = JsGenerationGranularity.WHOLE_PROGRAM,
|
||||||
|
icCompatibleIr2Js: Boolean = false,
|
||||||
): LoweredIr {
|
): LoweredIr {
|
||||||
|
|
||||||
if (lowerPerModule) {
|
if (lowerPerModule) {
|
||||||
@@ -99,7 +100,8 @@ fun compile(
|
|||||||
lowerPerModule,
|
lowerPerModule,
|
||||||
safeExternalBoolean,
|
safeExternalBoolean,
|
||||||
safeExternalBooleanDiagnostic,
|
safeExternalBooleanDiagnostic,
|
||||||
granularity
|
granularity,
|
||||||
|
icCompatibleIr2Js,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,6 +124,7 @@ fun compileIr(
|
|||||||
safeExternalBoolean: Boolean,
|
safeExternalBoolean: Boolean,
|
||||||
safeExternalBooleanDiagnostic: RuntimeDiagnostic?,
|
safeExternalBooleanDiagnostic: RuntimeDiagnostic?,
|
||||||
granularity: JsGenerationGranularity,
|
granularity: JsGenerationGranularity,
|
||||||
|
icCompatibleIr2Js: Boolean,
|
||||||
): LoweredIr {
|
): LoweredIr {
|
||||||
val moduleDescriptor = moduleFragment.descriptor
|
val moduleDescriptor = moduleFragment.descriptor
|
||||||
val irFactory = symbolTable.irFactory
|
val irFactory = symbolTable.irFactory
|
||||||
@@ -144,7 +147,8 @@ fun compileIr(
|
|||||||
baseClassIntoMetadata = baseClassIntoMetadata,
|
baseClassIntoMetadata = baseClassIntoMetadata,
|
||||||
safeExternalBoolean = safeExternalBoolean,
|
safeExternalBoolean = safeExternalBoolean,
|
||||||
safeExternalBooleanDiagnostic = safeExternalBooleanDiagnostic,
|
safeExternalBooleanDiagnostic = safeExternalBooleanDiagnostic,
|
||||||
granularity = granularity
|
granularity = granularity,
|
||||||
|
icCompatibleIr2Js = icCompatibleIr2Js,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Load declarations referenced during `context` initialization
|
// Load declarations referenced during `context` initialization
|
||||||
|
|||||||
@@ -70,7 +70,8 @@ fun compileWithIC(
|
|||||||
propertyLazyInitialization = propertyLazyInitialization,
|
propertyLazyInitialization = propertyLazyInitialization,
|
||||||
baseClassIntoMetadata = baseClassIntoMetadata,
|
baseClassIntoMetadata = baseClassIntoMetadata,
|
||||||
safeExternalBoolean = safeExternalBoolean,
|
safeExternalBoolean = safeExternalBoolean,
|
||||||
safeExternalBooleanDiagnostic = safeExternalBooleanDiagnostic
|
safeExternalBooleanDiagnostic = safeExternalBooleanDiagnostic,
|
||||||
|
icCompatibleIr2Js = true,
|
||||||
)
|
)
|
||||||
|
|
||||||
// Load declarations referenced during `context` initialization
|
// Load declarations referenced during `context` initialization
|
||||||
|
|||||||
+22
-20
@@ -20,27 +20,29 @@ class JsPropertyAccessorInlineLowering(
|
|||||||
return false
|
return false
|
||||||
|
|
||||||
// TODO: teach the deserializer to load constant property initializers
|
// TODO: teach the deserializer to load constant property initializers
|
||||||
val accessFile = accessContainer.fileOrNull ?: return false
|
if (context.icCompatibleIr2Js) {
|
||||||
val file = fileOrNull ?: return false
|
val accessFile = accessContainer.fileOrNull ?: return false
|
||||||
|
val file = fileOrNull ?: return false
|
||||||
|
|
||||||
return accessFile == file
|
return accessFile == file
|
||||||
|
}
|
||||||
|
|
||||||
// if (isConst)
|
if (isConst)
|
||||||
// return true
|
return true
|
||||||
//
|
|
||||||
// return when (context.granularity) {
|
return when (context.granularity) {
|
||||||
// JsGenerationGranularity.WHOLE_PROGRAM ->
|
JsGenerationGranularity.WHOLE_PROGRAM ->
|
||||||
// true
|
true
|
||||||
// JsGenerationGranularity.PER_MODULE -> {
|
JsGenerationGranularity.PER_MODULE -> {
|
||||||
// val accessModule = accessContainer.fileOrNull?.module ?: return false
|
val accessModule = accessContainer.fileOrNull?.module ?: return false
|
||||||
// val module = fileOrNull?.module ?: return false
|
val module = fileOrNull?.module ?: return false
|
||||||
// accessModule == module
|
accessModule == module
|
||||||
// }
|
}
|
||||||
// JsGenerationGranularity.PER_FILE ->
|
JsGenerationGranularity.PER_FILE ->
|
||||||
// // Not inlining because
|
// Not inlining because
|
||||||
// // 1. we need a way to distinguish per-file generation units
|
// 1. we need a way to distinguish per-file generation units
|
||||||
// // 2. per-file mode intended for debug builds only at the moment
|
// 2. per-file mode intended for debug builds only at the moment
|
||||||
// false
|
false
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -72,6 +72,7 @@ class JsIrBackendFacade(
|
|||||||
val splitPerModule = JsEnvironmentConfigurationDirectives.SPLIT_PER_MODULE in module.directives
|
val splitPerModule = JsEnvironmentConfigurationDirectives.SPLIT_PER_MODULE in module.directives
|
||||||
val splitPerFile = JsEnvironmentConfigurationDirectives.SPLIT_PER_FILE in module.directives
|
val splitPerFile = JsEnvironmentConfigurationDirectives.SPLIT_PER_FILE in module.directives
|
||||||
val perModule = JsEnvironmentConfigurationDirectives.PER_MODULE in module.directives
|
val perModule = JsEnvironmentConfigurationDirectives.PER_MODULE in module.directives
|
||||||
|
val runNewIr2Js = JsEnvironmentConfigurationDirectives.RUN_NEW_IR_2_JS in module.directives
|
||||||
|
|
||||||
val granularity = when {
|
val granularity = when {
|
||||||
!firstTimeCompilation -> JsGenerationGranularity.WHOLE_PROGRAM
|
!firstTimeCompilation -> JsGenerationGranularity.WHOLE_PROGRAM
|
||||||
@@ -117,7 +118,8 @@ class JsIrBackendFacade(
|
|||||||
lowerPerModule = lowerPerModule,
|
lowerPerModule = lowerPerModule,
|
||||||
safeExternalBoolean = JsEnvironmentConfigurationDirectives.SAFE_EXTERNAL_BOOLEAN in module.directives,
|
safeExternalBoolean = JsEnvironmentConfigurationDirectives.SAFE_EXTERNAL_BOOLEAN in module.directives,
|
||||||
safeExternalBooleanDiagnostic = module.directives[JsEnvironmentConfigurationDirectives.SAFE_EXTERNAL_BOOLEAN_DIAGNOSTIC].singleOrNull(),
|
safeExternalBooleanDiagnostic = module.directives[JsEnvironmentConfigurationDirectives.SAFE_EXTERNAL_BOOLEAN_DIAGNOSTIC].singleOrNull(),
|
||||||
granularity = granularity
|
granularity = granularity,
|
||||||
|
icCompatibleIr2Js = runNewIr2Js,
|
||||||
)
|
)
|
||||||
|
|
||||||
return loweredIr2JsArtifact(module, loweredIr, granularity)
|
return loweredIr2JsArtifact(module, loweredIr, granularity)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
// EXPECTED_REACHABLE_NODES: 1285
|
// EXPECTED_REACHABLE_NODES: 1285
|
||||||
|
// IGNORE_BACKEND: JS_IR
|
||||||
// IGNORE_BACKEND: JS_IR_ES6
|
// IGNORE_BACKEND: JS_IR_ES6
|
||||||
package foo
|
package foo
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -6,6 +6,10 @@ declare namespace JS_TESTS {
|
|||||||
interface ExportedInternalInterface {
|
interface ExportedInternalInterface {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
namespace foo {
|
||||||
|
interface FileLevelExportedExternalInterface {
|
||||||
|
}
|
||||||
|
}
|
||||||
namespace foo {
|
namespace foo {
|
||||||
const exportedVal: number;
|
const exportedVal: number;
|
||||||
function exportedFun(): number;
|
function exportedFun(): number;
|
||||||
@@ -14,10 +18,6 @@ declare namespace JS_TESTS {
|
|||||||
readonly value: number;
|
readonly value: number;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
namespace foo {
|
|
||||||
interface FileLevelExportedExternalInterface {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
namespace foo {
|
namespace foo {
|
||||||
const fileLevelExportedVal: number;
|
const fileLevelExportedVal: number;
|
||||||
function fileLevelExportedFun(): number;
|
function fileLevelExportedFun(): number;
|
||||||
|
|||||||
Reference in New Issue
Block a user