OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 | 298 |
299 void Save(MacroAssembler* masm) { | 299 void Save(MacroAssembler* masm) { |
300 ASSERT(!address_orig_.is(object_)); | 300 ASSERT(!address_orig_.is(object_)); |
301 ASSERT(object_.is(object_orig_) || address_.is(address_orig_)); | 301 ASSERT(object_.is(object_orig_) || address_.is(address_orig_)); |
302 ASSERT(!AreAliased(object_, address_, scratch1_, scratch0_)); | 302 ASSERT(!AreAliased(object_, address_, scratch1_, scratch0_)); |
303 ASSERT(!AreAliased(object_orig_, address_, scratch1_, scratch0_)); | 303 ASSERT(!AreAliased(object_orig_, address_, scratch1_, scratch0_)); |
304 ASSERT(!AreAliased(object_, address_orig_, scratch1_, scratch0_)); | 304 ASSERT(!AreAliased(object_, address_orig_, scratch1_, scratch0_)); |
305 // We don't have to save scratch0_orig_ because it was given to us as | 305 // We don't have to save scratch0_orig_ because it was given to us as |
306 // a scratch register. But if we had to switch to a different reg then | 306 // a scratch register. But if we had to switch to a different reg then |
307 // we should save the new scratch0_. | 307 // we should save the new scratch0_. |
308 if (!scratch0_.is(scratch0_orig_)) masm->push(scratch0_); | 308 if (!scratch0_.is(scratch0_orig_)) masm->Push(scratch0_); |
309 if (!rcx.is(scratch0_orig_) && | 309 if (!rcx.is(scratch0_orig_) && |
310 !rcx.is(object_orig_) && | 310 !rcx.is(object_orig_) && |
311 !rcx.is(address_orig_)) { | 311 !rcx.is(address_orig_)) { |
312 masm->push(rcx); | 312 masm->Push(rcx); |
313 } | 313 } |
314 masm->push(scratch1_); | 314 masm->Push(scratch1_); |
315 if (!address_.is(address_orig_)) { | 315 if (!address_.is(address_orig_)) { |
316 masm->push(address_); | 316 masm->Push(address_); |
317 masm->movp(address_, address_orig_); | 317 masm->movp(address_, address_orig_); |
318 } | 318 } |
319 if (!object_.is(object_orig_)) { | 319 if (!object_.is(object_orig_)) { |
320 masm->push(object_); | 320 masm->Push(object_); |
321 masm->movp(object_, object_orig_); | 321 masm->movp(object_, object_orig_); |
322 } | 322 } |
323 } | 323 } |
324 | 324 |
325 void Restore(MacroAssembler* masm) { | 325 void Restore(MacroAssembler* masm) { |
326 // These will have been preserved the entire time, so we just need to move | 326 // These will have been preserved the entire time, so we just need to move |
327 // them back. Only in one case is the orig_ reg different from the plain | 327 // them back. Only in one case is the orig_ reg different from the plain |
328 // one, since only one of them can alias with rcx. | 328 // one, since only one of them can alias with rcx. |
329 if (!object_.is(object_orig_)) { | 329 if (!object_.is(object_orig_)) { |
330 masm->movp(object_orig_, object_); | 330 masm->movp(object_orig_, object_); |
331 masm->pop(object_); | 331 masm->Pop(object_); |
332 } | 332 } |
333 if (!address_.is(address_orig_)) { | 333 if (!address_.is(address_orig_)) { |
334 masm->movp(address_orig_, address_); | 334 masm->movp(address_orig_, address_); |
335 masm->pop(address_); | 335 masm->Pop(address_); |
336 } | 336 } |
337 masm->pop(scratch1_); | 337 masm->Pop(scratch1_); |
338 if (!rcx.is(scratch0_orig_) && | 338 if (!rcx.is(scratch0_orig_) && |
339 !rcx.is(object_orig_) && | 339 !rcx.is(object_orig_) && |
340 !rcx.is(address_orig_)) { | 340 !rcx.is(address_orig_)) { |
341 masm->pop(rcx); | 341 masm->Pop(rcx); |
342 } | 342 } |
343 if (!scratch0_.is(scratch0_orig_)) masm->pop(scratch0_); | 343 if (!scratch0_.is(scratch0_orig_)) masm->Pop(scratch0_); |
344 } | 344 } |
345 | 345 |
346 // If we have to call into C then we need to save and restore all caller- | 346 // If we have to call into C then we need to save and restore all caller- |
347 // saved registers that were not already preserved. | 347 // saved registers that were not already preserved. |
348 | 348 |
349 // The three scratch registers (incl. rcx) will be restored by other means | 349 // The three scratch registers (incl. rcx) will be restored by other means |
350 // so we don't bother pushing them here. Rbx, rbp and r12-15 are callee | 350 // so we don't bother pushing them here. Rbx, rbp and r12-15 are callee |
351 // save and don't need to be preserved. | 351 // save and don't need to be preserved. |
352 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { | 352 void SaveCallerSaveRegisters(MacroAssembler* masm, SaveFPRegsMode mode) { |
353 masm->PushCallerSaved(mode, scratch0_, scratch1_, rcx); | 353 masm->PushCallerSaved(mode, scratch0_, scratch1_, rcx); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 RememberedSetAction remembered_set_action_; | 429 RememberedSetAction remembered_set_action_; |
430 SaveFPRegsMode save_fp_regs_mode_; | 430 SaveFPRegsMode save_fp_regs_mode_; |
431 Label slow_; | 431 Label slow_; |
432 RegisterAllocation regs_; | 432 RegisterAllocation regs_; |
433 }; | 433 }; |
434 | 434 |
435 | 435 |
436 } } // namespace v8::internal | 436 } } // namespace v8::internal |
437 | 437 |
438 #endif // V8_X64_CODE_STUBS_X64_H_ | 438 #endif // V8_X64_CODE_STUBS_X64_H_ |
OLD | NEW |