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 7495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7506 __ Ret(); | 7506 __ Ret(); |
7507 | 7507 |
7508 // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. | 7508 // Array literal has ElementsKind of FAST_DOUBLE_ELEMENTS. |
7509 __ bind(&double_elements); | 7509 __ bind(&double_elements); |
7510 __ ldr(r5, FieldMemOperand(r1, JSObject::kElementsOffset)); | 7510 __ ldr(r5, FieldMemOperand(r1, JSObject::kElementsOffset)); |
7511 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r2, | 7511 __ StoreNumberToDoubleElements(r0, r3, r1, r5, r6, r7, r9, r2, |
7512 &slow_elements); | 7512 &slow_elements); |
7513 __ Ret(); | 7513 __ Ret(); |
7514 } | 7514 } |
7515 | 7515 |
7516 | |
7517 void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) { | |
7518 if (entry_hook_ != NULL) { | |
7519 ProfileEntryHookStub stub; | |
7520 __ push(lr); | |
7521 __ CallStub(&stub); | |
7522 __ pop(lr); | |
7523 } | |
7524 } | |
7525 | |
7526 | |
7527 void ProfileEntryHookStub::Generate(MacroAssembler* masm) { | |
7528 // The entry hook is a "push lr" instruction, followed by a call. | |
7529 const int32_t kReturnAddressDistanceFromFunctionStart = | |
7530 Assembler::kCallTargetAddressOffset + Assembler::kInstrSize; | |
7531 | |
7532 // Save live volatile registers. | |
7533 __ Push(lr, r5, r1); | |
7534 const int32_t kNumSavedRegs = 3; | |
7535 | |
7536 // Compute the function's address for the first argument. | |
7537 __ sub(r0, lr, Operand(kReturnAddressDistanceFromFunctionStart)); | |
7538 | |
7539 // The caller's return address is above the saved temporaries. | |
7540 // Grab that for the second argument to the hook. | |
7541 __ add(r1, sp, Operand(kNumSavedRegs * kPointerSize)); | |
7542 | |
7543 // Align the stack if necessary. | |
7544 int frame_alignment = masm->ActivationFrameAlignment(); | |
7545 if (frame_alignment > kPointerSize) { | |
7546 __ mov(r5, sp); | |
7547 ASSERT(IsPowerOf2(frame_alignment)); | |
7548 __ and_(sp, sp, Operand(-frame_alignment)); | |
7549 } | |
7550 | |
7551 #if defined(V8_HOST_ARCH_ARM) | |
7552 __ mov(ip, Operand(reinterpret_cast<int32_t>(&entry_hook_))); | |
7553 __ ldr(ip, MemOperand(ip)); | |
7554 #else | |
7555 // Under the simulator we need to indirect the entry hook through a | |
7556 // trampoline function at a known address. | |
7557 Address trampoline_address = reinterpret_cast<Address>( | |
7558 reinterpret_cast<intptr_t>(EntryHookTrampoline)); | |
7559 ApiFunction dispatcher(trampoline_address); | |
7560 __ mov(ip, Operand(ExternalReference(&dispatcher, | |
7561 ExternalReference::BUILTIN_CALL, | |
7562 masm->isolate()))); | |
7563 #endif | |
7564 __ Call(ip); | |
7565 | |
7566 // Restore the stack pointer if needed. | |
7567 if (frame_alignment > kPointerSize) { | |
7568 __ mov(sp, r5); | |
7569 } | |
7570 | |
7571 __ Pop(lr, r5, r1); | |
7572 __ Ret(); | |
7573 } | |
7574 | |
7575 #undef __ | 7516 #undef __ |
7576 | 7517 |
7577 } } // namespace v8::internal | 7518 } } // namespace v8::internal |
7578 | 7519 |
7579 #endif // V8_TARGET_ARCH_ARM | 7520 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |