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...) 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 // Live registers at this point are the same as at the start of any |
| 6435 // JS function: |
| 6436 // o rdi: the JS function object being called (i.e. ourselves) |
| 6437 // o rsi: our context |
| 6438 // o rbp: our caller's frame pointer |
| 6439 // o rsp: stack pointer (pointing to return address) |
| 6440 // o rcx: rcx is zero for method calls and non-zero for function calls. |
| 6441 #ifdef _WIN64 |
| 6442 const int kNumSavedRegisters = 1; |
| 6443 |
| 6444 __ push(rcx); |
| 6445 #else |
| 6446 const int kNumSavedRegisters = 3; |
| 6447 |
| 6448 __ push(rcx); |
| 6449 __ push(rdi); |
| 6450 __ push(rsi); |
| 6451 #endif |
| 6452 |
| 6453 // Calculate the original stack pointer and store it in the second arg. |
| 6454 #ifdef _WIN64 |
| 6455 __ lea(rdx, Operand(rsp, kNumSavedRegisters * kPointerSize)); |
| 6456 #else |
| 6457 __ lea(rsi, Operand(rsp, kNumSavedRegisters * kPointerSize)); |
| 6458 #endif |
| 6459 |
| 6460 // Calculate the function address to the first arg. |
| 6461 #ifdef _WIN64 |
| 6462 __ movq(rcx, Operand(rdx, 0)); |
| 6463 __ subq(rcx, Immediate(Assembler::kShortCallInstructionLength)); |
| 6464 #else |
| 6465 __ movq(rdi, Operand(rsi, 0)); |
| 6466 __ subq(rdi, Immediate(Assembler::kShortCallInstructionLength)); |
| 6467 #endif |
| 6468 |
| 6469 // Call the entry hook function. |
| 6470 __ movq(rax, &entry_hook_, RelocInfo::NONE); |
| 6471 __ movq(rax, Operand(rax, 0)); |
| 6472 |
| 6473 AllowExternalCallThatCantCauseGC scope(masm); |
| 6474 |
| 6475 const int kArgumentCount = 2; |
| 6476 __ PrepareCallCFunction(kArgumentCount); |
| 6477 __ CallCFunction(rax, kArgumentCount); |
| 6478 |
| 6479 // Restore volatile regs. |
| 6480 #ifdef _WIN64 |
| 6481 __ pop(rcx); |
| 6482 #else |
| 6483 __ pop(rsi); |
| 6484 __ pop(rdi); |
| 6485 __ pop(rcx); |
| 6486 #endif |
| 6487 |
| 6488 __ Ret(); |
| 6489 } |
| 6490 |
6423 #undef __ | 6491 #undef __ |
6424 | 6492 |
6425 } } // namespace v8::internal | 6493 } } // namespace v8::internal |
6426 | 6494 |
6427 #endif // V8_TARGET_ARCH_X64 | 6495 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |