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

Unified Diff: src/isolate.h

Issue 3788008: [Isolates] Fix auto extraction of isolate from heap objects in handle constructor. (Closed)
Patch Set: Created 10 years, 2 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/heap-inl.h ('k') | src/jsregexp.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 2af0443cca74f029aaf589cef99a92b275db2e61..3f60d371288b970b46750fc0c54b2df0d123eb2f 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -638,8 +638,8 @@ class Isolate {
static const char* const kStackOverflowMessage;
- static const int kUC16AlphabetSize = 256; // See StringSearchBase.
- static const int kBMMaxShift = 250; // See StringSearchBase.
+ static const int kUC16AlphabetSize = 256; // See StringSearchBase.
+ static const int kBMMaxShift = 250; // See StringSearchBase.
// Accessors.
#define GLOBAL_ACCESSOR(type, name, initialvalue) \
@@ -1045,13 +1045,14 @@ class Isolate {
// versions of GCC. See V8 issue 122 for details.
class SaveContext BASE_EMBEDDED {
public:
- SaveContext()
- : context_(Isolate::Current()->context()),
+ explicit SaveContext(Isolate* isolate) : prev_(isolate->save_context()) {
+ if (isolate->context() != NULL) {
+ context_ = Handle<Context>(isolate->context());
#if __GNUC_VERSION__ >= 40100 && __GNUC_VERSION__ < 40300
- dummy_(Isolate::Current()->context()),
+ dummy_ = Handle<Context>(isolate->context());
#endif
- prev_(Isolate::Current()->save_context()) {
- Isolate::Current()->set_save_context(this);
+ }
+ isolate->set_save_context(this);
// If there is no JS frame under the current C frame, use the value 0.
JavaScriptFrameIterator it;
@@ -1059,8 +1060,15 @@ class SaveContext BASE_EMBEDDED {
}
~SaveContext() {
- Isolate::Current()->set_context(*context_);
- Isolate::Current()->set_save_context(prev_);
+ if (context_.is_null()) {
+ Isolate* isolate = Isolate::Current();
+ isolate->set_context(NULL);
+ isolate->set_save_context(prev_);
+ } else {
+ Isolate* isolate = context_->GetIsolate();
+ isolate->set_context(*context_);
+ isolate->set_save_context(prev_);
+ }
}
Handle<Context> context() { return context_; }
« no previous file with comments | « src/heap-inl.h ('k') | src/jsregexp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698