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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) { |
81 // Get the entrypoint corresponding to the function specified, this | 81 // Get the entrypoint corresponding to the function specified, this |
82 // will result in a compilation of the function if it is not already | 82 // will result in a compilation of the function if it is not already |
83 // compiled. | 83 // compiled. |
84 Thread* thread = Thread::Current(); | 84 Thread* thread = Thread::Current(); |
85 Zone* zone = thread->zone(); | 85 Zone* zone = thread->zone(); |
86 Isolate* isolate = thread->isolate(); | 86 Isolate* isolate = thread->isolate(); |
| 87 ASSERT(isolate->MutatorThreadIsCurrentThread()); |
87 if (!function.HasCode()) { | 88 if (!function.HasCode()) { |
88 const Error& error = Error::Handle( | 89 const Error& error = Error::Handle( |
89 zone, Compiler::CompileFunction(thread, function)); | 90 zone, Compiler::CompileFunction(thread, function)); |
90 if (!error.IsNull()) { | 91 if (!error.IsNull()) { |
91 return error.raw(); | 92 return error.raw(); |
92 } | 93 } |
93 } | 94 } |
94 // Now Call the invoke stub which will invoke the dart function. | 95 // Now Call the invoke stub which will invoke the dart function. |
95 invokestub entrypoint = reinterpret_cast<invokestub>( | 96 invokestub entrypoint = reinterpret_cast<invokestub>( |
96 StubCode::InvokeDartCode_entry()->EntryPoint()); | 97 StubCode::InvokeDartCode_entry()->EntryPoint()); |
97 const Code& code = Code::Handle(zone, function.CurrentCode()); | 98 const Code& code = Code::Handle(zone, function.CurrentCode()); |
98 ASSERT(!code.IsNull()); | 99 ASSERT(!code.IsNull()); |
99 ASSERT(Isolate::Current()->no_callback_scope_depth() == 0); | 100 ASSERT(thread->no_callback_scope_depth() == 0); |
100 ScopedIsolateStackLimits stack_limit(isolate); | 101 ScopedIsolateStackLimits stack_limit(isolate); |
101 SuspendLongJumpScope suspend_long_jump_scope(thread); | 102 SuspendLongJumpScope suspend_long_jump_scope(thread); |
102 #if defined(USING_SIMULATOR) | 103 #if defined(USING_SIMULATOR) |
103 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( | 104 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( |
104 reinterpret_cast<intptr_t>(entrypoint), | 105 reinterpret_cast<intptr_t>(entrypoint), |
105 reinterpret_cast<intptr_t>(&code), | 106 reinterpret_cast<intptr_t>(&code), |
106 reinterpret_cast<intptr_t>(&arguments_descriptor), | 107 reinterpret_cast<intptr_t>(&arguments_descriptor), |
107 reinterpret_cast<intptr_t>(&arguments), | 108 reinterpret_cast<intptr_t>(&arguments), |
108 reinterpret_cast<intptr_t>(thread))); | 109 reinterpret_cast<intptr_t>(thread))); |
109 #else | 110 #else |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 const Array& args = Array::Handle(Array::New(kNumArguments)); | 579 const Array& args = Array::Handle(Array::New(kNumArguments)); |
579 args.SetAt(0, map); | 580 args.SetAt(0, map); |
580 args.SetAt(1, key); | 581 args.SetAt(1, key); |
581 args.SetAt(2, value); | 582 args.SetAt(2, value); |
582 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, | 583 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, |
583 args)); | 584 args)); |
584 return result.raw(); | 585 return result.raw(); |
585 } | 586 } |
586 | 587 |
587 } // namespace dart | 588 } // namespace dart |
OLD | NEW |