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

Side by Side Diff: runtime/vm/dart_entry.cc

Issue 1299653003: Migrate LongJumpScope to Thread. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Assert current isolate. Created 5 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 unified diff | Download patch
« no previous file with comments | « runtime/vm/allocation_test.cc ('k') | runtime/vm/isolate.h » ('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) 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 isolate_->ClearStackLimit(); 48 isolate_->ClearStackLimit();
49 } 49 }
50 } 50 }
51 51
52 private: 52 private:
53 Isolate* isolate_; 53 Isolate* isolate_;
54 uword stack_base_; 54 uword stack_base_;
55 }; 55 };
56 56
57 57
58 // Clears/restores Isolate::long_jump_base on construction/destruction. 58 // Clears/restores Thread::long_jump_base on construction/destruction.
59 // Ensures that we do not attempt to long jump across Dart frames. 59 // Ensures that we do not attempt to long jump across Dart frames.
60 class SuspendLongJumpScope : public StackResource { 60 class SuspendLongJumpScope : public StackResource {
61 public: 61 public:
62 explicit SuspendLongJumpScope(Isolate* isolate) 62 explicit SuspendLongJumpScope(Thread* thread)
63 : StackResource(isolate), 63 : StackResource(thread),
64 saved_long_jump_base_(isolate->long_jump_base()) { 64 saved_long_jump_base_(thread->long_jump_base()) {
65 isolate->set_long_jump_base(NULL); 65 thread->set_long_jump_base(NULL);
66 } 66 }
67 67
68 ~SuspendLongJumpScope() { 68 ~SuspendLongJumpScope() {
69 ASSERT(isolate()->long_jump_base() == NULL); 69 ASSERT(thread()->long_jump_base() == NULL);
70 isolate()->set_long_jump_base(saved_long_jump_base_); 70 thread()->set_long_jump_base(saved_long_jump_base_);
71 } 71 }
72 72
73 private: 73 private:
74 LongJumpScope* saved_long_jump_base_; 74 LongJumpScope* saved_long_jump_base_;
75 }; 75 };
76 76
77 77
78 RawObject* DartEntry::InvokeFunction(const Function& function, 78 RawObject* DartEntry::InvokeFunction(const Function& function,
79 const Array& arguments, 79 const Array& arguments,
80 const Array& arguments_descriptor) { 80 const Array& arguments_descriptor) {
(...skipping 10 matching lines...) Expand all
91 return error.raw(); 91 return error.raw();
92 } 92 }
93 } 93 }
94 // Now Call the invoke stub which will invoke the dart function. 94 // Now Call the invoke stub which will invoke the dart function.
95 invokestub entrypoint = reinterpret_cast<invokestub>( 95 invokestub entrypoint = reinterpret_cast<invokestub>(
96 StubCode::InvokeDartCode_entry()->EntryPoint()); 96 StubCode::InvokeDartCode_entry()->EntryPoint());
97 const Code& code = Code::Handle(zone, function.CurrentCode()); 97 const Code& code = Code::Handle(zone, function.CurrentCode());
98 ASSERT(!code.IsNull()); 98 ASSERT(!code.IsNull());
99 ASSERT(Isolate::Current()->no_callback_scope_depth() == 0); 99 ASSERT(Isolate::Current()->no_callback_scope_depth() == 0);
100 ScopedIsolateStackLimits stack_limit(isolate); 100 ScopedIsolateStackLimits stack_limit(isolate);
101 SuspendLongJumpScope suspend_long_jump_scope(isolate); 101 SuspendLongJumpScope suspend_long_jump_scope(thread);
102 #if defined(USING_SIMULATOR) 102 #if defined(USING_SIMULATOR)
103 #if defined(ARCH_IS_64_BIT) 103 #if defined(ARCH_IS_64_BIT)
104 // TODO(zra): Change to intptr_t so we have only one case. 104 // TODO(zra): Change to intptr_t so we have only one case.
105 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( 105 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call(
106 reinterpret_cast<int64_t>(entrypoint), 106 reinterpret_cast<int64_t>(entrypoint),
107 static_cast<int64_t>(code.EntryPoint()), 107 static_cast<int64_t>(code.EntryPoint()),
108 reinterpret_cast<int64_t>(&arguments_descriptor), 108 reinterpret_cast<int64_t>(&arguments_descriptor),
109 reinterpret_cast<int64_t>(&arguments), 109 reinterpret_cast<int64_t>(&arguments),
110 reinterpret_cast<int64_t>(thread))); 110 reinterpret_cast<int64_t>(thread)));
111 #else 111 #else
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 const Array& args = Array::Handle(Array::New(kNumArguments)); 572 const Array& args = Array::Handle(Array::New(kNumArguments));
573 args.SetAt(0, map); 573 args.SetAt(0, map);
574 args.SetAt(1, key); 574 args.SetAt(1, key);
575 args.SetAt(2, value); 575 args.SetAt(2, value);
576 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, 576 const Object& result = Object::Handle(DartEntry::InvokeFunction(function,
577 args)); 577 args));
578 return result.raw(); 578 return result.raw();
579 } 579 }
580 580
581 } // namespace dart 581 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/allocation_test.cc ('k') | runtime/vm/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698