Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(390)

Side by Side Diff: runtime/vm/kernel_reader.cc

Issue 2854393002: [kernel] [partial] Streaming of kernel binary without AST nodes (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 Function& to_patch = Function::Handle( 194 Function& to_patch = Function::Handle(
195 Z, builtin_library.LookupFunctionAllowPrivate( 195 Z, builtin_library.LookupFunctionAllowPrivate(
196 dart::String::Handle(dart::String::New("_getMainClosure")))); 196 dart::String::Handle(dart::String::New("_getMainClosure"))));
197 197
198 Procedure* procedure = 198 Procedure* procedure =
199 reinterpret_cast<Procedure*>(to_patch.kernel_function()); 199 reinterpret_cast<Procedure*>(to_patch.kernel_function());
200 // If dart:_builtin was not compiled from Kernel at all or if it was 200 // If dart:_builtin was not compiled from Kernel at all or if it was
201 // linked with a script, it does not need to be patched. 201 // linked with a script, it does not need to be patched.
202 if ((procedure != NULL) && (procedure->function()->body() == NULL)) { 202 if ((procedure != NULL) && (procedure->function()->body() == NULL)) {
203 // We will handle the StaticGet specially and will not use the name. 203 // We will handle the StaticGet specially and will not use the name.
204 // Note that we pass "true" in cannot_stream to avoid trying to stream
205 // a non-existing part of the binary.
204 // 206 //
205 // TODO(kmillikin): we are leaking the function body. Find a way to 207 // TODO(kmillikin): we are leaking the function body. Find a way to
206 // deallocate it. 208 // deallocate it.
207 procedure->function()->set_body( 209 procedure->function()->set_body(
208 new ReturnStatement(new StaticGet(NULL))); 210 new ReturnStatement(new StaticGet(NULL, true), true));
209 } 211 }
210 return library; 212 return library;
211 } 213 }
212 } 214 }
213 215
214 // Either class finalization failed or we caught a compile error. 216 // Either class finalization failed or we caught a compile error.
215 // In both cases sticky error would be set. 217 // In both cases sticky error would be set.
216 Error& error = Error::Handle(Z); 218 Error& error = Error::Handle(Z);
217 error = thread_->sticky_error(); 219 error = thread_->sticky_error();
218 thread_->clear_sticky_error(); 220 thread_->clear_sticky_error();
(...skipping 708 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 initializer_fun.set_is_debuggable(false); 929 initializer_fun.set_is_debuggable(false);
928 initializer_fun.set_is_reflectable(false); 930 initializer_fun.set_is_reflectable(false);
929 initializer_fun.set_is_inlinable(false); 931 initializer_fun.set_is_inlinable(false);
930 return new (zone) ParsedFunction(thread, initializer_fun); 932 return new (zone) ParsedFunction(thread, initializer_fun);
931 } 933 }
932 934
933 935
934 } // namespace kernel 936 } // namespace kernel
935 } // namespace dart 937 } // namespace dart
936 #endif // !defined(DART_PRECOMPILED_RUNTIME) 938 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698