[jumbo] add test namespaces for cctest

By adding a per test source file namespace, we can avoid a lot of
symbol collisions in jumbo builds.

While we're at it, let's remove some "using" statements that also
cause trouble.

Bug: chromium:746958
Change-Id: I6f8a723e1ba5905888638e0687b23193f3f012ca
Reviewed-on: https://chromium-review.googlesource.com/676803
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Mostyn Bramley-Moore <mostynb@opera.com>
Cr-Commit-Position: refs/heads/master@{#48102}
This commit is contained in:
Mostyn Bramley-Moore 2017-09-21 05:29:52 +02:00 committed by Commit Bot
parent 2c22b8ecb7
commit 01946db5e0
29 changed files with 114 additions and 130 deletions

View File

@ -18,6 +18,7 @@
namespace v8 {
namespace internal {
namespace compiler {
namespace test_run_native_calls {
const auto GetRegConfig = RegisterConfiguration::Default;
@ -1225,6 +1226,8 @@ TEST(RunStackSlotFloat64) {
double magic = 3456.375;
TestStackSlot(MachineType::Float64(), magic);
}
} // namespace test_run_native_calls
} // namespace compiler
} // namespace internal
} // namespace v8

View File

@ -83,6 +83,7 @@ class TestCodeRangeScope {
DISALLOW_COPY_AND_ASSIGN(TestCodeRangeScope);
};
namespace test_spaces {
static void VerifyMemoryChunk(Isolate* isolate,
Heap* heap,
@ -706,6 +707,7 @@ TEST(ShrinkPageToHighWaterMarkTwoWordFiller) {
CHECK_EQ(0u, shrunk);
}
} // namespace test_spaces
} // namespace heap
} // namespace internal
} // namespace v8

View File

@ -40,6 +40,7 @@
namespace v8 {
namespace internal {
namespace test_bignum_dtoa {
// Removes trailing '0' digits.
// Can return the empty string if all digits are 0.
@ -314,5 +315,6 @@ TEST(BignumDtoaGayPrecision) {
}
}
} // namespace test_bignum_dtoa
} // namespace internal
} // namespace v8

View File

@ -35,6 +35,7 @@
namespace v8 {
namespace internal {
namespace test_bignum {
static const int kBufferSize = 1024;
@ -1541,5 +1542,6 @@ TEST(AssignPowerUInt16) {
buffer));
}
} // namespace test_bignum
} // namespace internal
} // namespace v8

View File

@ -40,6 +40,7 @@
namespace v8 {
namespace internal {
namespace test_code_stubs_x64 {
#define __ assm.
@ -156,5 +157,6 @@ TEST(ConvertDToI) {
}
}
} // namespace test_code_stubs_x64
} // namespace internal
} // namespace v8

View File

@ -40,6 +40,7 @@
namespace v8 {
namespace internal {
namespace test_dtoa {
// Removes trailing '0' digits.
static void TrimRepresentation(Vector<char> representation) {
@ -329,5 +330,6 @@ TEST(DtoaGayPrecision) {
}
}
} // namespace test_dtoa
} // namespace internal
} // namespace v8

View File

@ -18,6 +18,7 @@
namespace v8 {
namespace internal {
namespace test_elements_kind {
//
// Helper functions.
@ -479,5 +480,6 @@ TEST(JSArrayAddingElementsGeneralizingiFastDoubleElements) {
CHECK_EQ(array->map(), *previous_map);
}
} // namespace test_elements_kind
} // namespace internal
} // namespace v8

View File

@ -39,6 +39,7 @@
namespace v8 {
namespace internal {
namespace test_fast_dtoa {
static const int kBufferSize = 100;
@ -293,5 +294,6 @@ TEST(FastDtoaGayPrecision) {
CHECK_GT(succeeded_15*1.0/total_15, 0.9999);
}
} // namespace test_fast_dtoa
} // namespace internal
} // namespace v8

View File

