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

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

Issue 149063010: Remake of the load elimination fix made earlier (r18884). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review notes applied Created 6 years, 10 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 3565 matching lines...) Expand 10 before | Expand all | Expand 10 after
3576 HInnerAllocatedObject::New(zone, context(), dominating_allocate_, 3576 HInnerAllocatedObject::New(zone, context(), dominating_allocate_,
3577 dominating_allocate_->size(), type()); 3577 dominating_allocate_->size(), type());
3578 free_space_instr->InsertBefore(this); 3578 free_space_instr->InsertBefore(this);
3579 HConstant* filler_map = HConstant::New( 3579 HConstant* filler_map = HConstant::New(
3580 zone, 3580 zone,
3581 context(), 3581 context(),
3582 isolate()->factory()->free_space_map()); 3582 isolate()->factory()->free_space_map());
3583 filler_map->FinalizeUniqueness(); // TODO(titzer): should be init'd a'ready 3583 filler_map->FinalizeUniqueness(); // TODO(titzer): should be init'd a'ready
3584 filler_map->InsertAfter(free_space_instr); 3584 filler_map->InsertAfter(free_space_instr);
3585 HInstruction* store_map = HStoreNamedField::New(zone, context(), 3585 HInstruction* store_map = HStoreNamedField::New(zone, context(),
3586 free_space_instr, HObjectAccess::ForMap(), filler_map, 3586 free_space_instr, HObjectAccess::ForMap(), filler_map);
3587 INITIALIZING_STORE);
3588 store_map->SetFlag(HValue::kHasNoObservableSideEffects); 3587 store_map->SetFlag(HValue::kHasNoObservableSideEffects);
3589 store_map->InsertAfter(filler_map); 3588 store_map->InsertAfter(filler_map);
3590 3589
3591 // We must explicitly force Smi representation here because on x64 we 3590 // We must explicitly force Smi representation here because on x64 we
3592 // would otherwise automatically choose int32, but the actual store 3591 // would otherwise automatically choose int32, but the actual store
3593 // requires a Smi-tagged value. 3592 // requires a Smi-tagged value.
3594 HConstant* filler_size = HConstant::CreateAndInsertAfter( 3593 HConstant* filler_size = HConstant::CreateAndInsertAfter(
3595 zone, context(), free_space_size, Representation::Smi(), store_map); 3594 zone, context(), free_space_size, Representation::Smi(), store_map);
3596 // Must force Smi representation for x64 (see comment above). 3595 // Must force Smi representation for x64 (see comment above).
3597 HObjectAccess access = 3596 HObjectAccess access =
3598 HObjectAccess::ForJSObjectOffset(FreeSpace::kSizeOffset, 3597 HObjectAccess::ForMapAndOffset(isolate()->factory()->free_space_map(),
3599 Representation::Smi()); 3598 FreeSpace::kSizeOffset,
3599 Representation::Smi());
3600 HStoreNamedField* store_size = HStoreNamedField::New(zone, context(), 3600 HStoreNamedField* store_size = HStoreNamedField::New(zone, context(),
3601 free_space_instr, access, filler_size, INITIALIZING_STORE); 3601 free_space_instr, access, filler_size);
3602 store_size->SetFlag(HValue::kHasNoObservableSideEffects); 3602 store_size->SetFlag(HValue::kHasNoObservableSideEffects);
3603 store_size->InsertAfter(filler_size); 3603 store_size->InsertAfter(filler_size);
3604 filler_free_space_size_ = store_size; 3604 filler_free_space_size_ = store_size;
3605 } 3605 }
3606 3606
3607 3607
3608 void HAllocate::ClearNextMapWord(int offset) { 3608 void HAllocate::ClearNextMapWord(int offset) {
3609 if (MustClearNextMapWord()) { 3609 if (MustClearNextMapWord()) {
3610 Zone* zone = block()->zone(); 3610 Zone* zone = block()->zone();
3611 HObjectAccess access = HObjectAccess::ForJSObjectOffset(offset); 3611 HObjectAccess access =
3612 HObjectAccess::ForObservableJSObjectPropertyAt(offset);
3612 HStoreNamedField* clear_next_map = 3613 HStoreNamedField* clear_next_map =
3613 HStoreNamedField::New(zone, context(), this, access, 3614 HStoreNamedField::New(zone, context(), this, access,
3614 block()->graph()->GetConstant0(), INITIALIZING_STORE); 3615 block()->graph()->GetConstant0());
3615 clear_next_map->ClearAllSideEffects(); 3616 clear_next_map->ClearAllSideEffects();
3616 clear_next_map->InsertAfter(this); 3617 clear_next_map->InsertAfter(this);
3617 } 3618 }
3618 } 3619 }
3619 3620
3620 3621
3621 void HAllocate::PrintDataTo(StringStream* stream) { 3622 void HAllocate::PrintDataTo(StringStream* stream) {
3622 size()->PrintNameTo(stream); 3623 size()->PrintNameTo(stream);
3623 stream->Add(" ("); 3624 stream->Add(" (");
3624 if (IsNewSpaceAllocation()) stream->Add("N"); 3625 if (IsNewSpaceAllocation()) stream->Add("N");
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after
4228 4229
4229 4230
4230 HObjectAccess HObjectAccess::ForFixedArrayHeader(int offset) { 4231 HObjectAccess HObjectAccess::ForFixedArrayHeader(int offset) {
4231 ASSERT(offset >= 0); 4232 ASSERT(offset >= 0);
4232 ASSERT(offset < FixedArray::kHeaderSize); 4233 ASSERT(offset < FixedArray::kHeaderSize);
4233 if (offset == FixedArray::kLengthOffset) return ForFixedArrayLength(); 4234 if (offset == FixedArray::kLengthOffset) return ForFixedArrayLength();
4234 return HObjectAccess(kInobject, offset); 4235 return HObjectAccess(kInobject, offset);
4235 } 4236 }
4236 4237
4237 4238
4238 HObjectAccess HObjectAccess::ForJSObjectOffset(int offset, 4239 HObjectAccess HObjectAccess::ForMapAndOffset(Handle<Map> map, int offset,
4239 Representation representation) { 4240 Representation representation) {
4240 ASSERT(offset >= 0); 4241 ASSERT(offset >= 0);
4241 Portion portion = kInobject; 4242 Portion portion = kInobject;
4242 4243
4243 if (offset == JSObject::kElementsOffset) { 4244 if (offset == JSObject::kElementsOffset) {
4244 portion = kElementsPointer; 4245 portion = kElementsPointer;
4245 } else if (offset == JSObject::kMapOffset) { 4246 } else if (offset == JSObject::kMapOffset) {
4246 portion = kMaps; 4247 portion = kMaps;
4247 } 4248 }
4248 return HObjectAccess(portion, offset, representation); 4249 bool existing_inobject_property = true;
4250 if (!map.is_null()) {
4251 existing_inobject_property = (offset <
4252 map->instance_size() - map->unused_property_fields() * kPointerSize);
4253 }
4254 return HObjectAccess(portion, offset, representation, Handle<String>::null(),
4255 false, existing_inobject_property);
4249 } 4256 }
4250 4257
4251 4258
4252 HObjectAccess HObjectAccess::ForAllocationSiteOffset(int offset) { 4259 HObjectAccess HObjectAccess::ForAllocationSiteOffset(int offset) {
4253 switch (offset) { 4260 switch (offset) {
4254 case AllocationSite::kTransitionInfoOffset: 4261 case AllocationSite::kTransitionInfoOffset:
4255 return HObjectAccess(kInobject, offset, Representation::Tagged()); 4262 return HObjectAccess(kInobject, offset, Representation::Tagged());
4256 case AllocationSite::kNestedSiteOffset: 4263 case AllocationSite::kNestedSiteOffset:
4257 return HObjectAccess(kInobject, offset, Representation::Tagged()); 4264 return HObjectAccess(kInobject, offset, Representation::Tagged());
4258 case AllocationSite::kPretenureDataOffset: 4265 case AllocationSite::kPretenureDataOffset:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
4290 } else if (offset == JSObject::kMapOffset) { 4297 } else if (offset == JSObject::kMapOffset) {
4291 portion = kMaps; 4298 portion = kMaps;
4292 } 4299 }
4293 return HObjectAccess(portion, offset); 4300 return HObjectAccess(portion, offset);
4294 } 4301 }
4295 4302
4296 4303
4297 HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset, 4304 HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset,
4298 Representation representation) { 4305 Representation representation) {
4299 ASSERT(offset >= 0); 4306 ASSERT(offset >= 0);
4300 return HObjectAccess(kBackingStore, offset, representation); 4307 return HObjectAccess(kBackingStore, offset, representation,
4308 Handle<String>::null(), false, false);
4301 } 4309 }
4302 4310
4303 4311
4304 HObjectAccess HObjectAccess::ForField(Handle<Map> map, 4312 HObjectAccess HObjectAccess::ForField(Handle<Map> map,
4305 LookupResult *lookup, Handle<String> name) { 4313 LookupResult *lookup, Handle<String> name) {
4306 ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map)); 4314 ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map));
4307 int index; 4315 int index;
4308 Representation representation; 4316 Representation representation;
4309 if (lookup->IsField()) { 4317 if (lookup->IsField()) {
4310 index = lookup->GetLocalFieldIndexFromMap(*map); 4318 index = lookup->GetLocalFieldIndexFromMap(*map);
4311 representation = lookup->representation(); 4319 representation = lookup->representation();
4312 } else { 4320 } else {
4313 Map* transition = lookup->GetTransitionMapFromMap(*map); 4321 Map* transition = lookup->GetTransitionMapFromMap(*map);
4314 int descriptor = transition->LastAdded(); 4322 int descriptor = transition->LastAdded();
4315 index = transition->instance_descriptors()->GetFieldIndex(descriptor) - 4323 index = transition->instance_descriptors()->GetFieldIndex(descriptor) -
4316 map->inobject_properties(); 4324 map->inobject_properties();
4317 PropertyDetails details = 4325 PropertyDetails details =
4318 transition->instance_descriptors()->GetDetails(descriptor); 4326 transition->instance_descriptors()->GetDetails(descriptor);
4319 representation = details.representation(); 4327 representation = details.representation();
4320 } 4328 }
4321 if (index < 0) { 4329 if (index < 0) {
4322 // Negative property indices are in-object properties, indexed 4330 // Negative property indices are in-object properties, indexed
4323 // from the end of the fixed part of the object. 4331 // from the end of the fixed part of the object.
4324 int offset = (index * kPointerSize) + map->instance_size(); 4332 int offset = (index * kPointerSize) + map->instance_size();
4325 return HObjectAccess(kInobject, offset, representation, name); 4333 return HObjectAccess(kInobject, offset, representation, name, false, true);
4326 } else { 4334 } else {
4327 // Non-negative property indices are in the properties array. 4335 // Non-negative property indices are in the properties array.
4328 int offset = (index * kPointerSize) + FixedArray::kHeaderSize; 4336 int offset = (index * kPointerSize) + FixedArray::kHeaderSize;
4329 return HObjectAccess(kBackingStore, offset, representation, name); 4337 return HObjectAccess(kBackingStore, offset, representation, name,
4338 false, false);
4330 } 4339 }
4331 } 4340 }
4332 4341
4333 4342
4334 HObjectAccess HObjectAccess::ForCellPayload(Isolate* isolate) { 4343 HObjectAccess HObjectAccess::ForCellPayload(Isolate* isolate) {
4335 return HObjectAccess( 4344 return HObjectAccess(
4336 kInobject, Cell::kValueOffset, Representation::Tagged(), 4345 kInobject, Cell::kValueOffset, Representation::Tagged(),
4337 Handle<String>(isolate->heap()->cell_value_string())); 4346 Handle<String>(isolate->heap()->cell_value_string()));
4338 } 4347 }
4339 4348
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
4416 break; 4425 break;
4417 case kExternalMemory: 4426 case kExternalMemory:
4418 stream->Add("[external-memory]"); 4427 stream->Add("[external-memory]");
4419 break; 4428 break;
4420 } 4429 }
4421 4430
4422 stream->Add("@%d", offset()); 4431 stream->Add("@%d", offset());
4423 } 4432 }
4424 4433
4425 } } // namespace v8::internal 4434 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698