Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index 5fe3af1f5bd3e31e137bb73897ee5cba12ff4605..e236cf6da011dc9c80e4aafc2990cb9a51e73aa9 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -448,6 +448,7 @@ 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"; |
@@ -2647,6 +2648,7 @@ HConstant::HConstant(Handle<Object> handle, Representation r) |
has_smi_value_(false), |
has_int32_value_(false), |
has_double_value_(false), |
+ has_external_value_(false), |
is_internalized_string_(false), |
is_not_in_new_space_(true), |
is_cell_(false), |
@@ -2681,16 +2683,17 @@ 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), |
- 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) { |
+ : handle_(handle), |
+ unique_id_(unique_id), |
+ has_smi_value_(false), |
+ has_int32_value_(false), |
+ has_double_value_(false), |
+ has_external_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()); |
@@ -2702,16 +2705,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_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)) { |
+ : handle_(optional_handle), |
+ unique_id_(), |
+ has_int32_value_(true), |
+ has_double_value_(true), |
+ has_external_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)) { |
has_smi_value_ = Smi::IsValid(int32_value_); |
Initialize(r); |
} |
@@ -2721,21 +2725,36 @@ 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), |
- 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), |
+ has_external_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) { |
has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_); |
Initialize(r); |
} |
+HConstant::HConstant(ExternalReference reference, Representation r) |
+ : has_smi_value_(false), |
+ has_int32_value_(false), |
+ has_double_value_(false), |
+ has_external_value_(true), |
+ is_internalized_string_(false), |
+ is_not_in_new_space_(true), |
+ is_cell_(false), |
+ boolean_value_(true), |
+ external_value_(reference) { |
+ Initialize(r); |
+} |
+ |
+ |
void HConstant::Initialize(Representation r) { |
if (r.IsNone()) { |
if (has_smi_value_ && kSmiValueSize == 31) { |
@@ -2744,6 +2763,8 @@ void HConstant::Initialize(Representation r) { |
r = Representation::Integer32(); |
} else if (has_double_value_) { |
r = Representation::Double(); |
+ } else if (has_external_value_) { |
+ r = Representation::External(); |
} else { |
r = Representation::Tagged(); |
} |
@@ -2768,12 +2789,16 @@ 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_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_value_) { |
+ return new(zone) HConstant(external_value_, r); |
+ } |
ASSERT(!handle_.is_null()); |
return new(zone) HConstant(handle_, |
unique_id_, |
@@ -2826,6 +2851,8 @@ 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_value_) { |
+ stream->Add("%p ", reinterpret_cast<void*>(external_value_.address())); |
} else { |
handle()->ShortPrint(stream); |
} |
@@ -3667,6 +3694,7 @@ HType HConstant::CalculateInferredType() { |
return Smi::IsValid(int32_value_) ? HType::Smi() : HType::HeapNumber(); |
} |
if (has_double_value_) return HType::HeapNumber(); |
+ if (has_external_value_) return HType::None(); |
danno
2013/07/25 18:35:57
You should also look in HLoadExternalArrayPointer
Benedikt Meurer
2013/07/25 21:09:11
Why? It's an external pointer, shouldn't it have R
danno
2013/07/25 22:22:05
HLoadExternalArrayPointer already does return Repr
|
ASSERT(!type_from_value_.IsUninitialized()); |
return type_from_value_; |
} |
@@ -4520,6 +4548,10 @@ void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) { |
instr->SetGVNFlag(is_store |
? kChangesMaps : kDependsOnMaps); |
break; |
+ case kExternalMemory: |
+ instr->SetGVNFlag(is_store |
+ ? kChangesExternalMemory : kDependsOnExternalMemory); |
+ break; |
} |
} |
@@ -4546,6 +4578,9 @@ 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()); |