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

Side by Side Diff: src/arm/code-stubs-arm.cc

Issue 7019010: Fix bug restoring of JS entry sp so to fix profiler-related valgrind issues. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 7 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 | « no previous file | src/frames.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 3546 matching lines...) Expand 10 before | Expand all | Expand 10 after
3557 __ mov(r5, 3557 __ mov(r5,
3558 Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate))); 3558 Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate)));
3559 __ ldr(r5, MemOperand(r5)); 3559 __ ldr(r5, MemOperand(r5));
3560 __ Push(r8, r7, r6, r5); 3560 __ Push(r8, r7, r6, r5);
3561 3561
3562 // Setup frame pointer for the frame to be pushed. 3562 // Setup frame pointer for the frame to be pushed.
3563 __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); 3563 __ add(fp, sp, Operand(-EntryFrameConstants::kCallerFPOffset));
3564 3564
3565 #ifdef ENABLE_LOGGING_AND_PROFILING 3565 #ifdef ENABLE_LOGGING_AND_PROFILING
3566 // If this is the outermost JS call, set js_entry_sp value. 3566 // If this is the outermost JS call, set js_entry_sp value.
3567 Label non_outermost_js;
3567 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate); 3568 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate);
3568 __ mov(r5, Operand(ExternalReference(js_entry_sp))); 3569 __ mov(r5, Operand(ExternalReference(js_entry_sp)));
3569 __ ldr(r6, MemOperand(r5)); 3570 __ ldr(r6, MemOperand(r5));
3570 __ cmp(r6, Operand(0, RelocInfo::NONE)); 3571 __ cmp(r6, Operand(0));
3571 __ str(fp, MemOperand(r5), eq); 3572 __ b(ne, &non_outermost_js);
3573 __ str(fp, MemOperand(r5));
3574 __ mov(ip, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)));
3575 Label cont;
3576 __ b(&cont);
3577 __ bind(&non_outermost_js);
3578 __ mov(ip, Operand(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME)));
3579 __ bind(&cont);
3580 __ push(ip);
3572 #endif 3581 #endif
3573 3582
3574 // Call a faked try-block that does the invoke. 3583 // Call a faked try-block that does the invoke.
3575 __ bl(&invoke); 3584 __ bl(&invoke);
3576 3585
3577 // Caught exception: Store result (exception) in the pending 3586 // Caught exception: Store result (exception) in the pending
3578 // exception field in the JSEnv and return a failure sentinel. 3587 // exception field in the JSEnv and return a failure sentinel.
3579 // Coming in here the fp will be invalid because the PushTryHandler below 3588 // Coming in here the fp will be invalid because the PushTryHandler below
3580 // sets it to 0 to signal the existence of the JSEntry frame. 3589 // sets it to 0 to signal the existence of the JSEntry frame.
3581 __ mov(ip, Operand(ExternalReference(Isolate::k_pending_exception_address, 3590 __ mov(ip, Operand(ExternalReference(Isolate::k_pending_exception_address,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3619 __ mov(ip, Operand(entry)); 3628 __ mov(ip, Operand(entry));
3620 } 3629 }
3621 __ ldr(ip, MemOperand(ip)); // deref address 3630 __ ldr(ip, MemOperand(ip)); // deref address
3622 3631
3623 // Branch and link to JSEntryTrampoline. We don't use the double underscore 3632 // Branch and link to JSEntryTrampoline. We don't use the double underscore
3624 // macro for the add instruction because we don't want the coverage tool 3633 // macro for the add instruction because we don't want the coverage tool
3625 // inserting instructions here after we read the pc. 3634 // inserting instructions here after we read the pc.
3626 __ mov(lr, Operand(pc)); 3635 __ mov(lr, Operand(pc));
3627 masm->add(pc, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); 3636 masm->add(pc, ip, Operand(Code::kHeaderSize - kHeapObjectTag));
3628 3637
3629 // Unlink this frame from the handler chain. When reading the 3638 // Unlink this frame from the handler chain.
3630 // address of the next handler, there is no need to use the address 3639 __ PopTryHandler();
3631 // displacement since the current stack pointer (sp) points directly
3632 // to the stack handler.
3633 __ ldr(r3, MemOperand(sp, StackHandlerConstants::kNextOffset));
3634 __ mov(ip, Operand(ExternalReference(Isolate::k_handler_address, isolate)));
3635 __ str(r3, MemOperand(ip));
3636 // No need to restore registers
3637 __ add(sp, sp, Operand(StackHandlerConstants::kSize));
3638 3640
3641 __ bind(&exit); // r0 holds result
3639 #ifdef ENABLE_LOGGING_AND_PROFILING 3642 #ifdef ENABLE_LOGGING_AND_PROFILING
3640 // If current FP value is the same as js_entry_sp value, it means that 3643 // Check if the current stack frame is marked as the outermost JS frame.
3641 // the current function is the outermost. 3644 Label non_outermost_js_2;
3645 __ pop(r5);
3646 __ cmp(r5, Operand(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)));
3647 __ b(ne, &non_outermost_js_2);
3648 __ mov(r6, Operand(0));
3642 __ mov(r5, Operand(ExternalReference(js_entry_sp))); 3649 __ mov(r5, Operand(ExternalReference(js_entry_sp)));
3643 __ ldr(r6, MemOperand(r5)); 3650 __ str(r6, MemOperand(r5));
3644 __ cmp(fp, Operand(r6)); 3651 __ bind(&non_outermost_js_2);
3645 __ mov(r6, Operand(0, RelocInfo::NONE), LeaveCC, eq);
3646 __ str(r6, MemOperand(r5), eq);
3647 #endif 3652 #endif
3648 3653
3649 __ bind(&exit); // r0 holds result
3650 // Restore the top frame descriptors from the stack. 3654 // Restore the top frame descriptors from the stack.
3651 __ pop(r3); 3655 __ pop(r3);
3652 __ mov(ip, 3656 __ mov(ip,
3653 Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate))); 3657 Operand(ExternalReference(Isolate::k_c_entry_fp_address, isolate)));
3654 __ str(r3, MemOperand(ip)); 3658 __ str(r3, MemOperand(ip));
3655 3659
3656 // Reset the stack to the callee saved registers. 3660 // Reset the stack to the callee saved registers.
3657 __ add(sp, sp, Operand(-EntryFrameConstants::kCallerFPOffset)); 3661 __ add(sp, sp, Operand(-EntryFrameConstants::kCallerFPOffset));
3658 3662
3659 // Restore callee-saved registers and return. 3663 // Restore callee-saved registers and return.
(...skipping 2705 matching lines...) Expand 10 before | Expand all | Expand 10 after
6365 __ mov(result, Operand(0)); 6369 __ mov(result, Operand(0));
6366 __ Ret(); 6370 __ Ret();
6367 } 6371 }
6368 6372
6369 6373
6370 #undef __ 6374 #undef __
6371 6375
6372 } } // namespace v8::internal 6376 } } // namespace v8::internal
6373 6377
6374 #endif // V8_TARGET_ARCH_ARM 6378 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698