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

Side by Side Diff: src/x64/code-stubs-x64.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 | « src/ia32/code-stubs-ia32.cc ('k') | no next file » | 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 3252 matching lines...) Expand 10 before | Expand all | Expand 10 after
3263 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); 3263 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp);
3264 __ push(c_entry_fp_operand); 3264 __ push(c_entry_fp_operand);
3265 } 3265 }
3266 3266
3267 #ifdef ENABLE_LOGGING_AND_PROFILING 3267 #ifdef ENABLE_LOGGING_AND_PROFILING
3268 // If this is the outermost JS call, set js_entry_sp value. 3268 // If this is the outermost JS call, set js_entry_sp value.
3269 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate); 3269 ExternalReference js_entry_sp(Isolate::k_js_entry_sp_address, isolate);
3270 __ Load(rax, js_entry_sp); 3270 __ Load(rax, js_entry_sp);
3271 __ testq(rax, rax); 3271 __ testq(rax, rax);
3272 __ j(not_zero, &not_outermost_js); 3272 __ j(not_zero, &not_outermost_js);
3273 __ Push(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME));
3273 __ movq(rax, rbp); 3274 __ movq(rax, rbp);
3274 __ Store(js_entry_sp, rax); 3275 __ Store(js_entry_sp, rax);
3276 Label cont;
3277 __ jmp(&cont);
3275 __ bind(&not_outermost_js); 3278 __ bind(&not_outermost_js);
3279 __ Push(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME));
3280 __ bind(&cont);
3276 #endif 3281 #endif
3277 3282
3278 // Call a faked try-block that does the invoke. 3283 // Call a faked try-block that does the invoke.
3279 __ call(&invoke); 3284 __ call(&invoke);
3280 3285
3281 // Caught exception: Store result (exception) in the pending 3286 // Caught exception: Store result (exception) in the pending
3282 // exception field in the JSEnv and return a failure sentinel. 3287 // exception field in the JSEnv and return a failure sentinel.
3283 ExternalReference pending_exception(Isolate::k_pending_exception_address, 3288 ExternalReference pending_exception(Isolate::k_pending_exception_address,
3284 isolate); 3289 isolate);
3285 __ Store(pending_exception, rax); 3290 __ Store(pending_exception, rax);
(...skipping 21 matching lines...) Expand all
3307 isolate); 3312 isolate);
3308 __ Load(rax, construct_entry); 3313 __ Load(rax, construct_entry);
3309 } else { 3314 } else {
3310 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate); 3315 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate);
3311 __ Load(rax, entry); 3316 __ Load(rax, entry);
3312 } 3317 }
3313 __ lea(kScratchRegister, FieldOperand(rax, Code::kHeaderSize)); 3318 __ lea(kScratchRegister, FieldOperand(rax, Code::kHeaderSize));
3314 __ call(kScratchRegister); 3319 __ call(kScratchRegister);
3315 3320
3316 // Unlink this frame from the handler chain. 3321 // Unlink this frame from the handler chain.
3317 Operand handler_operand = 3322 __ PopTryHandler();
3318 masm->ExternalOperand(ExternalReference(Isolate::k_handler_address,
3319 isolate));
3320 __ pop(handler_operand);
3321 // Pop next_sp.
3322 __ addq(rsp, Immediate(StackHandlerConstants::kSize - kPointerSize));
3323 3323
3324 __ bind(&exit);
3324 #ifdef ENABLE_LOGGING_AND_PROFILING 3325 #ifdef ENABLE_LOGGING_AND_PROFILING
3325 // If current RBP value is the same as js_entry_sp value, it means that 3326 // Check if the current stack frame is marked as the outermost JS frame.
3326 // the current function is the outermost. 3327 __ pop(rbx);
3328 __ Cmp(rbx, Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME));
3329 __ j(not_equal, &not_outermost_js_2);
3327 __ movq(kScratchRegister, js_entry_sp); 3330 __ movq(kScratchRegister, js_entry_sp);
3328 __ cmpq(rbp, Operand(kScratchRegister, 0));
3329 __ j(not_equal, &not_outermost_js_2);
3330 __ movq(Operand(kScratchRegister, 0), Immediate(0)); 3331 __ movq(Operand(kScratchRegister, 0), Immediate(0));
3331 __ bind(&not_outermost_js_2); 3332 __ bind(&not_outermost_js_2);
3332 #endif 3333 #endif
3333 3334
3334 // Restore the top frame descriptor from the stack. 3335 // Restore the top frame descriptor from the stack.
3335 __ bind(&exit);
3336 { 3336 {
3337 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp); 3337 Operand c_entry_fp_operand = masm->ExternalOperand(c_entry_fp);
3338 __ pop(c_entry_fp_operand); 3338 __ pop(c_entry_fp_operand);
3339 } 3339 }
3340 3340
3341 // Restore callee-saved registers (X64 conventions). 3341 // Restore callee-saved registers (X64 conventions).
3342 __ pop(rbx); 3342 __ pop(rbx);
3343 #ifdef _WIN64 3343 #ifdef _WIN64
3344 // Callee save on in Win64 ABI, arguments/volatile in AMD64 ABI. 3344 // Callee save on in Win64 ABI, arguments/volatile in AMD64 ABI.
3345 __ pop(rsi); 3345 __ pop(rsi);
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
5101 __ Drop(1); 5101 __ Drop(1);
5102 __ ret(2 * kPointerSize); 5102 __ ret(2 * kPointerSize);
5103 } 5103 }
5104 5104
5105 5105
5106 #undef __ 5106 #undef __
5107 5107
5108 } } // namespace v8::internal 5108 } } // namespace v8::internal
5109 5109
5110 #endif // V8_TARGET_ARCH_X64 5110 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/code-stubs-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698