Fix BUILD.gn files and add presubmit step

Remove files that were removed from the build files but never deleted.

R=machenbach@chromium.org
BUG=

Review-Url: https://codereview.chromium.org/2346103002
Cr-Commit-Position: refs/heads/master@{#39499}
This commit is contained in:
jochen 2016-09-19 03:58:59 -07:00 committed by Commit bot
parent 95cc98c99c
commit d7ef0b8c97
11 changed files with 176 additions and 506 deletions

View File

@ -1772,6 +1772,7 @@ v8_source_set("v8_base") {
"src/ic/x64/stub-cache-x64.cc",
"src/regexp/x64/regexp-macro-assembler-x64.cc",
"src/regexp/x64/regexp-macro-assembler-x64.h",
"src/third_party/valgrind/valgrind.h",
"src/x64/assembler-x64-inl.h",
"src/x64/assembler-x64.cc",
"src/x64/assembler-x64.h",

View File

@ -216,6 +216,38 @@ def _CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api):
return []
def _CheckMissingFiles(input_api, output_api):
"""Runs verify_source_deps.py to ensure no files were added that are not in
GN.
"""
# We need to wait until we have an input_api object and use this
# roundabout construct to import checkdeps because this file is
# eval-ed and thus doesn't have __file__.
original_sys_path = sys.path
try:
sys.path = sys.path + [input_api.os_path.join(
input_api.PresubmitLocalPath(), 'tools')]
from verify_source_deps import missing_gn_files, missing_gyp_files
finally:
# Restore sys.path to what it was before.
sys.path = original_sys_path
gn_files = missing_gn_files()
gyp_files = missing_gyp_files()
results = []
if gn_files:
results.append(output_api.PresubmitError(
"You added one or more source files but didn't update the\n"
"corresponding BUILD.gn files:\n",
gn_files))
if gyp_files:
results.append(output_api.PresubmitError(
"You added one or more source files but didn't update the\n"
"corresponding gyp files:\n",
gyp_files))
return results
def _CommonChecks(input_api, output_api):
"""Checks common to both upload and commit."""
results = []
@ -231,6 +263,7 @@ def _CommonChecks(input_api, output_api):
_CheckNoProductionCodeUsingTestOnlyFunctions(input_api, output_api))
results.extend(
_CheckNoInlineHeaderIncludesInNormalHeaders(input_api, output_api))
results.extend(_CheckMissingFiles(input_api, output_api))
return results

View File

