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 ApiFunction dispatcher(reinterpret_cast<Address>(EntryHookTrampoline)); | |
7558 __ mov(ip, Operand(ExternalReference(&dispatcher, | |
7559 ExternalReference::BUILTIN_CALL, | |
7560 masm->isolate()))); | |
7561 #endif | |
7562 __ Call(ip); | |
7563 | |
7564 // Restore the stack pointer if needed. | |
7565 if (frame_alignment > kPointerSize) | |
danno
2012/07/12 15:23:11
nit: in V8 we always surround if code that can't r
Sigurður Ásgeirsson
2012/07/12 15:38:54
Done.
| |
7566 __ mov(sp, r5); | |
7567 | |
7568 __ Pop(lr, r5, r1); | |
7569 __ Ret(); | |
7570 } | |
7571 | |
7516 #undef __ | 7572 #undef __ |
7517 | 7573 |
7518 } } // namespace v8::internal | 7574 } } // namespace v8::internal |
7519 | 7575 |
7520 #endif // V8_TARGET_ARCH_ARM | 7576 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |