From 5345727935ad47b56aa43dece35effa511055df6 Mon Sep 17 00:00:00 2001 From: "balazs.kilvady" Date: Thu, 28 Apr 2016 03:58:41 -0700 Subject: [PATCH] MIPS: Fix unbounded label counter. TEST=mjsunit/asm/embenchen/zlib BUG= Review-Url: https://codereview.chromium.org/1925543003 Cr-Commit-Position: refs/heads/master@{#35854} --- src/mips/assembler-mips.cc | 1 + src/mips/assembler-mips.h | 2 ++ src/mips64/assembler-mips64.cc | 1 + src/mips64/assembler-mips64.h | 2 ++ test/cctest/test-assembler-mips.cc | 2 ++ test/cctest/test-assembler-mips64.cc | 2 ++ 6 files changed, 10 insertions(+) diff --git a/src/mips/assembler-mips.cc b/src/mips/assembler-mips.cc index 8e873c8f0a..f4d8a68490 100644 --- a/src/mips/assembler-mips.cc +++ b/src/mips/assembler-mips.cc @@ -2959,6 +2959,7 @@ void Assembler::dd(Label* label) { data = reinterpret_cast(buffer_ + label->pos()); } else { data = jump_address(label); + unbound_labels_count_++; internal_reference_positions_.insert(label->pos()); } RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE); diff --git a/src/mips/assembler-mips.h b/src/mips/assembler-mips.h index ed5cbf8bf2..37f32fa136 100644 --- a/src/mips/assembler-mips.h +++ b/src/mips/assembler-mips.h @@ -1161,6 +1161,8 @@ class Assembler : public AssemblerBase { bool IsPrevInstrCompactBranch() { return prev_instr_compact_branch_; } + inline int UnboundLabelsCount() { return unbound_labels_count_; } + protected: // Load Scaled Address instruction. void lsa(Register rd, Register rt, Register rs, uint8_t sa); diff --git a/src/mips64/assembler-mips64.cc b/src/mips64/assembler-mips64.cc index 420dc1874e..8907adf23f 100644 --- a/src/mips64/assembler-mips64.cc +++ b/src/mips64/assembler-mips64.cc @@ -3212,6 +3212,7 @@ void Assembler::dd(Label* label) { data = reinterpret_cast(buffer_ + label->pos()); } else { data = jump_address(label); + unbound_labels_count_++; internal_reference_positions_.insert(label->pos()); } RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE); diff --git a/src/mips64/assembler-mips64.h b/src/mips64/assembler-mips64.h index 6636d2b94a..2281be2df9 100644 --- a/src/mips64/assembler-mips64.h +++ b/src/mips64/assembler-mips64.h @@ -1215,6 +1215,8 @@ class Assembler : public AssemblerBase { bool IsPrevInstrCompactBranch() { return prev_instr_compact_branch_; } + inline int UnboundLabelsCount() { return unbound_labels_count_; } + protected: // Load Scaled Address instructions. void lsa(Register rd, Register rt, Register rs, uint8_t sa); diff --git a/test/cctest/test-assembler-mips.cc b/test/cctest/test-assembler-mips.cc index 2fb589d28b..e73b40e96b 100644 --- a/test/cctest/test-assembler-mips.cc +++ b/test/cctest/test-assembler-mips.cc @@ -3191,6 +3191,8 @@ TEST(jump_tables1) { __ jr(ra); __ nop(); + CHECK_EQ(assm.UnboundLabelsCount(), 0); + CodeDesc desc; assm.GetCode(&desc); Handle code = isolate->factory()->NewCode( diff --git a/test/cctest/test-assembler-mips64.cc b/test/cctest/test-assembler-mips64.cc index f17956c717..9529dab242 100644 --- a/test/cctest/test-assembler-mips64.cc +++ b/test/cctest/test-assembler-mips64.cc @@ -3315,6 +3315,8 @@ TEST(jump_tables1) { __ jr(ra); __ nop(); + CHECK_EQ(assm.UnboundLabelsCount(), 0); + CodeDesc desc; assm.GetCode(&desc); Handle code = isolate->factory()->NewCode(