@ -24,6 +24,7 @@
namespace v8 {
namespace internal {
namespace test_field_type_tracking {
// TODO(ishell): fix this once TransitionToPrototype stops generalizing
// all field representations (similar to crbug/448711 where elements kind
@ -2742,5 +2743,6 @@ TEST(HoleyMutableHeapNumber) {
CHECK_EQ(kHoleNanInt64, HeapNumber::cast(*obj)->value_as_bits());
}
} // namespace test_field_type_tracking
} // namespace internal
} // namespace v8

View File

@ -15,6 +15,7 @@
namespace v8 {
namespace internal {
namespace test_inobject_slack_tracking {
static const int kMaxInobjectProperties = JSObject::kMaxInObjectProperties;
@ -1202,5 +1203,6 @@ TEST(SubclassPromiseBuiltinNoInlineNew) {
TestSubclassPromiseBuiltin();
}
} // namespace test_inobject_slack_tracking
} // namespace internal
} // namespace v8

View File

@ -41,19 +41,6 @@
#include "src/utils.h"
#include "test/cctest/cctest.h"
using ::v8::Context;
using ::v8::Extension;
using ::v8::Function;
using ::v8::HandleScope;
using ::v8::Local;
using ::v8::Object;
using ::v8::ObjectTemplate;
using ::v8::Persistent;
using ::v8::Script;
using ::v8::String;
using ::v8::Value;
using ::v8::V8;
namespace {
class DeoptimizeCodeThread : public v8::base::Thread {
@ -81,7 +68,7 @@ class DeoptimizeCodeThread : public v8::base::Thread {
private:
v8::Isolate* isolate_;
Persistent<v8::Context> context_;
v8::Persistent<v8::Context> context_;
// The code that triggers the deoptimization.
const char* source_;
};
@ -133,6 +120,10 @@ void UnlockForDeoptimizationIfReady(
}
} // namespace
namespace v8 {
namespace internal {
namespace test_lockers {
TEST(LazyDeoptimizationMultithread) {
i::FLAG_allow_natives_syntax = true;
v8::Isolate::CreateParams create_params;
@ -329,7 +320,7 @@ class KangarooThread : public v8::base::Thread {
private:
v8::Isolate* isolate_;
Persistent<v8::Context> context_;
v8::Persistent<v8::Context> context_;
};
@ -569,7 +560,7 @@ class LockIsolateAndCalculateFibSharedContextThread : public JoinableThread {
virtual void Run() {
v8::Locker lock(isolate_);
v8::Isolate::Scope isolate_scope(isolate_);
HandleScope handle_scope(isolate_);
v8::HandleScope handle_scope(isolate_);
v8::Local<v8::Context> context =
v8::Local<v8::Context>::New(isolate_, context_);
v8::Context::Scope context_scope(context);
@ -577,7 +568,7 @@ class LockIsolateAndCalculateFibSharedContextThread : public JoinableThread {
}
private:
v8::Isolate* isolate_;
Persistent<v8::Context> context_;
v8::Persistent<v8::Context> context_;
};
class LockerUnlockerThread : public JoinableThread {
@ -898,12 +889,12 @@ TEST(Regress1433) {
v8::Locker lock(isolate);
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<Context> context = v8::Context::New(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context);
v8::Local<String> source = v8_str("1+1");
v8::Local<Script> script =
v8::Local<v8::String> source = v8_str("1+1");
v8::Local<v8::Script> script =
v8::Script::Compile(context, source).ToLocalChecked();
v8::Local<Value> result = script->Run(context).ToLocalChecked();
v8::Local<v8::Value> result = script->Run(context).ToLocalChecked();
v8::String::Utf8Value utf8(isolate, result);
}
isolate->Dispose();
@ -981,3 +972,7 @@ TEST(ExtensionsRegistration) {
}
StartJoinAndDeleteThreads(threads);
}
} // namespace test_lockers
} // namespace internal
} // namespace v8

View File

@ -35,71 +35,9 @@
#include "src/objects-inl.h"
#include "test/cctest/cctest.h"
namespace i = v8::internal;
using i::Address;
using i::Assembler;
using i::CodeDesc;
using i::Condition;
using i::FUNCTION_CAST;
using i::HandleScope;
using i::Immediate;
using i::Isolate;
using i::Label;
using i::MacroAssembler;
using i::Operand;
using i::RelocInfo;
using i::Representation;
using i::Smi;
using i::SmiIndex;
using i::byte;
using i::carry;
using i::greater;
using i::greater_equal;
using i::kIntSize;
using i::kFloatSize;
using i::kDoubleSize;
using i::kPointerSize;
using i::kSimd128Size;
using i::kSmiTagMask;
using i::kSmiValueSize;
using i::less_equal;
using i::negative;
using i::not_carry;
using i::not_equal;
using i::equal;
using i::not_zero;
using i::positive;
using i::r11;
using i::r13;
using i::r14;
using i::r15;
using i::r8;
using i::r9;
using i::rax;
using i::rbp;
using i::rbx;
using i::rcx;
using i::rdi;
using i::rdx;
using i::rsi;
using i::rsp;
using i::xmm0;
using i::xmm1;
using i::xmm2;
using i::xmm3;
using i::xmm4;
using i::xmm5;
using i::xmm6;
using i::xmm7;
using i::xmm8;
using i::xmm9;
using i::xmm10;
using i::xmm11;
using i::xmm12;
using i::xmm13;
using i::xmm14;
using i::xmm15;
using i::times_pointer_size;
namespace v8 {
namespace internal {
namespace test_macro_assembler_x64 {
// Test the x64 assembler by compiling some simple functions into
// a buffer and executing them. These tests do not initialize the
@ -117,15 +55,11 @@ typedef int (*F0)();
static void EntryCode(MacroAssembler* masm) {
// Smi constant register is callee save.
__ pushq(i::kRootRegister);
__ pushq(kRootRegister);
__ InitializeRootRegister();
}
static void ExitCode(MacroAssembler* masm) {
__ popq(i::kRootRegister);
}
static void ExitCode(MacroAssembler* masm) { __ popq(kRootRegister); }
TEST(Smi) {
// Check that C++ Smi operations work as expected.
@ -545,9 +479,9 @@ static void SmiAddTest(MacroAssembler* masm,
__ movl(rcx, Immediate(first));
__ Integer32ToSmi(rcx, rcx);
i::SmiOperationConstraints constraints =
i::SmiOperationConstraint::kPreserveSourceRegister |
i::SmiOperationConstraint::kBailoutOnOverflow;
SmiOperationConstraints constraints =
SmiOperationConstraint::kPreserveSourceRegister |
SmiOperationConstraint::kBailoutOnOverflow;
__ incq(rax);
__ SmiAddConstant(r9, rcx, Smi::FromInt(second), constraints, exit);
__ cmpq(r9, r8);
@ -561,8 +495,8 @@ static void SmiAddTest(MacroAssembler* masm,
__ movl(rcx, Immediate(first));
__ Integer32ToSmi(rcx, rcx);
constraints = i::SmiOperationConstraint::kPreserveSourceRegister |
i::SmiOperationConstraint::kBailoutOnNoOverflow;
constraints = SmiOperationConstraint::kPreserveSourceRegister |
SmiOperationConstraint::kBailoutOnNoOverflow;
Label done;
__ incq(rax);
__ SmiAddConstant(rcx, rcx, Smi::FromInt(second), constraints, &done);
@ -607,9 +541,9 @@ static void SmiAddOverflowTest(MacroAssembler* masm,
__ j(not_equal, exit);
}
i::SmiOperationConstraints constraints =
i::SmiOperationConstraint::kPreserveSourceRegister |
i::SmiOperationConstraint::kBailoutOnOverflow;
SmiOperationConstraints constraints =
SmiOperationConstraint::kPreserveSourceRegister |
SmiOperationConstraint::kBailoutOnOverflow;
__ movq(rcx, r11);
{
Label overflow_ok;
@ -669,7 +603,7 @@ static void SmiAddOverflowTest(MacroAssembler* masm,
__ j(not_equal, exit);
}
constraints = i::SmiOperationConstraint::kBailoutOnOverflow;
constraints = SmiOperationConstraint::kBailoutOnOverflow;
{
Label overflow_ok;
__ incq(rax);
@ -760,9 +694,9 @@ static void SmiSubTest(MacroAssembler* masm,
__ cmpq(rcx, r8);
__ j(not_equal, exit);
i::SmiOperationConstraints constraints =
i::SmiOperationConstraint::kPreserveSourceRegister |
i::SmiOperationConstraint::kBailoutOnOverflow;
SmiOperationConstraints constraints =
SmiOperationConstraint::kPreserveSourceRegister |
SmiOperationConstraint::kBailoutOnOverflow;
__ Move(rcx, Smi::FromInt(first));
__ incq(rax); // Test 4.
__ SmiSubConstant(rcx, rcx, Smi::FromInt(second), constraints, exit);
@ -775,8 +709,8 @@ static void SmiSubTest(MacroAssembler* masm,
__ cmpq(r9, r8);
__ j(not_equal, exit);
constraints = i::SmiOperationConstraint::kPreserveSourceRegister |
i::SmiOperationConstraint::kBailoutOnNoOverflow;
constraints = SmiOperationConstraint::kPreserveSourceRegister |
SmiOperationConstraint::kBailoutOnNoOverflow;
__ Move(rcx, Smi::FromInt(first));
Label done;
__ incq(rax); // Test 6.
@ -822,9 +756,9 @@ static void SmiSubOverflowTest(MacroAssembler* masm,
__ j(not_equal, exit);
}
i::SmiOperationConstraints constraints =
i::SmiOperationConstraint::kPreserveSourceRegister |
i::SmiOperationConstraint::kBailoutOnOverflow;
SmiOperationConstraints constraints =
SmiOperationConstraint::kPreserveSourceRegister |
SmiOperationConstraint::kBailoutOnOverflow;
__ movq(rcx, r11);
{
@ -885,7 +819,7 @@ static void SmiSubOverflowTest(MacroAssembler* masm,
__ j(not_equal, exit);
}
constraints = i::SmiOperationConstraint::kBailoutOnOverflow;
constraints = SmiOperationConstraint::kBailoutOnOverflow;
__ movq(rcx, r11);
{
Label overflow_ok;
@ -1791,3 +1725,7 @@ TEST(SIMDMacros) {
}
#undef __
} // namespace test_macro_assembler_x64
} // namespace internal
} // namespace v8

View File

@ -9,6 +9,7 @@
namespace v8 {
namespace internal {
namespace test_orderedhashtable {
static Isolate* GetIsolateFrom(LocalContext* context) {
return reinterpret_cast<Isolate*>((*context)->GetIsolate());
@ -896,5 +897,6 @@ TEST(OrderedHashSetDuplicateHashCodeDeletion) {
CHECK(!OrderedHashSet::HasKey(isolate, *set, *key2));
}
} // namespace test_orderedhashtable
} // namespace internal
} // namespace v8

View File

@ -57,6 +57,10 @@
#include "test/cctest/scope-test-helper.h"
#include "test/cctest/unicode-helpers.h"
namespace v8 {
namespace internal {
namespace test_parsing {
TEST(ScanKeywords) {
struct KeywordToken {
const char* keyword;
@ -10405,3 +10409,7 @@ TEST(LexicalLoopVariable) {
});
}
}
} // namespace test_parsing
} // namespace internal
} // namespace v8

View File

@ -36,17 +36,9 @@
#include "test/cctest/cctest.h"
#include "test/cctest/profiler-extension.h"
using i::CodeEntry;
using i::CodeMap;
using i::CpuProfile;
using i::CpuProfiler;
using i::CpuProfilesCollection;
using i::ProfileNode;
using i::ProfileTree;
using i::ProfileGenerator;
using i::TickSample;
using i::Vector;
namespace v8 {
namespace internal {
namespace test_profile_generator {
TEST(ProfileNodeFindOrAddChild) {
CcTest::InitializeVM();
@ -733,3 +725,7 @@ TEST(BailoutReason) {
CHECK(const_cast<v8::CpuProfileNode*>(current));
CHECK(!strcmp("Optimization disabled for test", current->GetBailoutReason()));
}
} // namespace test_profile_generator
} // namespace internal
} // namespace v8

View File

@ -92,6 +92,7 @@
namespace v8 {
namespace internal {
namespace test_regexp {
static bool CheckParse(const char* input) {
v8::HandleScope scope(CcTest::isolate());
@ -2034,5 +2035,6 @@ TEST(UncachedExternalString) {
ExpectString("external.substring(1).match(re)[1]", "z");
}
} // namespace test_regexp
} // namespace internal
} // namespace v8

View File

@ -97,6 +97,7 @@ class MyRandomNumberGenerator {
namespace v8 {
namespace internal {
namespace test_strings {
static const int DEEP_DEPTH = 8 * 1024;
static const int SUPER_DEEP_DEPTH = 80 * 1024;
@ -1669,5 +1670,6 @@ TEST(ExternalStringIndexOf) {
.FromJust());
}
} // namespace test_strings
} // namespace internal
} // namespace v8

View File

@ -38,6 +38,7 @@
namespace v8 {
namespace internal {
namespace test_strtod {
static Vector<const char> StringToVector(const char* str) {
return Vector<const char>(str, StrLength(str));
@ -480,5 +481,6 @@ TEST(RandomStrtod) {
}
}
} // namespace test_strtod
} // namespace internal
} // namespace v8

View File

@ -26,6 +26,7 @@
namespace v8 {
namespace internal {
namespace test_unboxed_doubles {
#if V8_DOUBLE_FIELDS_UNBOXING
@ -1598,5 +1599,6 @@ TEST(IncrementalWriteBarrierObjectShiftFieldsRight) {
#endif
} // namespace test_unboxed_doubles
} // namespace internal
} // namespace v8

View File

@ -6,7 +6,9 @@
#include "test/cctest/cctest.h"
namespace {
namespace v8 {
namespace internal {
namespace test_usecounters {
int* global_use_counts = NULL;
@ -14,7 +16,6 @@ void MockUseCounterCallback(v8::Isolate* isolate,
v8::Isolate::UseCounterFeature feature) {
++global_use_counts[feature];
}
}
TEST(DefineGetterSetterThrowUseCount) {
i::FLAG_harmony_strict_legacy_accessor_builtins = false;
@ -140,3 +141,7 @@ TEST(LabeledExpressionStatement) {
"bat: do { } while (false);");
CHECK_EQ(2, use_counts[v8::Isolate::kLabeledExpressionStatement]);
}
} // namespace test_usecounters
} // namespace internal
} // namespace v8

View File

@ -44,6 +44,7 @@
namespace v8 {
namespace internal {
namespace test_weakmaps {
static Isolate* GetIsolateFrom(LocalContext* context) {
return reinterpret_cast<Isolate*>((*context)->GetIsolate());
@ -263,5 +264,6 @@ TEST(Regress399527) {
CcTest::CollectAllGarbage();
}
} // namespace test_weakmaps
} // namespace internal
} // namespace v8

View File

@ -44,6 +44,7 @@
namespace v8 {
namespace internal {
namespace test_weaksets {
static Isolate* GetIsolateFrom(LocalContext* context) {
return reinterpret_cast<Isolate*>((*context)->GetIsolate());
@ -244,5 +245,6 @@ TEST(WeakSet_Regress2060b) {
CcTest::CollectAllGarbage();
}
} // namespace test_weaksets
} // namespace internal
} // namespace v8

View File

@ -19,6 +19,7 @@
namespace v8 {
namespace internal {
namespace wasm {
namespace test_run_wasm_64 {
// If the target architecture is 64-bit, enable all tests.
#if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64
@ -27,11 +28,6 @@ namespace wasm {
#define WASM_64 0
#endif
#define CHECK_TRAP32(x) \
CHECK_EQ(0xdeadbeef, (bit_cast<uint32_t>(x)) & 0xFFFFFFFF)
#define CHECK_TRAP64(x) \
CHECK_EQ(0xdeadbeefdeadbeef, (bit_cast<uint64_t>(x)) & 0xFFFFFFFFFFFFFFFF)
// Can't bridge macro land with nested macros.
#if V8_TARGET_ARCH_MIPS
#define MIPS true
@ -1673,8 +1669,6 @@ WASM_EXEC_TEST(Regress5874) {
}
#undef WASM_64
#undef CHECK_TRAP32
#undef CHECK_TRAP64
#undef MIPS
#undef REQUIRE
#undef ADD_CODE
@ -1682,6 +1676,7 @@ WASM_EXEC_TEST(Regress5874) {
// clang-format gets confused about these closing parentheses (wants to change
// the first comment to "// namespace v8". Disable it.
// clang-format off
} // namespace test_run_wasm_64
} // namespace wasm
} // namespace internal
} // namespace v8

View File

@ -19,6 +19,7 @@
namespace v8 {
namespace internal {
namespace wasm {
namespace test_run_wasm_interpreter {
TEST(Run_WasmInt8Const_i) {
WasmRunner<int32_t> r(kExecuteInterpreted);
@ -423,6 +424,7 @@ TEST(InterpreterLoadWithoutMemory) {
CHECK_TRAP32(r.Call(0));
}
} // namespace test_run_wasm_interpreter
} // namespace wasm
} // namespace internal
} // namespace v8

View File

@ -15,6 +15,7 @@
namespace v8 {
namespace internal {
namespace wasm {
namespace test_run_wasm_relocation {
#define FOREACH_TYPE(TEST_BODY) \
TEST_BODY(int32_t, WASM_I32_ADD) \
@ -65,6 +66,7 @@ FOREACH_TYPE(LOAD_SET_GLOBAL_TEST_BODY)
#undef FOREACH_TYPE
#undef LOAD_SET_GLOBAL_TEST_BODY
} // namespace test_run_wasm_relocation
} // namespace wasm
} // namespace internal
} // namespace v8

View File

@ -11,6 +11,7 @@
namespace v8 {
namespace internal {
namespace wasm {
namespace test_run_wasm_simd {
namespace {
@ -2240,6 +2241,7 @@ WASM_SIMD_TEST(SimdLoadStoreLoad) {
#undef WASM_SIMD_NON_CANONICAL_SELECT_TEST
#undef WASM_SIMD_BOOL_REDUCTION_TEST
} // namespace test_run_wasm_simd
} // namespace wasm
} // namespace internal
} // namespace v8

View File

@ -18,6 +18,7 @@
namespace v8 {
namespace internal {
namespace wasm {
namespace test_run_wasm {
// for even shorter tests.
#define B1(a) WASM_BLOCK(a)
@ -3099,6 +3100,7 @@ WASM_EXEC_TEST(IfInsideUnreachable) {
#undef RET_I8
#undef ADD_CODE
} // namespace test_run_wasm
} // namespace wasm
} // namespace internal
} // namespace v8

View File

@ -13,6 +13,7 @@
namespace v8 {
namespace internal {
namespace wasm {
namespace test_wasm_stack {
using v8::Local;
using v8::Utils;
@ -198,6 +199,7 @@ TEST(CollectDetailedWasmStack_WasmError) {
}
}
} // namespace test_wasm_stack
} // namespace wasm
} // namespace internal
} // namespace v8

View File

@ -14,6 +14,7 @@
namespace v8 {
namespace internal {
namespace wasm {
namespace test_wasm_trap_position {
using v8::Local;
using v8::Utils;
@ -146,6 +147,7 @@ WASM_EXEC_TEST(IllegalLoad) {
expected_exceptions);
}
} // namespace test_wasm_trap_position
} // namespace wasm
} // namespace internal
} // namespace v8