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

Unified Diff: runtime/vm/dart_entry.cc

Issue 506933002: Keep track of stack base whenever Dart code is invoked. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | « no previous file | runtime/vm/isolate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/dart_entry.cc
diff --git a/runtime/vm/dart_entry.cc b/runtime/vm/dart_entry.cc
index 7a5ce3207f9a44123865d2eacdcb98ed67bdac67..129b927aa0e2d38ad31e91994a3a531d27e72fe0 100644
--- a/runtime/vm/dart_entry.cc
+++ b/runtime/vm/dart_entry.cc
@@ -38,6 +38,32 @@ RawObject* DartEntry::InvokeFunction(const Function& function,
}
+class ScopedIsolateStackLimits : public ValueObject {
+ public:
+ explicit ScopedIsolateStackLimits(Isolate* isolate)
+ : isolate_(isolate) {
+ ASSERT(isolate_ != NULL);
+ ASSERT(isolate_ == Isolate::Current());
+ uword stack_base = reinterpret_cast<uword>(this);
+ if (stack_base >= isolate_->stack_base()) {
+ isolate_->SetStackLimitFromStackBase(stack_base);
+ }
+ }
+
+ ~ScopedIsolateStackLimits() {
+ ASSERT(isolate_ == Isolate::Current());
+ uword stack_base = reinterpret_cast<uword>(this);
+ if (isolate_->stack_base() == stack_base) {
+ // Bottomed out.
+ isolate_->ClearStackLimit();
+ }
+ }
+
+ private:
+ Isolate* isolate_;
+};
+
+
RawObject* DartEntry::InvokeFunction(const Function& function,
const Array& arguments,
const Array& arguments_descriptor,
@@ -59,6 +85,7 @@ RawObject* DartEntry::InvokeFunction(const Function& function,
const Code& code = Code::Handle(isolate, function.CurrentCode());
ASSERT(!code.IsNull());
ASSERT(Isolate::Current()->no_callback_scope_depth() == 0);
+ ScopedIsolateStackLimits stack_limit(isolate);
#if defined(USING_SIMULATOR)
#if defined(ARCH_IS_64_BIT)
// TODO(zra): Change to intptr_t so we have only one case.
« no previous file with comments | « no previous file | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698