[gn] Add gn support to gcmole

This also adds sources missing for PPC and x87, fixes a few
missing files in gyp due to wrong quotation and a few that
were simply not included.

The gn files are now authoritative, but the gcmole gyp and
gn source lists are enforced to match exactly.

This additional enforcement helped finding the bugs above
and will be removed when we deprecate the gyp files.

BUG=614645
NOTRY=true

Review-Url: https://codereview.chromium.org/2352103002
Cr-Commit-Position: refs/heads/master@{#39592}
This commit is contained in:
machenbach 2016-09-21 04:44:10 -07:00 committed by Commit bot
parent 1601e35a9a
commit a8951a96ab
5 changed files with 178 additions and 41 deletions

102
BUILD.gn
View File

@ -827,6 +827,8 @@ v8_source_set("v8_base") {
sources = [
"//base/trace_event/common/trace_event_common.h",
### gcmole(all) ###
"include/v8-debug.h",
"include/v8-experimental.h",
"include/v8-platform.h",
@ -1707,7 +1709,7 @@ v8_source_set("v8_base") {
]
if (v8_current_cpu == "x86") {
sources += [
sources += [ ### gcmole(arch:ia32) ###
"src/builtins/ia32/builtins-ia32.cc",
"src/compiler/ia32/code-generator-ia32.cc",
"src/compiler/ia32/instruction-codes-ia32.h",
@ -1747,7 +1749,7 @@ v8_source_set("v8_base") {
"src/regexp/ia32/regexp-macro-assembler-ia32.h",
]
} else if (v8_current_cpu == "x64") {
sources += [
sources += [ ### gcmole(arch:x64) ###
"src/builtins/x64/builtins-x64.cc",
"src/compiler/x64/code-generator-x64.cc",
"src/compiler/x64/instruction-codes-x64.h",
@ -1792,7 +1794,7 @@ v8_source_set("v8_base") {
"src/x64/sse-instr.h",
]
} else if (v8_current_cpu == "arm") {
sources += [
sources += [ ### gcmole(arch:arm) ###
"src/arm/assembler-arm-inl.h",
"src/arm/assembler-arm.cc",
"src/arm/assembler-arm.h",
@ -1838,7 +1840,7 @@ v8_source_set("v8_base") {
"src/regexp/arm/regexp-macro-assembler-arm.h",
]
} else if (v8_current_cpu == "arm64") {
sources += [
sources += [ ### gcmole(arch:arm64) ###
"src/arm64/assembler-arm64-inl.h",
"src/arm64/assembler-arm64.cc",
"src/arm64/assembler-arm64.h",
@ -1896,8 +1898,8 @@ v8_source_set("v8_base") {
"src/regexp/arm64/regexp-macro-assembler-arm64.cc",
"src/regexp/arm64/regexp-macro-assembler-arm64.h",
]
} else if (v8_current_cpu == "mipsel") {
sources += [
} else if (v8_current_cpu == "mips" || v8_current_cpu == "mipsel") {
sources += [ ### gcmole(arch:mipsel) ###
"src/builtins/mips/builtins-mips.cc",
"src/compiler/mips/code-generator-mips.cc",
"src/compiler/mips/instruction-codes-mips.h",
@ -1938,8 +1940,8 @@ v8_source_set("v8_base") {
"src/regexp/mips/regexp-macro-assembler-mips.cc",
"src/regexp/mips/regexp-macro-assembler-mips.h",
]
} else if (v8_current_cpu == "mips64el") {
sources += [
} else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") {
sources += [ ### gcmole(arch:mips64el) ###
"src/builtins/mips64/builtins-mips64.cc",
"src/compiler/mips64/code-generator-mips64.cc",
"src/compiler/mips64/instruction-codes-mips64.h",
@ -1980,8 +1982,50 @@ v8_source_set("v8_base") {
"src/regexp/mips64/regexp-macro-assembler-mips64.cc",
"src/regexp/mips64/regexp-macro-assembler-mips64.h",
]
} else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
sources += [ ### gcmole(arch:ppc) ###
"src/builtins/ppc/builtins-ppc.cc",
"src/compiler/ppc/code-generator-ppc.cc",
"src/compiler/ppc/instruction-codes-ppc.h",
"src/compiler/ppc/instruction-scheduler-ppc.cc",
"src/compiler/ppc/instruction-selector-ppc.cc",
"src/crankshaft/ppc/lithium-codegen-ppc.cc",
"src/crankshaft/ppc/lithium-codegen-ppc.h",
"src/crankshaft/ppc/lithium-gap-resolver-ppc.cc",
"src/crankshaft/ppc/lithium-gap-resolver-ppc.h",
"src/crankshaft/ppc/lithium-ppc.cc",
"src/crankshaft/ppc/lithium-ppc.h",
"src/debug/ppc/debug-ppc.cc",
"src/full-codegen/ppc/full-codegen-ppc.cc",
"src/ic/ppc/access-compiler-ppc.cc",
"src/ic/ppc/handler-compiler-ppc.cc",
"src/ic/ppc/ic-compiler-ppc.cc",
"src/ic/ppc/ic-ppc.cc",
"src/ic/ppc/stub-cache-ppc.cc",
"src/ppc/assembler-ppc-inl.h",
"src/ppc/assembler-ppc.cc",
"src/ppc/assembler-ppc.h",
"src/ppc/code-stubs-ppc.cc",
"src/ppc/code-stubs-ppc.h",
"src/ppc/codegen-ppc.cc",
"src/ppc/codegen-ppc.h",
"src/ppc/constants-ppc.cc",
"src/ppc/constants-ppc.h",
"src/ppc/cpu-ppc.cc",
"src/ppc/deoptimizer-ppc.cc",
"src/ppc/disasm-ppc.cc",
"src/ppc/frames-ppc.cc",
"src/ppc/frames-ppc.h",
"src/ppc/interface-descriptors-ppc.cc",
"src/ppc/macro-assembler-ppc.cc",
"src/ppc/macro-assembler-ppc.h",
"src/ppc/simulator-ppc.cc",
"src/ppc/simulator-ppc.h",
"src/regexp/ppc/regexp-macro-assembler-ppc.cc",
"src/regexp/ppc/regexp-macro-assembler-ppc.h",
]
} else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
sources += [
sources += [ ### gcmole(arch:s390) ###
"src/builtins/s390/builtins-s390.cc",
"src/compiler/s390/code-generator-s390.cc",
"src/compiler/s390/instruction-codes-s390.h",
@ -2022,6 +2066,46 @@ v8_source_set("v8_base") {
"src/s390/simulator-s390.cc",
"src/s390/simulator-s390.h",
]
} else if (v8_current_cpu == "x87") {
sources += [ ### gcmole(arch:x87) ###
"src/builtins/x87/builtins-x87.cc",
"src/compiler/x87/code-generator-x87.cc",
"src/compiler/x87/instruction-codes-x87.h",
"src/compiler/x87/instruction-scheduler-x87.cc",
"src/compiler/x87/instruction-selector-x87.cc",
"src/crankshaft/x87/lithium-codegen-x87.cc",
"src/crankshaft/x87/lithium-codegen-x87.h",
"src/crankshaft/x87/lithium-gap-resolver-x87.cc",
"src/crankshaft/x87/lithium-gap-resolver-x87.h",
"src/crankshaft/x87/lithium-x87.cc",
"src/crankshaft/x87/lithium-x87.h",
"src/debug/x87/debug-x87.cc",
"src/full-codegen/x87/full-codegen-x87.cc",
"src/ic/x87/access-compiler-x87.cc",
"src/ic/x87/handler-compiler-x87.cc",
"src/ic/x87/ic-compiler-x87.cc",
"src/ic/x87/ic-x87.cc",
"src/ic/x87/stub-cache-x87.cc",
"src/regexp/x87/regexp-macro-assembler-x87.cc",
"src/regexp/x87/regexp-macro-assembler-x87.h",
"src/x87/assembler-x87-inl.h",
"src/x87/assembler-x87.cc",
"src/x87/assembler-x87.h",
"src/x87/code-stubs-x87.cc",
"src/x87/code-stubs-x87.h",
"src/x87/codegen-x87.cc",
"src/x87/codegen-x87.h",
"src/x87/cpu-x87.cc",
"src/x87/deoptimizer-x87.cc",
"src/x87/disasm-x87.cc",
"src/x87/frames-x87.cc",
"src/x87/frames-x87.h",
"src/x87/interface-descriptors-x87.cc",
"src/x87/macro-assembler-x87.cc",
"src/x87/macro-assembler-x87.h",
"src/x87/simulator-x87.cc",
"src/x87/simulator-x87.h",
]
}
configs = [ ":internal_config" ]

View File

@ -582,14 +582,14 @@
'compiler/effect-control-linearizer.h',
'compiler/escape-analysis.cc',
'compiler/escape-analysis.h',
"compiler/escape-analysis-reducer.cc",
"compiler/escape-analysis-reducer.h",
'compiler/escape-analysis-reducer.cc',
'compiler/escape-analysis-reducer.h',
'compiler/frame.cc',
'compiler/frame.h',
'compiler/frame-elider.cc',
'compiler/frame-elider.h',
"compiler/frame-states.cc",
"compiler/frame-states.h",
'compiler/frame-states.cc',
'compiler/frame-states.h',
'compiler/gap-resolver.cc',
'compiler/gap-resolver.h',
'compiler/graph-reducer.cc',
@ -1560,9 +1560,15 @@
'regexp/mips64/regexp-macro-assembler-mips64.h',
],
}],
['v8_target_arch=="x64" or v8_target_arch=="x32"', {
['v8_target_arch=="x64"', {
'sources': [ ### gcmole(arch:x64) ###
'builtins/x64/builtins-x64.cc',
'compiler/x64/code-generator-x64.cc',
'compiler/x64/instruction-codes-x64.h',
'compiler/x64/instruction-scheduler-x64.cc',
'compiler/x64/instruction-selector-x64.cc',
'compiler/x64/unwinding-info-writer-x64.h',
'compiler/x64/unwinding-info-writer-x64.cc',
'crankshaft/x64/lithium-codegen-x64.cc',
'crankshaft/x64/lithium-codegen-x64.h',
'crankshaft/x64/lithium-gap-resolver-x64.cc',
@ -1579,6 +1585,7 @@
'x64/cpu-x64.cc',
'x64/deoptimizer-x64.cc',
'x64/disasm-x64.cc',
'x64/eh-frame-x64.cc',
'x64/frames-x64.cc',
'x64/frames-x64.h',
'x64/interface-descriptors-x64.cc',
@ -1599,17 +1606,6 @@
'third_party/valgrind/valgrind.h',
],
}],
['v8_target_arch=="x64"', {
'sources': [
'compiler/x64/code-generator-x64.cc',
'compiler/x64/instruction-codes-x64.h',
'compiler/x64/instruction-scheduler-x64.cc',
'compiler/x64/instruction-selector-x64.cc',
'compiler/x64/unwinding-info-writer-x64.h',
'compiler/x64/unwinding-info-writer-x64.cc',
'x64/eh-frame-x64.cc',
],
}],
['v8_target_arch=="ppc" or v8_target_arch=="ppc64"', {
'sources': [ ### gcmole(arch:ppc) ###
'builtins/ppc/builtins-ppc.cc',

View File

@ -9,6 +9,8 @@ v8_executable("cctest") {
sources = [
"$target_gen_dir/resources.cc",
### gcmole(all) ###
"asmjs/test-asm-typer.cc",
"ast-types-fuzz.h",
"cctest.cc",
@ -195,7 +197,7 @@ v8_executable("cctest") {
]
if (v8_current_cpu == "arm") {
sources += [
sources += [ ### gcmole(arch:arm) ###
"test-assembler-arm.cc",
"test-code-stubs-arm.cc",
"test-code-stubs.cc",
@ -205,7 +207,7 @@ v8_executable("cctest") {
"test-run-wasm-relocation-arm.cc",
]
} else if (v8_current_cpu == "arm64") {
sources += [
sources += [ ### gcmole(arch:arm64) ###
"test-assembler-arm64.cc",
"test-code-stubs-arm64.cc",
"test-code-stubs.cc",
@ -219,7 +221,7 @@ v8_executable("cctest") {
"test-utils-arm64.h",
]
} else if (v8_current_cpu == "x86") {
sources += [
sources += [ ### gcmole(arch:ia32) ###
"test-assembler-ia32.cc",
"test-code-stubs-ia32.cc",
"test-code-stubs.cc",
@ -230,7 +232,7 @@ v8_executable("cctest") {
"test-run-wasm-relocation-ia32.cc",
]
} else if (v8_current_cpu == "mips") {
sources += [
sources += [ ### gcmole(arch:mips) ###
"test-assembler-mips.cc",
"test-code-stubs-mips.cc",
"test-code-stubs.cc",
@ -239,7 +241,7 @@ v8_executable("cctest") {
"test-macro-assembler-mips.cc",
]
} else if (v8_current_cpu == "mipsel") {
sources += [
sources += [ ### gcmole(arch:mipsel) ###
"test-assembler-mips.cc",
"test-code-stubs-mips.cc",
"test-code-stubs.cc",
@ -248,7 +250,7 @@ v8_executable("cctest") {
"test-macro-assembler-mips.cc",
]
} else if (v8_current_cpu == "mips64") {
sources += [
sources += [ ### gcmole(arch:mips64) ###
"test-assembler-mips64.cc",
"test-code-stubs-mips64.cc",
"test-code-stubs.cc",
@ -257,7 +259,7 @@ v8_executable("cctest") {
"test-macro-assembler-mips64.cc",
]
} else if (v8_current_cpu == "mips64el") {
sources += [
sources += [ ### gcmole(arch:mips64el) ###
"test-assembler-mips64.cc",
"test-code-stubs-mips64.cc",
"test-code-stubs.cc",
@ -266,7 +268,7 @@ v8_executable("cctest") {
"test-macro-assembler-mips64.cc",
]
} else if (v8_current_cpu == "x64") {
sources += [
sources += [ ### gcmole(arch:x64) ###
"test-assembler-x64.cc",
"test-code-stubs-x64.cc",
"test-code-stubs.cc",
@ -278,7 +280,7 @@ v8_executable("cctest") {
"wasm/test-run-wasm-simd.cc",
]
} else if (v8_current_cpu == "x87") {
sources += [
sources += [ ### gcmole(arch:x87) ###
"test-assembler-x87.cc",
"test-code-stubs-x87.cc",
"test-code-stubs.cc",
@ -289,14 +291,14 @@ v8_executable("cctest") {
"test-run-wasm-relocation-x87.cc",
]
} else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
sources += [
sources += [ ### gcmole(arch:ppc) ###
"test-assembler-ppc.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-ppc.cc",
]
} else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
sources += [
sources += [ ### gcmole(arch:s390) ###
"test-assembler-s390.cc",
"test-code-stubs.cc",
"test-code-stubs.h",

View File

@ -183,6 +183,7 @@ end
-------------------------------------------------------------------------------
-- GYP file parsing
-- TODO(machenbach): Remove this when deprecating gyp.
local function ParseGYPFile()
local result = {}
local gyp_files = {
@ -209,6 +210,32 @@ local function ParseGYPFile()
return result
end
local function ParseGNFile()
local result = {}
local gn_files = {
{ "BUILD.gn", '"([^"]-%.cc)"', "" },
{ "test/cctest/BUILD.gn", '"(test-[^"]-%.cc)"', "test/cctest/" }
}
for i = 1, #gn_files do
local filename = gn_files[i][1]
local pattern = gn_files[i][2]
local prefix = gn_files[i][3]
local gn_file = assert(io.open(filename), "failed to open GN file")
local gn = gn_file:read('*a')
for condition, sources in
gn:gmatch "### gcmole%((.-)%) ###(.-)%]" do
if result[condition] == nil then result[condition] = {} end
for file in sources:gmatch(pattern) do
table.insert(result[condition], prefix .. file)
end
end
gn_file:close()
end
return result
end
local function EvaluateCondition(cond, props)
if cond == 'all' then return true end
@ -230,13 +257,40 @@ local function BuildFileList(sources, props)
return list
end
local sources = ParseGYPFile()
local gyp_sources = ParseGYPFile()
local gn_sources = ParseGNFile()
-- TODO(machenbach): Remove this comparison logic when deprecating gyp.
local function CompareSources(sources1, sources2, what)
for condition, files1 in pairs(sources1) do
local files2 = sources2[condition]
assert(
files2 ~= nil,
"Missing gcmole condition in " .. what .. ": " .. condition)
-- Turn into set for speed.
files2_set = {}
for i, file in pairs(files2) do files2_set[file] = true end
for i, file in pairs(files1) do
assert(
files2_set[file] ~= nil,
"Missing file " .. file .. " in " .. what .. " for condition " ..
condition)
end
end
end
CompareSources(gyp_sources, gn_sources, "GN")
CompareSources(gn_sources, gyp_sources, "GYP")
local function FilesForArch(arch)
return BuildFileList(sources, { os = 'linux',
arch = arch,
mode = 'debug',
simulator = ''})
return BuildFileList(gn_sources, { os = 'linux',
arch = arch,
mode = 'debug',
simulator = ''})
end
local mtConfig = {}

View File

@ -12,6 +12,7 @@
'parallel.py',
'run-gcmole.py',
# The following contains all relevant source and gyp files.
'../../BUILD.gn',
'../../base/',
'../../include/',
'../../src/',