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

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 6683022: [Isolates] Merge 7111:7152 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: Created 9 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 | « src/x64/macro-assembler-x64.h ('k') | src/x64/register-allocator-x64-inl.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 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 next_address); 549 next_address);
550 const int kLevelOffset = Offset( 550 const int kLevelOffset = Offset(
551 ExternalReference::handle_scope_level_address(), 551 ExternalReference::handle_scope_level_address(),
552 next_address); 552 next_address);
553 ExternalReference scheduled_exception_address = 553 ExternalReference scheduled_exception_address =
554 ExternalReference::scheduled_exception_address(); 554 ExternalReference::scheduled_exception_address();
555 555
556 // Allocate HandleScope in callee-save registers. 556 // Allocate HandleScope in callee-save registers.
557 Register prev_next_address_reg = r14; 557 Register prev_next_address_reg = r14;
558 Register prev_limit_reg = rbx; 558 Register prev_limit_reg = rbx;
559 Register base_reg = r12; 559 Register base_reg = r15;
560 movq(base_reg, next_address); 560 movq(base_reg, next_address);
561 movq(prev_next_address_reg, Operand(base_reg, kNextOffset)); 561 movq(prev_next_address_reg, Operand(base_reg, kNextOffset));
562 movq(prev_limit_reg, Operand(base_reg, kLimitOffset)); 562 movq(prev_limit_reg, Operand(base_reg, kLimitOffset));
563 addl(Operand(base_reg, kLevelOffset), Immediate(1)); 563 addl(Operand(base_reg, kLevelOffset), Immediate(1));
564 // Call the api function! 564 // Call the api function!
565 movq(rax, 565 movq(rax,
566 reinterpret_cast<int64_t>(function->address()), 566 reinterpret_cast<int64_t>(function->address()),
567 RelocInfo::RUNTIME_ENTRY); 567 RelocInfo::RUNTIME_ENTRY);
568 call(rax); 568 call(rax);
569 569
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 cmpq(dst, kSmiConstantRegister); 720 cmpq(dst, kSmiConstantRegister);
721 if (allow_stub_calls()) { 721 if (allow_stub_calls()) {
722 Assert(equal, "Uninitialized kSmiConstantRegister"); 722 Assert(equal, "Uninitialized kSmiConstantRegister");
723 } else { 723 } else {
724 NearLabel ok; 724 NearLabel ok;
725 j(equal, &ok); 725 j(equal, &ok);
726 int3(); 726 int3();
727 bind(&ok); 727 bind(&ok);
728 } 728 }
729 } 729 }
730 if (source->value() == 0) { 730 int value = source->value();
731 if (value == 0) {
731 xorl(dst, dst); 732 xorl(dst, dst);
732 return; 733 return;
733 } 734 }
734 int value = source->value();
735 bool negative = value < 0; 735 bool negative = value < 0;
736 unsigned int uvalue = negative ? -value : value; 736 unsigned int uvalue = negative ? -value : value;
737 737
738 switch (uvalue) { 738 switch (uvalue) {
739 case 9: 739 case 9:
740 lea(dst, Operand(kSmiConstantRegister, kSmiConstantRegister, times_8, 0)); 740 lea(dst, Operand(kSmiConstantRegister, kSmiConstantRegister, times_8, 0));
741 break; 741 break;
742 case 8: 742 case 8:
743 xorl(dst, dst); 743 xorl(dst, dst);
744 lea(dst, Operand(dst, kSmiConstantRegister, times_8, 0)); 744 lea(dst, Operand(dst, kSmiConstantRegister, times_8, 0));
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
1473 push(rcx); 1473 push(rcx);
1474 push(rdx); 1474 push(rdx);
1475 push(rbx); 1475 push(rbx);
1476 // Not pushing rsp or rbp. 1476 // Not pushing rsp or rbp.
1477 push(rsi); 1477 push(rsi);
1478 push(rdi); 1478 push(rdi);
1479 push(r8); 1479 push(r8);
1480 push(r9); 1480 push(r9);
1481 // r10 is kScratchRegister. 1481 // r10 is kScratchRegister.
1482 push(r11); 1482 push(r11);
1483 push(r12); 1483 // r12 is kSmiConstantRegister.
1484 // r13 is kRootRegister. 1484 // r13 is kRootRegister.
1485 push(r14); 1485 push(r14);
1486 // r15 is kSmiConstantRegister 1486 push(r15);
1487 STATIC_ASSERT(11 == kNumSafepointSavedRegisters); 1487 STATIC_ASSERT(11 == kNumSafepointSavedRegisters);
1488 // Use lea for symmetry with Popad. 1488 // Use lea for symmetry with Popad.
1489 int sp_delta = 1489 int sp_delta =
1490 (kNumSafepointRegisters - kNumSafepointSavedRegisters) * kPointerSize; 1490 (kNumSafepointRegisters - kNumSafepointSavedRegisters) * kPointerSize;
1491 lea(rsp, Operand(rsp, -sp_delta)); 1491 lea(rsp, Operand(rsp, -sp_delta));
1492 } 1492 }
1493 1493
1494 1494
1495 void MacroAssembler::Popad() { 1495 void MacroAssembler::Popad() {
1496 // Popad must not change the flags, so use lea instead of addq. 1496 // Popad must not change the flags, so use lea instead of addq.
1497 int sp_delta = 1497 int sp_delta =
1498 (kNumSafepointRegisters - kNumSafepointSavedRegisters) * kPointerSize; 1498 (kNumSafepointRegisters - kNumSafepointSavedRegisters) * kPointerSize;
1499 lea(rsp, Operand(rsp, sp_delta)); 1499 lea(rsp, Operand(rsp, sp_delta));
1500 pop(r15);
1500 pop(r14); 1501 pop(r14);
1501 pop(r12);
1502 pop(r11); 1502 pop(r11);
1503 pop(r9); 1503 pop(r9);
1504 pop(r8); 1504 pop(r8);
1505 pop(rdi); 1505 pop(rdi);
1506 pop(rsi); 1506 pop(rsi);
1507 pop(rbx); 1507 pop(rbx);
1508 pop(rdx); 1508 pop(rdx);
1509 pop(rcx); 1509 pop(rcx);
1510 pop(rax); 1510 pop(rax);
1511 } 1511 }
1512 1512
1513 1513
1514 void MacroAssembler::Dropad() { 1514 void MacroAssembler::Dropad() {
1515 addq(rsp, Immediate(kNumSafepointRegisters * kPointerSize)); 1515 addq(rsp, Immediate(kNumSafepointRegisters * kPointerSize));
1516 } 1516 }
1517 1517
1518 1518
1519 // Order general registers are pushed by Pushad: 1519 // Order general registers are pushed by Pushad:
1520 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r12, r14. 1520 // rax, rcx, rdx, rbx, rsi, rdi, r8, r9, r11, r14, r15.
1521 int MacroAssembler::kSafepointPushRegisterIndices[Register::kNumRegisters] = { 1521 int MacroAssembler::kSafepointPushRegisterIndices[Register::kNumRegisters] = {
1522 0, 1522 0,
1523 1, 1523 1,
1524 2, 1524 2,
1525 3, 1525 3,
1526 -1, 1526 -1,
1527 -1, 1527 -1,
1528 4, 1528 4,
1529 5, 1529 5,
1530 6, 1530 6,
1531 7, 1531 7,
1532 -1, 1532 -1,
1533 8, 1533 8,
1534 -1,
1535 -1,
1534 9, 1536 9,
1535 -1, 1537 10
1536 10,
1537 -1
1538 }; 1538 };
1539 1539
1540 1540
1541 void MacroAssembler::StoreToSafepointRegisterSlot(Register dst, Register src) { 1541 void MacroAssembler::StoreToSafepointRegisterSlot(Register dst, Register src) {
1542 movq(SafepointRegisterSlot(dst), src); 1542 movq(SafepointRegisterSlot(dst), src);
1543 } 1543 }
1544 1544
1545 1545
1546 void MacroAssembler::LoadFromSafepointRegisterSlot(Register dst, Register src) { 1546 void MacroAssembler::LoadFromSafepointRegisterSlot(Register dst, Register src) {
1547 movq(dst, SafepointRegisterSlot(src)); 1547 movq(dst, SafepointRegisterSlot(src));
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
2077 } 2077 }
2078 2078
2079 // Patch the saved entry sp. 2079 // Patch the saved entry sp.
2080 movq(Operand(rbp, ExitFrameConstants::kSPOffset), rsp); 2080 movq(Operand(rbp, ExitFrameConstants::kSPOffset), rsp);
2081 } 2081 }
2082 2082
2083 2083
2084 void MacroAssembler::EnterExitFrame(int arg_stack_space, bool save_doubles) { 2084 void MacroAssembler::EnterExitFrame(int arg_stack_space, bool save_doubles) {
2085 EnterExitFramePrologue(true); 2085 EnterExitFramePrologue(true);
2086 2086
2087 // Setup argv in callee-saved register r12. It is reused in LeaveExitFrame, 2087 // Setup argv in callee-saved register r15. It is reused in LeaveExitFrame,
2088 // so it must be retained across the C-call. 2088 // so it must be retained across the C-call.
2089 int offset = StandardFrameConstants::kCallerSPOffset - kPointerSize; 2089 int offset = StandardFrameConstants::kCallerSPOffset - kPointerSize;
2090 lea(r12, Operand(rbp, r14, times_pointer_size, offset)); 2090 lea(r15, Operand(rbp, r14, times_pointer_size, offset));
2091 2091
2092 EnterExitFrameEpilogue(arg_stack_space, save_doubles); 2092 EnterExitFrameEpilogue(arg_stack_space, save_doubles);
2093 } 2093 }
2094 2094
2095 2095
2096 void MacroAssembler::EnterApiExitFrame(int arg_stack_space) { 2096 void MacroAssembler::EnterApiExitFrame(int arg_stack_space) {
2097 EnterExitFramePrologue(false); 2097 EnterExitFramePrologue(false);
2098 EnterExitFrameEpilogue(arg_stack_space, false); 2098 EnterExitFrameEpilogue(arg_stack_space, false);
2099 } 2099 }
2100 2100
2101 2101
2102 void MacroAssembler::LeaveExitFrame(bool save_doubles) { 2102 void MacroAssembler::LeaveExitFrame(bool save_doubles) {
2103 // Registers: 2103 // Registers:
2104 // r12 : argv 2104 // r15 : argv
2105 if (save_doubles) { 2105 if (save_doubles) {
2106 int offset = -2 * kPointerSize; 2106 int offset = -2 * kPointerSize;
2107 for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; i++) { 2107 for (int i = 0; i < XMMRegister::kNumAllocatableRegisters; i++) {
2108 XMMRegister reg = XMMRegister::FromAllocationIndex(i); 2108 XMMRegister reg = XMMRegister::FromAllocationIndex(i);
2109 movsd(reg, Operand(rbp, offset - ((i + 1) * kDoubleSize))); 2109 movsd(reg, Operand(rbp, offset - ((i + 1) * kDoubleSize)));
2110 } 2110 }
2111 } 2111 }
2112 // Get the return address from the stack and restore the frame pointer. 2112 // Get the return address from the stack and restore the frame pointer.
2113 movq(rcx, Operand(rbp, 1 * kPointerSize)); 2113 movq(rcx, Operand(rbp, 1 * kPointerSize));
2114 movq(rbp, Operand(rbp, 0 * kPointerSize)); 2114 movq(rbp, Operand(rbp, 0 * kPointerSize));
2115 2115
2116 // Drop everything up to and including the arguments and the receiver 2116 // Drop everything up to and including the arguments and the receiver
2117 // from the caller stack. 2117 // from the caller stack.
2118 lea(rsp, Operand(r12, 1 * kPointerSize)); 2118 lea(rsp, Operand(r15, 1 * kPointerSize));
2119 2119
2120 // Push the return address to get ready to return. 2120 // Push the return address to get ready to return.
2121 push(rcx); 2121 push(rcx);
2122 2122
2123 LeaveExitFrameEpilogue(); 2123 LeaveExitFrameEpilogue();
2124 } 2124 }
2125 2125
2126 2126
2127 void MacroAssembler::LeaveApiExitFrame() { 2127 void MacroAssembler::LeaveApiExitFrame() {
2128 movq(rsp, rbp); 2128 movq(rsp, rbp);
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
2722 CPU::FlushICache(address_, size_); 2722 CPU::FlushICache(address_, size_);
2723 2723
2724 // Check that the code was patched as expected. 2724 // Check that the code was patched as expected.
2725 ASSERT(masm_.pc_ == address_ + size_); 2725 ASSERT(masm_.pc_ == address_ + size_);
2726 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2726 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2727 } 2727 }
2728 2728
2729 } } // namespace v8::internal 2729 } } // namespace v8::internal
2730 2730
2731 #endif // V8_TARGET_ARCH_X64 2731 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | src/x64/register-allocator-x64-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698