OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 488 |
489 | 489 |
490 void MacroAssembler::Abort(const char* msg) { | 490 void MacroAssembler::Abort(const char* msg) { |
491 // We want to pass the msg string like a smi to avoid GC | 491 // We want to pass the msg string like a smi to avoid GC |
492 // problems, however msg is not guaranteed to be aligned | 492 // problems, however msg is not guaranteed to be aligned |
493 // properly. Instead, we pass an aligned pointer that is | 493 // properly. Instead, we pass an aligned pointer that is |
494 // a proper v8 smi, but also pass the alignment difference | 494 // a proper v8 smi, but also pass the alignment difference |
495 // from the real pointer as a smi. | 495 // from the real pointer as a smi. |
496 intptr_t p1 = reinterpret_cast<intptr_t>(msg); | 496 intptr_t p1 = reinterpret_cast<intptr_t>(msg); |
497 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; | 497 intptr_t p0 = (p1 & ~kSmiTagMask) + kSmiTag; |
498 // Note: p0 might not be a valid Smi *value*, but it has a valid Smi tag. | 498 // Note: p0 might not be a valid Smi _value_, but it has a valid Smi tag. |
499 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); | 499 ASSERT(reinterpret_cast<Object*>(p0)->IsSmi()); |
500 #ifdef DEBUG | 500 #ifdef DEBUG |
501 if (msg != NULL) { | 501 if (msg != NULL) { |
502 RecordComment("Abort message: "); | 502 RecordComment("Abort message: "); |
503 RecordComment(msg); | 503 RecordComment(msg); |
504 } | 504 } |
505 #endif | 505 #endif |
506 push(rax); | 506 push(rax); |
507 movq(kScratchRegister, p0, RelocInfo::NONE); | 507 movq(kScratchRegister, p0, RelocInfo::NONE); |
508 push(kScratchRegister); | 508 push(kScratchRegister); |
(...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3224 Move(kScratchRegister, Smi::FromInt(type)); | 3224 Move(kScratchRegister, Smi::FromInt(type)); |
3225 cmpq(Operand(rbp, StandardFrameConstants::kMarkerOffset), kScratchRegister); | 3225 cmpq(Operand(rbp, StandardFrameConstants::kMarkerOffset), kScratchRegister); |
3226 Check(equal, "stack frame types must match"); | 3226 Check(equal, "stack frame types must match"); |
3227 } | 3227 } |
3228 movq(rsp, rbp); | 3228 movq(rsp, rbp); |
3229 pop(rbp); | 3229 pop(rbp); |
3230 } | 3230 } |
3231 | 3231 |
3232 | 3232 |
3233 void MacroAssembler::EnterExitFramePrologue(bool save_rax) { | 3233 void MacroAssembler::EnterExitFramePrologue(bool save_rax) { |
3234 // Setup the frame structure on the stack. | 3234 // Set up the frame structure on the stack. |
3235 // All constants are relative to the frame pointer of the exit frame. | 3235 // All constants are relative to the frame pointer of the exit frame. |
3236 ASSERT(ExitFrameConstants::kCallerSPDisplacement == +2 * kPointerSize); | 3236 ASSERT(ExitFrameConstants::kCallerSPDisplacement == +2 * kPointerSize); |
3237 ASSERT(ExitFrameConstants::kCallerPCOffset == +1 * kPointerSize); | 3237 ASSERT(ExitFrameConstants::kCallerPCOffset == +1 * kPointerSize); |
3238 ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); | 3238 ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); |
3239 push(rbp); | 3239 push(rbp); |
3240 movq(rbp, rsp); | 3240 movq(rbp, rsp); |
3241 | 3241 |
3242 // Reserve room for entry stack pointer and push the code object. | 3242 // Reserve room for entry stack pointer and push the code object. |
3243 ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize); | 3243 ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize); |
3244 push(Immediate(0)); // Saved entry sp, patched before call. | 3244 push(Immediate(0)); // Saved entry sp, patched before call. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3284 } | 3284 } |
3285 | 3285 |
3286 // Patch the saved entry sp. | 3286 // Patch the saved entry sp. |
3287 movq(Operand(rbp, ExitFrameConstants::kSPOffset), rsp); | 3287 movq(Operand(rbp, ExitFrameConstants::kSPOffset), rsp); |
3288 } | 3288 } |
3289 | 3289 |
3290 | 3290 |
3291 void MacroAssembler::EnterExitFrame(int arg_stack_space, bool save_doubles) { | 3291 void MacroAssembler::EnterExitFrame(int arg_stack_space, bool save_doubles) { |
3292 EnterExitFramePrologue(true); | 3292 EnterExitFramePrologue(true); |
3293 | 3293 |
3294 // Setup argv in callee-saved register r15. It is reused in LeaveExitFrame, | 3294 // Set up argv in callee-saved register r15. It is reused in LeaveExitFrame, |
3295 // so it must be retained across the C-call. | 3295 // so it must be retained across the C-call. |
3296 int offset = StandardFrameConstants::kCallerSPOffset - kPointerSize; | 3296 int offset = StandardFrameConstants::kCallerSPOffset - kPointerSize; |
3297 lea(r15, Operand(rbp, r14, times_pointer_size, offset)); | 3297 lea(r15, Operand(rbp, r14, times_pointer_size, offset)); |
3298 | 3298 |
3299 EnterExitFrameEpilogue(arg_stack_space, save_doubles); | 3299 EnterExitFrameEpilogue(arg_stack_space, save_doubles); |
3300 } | 3300 } |
3301 | 3301 |
3302 | 3302 |
3303 void MacroAssembler::EnterApiExitFrame(int arg_stack_space) { | 3303 void MacroAssembler::EnterApiExitFrame(int arg_stack_space) { |
3304 EnterExitFramePrologue(false); | 3304 EnterExitFramePrologue(false); |
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4325 | 4325 |
4326 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); | 4326 and_(bitmap_scratch, Immediate(~Page::kPageAlignmentMask)); |
4327 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); | 4327 addl(Operand(bitmap_scratch, MemoryChunk::kLiveBytesOffset), length); |
4328 | 4328 |
4329 bind(&done); | 4329 bind(&done); |
4330 } | 4330 } |
4331 | 4331 |
4332 } } // namespace v8::internal | 4332 } } // namespace v8::internal |
4333 | 4333 |
4334 #endif // V8_TARGET_ARCH_X64 | 4334 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |