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

Unified Diff: src/hydrogen-instructions.cc

Issue 21173004: Version 3.20.11.1 (Closed) Base URL: https://v8.googlecode.com/svn/trunk
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 | « src/hydrogen-instructions.h ('k') | src/hydrogen-mark-deoptimize.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index 54b53db5940d723ba0ccd58f2293688b553824c5..5fe3af1f5bd3e31e137bb73897ee5cba12ff4605 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -448,7 +448,6 @@ const char* HType::ToString() {
// Note: The c1visualizer syntax for locals allows only a sequence of the
// following characters: A-Za-z0-9_-|:
switch (type_) {
- case kNone: return "none";
case kTagged: return "tagged";
case kTaggedPrimitive: return "primitive";
case kTaggedNumber: return "number";
@@ -459,6 +458,7 @@ const char* HType::ToString() {
case kNonPrimitive: return "non-primitive";
case kJSArray: return "array";
case kJSObject: return "object";
+ case kUninitialized: return "uninitialized";
}
UNREACHABLE();
return "unreachable";
@@ -1632,7 +1632,9 @@ HValue* HUnaryMathOperation::Canonicalize() {
HValue* HCheckInstanceType::Canonicalize() {
- if (check_ == IS_STRING && value()->type().IsString()) {
+ if (check_ == IS_STRING &&
+ !value()->type().IsUninitialized() &&
+ value()->type().IsString()) {
return NULL;
}
@@ -2645,13 +2647,10 @@ HConstant::HConstant(Handle<Object> handle, Representation r)
has_smi_value_(false),
has_int32_value_(false),
has_double_value_(false),
- has_external_reference_value_(false),
is_internalized_string_(false),
is_not_in_new_space_(true),
is_cell_(false),
boolean_value_(handle->BooleanValue()) {
- set_type(HType::TypeFromValue(handle));
-
if (handle_->IsHeapObject()) {
Heap* heap = Handle<HeapObject>::cast(handle)->GetHeap();
is_not_in_new_space_ = !heap->InNewSpace(*handle);
@@ -2664,6 +2663,7 @@ HConstant::HConstant(Handle<Object> handle, Representation r)
double_value_ = n;
has_double_value_ = true;
} else {
+ type_from_value_ = HType::TypeFromValue(handle_);
is_internalized_string_ = handle_->IsInternalizedString();
}
@@ -2681,19 +2681,19 @@ HConstant::HConstant(Handle<Object> handle,
bool is_not_in_new_space,
bool is_cell,
bool boolean_value)
- : handle_(handle),
- unique_id_(unique_id),
- has_smi_value_(false),
- has_int32_value_(false),
- has_double_value_(false),
- has_external_reference_value_(false),
- is_internalized_string_(is_internalize_string),
- is_not_in_new_space_(is_not_in_new_space),
- is_cell_(is_cell),
- boolean_value_(boolean_value) {
+ : handle_(handle),
+ unique_id_(unique_id),
+ has_smi_value_(false),
+ has_int32_value_(false),
+ has_double_value_(false),
+ is_internalized_string_(is_internalize_string),
+ is_not_in_new_space_(is_not_in_new_space),
+ is_cell_(is_cell),
+ boolean_value_(boolean_value),
+ type_from_value_(type) {
ASSERT(!handle.is_null());
+ ASSERT(!type.IsUninitialized());
ASSERT(!type.IsTaggedNumber());
- set_type(type);
Initialize(r);
}
@@ -2702,19 +2702,17 @@ HConstant::HConstant(int32_t integer_value,
Representation r,
bool is_not_in_new_space,
Handle<Object> optional_handle)
- : handle_(optional_handle),
- unique_id_(),
- has_smi_value_(Smi::IsValid(integer_value)),
- has_int32_value_(true),
- has_double_value_(true),
- has_external_reference_value_(false),
- is_internalized_string_(false),
- is_not_in_new_space_(is_not_in_new_space),
- is_cell_(false),
- boolean_value_(integer_value != 0),
- int32_value_(integer_value),
- double_value_(FastI2D(integer_value)) {
- set_type(has_smi_value_ ? HType::Smi() : HType::TaggedNumber());
+ : handle_(optional_handle),
+ unique_id_(),
+ has_int32_value_(true),
+ has_double_value_(true),
+ is_internalized_string_(false),
+ is_not_in_new_space_(is_not_in_new_space),
+ is_cell_(false),
+ boolean_value_(integer_value != 0),
+ int32_value_(integer_value),
+ double_value_(FastI2D(integer_value)) {
+ has_smi_value_ = Smi::IsValid(int32_value_);
Initialize(r);
}
@@ -2723,38 +2721,21 @@ HConstant::HConstant(double double_value,
Representation r,
bool is_not_in_new_space,
Handle<Object> optional_handle)
- : handle_(optional_handle),
- unique_id_(),
- has_int32_value_(IsInteger32(double_value)),
- has_double_value_(true),
- has_external_reference_value_(false),
- is_internalized_string_(false),
- is_not_in_new_space_(is_not_in_new_space),
- is_cell_(false),
- boolean_value_(double_value != 0 && !std::isnan(double_value)),
- int32_value_(DoubleToInt32(double_value)),
- double_value_(double_value) {
+ : handle_(optional_handle),
+ unique_id_(),
+ has_int32_value_(IsInteger32(double_value)),
+ has_double_value_(true),
+ is_internalized_string_(false),
+ is_not_in_new_space_(is_not_in_new_space),
+ is_cell_(false),
+ boolean_value_(double_value != 0 && !std::isnan(double_value)),
+ int32_value_(DoubleToInt32(double_value)),
+ double_value_(double_value) {
has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_);
- set_type(has_smi_value_ ? HType::Smi() : HType::TaggedNumber());
Initialize(r);
}
-HConstant::HConstant(ExternalReference reference)
- : has_smi_value_(false),
- has_int32_value_(false),
- has_double_value_(false),
- has_external_reference_value_(true),
- is_internalized_string_(false),
- is_not_in_new_space_(true),
- is_cell_(false),
- boolean_value_(true),
- external_reference_value_(reference) {
- set_type(HType::None());
- Initialize(Representation::External());
-}
-
-
void HConstant::Initialize(Representation r) {
if (r.IsNone()) {
if (has_smi_value_ && kSmiValueSize == 31) {
@@ -2763,8 +2744,6 @@ void HConstant::Initialize(Representation r) {
r = Representation::Integer32();
} else if (has_double_value_) {
r = Representation::Double();
- } else if (has_external_reference_value_) {
- r = Representation::External();
} else {
r = Representation::Tagged();
}
@@ -2789,21 +2768,17 @@ HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const {
if (r.IsSmi() && !has_smi_value_) return NULL;
if (r.IsInteger32() && !has_int32_value_) return NULL;
if (r.IsDouble() && !has_double_value_) return NULL;
- if (r.IsExternal() && !has_external_reference_value_) return NULL;
if (has_int32_value_) {
return new(zone) HConstant(int32_value_, r, is_not_in_new_space_, handle_);
}
if (has_double_value_) {
return new(zone) HConstant(double_value_, r, is_not_in_new_space_, handle_);
}
- if (has_external_reference_value_) {
- return new(zone) HConstant(external_reference_value_);
- }
ASSERT(!handle_.is_null());
return new(zone) HConstant(handle_,
unique_id_,
r,
- type_,
+ type_from_value_,
is_internalized_string_,
is_not_in_new_space_,
is_cell_,
@@ -2851,9 +2826,6 @@ void HConstant::PrintDataTo(StringStream* stream) {
stream->Add("%d ", int32_value_);
} else if (has_double_value_) {
stream->Add("%f ", FmtElm(double_value_));
- } else if (has_external_reference_value_) {
- stream->Add("%p ", reinterpret_cast<void*>(
- external_reference_value_.address()));
} else {
handle()->ShortPrint(stream);
}
@@ -3681,9 +3653,8 @@ HType HCheckSmi::CalculateInferredType() {
HType HPhi::CalculateInferredType() {
- if (OperandCount() == 0) return HType::Tagged();
- HType result = OperandAt(0)->type();
- for (int i = 1; i < OperandCount(); ++i) {
+ HType result = HType::Uninitialized();
+ for (int i = 0; i < OperandCount(); ++i) {
HType current = OperandAt(i)->type();
result = result.Combine(current);
}
@@ -3691,6 +3662,16 @@ HType HPhi::CalculateInferredType() {
}
+HType HConstant::CalculateInferredType() {
+ if (has_int32_value_) {
+ return Smi::IsValid(int32_value_) ? HType::Smi() : HType::HeapNumber();
+ }
+ if (has_double_value_) return HType::HeapNumber();
+ ASSERT(!type_from_value_.IsUninitialized());
+ return type_from_value_;
+}
+
+
HType HCompareGeneric::CalculateInferredType() {
return HType::Boolean();
}
@@ -3747,6 +3728,11 @@ Representation HUnaryMathOperation::RepresentationFromInputs() {
}
+HType HStringCharFromCode::CalculateInferredType() {
+ return HType::String();
+}
+
+
void HAllocate::HandleSideEffectDominator(GVNFlag side_effect,
HValue* dominator) {
ASSERT(side_effect == kChangesNewSpacePromotion);
@@ -4375,11 +4361,7 @@ bool HValue::HasNonSmiUse() {
// We check for observed_input_representation elsewhere.
Representation use_rep =
it.value()->RequiredInputRepresentation(it.index());
- if (!use_rep.IsNone() &&
- !use_rep.IsSmi() &&
- !use_rep.IsTagged()) {
- return true;
- }
+ if (!use_rep.IsNone() && !use_rep.IsSmi()) return true;
}
return false;
}
@@ -4538,10 +4520,6 @@ void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) {
instr->SetGVNFlag(is_store
? kChangesMaps : kDependsOnMaps);
break;
- case kExternalMemory:
- instr->SetGVNFlag(is_store
- ? kChangesExternalMemory : kDependsOnExternalMemory);
- break;
}
}
@@ -4568,9 +4546,6 @@ void HObjectAccess::PrintTo(StringStream* stream) {
if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
stream->Add("[backing-store]");
break;
- case kExternalMemory:
- stream->Add("[external-memory]");
- break;
}
stream->Add("@%d", offset());
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/hydrogen-mark-deoptimize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698