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

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

Issue 16925008: Generate StoreGlobal stubs with Hydrogen (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Use pointer -> handle trampoline 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 unified diff | Download patch | Annotate | Revision Log
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 2156 matching lines...) Expand 10 before | Expand all | Expand 10 after
2167 2167
2168 2168
2169 HConstant::HConstant(Handle<Object> handle, Representation r) 2169 HConstant::HConstant(Handle<Object> handle, Representation r)
2170 : handle_(handle), 2170 : handle_(handle),
2171 unique_id_(), 2171 unique_id_(),
2172 has_smi_value_(false), 2172 has_smi_value_(false),
2173 has_int32_value_(false), 2173 has_int32_value_(false),
2174 has_double_value_(false), 2174 has_double_value_(false),
2175 is_internalized_string_(false), 2175 is_internalized_string_(false),
2176 is_not_in_new_space_(true), 2176 is_not_in_new_space_(true),
2177 is_cell_(false),
2177 boolean_value_(handle->BooleanValue()) { 2178 boolean_value_(handle->BooleanValue()) {
2178 if (handle_->IsHeapObject()) { 2179 if (handle_->IsHeapObject()) {
2179 Heap* heap = Handle<HeapObject>::cast(handle)->GetHeap(); 2180 Heap* heap = Handle<HeapObject>::cast(handle)->GetHeap();
2180 is_not_in_new_space_ = !heap->InNewSpace(*handle); 2181 is_not_in_new_space_ = !heap->InNewSpace(*handle);
2181 } 2182 }
2182 if (handle_->IsNumber()) { 2183 if (handle_->IsNumber()) {
2183 double n = handle_->Number(); 2184 double n = handle_->Number();
2184 has_int32_value_ = IsInteger32(n); 2185 has_int32_value_ = IsInteger32(n);
2185 int32_value_ = DoubleToInt32(n); 2186 int32_value_ = DoubleToInt32(n);
2186 has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_); 2187 has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_);
2187 double_value_ = n; 2188 double_value_ = n;
2188 has_double_value_ = true; 2189 has_double_value_ = true;
2189 } else { 2190 } else {
2190 type_from_value_ = HType::TypeFromValue(handle_); 2191 type_from_value_ = HType::TypeFromValue(handle_);
2191 is_internalized_string_ = handle_->IsInternalizedString(); 2192 is_internalized_string_ = handle_->IsInternalizedString();
2192 } 2193 }
2194
2195 is_cell_ = !handle_.is_null() &&
2196 (handle_->IsCell() || handle_->IsPropertyCell());
2193 Initialize(r); 2197 Initialize(r);
2194 } 2198 }
2195 2199
2196 2200
2197 HConstant::HConstant(Handle<Object> handle, 2201 HConstant::HConstant(Handle<Object> handle,
2198 UniqueValueId unique_id, 2202 UniqueValueId unique_id,
2199 Representation r, 2203 Representation r,
2200 HType type, 2204 HType type,
2201 bool is_internalize_string, 2205 bool is_internalize_string,
2202 bool is_not_in_new_space, 2206 bool is_not_in_new_space,
2207 bool is_cell,
2203 bool boolean_value) 2208 bool boolean_value)
2204 : handle_(handle), 2209 : handle_(handle),
2205 unique_id_(unique_id), 2210 unique_id_(unique_id),
2206 has_smi_value_(false), 2211 has_smi_value_(false),
2207 has_int32_value_(false), 2212 has_int32_value_(false),
2208 has_double_value_(false), 2213 has_double_value_(false),
2209 is_internalized_string_(is_internalize_string), 2214 is_internalized_string_(is_internalize_string),
2210 is_not_in_new_space_(is_not_in_new_space), 2215 is_not_in_new_space_(is_not_in_new_space),
2216 is_cell_(is_cell),
2211 boolean_value_(boolean_value), 2217 boolean_value_(boolean_value),
2212 type_from_value_(type) { 2218 type_from_value_(type) {
2213 ASSERT(!handle.is_null()); 2219 ASSERT(!handle.is_null());
2214 ASSERT(!type.IsUninitialized()); 2220 ASSERT(!type.IsUninitialized());
2215 ASSERT(!type.IsTaggedNumber()); 2221 ASSERT(!type.IsTaggedNumber());
2216 Initialize(r); 2222 Initialize(r);
2217 } 2223 }
2218 2224
2219 2225
2220 HConstant::HConstant(int32_t integer_value, 2226 HConstant::HConstant(int32_t integer_value,
2221 Representation r, 2227 Representation r,
2222 bool is_not_in_new_space, 2228 bool is_not_in_new_space,
2223 Handle<Object> optional_handle) 2229 Handle<Object> optional_handle)
2224 : handle_(optional_handle), 2230 : handle_(optional_handle),
2225 unique_id_(), 2231 unique_id_(),
2226 has_int32_value_(true), 2232 has_int32_value_(true),
2227 has_double_value_(true), 2233 has_double_value_(true),
2228 is_internalized_string_(false), 2234 is_internalized_string_(false),
2229 is_not_in_new_space_(is_not_in_new_space), 2235 is_not_in_new_space_(is_not_in_new_space),
2236 is_cell_(false),
2230 boolean_value_(integer_value != 0), 2237 boolean_value_(integer_value != 0),
2231 int32_value_(integer_value), 2238 int32_value_(integer_value),
2232 double_value_(FastI2D(integer_value)) { 2239 double_value_(FastI2D(integer_value)) {
2233 has_smi_value_ = Smi::IsValid(int32_value_); 2240 has_smi_value_ = Smi::IsValid(int32_value_);
2234 Initialize(r); 2241 Initialize(r);
2235 } 2242 }
2236 2243
2237 2244
2238 HConstant::HConstant(double double_value, 2245 HConstant::HConstant(double double_value,
2239 Representation r, 2246 Representation r,
2240 bool is_not_in_new_space, 2247 bool is_not_in_new_space,
2241 Handle<Object> optional_handle) 2248 Handle<Object> optional_handle)
2242 : handle_(optional_handle), 2249 : handle_(optional_handle),
2243 unique_id_(), 2250 unique_id_(),
2244 has_int32_value_(IsInteger32(double_value)), 2251 has_int32_value_(IsInteger32(double_value)),
2245 has_double_value_(true), 2252 has_double_value_(true),
2246 is_internalized_string_(false), 2253 is_internalized_string_(false),
2247 is_not_in_new_space_(is_not_in_new_space), 2254 is_not_in_new_space_(is_not_in_new_space),
2255 is_cell_(false),
2248 boolean_value_(double_value != 0 && !std::isnan(double_value)), 2256 boolean_value_(double_value != 0 && !std::isnan(double_value)),
2249 int32_value_(DoubleToInt32(double_value)), 2257 int32_value_(DoubleToInt32(double_value)),
2250 double_value_(double_value) { 2258 double_value_(double_value) {
2251 has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_); 2259 has_smi_value_ = has_int32_value_ && Smi::IsValid(int32_value_);
2252 Initialize(r); 2260 Initialize(r);
2253 } 2261 }
2254 2262
2255 2263
2256 void HConstant::Initialize(Representation r) { 2264 void HConstant::Initialize(Representation r) {
2257 if (r.IsNone()) { 2265 if (r.IsNone()) {
2258 if (has_smi_value_) { 2266 if (has_smi_value_) {
2259 r = Representation::Smi(); 2267 r = Representation::Smi();
2260 } else if (has_int32_value_) { 2268 } else if (has_int32_value_) {
2261 r = Representation::Integer32(); 2269 r = Representation::Integer32();
2262 } else if (has_double_value_) { 2270 } else if (has_double_value_) {
2263 r = Representation::Double(); 2271 r = Representation::Double();
2264 } else { 2272 } else {
2265 r = Representation::Tagged(); 2273 r = Representation::Tagged();
2266 } 2274 }
2267 } 2275 }
2268 set_representation(r); 2276 set_representation(r);
2269 SetFlag(kUseGVN); 2277 SetFlag(kUseGVN);
2270 if (representation().IsInteger32()) {
2271 ClearGVNFlag(kDependsOnOsrEntries);
2272 }
2273 } 2278 }
2274 2279
2275 2280
2281 bool HConstant::EmitAtUses() {
2282 ASSERT(IsLinked());
2283 if (block()->graph()->has_osr_loop_entry()) {
2284 return block()->graph()->IsStandardConstant(this);
2285 }
2286 if (IsCell()) return false;
2287 if (representation().IsDouble()) return false;
2288 return true;
2289 }
2290
2291
2276 HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const { 2292 HConstant* HConstant::CopyToRepresentation(Representation r, Zone* zone) const {
2277 if (r.IsSmi() && !has_smi_value_) return NULL; 2293 if (r.IsSmi() && !has_smi_value_) return NULL;
2278 if (r.IsInteger32() && !has_int32_value_) return NULL; 2294 if (r.IsInteger32() && !has_int32_value_) return NULL;
2279 if (r.IsDouble() && !has_double_value_) return NULL; 2295 if (r.IsDouble() && !has_double_value_) return NULL;
2280 if (has_int32_value_) { 2296 if (has_int32_value_) {
2281 return new(zone) HConstant(int32_value_, r, is_not_in_new_space_, handle_); 2297 return new(zone) HConstant(int32_value_, r, is_not_in_new_space_, handle_);
2282 } 2298 }
2283 if (has_double_value_) { 2299 if (has_double_value_) {
2284 return new(zone) HConstant(double_value_, r, is_not_in_new_space_, handle_); 2300 return new(zone) HConstant(double_value_, r, is_not_in_new_space_, handle_);
2285 } 2301 }
2286 ASSERT(!handle_.is_null()); 2302 ASSERT(!handle_.is_null());
2287 return new(zone) HConstant(handle_, 2303 return new(zone) HConstant(handle_,
2288 unique_id_, 2304 unique_id_,
2289 r, 2305 r,
2290 type_from_value_, 2306 type_from_value_,
2291 is_internalized_string_, 2307 is_internalized_string_,
2292 is_not_in_new_space_, 2308 is_not_in_new_space_,
2309 is_cell_,
2293 boolean_value_); 2310 boolean_value_);
2294 } 2311 }
2295 2312
2296 2313
2297 HConstant* HConstant::CopyToTruncatedInt32(Zone* zone) const { 2314 HConstant* HConstant::CopyToTruncatedInt32(Zone* zone) const {
2298 if (has_int32_value_) { 2315 if (has_int32_value_) {
2299 return new(zone) HConstant(int32_value_, 2316 return new(zone) HConstant(int32_value_,
2300 Representation::Integer32(), 2317 Representation::Integer32(),
2301 is_not_in_new_space_, 2318 is_not_in_new_space_,
2302 handle_); 2319 handle_);
(...skipping 1519 matching lines...) Expand 10 before | Expand all | Expand 10 after
3822 int offset = (index * kPointerSize) + map->instance_size(); 3839 int offset = (index * kPointerSize) + map->instance_size();
3823 return HObjectAccess(kInobject, offset); 3840 return HObjectAccess(kInobject, offset);
3824 } else { 3841 } else {
3825 // Non-negative property indices are in the properties array. 3842 // Non-negative property indices are in the properties array.
3826 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; 3843 int offset = (index * kPointerSize) + FixedArray::kHeaderSize;
3827 return HObjectAccess(kBackingStore, offset, name); 3844 return HObjectAccess(kBackingStore, offset, name);
3828 } 3845 }
3829 } 3846 }
3830 3847
3831 3848
3849 HObjectAccess HObjectAccess::ForCellPayload(Isolate* isolate) {
3850 return HObjectAccess(
3851 kInobject, Cell::kValueOffset,
3852 Handle<String>(isolate->heap()->cell_value_string()));
3853 }
3854
3855
3832 void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) { 3856 void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) {
3833 // set the appropriate GVN flags for a given load or store instruction 3857 // set the appropriate GVN flags for a given load or store instruction
3834 if (is_store) { 3858 if (is_store) {
3835 // track dominating allocations in order to eliminate write barriers 3859 // track dominating allocations in order to eliminate write barriers
3836 instr->SetGVNFlag(kDependsOnNewSpacePromotion); 3860 instr->SetGVNFlag(kDependsOnNewSpacePromotion);
3837 instr->SetFlag(HValue::kTrackSideEffectDominators); 3861 instr->SetFlag(HValue::kTrackSideEffectDominators);
3838 } else { 3862 } else {
3839 // try to GVN loads, but don't hoist above map changes 3863 // try to GVN loads, but don't hoist above map changes
3840 instr->SetFlag(HValue::kUseGVN); 3864 instr->SetFlag(HValue::kUseGVN);
3841 instr->SetGVNFlag(kDependsOnMaps); 3865 instr->SetGVNFlag(kDependsOnMaps);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
3891 case kBackingStore: 3915 case kBackingStore:
3892 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 3916 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
3893 stream->Add("[backing-store]"); 3917 stream->Add("[backing-store]");
3894 break; 3918 break;
3895 } 3919 }
3896 3920
3897 stream->Add("@%d", offset()); 3921 stream->Add("@%d", offset());
3898 } 3922 }
3899 3923
3900 } } // namespace v8::internal 3924 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/code-stubs-ia32.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698