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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 const Array& arguments_descriptor, | 89 const Array& arguments_descriptor, |
90 uword current_sp) { | 90 uword current_sp) { |
91 // Get the entrypoint corresponding to the function specified, this | 91 // Get the entrypoint corresponding to the function specified, this |
92 // will result in a compilation of the function if it is not already | 92 // will result in a compilation of the function if it is not already |
93 // compiled. | 93 // compiled. |
94 Thread* thread = Thread::Current(); | 94 Thread* thread = Thread::Current(); |
95 Zone* zone = thread->zone(); | 95 Zone* zone = thread->zone(); |
96 ASSERT(thread->IsMutatorThread()); | 96 ASSERT(thread->IsMutatorThread()); |
97 ScopedIsolateStackLimits stack_limit(thread, current_sp); | 97 ScopedIsolateStackLimits stack_limit(thread, current_sp); |
98 if (!function.HasCode()) { | 98 if (!function.HasCode()) { |
99 const Error& error = | 99 const Object& result = |
100 Error::Handle(zone, Compiler::CompileFunction(thread, function)); | 100 Object::Handle(zone, Compiler::CompileFunction(thread, function)); |
101 if (!error.IsNull()) { | 101 if (result.IsError()) { |
102 return error.raw(); | 102 return Error::Cast(result).raw(); |
103 } | 103 } |
104 } | 104 } |
105 // Now Call the invoke stub which will invoke the dart function. | 105 // Now Call the invoke stub which will invoke the dart function. |
106 #if !defined(TARGET_ARCH_DBC) | 106 #if !defined(TARGET_ARCH_DBC) |
107 invokestub entrypoint = reinterpret_cast<invokestub>( | 107 invokestub entrypoint = reinterpret_cast<invokestub>( |
108 StubCode::InvokeDartCode_entry()->EntryPoint()); | 108 StubCode::InvokeDartCode_entry()->EntryPoint()); |
109 #endif | 109 #endif |
110 const Code& code = Code::Handle(zone, function.CurrentCode()); | 110 const Code& code = Code::Handle(zone, function.CurrentCode()); |
111 ASSERT(!code.IsNull()); | 111 ASSERT(!code.IsNull()); |
112 ASSERT(thread->no_callback_scope_depth() == 0); | 112 ASSERT(thread->no_callback_scope_depth() == 0); |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 const Array& args = Array::Handle(Array::New(kNumArguments)); | 586 const Array& args = Array::Handle(Array::New(kNumArguments)); |
587 args.SetAt(0, map); | 587 args.SetAt(0, map); |
588 args.SetAt(1, key); | 588 args.SetAt(1, key); |
589 args.SetAt(2, value); | 589 args.SetAt(2, value); |
590 const Object& result = | 590 const Object& result = |
591 Object::Handle(DartEntry::InvokeFunction(function, args)); | 591 Object::Handle(DartEntry::InvokeFunction(function, args)); |
592 return result.raw(); | 592 return result.raw(); |
593 } | 593 } |
594 | 594 |
595 } // namespace dart | 595 } // namespace dart |
OLD | NEW |