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

Unified Diff: src/hydrogen-instructions.cc

Issue 19562003: Add support for IncrementCounter in Hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: And another try 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/ia32/lithium-codegen-ia32.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 3eca181c6fac57f9da076bb9f4e35a4bf5a53d0b..743bb091c5a97efbcf1662f41e52ade8e12e5cb4 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";
@@ -2644,6 +2645,7 @@ 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),
@@ -2679,15 +2681,16 @@ 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) {
+ : 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) {
ASSERT(!handle.is_null());
ASSERT(!type.IsTaggedNumber());
set_type(type);
@@ -2699,17 +2702,18 @@ 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),
- 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_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());
Initialize(r);
}
@@ -2719,22 +2723,38 @@ 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_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) {
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) {
@@ -2743,6 +2763,8 @@ 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();
}
@@ -2767,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_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_,
@@ -2825,6 +2851,9 @@ 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);
}
@@ -4505,6 +4534,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;
}
}
@@ -4531,6 +4564,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());
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-codegen-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698