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 6402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6413 __ movq(r9, FieldOperand(rbx, JSObject::kElementsOffset)); | 6413 __ movq(r9, FieldOperand(rbx, JSObject::kElementsOffset)); |
6414 __ SmiToInteger32(r11, rcx); | 6414 __ SmiToInteger32(r11, rcx); |
6415 __ StoreNumberToDoubleElements(rax, | 6415 __ StoreNumberToDoubleElements(rax, |
6416 r9, | 6416 r9, |
6417 r11, | 6417 r11, |
6418 xmm0, | 6418 xmm0, |
6419 &slow_elements); | 6419 &slow_elements); |
6420 __ ret(0); | 6420 __ ret(0); |
6421 } | 6421 } |
6422 | 6422 |
6423 | |
6424 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | |
6425 if (entry_hook_ != NULL) { | |
6426 ProfileEntryHookStub stub; | |
6427 masm->CallStub(&stub); | |
6428 } | |
6429 } | |
6430 | |
6431 | |
6432 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { | |
6433 // Save volatile registers. | |
6434 #ifdef _WIN64 | |
6435 const int kNumSavedRegisters = 1; | |
6436 | |
6437 __ push(rcx); | |
6438 #else | |
6439 const int kNumSavedRegisters = 3; | |
6440 | |
6441 __ push(rcx); | |
6442 __ push(rdi); | |
6443 __ push(rsi); | |
6444 #endif | |
6445 | |
6446 // Calculate the original stack pointer and store it in the second arg. | |
6447 #ifdef _WIN64 | |
6448 __ lea(rdx, Operand(rsp, kNumSavedRegisters * kPointerSize)); | |
6449 #else | |
6450 __ lea(rsi, Operand(rsp, kNumSavedRegisters * kPointerSize)); | |
6451 #endif | |
6452 | |
6453 // Calculate the function address to the first arg. | |
6454 #ifdef _WIN64 | |
6455 __ movq(rcx, Operand(rdx, 0)); | |
6456 __ subq(rcx, Immediate(Assembler::kShortCallInstructionLength)); | |
6457 #else | |
6458 __ movq(rdi, Operand(rsi, 0)); | |
6459 __ subq(rdi, Immediate(Assembler::kShortCallInstructionLength)); | |
6460 #endif | |
6461 | |
6462 // Reserve stack for the first 4 args and align the stack. | |
6463 __ movq(kScratchRegister, rsp); | |
6464 __ subq(rsp, Immediate(4 * kPointerSize)); | |
6465 int frame_alignment = OS::ActivationFrameAlignment(); | |
6466 ASSERT(IsPowerOf2(frame_alignment)); | |
6467 __ and_(rsp, Immediate(-frame_alignment)); | |
6468 | |
6469 // Call the entry hook. | |
6470 int64_t hook_location = reinterpret_cast<int64_t>(&entry_hook_); | |
6471 __ movq(rax, hook_location, RelocInfo::NONE); | |
6472 __ call(Operand(rax, 0)); | |
6473 __ movq(rsp, kScratchRegister); | |
6474 | |
6475 // Restore volatile regs. | |
6476 #ifdef _WIN64 | |
6477 __ pop(rcx); | |
6478 #else | |
6479 __ pop(rsi); | |
6480 __ pop(rdi); | |
6481 __ pop(rcx); | |
6482 #endif | |
6483 } | |
6484 | |
6485 #undef __ | 6423 #undef __ |
6486 | 6424 |
6487 } } // namespace v8::internal | 6425 } } // namespace v8::internal |
6488 | 6426 |
6489 #endif // V8_TARGET_ARCH_X64 | 6427 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |