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

Side by Side Diff: runtime/vm/assembler_mips.cc

Issue 13094015: Simplifies MIPS LoadWordFromPoolOffset (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 9 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 | « runtime/vm/assembler_mips.h ('k') | runtime/vm/instructions_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
7 7
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 9
10 namespace dart { 10 namespace dart {
(...skipping 11 matching lines...) Expand all
22 } 22 }
23 } 23 }
24 24
25 25
26 void Assembler::Bind(Label* label) { 26 void Assembler::Bind(Label* label) {
27 ASSERT(!label->IsBound()); 27 ASSERT(!label->IsBound());
28 int bound_pc = buffer_.Size(); 28 int bound_pc = buffer_.Size();
29 while (label->IsLinked()) { 29 while (label->IsLinked()) {
30 const int32_t position = label->Position(); 30 const int32_t position = label->Position();
31 const int32_t next = buffer_.Load<int32_t>(position); 31 const int32_t next = buffer_.Load<int32_t>(position);
32 // Reletive destination from an instruction after the branch. 32 // Relative destination from an instruction after the branch.
33 const int32_t dest = bound_pc - (position + Instr::kInstrSize); 33 const int32_t dest = bound_pc - (position + Instr::kInstrSize);
34 const int32_t encoded = Assembler::EncodeBranchOffset(dest, next); 34 const int32_t encoded = Assembler::EncodeBranchOffset(dest, next);
35 buffer_.Store<int32_t>(position, encoded); 35 buffer_.Store<int32_t>(position, encoded);
36 label->position_ = Assembler::DecodeBranchOffset(next); 36 label->position_ = Assembler::DecodeBranchOffset(next);
37 } 37 }
38 label->BindTo(bound_pc); 38 label->BindTo(bound_pc);
39 delay_slot_available_ = false; 39 delay_slot_available_ = false;
40 } 40 }
41 41
42 42
(...skipping 12 matching lines...) Expand all
55 // Sign-extend, left-shift by 2. 55 // Sign-extend, left-shift by 2.
56 return (((instr & kBranchOffsetMask) << 16) >> 14); 56 return (((instr & kBranchOffsetMask) << 16) >> 14);
57 } 57 }
58 58
59 59
60 void Assembler::LoadWordFromPoolOffset(Register rd, int32_t offset) { 60 void Assembler::LoadWordFromPoolOffset(Register rd, int32_t offset) {
61 ASSERT(rd != PP); 61 ASSERT(rd != PP);
62 if (Address::CanHoldOffset(offset)) { 62 if (Address::CanHoldOffset(offset)) {
63 lw(rd, Address(PP, offset)); 63 lw(rd, Address(PP, offset));
64 } else { 64 } else {
65 const uint16_t offset_low = Utils::Low16Bits(offset); 65 const int16_t offset_low = Utils::Low16Bits(offset); // Signed.
66 const uint16_t offset_high = Utils::High16Bits(offset); 66 offset -= offset_low;
67 const uint16_t offset_high = Utils::High16Bits(offset); // Unsigned.
67 if (offset_high != 0) { 68 if (offset_high != 0) {
68 lui(rd, Immediate(offset_high)); 69 lui(rd, Immediate(offset_high));
69 if (Address::CanHoldOffset(offset_low)) { 70 addu(rd, rd, PP);
70 addu(rd, rd, PP); 71 lw(rd, Address(rd, offset_low));
71 lw(rd, Address(rd, offset_low));
72 } else {
73 ori(rd, rd, Immediate(offset_low));
74 addu(rd, rd, PP);
75 lw(rd, Address(rd));
76 }
77 } else { 72 } else {
78 ori(rd, ZR, Immediate(offset_low)); 73 lw(rd, Address(PP, offset_low));
79 addu(rd, rd, PP);
80 lw(rd, Address(rd));
81 } 74 }
82 } 75 }
83 } 76 }
84 77
85 78
86 int32_t Assembler::AddObject(const Object& obj) { 79 int32_t Assembler::AddObject(const Object& obj) {
87 ASSERT(obj.IsNotTemporaryScopedHandle()); 80 ASSERT(obj.IsNotTemporaryScopedHandle());
88 ASSERT(obj.IsOld()); 81 ASSERT(obj.IsOld());
89 if (object_pool_.IsNull()) { 82 if (object_pool_.IsNull()) {
90 // The object pool cannot be used in the vm isolate. 83 // The object pool cannot be used in the vm isolate.
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 b(&stop); 119 b(&stop);
127 Emit(reinterpret_cast<int32_t>(message)); 120 Emit(reinterpret_cast<int32_t>(message));
128 Bind(&stop); 121 Bind(&stop);
129 break_(Instr::kStopMessageCode); 122 break_(Instr::kStopMessageCode);
130 } 123 }
131 124
132 } // namespace dart 125 } // namespace dart
133 126
134 #endif // defined TARGET_ARCH_MIPS 127 #endif // defined TARGET_ARCH_MIPS
135 128
OLDNEW
« no previous file with comments | « runtime/vm/assembler_mips.h ('k') | runtime/vm/instructions_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698