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

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

Issue 2938173002: [kernel] Fix loading of type argument in catch. (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | tests/language/language_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 "vm/kernel_binary_flowgraph.h" 5 #include "vm/kernel_binary_flowgraph.h"
6 6
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/longjump.h" 8 #include "vm/longjump.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 10
(...skipping 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 881
882 builder_->ReadBool(); // read any_catch_needs_stack_trace. 882 builder_->ReadBool(); // read any_catch_needs_stack_trace.
883 intptr_t num_catches = 883 intptr_t num_catches =
884 builder_->ReadListLength(); // read number of catches. 884 builder_->ReadListLength(); // read number of catches.
885 for (intptr_t i = 0; i < num_catches; ++i) { 885 for (intptr_t i = 0; i < num_catches; ++i) {
886 PositionScope scope(builder_->reader_); 886 PositionScope scope(builder_->reader_);
887 intptr_t offset = builder_->ReaderOffset(); // Catch has no tag. 887 intptr_t offset = builder_->ReaderOffset(); // Catch has no tag.
888 888
889 EnterScope(offset); 889 EnterScope(offset);
890 890
891 builder_->SkipDartType(); // read guard. 891 VisitDartType(); // read guard.
Kevin Millikin (Google) 2017/06/21 07:02:58 Update comments to be full sentences: "Read the gu
892 tag = builder_->ReadTag(); // read first part of exception. 892 tag = builder_->ReadTag(); // read first part of exception.
893 if (tag == kSomething) { 893 if (tag == kSomething) {
894 VisitVariableDeclaration(); // read exception. 894 VisitVariableDeclaration(); // read exception.
895 } 895 }
896 tag = builder_->ReadTag(); // read first part of stack trace. 896 tag = builder_->ReadTag(); // read first part of stack trace.
897 if (tag == kSomething) { 897 if (tag == kSomething) {
898 VisitVariableDeclaration(); // read stack trace. 898 VisitVariableDeclaration(); // read stack trace.
899 } 899 }
900 VisitStatement(); // read body. 900 VisitStatement(); // read body.
901 901
(...skipping 5633 matching lines...) Expand 10 before | Expand all | Expand 10 after
6535 } 6535 }
6536 } 6536 }
6537 6537
6538 if (type_guard != NULL) { 6538 if (type_guard != NULL) {
6539 if (type_guard->IsMalformed()) { 6539 if (type_guard->IsMalformed()) {
6540 catch_body += ThrowTypeError(); 6540 catch_body += ThrowTypeError();
6541 catch_body += Drop(); 6541 catch_body += Drop();
6542 } else { 6542 } else {
6543 catch_body += LoadLocal(CurrentException()); 6543 catch_body += LoadLocal(CurrentException());
6544 catch_body += PushArgument(); // exception 6544 catch_body += PushArgument(); // exception
6545 catch_body += NullConstant(); 6545 if (!type_guard->IsInstantiated(kCurrentClass)) {
6546 catch_body += LoadInstantiatorTypeArguments();
6547 } else {
6548 catch_body += NullConstant();
6549 }
6546 catch_body += PushArgument(); // instantiator type arguments 6550 catch_body += PushArgument(); // instantiator type arguments
6547 catch_body += NullConstant(); 6551 if (!type_guard->IsInstantiated(kFunctions)) {
6552 catch_body += LoadFunctionTypeArguments();
6553 } else {
6554 catch_body += NullConstant();
6555 }
6548 catch_body += PushArgument(); // function type arguments 6556 catch_body += PushArgument(); // function type arguments
6549 catch_body += Constant(*type_guard); 6557 catch_body += Constant(*type_guard);
6550 catch_body += PushArgument(); // guard type 6558 catch_body += PushArgument(); // guard type
6551 catch_body += InstanceCall( 6559 catch_body += InstanceCall(
6552 TokenPosition::kNoSource, 6560 TokenPosition::kNoSource,
6553 dart::Library::PrivateCoreLibName(Symbols::_instanceOf()), 6561 dart::Library::PrivateCoreLibName(Symbols::_instanceOf()),
6554 Token::kIS, 4); 6562 Token::kIS, 4);
6555 6563
6556 TargetEntryInstr* catch_entry; 6564 TargetEntryInstr* catch_entry;
6557 TargetEntryInstr* next_catch_entry; 6565 TargetEntryInstr* next_catch_entry;
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after
7150 metadata_values.SetAt(i, value); 7158 metadata_values.SetAt(i, value);
7151 } 7159 }
7152 7160
7153 return metadata_values.raw(); 7161 return metadata_values.raw();
7154 } 7162 }
7155 7163
7156 } // namespace kernel 7164 } // namespace kernel
7157 } // namespace dart 7165 } // namespace dart
7158 7166
7159 #endif // !defined(DART_PRECOMPILED_RUNTIME) 7167 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « no previous file | tests/language/language_kernel.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698