Commit ef35f11c authored by jarin's avatar jarin Committed by Commit bot

Remove the template magic from types.(h|cc), remove types-inl.h.

This CL removes the Config templatization from the types. It is not
necessary anymore, after the HeapTypes have been removed.

The CL also changes the type hierarchy - the specific type kinds are
not inner classes of the Type class and they do not inherit from Type.
This is partly because it seems impossible to make this work without
templates. Instead, a new TypeBase class is introduced and all the
structural (i.e., non-bitset) types inherit from it.

The bitset type still requires the bit-munging hack and some nasty
reinterpret-casts to pretend bitsets are of type Type*. Additionally,
there is now the same hack for TypeBase - all pointers to the sub-types
of TypeBase are reinterpret-casted to Type*. This is to keep the type
constructors in inline method definitions (although it is unclear how
much that actually buys us).

In future, we would like to move to a model where we encapsulate Type*
into a class (or possibly use Type where we used to use Type*). This
would loosen the coupling between bitset size and pointer size, and
eventually we would be able to have more bits.

TBR=bradnelson@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#33656}
parent eea1a4c0
......@@ -1303,7 +1303,6 @@ source_set("v8_base") {
"src/type-feedback-vector.h",
"src/type-info.cc",
"src/type-info.h",
"src/types-inl.h",
"src/types.cc",
"src/types.h",
"src/typing-asm.cc",
......
......@@ -819,14 +819,12 @@ void AstVisitor::VisitExpressions(ZoneList<Expression*>* expressions) {
}
}
CaseClause::CaseClause(Zone* zone, Expression* label,
ZoneList<Statement*>* statements, int pos)
: Expression(zone, pos),
label_(label),
statements_(statements),
compare_type_(Type::None(zone)) {}
compare_type_(Type::None()) {}
uint32_t Literal::Hash() {
return raw_value()->IsString()
......
......@@ -2379,7 +2379,7 @@ class CompareOperation final : public Expression {
op_(op),
left_(left),
right_(right),
combined_type_(Type::None(zone)) {
combined_type_(Type::None()) {
DCHECK(Token::IsCompareOp(op));
}
static int parent_num_ids() { return Expression::num_ids(); }
......
......@@ -134,7 +134,8 @@ class Genesis BASE_EMBEDDED {
public:
Genesis(Isolate* isolate, MaybeHandle<JSGlobalProxy> maybe_global_proxy,
v8::Local<v8::ObjectTemplate> global_proxy_template,
v8::ExtensionConfiguration* extensions, ContextType context_type);
v8::ExtensionConfiguration* extensions,
GlobalContextType context_type);
~Genesis() { }
Isolate* isolate() const { return isolate_; }
......@@ -187,10 +188,10 @@ class Genesis BASE_EMBEDDED {
// New context initialization. Used for creating a context from scratch.
void InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<JSFunction> empty_function,
ContextType context_type);
GlobalContextType context_type);
void InitializeExperimentalGlobal();
// Depending on the situation, expose and/or get rid of the utils object.
void ConfigureUtilsObject(ContextType context_type);
void ConfigureUtilsObject(GlobalContextType context_type);
#define DECLARE_FEATURE_INITIALIZATION(id, descr) \
void InitializeGlobal_##id();
......@@ -206,7 +207,7 @@ class Genesis BASE_EMBEDDED {
Handle<JSFunction> InstallInternalArray(Handle<JSObject> target,
const char* name,
ElementsKind elements_kind);
bool InstallNatives(ContextType context_type);
bool InstallNatives(GlobalContextType context_type);
void InstallTypedArray(const char* name, ElementsKind elements_kind,
Handle<JSFunction>* fun);
......@@ -318,11 +319,10 @@ void Bootstrapper::Iterate(ObjectVisitor* v) {
v->Synchronize(VisitorSynchronization::kExtensions);
}
Handle<Context> Bootstrapper::CreateEnvironment(
MaybeHandle<JSGlobalProxy> maybe_global_proxy,
v8::Local<v8::ObjectTemplate> global_proxy_template,
v8::ExtensionConfiguration* extensions, ContextType context_type) {
v8::ExtensionConfiguration* extensions, GlobalContextType context_type) {
HandleScope scope(isolate_);
Genesis genesis(isolate_, maybe_global_proxy, global_proxy_template,
extensions, context_type);
......@@ -1066,7 +1066,7 @@ static void InstallWithIntrinsicDefaultProto(Isolate* isolate,
// work in the snapshot case is done in HookUpGlobalObject.
void Genesis::InitializeGlobal(Handle<JSGlobalObject> global_object,
Handle<JSFunction> empty_function,
ContextType context_type) {
GlobalContextType context_type) {
// --- N a t i v e C o n t e x t ---
// Use the empty function as closure (no scope info).
native_context()->set_closure(*empty_function);
......@@ -1993,8 +1993,7 @@ static Handle<JSObject> ResolveBuiltinIdHolder(Handle<Context> native_context,
return Handle<JSObject>::cast(value);
}
void Genesis::ConfigureUtilsObject(ContextType context_type) {
void Genesis::ConfigureUtilsObject(GlobalContextType context_type) {
switch (context_type) {
// We still need the utils object to find debug functions.
case DEBUG_CONTEXT:
......@@ -2607,8 +2606,7 @@ Handle<JSFunction> Genesis::InstallInternalArray(Handle<JSObject> target,
return array_function;
}
bool Genesis::InstallNatives(ContextType context_type) {
bool Genesis::InstallNatives(GlobalContextType context_type) {
HandleScope scope(isolate());
// Set up the utils object as shared container between native scripts.
......@@ -3490,12 +3488,11 @@ class NoTrackDoubleFieldsForSerializerScope {
bool enabled_;
};
Genesis::Genesis(Isolate* isolate,
MaybeHandle<JSGlobalProxy> maybe_global_proxy,
v8::Local<v8::ObjectTemplate> global_proxy_template,
v8::ExtensionConfiguration* extensions,
ContextType context_type)
GlobalContextType context_type)
: isolate_(isolate), active_(isolate->bootstrapper()) {
NoTrackDoubleFieldsForSerializerScope disable_scope(isolate);
result_ = Handle<Context>::null();
......
......@@ -61,7 +61,7 @@ class SourceCodeCache final BASE_EMBEDDED {
DISALLOW_COPY_AND_ASSIGN(SourceCodeCache);
};
enum ContextType { FULL_CONTEXT, THIN_CONTEXT, DEBUG_CONTEXT };
enum GlobalContextType { FULL_CONTEXT, THIN_CONTEXT, DEBUG_CONTEXT };
// The Boostrapper is the public interface for creating a JavaScript global
// context.
......@@ -80,7 +80,7 @@ class Bootstrapper final {
MaybeHandle<JSGlobalProxy> maybe_global_proxy,
v8::Local<v8::ObjectTemplate> global_object_template,
v8::ExtensionConfiguration* extensions,
ContextType context_type = FULL_CONTEXT);
GlobalContextType context_type = FULL_CONTEXT);
// Detach the environment from its outer global object.
void DetachGlobal(Handle<Context> env);
......
......@@ -318,7 +318,7 @@ template <>
HValue* CodeStubGraphBuilder<NumberToStringStub>::BuildCodeStub() {
info()->MarkAsSavesCallerDoubles();
HValue* number = GetParameter(NumberToStringStub::kNumber);
return BuildNumberToString(number, Type::Number(zone()));
return BuildNumberToString(number, Type::Number());
}
......@@ -1468,10 +1468,9 @@ HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() {
if_leftisstring.If<HIsStringAndBranch>(left);
if_leftisstring.Then();
{
Push(BuildBinaryOperation(state.op(), left, right, Type::String(zone()),
right_type, result_type,
state.fixed_right_arg(), allocation_mode,
state.strength()));
Push(BuildBinaryOperation(
state.op(), left, right, Type::String(), right_type, result_type,
state.fixed_right_arg(), allocation_mode, state.strength()));
}
if_leftisstring.Else();
{
......@@ -1486,10 +1485,9 @@ HValue* CodeStubGraphBuilder<BinaryOpICStub>::BuildCodeInitializedStub() {
if_rightisstring.If<HIsStringAndBranch>(right);
if_rightisstring.Then();
{
Push(BuildBinaryOperation(state.op(), left, right, left_type,
Type::String(zone()), result_type,
state.fixed_right_arg(), allocation_mode,
state.strength()));
Push(BuildBinaryOperation(
state.op(), left, right, left_type, Type::String(), result_type,
state.fixed_right_arg(), allocation_mode, state.strength()));
}
if_rightisstring.Else();
{
......
......@@ -555,18 +555,17 @@ std::ostream& operator<<(std::ostream& os, const CompareNilICStub::State& s) {
Type* CompareNilICStub::GetType(Zone* zone, Handle<Map> map) {
State state = this->state();
if (state.Contains(CompareNilICStub::GENERIC)) return Type::Any(zone);
if (state.Contains(CompareNilICStub::GENERIC)) return Type::Any();
Type* result = Type::None(zone);
Type* result = Type::None();
if (state.Contains(CompareNilICStub::UNDEFINED)) {
result = Type::Union(result, Type::Undefined(zone), zone);
result = Type::Union(result, Type::Undefined(), zone);
}
if (state.Contains(CompareNilICStub::NULL_TYPE)) {
result = Type::Union(result, Type::Null(zone), zone);
result = Type::Union(result, Type::Null(), zone);
}
if (state.Contains(CompareNilICStub::MONOMORPHIC_MAP)) {
Type* type =
map.is_null() ? Type::Detectable(zone) : Type::Class(map, zone);
Type* type = map.is_null() ? Type::Detectable() : Type::Class(map, zone);
result = Type::Union(result, type, zone);
}
......@@ -576,8 +575,7 @@ Type* CompareNilICStub::GetType(Zone* zone, Handle<Map> map) {
Type* CompareNilICStub::GetInputType(Zone* zone, Handle<Map> map) {
Type* output_type = GetType(zone, map);
Type* nil_type =
nil_value() == kNullValue ? Type::Null(zone) : Type::Undefined(zone);
Type* nil_type = nil_value() == kNullValue ? Type::Null() : Type::Undefined();
return Type::Union(output_type, nil_type, zone);
}
......
......@@ -6,9 +6,9 @@
#include "src/contexts.h"
#include "src/frames.h"
#include "src/handles-inl.h"
#include "src/heap/heap.h"
#include "src/type-cache.h"
#include "src/types-inl.h"
namespace v8 {
namespace internal {
......
......@@ -10,7 +10,6 @@
#include "src/field-index-inl.h"
#include "src/objects-inl.h" // TODO(mstarzinger): Temporary cycle breaker!
#include "src/type-cache.h"
#include "src/types-inl.h"
namespace v8 {
namespace internal {
......
......@@ -14,11 +14,7 @@ namespace internal {
// Forward declarations.
class ExternalReference;
template <class>
class TypeImpl;
struct ZoneTypeConfig;
typedef TypeImpl<ZoneTypeConfig> Type;
class Type;
namespace compiler {
......
......@@ -8,7 +8,7 @@
#include "src/compiler/node-properties.h"
#include "src/compiler/operator-properties.h"
#include "src/compiler/verifier.h"
#include "src/types-inl.h"
#include "src/handles-inl.h"
namespace v8 {
namespace internal {
......
......@@ -7,7 +7,7 @@
#include "src/base/lazy-instance.h"
#include "src/compiler/opcodes.h"
#include "src/compiler/operator.h"
#include "src/types-inl.h"
#include "src/types.h"
namespace v8 {
namespace internal {
......
......@@ -15,10 +15,7 @@ namespace v8 {
namespace internal {
// Forward declarations.
template <class>
class TypeImpl;
struct ZoneTypeConfig;
typedef TypeImpl<ZoneTypeConfig> Type;
class Type;
class Zone;
......
This diff is collapsed.
......@@ -30,7 +30,7 @@ class Typer {
Typer(Isolate* isolate, Graph* graph, Flags flags = kNoFlags,
CompilationDependencies* dependencies = nullptr,
Type::FunctionType* function_type = nullptr);
FunctionType* function_type = nullptr);
~Typer();
void Run();
......@@ -46,13 +46,13 @@ class Typer {
Isolate* isolate() const { return isolate_; }
Flags flags() const { return flags_; }
CompilationDependencies* dependencies() const { return dependencies_; }
Type::FunctionType* function_type() const { return function_type_; }
FunctionType* function_type() const { return function_type_; }
Isolate* const isolate_;
Graph* const graph_;
Flags const flags_;
CompilationDependencies* const dependencies_;
Type::FunctionType* function_type_;
FunctionType* function_type_;
Decorator* decorator_;
TypeCache const& cache_;
......
......@@ -22,7 +22,6 @@
#include "src/compiler/schedule.h"
#include "src/compiler/simplified-operator.h"
#include "src/ostreams.h"
#include "src/types-inl.h"
namespace v8 {
namespace internal {
......
......@@ -4,9 +4,8 @@
#include "src/crankshaft/hydrogen-types.h"
#include "src/handles-inl.h"
#include "src/ostreams.h"
#include "src/types-inl.h"
namespace v8 {
namespace internal {
......
......@@ -10906,7 +10906,7 @@ HValue* HGraphBuilder::TruncateToNumber(HValue* value, Type** expected) {
Maybe<HConstant*> number =
constant->CopyToTruncatedNumber(isolate(), zone());
if (number.IsJust()) {
*expected = Type::Number(zone());
*expected = Type::Number();
return AddInstruction(number.FromJust());
}
}
......@@ -10920,20 +10920,20 @@ HValue* HGraphBuilder::TruncateToNumber(HValue* value, Type** expected) {
// Separate the number type from the rest.
Type* expected_obj =
Type::Intersect(expected_type, Type::NonNumber(zone()), zone());
Type::Intersect(expected_type, Type::NonNumber(), zone());
Type* expected_number =
Type::Intersect(expected_type, Type::Number(zone()), zone());
Type::Intersect(expected_type, Type::Number(), zone());
// We expect to get a number.
// (We need to check first, since Type::None->Is(Type::Any()) == true.
if (expected_obj->Is(Type::None())) {
DCHECK(!expected_number->Is(Type::None(zone())));
DCHECK(!expected_number->Is(Type::None()));
return value;
}
if (expected_obj->Is(Type::Undefined(zone()))) {
if (expected_obj->Is(Type::Undefined())) {
// This is already done by HChange.
*expected = Type::Union(expected_number, Type::Number(zone()), zone());
*expected = Type::Union(expected_number, Type::Number(), zone());
return value;
}
......@@ -11008,7 +11008,7 @@ HValue* HGraphBuilder::BuildBinaryOperation(
Add<HDeoptimize>(
Deoptimizer::kInsufficientTypeFeedbackForLHSOfBinaryOperation,
Deoptimizer::SOFT);
left_type = Type::Any(zone());
left_type = Type::Any();
left_rep = RepresentationFor(left_type);
maybe_string_add = op == Token::ADD;
}
......@@ -11017,7 +11017,7 @@ HValue* HGraphBuilder::BuildBinaryOperation(
Add<HDeoptimize>(
Deoptimizer::kInsufficientTypeFeedbackForRHSOfBinaryOperation,
Deoptimizer::SOFT);
right_type = Type::Any(zone());
right_type = Type::Any();
right_rep = RepresentationFor(right_type);
maybe_string_add = op == Token::ADD;
}
......@@ -11571,7 +11571,7 @@ HControlInstruction* HOptimizedGraphBuilder::BuildCompareInstruction(
Add<HDeoptimize>(
Deoptimizer::kInsufficientTypeFeedbackForCombinedTypeOfBinaryOperation,
Deoptimizer::SOFT);
combined_type = left_type = right_type = Type::Any(zone());
combined_type = left_type = right_type = Type::Any();
}
Representation left_rep = RepresentationFor(left_type);
......@@ -11757,7 +11757,8 @@ void HOptimizedGraphBuilder::HandleLiteralCompareNil(CompareOperation* expr,
} else {
DCHECK_EQ(Token::EQ, expr->op());
Type* type = expr->combined_type()->Is(Type::None())
? Type::Any(zone()) : expr->combined_type();
? Type::Any()
: expr->combined_type();
HIfContinuation continuation;
BuildCompareNil(value, type, &continuation);
return ast_context()->ReturnContinuation(&continuation, expr->id());
......@@ -12320,10 +12321,10 @@ void HOptimizedGraphBuilder::GenerateToName(CallRuntime* call) {
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* input = Pop();
if (input->type().IsSmi()) {
HValue* result = BuildNumberToString(input, Type::SignedSmall(zone()));
HValue* result = BuildNumberToString(input, Type::SignedSmall());
return ast_context()->ReturnValue(result);
} else if (input->type().IsTaggedNumber()) {
HValue* result = BuildNumberToString(input, Type::Number(zone()));
HValue* result = BuildNumberToString(input, Type::Number());
return ast_context()->ReturnValue(result);
} else if (input->type().IsString()) {
return ast_context()->ReturnValue(input);
......@@ -12744,7 +12745,7 @@ void HOptimizedGraphBuilder::GenerateNumberToString(CallRuntime* call) {
DCHECK_EQ(1, call->arguments()->length());
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* number = Pop();
HValue* result = BuildNumberToString(number, Type::Any(zone()));
HValue* result = BuildNumberToString(number, Type::Any());
return ast_context()->ReturnValue(result);
}
......
......@@ -45,7 +45,7 @@ AstTyper::AstTyper(Isolate* isolate, Zone* zone, Handle<JSFunction> closure,
Effect AstTyper::ObservedOnStack(Object* value) {
Type* lower = Type::NowOf(value, zone());
return Effect(Bounds(lower, Type::Any(zone())));
return Effect(Bounds(lower, Type::Any()));
}
......@@ -393,7 +393,7 @@ void AstTyper::VisitLiteral(Literal* expr) {
void AstTyper::VisitRegExpLiteral(RegExpLiteral* expr) {
// TODO(rossberg): Reintroduce RegExp type.
NarrowType(expr, Bounds(Type::Object(zone())));
NarrowType(expr, Bounds(Type::Object()));
}
......@@ -421,7 +421,7 @@ void AstTyper::VisitObjectLiteral(ObjectLiteral* expr) {
RECURSE(Visit(prop->value()));
}
NarrowType(expr, Bounds(Type::Object(zone())));
NarrowType(expr, Bounds(Type::Object()));
}
......@@ -432,7 +432,7 @@ void AstTyper::VisitArrayLiteral(ArrayLiteral* expr) {
RECURSE(Visit(value));
}
NarrowType(expr, Bounds(Type::Object(zone())));
NarrowType(expr, Bounds(Type::Object()));
}
......@@ -485,7 +485,7 @@ void AstTyper::VisitThrow(Throw* expr) {
RECURSE(Visit(expr->exception()));
// TODO(rossberg): is it worth having a non-termination effect?
NarrowType(expr, Bounds(Type::None(zone())));
NarrowType(expr, Bounds(Type::None()));
}
......@@ -569,7 +569,7 @@ void AstTyper::VisitCallNew(CallNew* expr) {
RECURSE(Visit(arg));
}
NarrowType(expr, Bounds(Type::None(zone()), Type::Receiver(zone())));
NarrowType(expr, Bounds(Type::None(), Type::Receiver()));
}
......@@ -596,13 +596,13 @@ void AstTyper::VisitUnaryOperation(UnaryOperation* expr) {
switch (expr->op()) {
case Token::NOT:
case Token::DELETE:
NarrowType(expr, Bounds(Type::Boolean(zone())));
NarrowType(expr, Bounds(Type::Boolean()));
break;
case Token::VOID:
NarrowType(expr, Bounds(Type::Undefined(zone())));
NarrowType(expr, Bounds(Type::Undefined()));
break;
case Token::TYPEOF:
NarrowType(expr, Bounds(Type::InternalizedString(zone())));
NarrowType(expr, Bounds(Type::InternalizedString()));
break;
default:
UNREACHABLE();
......@@ -624,7 +624,7 @@ void AstTyper::VisitCountOperation(CountOperation* expr) {
RECURSE(Visit(expr->expression()));
NarrowType(expr, Bounds(Type::SignedSmall(zone()), Type::Number(zone())));
NarrowType(expr, Bounds(Type::SignedSmall(), Type::Number()));
VariableProxy* proxy = expr->expression()->AsVariableProxy();
if (proxy != NULL && proxy->var()->IsStackAllocated()) {
......@@ -679,8 +679,8 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
RECURSE(Visit(expr->right()));
Type* upper = Type::Union(
expr->left()->bounds().upper, expr->right()->bounds().upper, zone());
if (!upper->Is(Type::Signed32())) upper = Type::Signed32(zone());
Type* lower = Type::Intersect(Type::SignedSmall(zone()), upper, zone());
if (!upper->Is(Type::Signed32())) upper = Type::Signed32();
Type* lower = Type::Intersect(Type::SignedSmall(), upper, zone());
NarrowType(expr, Bounds(lower, upper));
break;
}
......@@ -689,8 +689,7 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
case Token::SAR:
RECURSE(Visit(expr->left()));
RECURSE(Visit(expr->right()));
NarrowType(expr,
Bounds(Type::SignedSmall(zone()), Type::Signed32(zone())));
NarrowType(expr, Bounds(Type::SignedSmall(), Type::Signed32()));
break;
case Token::SHR:
RECURSE(Visit(expr->left()));
......@@ -698,7 +697,7 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
// TODO(rossberg): The upper bound would be Unsigned32, but since there
// is no 'positive Smi' type for the lower bound, we use the smallest
// union of Smi and Unsigned32 as upper bound instead.
NarrowType(expr, Bounds(Type::SignedSmall(zone()), Type::Number(zone())));
NarrowType(expr, Bounds(Type::SignedSmall(), Type::Number()));
break;
case Token::ADD: {
RECURSE(Visit(expr->left()));
......@@ -706,17 +705,19 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
Bounds l = expr->left()->bounds();
Bounds r = expr->right()->bounds();
Type* lower =
!l.lower->IsInhabited() || !r.lower->IsInhabited() ?
Type::None(zone()) :
l.lower->Is(Type::String()) || r.lower->Is(Type::String()) ?
Type::String(zone()) :
l.lower->Is(Type::Number()) && r.lower->Is(Type::Number()) ?
Type::SignedSmall(zone()) : Type::None(zone());
!l.lower->IsInhabited() || !r.lower->IsInhabited()
? Type::None()
: l.lower->Is(Type::String()) || r.lower->Is(Type::String())
? Type::String()
: l.lower->Is(Type::Number()) && r.lower->Is(Type::Number())
? Type::SignedSmall()
: Type::None();
Type* upper =
l.upper->Is(Type::String()) || r.upper->Is(Type::String()) ?
Type::String(zone()) :
l.upper->Is(Type::Number()) && r.upper->Is(Type::Number()) ?
Type::Number(zone()) : Type::NumberOrString(zone());
l.upper->Is(Type::String()) || r.upper->Is(Type::String())
? Type::String()
: l.upper->Is(Type::Number()) && r.upper->Is(Type::Number())
? Type::Number()
: Type::NumberOrString();
NarrowType(expr, Bounds(lower, upper));
break;
}
......@@ -726,7 +727,7 @@ void AstTyper::VisitBinaryOperation(BinaryOperation* expr) {
case Token::MOD:
RECURSE(Visit(expr->left()));
RECURSE(Visit(expr->right()));
NarrowType(expr, Bounds(Type::SignedSmall(zone()), Type::Number(zone())));
NarrowType(expr, Bounds(Type::SignedSmall(), Type::Number()));
break;
default:
UNREACHABLE();
......@@ -748,7 +749,7 @@ void AstTyper::VisitCompareOperation(CompareOperation* expr) {
RECURSE(Visit(expr->left()));
RECURSE(Visit(expr->right()));
NarrowType(expr, Bounds(Type::Boolean(zone())));
NarrowType(expr, Bounds(Type::Boolean()));
}
......
......@@ -371,25 +371,25 @@ const char* CompareICState::GetStateName(State state) {
Type* CompareICState::StateToType(Zone* zone, State state, Handle<Map> map) {
switch (state) {
case UNINITIALIZED:
return Type::None(zone);
return Type::None();
case BOOLEAN:
return Type::Boolean(zone);
return Type::Boolean();
case SMI:
return Type::SignedSmall(zone);
return Type::SignedSmall();
case NUMBER:
return Type::Number(zone);
return Type::Number();
case STRING:
return Type::String(zone);
return Type::String();
case INTERNALIZED_STRING:
return Type::InternalizedString(zone);
return Type::InternalizedString();
case UNIQUE_NAME:
return Type::UniqueName(zone);
return Type::UniqueName();
case RECEIVER:
return Type::Receiver(zone);
return Type::Receiver();
case KNOWN_RECEIVER:
return map.is_null() ? Type::Receiver(zone) : Type::Class(map, zone);
return map.is_null() ? Type::Receiver() : Type::Class(map, zone);
case GENERIC:
return Type::Any(zone);
return Type::Any();
}
UNREACHABLE();
return NULL;
......
This diff is collapsed.
......@@ -89,7 +89,7 @@ class CallInterfaceDescriptorData {
// A copy of the passed in registers and param_representations is made
// and owned by the CallInterfaceDescriptorData.
void InitializePlatformIndependent(Type::FunctionType* function_type) {
void InitializePlatformIndependent(FunctionType* function_type) {
function_type_ = function_type;
}
......@@ -112,7 +112,7 @@ class CallInterfaceDescriptorData {
return platform_specific_descriptor_;
}
Type::FunctionType* function_type() const { return function_type_; }
FunctionType* function_type() const { return function_type_; }
private:
int register_param_count_;
......@@ -124,7 +124,7 @@ class CallInterfaceDescriptorData {
base::SmartArrayPointer<Register> register_params_;
// Specifies types for parameters and return
Type::FunctionType* function_type_;
FunctionType* function_type_;
PlatformInterfaceDescriptor* platform_specific_descriptor_;
......@@ -175,21 +175,19 @@ class CallInterfaceDescriptor {
return data()->platform_specific_descriptor();
}
Type::FunctionType* GetFunctionType() const {
return data()->function_type();
}
FunctionType* GetFunctionType() const { return data()->function_type(); }
static const Register ContextRegister();
const char* DebugName(Isolate* isolate) const;
static Type::FunctionType* BuildDefaultFunctionType(Isolate* isolate,
int paramater_count);
static FunctionType* BuildDefaultFunctionType(Isolate* isolate,
int paramater_count);
protected:
const CallInterfaceDescriptorData* data() const { return data_; }
virtual Type::FunctionType* BuildCallInterfaceDescriptorFunctionType(
virtual FunctionType* BuildCallInterfaceDescriptorFunctionType(
Isolate* isolate, int register_param_count) {
return BuildDefaultFunctionType(isolate, register_param_count);
}
......@@ -202,9 +200,8 @@ class CallInterfaceDescriptor {
if (!data()->IsInitialized()) {
CallInterfaceDescriptorData* d = isolate->call_descriptor_data(key);
InitializePlatformSpecific(d);
Type::FunctionType* function_type =
BuildCallInterfaceDescriptorFunctionType(isolate,
d->register_param_count());
FunctionType* function_type = BuildCallInterfaceDescriptorFunctionType(
isolate, d->register_param_count());
d->InitializePlatformIndependent(function_type);
}
}
......@@ -226,16 +223,14 @@ class CallInterfaceDescriptor {
public: \
static inline CallDescriptors::Key key();
#define DECLARE_DESCRIPTOR_WITH_CUSTOM_FUNCTION_TYPE(name, base) \
DECLARE_DESCRIPTOR(name, base) \
protected: \
Type::FunctionType* BuildCallInterfaceDescriptorFunctionType( \
FunctionType* BuildCallInterfaceDescriptorFunctionType( \
Isolate* isolate, int register_param_count) override; \
\
public:
class VoidDescriptor : public CallInterfaceDescriptor {
public:
DECLARE_DESCRIPTOR(VoidDescriptor, CallInterfaceDescriptor)
......
......@@ -71,6 +71,7 @@ class CallSite {
int32_t pos_;
};
#define MESSAGE_TEMPLATES(T) \
/* Error */ \
T(None, "") \
......
......@@ -18,6 +18,7 @@
#include "src/conversions-inl.h"
#include "src/factory.h"
#include "src/field-index-inl.h"
#include "src/handles-inl.h"
#include "src/heap/heap-inl.h"
#include "src/heap/heap.h"
#include "src/isolate.h"
......@@ -28,7 +29,6 @@
#include "src/prototype.h"
#include "src/transitions-inl.h"
#include "src/type-feedback-vector-inl.h"
#include "src/types-inl.h"
#include "src/v8memory.h"
namespace v8 {
......
......@@ -56,9 +56,7 @@ STATIC_ASSERT(((SKIP_STRINGS | SKIP_SYMBOLS | ONLY_ALL_CAN_READ) &
class Smi;
template<class> class TypeImpl;
struct ZoneTypeConfig;
typedef TypeImpl<ZoneTypeConfig> Type;
class Type;
class TypeInfo;
// Type of properties.
......
......@@ -5,7 +5,6 @@
#include "src/type-cache.h"
#include "src/base/lazy-instance.h"
#include "src/types-inl.h"
namespace v8 {
namespace internal {
......
......@@ -200,7 +200,7 @@ void TypeFeedbackOracle::CompareType(TypeFeedbackId id,
Handle<Object> info = GetInfo(id);
if (!info->IsCode()) {
// For some comparisons we don't have ICs, e.g. LiteralCompareTypeof.
*left_type = *right_type = *combined_type = Type::None(zone());
*left_type = *right_type = *combined_type = Type::None();
return;
}
Handle<Code> code = Handle<Code>::cast(info);
......@@ -235,7 +235,7 @@ void TypeFeedbackOracle::BinaryType(TypeFeedbackId id,
// operations covered by the BinaryOpIC we should always have them.
DCHECK(op < BinaryOpICState::FIRST_TOKEN ||
op > BinaryOpICState::LAST_TOKEN);
*left = *right = *result = Type::None(zone());
*left = *right = *result = Type::None();
*fixed_right_arg = Nothing<int>();
*allocation_site = Handle<AllocationSite>::null();
return;
......@@ -261,7 +261,7 @@ void TypeFeedbackOracle::BinaryType(TypeFeedbackId id,
Type* TypeFeedbackOracle::CountType(TypeFeedbackId id) {
Handle<Object> object = GetInfo(id);
if (!object->IsCode()) return Type::None(zone());
if (!object->IsCode()) return Type::None();
Handle<Code> code = Handle<Code>::cast(object);
DCHECK_EQ(Code::BINARY_OP_IC, code->kind());
BinaryOpICState state(isolate(), code->extra_ic_state());
......
// Copyright 2014 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.
#ifndef V8_TYPES_INL_H_
#define V8_TYPES_INL_H_
#include "src/types.h"
#include "src/factory.h"
#include "src/handles-inl.h"
namespace v8 {
namespace internal {
// -----------------------------------------------------------------------------
// TypeImpl
template<class Config>
typename TypeImpl<Config>::bitset TypeImpl<Config>::BitsetType::SignedSmall() {
return i::SmiValuesAre31Bits() ? kSigned31 : kSigned32;
}
template<class Config>
typename TypeImpl<Config>::bitset
TypeImpl<Config>::BitsetType::UnsignedSmall() {
return i::SmiValuesAre31Bits() ? kUnsigned30 : kUnsigned31;
}
#define CONSTRUCT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) \
template<class Config> \
typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::Name( \
Isolate* isolate, Region* region) { \
return Class(i::handle(isolate->heap()->name##_map()), region); \
}
SIMD128_TYPES(CONSTRUCT_SIMD_TYPE)
#undef CONSTRUCT_SIMD_TYPE
template<class Config>
TypeImpl<Config>* TypeImpl<Config>::cast(typename Config::Base* object) {
TypeImpl* t = static_cast<TypeImpl*>(object);
DCHECK(t->IsBitset() || t->IsClass() || t->IsConstant() || t->IsRange() ||
t->IsUnion() || t->IsArray() || t->IsFunction() || t->IsContext());
return t;
}
// Most precise _current_ type of a value (usually its class).
template<class Config>
typename TypeImpl<Config>::TypeHandle TypeImpl<Config>::NowOf(
i::Object* value, Region* region) {
if (value->IsSmi() ||
i::HeapObject::cast(value)->map()->instance_type() == HEAP_NUMBER_TYPE) {
return Of(value, region);
}
return Class(i::handle(i::HeapObject::cast(value)->map()), region);
}
template<class Config>
bool TypeImpl<Config>::NowContains(i::Object* value) {
DisallowHeapAllocation no_allocation;
if (this->IsAny()) return true;
if (value->IsHeapObject()) {
i::Map* map = i::HeapObject::cast(value)->map();
for (Iterator<i::Map> it = this->Classes(); !it.Done(); it.Advance()) {
if (*it.Current() == map) return true;
}
}
return this->Contains(value);
}
// -----------------------------------------------------------------------------
// ZoneTypeConfig
// static
template<class T>
T* ZoneTypeConfig::handle(T* type) {
return type;
}
// static
template<class T>
T* ZoneTypeConfig::cast(Type* type) {
return static_cast<T*>(type);
}
// static
bool ZoneTypeConfig::is_bitset(Type* type) {
return reinterpret_cast<uintptr_t>(type) & 1;
}
// static
bool ZoneTypeConfig::is_struct(Type* type, int tag) {
DCHECK(tag != kRangeStructTag);
if (is_bitset(type)) return false;
int type_tag = struct_tag(as_struct(type));
return type_tag == tag;
}
// static
bool ZoneTypeConfig::is_range(Type* type) {
if (is_bitset(type)) return false;
int type_tag = struct_tag(as_struct(type));
return type_tag == kRangeStructTag;
}
// static
bool ZoneTypeConfig::is_class(Type* type) {
return false;
}
// static
ZoneTypeConfig::Type::bitset ZoneTypeConfig::as_bitset(Type* type) {
DCHECK(is_bitset(type));
return static_cast<Type::bitset>(reinterpret_cast<uintptr_t>(type) ^ 1u);
}
// static
ZoneTypeConfig::Struct* ZoneTypeConfig::as_struct(Type* type) {
DCHECK(!is_bitset(type));
return reinterpret_cast<Struct*>(type);
}
// static
ZoneTypeConfig::Range* ZoneTypeConfig::as_range(Type* type) {
DCHECK(!is_bitset(type));
return reinterpret_cast<Range*>(type);
}
// static
i::Handle<i::Map> ZoneTypeConfig::as_class(Type* type) {
UNREACHABLE();
return i::Handle<i::Map>();
}
// static
ZoneTypeConfig::Type* ZoneTypeConfig::from_bitset(Type::bitset bitset) {
return reinterpret_cast<Type*>(static_cast<uintptr_t>(bitset | 1u));
}
// static
ZoneTypeConfig::Type* ZoneTypeConfig::from_bitset(
Type::bitset bitset, Zone* Zone) {
return from_bitset(bitset);
}
// static
ZoneTypeConfig::Type* ZoneTypeConfig::from_struct(Struct* structure) {
return reinterpret_cast<Type*>(structure);
}
// static
ZoneTypeConfig::Type* ZoneTypeConfig::from_range(Range* range) {
return reinterpret_cast<Type*>(range);
}
// static
ZoneTypeConfig::Type* ZoneTypeConfig::from_class(
i::Handle<i::Map> map, Zone* zone) {
return from_bitset(0);
}
// static
ZoneTypeConfig::Struct* ZoneTypeConfig::struct_create(
int tag, int length, Zone* zone) {
DCHECK(tag != kRangeStructTag);
Struct* structure = reinterpret_cast<Struct*>(
zone->New(sizeof(void*) * (length + 2))); // NOLINT
structure[0] = reinterpret_cast<void*>(tag);
structure[1] = reinterpret_cast<void*>(length);
return structure;
}
// static
void ZoneTypeConfig::struct_shrink(Struct* structure, int length) {
DCHECK(0 <= length && length <= struct_length(structure));
structure[1] = reinterpret_cast<void*>(length);
}
// static
int ZoneTypeConfig::struct_tag(Struct* structure) {
return static_cast<int>(reinterpret_cast<intptr_t>(structure[0]));
}
// static
int ZoneTypeConfig::struct_length(Struct* structure) {
return static_cast<int>(reinterpret_cast<intptr_t>(structure[1]));
}
// static
Type* ZoneTypeConfig::struct_get(Struct* structure, int i) {
DCHECK(0 <= i && i <= struct_length(structure));
return static_cast<Type*>(structure[2 + i]);
}
// static
void ZoneTypeConfig::struct_set(Struct* structure, int i, Type* x) {
DCHECK(0 <= i && i <= struct_length(structure));
structure[2 + i] = x;
}
// static
template<class V>
i::Handle<V> ZoneTypeConfig::struct_get_value(Struct* structure, int i) {
DCHECK(0 <= i && i <= struct_length(structure));
return i::Handle<V>(static_cast<V**>(structure[2 + i]));
}
// static
template<class V>
void ZoneTypeConfig::struct_set_value(
Struct* structure, int i, i::Handle<V> x) {
DCHECK(0 <= i && i <= struct_length(structure));
structure[2 + i] = x.location();
}
// static
ZoneTypeConfig::Range* ZoneTypeConfig::range_create(Zone* zone) {
Range* range = reinterpret_cast<Range*>(zone->New(sizeof(Range))); // NOLINT
range->tag = reinterpret_cast<void*>(kRangeStructTag);
range->bitset = 0;
range->limits[0] = 1;
range->limits[1] = 0;
return range;
}
// static
int ZoneTypeConfig::range_get_bitset(ZoneTypeConfig::Range* range) {
return range->bitset;
}
// static
void ZoneTypeConfig::range_set_bitset(ZoneTypeConfig::Range* range, int value) {
range->bitset = value;
}
// static
double ZoneTypeConfig::range_get_double(ZoneTypeConfig::Range* range,
int index) {
DCHECK(index >= 0 && index < 2);
return range->limits[index];
}
// static
void ZoneTypeConfig::range_set_double(ZoneTypeConfig::Range* range, int index,
double value, Zone*) {
DCHECK(index >= 0 && index < 2);
range->limits[index] = value;
}
} // namespace internal
} // namespace v8
#endif // V8_TYPES_INL_H_
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -336,7 +336,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
Scope* scope = expr->scope();
if (in_function_) {
if (expr->bounds().lower->IsFunction()) {
Type::FunctionType* func_type = expr->bounds().lower->AsFunction();
FunctionType* func_type = expr->bounds().lower->AsFunction();
LocalType return_type = TypeFrom(func_type->Result());
current_function_builder_->ReturnType(return_type);
for (int i = 0; i < expr->parameter_count(); i++) {
......@@ -465,7 +465,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
}
void AddFunctionTable(VariableProxy* table, ArrayLiteral* funcs) {
Type::FunctionType* func_type =
FunctionType* func_type =
funcs->bounds().lower->AsArray()->Element()->AsFunction();
LocalType return_type = TypeFrom(func_type->Result());
FunctionSig::Builder sig(zone(), return_type == kAstStmt ? 0 : 1,
......@@ -551,7 +551,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
void VisitProperty(Property* expr) {
Expression* obj = expr->obj();
DCHECK(obj->bounds().lower == obj->bounds().upper);
TypeImpl<ZoneTypeConfig>* type = obj->bounds().lower;
Type* type = obj->bounds().lower;
MachineType mtype;
int size;
if (type->Is(cache_.kUint8Array)) {
......@@ -951,7 +951,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
TypeIndex TypeIndexOf(Expression* expr) {
DCHECK(expr->bounds().lower == expr->bounds().upper);
TypeImpl<ZoneTypeConfig>* type = expr->bounds().lower;
Type* type = expr->bounds().lower;
if (type->Is(cache_.kAsmFixnum)) {
return kFixnum;
} else if (type->Is(cache_.kAsmSigned)) {
......@@ -1063,7 +1063,7 @@ class AsmWasmBuilderImpl : public AstVisitor {
return TypeFrom(expr->bounds().lower);
}
LocalType TypeFrom(TypeImpl<ZoneTypeConfig>* type) {
LocalType TypeFrom(Type* type) {
if (type->Is(cache_.kAsmInt)) {
return kAstI32;
} else if (type->Is(cache_.kAsmFloat)) {
......
......@@ -16,15 +16,15 @@
#include "test/cctest/expression-type-collector-macros.h"
// Macros for function types.
#define FUNC_BARE_TYPE Bounds(Type::Function(zone))
#define FUNC_V_TYPE Bounds(Type::Function(Type::Undefined(zone), zone))
#define FUNC_BARE_TYPE Bounds(Type::Function())
#define FUNC_V_TYPE Bounds(Type::Function(Type::Undefined(), zone))
#define FUNC_I_TYPE Bounds(Type::Function(cache.kAsmSigned, zone))
#define FUNC_F_TYPE Bounds(Type::Function(cache.kAsmFloat, zone))
#define FUNC_D_TYPE Bounds(Type::Function(cache.kAsmDouble, zone))
#define FUNC_D2D_TYPE \
Bounds(Type::Function(cache.kAsmDouble, cache.kAsmDouble, zone))
#define FUNC_N2F_TYPE \
Bounds(Type::Function(cache.kAsmFloat, Type::Number(zone), zone))
Bounds(Type::Function(cache.kAsmFloat, Type::Number(), zone))
#define FUNC_I2I_TYPE \
Bounds(Type::Function(cache.kAsmSigned, cache.kAsmInt, zone))
#define FUNC_II2D_TYPE \
......@@ -34,11 +34,10 @@
#define FUNC_DD2D_TYPE \
Bounds(Type::Function(cache.kAsmDouble, cache.kAsmDouble, cache.kAsmDouble, \
zone))
#define FUNC_NN2N_TYPE \
Bounds(Type::Function(Type::Number(zone), Type::Number(zone), \
Type::Number(zone), zone))
#define FUNC_NN2N_TYPE \
Bounds(Type::Function(Type::Number(), Type::Number(), Type::Number(), zone))
#define FUNC_N2N_TYPE \
Bounds(Type::Function(Type::Number(zone), Type::Number(zone), zone))
Bounds(Type::Function(Type::Number(), Type::Number(), zone))
// Macros for array types.
#define FLOAT64_ARRAY_TYPE Bounds(Type::Array(cache.kAsmDouble, zone))
......@@ -266,7 +265,7 @@ TEST(ValidateMinimum) {
}
}
// "use asm";
CHECK_EXPR(Literal, Bounds(Type::String(zone)));
CHECK_EXPR(Literal, Bounds(Type::String()));
// var exp = stdlib.Math.exp;
CHECK_EXPR(Assignment, FUNC_D2D_TYPE) {
CHECK_VAR(exp, FUNC_D2D_TYPE);
......@@ -519,12 +518,11 @@ void CheckStdlibShortcuts2(Zone* zone, ZoneVector<ExpressionTypeEntry>& types,
CHECK_EXPR(FunctionLiteral, Bounds::Unbounded()) {
#define CHECK_FUNC_TYPES_END_1() \
/* "use asm"; */ \
CHECK_EXPR(Literal, Bounds(Type::String(zone))); \
CHECK_EXPR(Literal, Bounds(Type::String())); \
/* stdlib shortcuts. */ \
CheckStdlibShortcuts1(zone, types, index, depth, cache); \
CheckStdlibShortcuts2(zone, types, index, depth, cache);
#define CHECK_FUNC_TYPES_END_2() \
/* return { foo: foo }; */ \
CHECK_EXPR(ObjectLiteral, Bounds::Unbounded()) { \
......@@ -565,10 +563,10 @@ TEST(ReturnVoid) {
"function foo() { bar(); }") {
CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {
// return undefined;
CHECK_EXPR(Literal, Bounds(Type::Undefined(zone)));
CHECK_EXPR(Literal, Bounds(Type::Undefined()));
}
CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {
CHECK_EXPR(Call, Bounds(Type::Undefined(zone))) {
CHECK_EXPR(Call, Bounds(Type::Undefined())) {
CHECK_VAR(bar, FUNC_V_TYPE);
}
}
......@@ -583,7 +581,7 @@ TEST(EmptyBody) {
"function foo() { bar(); }") {
CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE);
CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {
CHECK_EXPR(Call, Bounds(Type::Undefined(zone))) {
CHECK_EXPR(Call, Bounds(Type::Undefined())) {
CHECK_VAR(bar, FUNC_V_TYPE);
}
}
......@@ -603,7 +601,7 @@ TEST(DoesNothing) {
}
}
CHECK_EXPR(FunctionLiteral, FUNC_V_TYPE) {
CHECK_EXPR(Call, Bounds(Type::Undefined(zone))) {
CHECK_EXPR(Call, Bounds(Type::Undefined())) {
CHECK_VAR(bar, FUNC_V_TYPE);
}
}
......@@ -1067,7 +1065,7 @@ TEST(UnsignedDivide) {
CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
}
CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) {
CHECK_EXPR(BinaryOperation, Bounds(Type::None(zone), Type::Any(zone))) {
CHECK_EXPR(BinaryOperation, Bounds(Type::None(), Type::Any())) {
CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmUnsigned)) {
CHECK_VAR(x, Bounds(cache.kAsmInt));
CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
......@@ -1742,9 +1740,9 @@ TEST(ForeignFunction) {
}
}
CHECK_FUNC_TYPES_END_1()
CHECK_EXPR(Assignment, Bounds(Type::Any(zone))) {
CHECK_VAR(baz, Bounds(Type::Any(zone)));
CHECK_EXPR(Property, Bounds(Type::Any(zone))) {
CHECK_EXPR(Assignment, Bounds(Type::Any())) {
CHECK_VAR(baz, Bounds(Type::Any()));
CHECK_EXPR(Property, Bounds(Type::Any())) {
CHECK_VAR(foreign, Bounds::Unbounded());
CHECK_EXPR(Literal, Bounds::Unbounded());
}
......@@ -2010,7 +2008,7 @@ TEST(SwitchTest) {
CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
}
}
CHECK_EXPR(Literal, Bounds(Type::Undefined(zone)));
CHECK_EXPR(Literal, Bounds(Type::Undefined()));
CHECK_VAR(.switch_tag, Bounds(cache.kAsmSigned));
// case 1: return 23;
CHECK_EXPR(Literal, Bounds(cache.kAsmFixnum));
......@@ -2154,11 +2152,11 @@ TEST(Imports) {
}
}
// "use asm";
CHECK_EXPR(Literal, Bounds(Type::String(zone)));
CHECK_EXPR(Literal, Bounds(Type::String()));
// var func = foreign.foo;
CHECK_EXPR(Assignment, Bounds(Type::Any(zone))) {
CHECK_VAR(ffunc, Bounds(Type::Any(zone)));
CHECK_EXPR(Property, Bounds(Type::Any(zone))) {
CHECK_EXPR(Assignment, Bounds(Type::Any())) {
CHECK_VAR(ffunc, Bounds(Type::Any()));
CHECK_EXPR(Property, Bounds(Type::Any())) {
CHECK_VAR(foreign, Bounds::Unbounded());
CHECK_EXPR(Literal, Bounds::Unbounded());
}
......@@ -2167,7 +2165,7 @@ TEST(Imports) {
CHECK_EXPR(Assignment, Bounds(cache.kAsmInt)) {
CHECK_VAR(fint, Bounds(cache.kAsmInt));
CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmSigned)) {
CHECK_EXPR(Property, Bounds(Type::Number(zone))) {
CHECK_EXPR(Property, Bounds(Type::Number())) {
CHECK_VAR(foreign, Bounds::Unbounded());
CHECK_EXPR(Literal, Bounds::Unbounded());
}
......@@ -2178,7 +2176,7 @@ TEST(Imports) {
CHECK_EXPR(Assignment, Bounds(cache.kAsmDouble)) {
CHECK_VAR(fdouble, Bounds(cache.kAsmDouble));
CHECK_EXPR(BinaryOperation, Bounds(cache.kAsmDouble)) {
CHECK_EXPR(Property, Bounds(Type::Number(zone))) {
CHECK_EXPR(Property, Bounds(Type::Number())) {
CHECK_VAR(foreign, Bounds::Unbounded());
CHECK_EXPR(Literal, Bounds::Unbounded());
}
......
This diff is collapsed.
This diff is collapsed.
......@@ -9,7 +9,7 @@
#include "src/compiler/js-graph.h"
#include "src/compiler/node-properties.h"
#include "src/compiler/simplified-operator.h"
#include "src/types-inl.h"
#include "src/types.h"
#include "src/zone-containers.h"
#include "test/unittests/compiler/graph-unittest.h"
......
......@@ -7,7 +7,6 @@
#include "src/compiler/js-graph.h"
#include "src/compiler/js-intrinsic-lowering.h"
#include "src/compiler/js-operator.h"
#include "src/types-inl.h"
#include "test/unittests/compiler/graph-unittest.h"
#include "test/unittests/compiler/node-test-utils.h"
#include "testing/gmock-support.h"
......
......@@ -17,11 +17,8 @@ class ExternalReference;
template <typename T>
class Handle;
class HeapObject;
template <class>
class TypeImpl;
class Type;
enum TypeofMode : int;
struct ZoneTypeConfig;
typedef TypeImpl<ZoneTypeConfig> Type;
namespace compiler {
......
......@@ -6,7 +6,7 @@
#include "src/compiler/operator.h"
#include "src/compiler/operator-properties.h"
#include "src/compiler/simplified-operator.h"
#include "src/types-inl.h"
#include "src/types.h"
#include "test/unittests/test-utils.h"
namespace v8 {
......
......@@ -49,7 +49,7 @@ class TyperTest : public TypedGraphTest {
}
}
Types<Type, Type*, Zone> types_;
Types types_;
JSOperatorBuilder javascript_;
BinaryOperationHints const hints_ = BinaryOperationHints::Any();
Node* context_node_;
......@@ -115,7 +115,7 @@ class TyperTest : public TypedGraphTest {
return result;
}
double RandomInt(Type::RangeType* range) {
double RandomInt(RangeType* range) {
return RandomInt(range->Min(), range->Max());
}
......@@ -149,12 +149,12 @@ class TyperTest : public TypedGraphTest {
void TestBinaryArithOp(const Operator* op, BinaryFunction opfun) {
TestBinaryArithOpCloseToZero(op, opfun, 8);
for (int i = 0; i < 100; ++i) {
Type::RangeType* r1 = RandomRange()->AsRange();
Type::RangeType* r2 = RandomRange()->AsRange();
Type* r1 = RandomRange();
Type* r2 = RandomRange();
Type* expected_type = TypeBinaryOp(op, r1, r2);
for (int i = 0; i < 10; i++) {
double x1 = RandomInt(r1);
double x2 = RandomInt(r2);
double x1 = RandomInt(r1->AsRange());
double x2 = RandomInt(r2->AsRange());
double result_value = opfun(x1, x2);
Type* result_type = Type::Constant(
isolate()->factory()->NewNumber(result_value), zone());
......@@ -166,12 +166,12 @@ class TyperTest : public TypedGraphTest {
template <class BinaryFunction>
void TestBinaryCompareOp(const Operator* op, BinaryFunction opfun) {
for (int i = 0; i < 100; ++i) {
Type::RangeType* r1 = RandomRange()->AsRange();
Type::RangeType* r2 = RandomRange()->AsRange();
Type* r1 = RandomRange();
Type* r2 = RandomRange();
Type* expected_type = TypeBinaryOp(op, r1, r2);
for (int i = 0; i < 10; i++) {
double x1 = RandomInt(r1);
double x2 = RandomInt(r2);
double x1 = RandomInt(r1->AsRange());
double x2 = RandomInt(r2->AsRange());
bool result_value = opfun(x1, x2);
Type* result_type =
Type::Constant(result_value ? isolate()->factory()->true_value()
......@@ -185,12 +185,12 @@ class TyperTest : public TypedGraphTest {
template <class BinaryFunction>
void TestBinaryBitOp(const Operator* op, BinaryFunction opfun) {
for (int i = 0; i < 100; ++i) {
Type::RangeType* r1 = RandomRange(true)->AsRange();
Type::RangeType* r2 = RandomRange(true)->AsRange();
Type* r1 = RandomRange(true);
Type* r2 = RandomRange(true);
Type* expected_type = TypeBinaryOp(op, r1, r2);
for (int i = 0; i < 10; i++) {
int32_t x1 = static_cast<int32_t>(RandomInt(r1));
int32_t x2 = static_cast<int32_t>(RandomInt(r2));
int32_t x1 = static_cast<int32_t>(RandomInt(r1->AsRange()));
int32_t x2 = static_cast<int32_t>(RandomInt(r2->AsRange()));
double result_value = opfun(x1, x2);
Type* result_type = Type::Constant(
isolate()->factory()->NewNumber(result_value), zone());
......
......@@ -1066,7 +1066,6 @@
'../../src/type-feedback-vector.h',
'../../src/type-info.cc',
'../../src/type-info.h',
'../../src/types-inl.h',
'../../src/types.cc',
'../../src/types.h',
'../../src/typing-asm.cc',
......
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