OLD | NEW |
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 4372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4383 } | 4383 } |
4384 | 4384 |
4385 | 4385 |
4386 HObjectAccess HObjectAccess::ForCellPayload(Isolate* isolate) { | 4386 HObjectAccess HObjectAccess::ForCellPayload(Isolate* isolate) { |
4387 return HObjectAccess( | 4387 return HObjectAccess( |
4388 kInobject, Cell::kValueOffset, Representation::Tagged(), | 4388 kInobject, Cell::kValueOffset, Representation::Tagged(), |
4389 Handle<String>(isolate->heap()->cell_value_string())); | 4389 Handle<String>(isolate->heap()->cell_value_string())); |
4390 } | 4390 } |
4391 | 4391 |
4392 | 4392 |
4393 void HObjectAccess::SetGVNFlags(HValue *instr, bool is_store) { | 4393 void HObjectAccess::SetGVNFlags(HValue *instr, PropertyAccessType access_type) { |
4394 // set the appropriate GVN flags for a given load or store instruction | 4394 // set the appropriate GVN flags for a given load or store instruction |
4395 if (is_store) { | 4395 if (access_type == STORE) { |
4396 // track dominating allocations in order to eliminate write barriers | 4396 // track dominating allocations in order to eliminate write barriers |
4397 instr->SetGVNFlag(kDependsOnNewSpacePromotion); | 4397 instr->SetGVNFlag(kDependsOnNewSpacePromotion); |
4398 instr->SetFlag(HValue::kTrackSideEffectDominators); | 4398 instr->SetFlag(HValue::kTrackSideEffectDominators); |
4399 } else { | 4399 } else { |
4400 // try to GVN loads, but don't hoist above map changes | 4400 // try to GVN loads, but don't hoist above map changes |
4401 instr->SetFlag(HValue::kUseGVN); | 4401 instr->SetFlag(HValue::kUseGVN); |
4402 instr->SetGVNFlag(kDependsOnMaps); | 4402 instr->SetGVNFlag(kDependsOnMaps); |
4403 } | 4403 } |
4404 | 4404 |
4405 switch (portion()) { | 4405 switch (portion()) { |
4406 case kArrayLengths: | 4406 case kArrayLengths: |
4407 instr->SetGVNFlag(is_store | 4407 instr->SetGVNFlag(access_type == STORE |
4408 ? kChangesArrayLengths : kDependsOnArrayLengths); | 4408 ? kChangesArrayLengths : kDependsOnArrayLengths); |
4409 break; | 4409 break; |
4410 case kStringLengths: | 4410 case kStringLengths: |
4411 instr->SetGVNFlag(is_store | 4411 instr->SetGVNFlag(access_type == STORE |
4412 ? kChangesStringLengths : kDependsOnStringLengths); | 4412 ? kChangesStringLengths : kDependsOnStringLengths); |
4413 break; | 4413 break; |
4414 case kInobject: | 4414 case kInobject: |
4415 instr->SetGVNFlag(is_store | 4415 instr->SetGVNFlag(access_type == STORE |
4416 ? kChangesInobjectFields : kDependsOnInobjectFields); | 4416 ? kChangesInobjectFields : kDependsOnInobjectFields); |
4417 break; | 4417 break; |
4418 case kDouble: | 4418 case kDouble: |
4419 instr->SetGVNFlag(is_store | 4419 instr->SetGVNFlag(access_type == STORE |
4420 ? kChangesDoubleFields : kDependsOnDoubleFields); | 4420 ? kChangesDoubleFields : kDependsOnDoubleFields); |
4421 break; | 4421 break; |
4422 case kBackingStore: | 4422 case kBackingStore: |
4423 instr->SetGVNFlag(is_store | 4423 instr->SetGVNFlag(access_type == STORE |
4424 ? kChangesBackingStoreFields : kDependsOnBackingStoreFields); | 4424 ? kChangesBackingStoreFields : kDependsOnBackingStoreFields); |
4425 break; | 4425 break; |
4426 case kElementsPointer: | 4426 case kElementsPointer: |
4427 instr->SetGVNFlag(is_store | 4427 instr->SetGVNFlag(access_type == STORE |
4428 ? kChangesElementsPointer : kDependsOnElementsPointer); | 4428 ? kChangesElementsPointer : kDependsOnElementsPointer); |
4429 break; | 4429 break; |
4430 case kMaps: | 4430 case kMaps: |
4431 instr->SetGVNFlag(is_store | 4431 instr->SetGVNFlag(access_type == STORE |
4432 ? kChangesMaps : kDependsOnMaps); | 4432 ? kChangesMaps : kDependsOnMaps); |
4433 break; | 4433 break; |
4434 case kExternalMemory: | 4434 case kExternalMemory: |
4435 instr->SetGVNFlag(is_store | 4435 instr->SetGVNFlag(access_type == STORE |
4436 ? kChangesExternalMemory : kDependsOnExternalMemory); | 4436 ? kChangesExternalMemory : kDependsOnExternalMemory); |
4437 break; | 4437 break; |
4438 } | 4438 } |
4439 } | 4439 } |
4440 | 4440 |
4441 | 4441 |
4442 void HObjectAccess::PrintTo(StringStream* stream) { | 4442 void HObjectAccess::PrintTo(StringStream* stream) { |
4443 stream->Add("."); | 4443 stream->Add("."); |
4444 | 4444 |
4445 switch (portion()) { | 4445 switch (portion()) { |
(...skipping 22 matching lines...) Expand all Loading... |
4468 break; | 4468 break; |
4469 case kExternalMemory: | 4469 case kExternalMemory: |
4470 stream->Add("[external-memory]"); | 4470 stream->Add("[external-memory]"); |
4471 break; | 4471 break; |
4472 } | 4472 } |
4473 | 4473 |
4474 stream->Add("@%d", offset()); | 4474 stream->Add("@%d", offset()); |
4475 } | 4475 } |
4476 | 4476 |
4477 } } // namespace v8::internal | 4477 } } // namespace v8::internal |
OLD | NEW |