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

Unified Diff: runtime/vm/kernel_to_il.cc

Issue 2485993002: VM: Support bootstrapping core libraries from Kernel binaries instead of source. (Closed)
Patch Set: Done Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/kernel_to_il.cc
diff --git a/runtime/vm/kernel_to_il.cc b/runtime/vm/kernel_to_il.cc
index 61a4e71f0d36f8aaf7e08312746f2e73041ca437..5c46389eeab079f8f2939f18b95117ecac87e5d9 100644
--- a/runtime/vm/kernel_to_il.cc
+++ b/runtime/vm/kernel_to_il.cc
@@ -18,6 +18,7 @@
#include "vm/resolver.h"
#include "vm/stack_frame.h"
+#if !defined(DART_PRECOMPILED_RUNTIME)
namespace dart {
DECLARE_FLAG(bool, support_externalizable_strings);
@@ -645,6 +646,16 @@ void ScopeBuilder::VisitFunctionNode(FunctionNode* node) {
for (intptr_t i = 0; i < type_parameters.length(); ++i) {
VisitTypeParameter(type_parameters[i]);
}
+
+ if (node->async_marker() == FunctionNode::kSyncYielding) {
+ LocalScope* scope = parsed_function_->node_sequence()->scope();
+ for (intptr_t i = 0;
+ i < parsed_function_->function().NumOptionalPositionalParameters();
+ i++) {
+ scope->VariableAt(i)->set_is_forced_stack();
+ }
+ }
+
// Do not visit the positional and named parameters, because they've
// already been added to the scope.
if (node->body() != NULL) {
@@ -1105,6 +1116,21 @@ dart::RawClass* TranslationHelper::LookupClassByKernelClass(
}
+dart::RawUnresolvedClass* TranslationHelper::ToUnresolvedClass(
+ Class* kernel_klass) {
+ dart::RawClass* klass = NULL;
+
+ const dart::String& class_name = DartClassName(kernel_klass);
+ Library* kernel_library = Library::Cast(kernel_klass->parent());
+ dart::Library& library =
+ dart::Library::Handle(Z, LookupLibraryByKernelLibrary(kernel_library));
+
+ ASSERT(klass != Object::null());
+ return dart::UnresolvedClass::New(library, class_name,
+ TokenPosition::kNoSource);
+}
+
+
dart::RawField* TranslationHelper::LookupFieldByKernelField(
Field* kernel_field) {
TreeNode* node = kernel_field->parent();
@@ -1839,7 +1865,9 @@ FlowGraphBuilder::FlowGraphBuilder(
try_catch_block_(NULL),
next_used_try_index_(0),
catch_block_(NULL),
- type_translator_(&translation_helper_, &active_class_),
+ type_translator_(&translation_helper_,
+ &active_class_,
+ /* finalize= */ true),
constant_evaluator_(this,
zone_,
&translation_helper_,
@@ -3841,10 +3869,8 @@ AbstractType& DartTypeTranslator::TranslateTypeWithoutFinalization(
DartType* node) {
bool saved_finalize = finalize_;
finalize_ = false;
- H.SetFinalize(false);
AbstractType& result = TranslateType(node);
finalize_ = saved_finalize;
- H.SetFinalize(saved_finalize);
return result;
}
@@ -4000,13 +4026,13 @@ void DartTypeTranslator::VisitInterfaceType(InterfaceType* node) {
const TypeArguments& type_arguments = TranslateTypeArguments(
node->type_arguments().raw_array(), node->type_arguments().length());
- const dart::Class& klass =
- dart::Class::Handle(Z, H.LookupClassByKernelClass(node->klass()));
+ dart::Object& klass =
+ dart::Object::Handle(Z, H.ToUnresolvedClass(node->klass()));
result_ = Type::New(klass, type_arguments, TokenPosition::kNoSource);
- result_.SetIsResolved();
if (finalize_) {
- result_ = ClassFinalizer::FinalizeType(klass, result_,
+ ASSERT(active_class_->klass != NULL);
+ result_ = ClassFinalizer::FinalizeType(*active_class_->klass, result_,
ClassFinalizer::kCanonicalize);
}
}
@@ -5633,9 +5659,6 @@ void FlowGraphBuilder::VisitYieldStatement(YieldStatement* node) {
ASSERT(stack_trace_var->name().raw() ==
Symbols::StackTraceParameter().raw());
- exception_var->set_is_forced_stack();
- stack_trace_var->set_is_forced_stack();
-
TargetEntryInstr* no_error;
TargetEntryInstr* error;
@@ -5725,3 +5748,4 @@ Fragment FlowGraphBuilder::TranslateFunctionNode(FunctionNode* node,
} // namespace kernel
} // namespace dart
+#endif // !defined(DART_PRECOMPILED_RUNTIME)

Powered by Google App Engine
This is Rietveld 408576698