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

Unified Diff: src/isolate.cc

Issue 1122083002: Remove materialized objects on stack unwind. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Tweaks, do not unwind the handler's frame Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/isolate.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.cc
diff --git a/src/isolate.cc b/src/isolate.cc
index f3596483112c00f8dbc2081c1a24bab75fae6c4e..33cc52105d33237cd6dfe184dc97e766a6d5576d 100644
--- a/src/isolate.cc
+++ b/src/isolate.cc
@@ -1025,7 +1025,7 @@ Object* Isolate::ReThrow(Object* exception) {
}
-Object* Isolate::FindHandler() {
+Object* Isolate::UnwindAndFindHandler() {
Object* exception = pending_exception();
Code* code = nullptr;
@@ -1062,19 +1062,19 @@ Object* Isolate::FindHandler() {
OptimizedFrame* js_frame = static_cast<OptimizedFrame*>(frame);
int stack_slots = 0; // Will contain stack slot count of frame.
offset = js_frame->LookupExceptionHandlerInTable(&stack_slots);
- if (offset < 0) continue;
-
- // Compute the stack pointer from the frame pointer. This ensures that
- // argument slots on the stack are dropped as returning would.
- Address return_sp = frame->fp() -
- StandardFrameConstants::kFixedFrameSizeFromFp -
- stack_slots * kPointerSize;
-
- // Gather information from the frame.
- code = frame->LookupCode();
- handler_sp = return_sp;
- handler_fp = frame->fp();
- break;
+ if (offset >= 0) {
+ // Compute the stack pointer from the frame pointer. This ensures that
+ // argument slots on the stack are dropped as returning would.
+ Address return_sp = frame->fp() -
+ StandardFrameConstants::kFixedFrameSizeFromFp -
+ stack_slots * kPointerSize;
+
+ // Gather information from the frame.
+ code = frame->LookupCode();
+ handler_sp = return_sp;
+ handler_fp = frame->fp();
+ break;
+ }
}
// For JavaScript frames we perform a range lookup in the handler table.
@@ -1082,23 +1082,25 @@ Object* Isolate::FindHandler() {
JavaScriptFrame* js_frame = static_cast<JavaScriptFrame*>(frame);
int stack_slots = 0; // Will contain operand stack depth of handler.
offset = js_frame->LookupExceptionHandlerInTable(&stack_slots);
- if (offset < 0) continue;
-
- // Compute the stack pointer from the frame pointer. This ensures that
- // operand stack slots are dropped for nested statements. Also restore
- // correct context for the handler which is pushed within the try-block.
- Address return_sp = frame->fp() -
- StandardFrameConstants::kFixedFrameSizeFromFp -
- stack_slots * kPointerSize;
- STATIC_ASSERT(TryBlockConstant::kElementCount == 1);
- context = Context::cast(Memory::Object_at(return_sp - kPointerSize));
-
- // Gather information from the frame.
- code = frame->LookupCode();
- handler_sp = return_sp;
- handler_fp = frame->fp();
- break;
+ if (offset >= 0) {
+ // Compute the stack pointer from the frame pointer. This ensures that
+ // operand stack slots are dropped for nested statements. Also restore
+ // correct context for the handler which is pushed within the try-block.
+ Address return_sp = frame->fp() -
+ StandardFrameConstants::kFixedFrameSizeFromFp -
+ stack_slots * kPointerSize;
+ STATIC_ASSERT(TryBlockConstant::kElementCount == 1);
+ context = Context::cast(Memory::Object_at(return_sp - kPointerSize));
+
+ // Gather information from the frame.
+ code = frame->LookupCode();
+ handler_sp = return_sp;
+ handler_fp = frame->fp();
+ break;
+ }
}
+
+ RemoveMaterializedObjectsOnUnwind(frame);
}
// Handler must exist.
@@ -1154,6 +1156,17 @@ Isolate::CatchType Isolate::PredictExceptionCatcher() {
}
+void Isolate::RemoveMaterializedObjectsOnUnwind(StackFrame* frame) {
+ if (frame->is_optimized()) {
+ bool removed = materialized_object_store_->Remove(frame->fp());
+ USE(removed);
+ // If there were any materialized objects, the code should be
+ // marked for deopt.
+ DCHECK(!removed || frame->LookupCode()->marked_for_deoptimization());
+ }
+}
+
+
Object* Isolate::ThrowIllegalOperation() {
if (FLAG_stack_trace_on_illegal) PrintStack(stdout);
return Throw(heap()->illegal_access_string());
« no previous file with comments | « src/isolate.h ('k') | src/mips/code-stubs-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698