| Index: src/hydrogen-instructions.cc
|
| diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
|
| index aadf87572df411eb5d8c9c9aeb1ce8b985010aea..d47c6efc67d2ba8f3defc21776c6153d454cdde0 100644
|
| --- a/src/hydrogen-instructions.cc
|
| +++ b/src/hydrogen-instructions.cc
|
| @@ -2073,6 +2073,7 @@ HConstant::HConstant(Handle<Object> handle, Representation r)
|
| type_from_value_ = HType::TypeFromValue(handle_);
|
| is_internalized_string_ = handle_->IsInternalizedString();
|
| }
|
| +
|
| if (r.IsNone()) {
|
| if (has_int32_value_) {
|
| r = Representation::Integer32();
|
| @@ -2142,34 +2143,56 @@ void HConstant::Initialize(Representation r) {
|
| if (representation().IsInteger32()) {
|
| ClearGVNFlag(kDependsOnOsrEntries);
|
| }
|
| +
|
| + // TODO(mvstanton): pass isolate as a parameter
|
| + Isolate* isolate = Isolate::Current();
|
| + if (handle_.is_null()) {
|
| + guaranteed_in_old_space_ = true;
|
| + } else if (!isolate->optimizing_compiler_thread()->IsOptimizerThread()) {
|
| + ALLOW_HANDLE_DEREF(isolate, "using raw address");
|
| + guaranteed_in_old_space_ = !(isolate->heap()->InNewSpace(*handle_));
|
| + } else {
|
| + guaranteed_in_old_space_ = false;
|
| + }
|
| }
|
|
|
|
|
| HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const {
|
| if (r.IsInteger32() && !has_int32_value_) return NULL;
|
| if (r.IsDouble() && !has_double_value_) return NULL;
|
| - if (has_int32_value_) return new(zone) HConstant(int32_value_, r, handle_);
|
| - if (has_double_value_) return new(zone) HConstant(double_value_, r, handle_);
|
| - ASSERT(!handle_.is_null());
|
| - return new(zone) HConstant(handle_,
|
| - unique_id_,
|
| - r,
|
| - type_from_value_,
|
| - is_internalized_string_,
|
| - boolean_value_);
|
| + HConstant* result;
|
| + if (has_int32_value_) {
|
| + result = new(zone) HConstant(int32_value_, r, handle_);
|
| + } else if (has_double_value_) {
|
| + result = new(zone) HConstant(double_value_, r, handle_);
|
| + } else {
|
| + ASSERT(!handle_.is_null());
|
| + result = new(zone) HConstant(handle_,
|
| + unique_id_,
|
| + r,
|
| + type_from_value_,
|
| + is_internalized_string_,
|
| + boolean_value_);
|
| + }
|
| + result->set_guaranteed_in_old_space(guaranteed_in_old_space_);
|
| + return result;
|
| }
|
|
|
|
|
| HConstant* HConstant::CopyToTruncatedInt32(Zone* zone) const {
|
| + HConstant* result;
|
| if (has_int32_value_) {
|
| - return new(zone) HConstant(
|
| + result = new(zone) HConstant(
|
| int32_value_, Representation::Integer32(), handle_);
|
| - }
|
| - if (has_double_value_) {
|
| - return new(zone) HConstant(
|
| + } else if (has_double_value_) {
|
| + result = new(zone) HConstant(
|
| DoubleToInt32(double_value_), Representation::Integer32(), handle_);
|
| + } else {
|
| + return NULL;
|
| }
|
| - return NULL;
|
| +
|
| + result->set_guaranteed_in_old_space(guaranteed_in_old_space_);
|
| + return result;
|
| }
|
|
|
|
|
|
|