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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 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 // Note that we pass "true" in cannot_stream to avoid trying to stream |
| 216 // a non-existing part of the binary. |
215 // | 217 // |
216 // TODO(kmillikin): we are leaking the new function body. Find a way to | 218 // TODO(kmillikin): we are leaking the new function body. Find a way to |
217 // deallocate it. | 219 // deallocate it. |
218 procedure->function()->ReplaceBody( | 220 procedure->function()->ReplaceBody( |
219 new ReturnStatement(new StaticGet(NameIndex()))); | 221 new ReturnStatement(new StaticGet(NameIndex(), false), false)); |
220 } | 222 } |
221 return library; | 223 return library; |
222 } | 224 } |
223 } | 225 } |
224 | 226 |
225 // Either class finalization failed or we caught a compile error. | 227 // Either class finalization failed or we caught a compile error. |
226 // In both cases sticky error would be set. | 228 // In both cases sticky error would be set. |
227 Error& error = Error::Handle(Z); | 229 Error& error = Error::Handle(Z); |
228 error = thread_->sticky_error(); | 230 error = thread_->sticky_error(); |
229 thread_->clear_sticky_error(); | 231 thread_->clear_sticky_error(); |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
940 initializer_fun.set_is_debuggable(false); | 942 initializer_fun.set_is_debuggable(false); |
941 initializer_fun.set_is_reflectable(false); | 943 initializer_fun.set_is_reflectable(false); |
942 initializer_fun.set_is_inlinable(false); | 944 initializer_fun.set_is_inlinable(false); |
943 return new (zone) ParsedFunction(thread, initializer_fun); | 945 return new (zone) ParsedFunction(thread, initializer_fun); |
944 } | 946 } |
945 | 947 |
946 | 948 |
947 } // namespace kernel | 949 } // namespace kernel |
948 } // namespace dart | 950 } // namespace dart |
949 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 951 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |