| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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/kernel_reader.h" | 5 #include "vm/kernel_reader.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include "vm/dart_api_impl.h" | 9 #include "vm/dart_api_impl.h" |
| 10 #include "vm/kernel_binary.h" | 10 #include "vm/kernel_binary.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 Object& main_obj = Object::Handle( | 201 Object& main_obj = Object::Handle( |
| 202 Z, library.LookupObjectAllowPrivate(H.DartSymbol("main"))); | 202 Z, library.LookupObjectAllowPrivate(H.DartSymbol("main"))); |
| 203 ASSERT(!main_obj.IsNull()); | 203 ASSERT(!main_obj.IsNull()); |
| 204 | 204 |
| 205 Function& to_patch = Function::Handle( | 205 Function& to_patch = Function::Handle( |
| 206 Z, builtin_library.LookupFunctionAllowPrivate( | 206 Z, builtin_library.LookupFunctionAllowPrivate( |
| 207 dart::String::Handle(dart::String::New("_getMainClosure")))); | 207 dart::String::Handle(dart::String::New("_getMainClosure")))); |
| 208 | 208 |
| 209 Procedure* procedure = | 209 Procedure* procedure = |
| 210 reinterpret_cast<Procedure*>(to_patch.kernel_function()); | 210 reinterpret_cast<Procedure*>(to_patch.kernel_function()); |
| 211 // If dart:_builtin was not compiled from Kernel at all or if it was | 211 // If dart:_builtin was not compiled from Kernel at all it does not need |
| 212 // linked with a script, it does not need to be patched. | 212 // to be patched. |
| 213 if ((procedure != NULL) && (procedure->function()->body() == NULL)) { | 213 if (procedure != NULL) { |
| 214 // We will handle the StaticGet specially and will not use the name. | 214 // We will handle the StaticGet specially and will not use the name. |
| 215 // | 215 // |
| 216 // TODO(kmillikin): we are leaking the function body. Find a way to | 216 // TODO(kmillikin): we are leaking the function body. Find a way to |
| 217 // deallocate it. | 217 // deallocate it. |
| 218 procedure->function()->set_body( | 218 procedure->function()->set_body( |
| 219 new ReturnStatement(new StaticGet(NameIndex()))); | 219 new ReturnStatement(new StaticGet(NameIndex()))); |
| 220 } | 220 } |
| 221 return library; | 221 return library; |
| 222 } | 222 } |
| 223 } | 223 } |
| (...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 initializer_fun.set_is_debuggable(false); | 940 initializer_fun.set_is_debuggable(false); |
| 941 initializer_fun.set_is_reflectable(false); | 941 initializer_fun.set_is_reflectable(false); |
| 942 initializer_fun.set_is_inlinable(false); | 942 initializer_fun.set_is_inlinable(false); |
| 943 return new (zone) ParsedFunction(thread, initializer_fun); | 943 return new (zone) ParsedFunction(thread, initializer_fun); |
| 944 } | 944 } |
| 945 | 945 |
| 946 | 946 |
| 947 } // namespace kernel | 947 } // namespace kernel |
| 948 } // namespace dart | 948 } // namespace dart |
| 949 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 949 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |