High-level comment: I consider HType deprecated, to be replaced by a Type (or more likely a Bounds struct) being stored in every HValue. That makes most of this change temporary code, and I'm not sure adding more machinery (your custom
Type/HType intersection function) to support this transient state. Maybe we
should do the HType->Type transition first, before adding more inference logic
to the Hydrogen typing system.


https://codereview.chromium.org/19271008/diff/23001/src/hydrogen-instructions.cc
File src/hydrogen-instructions.cc (right):

https://codereview.chromium.org/19271008/diff/23001/src/hydrogen-instructions.cc#newcode466
src/hydrogen-instructions.cc:466: if (IsSmi())     return
handle(::v8::internal::Type::Smi(), isolate);
This is not a generic implementation of intersection. At the very least,
you should ASSERT(type->Is(Type::Smi())).

https://codereview.chromium.org/19271008/diff/23001/src/hydrogen-instructions.h
File src/hydrogen-instructions.h (right):

https://codereview.chromium.org/19271008/diff/23001/src/hydrogen-instructions.h#newcode367
src/hydrogen-instructions.h:367: Handle< ::v8::internal::Type>
intersect(
Wouldn't it be easier to rename HType::Type to HType::InternalTypeEnum
or whatever so you don't need the namespace-qualified name here?

https://codereview.chromium.org/19271008/diff/23001/src/hydrogen.cc
File src/hydrogen.cc (right):

https://codereview.chromium.org/19271008/diff/23001/src/hydrogen.cc#newcode7899
src/hydrogen.cc:7899: ? graph()->GetConstant1() :
graph()->GetConstant0();
nit: indentation

https://codereview.chromium.org/19271008/diff/23001/src/hydrogen.cc#newcode7941
src/hydrogen.cc:7941: left->KnownOptimalRepresentation() :
Representation::FromType(left_type);
nit: indentation. Also, prefer the '?' on the next line. Maybe:
  Representation left_rep = left->IsConstant()
      ? left->KnownOptimalRepresentation()
      : Representation::FromType(left_type);

https://codereview.chromium.org/19271008/diff/23001/src/hydrogen.cc#newcode7950
src/hydrogen.cc:7950: if (!left->type().IsString() ||
!right->type().IsString()) {
Why is this one atomic block rather than "if (!left is string) { add
check for left; }" and then the same for |right|?

https://codereview.chromium.org/19271008/diff/23001/src/types.h
File src/types.h (right):

https://codereview.chromium.org/19271008/diff/23001/src/types.h#newcode131
src/types.h:131: V(NonSmi,          kAny - kSmi)
          \
I'm not sure this is what you want. Type::Smi denotes a value that can
be stored as a Smi, i.e. a number in int31/int32 range (depending on
platform). It is therefore not the same as HType's "IsNonPrimitive() ||
IsJSObject()". I think I'd prefer an explicit union of Types instead
(likely just Receiver, Undefined).

https://codereview.chromium.org/19271008/

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to