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

Side by Side Diff: src/arm64/assembler-arm64.cc

Issue 217343007: ARM64: Avoid iterating through unresolved branches information when unnecessary. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 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 | « no previous file | 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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // 2 //
3 // Redistribution and use in source and binary forms, with or without 3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are 4 // modification, are permitted provided that the following conditions are
5 // met: 5 // met:
6 // 6 //
7 // * Redistributions of source code must retain the above copyright 7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer. 8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above 9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following 10 // copyright notice, this list of conditions and the following
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 449
450 450
451 void Assembler::bind(Label* label) { 451 void Assembler::bind(Label* label) {
452 // Bind label to the address at pc_. All instructions (most likely branches) 452 // Bind label to the address at pc_. All instructions (most likely branches)
453 // that are linked to this label will be updated to point to the newly-bound 453 // that are linked to this label will be updated to point to the newly-bound
454 // label. 454 // label.
455 455
456 ASSERT(!label->is_near_linked()); 456 ASSERT(!label->is_near_linked());
457 ASSERT(!label->is_bound()); 457 ASSERT(!label->is_bound());
458 458
459 DeleteUnresolvedBranchInfoForLabel(label);
460
459 // If the label is linked, the link chain looks something like this: 461 // If the label is linked, the link chain looks something like this:
460 // 462 //
461 // |--I----I-------I-------L 463 // |--I----I-------I-------L
462 // |---------------------->| pc_offset 464 // |---------------------->| pc_offset
463 // |-------------->| linkoffset = label->pos() 465 // |-------------->| linkoffset = label->pos()
464 // |<------| link->ImmPCOffset() 466 // |<------| link->ImmPCOffset()
465 // |------>| prevlinkoffset = linkoffset + link->ImmPCOffset() 467 // |------>| prevlinkoffset = linkoffset + link->ImmPCOffset()
466 // 468 //
467 // On each iteration, the last link is updated and then removed from the 469 // On each iteration, the last link is updated and then removed from the
468 // chain until only one remains. At that point, the label is bound. 470 // chain until only one remains. At that point, the label is bound.
(...skipping 21 matching lines...) Expand all
490 label->Unuse(); 492 label->Unuse();
491 } else { 493 } else {
492 // Update the label for the next iteration. 494 // Update the label for the next iteration.
493 label->link_to(prevlinkoffset); 495 label->link_to(prevlinkoffset);
494 } 496 }
495 } 497 }
496 label->bind_to(pc_offset()); 498 label->bind_to(pc_offset());
497 499
498 ASSERT(label->is_bound()); 500 ASSERT(label->is_bound());
499 ASSERT(!label->is_linked()); 501 ASSERT(!label->is_linked());
500
501 DeleteUnresolvedBranchInfoForLabel(label);
502 } 502 }
503 503
504 504
505 int Assembler::LinkAndGetByteOffsetTo(Label* label) { 505 int Assembler::LinkAndGetByteOffsetTo(Label* label) {
506 ASSERT(sizeof(*pc_) == 1); 506 ASSERT(sizeof(*pc_) == 1);
507 CheckLabelLinkChain(label); 507 CheckLabelLinkChain(label);
508 508
509 int offset; 509 int offset;
510 if (label->is_bound()) { 510 if (label->is_bound()) {
511 // The label is bound, so it does not need to be updated. Referring 511 // The label is bound, so it does not need to be updated. Referring
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 return offset; 544 return offset;
545 } 545 }
546 546
547 547
548 void Assembler::DeleteUnresolvedBranchInfoForLabel(Label* label) { 548 void Assembler::DeleteUnresolvedBranchInfoForLabel(Label* label) {
549 if (unresolved_branches_.empty()) { 549 if (unresolved_branches_.empty()) {
550 ASSERT(next_veneer_pool_check_ == kMaxInt); 550 ASSERT(next_veneer_pool_check_ == kMaxInt);
551 return; 551 return;
552 } 552 }
553 553
554 // Branches to this label will be resolved when the label is bound below. 554 if (label->is_linked()) {
555 std::multimap<int, FarBranchInfo>::iterator it_tmp, it; 555 // Branches to this label will be resolved when the label is bound below.
556 it = unresolved_branches_.begin(); 556 std::multimap<int, FarBranchInfo>::iterator it_tmp, it;
557 while (it != unresolved_branches_.end()) { 557 it = unresolved_branches_.begin();
558 it_tmp = it++; 558 while (it != unresolved_branches_.end()) {
559 if (it_tmp->second.label_ == label) { 559 it_tmp = it++;
560 CHECK(it_tmp->first >= pc_offset()); 560 if (it_tmp->second.label_ == label) {
561 unresolved_branches_.erase(it_tmp); 561 CHECK(it_tmp->first >= pc_offset());
562 unresolved_branches_.erase(it_tmp);
563 }
562 } 564 }
563 } 565 }
564 if (unresolved_branches_.empty()) { 566 if (unresolved_branches_.empty()) {
565 next_veneer_pool_check_ = kMaxInt; 567 next_veneer_pool_check_ = kMaxInt;
566 } else { 568 } else {
567 next_veneer_pool_check_ = 569 next_veneer_pool_check_ =
568 unresolved_branches_first_limit() - kVeneerDistanceCheckMargin; 570 unresolved_branches_first_limit() - kVeneerDistanceCheckMargin;
569 } 571 }
570 } 572 }
571 573
(...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after
2804 2806
2805 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) { 2807 void Assembler::PopulateConstantPool(ConstantPoolArray* constant_pool) {
2806 // No out-of-line constant pool support. 2808 // No out-of-line constant pool support.
2807 UNREACHABLE(); 2809 UNREACHABLE();
2808 } 2810 }
2809 2811
2810 2812
2811 } } // namespace v8::internal 2813 } } // namespace v8::internal
2812 2814
2813 #endif // V8_TARGET_ARCH_ARM64 2815 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698