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

Side by Side Diff: src/hydrogen-instructions.cc

Issue 13977019: Fix HConstant::InNewSpace() for parallel compilation. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 2044 matching lines...) Expand 10 before | Expand all | Expand 10 after
2055 return BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(value); 2055 return BitCast<int64_t>(roundtrip_value) == BitCast<int64_t>(value);
2056 } 2056 }
2057 2057
2058 2058
2059 HConstant::HConstant(Handle<Object> handle, Representation r) 2059 HConstant::HConstant(Handle<Object> handle, Representation r)
2060 : handle_(handle), 2060 : handle_(handle),
2061 unique_id_(), 2061 unique_id_(),
2062 has_int32_value_(false), 2062 has_int32_value_(false),
2063 has_double_value_(false), 2063 has_double_value_(false),
2064 is_internalized_string_(false), 2064 is_internalized_string_(false),
2065 is_not_in_new_space_(true),
2065 boolean_value_(handle->BooleanValue()) { 2066 boolean_value_(handle->BooleanValue()) {
2067 if (handle_->IsHeapObject()) {
2068 Heap* heap = Handle<HeapObject>::cast(handle)->GetHeap();
2069 is_not_in_new_space_ = !heap->InNewSpace(*handle);
2070 }
2066 if (handle_->IsNumber()) { 2071 if (handle_->IsNumber()) {
2067 double n = handle_->Number(); 2072 double n = handle_->Number();
2068 has_int32_value_ = IsInteger32(n); 2073 has_int32_value_ = IsInteger32(n);
2069 int32_value_ = DoubleToInt32(n); 2074 int32_value_ = DoubleToInt32(n);
2070 double_value_ = n; 2075 double_value_ = n;
2071 has_double_value_ = true; 2076 has_double_value_ = true;
2072 } else { 2077 } else {
2073 type_from_value_ = HType::TypeFromValue(handle_); 2078 type_from_value_ = HType::TypeFromValue(handle_);
2074 is_internalized_string_ = handle_->IsInternalizedString(); 2079 is_internalized_string_ = handle_->IsInternalizedString();
2075 } 2080 }
2076 if (r.IsNone()) { 2081 if (r.IsNone()) {
2077 if (has_int32_value_) { 2082 if (has_int32_value_) {
2078 r = Representation::Integer32(); 2083 r = Representation::Integer32();
2079 } else if (has_double_value_) { 2084 } else if (has_double_value_) {
2080 r = Representation::Double(); 2085 r = Representation::Double();
2081 } else { 2086 } else {
2082 r = Representation::Tagged(); 2087 r = Representation::Tagged();
2083 } 2088 }
2084 } 2089 }
2085 Initialize(r); 2090 Initialize(r);
2086 } 2091 }
2087 2092
2088 2093
2089 HConstant::HConstant(Handle<Object> handle, 2094 HConstant::HConstant(Handle<Object> handle,
2090 UniqueValueId unique_id, 2095 UniqueValueId unique_id,
2091 Representation r, 2096 Representation r,
2092 HType type, 2097 HType type,
2093 bool is_internalize_string, 2098 bool is_internalize_string,
2099 bool is_not_in_new_space,
2094 bool boolean_value) 2100 bool boolean_value)
2095 : handle_(handle), 2101 : handle_(handle),
2096 unique_id_(unique_id), 2102 unique_id_(unique_id),
2097 has_int32_value_(false), 2103 has_int32_value_(false),
2098 has_double_value_(false), 2104 has_double_value_(false),
2099 is_internalized_string_(is_internalize_string), 2105 is_internalized_string_(is_internalize_string),
2106 is_not_in_new_space_(is_not_in_new_space),
2100 boolean_value_(boolean_value), 2107 boolean_value_(boolean_value),
2101 type_from_value_(type) { 2108 type_from_value_(type) {
2102 ASSERT(!handle.is_null()); 2109 ASSERT(!handle.is_null());
2103 ASSERT(!type.IsUninitialized()); 2110 ASSERT(!type.IsUninitialized());
2104 ASSERT(!type.IsTaggedNumber()); 2111 ASSERT(!type.IsTaggedNumber());
2105 Initialize(r); 2112 Initialize(r);
2106 } 2113 }
2107 2114
2108 2115
2109 HConstant::HConstant(int32_t integer_value, 2116 HConstant::HConstant(int32_t integer_value,
2110 Representation r, 2117 Representation r,
2118 bool is_not_in_new_space,
2111 Handle<Object> optional_handle) 2119 Handle<Object> optional_handle)
2112 : handle_(optional_handle), 2120 : handle_(optional_handle),
2113 unique_id_(), 2121 unique_id_(),
2114 has_int32_value_(true), 2122 has_int32_value_(true),
2115 has_double_value_(true), 2123 has_double_value_(true),
2116 is_internalized_string_(false), 2124 is_internalized_string_(false),
2125 is_not_in_new_space_(is_not_in_new_space),
2117 boolean_value_(integer_value != 0), 2126 boolean_value_(integer_value != 0),
2118 int32_value_(integer_value), 2127 int32_value_(integer_value),
2119 double_value_(FastI2D(integer_value)) { 2128 double_value_(FastI2D(integer_value)) {
2120 Initialize(r); 2129 Initialize(r);
2121 } 2130 }
2122 2131
2123 2132
2124 HConstant::HConstant(double double_value, 2133 HConstant::HConstant(double double_value,
2125 Representation r, 2134 Representation r,
2135 bool is_not_in_new_space,
2126 Handle<Object> optional_handle) 2136 Handle<Object> optional_handle)
2127 : handle_(optional_handle), 2137 : handle_(optional_handle),
2128 unique_id_(), 2138 unique_id_(),
2129 has_int32_value_(IsInteger32(double_value)), 2139 has_int32_value_(IsInteger32(double_value)),
2130 has_double_value_(true), 2140 has_double_value_(true),
2131 is_internalized_string_(false), 2141 is_internalized_string_(false),
2142 is_not_in_new_space_(is_not_in_new_space),
2132 boolean_value_(double_value != 0 && !std::isnan(double_value)), 2143 boolean_value_(double_value != 0 && !std::isnan(double_value)),
2133 int32_value_(DoubleToInt32(double_value)), 2144 int32_value_(DoubleToInt32(double_value)),
2134 double_value_(double_value) { 2145 double_value_(double_value) {
2135 Initialize(r); 2146 Initialize(r);
2136 } 2147 }
2137 2148
2138 2149
2139 void HConstant::Initialize(Representation r) { 2150 void HConstant::Initialize(Representation r) {
2140 set_representation(r); 2151 set_representation(r);
2141 SetFlag(kUseGVN); 2152 SetFlag(kUseGVN);
2142 if (representation().IsInteger32()) { 2153 if (representation().IsInteger32()) {
2143 ClearGVNFlag(kDependsOnOsrEntries); 2154 ClearGVNFlag(kDependsOnOsrEntries);
2144 } 2155 }
2145 } 2156 }
2146 2157
2147 2158
2148 HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const { 2159 HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const {
2149 if (r.IsInteger32() && !has_int32_value_) return NULL; 2160 if (r.IsInteger32() && !has_int32_value_) return NULL;
2150 if (r.IsDouble() && !has_double_value_) return NULL; 2161 if (r.IsDouble() && !has_double_value_) return NULL;
2151 if (has_int32_value_) return new(zone) HConstant(int32_value_, r, handle_); 2162 if (has_int32_value_) {
2152 if (has_double_value_) return new(zone) HConstant(double_value_, r, handle_); 2163 return new(zone) HConstant(int32_value_, r, is_not_in_new_space_, handle_);
2164 }
2165 if (has_double_value_) {
2166 return new(zone) HConstant(double_value_, r, is_not_in_new_space_, handle_);
2167 }
2153 ASSERT(!handle_.is_null()); 2168 ASSERT(!handle_.is_null());
2154 return new(zone) HConstant(handle_, 2169 return new(zone) HConstant(handle_,
2155 unique_id_, 2170 unique_id_,
2156 r, 2171 r,
2157 type_from_value_, 2172 type_from_value_,
2158 is_internalized_string_, 2173 is_internalized_string_,
2174 is_not_in_new_space_,
2159 boolean_value_); 2175 boolean_value_);
2160 } 2176 }
2161 2177
2162 2178
2163 HConstant* HConstant::CopyToTruncatedInt32(Zone* zone) const { 2179 HConstant* HConstant::CopyToTruncatedInt32(Zone* zone) const {
2164 if (has_int32_value_) { 2180 if (has_int32_value_) {
2165 return new(zone) HConstant( 2181 return new(zone) HConstant(int32_value_,
2166 int32_value_, Representation::Integer32(), handle_); 2182 Representation::Integer32(),
2183 is_not_in_new_space_,
2184 handle_);
2167 } 2185 }
2168 if (has_double_value_) { 2186 if (has_double_value_) {
2169 return new(zone) HConstant( 2187 return new(zone) HConstant(DoubleToInt32(double_value_),
2170 DoubleToInt32(double_value_), Representation::Integer32(), handle_); 2188 Representation::Integer32(),
2189 is_not_in_new_space_,
2190 handle_);
2171 } 2191 }
2172 return NULL; 2192 return NULL;
2173 } 2193 }
2174 2194
2175 2195
2176 void HConstant::PrintDataTo(StringStream* stream) { 2196 void HConstant::PrintDataTo(StringStream* stream) {
2177 if (has_int32_value_) { 2197 if (has_int32_value_) {
2178 stream->Add("%d ", int32_value_); 2198 stream->Add("%d ", int32_value_);
2179 } else if (has_double_value_) { 2199 } else if (has_double_value_) {
2180 stream->Add("%f ", FmtElm(double_value_)); 2200 stream->Add("%f ", FmtElm(double_value_));
(...skipping 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after
3627 3647
3628 3648
3629 void HCheckFunction::Verify() { 3649 void HCheckFunction::Verify() {
3630 HInstruction::Verify(); 3650 HInstruction::Verify();
3631 ASSERT(HasNoUses()); 3651 ASSERT(HasNoUses());
3632 } 3652 }
3633 3653
3634 #endif 3654 #endif
3635 3655
3636 } } // namespace v8::internal 3656 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698