@ -961,6 +961,7 @@
'ic/call-optimization.h',
'ic/handler-compiler.cc',
'ic/handler-compiler.h',
'ic/handler-configuration.h',
'ic/ic-inl.h',
'ic/ic-state.cc',
'ic/ic-state.h',
@ -1412,6 +1413,8 @@
'ia32/interface-descriptors-ia32.cc',
'ia32/macro-assembler-ia32.cc',
'ia32/macro-assembler-ia32.h',
'ia32/simulator-ia32.cc',
'ia32/simulator-ia32.h',
'builtins/ia32/builtins-ia32.cc',
'compiler/ia32/code-generator-ia32.cc',
'compiler/ia32/instruction-codes-ia32.h',
@ -1451,6 +1454,8 @@
'x87/interface-descriptors-x87.cc',
'x87/macro-assembler-x87.cc',
'x87/macro-assembler-x87.h',
'x87/simulator-x87.cc',
'x87/simulator-x87.h',
'builtins/x87/builtins-x87.cc',
'compiler/x87/code-generator-x87.cc',
'compiler/x87/instruction-codes-x87.h',
@ -1583,6 +1588,8 @@
'x64/interface-descriptors-x64.cc',
'x64/macro-assembler-x64.cc',
'x64/macro-assembler-x64.h',
'x64/simulator-x64.cc',
'x64/simulator-x64.h',
'x64/sse-instr.h',
'debug/x64/debug-x64.cc',
'full-codegen/x64/full-codegen-x64.cc',
@ -1593,6 +1600,7 @@
'ic/x64/stub-cache-x64.cc',
'regexp/x64/regexp-macro-assembler-x64.cc',
'regexp/x64/regexp-macro-assembler-x64.h',
'third_party/valgrind/valgrind.h',
],
}],
['v8_target_arch=="x64"', {

View File

@ -10,8 +10,11 @@ v8_executable("cctest") {
sources = [
"$target_gen_dir/resources.cc",
"asmjs/test-asm-typer.cc",
"ast-types-fuzz.h",
"cctest.cc",
"cctest.h",
"compiler/c-signature.h",
"compiler/call-tester.h",
"compiler/code-assembler-tester.h",
"compiler/codegen-tester.cc",
"compiler/codegen-tester.h",
@ -55,9 +58,14 @@ v8_executable("cctest") {
"compiler/test-run-unwinding-info.cc",
"compiler/test-run-variables.cc",
"compiler/test-run-wasm-machops.cc",
"compiler/value-helper.h",
"expression-type-collector-macros.h",
"gay-fixed.cc",
"gay-fixed.h",
"gay-precision.cc",
"gay-precision.h",
"gay-shortest.cc",
"gay-shortest.h",
"heap/heap-tester.h",
"heap/heap-utils.cc",
"heap/heap-utils.h",
@ -73,6 +81,7 @@ v8_executable("cctest") {
"interpreter/bytecode-expectations-printer.cc",
"interpreter/bytecode-expectations-printer.h",
"interpreter/interpreter-tester.cc",
"interpreter/interpreter-tester.h",
"interpreter/source-position-matcher.cc",
"interpreter/source-position-matcher.h",
"interpreter/test-bytecode-generator.cc",
@ -83,7 +92,9 @@ v8_executable("cctest") {
"libsampler/test-sampler.cc",
"parsing/test-scanner-streams.cc",
"print-extension.cc",
"print-extension.h",
"profiler-extension.cc",
"profiler-extension.h",
"test-access-checks.cc",
"test-accessors.cc",
"test-api-accessors.cc",
@ -117,6 +128,7 @@ v8_executable("cctest") {
"test-elements-kind.cc",
"test-fast-dtoa.cc",
"test-feedback-vector.cc",
"test-feedback-vector.h",
"test-field-type-tracking.cc",
"test-fixed-dtoa.cc",
"test-flags.cc",
@ -164,6 +176,8 @@ v8_executable("cctest") {
"test-weakmaps.cc",
"test-weaksets.cc",
"trace-extension.cc",
"trace-extension.h",
"types-fuzz.h",
"wasm/test-run-wasm-64.cc",
"wasm/test-run-wasm-asmjs.cc",
"wasm/test-run-wasm-interpreter.cc",
@ -183,6 +197,7 @@ v8_executable("cctest") {
"test-assembler-arm.cc",
"test-code-stubs-arm.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-arm.cc",
"test-macro-assembler-arm.cc",
"test-run-wasm-relocation-arm.cc",
@ -192,18 +207,21 @@ v8_executable("cctest") {
"test-assembler-arm64.cc",
"test-code-stubs-arm64.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-arm64.cc",
"test-fuzz-arm64.cc",
"test-javascript-arm64.cc",
"test-js-arm64-variables.cc",
"test-run-wasm-relocation-arm64.cc",
"test-utils-arm64.cc",
"test-utils-arm64.h",
]
} else if (v8_current_cpu == "x86") {
sources += [
"test-assembler-ia32.cc",
"test-code-stubs-ia32.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-ia32.cc",
"test-log-stack-tracer.cc",
"test-macro-assembler-ia32.cc",
@ -214,6 +232,7 @@ v8_executable("cctest") {
"test-assembler-mips.cc",
"test-code-stubs-mips.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-mips.cc",
"test-macro-assembler-mips.cc",
]
@ -222,6 +241,7 @@ v8_executable("cctest") {
"test-assembler-mips.cc",
"test-code-stubs-mips.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-mips.cc",
"test-macro-assembler-mips.cc",
]
@ -230,6 +250,7 @@ v8_executable("cctest") {
"test-assembler-mips64.cc",
"test-code-stubs-mips64.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-mips64.cc",
"test-macro-assembler-mips64.cc",
]
@ -238,6 +259,7 @@ v8_executable("cctest") {
"test-assembler-mips64.cc",
"test-code-stubs-mips64.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-mips64.cc",
"test-macro-assembler-mips64.cc",
]
@ -246,6 +268,7 @@ v8_executable("cctest") {
"test-assembler-x64.cc",
"test-code-stubs-x64.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-x64.cc",
"test-log-stack-tracer.cc",
"test-macro-assembler-x64.cc",
@ -257,6 +280,7 @@ v8_executable("cctest") {
"test-assembler-x87.cc",
"test-code-stubs-x87.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-x87.cc",
"test-log-stack-tracer.cc",
"test-macro-assembler-x87.cc",
@ -266,12 +290,14 @@ v8_executable("cctest") {
sources += [
"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 += [
"test-assembler-s390.cc",
"test-code-stubs.cc",
"test-code-stubs.h",
"test-disasm-s390.cc",
]
}

View File

@ -33,7 +33,9 @@
'generated_file': '<(SHARED_INTERMEDIATE_DIR)/resources.cc',
'cctest_sources': [ ### gcmole(all) ###
'asmjs/test-asm-typer.cc',
'ast-types-fuzz.h',
'compiler/c-signature.h',
'compiler/call-tester.h',
'compiler/codegen-tester.cc',
'compiler/codegen-tester.h',
'compiler/code-assembler-tester.h',
@ -77,8 +79,12 @@
'compiler/test-run-stubs.cc',
'compiler/test-run-variables.cc',
'compiler/test-run-wasm-machops.cc',
'compiler/value-helper.h',
'cctest.cc',
'cctest.h',
'expression-type-collector-macros.h',
'interpreter/interpreter-tester.cc',
'interpreter/interpreter-tester.h',
'interpreter/source-position-matcher.cc',
'interpreter/source-position-matcher.h',
'interpreter/test-bytecode-generator.cc',
@ -88,8 +94,11 @@
'interpreter/bytecode-expectations-printer.cc',
'interpreter/bytecode-expectations-printer.h',
'gay-fixed.cc',
'gay-fixed.h',
'gay-precision.cc',
'gay-precision.h',
'gay-shortest.cc',
'gay-shortest.h',
'heap/heap-tester.h',
'heap/heap-utils.cc',
'heap/heap-utils.h',
@ -106,7 +115,9 @@
'libsampler/test-sampler.cc',
'parsing/test-scanner-streams.cc',
'print-extension.cc',
'print-extension.h',
'profiler-extension.cc',
'profiler-extension.h',
'test-access-checks.cc',
'test-accessors.cc',
'test-api.cc',
@ -139,6 +150,7 @@
'test-elements-kind.cc',
'test-fast-dtoa.cc',
'test-feedback-vector.cc',
'test-feedback-vector.h',
'test-field-type-tracking.cc',
'test-fixed-dtoa.cc',
'test-flags.cc',
@ -187,6 +199,8 @@
'test-weakmaps.cc',
'test-weaksets.cc',
'trace-extension.cc',
'trace-extension.h',
'types-fuzz.h',
'wasm/test-run-wasm.cc',
'wasm/test-run-wasm-64.cc',
'wasm/test-run-wasm-asmjs.cc',
@ -203,6 +217,7 @@
'cctest_sources_ia32': [ ### gcmole(arch:ia32) ###
'test-assembler-ia32.cc',
'test-code-stubs.cc',
'test-code-stubs.h',
'test-code-stubs-ia32.cc',
'test-disasm-ia32.cc',
'test-macro-assembler-ia32.cc',
@ -212,6 +227,7 @@
'cctest_sources_x64': [ ### gcmole(arch:x64) ###
'test-assembler-x64.cc',
'test-code-stubs.cc',
'test-code-stubs.h',
'test-code-stubs-x64.cc',
'test-disasm-x64.cc',
'test-macro-assembler-x64.cc',
@ -222,6 +238,7 @@
'cctest_sources_arm': [ ### gcmole(arch:arm) ###
'test-assembler-arm.cc',
'test-code-stubs.cc',
'test-code-stubs.h',
'test-code-stubs-arm.cc',
'test-disasm-arm.cc',
'test-macro-assembler-arm.cc',
@ -229,8 +246,10 @@
],
'cctest_sources_arm64': [ ### gcmole(arch:arm64) ###
'test-utils-arm64.cc',
'test-utils-arm64.h',
'test-assembler-arm64.cc',
'test-code-stubs.cc',
'test-code-stubs.h',
'test-code-stubs-arm64.cc',
'test-disasm-arm64.cc',
'test-fuzz-arm64.cc',
@ -241,16 +260,19 @@
'cctest_sources_s390': [ ### gcmole(arch:s390) ###
'test-assembler-s390.cc',
'test-code-stubs.cc',
'test-code-stubs.h',
'test-disasm-s390.cc'
],
'cctest_sources_ppc': [ ### gcmole(arch:ppc) ###
'test-assembler-ppc.cc',
'test-code-stubs.cc',
'test-code-stubs.h',
'test-disasm-ppc.cc'
],
'cctest_sources_mips': [ ### gcmole(arch:mips) ###
'test-assembler-mips.cc',
'test-code-stubs.cc',
'test-code-stubs.h',
'test-code-stubs-mips.cc',
'test-disasm-mips.cc',
'test-macro-assembler-mips.cc'
@ -258,6 +280,7 @@
'cctest_sources_mipsel': [ ### gcmole(arch:mipsel) ###
'test-assembler-mips.cc',
'test-code-stubs.cc',
'test-code-stubs.h',
'test-code-stubs-mips.cc',
'test-disasm-mips.cc',
'test-macro-assembler-mips.cc'
@ -265,6 +288,7 @@
'cctest_sources_mips64': [ ### gcmole(arch:mips64) ###
'test-assembler-mips64.cc',
'test-code-stubs.cc',
'test-code-stubs.h',
'test-code-stubs-mips64.cc',
'test-disasm-mips64.cc',
'test-macro-assembler-mips64.cc'
@ -272,6 +296,7 @@
'cctest_sources_mips64el': [ ### gcmole(arch:mips64el) ###
'test-assembler-mips64.cc',
'test-code-stubs.cc',
'test-code-stubs.h',
'test-code-stubs-mips64.cc',
'test-disasm-mips64.cc',
'test-macro-assembler-mips64.cc'
@ -279,6 +304,7 @@
'cctest_sources_x87': [ ### gcmole(arch:x87) ###
'test-assembler-x87.cc',
'test-code-stubs.cc',
'test-code-stubs.h',
'test-code-stubs-x87.cc',
'test-disasm-x87.cc',
'test-macro-assembler-x87.cc',

View File

@ -1,133 +0,0 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/heap/slots-buffer.h"
#include "test/cctest/cctest.h"
#include "test/cctest/heap/heap-utils.h"
namespace v8 {
namespace internal {
TEST(SlotsBufferObjectSlotsRemoval) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
Isolate* isolate = CcTest::i_isolate();
Heap* heap = isolate->heap();
Factory* factory = isolate->factory();
SlotsBuffer* buffer = new SlotsBuffer(NULL);
void* fake_object[1];
Handle<FixedArray> array = factory->NewFixedArray(2, TENURED);
CHECK(heap->old_space()->Contains(*array));
array->set(0, reinterpret_cast<Object*>(fake_object), SKIP_WRITE_BARRIER);
// Firstly, let's test the regular slots buffer entry.
buffer->Add(HeapObject::RawField(*array, FixedArray::kHeaderSize));
CHECK(reinterpret_cast<void*>(buffer->Get(0)) ==
HeapObject::RawField(*array, FixedArray::kHeaderSize));
SlotsBuffer::RemoveObjectSlots(CcTest::i_isolate()->heap(), buffer,
array->address(),
array->address() + array->Size());
CHECK(reinterpret_cast<void*>(buffer->Get(0)) ==
HeapObject::RawField(heap->empty_fixed_array(),
FixedArrayBase::kLengthOffset));
// Secondly, let's test the typed slots buffer entry.
SlotsBuffer::AddTo(NULL, &buffer, SlotsBuffer::EMBEDDED_OBJECT_SLOT,
array->address() + FixedArray::kHeaderSize,
SlotsBuffer::FAIL_ON_OVERFLOW);
CHECK(reinterpret_cast<void*>(buffer->Get(1)) ==
reinterpret_cast<Object**>(SlotsBuffer::EMBEDDED_OBJECT_SLOT));
CHECK(reinterpret_cast<void*>(buffer->Get(2)) ==
HeapObject::RawField(*array, FixedArray::kHeaderSize));
SlotsBuffer::RemoveObjectSlots(CcTest::i_isolate()->heap(), buffer,
array->address(),
array->address() + array->Size());
CHECK(reinterpret_cast<void*>(buffer->Get(1)) ==
HeapObject::RawField(heap->empty_fixed_array(),
FixedArrayBase::kLengthOffset));
CHECK(reinterpret_cast<void*>(buffer->Get(2)) ==
HeapObject::RawField(heap->empty_fixed_array(),
FixedArrayBase::kLengthOffset));
delete buffer;
}
TEST(FilterInvalidSlotsBufferEntries) {
FLAG_manual_evacuation_candidates_selection = true;
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
Isolate* isolate = CcTest::i_isolate();
Heap* heap = isolate->heap();
Factory* factory = isolate->factory();
SlotsBuffer* buffer = new SlotsBuffer(NULL);
// Set up a fake black object that will contain a recorded SMI, a recorded
// pointer to a new space object, and a recorded pointer to a non-evacuation
// candidate object. These object should be filtered out. Additionally,
// we point to an evacuation candidate object which should not be filtered
// out.
// Create fake object and mark it black.
Handle<FixedArray> fake_object = factory->NewFixedArray(23, TENURED);
MarkBit mark_bit = Marking::MarkBitFrom(*fake_object);
Marking::MarkBlack(mark_bit);
// Write a SMI into field one and record its address;
Object** field_smi = fake_object->RawFieldOfElementAt(0);
*field_smi = Smi::FromInt(100);
buffer->Add(field_smi);
// Write a new space reference into field 2 and record its address;
Handle<FixedArray> new_space_object = factory->NewFixedArray(23);
mark_bit = Marking::MarkBitFrom(*new_space_object);
Marking::MarkBlack(mark_bit);
Object** field_new_space = fake_object->RawFieldOfElementAt(1);
*field_new_space = *new_space_object;
buffer->Add(field_new_space);
// Write an old space reference into field 3 which points to an object not on
// an evacuation candidate.
Handle<FixedArray> old_space_object_non_evacuation =
factory->NewFixedArray(23, TENURED);
mark_bit = Marking::MarkBitFrom(*old_space_object_non_evacuation);
Marking::MarkBlack(mark_bit);
Object** field_old_space_object_non_evacuation =
fake_object->RawFieldOfElementAt(2);
*field_old_space_object_non_evacuation = *old_space_object_non_evacuation;
buffer->Add(field_old_space_object_non_evacuation);
// Write an old space reference into field 4 which points to an object on an
// evacuation candidate.
heap::SimulateFullSpace(heap->old_space());
Handle<FixedArray> valid_object =
isolate->factory()->NewFixedArray(23, TENURED);
Page* page = Page::FromAddress(valid_object->address());
page->SetFlag(MemoryChunk::EVACUATION_CANDIDATE);
Object** valid_field = fake_object->RawFieldOfElementAt(3);
*valid_field = *valid_object;
buffer->Add(valid_field);
SlotsBuffer::RemoveInvalidSlots(heap, buffer);
Object** kRemovedEntry = HeapObject::RawField(heap->empty_fixed_array(),
FixedArrayBase::kLengthOffset);
CHECK_EQ(buffer->Get(0), kRemovedEntry);
CHECK_EQ(buffer->Get(1), kRemovedEntry);
CHECK_EQ(buffer->Get(2), kRemovedEntry);
CHECK_EQ(buffer->Get(3), valid_field);
// Clean-up to make verify heap happy.
mark_bit = Marking::MarkBitFrom(*fake_object);
Marking::MarkWhite(mark_bit);
mark_bit = Marking::MarkBitFrom(*new_space_object);
Marking::MarkWhite(mark_bit);
mark_bit = Marking::MarkBitFrom(*old_space_object_non_evacuation);
Marking::MarkWhite(mark_bit);
delete buffer;
}
} // namespace internal
} // namespace v8

View File

@ -196,8 +196,8 @@
'wasm-data-section.cc',
'../common/wasm/wasm-module-runner.cc',
'../common/wasm/wasm-module-runner.h',
'../fuzzer/wasm-section-fuzzers.cc',
'../fuzzer/wasm-section-fuzzers.h',
'wasm-section-fuzzers.cc',
'wasm-section-fuzzers.h',
],
},
{
@ -226,8 +226,8 @@
'wasm-function-sigs-section.cc',
'../common/wasm/wasm-module-runner.cc',
'../common/wasm/wasm-module-runner.h',
'../fuzzer/wasm-section-fuzzers.cc',
'../fuzzer/wasm-section-fuzzers.h',
'wasm-section-fuzzers.cc',
'wasm-section-fuzzers.h',
],
},
{
@ -256,8 +256,8 @@
'wasm-globals-section.cc',
'../common/wasm/wasm-module-runner.cc',
'../common/wasm/wasm-module-runner.h',
'../fuzzer/wasm-section-fuzzers.cc',
'../fuzzer/wasm-section-fuzzers.h',
'wasm-section-fuzzers.cc',
'wasm-section-fuzzers.h',
],
},
{
@ -286,8 +286,8 @@
'wasm-imports-section.cc',
'../common/wasm/wasm-module-runner.cc',
'../common/wasm/wasm-module-runner.h',
'../fuzzer/wasm-section-fuzzers.cc',
'../fuzzer/wasm-section-fuzzers.h',
'wasm-section-fuzzers.cc',
'wasm-section-fuzzers.h',
],
},
{
@ -316,8 +316,8 @@
'wasm-memory-section.cc',
'../common/wasm/wasm-module-runner.cc',
'../common/wasm/wasm-module-runner.h',
'../fuzzer/wasm-section-fuzzers.cc',
'../fuzzer/wasm-section-fuzzers.h',
'wasm-section-fuzzers.cc',
'wasm-section-fuzzers.h',
],
},
{
@ -346,8 +346,8 @@
'wasm-names-section.cc',
'../common/wasm/wasm-module-runner.cc',
'../common/wasm/wasm-module-runner.h',
'../fuzzer/wasm-section-fuzzers.cc',
'../fuzzer/wasm-section-fuzzers.h',
'wasm-section-fuzzers.cc',
'wasm-section-fuzzers.h',
],
},
{
@ -376,8 +376,8 @@
'wasm-types-section.cc',
'../common/wasm/wasm-module-runner.cc',
'../common/wasm/wasm-module-runner.h',
'../fuzzer/wasm-section-fuzzers.cc',
'../fuzzer/wasm-section-fuzzers.h',
'wasm-section-fuzzers.cc',
'wasm-section-fuzzers.h',
],
},
{

View File

@ -54,6 +54,7 @@ v8_executable("unittests") {
"compiler/js-operator-unittest.cc",
"compiler/js-typed-lowering-unittest.cc",
"compiler/linkage-tail-call-unittest.cc",
"compiler/live-range-builder.h",
"compiler/live-range-unittest.cc",
"compiler/liveness-analyzer-unittest.cc",
"compiler/load-elimination-unittest.cc",
@ -100,6 +101,7 @@ v8_executable("unittests") {
"interpreter/bytecode-pipeline-unittest.cc",
"interpreter/bytecode-register-allocator-unittest.cc",
"interpreter/bytecode-register-optimizer-unittest.cc",
"interpreter/bytecode-utils.h",
"interpreter/bytecodes-unittest.cc",
"interpreter/constant-array-builder-unittest.cc",
"interpreter/interpreter-assembler-unittest.cc",

View File

@ -1,335 +0,0 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/compiler/js-type-feedback.h"
#include "src/compilation-dependencies.h"
#include "src/compiler/access-builder.h"
#include "src/compiler/js-graph.h"
#include "src/compiler/js-operator.h"
#include "src/compiler/machine-operator.h"
#include "src/compiler/node-matchers.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/operator-properties.h"
#include "test/unittests/compiler/compiler-test-utils.h"
#include "test/unittests/compiler/graph-unittest.h"
#include "test/unittests/compiler/node-test-utils.h"
#include "testing/gmock-support.h"
using testing::Capture;
namespace v8 {
namespace internal {
namespace compiler {
class JSTypeFeedbackTest : public TypedGraphTest {
public:
JSTypeFeedbackTest()
: TypedGraphTest(3),
javascript_(zone()),
dependencies_(isolate(), zone()) {}
~JSTypeFeedbackTest() override { dependencies_.Rollback(); }
protected:
Reduction Reduce(Node* node,
JSTypeFeedbackSpecializer::DeoptimizationMode mode) {
Handle<GlobalObject> global_object(
isolate()->native_context()->global_object(), isolate());
MachineOperatorBuilder machine(zone());
SimplifiedOperatorBuilder simplified(zone());
JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified,
&machine);
JSTypeFeedbackTable table(zone());
// TODO(titzer): mock the GraphReducer here for better unit testing.
GraphReducer graph_reducer(zone(), graph());
JSTypeFeedbackSpecializer reducer(&graph_reducer, &jsgraph, &table, nullptr,
global_object, mode, &dependencies_);
return reducer.Reduce(node);
}
Node* EmptyFrameState() {
MachineOperatorBuilder machine(zone());
JSGraph jsgraph(isolate(), graph(), common(), javascript(), nullptr,
&machine);
return jsgraph.EmptyFrameState();
}
JSOperatorBuilder* javascript() { return &javascript_; }
void SetGlobalProperty(const char* string, int value) {
SetGlobalProperty(string, Handle<Smi>(Smi::FromInt(value), isolate()));
}
void SetGlobalProperty(const char* string, double value) {
SetGlobalProperty(string, isolate()->factory()->NewNumber(value));
}
void SetGlobalProperty(const char* string, Handle<Object> value) {
Handle<JSObject> global(isolate()->context()->global_object(), isolate());
Handle<String> name =
isolate()->factory()->NewStringFromAsciiChecked(string);
MaybeHandle<Object> result =
JSReceiver::SetProperty(global, name, value, SLOPPY);
result.Assert();
}
Node* ReturnLoadNamedFromGlobal(
const char* string, Node* effect, Node* control,
JSTypeFeedbackSpecializer::DeoptimizationMode mode) {
VectorSlotPair feedback;
Node* vector = UndefinedConstant();
Node* context = UndefinedConstant();
Handle<Name> name = isolate()->factory()->InternalizeUtf8String(string);
const Operator* op = javascript()->LoadGlobal(name, feedback);
Node* load = graph()->NewNode(op, vector, context, EmptyFrameState(),
EmptyFrameState(), effect, control);
Node* if_success = graph()->NewNode(common()->IfSuccess(), load);
return graph()->NewNode(common()->Return(), load, load, if_success);
}
CompilationDependencies* dependencies() { return &dependencies_; }
private:
JSOperatorBuilder javascript_;
CompilationDependencies dependencies_;
};
TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalConstSmi) {
const int kValue = 111;
const char* kName = "banana";
SetGlobalProperty(kName, kValue);
Node* ret = ReturnLoadNamedFromGlobal(
kName, graph()->start(), graph()->start(),
JSTypeFeedbackSpecializer::kDeoptimizationDisabled);
graph()->SetEnd(graph()->NewNode(common()->End(1), ret));
Reduction r = Reduce(ret->InputAt(0),
JSTypeFeedbackSpecializer::kDeoptimizationDisabled);
EXPECT_FALSE(r.Changed());
EXPECT_TRUE(dependencies()->IsEmpty());
}
TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalConstSmiWithDeoptimization) {
const int kValue = 111;
const char* kName = "banana";
SetGlobalProperty(kName, kValue);
Node* ret = ReturnLoadNamedFromGlobal(
kName, graph()->start(), graph()->start(),
JSTypeFeedbackSpecializer::kDeoptimizationEnabled);
graph()->SetEnd(graph()->NewNode(common()->End(1), ret));
Reduction r = Reduce(ret->InputAt(0),
JSTypeFeedbackSpecializer::kDeoptimizationEnabled);
// Check LoadNamed(global) => HeapConstant[kValue]
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsNumberConstant(kValue));
EXPECT_THAT(ret, IsReturn(IsNumberConstant(kValue), graph()->start(),
graph()->start()));
EXPECT_THAT(graph()->end(), IsEnd(ret));
EXPECT_FALSE(dependencies()->IsEmpty());
dependencies()->Rollback();
}
TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalConstNumber) {
const double kValue = -11.25;
const char* kName = "kiwi";
SetGlobalProperty(kName, kValue);
Node* ret = ReturnLoadNamedFromGlobal(
kName, graph()->start(), graph()->start(),
JSTypeFeedbackSpecializer::kDeoptimizationDisabled);
graph()->SetEnd(graph()->NewNode(common()->End(1), ret));
Reduction r = Reduce(ret->InputAt(0),
JSTypeFeedbackSpecializer::kDeoptimizationDisabled);
EXPECT_FALSE(r.Changed());
EXPECT_TRUE(dependencies()->IsEmpty());
}
TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalConstNumberWithDeoptimization) {
const double kValue = -11.25;
const char* kName = "kiwi";
SetGlobalProperty(kName, kValue);
Node* ret = ReturnLoadNamedFromGlobal(
kName, graph()->start(), graph()->start(),
JSTypeFeedbackSpecializer::kDeoptimizationEnabled);
graph()->SetEnd(graph()->NewNode(common()->End(1), ret));
Reduction r = Reduce(ret->InputAt(0),
JSTypeFeedbackSpecializer::kDeoptimizationEnabled);
// Check LoadNamed(global) => HeapConstant[kValue]
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsNumberConstant(kValue));
EXPECT_THAT(ret, IsReturn(IsNumberConstant(kValue), graph()->start(),
graph()->start()));
EXPECT_THAT(graph()->end(), IsEnd(ret));
EXPECT_FALSE(dependencies()->IsEmpty());
}
TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalConstString) {
Handle<HeapObject> kValue = isolate()->factory()->undefined_string();
const char* kName = "mango";
SetGlobalProperty(kName, kValue);
Node* ret = ReturnLoadNamedFromGlobal(
kName, graph()->start(), graph()->start(),
JSTypeFeedbackSpecializer::kDeoptimizationDisabled);
graph()->SetEnd(graph()->NewNode(common()->End(1), ret));
Reduction r = Reduce(ret->InputAt(0),
JSTypeFeedbackSpecializer::kDeoptimizationDisabled);
ASSERT_FALSE(r.Changed());
EXPECT_TRUE(dependencies()->IsEmpty());
}
TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalConstStringWithDeoptimization) {
Handle<HeapObject> kValue = isolate()->factory()->undefined_string();
const char* kName = "mango";
SetGlobalProperty(kName, kValue);
Node* ret = ReturnLoadNamedFromGlobal(
kName, graph()->start(), graph()->start(),
JSTypeFeedbackSpecializer::kDeoptimizationEnabled);
graph()->SetEnd(graph()->NewNode(common()->End(1), ret));
Reduction r = Reduce(ret->InputAt(0),
JSTypeFeedbackSpecializer::kDeoptimizationEnabled);
// Check LoadNamed(global) => HeapConstant[kValue]
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(), IsHeapConstant(kValue));
EXPECT_THAT(ret, IsReturn(IsHeapConstant(kValue), graph()->start(),
graph()->start()));
EXPECT_THAT(graph()->end(), IsEnd(ret));
EXPECT_FALSE(dependencies()->IsEmpty());
dependencies()->Rollback();
}
TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalPropertyCellSmi) {
const char* kName = "melon";
SetGlobalProperty(kName, 123);
SetGlobalProperty(kName, 124);
Node* ret = ReturnLoadNamedFromGlobal(
kName, graph()->start(), graph()->start(),
JSTypeFeedbackSpecializer::kDeoptimizationDisabled);
graph()->SetEnd(graph()->NewNode(common()->End(1), ret));
Reduction r = Reduce(ret->InputAt(0),
JSTypeFeedbackSpecializer::kDeoptimizationDisabled);
ASSERT_FALSE(r.Changed());
EXPECT_TRUE(dependencies()->IsEmpty());
}
TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalPropertyCellSmiWithDeoptimization) {
const char* kName = "melon";
SetGlobalProperty(kName, 123);
SetGlobalProperty(kName, 124);
Node* ret = ReturnLoadNamedFromGlobal(
kName, graph()->start(), graph()->start(),
JSTypeFeedbackSpecializer::kDeoptimizationEnabled);
graph()->SetEnd(graph()->NewNode(common()->End(1), ret));
Reduction r = Reduce(ret->InputAt(0),
JSTypeFeedbackSpecializer::kDeoptimizationEnabled);
// Check LoadNamed(global) => LoadField[PropertyCell::value](cell)
ASSERT_TRUE(r.Changed());
FieldAccess access = AccessBuilder::ForPropertyCellValue();
Capture<Node*> cell_capture;
Matcher<Node*> load_field_match = IsLoadField(
access, CaptureEq(&cell_capture), graph()->start(), graph()->start());
EXPECT_THAT(r.replacement(), load_field_match);
HeapObjectMatcher cell(cell_capture.value());
EXPECT_TRUE(cell.HasValue());
EXPECT_TRUE(cell.Value()->IsPropertyCell());
EXPECT_THAT(ret,
IsReturn(load_field_match, load_field_match, graph()->start()));
EXPECT_THAT(graph()->end(), IsEnd(ret));
EXPECT_FALSE(dependencies()->IsEmpty());
dependencies()->Rollback();
}
TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalPropertyCellString) {
const char* kName = "pineapple";
SetGlobalProperty(kName, isolate()->factory()->undefined_string());
SetGlobalProperty(kName, isolate()->factory()->undefined_value());
Node* ret = ReturnLoadNamedFromGlobal(
kName, graph()->start(), graph()->start(),
JSTypeFeedbackSpecializer::kDeoptimizationDisabled);
graph()->SetEnd(graph()->NewNode(common()->End(1), ret));
Reduction r = Reduce(ret->InputAt(0),
JSTypeFeedbackSpecializer::kDeoptimizationDisabled);
ASSERT_FALSE(r.Changed());
EXPECT_TRUE(dependencies()->IsEmpty());
}
TEST_F(JSTypeFeedbackTest,
JSLoadNamedGlobalPropertyCellStringWithDeoptimization) {
const char* kName = "pineapple";
SetGlobalProperty(kName, isolate()->factory()->undefined_string());
SetGlobalProperty(kName, isolate()->factory()->undefined_value());
Node* ret = ReturnLoadNamedFromGlobal(
kName, graph()->start(), graph()->start(),
JSTypeFeedbackSpecializer::kDeoptimizationEnabled);
graph()->SetEnd(graph()->NewNode(common()->End(1), ret));
Reduction r = Reduce(ret->InputAt(0),
JSTypeFeedbackSpecializer::kDeoptimizationEnabled);
// Check LoadNamed(global) => LoadField[PropertyCell::value](cell)
ASSERT_TRUE(r.Changed());
FieldAccess access = AccessBuilder::ForPropertyCellValue();
Capture<Node*> cell_capture;
Matcher<Node*> load_field_match = IsLoadField(
access, CaptureEq(&cell_capture), graph()->start(), graph()->start());
EXPECT_THAT(r.replacement(), load_field_match);
HeapObjectMatcher cell(cell_capture.value());
EXPECT_TRUE(cell.HasValue());
EXPECT_TRUE(cell.Value()->IsPropertyCell());
EXPECT_THAT(ret,
IsReturn(load_field_match, load_field_match, graph()->start()));
EXPECT_THAT(graph()->end(), IsEnd(ret));
EXPECT_FALSE(dependencies()->IsEmpty());
dependencies()->Rollback();
}
} // namespace compiler
} // namespace internal
} // namespace v8

View File

@ -54,6 +54,7 @@
'compiler/js-typed-lowering-unittest.cc',
'compiler/linkage-tail-call-unittest.cc',
'compiler/liveness-analyzer-unittest.cc',
'compiler/live-range-builder.h',
'compiler/live-range-unittest.cc',
'compiler/load-elimination-unittest.cc',
'compiler/loop-peeling-unittest.cc',
@ -93,6 +94,7 @@
'interpreter/bytecode-pipeline-unittest.cc',
'interpreter/bytecode-register-allocator-unittest.cc',
'interpreter/bytecode-register-optimizer-unittest.cc',
'interpreter/bytecode-utils.h',
'interpreter/constant-array-builder-unittest.cc',
'interpreter/interpreter-assembler-unittest.cc',
'interpreter/interpreter-assembler-unittest.h',

View File

@ -16,18 +16,21 @@ tool won't be accurate for other sources in other directories (e.g. cctest).
import itertools
import re
import os
import sys
V8_BASE = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
V8_SRC_BASE = os.path.join(V8_BASE, 'src')
V8_TEST_BASE = os.path.join(V8_BASE, 'test')
V8_INCLUDE_BASE = os.path.join(V8_BASE, 'include')
GYP_FILES = [
os.path.join(V8_BASE, 'src', 'd8.gyp'),
os.path.join(V8_BASE, 'src', 'v8.gyp'),
os.path.join(V8_BASE, 'src', 'inspector', 'inspector.gyp'),
os.path.join(V8_BASE, 'src', 'inspector', 'inspector.gypi'),
os.path.join(V8_BASE, 'src', 'third_party', 'vtune', 'v8vtune.gyp'),
os.path.join(V8_BASE, 'test', 'cctest', 'cctest.gyp'),
os.path.join(V8_BASE, 'test', 'fuzzer', 'fuzzer.gyp'),
os.path.join(V8_BASE, 'test', 'unittests', 'unittests.gyp'),
os.path.join(V8_BASE, 'tools', 'parser-shell.gyp'),
]
@ -48,25 +51,46 @@ GN_UNSUPPORTED_FEATURES = [
'ppc',
'qnx',
'solaris',
'valgrind',
'vtune',
'x87',
]
ALL_GN_PREFIXES = [
'..',
os.path.join('src', 'inspector'),
'src',
os.path.join('test', 'cctest'),
os.path.join('test', 'unittests'),
]
def path_no_prefix(path):
for prefix in ['../', 'src/inspector/', 'src/']:
if path.startswith(prefix):
return path_no_prefix(path[len(prefix):])
ALL_GYP_PREFIXES = [
'..',
'common',
os.path.join('src', 'third_party', 'vtune'),
'src',
os.path.join('test', 'cctest'),
os.path.join('test', 'common'),
os.path.join('test', 'fuzzer'),
os.path.join('test', 'unittests'),
]
def pathsplit(path):
return re.split('[/\\\\]', path)
def path_no_prefix(path, prefixes):
for prefix in prefixes:
if path.startswith(prefix + os.sep):
return path_no_prefix(path[len(prefix) + 1:], prefixes)
return path
def isources(directory):
def isources(directory, prefixes):
for root, dirs, files in os.walk(directory):
for f in files:
if not (f.endswith('.h') or f.endswith('.cc')):
continue
yield path_no_prefix(os.path.relpath(os.path.join(root, f), V8_BASE))
yield path_no_prefix(
os.path.relpath(os.path.join(root, f), V8_BASE), prefixes)
def iflatten(obj):
@ -79,7 +103,7 @@ def iflatten(obj):
for i in iflatten(value):
yield i
elif isinstance(obj, basestring):
yield path_no_prefix(obj)
yield path_no_prefix(os.path.join(*pathsplit(obj)), ALL_GYP_PREFIXES)
def iflatten_gyp_file(gyp_file):
@ -100,30 +124,46 @@ def iflatten_gn_file(gn_file):
for line in f.read().splitlines():
match = re.match(r'.*"([^"]*)".*', line)
if match:
yield path_no_prefix(match.group(1))
yield path_no_prefix(
os.path.join(*pathsplit(match.group(1))), ALL_GN_PREFIXES)
def icheck_values(values, *source_dirs):
def icheck_values(values, prefixes, *source_dirs):
for source_file in itertools.chain(
*[isources(source_dir) for source_dir in source_dirs]
*[isources(source_dir, prefixes) for source_dir in source_dirs]
):
if source_file not in values:
yield source_file
gyp_values = set(itertools.chain(
*[iflatten_gyp_file(gyp_file) for gyp_file in GYP_FILES]
))
def missing_gyp_files():
gyp_values = set(itertools.chain(
*[iflatten_gyp_file(gyp_file) for gyp_file in GYP_FILES]
))
return sorted(icheck_values(
gyp_values, ALL_GYP_PREFIXES, V8_SRC_BASE, V8_INCLUDE_BASE, V8_TEST_BASE))
print "----------- Files not in gyp: ------------"
for i in sorted(icheck_values(gyp_values, V8_SRC_BASE, V8_INCLUDE_BASE)):
print i
gn_values = set(itertools.chain(
*[iflatten_gn_file(gn_file) for gn_file in GN_FILES]
))
def missing_gn_files():
gn_values = set(itertools.chain(
*[iflatten_gn_file(gn_file) for gn_file in GN_FILES]
))
print "\n----------- Files not in gn: -------------"
for i in sorted(icheck_values(gn_values, V8_SRC_BASE, V8_INCLUDE_BASE)):
if not any(f in i for f in GN_UNSUPPORTED_FEATURES):
gn_files = sorted(icheck_values(
gn_values, ALL_GN_PREFIXES, V8_SRC_BASE, V8_INCLUDE_BASE, V8_TEST_BASE))
return filter(
lambda x: not any(i in x for i in GN_UNSUPPORTED_FEATURES), gn_files)
def main():
print "----------- Files not in gyp: ------------"
for i in missing_gyp_files():
print i
print "\n----------- Files not in gn: -------------"
for i in missing_gn_files():
print i
return 0
if '__main__' == __name__:
sys.exit(main())