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

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

Issue 22389004: Allows compiler bailout to handle errors of any type. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | 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/object.h" 5 #include "vm/object.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/assembler.h" 9 #include "vm/assembler.h"
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 AbstractTypeArguments* Object::null_abstract_type_arguments_ = NULL; 81 AbstractTypeArguments* Object::null_abstract_type_arguments_ = NULL;
82 Array* Object::empty_array_ = NULL; 82 Array* Object::empty_array_ = NULL;
83 Instance* Object::sentinel_ = NULL; 83 Instance* Object::sentinel_ = NULL;
84 Instance* Object::transition_sentinel_ = NULL; 84 Instance* Object::transition_sentinel_ = NULL;
85 Instance* Object::unknown_constant_ = NULL; 85 Instance* Object::unknown_constant_ = NULL;
86 Instance* Object::non_constant_ = NULL; 86 Instance* Object::non_constant_ = NULL;
87 Bool* Object::bool_true_ = NULL; 87 Bool* Object::bool_true_ = NULL;
88 Bool* Object::bool_false_ = NULL; 88 Bool* Object::bool_false_ = NULL;
89 Smi* Object::smi_illegal_cid_ = NULL; 89 Smi* Object::smi_illegal_cid_ = NULL;
90 LanguageError* Object::snapshot_writer_error_ = NULL; 90 LanguageError* Object::snapshot_writer_error_ = NULL;
91 LanguageError* Object::branch_offset_error_ = NULL;
91 92
92 RawObject* Object::null_ = reinterpret_cast<RawObject*>(RAW_NULL); 93 RawObject* Object::null_ = reinterpret_cast<RawObject*>(RAW_NULL);
93 RawClass* Object::class_class_ = reinterpret_cast<RawClass*>(RAW_NULL); 94 RawClass* Object::class_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
94 RawClass* Object::null_class_ = reinterpret_cast<RawClass*>(RAW_NULL); 95 RawClass* Object::null_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
95 RawClass* Object::dynamic_class_ = reinterpret_cast<RawClass*>(RAW_NULL); 96 RawClass* Object::dynamic_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
96 RawClass* Object::void_class_ = reinterpret_cast<RawClass*>(RAW_NULL); 97 RawClass* Object::void_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
97 RawClass* Object::unresolved_class_class_ = 98 RawClass* Object::unresolved_class_class_ =
98 reinterpret_cast<RawClass*>(RAW_NULL); 99 reinterpret_cast<RawClass*>(RAW_NULL);
99 RawClass* Object::type_arguments_class_ = reinterpret_cast<RawClass*>(RAW_NULL); 100 RawClass* Object::type_arguments_class_ = reinterpret_cast<RawClass*>(RAW_NULL);
100 RawClass* Object::instantiated_type_arguments_class_ = 101 RawClass* Object::instantiated_type_arguments_class_ =
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 null_abstract_type_arguments_ = AbstractTypeArguments::ReadOnlyHandle(); 354 null_abstract_type_arguments_ = AbstractTypeArguments::ReadOnlyHandle();
354 empty_array_ = Array::ReadOnlyHandle(); 355 empty_array_ = Array::ReadOnlyHandle();
355 sentinel_ = Instance::ReadOnlyHandle(); 356 sentinel_ = Instance::ReadOnlyHandle();
356 transition_sentinel_ = Instance::ReadOnlyHandle(); 357 transition_sentinel_ = Instance::ReadOnlyHandle();
357 unknown_constant_ = Instance::ReadOnlyHandle(); 358 unknown_constant_ = Instance::ReadOnlyHandle();
358 non_constant_ = Instance::ReadOnlyHandle(); 359 non_constant_ = Instance::ReadOnlyHandle();
359 bool_true_ = Bool::ReadOnlyHandle(); 360 bool_true_ = Bool::ReadOnlyHandle();
360 bool_false_ = Bool::ReadOnlyHandle(); 361 bool_false_ = Bool::ReadOnlyHandle();
361 smi_illegal_cid_ = Smi::ReadOnlyHandle(); 362 smi_illegal_cid_ = Smi::ReadOnlyHandle();
362 snapshot_writer_error_ = LanguageError::ReadOnlyHandle(); 363 snapshot_writer_error_ = LanguageError::ReadOnlyHandle();
364 branch_offset_error_ = LanguageError::ReadOnlyHandle();
365
363 366
364 // Allocate and initialize the null instance. 367 // Allocate and initialize the null instance.
365 // 'null_' must be the first object allocated as it is used in allocation to 368 // 'null_' must be the first object allocated as it is used in allocation to
366 // clear the object. 369 // clear the object.
367 { 370 {
368 uword address = heap->Allocate(Instance::InstanceSize(), Heap::kOld); 371 uword address = heap->Allocate(Instance::InstanceSize(), Heap::kOld);
369 null_ = reinterpret_cast<RawInstance*>(address + kHeapObjectTag); 372 null_ = reinterpret_cast<RawInstance*>(address + kHeapObjectTag);
370 // The call below is using 'null_' to initialize itself. 373 // The call below is using 'null_' to initialize itself.
371 InitializeObject(address, kNullCid, Instance::InstanceSize()); 374 InitializeObject(address, kNullCid, Instance::InstanceSize());
372 } 375 }
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 empty_array_->raw()->ptr()->length_ = Smi::New(0); 567 empty_array_->raw()->ptr()->length_ = Smi::New(0);
565 } 568 }
566 569
567 // Allocate and initialize singleton true and false boolean objects. 570 // Allocate and initialize singleton true and false boolean objects.
568 cls = Class::New<Bool>(); 571 cls = Class::New<Bool>();
569 isolate->object_store()->set_bool_class(cls); 572 isolate->object_store()->set_bool_class(cls);
570 *bool_true_ = Bool::New(true); 573 *bool_true_ = Bool::New(true);
571 *bool_false_ = Bool::New(false); 574 *bool_false_ = Bool::New(false);
572 575
573 *smi_illegal_cid_ = Smi::New(kIllegalCid); 576 *smi_illegal_cid_ = Smi::New(kIllegalCid);
574 *snapshot_writer_error_ = 577
575 LanguageError::New(String::Handle(String::New("SnapshotWriter Error"))); 578 String& error_str = String::Handle();
579 error_str = String::New("SnapshotWriter Error");
580 *snapshot_writer_error_ = LanguageError::New(error_str);
581 error_str = String::New("Branch offset overflow");
582 *branch_offset_error_ = LanguageError::New(error_str);
576 583
577 ASSERT(!null_object_->IsSmi()); 584 ASSERT(!null_object_->IsSmi());
578 ASSERT(!null_array_->IsSmi()); 585 ASSERT(!null_array_->IsSmi());
579 ASSERT(null_array_->IsArray()); 586 ASSERT(null_array_->IsArray());
580 ASSERT(!null_string_->IsSmi()); 587 ASSERT(!null_string_->IsSmi());
581 ASSERT(null_string_->IsString()); 588 ASSERT(null_string_->IsString());
582 ASSERT(!null_instance_->IsSmi()); 589 ASSERT(!null_instance_->IsSmi());
583 ASSERT(null_instance_->IsInstance()); 590 ASSERT(null_instance_->IsInstance());
584 ASSERT(!null_abstract_type_arguments_->IsSmi()); 591 ASSERT(!null_abstract_type_arguments_->IsSmi());
585 ASSERT(null_abstract_type_arguments_->IsAbstractTypeArguments()); 592 ASSERT(null_abstract_type_arguments_->IsAbstractTypeArguments());
586 ASSERT(!empty_array_->IsSmi()); 593 ASSERT(!empty_array_->IsSmi());
587 ASSERT(empty_array_->IsArray()); 594 ASSERT(empty_array_->IsArray());
588 ASSERT(!sentinel_->IsSmi()); 595 ASSERT(!sentinel_->IsSmi());
589 ASSERT(sentinel_->IsInstance()); 596 ASSERT(sentinel_->IsInstance());
590 ASSERT(!transition_sentinel_->IsSmi()); 597 ASSERT(!transition_sentinel_->IsSmi());
591 ASSERT(transition_sentinel_->IsInstance()); 598 ASSERT(transition_sentinel_->IsInstance());
592 ASSERT(!unknown_constant_->IsSmi()); 599 ASSERT(!unknown_constant_->IsSmi());
593 ASSERT(unknown_constant_->IsInstance()); 600 ASSERT(unknown_constant_->IsInstance());
594 ASSERT(!non_constant_->IsSmi()); 601 ASSERT(!non_constant_->IsSmi());
595 ASSERT(non_constant_->IsInstance()); 602 ASSERT(non_constant_->IsInstance());
596 ASSERT(!bool_true_->IsSmi()); 603 ASSERT(!bool_true_->IsSmi());
597 ASSERT(bool_true_->IsBool()); 604 ASSERT(bool_true_->IsBool());
598 ASSERT(!bool_false_->IsSmi()); 605 ASSERT(!bool_false_->IsSmi());
599 ASSERT(bool_false_->IsBool()); 606 ASSERT(bool_false_->IsBool());
600 ASSERT(smi_illegal_cid_->IsSmi()); 607 ASSERT(smi_illegal_cid_->IsSmi());
601 ASSERT(!snapshot_writer_error_->IsSmi()); 608 ASSERT(!snapshot_writer_error_->IsSmi());
602 ASSERT(snapshot_writer_error_->IsLanguageError()); 609 ASSERT(snapshot_writer_error_->IsLanguageError());
610 ASSERT(!branch_offset_error_->IsSmi());
611 ASSERT(branch_offset_error_->IsLanguageError());
603 } 612 }
604 613
605 614
606 #define SET_CLASS_NAME(class_name, name) \ 615 #define SET_CLASS_NAME(class_name, name) \
607 cls = class_name##_class(); \ 616 cls = class_name##_class(); \
608 cls.set_name(Symbols::name()); \ 617 cls.set_name(Symbols::name()); \
609 618
610 void Object::RegisterSingletonClassNames() { 619 void Object::RegisterSingletonClassNames() {
611 Class& cls = Class::Handle(); 620 Class& cls = Class::Handle();
612 621
(...skipping 13964 matching lines...) Expand 10 before | Expand all | Expand 10 after
14577 } 14586 }
14578 14587
14579 14588
14580 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 14589 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
14581 stream->OpenObject(); 14590 stream->OpenObject();
14582 stream->CloseObject(); 14591 stream->CloseObject();
14583 } 14592 }
14584 14593
14585 14594
14586 } // namespace dart 14595 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698