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

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

Issue 112913002: Split up HLoadNamedField and HStoreNamedField. Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years 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-codegen-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 1524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1535 case IS_INTERNALIZED_STRING: 1535 case IS_INTERNALIZED_STRING:
1536 *mask = kIsNotStringMask | kIsNotInternalizedMask; 1536 *mask = kIsNotStringMask | kIsNotInternalizedMask;
1537 *tag = kInternalizedTag; 1537 *tag = kInternalizedTag;
1538 return; 1538 return;
1539 default: 1539 default:
1540 UNREACHABLE(); 1540 UNREACHABLE();
1541 } 1541 }
1542 } 1542 }
1543 1543
1544 1544
1545 static bool IsMapAccess(HObjectAccess access) {
1546 return access.IsInobject() && access.offset() == JSObject::kMapOffset;
1547 }
1548
1549
1545 void HCheckMaps::HandleSideEffectDominator(GVNFlag side_effect, 1550 void HCheckMaps::HandleSideEffectDominator(GVNFlag side_effect,
1546 HValue* dominator) { 1551 HValue* dominator) {
1547 ASSERT(side_effect == kChangesMaps); 1552 ASSERT(side_effect == kChangesMaps);
1548 // TODO(mstarzinger): For now we specialize on HStoreNamedField, but once 1553 // TODO(mstarzinger): For now we specialize on HStoreNamedField, but once
1549 // type information is rich enough we should generalize this to any HType 1554 // type information is rich enough we should generalize this to any HType
1550 // for which the map is known. 1555 // for which the map is known.
1551 if (HasNoUses() && dominator->IsStoreNamedField()) { 1556 if (HasNoUses() && dominator->IsStoreNamedField()) {
1552 HStoreNamedField* store = HStoreNamedField::cast(dominator); 1557 HStoreNamedField* store = HStoreNamedField::cast(dominator);
1553 if (!store->has_transition() || store->object() != value()) return; 1558 if (!IsMapAccess(store->access()) ||
1554 HConstant* transition = HConstant::cast(store->transition()); 1559 store->object() != value() ||
1560 !store->value()->IsConstant()) {
1561 return;
1562 }
1563 HConstant* transition = HConstant::cast(store->value());
1555 if (map_set_.Contains(transition->GetUnique())) { 1564 if (map_set_.Contains(transition->GetUnique())) {
1556 DeleteAndReplaceWith(NULL); 1565 DeleteAndReplaceWith(NULL);
1557 return; 1566 return;
1558 } 1567 }
1559 } 1568 }
1560 } 1569 }
1561 1570
1562 1571
1563 void HCheckMaps::PrintDataTo(StringStream* stream) { 1572 void HCheckMaps::PrintDataTo(StringStream* stream) {
1564 value()->PrintNameTo(stream); 1573 value()->PrintNameTo(stream);
(...skipping 1686 matching lines...) Expand 10 before | Expand all | Expand 10 after
3251 3260
3252 3261
3253 void HStoreNamedField::PrintDataTo(StringStream* stream) { 3262 void HStoreNamedField::PrintDataTo(StringStream* stream) {
3254 object()->PrintNameTo(stream); 3263 object()->PrintNameTo(stream);
3255 access_.PrintTo(stream); 3264 access_.PrintTo(stream);
3256 stream->Add(" = "); 3265 stream->Add(" = ");
3257 value()->PrintNameTo(stream); 3266 value()->PrintNameTo(stream);
3258 if (NeedsWriteBarrier()) { 3267 if (NeedsWriteBarrier()) {
3259 stream->Add(" (write-barrier)"); 3268 stream->Add(" (write-barrier)");
3260 } 3269 }
3261 if (has_transition()) {
3262 stream->Add(" (transition map %p)", *transition_map());
3263 }
3264 } 3270 }
3265 3271
3266 3272
3267 void HStoreKeyed::PrintDataTo(StringStream* stream) { 3273 void HStoreKeyed::PrintDataTo(StringStream* stream) {
3268 if (!is_external()) { 3274 if (!is_external()) {
3269 elements()->PrintNameTo(stream); 3275 elements()->PrintNameTo(stream);
3270 } else { 3276 } else {
3271 elements()->PrintNameTo(stream); 3277 elements()->PrintNameTo(stream);
3272 stream->Add("."); 3278 stream->Add(".");
3273 stream->Add(ElementsKindToString(elements_kind())); 3279 stream->Add(ElementsKindToString(elements_kind()));
(...skipping 1019 matching lines...) Expand 10 before | Expand all | Expand 10 after
4293 portion = kElementsPointer; 4299 portion = kElementsPointer;
4294 } else if (offset == JSArray::kLengthOffset) { 4300 } else if (offset == JSArray::kLengthOffset) {
4295 portion = kArrayLengths; 4301 portion = kArrayLengths;
4296 } else if (offset == JSObject::kMapOffset) { 4302 } else if (offset == JSObject::kMapOffset) {
4297 portion = kMaps; 4303 portion = kMaps;
4298 } 4304 }
4299 return HObjectAccess(portion, offset); 4305 return HObjectAccess(portion, offset);
4300 } 4306 }
4301 4307
4302 4308
4309 HObjectAccess HObjectAccess::ForBackingStore() {
4310 return HObjectAccess(kBackingStorePointer, JSObject::kPropertiesOffset);
4311 }
4312
4313
4303 HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset, 4314 HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset,
4304 Representation representation) { 4315 Representation representation) {
4305 ASSERT(offset >= 0); 4316 ASSERT(offset >= 0);
4306 return HObjectAccess(kBackingStore, offset, representation); 4317 return HObjectAccess(kBackingStore, offset, representation);
4307 } 4318 }
4308 4319
4309 4320
4310 HObjectAccess HObjectAccess::ForField(Handle<Map> map, 4321 HObjectAccess HObjectAccess::ForField(Handle<Map> map,
4311 LookupResult *lookup, Handle<String> name) { 4322 LookupResult *lookup, Handle<String> name) {
4312 ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map)); 4323 ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map));
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
4370 ? kChangesInobjectFields : kDependsOnInobjectFields); 4381 ? kChangesInobjectFields : kDependsOnInobjectFields);
4371 break; 4382 break;
4372 case kDouble: 4383 case kDouble:
4373 instr->SetGVNFlag(is_store 4384 instr->SetGVNFlag(is_store
4374 ? kChangesDoubleFields : kDependsOnDoubleFields); 4385 ? kChangesDoubleFields : kDependsOnDoubleFields);
4375 break; 4386 break;
4376 case kBackingStore: 4387 case kBackingStore:
4377 instr->SetGVNFlag(is_store 4388 instr->SetGVNFlag(is_store
4378 ? kChangesBackingStoreFields : kDependsOnBackingStoreFields); 4389 ? kChangesBackingStoreFields : kDependsOnBackingStoreFields);
4379 break; 4390 break;
4391 case kBackingStorePointer:
4392 instr->SetGVNFlag(is_store
4393 ? kChangesBackingStore : kDependsOnBackingStore);
4394 break;
4380 case kElementsPointer: 4395 case kElementsPointer:
4381 instr->SetGVNFlag(is_store 4396 instr->SetGVNFlag(is_store
4382 ? kChangesElementsPointer : kDependsOnElementsPointer); 4397 ? kChangesElementsPointer : kDependsOnElementsPointer);
4383 break; 4398 break;
4384 case kMaps: 4399 case kMaps:
4385 instr->SetGVNFlag(is_store 4400 instr->SetGVNFlag(is_store
4386 ? kChangesMaps : kDependsOnMaps); 4401 ? kChangesMaps : kDependsOnMaps);
4387 break; 4402 break;
4388 case kExternalMemory: 4403 case kExternalMemory:
4389 instr->SetGVNFlag(is_store 4404 instr->SetGVNFlag(is_store
(...skipping 23 matching lines...) Expand all
4413 stream->Add(String::cast(*name_)->ToCString().get()); 4428 stream->Add(String::cast(*name_)->ToCString().get());
4414 } 4429 }
4415 stream->Add("[in-object]"); 4430 stream->Add("[in-object]");
4416 break; 4431 break;
4417 case kBackingStore: 4432 case kBackingStore:
4418 if (!name_.is_null()) { 4433 if (!name_.is_null()) {
4419 stream->Add(String::cast(*name_)->ToCString().get()); 4434 stream->Add(String::cast(*name_)->ToCString().get());
4420 } 4435 }
4421 stream->Add("[backing-store]"); 4436 stream->Add("[backing-store]");
4422 break; 4437 break;
4438 case kBackingStorePointer:
4439 if (!name_.is_null()) {
4440 stream->Add(String::cast(*name_)->ToCString().get());
4441 }
4442 stream->Add("[backing-store-pointer]");
4443 break;
4423 case kExternalMemory: 4444 case kExternalMemory:
4424 stream->Add("[external-memory]"); 4445 stream->Add("[external-memory]");
4425 break; 4446 break;
4426 } 4447 }
4427 4448
4428 stream->Add("@%d", offset()); 4449 stream->Add("@%d", offset());
4429 } 4450 }
4430 4451
4431 } } // namespace v8::internal 4452 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698