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

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

Issue 8462010: Add a level of indirection to exception handler addresses. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Incorporate review changes. Created 9 years, 1 month 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/x64/code-stubs-x64.h ('k') | src/x64/frames-x64.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 3330 matching lines...) Expand 10 before | Expand all | Expand 10 after
3341 __ testb(scratch, Immediate(kIsSymbolMask)); 3341 __ testb(scratch, Immediate(kIsSymbolMask));
3342 __ j(zero, label); 3342 __ j(zero, label);
3343 } 3343 }
3344 3344
3345 3345
3346 void StackCheckStub::Generate(MacroAssembler* masm) { 3346 void StackCheckStub::Generate(MacroAssembler* masm) {
3347 __ TailCallRuntime(Runtime::kStackGuard, 0, 1); 3347 __ TailCallRuntime(Runtime::kStackGuard, 0, 1);
3348 } 3348 }
3349 3349
3350 3350
3351 void CallFunctionStub::FinishCode(Code* code) { 3351 void CallFunctionStub::FinishCode(Handle<Code> code) {
3352 code->set_has_function_cache(false); 3352 code->set_has_function_cache(false);
3353 } 3353 }
3354 3354
3355 3355
3356 void CallFunctionStub::Clear(Heap* heap, Address address) { 3356 void CallFunctionStub::Clear(Heap* heap, Address address) {
3357 UNREACHABLE(); 3357 UNREACHABLE();
3358 } 3358 }
3359 3359
3360 3360
3361 Object* CallFunctionStub::GetCachedValue(Address address) { 3361 Object* CallFunctionStub::GetCachedValue(Address address) {
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
3697 3697
3698 __ bind(&throw_termination_exception); 3698 __ bind(&throw_termination_exception);
3699 GenerateThrowUncatchable(masm, TERMINATION); 3699 GenerateThrowUncatchable(masm, TERMINATION);
3700 3700
3701 __ bind(&throw_normal_exception); 3701 __ bind(&throw_normal_exception);
3702 GenerateThrowTOS(masm); 3702 GenerateThrowTOS(masm);
3703 } 3703 }
3704 3704
3705 3705
3706 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) { 3706 void JSEntryStub::GenerateBody(MacroAssembler* masm, bool is_construct) {
3707 Label invoke, exit; 3707 Label invoke, handler_entry, exit;
3708 Label not_outermost_js, not_outermost_js_2; 3708 Label not_outermost_js, not_outermost_js_2;
3709 { // NOLINT. Scope block confuses linter. 3709 { // NOLINT. Scope block confuses linter.
3710 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm); 3710 MacroAssembler::NoRootArrayScope uninitialized_root_register(masm);
3711 // Setup frame. 3711 // Setup frame.
3712 __ push(rbp); 3712 __ push(rbp);
3713 __ movq(rbp, rsp); 3713 __ movq(rbp, rsp);
3714 3714
3715 // Push the stack frame type marker twice. 3715 // Push the stack frame type marker twice.
3716 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY; 3716 int marker = is_construct ? StackFrame::ENTRY_CONSTRUCT : StackFrame::ENTRY;
3717 // Scratch register is neither callee-save, nor an argument register on any 3717 // Scratch register is neither callee-save, nor an argument register on any
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3757 __ j(not_zero, &not_outermost_js); 3757 __ j(not_zero, &not_outermost_js);
3758 __ Push(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME)); 3758 __ Push(Smi::FromInt(StackFrame::OUTERMOST_JSENTRY_FRAME));
3759 __ movq(rax, rbp); 3759 __ movq(rax, rbp);
3760 __ Store(js_entry_sp, rax); 3760 __ Store(js_entry_sp, rax);
3761 Label cont; 3761 Label cont;
3762 __ jmp(&cont); 3762 __ jmp(&cont);
3763 __ bind(&not_outermost_js); 3763 __ bind(&not_outermost_js);
3764 __ Push(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME)); 3764 __ Push(Smi::FromInt(StackFrame::INNER_JSENTRY_FRAME));
3765 __ bind(&cont); 3765 __ bind(&cont);
3766 3766
3767 // Call a faked try-block that does the invoke. 3767 // Jump to a faked try block that does the invoke, with a faked catch
3768 __ call(&invoke); 3768 // block that sets the pending exception.
3769 3769 __ jmp(&invoke);
3770 // Caught exception: Store result (exception) in the pending 3770 __ bind(&handler_entry);
3771 // exception field in the JSEnv and return a failure sentinel. 3771 handler_offset_ = handler_entry.pos();
3772 // Caught exception: Store result (exception) in the pending exception
3773 // field in the JSEnv and return a failure sentinel.
3772 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, 3774 ExternalReference pending_exception(Isolate::kPendingExceptionAddress,
3773 isolate); 3775 isolate);
3774 __ Store(pending_exception, rax); 3776 __ Store(pending_exception, rax);
3775 __ movq(rax, Failure::Exception(), RelocInfo::NONE); 3777 __ movq(rax, Failure::Exception(), RelocInfo::NONE);
3776 __ jmp(&exit); 3778 __ jmp(&exit);
3777 3779
3778 // Invoke: Link this frame into the handler chain. 3780 // Invoke: Link this frame into the handler chain. There's only one
3781 // handler block in this code object, so its index is 0.
3779 __ bind(&invoke); 3782 __ bind(&invoke);
3780 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER); 3783 __ PushTryHandler(IN_JS_ENTRY, JS_ENTRY_HANDLER, 0);
3781 3784
3782 // Clear any pending exceptions. 3785 // Clear any pending exceptions.
3783 __ LoadRoot(rax, Heap::kTheHoleValueRootIndex); 3786 __ LoadRoot(rax, Heap::kTheHoleValueRootIndex);
3784 __ Store(pending_exception, rax); 3787 __ Store(pending_exception, rax);
3785 3788
3786 // Fake a receiver (NULL). 3789 // Fake a receiver (NULL).
3787 __ push(Immediate(0)); // receiver 3790 __ push(Immediate(0)); // receiver
3788 3791
3789 // Invoke the function by calling through JS entry trampoline 3792 // Invoke the function by calling through JS entry trampoline builtin and
3790 // builtin and pop the faked function when we return. We load the address 3793 // pop the faked function when we return. We load the address from an
3791 // from an external reference instead of inlining the call target address 3794 // external reference instead of inlining the call target address directly
3792 // directly in the code, because the builtin stubs may not have been 3795 // in the code, because the builtin stubs may not have been generated yet
3793 // generated yet at the time this code is generated. 3796 // at the time this code is generated.
3794 if (is_construct) { 3797 if (is_construct) {
3795 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline, 3798 ExternalReference construct_entry(Builtins::kJSConstructEntryTrampoline,
3796 isolate); 3799 isolate);
3797 __ Load(rax, construct_entry); 3800 __ Load(rax, construct_entry);
3798 } else { 3801 } else {
3799 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate); 3802 ExternalReference entry(Builtins::kJSEntryTrampoline, isolate);
3800 __ Load(rax, entry); 3803 __ Load(rax, entry);
3801 } 3804 }
3802 __ lea(kScratchRegister, FieldOperand(rax, Code::kHeaderSize)); 3805 __ lea(kScratchRegister, FieldOperand(rax, Code::kHeaderSize));
3803 __ call(kScratchRegister); 3806 __ call(kScratchRegister);
(...skipping 2226 matching lines...) Expand 10 before | Expand all | Expand 10 after
6030 __ bind(&element_done); 6033 __ bind(&element_done);
6031 __ ret(0); 6034 __ ret(0);
6032 } 6035 }
6033 } 6036 }
6034 6037
6035 #undef __ 6038 #undef __
6036 6039
6037 } } // namespace v8::internal 6040 } } // namespace v8::internal
6038 6041
6039 #endif // V8_TARGET_ARCH_X64 6042 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/code-stubs-x64.h ('k') | src/x64/frames-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698