OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 #include "vm/dart_entry.h" | 5 #include "vm/dart_entry.h" |
6 | 6 |
7 #include "vm/class_finalizer.h" | 7 #include "vm/class_finalizer.h" |
8 #include "vm/code_generator.h" | 8 #include "vm/code_generator.h" |
9 #include "vm/compiler.h" | 9 #include "vm/compiler.h" |
10 #include "vm/debugger.h" | 10 #include "vm/debugger.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 const Array& arguments) { | 24 const Array& arguments) { |
25 const Array& arguments_descriptor = | 25 const Array& arguments_descriptor = |
26 Array::Handle(ArgumentsDescriptor::New(arguments.Length())); | 26 Array::Handle(ArgumentsDescriptor::New(arguments.Length())); |
27 return InvokeFunction(function, arguments, arguments_descriptor); | 27 return InvokeFunction(function, arguments, arguments_descriptor); |
28 } | 28 } |
29 | 29 |
30 | 30 |
31 class ScopedIsolateStackLimits : public ValueObject { | 31 class ScopedIsolateStackLimits : public ValueObject { |
32 public: | 32 public: |
33 explicit ScopedIsolateStackLimits(Isolate* isolate) | 33 explicit ScopedIsolateStackLimits(Isolate* isolate) |
34 : isolate_(isolate) { | 34 : isolate_(isolate), stack_base_(Isolate::GetCurrentStackPointer()) { |
35 ASSERT(isolate_ != NULL); | 35 ASSERT(isolate_ != NULL); |
36 ASSERT(isolate_ == Isolate::Current()); | 36 ASSERT(isolate_ == Isolate::Current()); |
37 uword stack_base = reinterpret_cast<uword>(this); | 37 if (stack_base_ >= isolate_->stack_base()) { |
38 if (stack_base >= isolate_->stack_base()) { | 38 isolate_->SetStackLimitFromStackBase(stack_base_); |
39 isolate_->SetStackLimitFromStackBase(stack_base); | |
40 } | 39 } |
41 } | 40 } |
42 | 41 |
43 ~ScopedIsolateStackLimits() { | 42 ~ScopedIsolateStackLimits() { |
44 ASSERT(isolate_ == Isolate::Current()); | 43 ASSERT(isolate_ == Isolate::Current()); |
45 uword stack_base = reinterpret_cast<uword>(this); | 44 if (isolate_->stack_base() == stack_base_) { |
46 if (isolate_->stack_base() == stack_base) { | |
47 // Bottomed out. | 45 // Bottomed out. |
48 isolate_->ClearStackLimit(); | 46 isolate_->ClearStackLimit(); |
49 } | 47 } |
50 } | 48 } |
51 | 49 |
52 private: | 50 private: |
53 Isolate* isolate_; | 51 Isolate* isolate_; |
| 52 uword stack_base_; |
54 }; | 53 }; |
55 | 54 |
56 | 55 |
57 // Clears/restores Isolate::long_jump_base on construction/destruction. | 56 // Clears/restores Isolate::long_jump_base on construction/destruction. |
58 // Ensures that we do not attempt to long jump across Dart frames. | 57 // Ensures that we do not attempt to long jump across Dart frames. |
59 class SuspendLongJumpScope : public StackResource { | 58 class SuspendLongJumpScope : public StackResource { |
60 public: | 59 public: |
61 explicit SuspendLongJumpScope(Isolate* isolate) | 60 explicit SuspendLongJumpScope(Isolate* isolate) |
62 : StackResource(isolate), | 61 : StackResource(isolate), |
63 saved_long_jump_base_(isolate->long_jump_base()) { | 62 saved_long_jump_base_(isolate->long_jump_base()) { |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 const Array& args = Array::Handle(Array::New(kNumArguments)); | 515 const Array& args = Array::Handle(Array::New(kNumArguments)); |
517 args.SetAt(0, map); | 516 args.SetAt(0, map); |
518 args.SetAt(1, key); | 517 args.SetAt(1, key); |
519 args.SetAt(2, value); | 518 args.SetAt(2, value); |
520 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, | 519 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, |
521 args)); | 520 args)); |
522 return result.raw(); | 521 return result.raw(); |
523 } | 522 } |
524 | 523 |
525 } // namespace dart | 524 } // namespace dart |
OLD | NEW |