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

Side by Side 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: Created 5 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
« no previous file with comments | « src/isolate.h ('k') | test/mjsunit/mjsunit.status » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include <fstream> // NOLINT(readability/streams) 7 #include <fstream> // NOLINT(readability/streams)
8 #include <sstream> 8 #include <sstream>
9 9
10 #include "src/v8.h" 10 #include "src/v8.h"
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 1036
1037 // Special handling of termination exceptions, uncatchable by JavaScript code, 1037 // Special handling of termination exceptions, uncatchable by JavaScript code,
1038 // we unwind the handlers until the top ENTRY handler is found. 1038 // we unwind the handlers until the top ENTRY handler is found.
1039 bool catchable_by_js = is_catchable_by_javascript(exception); 1039 bool catchable_by_js = is_catchable_by_javascript(exception);
1040 1040
1041 // Compute handler and stack unwinding information by performing a full walk 1041 // Compute handler and stack unwinding information by performing a full walk
1042 // over the stack and dispatching according to the frame type. 1042 // over the stack and dispatching according to the frame type.
1043 for (StackFrameIterator iter(this); !iter.done(); iter.Advance()) { 1043 for (StackFrameIterator iter(this); !iter.done(); iter.Advance()) {
1044 StackFrame* frame = iter.frame(); 1044 StackFrame* frame = iter.frame();
1045 1045
1046 RemoveMaterializedObjectsOnUnwind(frame);
Michael Starzinger 2015/05/04 15:17:03 As discussed offline: I think the materialized obj
1047
1046 // For JSEntryStub frames we always have a handler. 1048 // For JSEntryStub frames we always have a handler.
1047 if (frame->is_entry() || frame->is_entry_construct()) { 1049 if (frame->is_entry() || frame->is_entry_construct()) {
1048 StackHandler* handler = frame->top_handler(); 1050 StackHandler* handler = frame->top_handler();
1049 1051
1050 // Restore the next handler. 1052 // Restore the next handler.
1051 thread_local_top()->handler_ = handler->next()->address(); 1053 thread_local_top()->handler_ = handler->next()->address();
1052 1054
1053 // Gather information from the handler. 1055 // Gather information from the handler.
1054 code = frame->LookupCode(); 1056 code = frame->LookupCode();
1055 handler_sp = handler->address() + StackHandlerConstants::kSize; 1057 handler_sp = handler->address() + StackHandlerConstants::kSize;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1110 thread_local_top()->pending_handler_offset_ = offset; 1112 thread_local_top()->pending_handler_offset_ = offset;
1111 thread_local_top()->pending_handler_fp_ = handler_fp; 1113 thread_local_top()->pending_handler_fp_ = handler_fp;
1112 thread_local_top()->pending_handler_sp_ = handler_sp; 1114 thread_local_top()->pending_handler_sp_ = handler_sp;
1113 1115
1114 // Return and clear pending exception. 1116 // Return and clear pending exception.
1115 clear_pending_exception(); 1117 clear_pending_exception();
1116 return exception; 1118 return exception;
1117 } 1119 }
1118 1120
1119 1121
1122 void Isolate::RemoveMaterializedObjectsOnUnwind(StackFrame* frame) {
1123 if (frame->is_optimized()) {
1124 bool removed = materialized_object_store_->Remove(frame->fp());
1125 USE(removed);
1126 // If there were any materialized objects, the code should be
1127 // marked for deopt.
1128 DCHECK(!removed || frame->LookupCode()->marked_for_deoptimization());
1129 }
1130 }
1131
1132
1120 Isolate::CatchType Isolate::PredictExceptionCatcher() { 1133 Isolate::CatchType Isolate::PredictExceptionCatcher() {
1121 Address external_handler = thread_local_top()->try_catch_handler_address(); 1134 Address external_handler = thread_local_top()->try_catch_handler_address();
1122 Address entry_handler = Isolate::handler(thread_local_top()); 1135 Address entry_handler = Isolate::handler(thread_local_top());
1123 if (IsExternalHandlerOnTop(nullptr)) return CAUGHT_BY_EXTERNAL; 1136 if (IsExternalHandlerOnTop(nullptr)) return CAUGHT_BY_EXTERNAL;
1124 1137
1125 // Search for an exception handler by performing a full walk over the stack. 1138 // Search for an exception handler by performing a full walk over the stack.
1126 for (StackFrameIterator iter(this); !iter.done(); iter.Advance()) { 1139 for (StackFrameIterator iter(this); !iter.done(); iter.Advance()) {
1127 StackFrame* frame = iter.frame(); 1140 StackFrame* frame = iter.frame();
1128 1141
1129 // For JSEntryStub frames we update the JS_ENTRY handler. 1142 // For JSEntryStub frames we update the JS_ENTRY handler.
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 if (prev_ && prev_->Intercept(flag)) return true; 2769 if (prev_ && prev_->Intercept(flag)) return true;
2757 // Then check whether this scope intercepts. 2770 // Then check whether this scope intercepts.
2758 if ((flag & intercept_mask_)) { 2771 if ((flag & intercept_mask_)) {
2759 intercepted_flags_ |= flag; 2772 intercepted_flags_ |= flag;
2760 return true; 2773 return true;
2761 } 2774 }
2762 return false; 2775 return false;
2763 } 2776 }
2764 2777
2765 } } // namespace v8::internal 2778 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.h ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698