Commit 16f13300 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

Move compiler cctests into v8::internal::compiler namespace.

This moves all cctest files for the compiler to live in the same
namespace as the components they are testing. Hence we can avoid the
forbidden using directives pulling in entire namespaces.

From the Google C++ style guide: "You may not use a using-directive to
make all names from a namespace available". This would be covered by
presubmit linter checks if build/namespaces were not blacklisted.

R=bmeurer@chromium.org

Review URL: https://codereview.chromium.org/1424943004

Cr-Commit-Position: refs/heads/master@{#31671}
parent 86c27e01
......@@ -6,8 +6,9 @@
#include "test/cctest/compiler/codegen-tester.h"
#include "test/cctest/compiler/value-helper.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
TEST(CompareWrapper) {
// Who tests the testers?
......@@ -568,3 +569,7 @@ TEST(RunBinopTester) {
FOR_FLOAT64_INPUTS(i) { CheckDoubleEq(*i, bt.call(-11.25, *i)); }
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -9,8 +9,9 @@
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/codegen-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
typedef RawMachineAssembler::Label MLabel;
......@@ -109,3 +110,7 @@ TEST(ProfileLoop) {
m.Expect(arraysize(expected), expected);
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -9,8 +9,9 @@
#include "test/cctest/compiler/codegen-tester.h"
#include "test/cctest/compiler/value-helper.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
typedef RawMachineAssembler::Label MLabel;
......@@ -458,3 +459,7 @@ TEST(BranchCombineFloat64Compares) {
}
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -27,8 +27,9 @@
#include "test/cctest/compiler/graph-builder-tester.h"
#include "test/cctest/compiler/value-helper.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
template <typename ReturnType>
class ChangesLoweringTester : public GraphBuilderTester<ReturnType> {
......@@ -286,3 +287,7 @@ TEST(RunChangeBitToBool) {
CHECK_EQ(false_obj, result);
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -10,8 +10,9 @@
#include "src/base/utils/random-number-generator.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
// The state of our move interpreter is the mapping of operands to values. Note
// that the actual values don't really matter, all we care about is equality.
......@@ -255,3 +256,7 @@ TEST(FuzzResolver) {
}
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -18,8 +18,9 @@
#include "src/compiler/verifier.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
static Operator dummy_operator1(IrOpcode::kParameter, Operator::kNoWrite,
"dummy", 1, 0, 0, 1, 0, 0);
......@@ -128,3 +129,7 @@ TEST(NodeNetworkOfDummiesReachableFromEnd) {
SourcePositionTable table(&graph);
os << AsJSON(graph, &table);
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -17,8 +17,9 @@
#include "src/compiler/scheduler.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
typedef v8::internal::compiler::Instruction TestInstr;
typedef v8::internal::compiler::InstructionSequence TestInstrSeq;
......@@ -322,3 +323,7 @@ TEST(InstructionOperands) {
}
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -13,8 +13,9 @@
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/value-helper.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
class JSCacheTesterHelper {
protected:
......@@ -474,3 +475,7 @@ TEST(JSGraph_GetCachedNodes_together) {
CHECK(Contains(&nodes, constants[i]));
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -15,8 +15,9 @@
#include "test/cctest/compiler/function-tester.h"
#include "test/cctest/compiler/graph-builder-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
class ContextSpecializationTester : public HandleAndZoneScope {
public:
......@@ -318,3 +319,7 @@ TEST(SpecializeJSFunction_ToConstant_uninit) {
CHECK(T.Call(T.Val(-2.1), T.Val(0.0)).ToHandleChecked()->IsNaN());
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -15,8 +15,9 @@
#include "src/compiler/typer.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
#ifndef TEST_WITH_STRONG
#define TEST_WITH_STRONG(Name) \
......@@ -1262,3 +1263,7 @@ TEST_WITH_STRONG(Int32Comparisons) {
}
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -20,8 +20,9 @@
#include "src/compiler/schedule.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
static Operator dummy_operator(IrOpcode::kParameter, Operator::kNoWrite,
"dummy", 0, 0, 0, 0, 0, 0);
......@@ -113,3 +114,7 @@ TEST(TestLinkageRuntimeCall) {
TEST(TestLinkageStubCall) {
// TODO(titzer): test linkage creation for outgoing stub calls.
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -21,8 +21,9 @@
#include "src/compiler/verifier.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
static Operator kIntAdd(IrOpcode::kInt32Add, Operator::kPure, "Int32Add", 2, 0,
0, 1, 0, 0);
......@@ -1013,3 +1014,7 @@ TEST(LaManyNested_64) { RunManyNestedLoops_i(64); }
TEST(LaPhiTangle) { LoopFinderTester t; }
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -11,8 +11,9 @@
#include "src/scopes.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
namespace {
const int kBufferSize = 1024;
......@@ -296,3 +297,7 @@ TEST(NestedLoops3c) {
f.CheckLoopAssignedCount(5, "z");
f.CheckLoopAssignedCount(0, "w");
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -14,8 +14,9 @@
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/value-helper.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
template <typename T>
const Operator* NewConstantOperator(CommonOperatorBuilder* common,
......@@ -750,3 +751,7 @@ TEST(ReduceLoadStore) {
// TODO(titzer): test MachineOperatorReducer for Float64Mul
// TODO(titzer): test MachineOperatorReducer for Float64Div
// TODO(titzer): test MachineOperatorReducer for Float64Mod
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -20,11 +20,9 @@
#include "test/cctest/compiler/codegen-tester.h"
#include "test/cctest/compiler/value-helper.h"
using namespace v8::base;
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
namespace {
......@@ -117,3 +115,7 @@ TEST(ReturnThreeValues) {
#endif
CHECK_EQ((123 + 456) + (123 - 456) + (123 * 456), mt.Call());
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -12,8 +12,9 @@
#include "src/compiler/operator.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
#define NONE reinterpret_cast<Node*>(1)
......@@ -785,3 +786,7 @@ TEST(AppendAndTrim) {
CHECK_USES(last, NONE);
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -10,8 +10,9 @@
#include "src/compiler/operator.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
#define NONE Operator::kNoProperties
#define FOLD Operator::kFoldable
......@@ -282,3 +283,7 @@ TEST(Operator_CountsOrder) {
CHECK_EQ(55, op.EffectOutputCount());
CHECK_EQ(66, op.ControlOutputCount());
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -16,8 +16,9 @@
#include "src/compiler/osr.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
// TODO(titzer): move this method to a common testing place.
......@@ -566,3 +567,7 @@ TEST(Deconstruct_osr_nested3) {
// depends on the copy of the outer loop0.
CheckInputs(new_ret, new_loop0_phi, T.graph.start(), new_loop0_exit);
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -11,8 +11,9 @@
#include "src/parser.h"
#include "test/cctest/cctest.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
static void RunPipeline(Zone* zone, const char* source) {
Handle<JSFunction> function = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
......@@ -40,3 +41,7 @@ TEST(PipelineGeneric) {
FLAG_turbo_types = false;
RunPipeline(handles.main_zone(), "(function(a,b) { return a + b; })");
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -15,10 +15,7 @@
#include "src/compiler/node-matchers.h"
#include "src/compiler/representation-change.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 { // for friendiness.
namespace v8 {
namespace internal {
namespace compiler {
......@@ -102,9 +99,6 @@ class RepresentationChangerTester : public HandleAndZoneScope,
CHECK_EQ(n, c);
}
};
} // namespace compiler
} // namespace internal
} // namespace v8
static const MachineType all_reps[] = {kRepBit, kRepWord32, kRepWord64,
......@@ -553,3 +547,7 @@ TEST(TypeErrors) {
}
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -112,13 +112,6 @@ class BytecodeGraphTester {
DISALLOW_COPY_AND_ASSIGN(BytecodeGraphTester);
};
} // namespace compiler
} // namespace internal
} // namespace v8
using namespace v8::internal;
using namespace v8::internal::compiler;
template <int N>
struct ExpectedSnippet {
......@@ -260,3 +253,7 @@ TEST(BytecodeGraphBuilderTwoParameterTests) {
CHECK(return_value->SameValue(*snippets[i].return_value()));
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -9,8 +9,9 @@
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/function-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
static void IsOptimized(const v8::FunctionCallbackInfo<v8::Value>& args) {
JavaScriptFrameIterator it(CcTest::i_isolate());
......@@ -117,3 +118,7 @@ TEST(DeoptTrivial) {
T.CheckCall(T.Val(1));
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -8,8 +8,9 @@
#include "src/frames-inl.h"
#include "test/cctest/compiler/function-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
namespace {
......@@ -603,3 +604,7 @@ TEST(InlineMutuallyRecursive) {
InstallAssertInlineCountHelper(CcTest::isolate());
T.CheckCall(T.Val(42), T.Val(1));
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -7,8 +7,10 @@
#include "test/cctest/compiler/function-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
uint32_t flags = CompilationInfo::kInliningEnabled;
......@@ -321,3 +323,7 @@ TEST(ValueOf) {
T.CheckCall(T.Val(123), T.Val(123));
T.CheckCall(T.Val(456), T.NewObject("(new Number(456))"));
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -7,8 +7,9 @@
#include "test/cctest/compiler/function-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
TEST(Conditional) {
FunctionTester T("(function(a) { return a ? 23 : 42; })");
......@@ -383,3 +384,7 @@ TEST(EmptyFor) {
T.CheckCall(T.Val(8126.1), T.Val(0.0), T.Val(8126.1));
T.CheckCall(T.Val(1123.1), T.Val(0.0), T.Val(1123.1));
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -7,8 +7,9 @@
#include "test/cctest/compiler/function-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
TEST(SimpleCall) {
FunctionTester T("(function(foo,a) { return foo(a); })");
......@@ -246,3 +247,7 @@ TEST(BuiltinLoadedFromActivation) {
CompileRun("var x = 24;");
ExpectObject("foo()", context->Global());
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -7,8 +7,9 @@
#include "test/cctest/compiler/function-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
TEST(Throw) {
FunctionTester T("(function(a,b) { if (a) { throw b; } else { return b; }})");
......@@ -278,3 +279,7 @@ TEST(DeoptFinallyReThrow) {
T.CheckThrows(T.NewObject("new Error"), T.Val(1));
#endif
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -7,8 +7,9 @@
#include "test/cctest/compiler/function-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
TEST(ArgumentsMapped) {
FunctionTester T("(function(a) { return arguments; })");
......@@ -48,3 +49,7 @@ TEST(ArgumentsRest) {
Handle<Object> length = JSObject::GetProperty(arguments, l).ToHandleChecked();
CHECK_EQ(3, length->Number());
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -7,8 +7,9 @@
#include "test/cctest/compiler/function-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
TEST(BinopAdd) {
FunctionTester T("(function(a,b) { return a + b; })");
......@@ -540,3 +541,7 @@ TEST(ClassLiteral) {
T.CheckCall(T.Val(65), T.Val(23), T.Val(42));
T.CheckCall(T.Val("ab"), T.Val("a"), T.Val("b"));
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -18,8 +18,10 @@
#include "test/cctest/compiler/value-helper.h"
using namespace v8::base;
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
typedef RawMachineAssembler::Label MLabel;
......@@ -5567,3 +5569,7 @@ TEST(RunComputedCodeObject) {
CHECK_EQ(33, r.Call(1));
CHECK_EQ(44, r.Call(0));
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -17,9 +17,9 @@
#include "test/cctest/compiler/graph-builder-tester.h"
#include "test/cctest/compiler/value-helper.h"
using namespace v8::base;
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
typedef RawMachineAssembler::Label MLabel;
......@@ -1167,3 +1167,7 @@ TEST(MixedParams_0) { MixedParamTest(0); }
TEST(MixedParams_1) { MixedParamTest(1); }
TEST(MixedParams_2) { MixedParamTest(2); }
TEST(MixedParams_3) { MixedParamTest(3); }
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -7,8 +7,9 @@
#include "test/cctest/compiler/function-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
template <typename U>
static void TypedArrayLoadHelper(const char* array_type) {
......@@ -138,3 +139,7 @@ TEST(TypedArrayStore) {
TypedArrayStoreHelper<double>("Float64");
// TODO(mstarzinger): Add tests for ClampedUint8.
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -7,8 +7,9 @@
#include "test/cctest/compiler/function-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
TEST(TerminateAtMethodEntry) {
FunctionTester T("(function(a,b) { return 23; })");
......@@ -17,3 +18,7 @@ TEST(TerminateAtMethodEntry) {
T.isolate->stack_guard()->RequestTerminateExecution();
T.CheckThrows(T.undefined(), T.undefined());
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -17,8 +17,9 @@
#include "src/parser.h"
#include "test/cctest/compiler/function-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
TEST(RunOptimizedMathFloorStub) {
......@@ -143,3 +144,7 @@ TEST(RunStringAddTFStub) {
Handle<Object> result = ft.Call(leftArg, rightArg).ToHandleChecked();
CHECK(String::Equals(ft.Val("linksrechts"), Handle<String>::cast(result)));
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -7,8 +7,9 @@
#include "test/cctest/compiler/function-tester.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
static const char* throws = NULL;
......@@ -119,3 +120,7 @@ TEST(SelfReferenceVariable) {
CompileRun("var self = 'not a function'");
T.CheckCall(T.function);
}
} // namespace compiler
} // namespace internal
} // namespace v8
......@@ -29,8 +29,9 @@
#include "test/cctest/compiler/graph-builder-tester.h"
#include "test/cctest/compiler/value-helper.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
namespace v8 {
namespace internal {
namespace compiler {
template <typename ReturnType>
class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> {
......@@ -2006,3 +2007,7 @@ TEST(PhiRepresentation) {
CHECK_EQ(d.expected, OpParameter<MachineType>(phi));
}
}
} // namespace compiler
} // namespace internal
} // namespace v8
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment