| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (!function.HasCode()) { | 48 if (!function.HasCode()) { |
| 49 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 49 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
| 50 if (!error.IsNull()) { | 50 if (!error.IsNull()) { |
| 51 return error.raw(); | 51 return error.raw(); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 // Now Call the invoke stub which will invoke the dart function. | 54 // Now Call the invoke stub which will invoke the dart function. |
| 55 Isolate* isolate = Isolate::Current(); |
| 56 TIMERSCOPE(isolate, time_dart_execution); |
| 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->no_callback_scope_depth() == 0); |
| 60 #if defined(USING_SIMULATOR) | 62 #if defined(USING_SIMULATOR) |
| 61 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( | 63 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( |
| 62 reinterpret_cast<int32_t>(entrypoint), | 64 reinterpret_cast<int32_t>(entrypoint), |
| 63 static_cast<int32_t>(code.EntryPoint()), | 65 static_cast<int32_t>(code.EntryPoint()), |
| 64 reinterpret_cast<int32_t>(&arguments_descriptor), | 66 reinterpret_cast<int32_t>(&arguments_descriptor), |
| 65 reinterpret_cast<int32_t>(&arguments), | 67 reinterpret_cast<int32_t>(&arguments), |
| 66 reinterpret_cast<int32_t>(&context))); | 68 reinterpret_cast<int32_t>(&context))); |
| 67 #else | 69 #else |
| 68 return entrypoint(code.EntryPoint(), | 70 return entrypoint(code.EntryPoint(), |
| 69 arguments_descriptor, | 71 arguments_descriptor, |
| 70 arguments, | 72 arguments, |
| 71 context); | 73 context); |
| 72 #endif | 74 #endif |
| 73 } | 75 } |
| 74 | 76 |
| 75 | 77 |
| 76 RawObject* DartEntry::InvokeClosure(const Array& arguments) { | 78 RawObject* DartEntry::InvokeClosure(const Array& arguments) { |
| 77 const Array& arguments_descriptor = | 79 const Array& arguments_descriptor = |
| 78 Array::Handle(ArgumentsDescriptor::New(arguments.Length())); | 80 Array::Handle(ArgumentsDescriptor::New(arguments.Length())); |
| 79 return InvokeClosure(arguments, arguments_descriptor); | 81 return InvokeClosure(arguments, arguments_descriptor); |
| 80 } | 82 } |
| 81 | 83 |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 // Get send port class from isolate library. | 501 // Get send port class from isolate library. |
| 500 const Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); | 502 const Library& isolate_lib = Library::Handle(Library::IsolateLibrary()); |
| 501 const Class& send_port_cls = Class::Handle( | 503 const Class& send_port_cls = Class::Handle( |
| 502 isolate_lib.LookupClassAllowPrivate(Symbols::_SendPortImpl())); | 504 isolate_lib.LookupClassAllowPrivate(Symbols::_SendPortImpl())); |
| 503 // Check for the same class id. | 505 // Check for the same class id. |
| 504 ASSERT(!send_port_cls.IsNull()); | 506 ASSERT(!send_port_cls.IsNull()); |
| 505 return cls.id() == send_port_cls.id(); | 507 return cls.id() == send_port_cls.id(); |
| 506 } | 508 } |
| 507 | 509 |
| 508 } // namespace dart | 510 } // namespace dart |
| OLD | NEW |