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

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

Issue 149573014: Perform a fix point iteration for GVN. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | 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 1496 matching lines...) Expand 10 before | Expand all | Expand 10 after
1507 case IS_INTERNALIZED_STRING: 1507 case IS_INTERNALIZED_STRING:
1508 *mask = kIsNotStringMask | kIsNotInternalizedMask; 1508 *mask = kIsNotStringMask | kIsNotInternalizedMask;
1509 *tag = kInternalizedTag; 1509 *tag = kInternalizedTag;
1510 return; 1510 return;
1511 default: 1511 default:
1512 UNREACHABLE(); 1512 UNREACHABLE();
1513 } 1513 }
1514 } 1514 }
1515 1515
1516 1516
1517 void HCheckMaps::HandleSideEffectDominator(GVNFlag side_effect, 1517 bool HCheckMaps::HandleSideEffectDominator(GVNFlag side_effect,
1518 HValue* dominator) { 1518 HValue* dominator) {
1519 ASSERT(side_effect == kChangesMaps); 1519 ASSERT(side_effect == kChangesMaps);
1520 // TODO(mstarzinger): For now we specialize on HStoreNamedField, but once 1520 // TODO(mstarzinger): For now we specialize on HStoreNamedField, but once
1521 // type information is rich enough we should generalize this to any HType 1521 // type information is rich enough we should generalize this to any HType
1522 // for which the map is known. 1522 // for which the map is known.
1523 if (HasNoUses() && dominator->IsStoreNamedField()) { 1523 if (HasNoUses() && dominator->IsStoreNamedField()) {
1524 HStoreNamedField* store = HStoreNamedField::cast(dominator); 1524 HStoreNamedField* store = HStoreNamedField::cast(dominator);
1525 if (!store->has_transition() || store->object() != value()) return; 1525 if (!store->has_transition() || store->object() != value()) return false;
1526 HConstant* transition = HConstant::cast(store->transition()); 1526 HConstant* transition = HConstant::cast(store->transition());
1527 if (map_set_.Contains(transition->GetUnique())) { 1527 if (map_set_.Contains(transition->GetUnique())) {
1528 DeleteAndReplaceWith(NULL); 1528 DeleteAndReplaceWith(NULL);
1529 return; 1529 return true;
1530 } 1530 }
1531 } 1531 }
1532 return false;
1532 } 1533 }
1533 1534
1534 1535
1535 void HCheckMaps::PrintDataTo(StringStream* stream) { 1536 void HCheckMaps::PrintDataTo(StringStream* stream) {
1536 value()->PrintNameTo(stream); 1537 value()->PrintNameTo(stream);
1537 stream->Add(" [%p", *map_set_.at(0).handle()); 1538 stream->Add(" [%p", *map_set_.at(0).handle());
1538 for (int i = 1; i < map_set_.size(); ++i) { 1539 for (int i = 1; i < map_set_.size(); ++i) {
1539 stream->Add(",%p", *map_set_.at(i).handle()); 1540 stream->Add(",%p", *map_set_.at(i).handle());
1540 } 1541 }
1541 stream->Add("]%s", CanOmitMapChecks() ? "(omitted)" : ""); 1542 stream->Add("]%s", CanOmitMapChecks() ? "(omitted)" : "");
(...skipping 1860 matching lines...) Expand 10 before | Expand all | Expand 10 after
3402 // If any of the actual input representation is more general than what we 3403 // If any of the actual input representation is more general than what we
3403 // have so far but not Tagged, use that representation instead. 3404 // have so far but not Tagged, use that representation instead.
3404 Representation input_rep = value()->representation(); 3405 Representation input_rep = value()->representation();
3405 if (!input_rep.IsTagged()) { 3406 if (!input_rep.IsTagged()) {
3406 rep = rep.generalize(input_rep); 3407 rep = rep.generalize(input_rep);
3407 } 3408 }
3408 return rep; 3409 return rep;
3409 } 3410 }
3410 3411
3411 3412
3412 void HAllocate::HandleSideEffectDominator(GVNFlag side_effect, 3413 bool HAllocate::HandleSideEffectDominator(GVNFlag side_effect,
3413 HValue* dominator) { 3414 HValue* dominator) {
3414 ASSERT(side_effect == kChangesNewSpacePromotion); 3415 ASSERT(side_effect == kChangesNewSpacePromotion);
3415 Zone* zone = block()->zone(); 3416 Zone* zone = block()->zone();
3416 if (!FLAG_use_allocation_folding) return; 3417 if (!FLAG_use_allocation_folding) return false;
3417 3418
3418 // Try to fold allocations together with their dominating allocations. 3419 // Try to fold allocations together with their dominating allocations.
3419 if (!dominator->IsAllocate()) { 3420 if (!dominator->IsAllocate()) {
3420 if (FLAG_trace_allocation_folding) { 3421 if (FLAG_trace_allocation_folding) {
3421 PrintF("#%d (%s) cannot fold into #%d (%s)\n", 3422 PrintF("#%d (%s) cannot fold into #%d (%s)\n",
3422 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); 3423 id(), Mnemonic(), dominator->id(), dominator->Mnemonic());
3423 } 3424 }
3424 return; 3425 return false;
3425 } 3426 }
3426 3427
3427 HAllocate* dominator_allocate = HAllocate::cast(dominator); 3428 HAllocate* dominator_allocate = HAllocate::cast(dominator);
3428 HValue* dominator_size = dominator_allocate->size(); 3429 HValue* dominator_size = dominator_allocate->size();
3429 HValue* current_size = size(); 3430 HValue* current_size = size();
3430 3431
3431 // TODO(hpayer): Add support for non-constant allocation in dominator. 3432 // TODO(hpayer): Add support for non-constant allocation in dominator.
3432 if (!current_size->IsInteger32Constant() || 3433 if (!current_size->IsInteger32Constant() ||
3433 !dominator_size->IsInteger32Constant()) { 3434 !dominator_size->IsInteger32Constant()) {
3434 if (FLAG_trace_allocation_folding) { 3435 if (FLAG_trace_allocation_folding) {
3435 PrintF("#%d (%s) cannot fold into #%d (%s), dynamic allocation size\n", 3436 PrintF("#%d (%s) cannot fold into #%d (%s), dynamic allocation size\n",
3436 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); 3437 id(), Mnemonic(), dominator->id(), dominator->Mnemonic());
3437 } 3438 }
3438 return; 3439 return false;
3439 } 3440 }
3440 3441
3441 dominator_allocate = GetFoldableDominator(dominator_allocate); 3442 dominator_allocate = GetFoldableDominator(dominator_allocate);
3442 if (dominator_allocate == NULL) { 3443 if (dominator_allocate == NULL) {
3443 return; 3444 return false;
3444 } 3445 }
3445 3446
3446 ASSERT((IsNewSpaceAllocation() && 3447 ASSERT((IsNewSpaceAllocation() &&
3447 dominator_allocate->IsNewSpaceAllocation()) || 3448 dominator_allocate->IsNewSpaceAllocation()) ||
3448 (IsOldDataSpaceAllocation() && 3449 (IsOldDataSpaceAllocation() &&
3449 dominator_allocate->IsOldDataSpaceAllocation()) || 3450 dominator_allocate->IsOldDataSpaceAllocation()) ||
3450 (IsOldPointerSpaceAllocation() && 3451 (IsOldPointerSpaceAllocation() &&
3451 dominator_allocate->IsOldPointerSpaceAllocation())); 3452 dominator_allocate->IsOldPointerSpaceAllocation()));
3452 3453
3453 // First update the size of the dominator allocate instruction. 3454 // First update the size of the dominator allocate instruction.
(...skipping 16 matching lines...) Expand all
3470 } 3471 }
3471 3472
3472 // Since we clear the first word after folded memory, we cannot use the 3473 // Since we clear the first word after folded memory, we cannot use the
3473 // whole Page::kMaxRegularHeapObjectSize memory. 3474 // whole Page::kMaxRegularHeapObjectSize memory.
3474 if (new_dominator_size > Page::kMaxRegularHeapObjectSize - kPointerSize) { 3475 if (new_dominator_size > Page::kMaxRegularHeapObjectSize - kPointerSize) {
3475 if (FLAG_trace_allocation_folding) { 3476 if (FLAG_trace_allocation_folding) {
3476 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n", 3477 PrintF("#%d (%s) cannot fold into #%d (%s) due to size: %d\n",
3477 id(), Mnemonic(), dominator_allocate->id(), 3478 id(), Mnemonic(), dominator_allocate->id(),
3478 dominator_allocate->Mnemonic(), new_dominator_size); 3479 dominator_allocate->Mnemonic(), new_dominator_size);
3479 } 3480 }
3480 return; 3481 return false;
3481 } 3482 }
3482 3483
3483 HInstruction* new_dominator_size_constant = HConstant::CreateAndInsertBefore( 3484 HInstruction* new_dominator_size_constant = HConstant::CreateAndInsertBefore(
3484 zone, 3485 zone,
3485 context(), 3486 context(),
3486 new_dominator_size, 3487 new_dominator_size,
3487 Representation::None(), 3488 Representation::None(),
3488 dominator_allocate); 3489 dominator_allocate);
3489 dominator_allocate->UpdateSize(new_dominator_size_constant); 3490 dominator_allocate->UpdateSize(new_dominator_size_constant);
3490 3491
(...skipping 27 matching lines...) Expand all
3518 dominator_allocate, 3519 dominator_allocate,
3519 inner_offset, 3520 inner_offset,
3520 type()); 3521 type());
3521 dominated_allocate_instr->InsertBefore(this); 3522 dominated_allocate_instr->InsertBefore(this);
3522 DeleteAndReplaceWith(dominated_allocate_instr); 3523 DeleteAndReplaceWith(dominated_allocate_instr);
3523 if (FLAG_trace_allocation_folding) { 3524 if (FLAG_trace_allocation_folding) {
3524 PrintF("#%d (%s) folded into #%d (%s)\n", 3525 PrintF("#%d (%s) folded into #%d (%s)\n",
3525 id(), Mnemonic(), dominator_allocate->id(), 3526 id(), Mnemonic(), dominator_allocate->id(),
3526 dominator_allocate->Mnemonic()); 3527 dominator_allocate->Mnemonic());
3527 } 3528 }
3529 return true;
3528 } 3530 }
3529 3531
3530 3532
3531 HAllocate* HAllocate::GetFoldableDominator(HAllocate* dominator) { 3533 HAllocate* HAllocate::GetFoldableDominator(HAllocate* dominator) {
3532 if (!IsFoldable(dominator)) { 3534 if (!IsFoldable(dominator)) {
3533 // We cannot hoist old space allocations over new space allocations. 3535 // We cannot hoist old space allocations over new space allocations.
3534 if (IsNewSpaceAllocation() || dominator->IsNewSpaceAllocation()) { 3536 if (IsNewSpaceAllocation() || dominator->IsNewSpaceAllocation()) {
3535 if (FLAG_trace_allocation_folding) { 3537 if (FLAG_trace_allocation_folding) {
3536 PrintF("#%d (%s) cannot fold into #%d (%s), new space hoisting\n", 3538 PrintF("#%d (%s) cannot fold into #%d (%s), new space hoisting\n",
3537 id(), Mnemonic(), dominator->id(), dominator->Mnemonic()); 3539 id(), Mnemonic(), dominator->id(), dominator->Mnemonic());
(...skipping 928 matching lines...) Expand 10 before | Expand all | Expand 10 after
4466 break; 4468 break;
4467 case kExternalMemory: 4469 case kExternalMemory:
4468 stream->Add("[external-memory]"); 4470 stream->Add("[external-memory]");
4469 break; 4471 break;
4470 } 4472 }
4471 4473
4472 stream->Add("@%d", offset()); 4474 stream->Add("@%d", offset());
4473 } 4475 }
4474 4476
4475 } } // namespace v8::internal 4477 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698