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

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

Issue 11818023: Some more instrumentation to narrow down Failure leaks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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/runtime.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 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 3881 matching lines...) Expand 10 before | Expand all | Expand 10 after
3892 3892
3893 3893
3894 void CEntryStub::GenerateAheadOfTime() { 3894 void CEntryStub::GenerateAheadOfTime() {
3895 CEntryStub stub(1, kDontSaveFPRegs); 3895 CEntryStub stub(1, kDontSaveFPRegs);
3896 stub.GetCode()->set_is_pregenerated(true); 3896 stub.GetCode()->set_is_pregenerated(true);
3897 CEntryStub save_doubles(1, kSaveFPRegs); 3897 CEntryStub save_doubles(1, kSaveFPRegs);
3898 save_doubles.GetCode()->set_is_pregenerated(true); 3898 save_doubles.GetCode()->set_is_pregenerated(true);
3899 } 3899 }
3900 3900
3901 3901
3902 static void JumpIfOOM(MacroAssembler* masm,
3903 Register value,
3904 Register scratch,
3905 Label* oom_label) {
3906 __ movq(scratch, value);
3907 STATIC_ASSERT(Failure::OUT_OF_MEMORY_EXCEPTION == 3);
3908 STATIC_ASSERT(kFailureTag == 3);
3909 __ and_(scratch, Immediate(0xf));
3910 __ cmpq(scratch, Immediate(0xf));
3911 __ j(equal, oom_label);
3912 }
3913
3914
3902 void CEntryStub::GenerateCore(MacroAssembler* masm, 3915 void CEntryStub::GenerateCore(MacroAssembler* masm,
3903 Label* throw_normal_exception, 3916 Label* throw_normal_exception,
3904 Label* throw_termination_exception, 3917 Label* throw_termination_exception,
3905 Label* throw_out_of_memory_exception, 3918 Label* throw_out_of_memory_exception,
3906 bool do_gc, 3919 bool do_gc,
3907 bool always_allocate_scope) { 3920 bool always_allocate_scope) {
3908 // rax: result parameter for PerformGC, if any. 3921 // rax: result parameter for PerformGC, if any.
3909 // rbx: pointer to C function (C callee-saved). 3922 // rbx: pointer to C function (C callee-saved).
3910 // rbp: frame pointer (restored after C call). 3923 // rbp: frame pointer (restored after C call).
3911 // rsp: stack pointer (restored after C call). 3924 // rsp: stack pointer (restored after C call).
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
4005 // Handling of failure. 4018 // Handling of failure.
4006 __ bind(&failure_returned); 4019 __ bind(&failure_returned);
4007 4020
4008 Label retry; 4021 Label retry;
4009 // If the returned exception is RETRY_AFTER_GC continue at retry label 4022 // If the returned exception is RETRY_AFTER_GC continue at retry label
4010 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); 4023 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0);
4011 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); 4024 __ testl(rax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize));
4012 __ j(zero, &retry, Label::kNear); 4025 __ j(zero, &retry, Label::kNear);
4013 4026
4014 // Special handling of out of memory exceptions. 4027 // Special handling of out of memory exceptions.
4015 __ movq(kScratchRegister, Failure::OutOfMemoryException(), RelocInfo::NONE64); 4028 JumpIfOOM(masm, rax, kScratchRegister, throw_out_of_memory_exception);
4016 __ cmpq(rax, kScratchRegister);
4017 __ j(equal, throw_out_of_memory_exception);
4018 4029
4019 // Retrieve the pending exception and clear the variable. 4030 // Retrieve the pending exception and clear the variable.
4020 ExternalReference pending_exception_address( 4031 ExternalReference pending_exception_address(
4021 Isolate::kPendingExceptionAddress, masm->isolate()); 4032 Isolate::kPendingExceptionAddress, masm->isolate());
4022 Operand pending_exception_operand = 4033 Operand pending_exception_operand =
4023 masm->ExternalOperand(pending_exception_address); 4034 masm->ExternalOperand(pending_exception_address);
4024 __ movq(rax, pending_exception_operand); 4035 __ movq(rax, pending_exception_operand);
4025 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex); 4036 __ LoadRoot(rdx, Heap::kTheHoleValueRootIndex);
4026 __ movq(pending_exception_operand, rdx); 4037 __ movq(pending_exception_operand, rdx);
4027 4038
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
4104 // Set external caught exception to false. 4115 // Set external caught exception to false.
4105 Isolate* isolate = masm->isolate(); 4116 Isolate* isolate = masm->isolate();
4106 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress, 4117 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress,
4107 isolate); 4118 isolate);
4108 __ Set(rax, static_cast<int64_t>(false)); 4119 __ Set(rax, static_cast<int64_t>(false));
4109 __ Store(external_caught, rax); 4120 __ Store(external_caught, rax);
4110 4121
4111 // Set pending exception and rax to out of memory exception. 4122 // Set pending exception and rax to out of memory exception.
4112 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, 4123 ExternalReference pending_exception(Isolate::kPendingExceptionAddress,
4113 isolate); 4124 isolate);
4114 __ movq(rax, Failure::OutOfMemoryException(), RelocInfo::NONE64); 4125 Label already_have_failure;
4126 JumpIfOOM(masm, rax, kScratchRegister, &already_have_failure);
4127 __ movq(rax, Failure::OutOfMemoryException(0x1), RelocInfo::NONE64);
4128 __ bind(&already_have_failure);
4115 __ Store(pending_exception, rax); 4129 __ Store(pending_exception, rax);
4116 // Fall through to the next label. 4130 // Fall through to the next label.
4117 4131
4118 __ bind(&throw_termination_exception); 4132 __ bind(&throw_termination_exception);
4119 __ ThrowUncatchable(rax); 4133 __ ThrowUncatchable(rax);
4120 4134
4121 __ bind(&throw_normal_exception); 4135 __ bind(&throw_normal_exception);
4122 __ Throw(rax); 4136 __ Throw(rax);
4123 } 4137 }
4124 4138
(...skipping 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after
6484 #endif 6498 #endif
6485 6499
6486 __ Ret(); 6500 __ Ret();
6487 } 6501 }
6488 6502
6489 #undef __ 6503 #undef __
6490 6504
6491 } } // namespace v8::internal 6505 } } // namespace v8::internal
6492 6506
6493 #endif // V8_TARGET_ARCH_X64 6507 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/runtime.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698