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

Unified Diff: src/isolate.h

Issue 20680002: Rebase of partial ia32 implementation of optimized try/catch (started by Kevin Millikin, continued … (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix detection of CATCH frames (fixes debuger exception reporting anf breaks another assertion...). Created 7 years, 5 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/ia32/macro-assembler-ia32.cc ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index 0552ef7f8085b60f8b3d349580424b05255092ec..121d795f1addab76cf79deb37a13551276a067f8 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -258,6 +258,13 @@ class ThreadLocalTop BASE_EMBEDDED {
SaveContext* save_context_;
v8::TryCatch* catcher_;
+ // Fields for handling try-catch statements in optimized code.
+ byte* optimized_handler_patch_buffer_;
+ MaybeObject* optimized_pending_exception_;
+ int optimized_handler_handler_index_;
+ int optimized_handler_deopt_index_;
+ int optimized_handler_frame_pc_offset_;
+
// Stack.
Address c_entry_fp_; // the frame pointer of the top c entry frame
Address handler_; // try-blocks are chained through the stack
@@ -284,6 +291,8 @@ class ThreadLocalTop BASE_EMBEDDED {
// Whether out of memory exceptions should be ignored.
bool ignore_out_of_memory_;
+ int thread_id() { return thread_id_.ToInteger(); }
+
private:
void InitializeInternal();
@@ -549,7 +558,7 @@ class Isolate {
}
Context** context_address() { return &thread_local_top_.context_; }
- SaveContext* save_context() {return thread_local_top_.save_context_; }
+ SaveContext* save_context() { return thread_local_top_.save_context_; }
void set_save_context(SaveContext* save) {
thread_local_top_.save_context_ = save;
}
@@ -574,6 +583,10 @@ class Isolate {
}
void clear_pending_exception() {
thread_local_top_.pending_exception_ = heap_.the_hole_value();
+
+ if (is_handling_optimized_catch_statement()) {
+ ClearOptimizedHandlerByAPI();
+ }
}
MaybeObject** pending_exception_address() {
return &thread_local_top_.pending_exception_;
@@ -602,6 +615,69 @@ class Isolate {
thread_local_top_.catcher_ = catcher;
}
+ // Interface for supporting try-catch statements in optimized code.
+ bool is_handling_optimized_catch_statement() {
+ return thread_local_top_.optimized_handler_handler_index_ != -1;
+ }
+ byte* optimized_handler_patch_buffer() {
+ return thread_local_top_.optimized_handler_patch_buffer_;
+ }
+ void set_optimized_handler_patch_buffer(Address patch_address,
+ int patch_size) {
+ ASSERT(thread_local_top_.optimized_handler_patch_buffer_ == NULL);
+ thread_local_top_.optimized_handler_patch_buffer_ = new byte[patch_size];
+ memcpy(thread_local_top_.optimized_handler_patch_buffer_,
+ patch_address, patch_size);
+ }
+ void clear_optimized_handler_patch_buffer() {
+ ASSERT(thread_local_top_.optimized_handler_patch_buffer_ != NULL);
+ delete[] thread_local_top_.optimized_handler_patch_buffer_;
+ thread_local_top_.optimized_handler_patch_buffer_ = NULL;
+ }
+ MaybeObject* optimized_pending_exception() {
+ return thread_local_top_.optimized_pending_exception_;
+ }
+ void set_optimized_pending_exception(MaybeObject* v) {
+ thread_local_top_.optimized_pending_exception_ = v;
+ }
+ void clear_optimized_pending_exception() {
+ thread_local_top_.optimized_pending_exception_ = NULL;
+ }
+ int optimized_handler_handler_index() {
+ return thread_local_top_.optimized_handler_handler_index_;
+ }
+ void set_optimized_handler_handler_index(int v) {
+ ASSERT(thread_local_top_.optimized_handler_handler_index_ == -1);
+ thread_local_top_.optimized_handler_handler_index_ = v;
+ }
+ void clear_optimized_handler_handler_index() {
+ ASSERT(thread_local_top_.optimized_handler_handler_index_ != -1);
+ thread_local_top_.optimized_handler_handler_index_ = -1;
+ }
+ int optimized_handler_deopt_index() {
+ return thread_local_top_.optimized_handler_deopt_index_;
+ }
+ void set_optimized_handler_deopt_index(int v) {
+ ASSERT(thread_local_top_.optimized_handler_deopt_index_ == -1);
+ thread_local_top_.optimized_handler_deopt_index_ = v;
+ }
+ void clear_optimized_handler_deopt_index() {
+ ASSERT(thread_local_top_.optimized_handler_deopt_index_ != -1);
+ thread_local_top_.optimized_handler_deopt_index_ = -1;
+ }
+ int optimized_handler_frame_pc_offset() {
+ return thread_local_top_.optimized_handler_frame_pc_offset_;
+ }
+ void set_optimized_handler_frame_pc_offset(int v) {
+ ASSERT(thread_local_top_.optimized_handler_frame_pc_offset_ == -1);
+ thread_local_top_.optimized_handler_frame_pc_offset_ = v;
+ }
+ void clear_optimized_handler_frame_pc_offset() {
+ ASSERT(thread_local_top_.optimized_handler_frame_pc_offset_ != -1);
+ thread_local_top_.optimized_handler_frame_pc_offset_ = -1;
+ }
+
+
MaybeObject** scheduled_exception_address() {
return &thread_local_top_.scheduled_exception_;
}
@@ -775,6 +851,12 @@ class Isolate {
bool ShouldReportException(bool* can_be_caught_externally,
bool catchable_by_javascript);
+ // The temporary optimized handler state is used by the deoptimizer when
+ // catching exceptions in optimized code.
+ void PrepareForOptimizedHandler();
+ void ClearOptimizedHandlerByDeopt(Code* optimized_code);
+ void ClearOptimizedHandlerByAPI();
+
// Attempts to compute the current source location, storing the
// result in the target out parameter.
void ComputeLocation(MessageLocation* target);
« no previous file with comments | « src/ia32/macro-assembler-ia32.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698