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

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

Issue 11417058: Revert "Remove NullPointerException." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/exceptions.cc ('k') | sdk/lib/_internal/compiler/compiler.dart » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/bootstrap.h" 9 #include "vm/bootstrap.h"
10 #include "vm/exceptions.h" 10 #include "vm/exceptions.h"
(...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after
811 return; 811 return;
812 } 812 }
813 813
814 NoGCScope no_gc; 814 NoGCScope no_gc;
815 RawClass* cls = class_table_->At(raw->GetClassId()); 815 RawClass* cls = class_table_->At(raw->GetClassId());
816 intptr_t class_id = cls->ptr()->id_; 816 intptr_t class_id = cls->ptr()->id_;
817 ASSERT(class_id == raw->GetClassId()); 817 ASSERT(class_id == raw->GetClassId());
818 if (class_id >= kNumPredefinedCids) { 818 if (class_id >= kNumPredefinedCids) {
819 if (Class::IsSignatureClass(cls)) { 819 if (Class::IsSignatureClass(cls)) {
820 // We do not allow closure objects in an isolate message. 820 // We do not allow closure objects in an isolate message.
821 set_exception_type(Exceptions::kArgument); 821 set_exception_type(Exceptions::kArgumentError);
822 // TODO(6726): Allocate these constant strings once in the VM isolate. 822 // TODO(6726): Allocate these constant strings once in the VM isolate.
823 set_exception_msg("Illegal argument in isolate message" 823 set_exception_msg("Illegal argument in isolate message"
824 " : (object is a closure)"); 824 " : (object is a closure)");
825 Isolate::Current()->long_jump_base()->Jump(1, *ErrorHandle()); 825 Isolate::Current()->long_jump_base()->Jump(1, *ErrorHandle());
826 } 826 }
827 // Object is being referenced, add it to the forward ref list and mark 827 // Object is being referenced, add it to the forward ref list and mark
828 // it so that future references to this object in the snapshot will use 828 // it so that future references to this object in the snapshot will use
829 // this object id. Mark it as not having been serialized yet so that we 829 // this object id. Mark it as not having been serialized yet so that we
830 // will serialize the object when we go through the forward list. 830 // will serialize the object when we go through the forward list.
831 intptr_t object_id = MarkObject(raw, kIsNotSerialized); 831 intptr_t object_id = MarkObject(raw, kIsNotSerialized);
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1066 uword tags = raw->ptr()->tags_; 1066 uword tags = raw->ptr()->tags_;
1067 ASSERT(SerializedHeaderTag::decode(tags) == kObjectId); 1067 ASSERT(SerializedHeaderTag::decode(tags) == kObjectId);
1068 intptr_t object_id = SerializedHeaderData::decode(tags); 1068 intptr_t object_id = SerializedHeaderData::decode(tags);
1069 tags = forward_list_[object_id - kMaxPredefinedObjectIds]->tags(); 1069 tags = forward_list_[object_id - kMaxPredefinedObjectIds]->tags();
1070 RawClass* cls = class_table_->At(RawObject::ClassIdTag::decode(tags)); 1070 RawClass* cls = class_table_->At(RawObject::ClassIdTag::decode(tags));
1071 intptr_t class_id = cls->ptr()->id_; 1071 intptr_t class_id = cls->ptr()->id_;
1072 1072
1073 if (class_id >= kNumPredefinedCids) { 1073 if (class_id >= kNumPredefinedCids) {
1074 if (Class::IsSignatureClass(cls)) { 1074 if (Class::IsSignatureClass(cls)) {
1075 // We do not allow closure objects in an isolate message. 1075 // We do not allow closure objects in an isolate message.
1076 set_exception_type(Exceptions::kArgument); 1076 set_exception_type(Exceptions::kArgumentError);
1077 // TODO(6726): Allocate these constant strings once in the VM isolate. 1077 // TODO(6726): Allocate these constant strings once in the VM isolate.
1078 set_exception_msg("Illegal argument in isolate message" 1078 set_exception_msg("Illegal argument in isolate message"
1079 " : (object is a closure)"); 1079 " : (object is a closure)");
1080 Isolate::Current()->long_jump_base()->Jump(1, *ErrorHandle()); 1080 Isolate::Current()->long_jump_base()->Jump(1, *ErrorHandle());
1081 } 1081 }
1082 if (cls->ptr()->num_native_fields_ != 0) { 1082 if (cls->ptr()->num_native_fields_ != 0) {
1083 // We do not allow objects with native fields in an isolate message. 1083 // We do not allow objects with native fields in an isolate message.
1084 set_exception_type(Exceptions::kArgument); 1084 set_exception_type(Exceptions::kArgumentError);
1085 // TODO(6726): Allocate these constant strings once in the VM isolate. 1085 // TODO(6726): Allocate these constant strings once in the VM isolate.
1086 set_exception_msg("Illegal argument in isolate message" 1086 set_exception_msg("Illegal argument in isolate message"
1087 " : (object extends NativeWrapper)"); 1087 " : (object extends NativeWrapper)");
1088 1088
1089 Isolate::Current()->long_jump_base()->Jump(1, *ErrorHandle()); 1089 Isolate::Current()->long_jump_base()->Jump(1, *ErrorHandle());
1090 } 1090 }
1091 // Object is regular dart instance. 1091 // Object is regular dart instance.
1092 intptr_t instance_size = cls->ptr()->instance_size_; 1092 intptr_t instance_size = cls->ptr()->instance_size_;
1093 ASSERT(instance_size != 0); 1093 ASSERT(instance_size != 0);
1094 1094
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 UnmarkAll(); 1270 UnmarkAll();
1271 isolate->set_long_jump_base(base); 1271 isolate->set_long_jump_base(base);
1272 } else { 1272 } else {
1273 isolate->set_long_jump_base(base); 1273 isolate->set_long_jump_base(base);
1274 ThrowException(exception_type(), exception_msg()); 1274 ThrowException(exception_type(), exception_msg());
1275 } 1275 }
1276 } 1276 }
1277 1277
1278 1278
1279 } // namespace dart 1279 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/exceptions.cc ('k') | sdk/lib/_internal/compiler/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698