From 68a1a59556fd6907b22cbb8ab0e8f053e53c1193 Mon Sep 17 00:00:00 2001 From: "rossberg@chromium.org" Date: Tue, 27 May 2014 14:26:32 +0000 Subject: [PATCH] Remove cpp hack to avoid link failures on Windows TBR=yangguo@chromium.org BUG= Review URL: https://codereview.chromium.org/298133005 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21532 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/types.h | 2 +- test/cctest/test-types.cc | 41 +++++++++++++++++++++++++++++------------ 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/src/types.h b/src/types.h index 451ad1a..9adb59d 100644 --- a/src/types.h +++ b/src/types.h @@ -469,7 +469,7 @@ class TypeImpl : public Config::Base { template class TypeImpl::BitsetType : public TypeImpl { - private: + protected: friend class TypeImpl; enum { diff --git a/test/cctest/test-types.cc b/test/cctest/test-types.cc index 4eeeec4..d2f9b9a 100644 --- a/test/cctest/test-types.cc +++ b/test/cctest/test-types.cc @@ -27,13 +27,8 @@ #include -#define private public /* To test private methods :) */ -#define protected public -#include "types.h" -#undef private -#undef protected - #include "cctest.h" +#include "types.h" #include "utils/random-number-generator.h" using namespace v8::internal; @@ -76,6 +71,13 @@ struct ZoneRep { } static Zone* ToRegion(Zone* zone, Isolate* isolate) { return zone; } + + struct BitsetType : Type::BitsetType { + using Type::BitsetType::New; + using Type::BitsetType::Glb; + using Type::BitsetType::Lub; + using Type::BitsetType::InherentLub; + }; }; @@ -108,6 +110,16 @@ struct HeapRep { static int Length(Struct* structured) { return structured->length() - 1; } static Isolate* ToRegion(Zone* zone, Isolate* isolate) { return isolate; } + + struct BitsetType : HeapType::BitsetType { + using HeapType::BitsetType::New; + using HeapType::BitsetType::Glb; + using HeapType::BitsetType::Lub; + using HeapType::BitsetType::InherentLub; + static int Glb(Handle type) { return Glb(*type); } + static int Lub(Handle type) { return Lub(*type); } + static int InherentLub(Handle type) { return InherentLub(*type); } + }; }; @@ -739,31 +751,36 @@ struct Tests : Rep { // Ordering: (T->BitsetGlb())->Is(T->BitsetLub()) for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { TypeHandle type = *it; - TypeHandle glb = Type::BitsetType::New(type->BitsetGlb(), T.region()); - TypeHandle lub = Type::BitsetType::New(type->BitsetLub(), T.region()); + TypeHandle glb = + Rep::BitsetType::New(Rep::BitsetType::Glb(type), T.region()); + TypeHandle lub = + Rep::BitsetType::New(Rep::BitsetType::Lub(type), T.region()); CHECK(glb->Is(lub)); } // Lower bound: (T->BitsetGlb())->Is(T) for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { TypeHandle type = *it; - TypeHandle glb = Type::BitsetType::New(type->BitsetGlb(), T.region()); + TypeHandle glb = + Rep::BitsetType::New(Rep::BitsetType::Glb(type), T.region()); CHECK(glb->Is(type)); } // Upper bound: T->Is(T->BitsetLub()) for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { TypeHandle type = *it; - TypeHandle lub = Type::BitsetType::New(type->BitsetLub(), T.region()); + TypeHandle lub = + Rep::BitsetType::New(Rep::BitsetType::Lub(type), T.region()); CHECK(type->Is(lub)); } // Inherent bound: (T->BitsetLub())->Is(T->InherentBitsetLub()) for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { TypeHandle type = *it; - TypeHandle lub = Type::BitsetType::New(type->BitsetLub(), T.region()); + TypeHandle lub = + Rep::BitsetType::New(Rep::BitsetType::Lub(type), T.region()); TypeHandle inherent = - Type::BitsetType::New(type->InherentBitsetLub(), T.region()); + Rep::BitsetType::New(Rep::BitsetType::InherentLub(type), T.region()); CHECK(lub->Is(inherent)); } } -- 2.7.4