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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 it does not need | 211 // If dart:_builtin was not compiled from Kernel at all it does not need |
212 // to be patched. | 212 // to be patched. |
213 if (procedure != 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 new function body. Find a way to |
217 // deallocate it. | 217 // deallocate it. |
218 procedure->function()->set_body( | 218 procedure->function()->ReplaceBody( |
219 new ReturnStatement(new StaticGet(NameIndex()))); | 219 new ReturnStatement(new StaticGet(NameIndex()))); |
220 } | 220 } |
221 return library; | 221 return library; |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 // Either class finalization failed or we caught a compile error. | 225 // Either class finalization failed or we caught a compile error. |
226 // In both cases sticky error would be set. | 226 // In both cases sticky error would be set. |
227 Error& error = Error::Handle(Z); | 227 Error& error = Error::Handle(Z); |
228 error = thread_->sticky_error(); | 228 error = thread_->sticky_error(); |
(...skipping 711 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 |