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

Side by Side Diff: src/ia32/code-stubs-ia32.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/heap-inl.h ('k') | src/isolate.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 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 4831 matching lines...) Expand 10 before | Expand all | Expand 10 after
4842 } 4842 }
4843 4843
4844 4844
4845 void CEntryStub::GenerateAheadOfTime() { 4845 void CEntryStub::GenerateAheadOfTime() {
4846 CEntryStub stub(1, kDontSaveFPRegs); 4846 CEntryStub stub(1, kDontSaveFPRegs);
4847 Handle<Code> code = stub.GetCode(); 4847 Handle<Code> code = stub.GetCode();
4848 code->set_is_pregenerated(true); 4848 code->set_is_pregenerated(true);
4849 } 4849 }
4850 4850
4851 4851
4852 static void JumpIfOOM(MacroAssembler* masm,
4853 Register value,
4854 Register scratch,
4855 Label* oom_label) {
4856 __ mov(scratch, value);
4857 STATIC_ASSERT(Failure::OUT_OF_MEMORY_EXCEPTION == 3);
4858 STATIC_ASSERT(kFailureTag == 3);
4859 __ and_(scratch, 0xf);
4860 __ cmp(scratch, 0xf);
4861 __ j(equal, oom_label);
4862 }
4863
4864
4852 void CEntryStub::GenerateCore(MacroAssembler* masm, 4865 void CEntryStub::GenerateCore(MacroAssembler* masm,
4853 Label* throw_normal_exception, 4866 Label* throw_normal_exception,
4854 Label* throw_termination_exception, 4867 Label* throw_termination_exception,
4855 Label* throw_out_of_memory_exception, 4868 Label* throw_out_of_memory_exception,
4856 bool do_gc, 4869 bool do_gc,
4857 bool always_allocate_scope) { 4870 bool always_allocate_scope) {
4858 // eax: result parameter for PerformGC, if any 4871 // eax: result parameter for PerformGC, if any
4859 // ebx: pointer to C function (C callee-saved) 4872 // ebx: pointer to C function (C callee-saved)
4860 // ebp: frame pointer (restored after C call) 4873 // ebp: frame pointer (restored after C call)
4861 // esp: stack pointer (restored after C call) 4874 // esp: stack pointer (restored after C call)
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
4939 // Handling of failure. 4952 // Handling of failure.
4940 __ bind(&failure_returned); 4953 __ bind(&failure_returned);
4941 4954
4942 Label retry; 4955 Label retry;
4943 // If the returned exception is RETRY_AFTER_GC continue at retry label 4956 // If the returned exception is RETRY_AFTER_GC continue at retry label
4944 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0); 4957 STATIC_ASSERT(Failure::RETRY_AFTER_GC == 0);
4945 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize)); 4958 __ test(eax, Immediate(((1 << kFailureTypeTagSize) - 1) << kFailureTagSize));
4946 __ j(zero, &retry, Label::kNear); 4959 __ j(zero, &retry, Label::kNear);
4947 4960
4948 // Special handling of out of memory exceptions. 4961 // Special handling of out of memory exceptions.
4949 __ cmp(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); 4962 JumpIfOOM(masm, eax, ecx, throw_out_of_memory_exception);
4950 __ j(equal, throw_out_of_memory_exception);
4951 4963
4952 // Retrieve the pending exception and clear the variable. 4964 // Retrieve the pending exception and clear the variable.
4953 __ mov(eax, Operand::StaticVariable(pending_exception_address)); 4965 __ mov(eax, Operand::StaticVariable(pending_exception_address));
4954 __ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value())); 4966 __ mov(edx, Immediate(masm->isolate()->factory()->the_hole_value()));
4955 __ mov(Operand::StaticVariable(pending_exception_address), edx); 4967 __ mov(Operand::StaticVariable(pending_exception_address), edx);
4956 4968
4957 // Special handling of termination exceptions which are uncatchable 4969 // Special handling of termination exceptions which are uncatchable
4958 // by javascript code. 4970 // by javascript code.
4959 __ cmp(eax, masm->isolate()->factory()->termination_exception()); 4971 __ cmp(eax, masm->isolate()->factory()->termination_exception());
4960 __ j(equal, throw_termination_exception); 4972 __ j(equal, throw_termination_exception);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
5022 __ bind(&throw_out_of_memory_exception); 5034 __ bind(&throw_out_of_memory_exception);
5023 // Set external caught exception to false. 5035 // Set external caught exception to false.
5024 Isolate* isolate = masm->isolate(); 5036 Isolate* isolate = masm->isolate();
5025 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress, 5037 ExternalReference external_caught(Isolate::kExternalCaughtExceptionAddress,
5026 isolate); 5038 isolate);
5027 __ mov(Operand::StaticVariable(external_caught), Immediate(false)); 5039 __ mov(Operand::StaticVariable(external_caught), Immediate(false));
5028 5040
5029 // Set pending exception and eax to out of memory exception. 5041 // Set pending exception and eax to out of memory exception.
5030 ExternalReference pending_exception(Isolate::kPendingExceptionAddress, 5042 ExternalReference pending_exception(Isolate::kPendingExceptionAddress,
5031 isolate); 5043 isolate);
5032 __ mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException())); 5044 Label already_have_failure;
5045 JumpIfOOM(masm, eax, ecx, &already_have_failure);
5046 __ mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException(0x1)));
5047 __ bind(&already_have_failure);
5033 __ mov(Operand::StaticVariable(pending_exception), eax); 5048 __ mov(Operand::StaticVariable(pending_exception), eax);
5034 // Fall through to the next label. 5049 // Fall through to the next label.
5035 5050
5036 __ bind(&throw_termination_exception); 5051 __ bind(&throw_termination_exception);
5037 __ ThrowUncatchable(eax); 5052 __ ThrowUncatchable(eax);
5038 5053
5039 __ bind(&throw_normal_exception); 5054 __ bind(&throw_normal_exception);
5040 __ Throw(eax); 5055 __ Throw(eax);
5041 } 5056 }
5042 5057
(...skipping 2433 matching lines...) Expand 10 before | Expand all | Expand 10 after
7476 // Restore ecx. 7491 // Restore ecx.
7477 __ pop(ecx); 7492 __ pop(ecx);
7478 __ ret(0); 7493 __ ret(0);
7479 } 7494 }
7480 7495
7481 #undef __ 7496 #undef __
7482 7497
7483 } } // namespace v8::internal 7498 } } // namespace v8::internal
7484 7499
7485 #endif // V8_TARGET_ARCH_IA32 7500 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/heap-inl.h ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698