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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 Zone* zone = thread->zone(); | 83 Zone* zone = thread->zone(); |
84 Isolate* isolate = thread->isolate(); | 84 Isolate* isolate = thread->isolate(); |
85 if (!function.HasCode()) { | 85 if (!function.HasCode()) { |
86 const Error& error = Error::Handle( | 86 const Error& error = Error::Handle( |
87 zone, Compiler::CompileFunction(thread, function)); | 87 zone, Compiler::CompileFunction(thread, function)); |
88 if (!error.IsNull()) { | 88 if (!error.IsNull()) { |
89 return error.raw(); | 89 return error.raw(); |
90 } | 90 } |
91 } | 91 } |
92 // Now Call the invoke stub which will invoke the dart function. | 92 // Now Call the invoke stub which will invoke the dart function. |
| 93 const Code& invoke_stub = Code::CheckedHandle( |
| 94 isolate->stub_code()->InvokeDartCodeCode()); |
| 95 |
93 invokestub entrypoint = reinterpret_cast<invokestub>( | 96 invokestub entrypoint = reinterpret_cast<invokestub>( |
94 isolate->stub_code()->InvokeDartCodeEntryPoint()); | 97 invoke_stub.EntryPoint()); |
95 const Code& code = Code::Handle(zone, function.CurrentCode()); | 98 const Code& code = Code::Handle(zone, function.CurrentCode()); |
96 ASSERT(!code.IsNull()); | 99 ASSERT(!code.IsNull()); |
97 ASSERT(Isolate::Current()->no_callback_scope_depth() == 0); | 100 ASSERT(Isolate::Current()->no_callback_scope_depth() == 0); |
98 ScopedIsolateStackLimits stack_limit(isolate); | 101 ScopedIsolateStackLimits stack_limit(isolate); |
99 SuspendLongJumpScope suspend_long_jump_scope(isolate); | 102 SuspendLongJumpScope suspend_long_jump_scope(isolate); |
100 #if defined(USING_SIMULATOR) | 103 #if defined(USING_SIMULATOR) |
101 #if defined(ARCH_IS_64_BIT) | 104 #if defined(ARCH_IS_64_BIT) |
102 // TODO(zra): Change to intptr_t so we have only one case. | 105 // TODO(zra): Change to intptr_t so we have only one case. |
103 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( | 106 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( |
104 reinterpret_cast<int64_t>(entrypoint), | 107 reinterpret_cast<int64_t>(entrypoint), |
105 static_cast<int64_t>(code.EntryPoint()), | 108 static_cast<int64_t>(code.EntryPoint()), |
106 reinterpret_cast<int64_t>(&arguments_descriptor), | 109 reinterpret_cast<int64_t>(&arguments_descriptor), |
107 reinterpret_cast<int64_t>(&arguments), | 110 reinterpret_cast<int64_t>(&arguments), |
108 reinterpret_cast<int64_t>(thread))); | 111 reinterpret_cast<int64_t>(thread))); |
109 #else | 112 #else |
110 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( | 113 return bit_copy<RawObject*, int64_t>(Simulator::Current()->Call( |
111 reinterpret_cast<int32_t>(entrypoint), | 114 reinterpret_cast<int32_t>(entrypoint), |
112 static_cast<int32_t>(code.EntryPoint()), | 115 static_cast<int32_t>(code.EntryPoint()), |
113 reinterpret_cast<int32_t>(&arguments_descriptor), | 116 reinterpret_cast<int32_t>(&arguments_descriptor), |
114 reinterpret_cast<int32_t>(&arguments), | 117 reinterpret_cast<int32_t>(&arguments), |
115 reinterpret_cast<int32_t>(thread))); | 118 reinterpret_cast<int32_t>(thread))); |
116 #endif | 119 #endif |
| 120 #elif defined(TARGET_ARCH_X64) |
| 121 return entrypoint(invoke_stub, |
| 122 code, |
| 123 arguments_descriptor, |
| 124 arguments, |
| 125 thread); |
117 #else | 126 #else |
118 return entrypoint(code.EntryPoint(), | 127 return entrypoint(code.EntryPoint(), |
119 arguments_descriptor, | 128 arguments_descriptor, |
120 arguments, | 129 arguments, |
121 thread); | 130 thread); |
122 #endif | 131 #endif |
123 } | 132 } |
124 | 133 |
125 | 134 |
126 RawObject* DartEntry::InvokeClosure(const Array& arguments) { | 135 RawObject* DartEntry::InvokeClosure(const Array& arguments) { |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 const Array& args = Array::Handle(Array::New(kNumArguments)); | 527 const Array& args = Array::Handle(Array::New(kNumArguments)); |
519 args.SetAt(0, map); | 528 args.SetAt(0, map); |
520 args.SetAt(1, key); | 529 args.SetAt(1, key); |
521 args.SetAt(2, value); | 530 args.SetAt(2, value); |
522 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, | 531 const Object& result = Object::Handle(DartEntry::InvokeFunction(function, |
523 args)); | 532 args)); |
524 return result.raw(); | 533 return result.raw(); |
525 } | 534 } |
526 | 535 |
527 } // namespace dart | 536 } // namespace dart |
OLD | NEW |