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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « src/heap-inl.h ('k') | src/jsregexp.cc » ('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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 Handle<Context> GetCallingGlobalContext(); 631 Handle<Context> GetCallingGlobalContext();
632 632
633 void RegisterTryCatchHandler(v8::TryCatch* that); 633 void RegisterTryCatchHandler(v8::TryCatch* that);
634 void UnregisterTryCatchHandler(v8::TryCatch* that); 634 void UnregisterTryCatchHandler(v8::TryCatch* that);
635 635
636 char* ArchiveThread(char* to); 636 char* ArchiveThread(char* to);
637 char* RestoreThread(char* from); 637 char* RestoreThread(char* from);
638 638
639 static const char* const kStackOverflowMessage; 639 static const char* const kStackOverflowMessage;
640 640
641 static const int kUC16AlphabetSize = 256; // See StringSearchBase. 641 static const int kUC16AlphabetSize = 256; // See StringSearchBase.
642 static const int kBMMaxShift = 250; // See StringSearchBase. 642 static const int kBMMaxShift = 250; // See StringSearchBase.
643 643
644 // Accessors. 644 // Accessors.
645 #define GLOBAL_ACCESSOR(type, name, initialvalue) \ 645 #define GLOBAL_ACCESSOR(type, name, initialvalue) \
646 type name() const { return name##_; } \ 646 type name() const { return name##_; } \
647 void set_##name(type value) { name##_ = value; } 647 void set_##name(type value) { name##_ = value; }
648 ISOLATE_INIT_LIST(GLOBAL_ACCESSOR) 648 ISOLATE_INIT_LIST(GLOBAL_ACCESSOR)
649 #undef GLOBAL_ACCESSOR 649 #undef GLOBAL_ACCESSOR
650 650
651 #define GLOBAL_ARRAY_ACCESSOR(type, name, length) \ 651 #define GLOBAL_ARRAY_ACCESSOR(type, name, length) \
652 type* name() { return &(name##_[0]); } 652 type* name() { return &(name##_[0]); }
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 1038
1039 DISALLOW_COPY_AND_ASSIGN(Isolate); 1039 DISALLOW_COPY_AND_ASSIGN(Isolate);
1040 }; 1040 };
1041 1041
1042 1042
1043 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the 1043 // If the GCC version is 4.1.x or 4.2.x an additional field is added to the
1044 // class as a work around for a bug in the generated code found with these 1044 // class as a work around for a bug in the generated code found with these
1045 // versions of GCC. See V8 issue 122 for details. 1045 // versions of GCC. See V8 issue 122 for details.
1046 class SaveContext BASE_EMBEDDED { 1046 class SaveContext BASE_EMBEDDED {
1047 public: 1047 public:
1048 SaveContext() 1048 explicit SaveContext(Isolate* isolate) : prev_(isolate->save_context()) {
1049 : context_(Isolate::Current()->context()), 1049 if (isolate->context() != NULL) {
1050 context_ = Handle<Context>(isolate->context());
1050 #if __GNUC_VERSION__ >= 40100 && __GNUC_VERSION__ < 40300 1051 #if __GNUC_VERSION__ >= 40100 && __GNUC_VERSION__ < 40300
1051 dummy_(Isolate::Current()->context()), 1052 dummy_ = Handle<Context>(isolate->context());
1052 #endif 1053 #endif
1053 prev_(Isolate::Current()->save_context()) { 1054 }
1054 Isolate::Current()->set_save_context(this); 1055 isolate->set_save_context(this);
1055 1056
1056 // If there is no JS frame under the current C frame, use the value 0. 1057 // If there is no JS frame under the current C frame, use the value 0.
1057 JavaScriptFrameIterator it; 1058 JavaScriptFrameIterator it;
1058 js_sp_ = it.done() ? 0 : it.frame()->sp(); 1059 js_sp_ = it.done() ? 0 : it.frame()->sp();
1059 } 1060 }
1060 1061
1061 ~SaveContext() { 1062 ~SaveContext() {
1062 Isolate::Current()->set_context(*context_); 1063 if (context_.is_null()) {
1063 Isolate::Current()->set_save_context(prev_); 1064 Isolate* isolate = Isolate::Current();
1065 isolate->set_context(NULL);
1066 isolate->set_save_context(prev_);
1067 } else {
1068 Isolate* isolate = context_->GetIsolate();
1069 isolate->set_context(*context_);
1070 isolate->set_save_context(prev_);
1071 }
1064 } 1072 }
1065 1073
1066 Handle<Context> context() { return context_; } 1074 Handle<Context> context() { return context_; }
1067 SaveContext* prev() { return prev_; } 1075 SaveContext* prev() { return prev_; }
1068 1076
1069 // Returns true if this save context is below a given JavaScript frame. 1077 // Returns true if this save context is below a given JavaScript frame.
1070 bool below(JavaScriptFrame* frame) { 1078 bool below(JavaScriptFrame* frame) {
1071 return (js_sp_ == 0) || (frame->sp() < js_sp_); 1079 return (js_sp_ == 0) || (frame->sp() < js_sp_);
1072 } 1080 }
1073 1081
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
1185 #define ISOLATED_CLASS class 1193 #define ISOLATED_CLASS class
1186 1194
1187 } } // namespace v8::internal 1195 } } // namespace v8::internal
1188 1196
1189 // TODO(isolates): Get rid of these -inl.h includes and place them only where 1197 // TODO(isolates): Get rid of these -inl.h includes and place them only where
1190 // they're needed. 1198 // they're needed.
1191 #include "allocation-inl.h" 1199 #include "allocation-inl.h"
1192 #include "zone-inl.h" 1200 #include "zone-inl.h"
1193 1201
1194 #endif // V8_ISOLATE_H_ 1202 #endif // V8_ISOLATE_H_
OLDNEW
« 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