Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Unified Diff: src/hydrogen-instructions.h

Issue 21072002: Eagerly set the types of many kinds of hydrogen instructions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index 1015b6e6833fc79849a11b06783041f92649816c..5738d894fe357cedcceabbc83bc726e588cae9ca 100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -2555,6 +2555,7 @@ class HBitNot: public HUnaryOperation {
SetFlag(kUseGVN);
SetFlag(kTruncatingToInt32);
SetFlag(kAllowUndefinedAsNaN);
+ set_type(HType::TaggedNumber());
}
virtual Representation RequiredInputRepresentation(int index) {
@@ -2563,7 +2564,6 @@ class HBitNot: public HUnaryOperation {
virtual Representation observed_input_representation(int index) {
return Representation::Integer32();
}
- virtual HType CalculateInferredType();
virtual HValue* Canonicalize();
@@ -2589,8 +2589,6 @@ class HUnaryMathOperation: public HTemplateInstruction<2> {
virtual void PrintDataTo(StringStream* stream);
- virtual HType CalculateInferredType();
-
virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
virtual Representation RequiredInputRepresentation(int index) {
@@ -2669,6 +2667,7 @@ class HUnaryMathOperation: public HTemplateInstruction<2> {
}
SetFlag(kUseGVN);
SetFlag(kAllowUndefinedAsNaN);
+ set_type(HType::TaggedNumber());
}
virtual bool IsDeletable() const { return true; }
@@ -2729,7 +2728,6 @@ class HCheckMaps: public HTemplateInstruction<2> {
virtual void HandleSideEffectDominator(GVNFlag side_effect,
HValue* dominator);
virtual void PrintDataTo(StringStream* stream);
- virtual HType CalculateInferredType();
HValue* value() { return OperandAt(0); }
SmallMapList* map_set() { return &map_set_; }
@@ -2767,6 +2765,7 @@ class HCheckMaps: public HTemplateInstruction<2> {
SetFlag(kTrackSideEffectDominators);
SetGVNFlag(kDependsOnMaps);
SetGVNFlag(kDependsOnElementsKind);
+ set_type(value->type());
}
void omit(CompilationInfo* info) {
@@ -2791,13 +2790,13 @@ class HCheckFunction: public HUnaryOperation {
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
target_in_new_space_ = Isolate::Current()->heap()->InNewSpace(*function);
+ set_type(value->type());
}
virtual Representation RequiredInputRepresentation(int index) {
return Representation::Tagged();
}
virtual void PrintDataTo(StringStream* stream);
- virtual HType CalculateInferredType();
virtual HValue* Canonicalize();
@@ -2892,14 +2891,13 @@ class HCheckSmi: public HUnaryOperation {
explicit HCheckSmi(HValue* value) : HUnaryOperation(value) {
set_representation(Representation::Smi());
SetFlag(kUseGVN);
+ set_type(HType::Smi());
}
virtual Representation RequiredInputRepresentation(int index) {
return Representation::Tagged();
}
- virtual HType CalculateInferredType();
-
virtual HValue* Canonicalize() {
HType value_type = value()->type();
if (value_type.IsSmi()) {
@@ -2935,14 +2933,13 @@ class HCheckHeapObject: public HUnaryOperation {
explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) {
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
+ set_type(HType::NonPrimitive());
}
virtual Representation RequiredInputRepresentation(int index) {
return Representation::Tagged();
}
- virtual HType CalculateInferredType();
-
#ifdef DEBUG
virtual void Verify();
#endif
@@ -4063,8 +4060,6 @@ class HBitwiseBinaryOperation: public HBinaryOperation {
HBinaryOperation::initialize_output_representation(observed);
}
- virtual HType CalculateInferredType();
-
DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation)
private:
@@ -4108,6 +4103,7 @@ class HArithmeticBinaryOperation: public HBinaryOperation {
SetAllSideEffects();
SetFlag(kFlexibleRepresentation);
SetFlag(kAllowUndefinedAsNaN);
+ set_type(HType::TaggedNumber());
}
virtual void RepresentationChanged(Representation to) {
@@ -4120,8 +4116,6 @@ class HArithmeticBinaryOperation: public HBinaryOperation {
}
}
- virtual HType CalculateInferredType();
-
DECLARE_ABSTRACT_INSTRUCTION(ArithmeticBinaryOperation)
private:
@@ -4138,6 +4132,7 @@ class HCompareGeneric: public HBinaryOperation {
: HBinaryOperation(context, left, right), token_(token) {
ASSERT(Token::IsCompareOp(token));
set_representation(Representation::Tagged());
+ set_type(HType::Boolean());
SetAllSideEffects();
}
@@ -4150,8 +4145,6 @@ class HCompareGeneric: public HBinaryOperation {
Token::Value token() const { return token_; }
virtual void PrintDataTo(StringStream* stream);
- virtual HType CalculateInferredType();
-
DECLARE_CONCRETE_INSTRUCTION(CompareGeneric)
private:
@@ -4429,6 +4422,7 @@ class HInstanceOf: public HBinaryOperation {
HInstanceOf(HValue* context, HValue* left, HValue* right)
: HBinaryOperation(context, left, right) {
set_representation(Representation::Tagged());
+ set_type(HType::Boolean());
SetAllSideEffects();
}
@@ -4436,8 +4430,6 @@ class HInstanceOf: public HBinaryOperation {
return Representation::Tagged();
}
- virtual HType CalculateInferredType();
-
virtual void PrintDataTo(StringStream* stream);
DECLARE_CONCRETE_INSTRUCTION(InstanceOf)
@@ -4452,6 +4444,7 @@ class HInstanceOfKnownGlobal: public HTemplateInstruction<2> {
: function_(right) {
SetOperandAt(0, context);
SetOperandAt(1, left);
+ set_type(HType::Boolean());
set_representation(Representation::Tagged());
SetAllSideEffects();
}
@@ -4464,8 +4457,6 @@ class HInstanceOfKnownGlobal: public HTemplateInstruction<2> {
return Representation::Tagged();
}
- virtual HType CalculateInferredType();
-
DECLARE_CONCRETE_INSTRUCTION(InstanceOfKnownGlobal)
private:
@@ -4564,8 +4555,6 @@ class HAdd: public HArithmeticBinaryOperation {
virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
- virtual HType CalculateInferredType();
-
virtual HValue* Canonicalize();
virtual bool TryDecompose(DecompositionResult* decomposition) {
@@ -4879,6 +4868,7 @@ class HBitwise: public HBitwiseBinaryOperation {
HConstant::cast(right)->Integer32Value() < 0))) {
SetFlag(kTruncatingToSmi);
}
+ set_type(HType::TaggedNumber());
}
Token::Value op_;
@@ -6465,10 +6455,6 @@ class HStringAdd: public HBinaryOperation {
return Representation::Tagged();
}
- virtual HType CalculateInferredType() {
- return HType::String();
- }
-
DECLARE_CONCRETE_INSTRUCTION(StringAdd)
protected:
@@ -6481,6 +6467,7 @@ class HStringAdd: public HBinaryOperation {
SetFlag(kUseGVN);
SetGVNFlag(kDependsOnMaps);
SetGVNFlag(kChangesNewSpacePromotion);
+ set_type(HType::String());
}
// No side-effects except possible allocation.
@@ -6540,7 +6527,6 @@ class HStringCharFromCode: public HTemplateInstruction<2> {
? Representation::Tagged()
: Representation::Integer32();
}
- virtual HType CalculateInferredType() { return HType::String(); }
HValue* context() const { return OperandAt(0); }
HValue* value() const { return OperandAt(1); }
@@ -6556,6 +6542,7 @@ class HStringCharFromCode: public HTemplateInstruction<2> {
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
SetGVNFlag(kChangesNewSpacePromotion);
+ set_type(HType::String());
}
virtual bool IsDeletable() const {
@@ -6572,11 +6559,6 @@ class HStringLength: public HUnaryOperation {
return Representation::Tagged();
}
- virtual HType CalculateInferredType() {
- STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
- return HType::Smi();
- }
-
DECLARE_CONCRETE_INSTRUCTION(StringLength)
protected:
@@ -6588,9 +6570,11 @@ class HStringLength: public HUnaryOperation {
private:
explicit HStringLength(HValue* string) : HUnaryOperation(string) {
+ STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue);
set_representation(Representation::Tagged());
SetFlag(kUseGVN);
SetGVNFlag(kDependsOnMaps);
+ set_type(HType::Smi());
}
virtual bool IsDeletable() const { return true; }
@@ -6639,6 +6623,7 @@ class HRegExpLiteral: public HMaterializedLiteral<1> {
flags_(flags) {
SetOperandAt(0, context);
SetAllSideEffects();
+ set_type(HType::JSObject());
}
HValue* context() { return OperandAt(0); }
@@ -6649,7 +6634,6 @@ class HRegExpLiteral: public HMaterializedLiteral<1> {
virtual Representation RequiredInputRepresentation(int index) {
return Representation::Tagged();
}
- virtual HType CalculateInferredType();
DECLARE_CONCRETE_INSTRUCTION(RegExpLiteral)
@@ -6671,6 +6655,7 @@ class HFunctionLiteral: public HTemplateInstruction<1> {
is_generator_(shared->is_generator()),
language_mode_(shared->language_mode()) {
SetOperandAt(0, context);
+ set_type(HType::JSObject());
set_representation(Representation::Tagged());
SetGVNFlag(kChangesNewSpacePromotion);
}
@@ -6680,7 +6665,6 @@ class HFunctionLiteral: public HTemplateInstruction<1> {
virtual Representation RequiredInputRepresentation(int index) {
return Representation::Tagged();
}
- virtual HType CalculateInferredType();
DECLARE_CONCRETE_INSTRUCTION(FunctionLiteral)
« no previous file with comments | « no previous file | src/hydrogen-instructions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698