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

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

Issue 2792033002: [kernel] vm: Fix a few issues in the kernel flow graph builder, update status file for checked-mode (Closed)
Patch Set: addressed comments Created 3 years, 8 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
« no previous file with comments | « runtime/vm/compiler.cc ('k') | tests/co19/co19-kernel.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 8
9 #include "vm/kernel_to_il.h" 9 #include "vm/kernel_to_il.h"
10 10
(...skipping 4945 matching lines...) Expand 10 before | Expand all | Expand 10 after
4956 } 4956 }
4957 4957
4958 dart::Class& klass = dart::Class::ZoneHandle( 4958 dart::Class& klass = dart::Class::ZoneHandle(
4959 Z, H.LookupClassByKernelClass(node->target()->EnclosingName())); 4959 Z, H.LookupClassByKernelClass(node->target()->EnclosingName()));
4960 4960
4961 Fragment instructions; 4961 Fragment instructions;
4962 4962
4963 // Check for malbounded-ness of type. 4963 // Check for malbounded-ness of type.
4964 if (I->type_checks()) { 4964 if (I->type_checks()) {
4965 List<DartType>& kernel_type_arguments = node->arguments()->types(); 4965 List<DartType>& kernel_type_arguments = node->arguments()->types();
4966 const TypeArguments& type_arguments = T.TranslateInstantiatedTypeArguments( 4966 const TypeArguments& type_arguments = T.TranslateTypeArguments(
4967 klass, kernel_type_arguments.raw_array(), 4967 kernel_type_arguments.raw_array(), kernel_type_arguments.length());
4968 kernel_type_arguments.length());
4969 4968
4970 AbstractType& type = AbstractType::Handle( 4969 AbstractType& type = AbstractType::Handle(
4971 Z, Type::New(klass, type_arguments, TokenPosition::kNoSource)); 4970 Z, Type::New(klass, type_arguments, TokenPosition::kNoSource));
4972 type = ClassFinalizer::FinalizeType(klass, type); 4971 type = ClassFinalizer::FinalizeType(klass, type);
4973 4972
4974 if (type.IsMalbounded()) { 4973 if (type.IsMalbounded()) {
4975 // Evaluate expressions for correctness. 4974 // Evaluate expressions for correctness.
4976 List<Expression>& positional = node->arguments()->positional(); 4975 List<Expression>& positional = node->arguments()->positional();
4977 List<NamedExpression>& named = node->arguments()->named(); 4976 List<NamedExpression>& named = node->arguments()->named();
4978 for (intptr_t i = 0; i < positional.length(); ++i) { 4977 for (intptr_t i = 0; i < positional.length(); ++i) {
(...skipping 1465 matching lines...) Expand 10 before | Expand all | Expand 10 after
6444 return NULL; 6443 return NULL;
6445 } 6444 }
6446 6445
6447 Thread* thread = Thread::Current(); 6446 Thread* thread = Thread::Current();
6448 Zone* zone_ = thread->zone(); 6447 Zone* zone_ = thread->zone();
6449 TranslationHelper translation_helper(thread); 6448 TranslationHelper translation_helper(thread);
6450 DartTypeTranslator type_translator(&translation_helper, NULL, true); 6449 DartTypeTranslator type_translator(&translation_helper, NULL, true);
6451 ConstantEvaluator constant_evaluator(/* flow_graph_builder = */ NULL, Z, 6450 ConstantEvaluator constant_evaluator(/* flow_graph_builder = */ NULL, Z,
6452 &translation_helper, &type_translator); 6451 &translation_helper, &type_translator);
6453 6452
6454 6453 const intptr_t positional_count =
6455 intptr_t param_count = function_node->positional_parameters().length() + 6454 function_node->positional_parameters().length();
6456 function_node->named_parameters().length(); 6455 const intptr_t param_count =
6456 positional_count + function_node->named_parameters().length();
6457 const Array& param_descriptor = Array::Handle( 6457 const Array& param_descriptor = Array::Handle(
6458 Array::New(param_count * Parser::kParameterEntrySize, Heap::kOld)); 6458 Array::New(param_count * Parser::kParameterEntrySize, Heap::kOld));
6459 for (intptr_t i = 0; i < param_count; ++i) { 6459 for (intptr_t i = 0; i < param_count; ++i) {
6460 const intptr_t entry_start = i * Parser::kParameterEntrySize;
6461
6460 VariableDeclaration* variable; 6462 VariableDeclaration* variable;
6461 if (i < function_node->positional_parameters().length()) { 6463 if (i < positional_count) {
6462 variable = function_node->positional_parameters()[i]; 6464 variable = function_node->positional_parameters()[i];
6463 } else { 6465 } else {
6464 variable = function_node->named_parameters()[i]; 6466 variable = function_node->named_parameters()[i - positional_count];
6465 } 6467 }
6466 6468
6467 param_descriptor.SetAt( 6469 param_descriptor.SetAt(
6468 i + Parser::kParameterIsFinalOffset, 6470 entry_start + Parser::kParameterIsFinalOffset,
6469 variable->IsFinal() ? Bool::True() : Bool::False()); 6471 variable->IsFinal() ? Bool::True() : Bool::False());
6470 6472
6471 if (variable->initializer() != NULL) { 6473 if (variable->initializer() != NULL) {
6472 param_descriptor.SetAt( 6474 param_descriptor.SetAt(
6473 i + Parser::kParameterDefaultValueOffset, 6475 entry_start + Parser::kParameterDefaultValueOffset,
6474 constant_evaluator.EvaluateExpression(variable->initializer())); 6476 constant_evaluator.EvaluateExpression(variable->initializer()));
6475 } else { 6477 } else {
6476 param_descriptor.SetAt(i + Parser::kParameterDefaultValueOffset, 6478 param_descriptor.SetAt(
6477 Object::null_instance()); 6479 entry_start + Parser::kParameterDefaultValueOffset,
6480 Object::null_instance());
6478 } 6481 }
6479 6482
6480 param_descriptor.SetAt(i + Parser::kParameterMetadataOffset, 6483 param_descriptor.SetAt(entry_start + Parser::kParameterMetadataOffset,
6481 /* Issue(28434): Missing parameter metadata. */ 6484 /* Issue(28434): Missing parameter metadata. */
6482 Object::null_instance()); 6485 Object::null_instance());
6483 } 6486 }
6484 return param_descriptor.raw(); 6487 return param_descriptor.raw();
6485 } else { 6488 } else {
6486 Thread* thread = Thread::Current(); 6489 Thread* thread = Thread::Current();
6487 Error& error = Error::Handle(); 6490 Error& error = Error::Handle();
6488 error = thread->sticky_error(); 6491 error = thread->sticky_error();
6489 thread->clear_sticky_error(); 6492 thread->clear_sticky_error();
6490 return error.raw(); 6493 return error.raw();
6491 } 6494 }
6492 } 6495 }
6493 6496
6494 6497
6495 } // namespace kernel 6498 } // namespace kernel
6496 } // namespace dart 6499 } // namespace dart
6497 6500
6498 #endif // !defined(DART_PRECOMPILED_RUNTIME) 6501 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | tests/co19/co19-kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698