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

Side by Side Diff: src/assembler-ia32-inl.h

Issue 13783: * Made preemption work in Irregexp-native-ia32 (Closed)
Patch Set: Addressed review comments Created 12 years 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
« no previous file with comments | « src/assembler-ia32.cc ('k') | src/execution.h » ('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) 1994-2006 Sun Microsystems Inc. 1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved. 2 // All Rights Reserved.
3 // 3 //
4 // Redistribution and use in source and binary forms, with or without 4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are 5 // modification, are permitted provided that the following conditions are
6 // met: 6 // met:
7 // 7 //
8 // - Redistributions of source code must retain the above copyright notice, 8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer. 9 // this list of conditions and the following disclaimer.
10 // 10 //
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 x_ = reinterpret_cast<int32_t>(ext.address()); 145 x_ = reinterpret_cast<int32_t>(ext.address());
146 rmode_ = RelocInfo::EXTERNAL_REFERENCE; 146 rmode_ = RelocInfo::EXTERNAL_REFERENCE;
147 } 147 }
148 148
149 Immediate::Immediate(const char* s) { 149 Immediate::Immediate(const char* s) {
150 x_ = reinterpret_cast<int32_t>(s); 150 x_ = reinterpret_cast<int32_t>(s);
151 rmode_ = RelocInfo::EMBEDDED_STRING; 151 rmode_ = RelocInfo::EMBEDDED_STRING;
152 } 152 }
153 153
154 154
155 Immediate::Immediate(Label *internal_offset) {
156 x_ = reinterpret_cast<int32_t>(internal_offset);
157 rmode_ = RelocInfo::INTERNAL_REFERENCE;
158 }
159
160
155 Immediate::Immediate(Handle<Object> handle) { 161 Immediate::Immediate(Handle<Object> handle) {
156 // Verify all Objects referred by code are NOT in new space. 162 // Verify all Objects referred by code are NOT in new space.
157 Object* obj = *handle; 163 Object* obj = *handle;
158 ASSERT(!Heap::InNewSpace(obj)); 164 ASSERT(!Heap::InNewSpace(obj));
159 if (obj->IsHeapObject()) { 165 if (obj->IsHeapObject()) {
160 x_ = reinterpret_cast<intptr_t>(handle.location()); 166 x_ = reinterpret_cast<intptr_t>(handle.location());
161 rmode_ = RelocInfo::EMBEDDED_OBJECT; 167 rmode_ = RelocInfo::EMBEDDED_OBJECT;
162 } else { 168 } else {
163 // no relocation needed 169 // no relocation needed
164 x_ = reinterpret_cast<intptr_t>(obj); 170 x_ = reinterpret_cast<intptr_t>(obj);
(...skipping 28 matching lines...) Expand all
193 } 199 }
194 200
195 201
196 void Assembler::emit(uint32_t x, RelocInfo::Mode rmode) { 202 void Assembler::emit(uint32_t x, RelocInfo::Mode rmode) {
197 if (rmode != RelocInfo::NONE) RecordRelocInfo(rmode); 203 if (rmode != RelocInfo::NONE) RecordRelocInfo(rmode);
198 emit(x); 204 emit(x);
199 } 205 }
200 206
201 207
202 void Assembler::emit(const Immediate& x) { 208 void Assembler::emit(const Immediate& x) {
209 if (x.rmode_ == RelocInfo::INTERNAL_REFERENCE) {
210 Label* label = reinterpret_cast<Label*>(x.x_);
211 emit_code_relative_offset(label);
212 return;
213 }
203 if (x.rmode_ != RelocInfo::NONE) RecordRelocInfo(x.rmode_); 214 if (x.rmode_ != RelocInfo::NONE) RecordRelocInfo(x.rmode_);
204 emit(x.x_); 215 emit(x.x_);
205 } 216 }
206 217
207 218
219 void Assembler::emit_code_relative_offset(Label* label) {
220 if (label->is_bound()) {
221 int32_t pos;
222 pos = label->pos() + Code::kHeaderSize - kHeapObjectTag;
223 emit(pos);
224 } else {
225 emit_disp(label, Displacement::CODE_RELATIVE);
226 }
227 }
228
229
208 void Assembler::emit_w(const Immediate& x) { 230 void Assembler::emit_w(const Immediate& x) {
209 ASSERT(x.rmode_ == RelocInfo::NONE); 231 ASSERT(x.rmode_ == RelocInfo::NONE);
210 uint16_t value = static_cast<uint16_t>(x.x_); 232 uint16_t value = static_cast<uint16_t>(x.x_);
211 reinterpret_cast<uint16_t*>(pc_)[0] = value; 233 reinterpret_cast<uint16_t*>(pc_)[0] = value;
212 pc_ += sizeof(uint16_t); 234 pc_ += sizeof(uint16_t);
213 } 235 }
214 236
215 237
216 Address Assembler::target_address_at(Address pc) { 238 Address Assembler::target_address_at(Address pc) {
217 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc); 239 return pc + sizeof(int32_t) + *reinterpret_cast<int32_t*>(pc);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 287
266 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) { 288 Operand::Operand(int32_t disp, RelocInfo::Mode rmode) {
267 // [disp/r] 289 // [disp/r]
268 set_modrm(0, ebp); 290 set_modrm(0, ebp);
269 set_dispr(disp, rmode); 291 set_dispr(disp, rmode);
270 } 292 }
271 293
272 } } // namespace v8::internal 294 } } // namespace v8::internal
273 295
274 #endif // V8_ASSEMBLER_IA32_INL_H_ 296 #endif // V8_ASSEMBLER_IA32_INL_H_
OLDNEW
« no previous file with comments | « src/assembler-ia32.cc ('k') | src/execution.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698