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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 LongJumpScope* saved_long_jump_base_; | 72 LongJumpScope* saved_long_jump_base_; |
73 }; | 73 }; |
74 | 74 |
75 | 75 |
76 RawObject* DartEntry::InvokeFunction(const Function& function, | 76 RawObject* DartEntry::InvokeFunction(const Function& function, |
77 const Array& arguments, | 77 const Array& arguments, |
78 const Array& arguments_descriptor) { | 78 const Array& arguments_descriptor) { |
79 // Get the entrypoint corresponding to the function specified, this | 79 // Get the entrypoint corresponding to the function specified, this |
80 // will result in a compilation of the function if it is not already | 80 // will result in a compilation of the function if it is not already |
81 // compiled. | 81 // compiled. |
82 Isolate* isolate = Isolate::Current(); | 82 Thread* thread = Thread::Current(); |
| 83 Zone* zone = thread->zone(); |
| 84 Isolate* isolate = thread->isolate(); |
83 if (!function.HasCode()) { | 85 if (!function.HasCode()) { |
84 const Error& error = Error::Handle( | 86 const Error& error = Error::Handle( |
85 isolate, Compiler::CompileFunction(isolate, function)); | 87 zone, Compiler::CompileFunction(thread, function)); |
86 if (!error.IsNull()) { | 88 if (!error.IsNull()) { |
87 return error.raw(); | 89 return error.raw(); |
88 } | 90 } |
89 } | 91 } |
90 // Now Call the invoke stub which will invoke the dart function. | 92 // Now Call the invoke stub which will invoke the dart function. |
91 invokestub entrypoint = reinterpret_cast<invokestub>( | 93 invokestub entrypoint = reinterpret_cast<invokestub>( |
92 isolate->stub_code()->InvokeDartCodeEntryPoint()); | 94 isolate->stub_code()->InvokeDartCodeEntryPoint()); |
93 const Code& code = Code::Handle(isolate, function.CurrentCode()); | 95 const Code& code = Code::Handle(zone, function.CurrentCode()); |
94 ASSERT(!code.IsNull()); | 96 ASSERT(!code.IsNull()); |
95 ASSERT(Isolate::Current()->no_callback_scope_depth() == 0); | 97 ASSERT(Isolate::Current()->no_callback_scope_depth() == 0); |
96 ScopedIsolateStackLimits stack_limit(isolate); | 98 ScopedIsolateStackLimits stack_limit(isolate); |
97 SuspendLongJumpScope suspend_long_jump_scope(isolate); | 99 SuspendLongJumpScope suspend_long_jump_scope(isolate); |
98 #if defined(USING_SIMULATOR) | 100 #if defined(USING_SIMULATOR) |
99 #if defined(ARCH_IS_64_BIT) | 101 #if defined(ARCH_IS_64_BIT) |
100 // TODO(zra): Change to intptr_t so we have only one case. | 102 // TODO(zra): Change to intptr_t so we have only one case. |
101 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( | 103 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( |
102 reinterpret_cast<int64_t>(entrypoint), | 104 reinterpret_cast<int64_t>(entrypoint), |
103 static_cast<int64_t>(code.EntryPoint()), | 105 static_cast<int64_t>(code.EntryPoint()), |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
515 const Array& args = Array::Handle(Array::New(kNumArguments)); | 517 const Array& args = Array::Handle(Array::New(kNumArguments)); |
516 args.SetAt(0, map); | 518 args.SetAt(0, map); |
517 args.SetAt(1, key); | 519 args.SetAt(1, key); |
518 args.SetAt(2, value); | 520 args.SetAt(2, value); |
519 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, | 521 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, |
520 args)); | 522 args)); |
521 return result.raw(); | 523 return result.raw(); |
522 } | 524 } |
523 | 525 |
524 } // namespace dart | 526 } // namespace dart |
OLD | NEW |