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 27 matching lines...) Expand all Loading... |
38 } | 38 } |
39 | 39 |
40 | 40 |
41 RawObject* DartEntry::InvokeFunction(const Function& function, | 41 RawObject* DartEntry::InvokeFunction(const Function& function, |
42 const Array& arguments, | 42 const Array& arguments, |
43 const Array& arguments_descriptor, | 43 const Array& arguments_descriptor, |
44 const Context& context) { | 44 const Context& context) { |
45 // Get the entrypoint corresponding to the function specified, this | 45 // Get the entrypoint corresponding to the function specified, this |
46 // will result in a compilation of the function if it is not already | 46 // will result in a compilation of the function if it is not already |
47 // compiled. | 47 // compiled. |
| 48 Isolate* isolate = Isolate::Current(); |
48 if (!function.HasCode()) { | 49 if (!function.HasCode()) { |
49 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 50 const Error& error = Error::Handle( |
| 51 isolate, Compiler::CompileFunction(isolate, function)); |
50 if (!error.IsNull()) { | 52 if (!error.IsNull()) { |
51 return error.raw(); | 53 return error.raw(); |
52 } | 54 } |
53 } | 55 } |
54 // Now Call the invoke stub which will invoke the dart function. | 56 // Now Call the invoke stub which will invoke the dart function. |
55 invokestub entrypoint = reinterpret_cast<invokestub>( | 57 invokestub entrypoint = reinterpret_cast<invokestub>( |
56 StubCode::InvokeDartCodeEntryPoint()); | 58 StubCode::InvokeDartCodeEntryPoint()); |
57 const Code& code = Code::Handle(function.CurrentCode()); | 59 const Code& code = Code::Handle(isolate, function.CurrentCode()); |
58 ASSERT(!code.IsNull()); | 60 ASSERT(!code.IsNull()); |
59 ASSERT(Isolate::Current()->no_callback_scope_depth() == 0); | 61 ASSERT(Isolate::Current()->no_callback_scope_depth() == 0); |
60 #if defined(USING_SIMULATOR) | 62 #if defined(USING_SIMULATOR) |
61 #if defined(ARCH_IS_64_BIT) | 63 #if defined(ARCH_IS_64_BIT) |
62 // TODO(zra): Change to intptr_t so we have only one case. | 64 // TODO(zra): Change to intptr_t so we have only one case. |
63 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( | 65 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( |
64 reinterpret_cast<int64_t>(entrypoint), | 66 reinterpret_cast<int64_t>(entrypoint), |
65 static_cast<int64_t>(code.EntryPoint()), | 67 static_cast<int64_t>(code.EntryPoint()), |
66 reinterpret_cast<int64_t>(&arguments_descriptor), | 68 reinterpret_cast<int64_t>(&arguments_descriptor), |
67 reinterpret_cast<int64_t>(&arguments), | 69 reinterpret_cast<int64_t>(&arguments), |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 const Array& args = Array::Handle(Array::New(kNumArguments)); | 463 const Array& args = Array::Handle(Array::New(kNumArguments)); |
462 args.SetAt(0, map); | 464 args.SetAt(0, map); |
463 args.SetAt(1, key); | 465 args.SetAt(1, key); |
464 args.SetAt(2, value); | 466 args.SetAt(2, value); |
465 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, | 467 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, |
466 args)); | 468 args)); |
467 return result.raw(); | 469 return result.raw(); |
468 } | 470 } |
469 | 471 |
470 } // namespace dart | 472 } // namespace dart |
OLD | NEW |