MIPS: Fix Assembler::dd(Label*) implementation.
authorbalazs.kilvady <balazs.kilvady@imgtec.com>
Thu, 7 May 2015 17:21:23 +0000 (10:21 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 7 May 2015 17:21:29 +0000 (17:21 +0000)
BUG=
TEST=mjsunit/asm/embenchen/lua_binarytrees

Review URL: https://codereview.chromium.org/1127393003

Cr-Commit-Position: refs/heads/master@{#28303}

src/mips/assembler-mips.cc
src/mips64/assembler-mips64.cc

index 3e7ec15b0d2d4b49bf9cebf87480624271e07588..e05fc015a838c7bd6ffd729e91937ae7bc5ee063 100644 (file)
@@ -2580,15 +2580,15 @@ void Assembler::dd(uint32_t data) {
 void Assembler::dd(Label* label) {
   CheckBuffer();
   RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE);
+  uint32_t data;
   if (label->is_bound()) {
-    uint32_t data = reinterpret_cast<uint32_t>(buffer_ + label->pos());
-    *reinterpret_cast<uint32_t*>(pc_) = data;
-    pc_ += sizeof(uint32_t);
+    data = reinterpret_cast<uint32_t>(buffer_ + label->pos());
   } else {
-    uint32_t target_pos = jump_address(label);
-    emit(target_pos);
+    data = jump_address(label);
     internal_reference_positions_.insert(label->pos());
   }
+  *reinterpret_cast<uint32_t*>(pc_) = data;
+  pc_ += sizeof(uint32_t);
 }
 
 
index ee2daa45bb44cf980a5b919f7686af02426b3065..7a3091530336de4984369dbaa2fa7f69a0257722 100644 (file)
@@ -2756,15 +2756,15 @@ void Assembler::dd(uint32_t data) {
 void Assembler::dd(Label* label) {
   CheckBuffer();
   RecordRelocInfo(RelocInfo::INTERNAL_REFERENCE);
+  uint64_t data;
   if (label->is_bound()) {
-    uint64_t data = reinterpret_cast<uint64_t>(buffer_ + label->pos());
-    *reinterpret_cast<uint64_t*>(pc_) = data;
-    pc_ += sizeof(uint64_t);
+    data = reinterpret_cast<uint64_t>(buffer_ + label->pos());
   } else {
-    uint64_t target_pos = jump_address(label);
-    emit(target_pos);
+    data = jump_address(label);
     internal_reference_positions_.insert(label->pos());
   }
+  *reinterpret_cast<uint64_t*>(pc_) = data;
+  pc_ += sizeof(uint64_t);
 }