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

Side by Side Diff: runtime/vm/isolate.h

Issue 1417523006: 1. Do not initialize the stack limit during isolate initialization, it is done instead at StartIsol… (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: self-review-comments Created 5 years, 1 month 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 | « runtime/vm/dart.cc ('k') | runtime/vm/isolate.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_ISOLATE_H_ 5 #ifndef VM_ISOLATE_H_
6 #define VM_ISOLATE_H_ 6 #define VM_ISOLATE_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "vm/atomic.h" 10 #include "vm/atomic.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 environment_callback_ = value; 205 environment_callback_ = value;
206 } 206 }
207 207
208 Dart_LibraryTagHandler library_tag_handler() const { 208 Dart_LibraryTagHandler library_tag_handler() const {
209 return library_tag_handler_; 209 return library_tag_handler_;
210 } 210 }
211 void set_library_tag_handler(Dart_LibraryTagHandler value) { 211 void set_library_tag_handler(Dart_LibraryTagHandler value) {
212 library_tag_handler_ = value; 212 library_tag_handler_ = value;
213 } 213 }
214 214
215 void InitializeStackLimit();
216 void SetStackLimit(uword value); 215 void SetStackLimit(uword value);
217 void SetStackLimitFromStackBase(uword stack_base); 216 void SetStackLimitFromStackBase(uword stack_base);
218 void ClearStackLimit(); 217 void ClearStackLimit();
219 218
220 // Returns the current C++ stack pointer. Equivalent taking the address of a 219 // Returns the current C++ stack pointer. Equivalent taking the address of a
221 // stack allocated local, but plays well with AddressSanitizer. 220 // stack allocated local, but plays well with AddressSanitizer.
222 // TODO(koda): Move to Thread. 221 // TODO(koda): Move to Thread.
223 static uword GetCurrentStackPointer(); 222 static uword GetCurrentStackPointer();
224 223
225 void SetupInstructionsSnapshotPage( 224 void SetupInstructionsSnapshotPage(
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
905 904
906 905
907 // When we need to execute code in an isolate, we use the 906 // When we need to execute code in an isolate, we use the
908 // StartIsolateScope. 907 // StartIsolateScope.
909 class StartIsolateScope { 908 class StartIsolateScope {
910 public: 909 public:
911 explicit StartIsolateScope(Isolate* new_isolate) 910 explicit StartIsolateScope(Isolate* new_isolate)
912 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) { 911 : new_isolate_(new_isolate), saved_isolate_(Isolate::Current()) {
913 // TODO(koda): Audit users; passing NULL goes against naming of this class. 912 // TODO(koda): Audit users; passing NULL goes against naming of this class.
914 if (new_isolate_ == NULL) { 913 if (new_isolate_ == NULL) {
914 ASSERT(Isolate::Current() == NULL);
915 // Do nothing. 915 // Do nothing.
916 return; 916 return;
917 } 917 }
918 if (saved_isolate_ != new_isolate_) { 918 if (saved_isolate_ != new_isolate_) {
919 ASSERT(Isolate::Current() == NULL); 919 ASSERT(Isolate::Current() == NULL);
920 // Ensure this is not a nested 'isolate enter' with prior state.
921 ASSERT(new_isolate_->stack_base() == 0);
920 Thread::EnterIsolate(new_isolate_); 922 Thread::EnterIsolate(new_isolate_);
921 new_isolate_->SetStackLimitFromStackBase(
922 Isolate::GetCurrentStackPointer());
923 } 923 }
924 } 924 }
925 925
926 ~StartIsolateScope() { 926 ~StartIsolateScope() {
927 if (new_isolate_ == NULL) { 927 if (new_isolate_ == NULL) {
928 ASSERT(Isolate::Current() == NULL);
928 // Do nothing. 929 // Do nothing.
929 return; 930 return;
930 } 931 }
931 if (saved_isolate_ != new_isolate_) { 932 if (saved_isolate_ != new_isolate_) {
932 new_isolate_->ClearStackLimit(); 933 ASSERT(saved_isolate_ == NULL);
934 // ASSERT that we have bottomed out of all Dart invocations.
935 ASSERT(new_isolate_->stack_base() == 0);
933 Thread::ExitIsolate(); 936 Thread::ExitIsolate();
934 ASSERT(saved_isolate_ == NULL);
935 } 937 }
936 } 938 }
937 939
938 private: 940 private:
939 Isolate* new_isolate_; 941 Isolate* new_isolate_;
940 Isolate* saved_isolate_; 942 Isolate* saved_isolate_;
941 943
942 DISALLOW_COPY_AND_ASSIGN(StartIsolateScope); 944 DISALLOW_COPY_AND_ASSIGN(StartIsolateScope);
943 }; 945 };
944 946
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 uint8_t* serialized_message_; 1045 uint8_t* serialized_message_;
1044 intptr_t serialized_message_len_; 1046 intptr_t serialized_message_len_;
1045 Isolate::Flags isolate_flags_; 1047 Isolate::Flags isolate_flags_;
1046 bool paused_; 1048 bool paused_;
1047 bool errors_are_fatal_; 1049 bool errors_are_fatal_;
1048 }; 1050 };
1049 1051
1050 } // namespace dart 1052 } // namespace dart
1051 1053
1052 #endif // VM_ISOLATE_H_ 1054 #endif // VM_ISOLATE_H_
OLDNEW
« no previous file with comments | « runtime/vm/dart.cc ('k') | runtime/vm/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698