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

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

Issue 142233002: Make sure all new Code objects have a non-null PcDescriptors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 #if defined(RAW_NULL) 82 #if defined(RAW_NULL)
83 #error RAW_NULL should not be defined. 83 #error RAW_NULL should not be defined.
84 #endif 84 #endif
85 #define RAW_NULL kHeapObjectTag 85 #define RAW_NULL kHeapObjectTag
86 Object* Object::null_object_ = NULL; 86 Object* Object::null_object_ = NULL;
87 Array* Object::null_array_ = NULL; 87 Array* Object::null_array_ = NULL;
88 String* Object::null_string_ = NULL; 88 String* Object::null_string_ = NULL;
89 Instance* Object::null_instance_ = NULL; 89 Instance* Object::null_instance_ = NULL;
90 AbstractTypeArguments* Object::null_abstract_type_arguments_ = NULL; 90 AbstractTypeArguments* Object::null_abstract_type_arguments_ = NULL;
91 Array* Object::empty_array_ = NULL; 91 Array* Object::empty_array_ = NULL;
92 PcDescriptors* Object::empty_descriptors_ = NULL;
92 Instance* Object::sentinel_ = NULL; 93 Instance* Object::sentinel_ = NULL;
93 Instance* Object::transition_sentinel_ = NULL; 94 Instance* Object::transition_sentinel_ = NULL;
94 Instance* Object::unknown_constant_ = NULL; 95 Instance* Object::unknown_constant_ = NULL;
95 Instance* Object::non_constant_ = NULL; 96 Instance* Object::non_constant_ = NULL;
96 Bool* Object::bool_true_ = NULL; 97 Bool* Object::bool_true_ = NULL;
97 Bool* Object::bool_false_ = NULL; 98 Bool* Object::bool_false_ = NULL;
98 Smi* Object::smi_illegal_cid_ = NULL; 99 Smi* Object::smi_illegal_cid_ = NULL;
99 LanguageError* Object::snapshot_writer_error_ = NULL; 100 LanguageError* Object::snapshot_writer_error_ = NULL;
100 LanguageError* Object::branch_offset_error_ = NULL; 101 LanguageError* Object::branch_offset_error_ = NULL;
101 102
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 Isolate* isolate = Isolate::Current(); 429 Isolate* isolate = Isolate::Current();
429 Heap* heap = isolate->heap(); 430 Heap* heap = isolate->heap();
430 431
431 // Allocate the read only object handles here. 432 // Allocate the read only object handles here.
432 null_object_ = Object::ReadOnlyHandle(); 433 null_object_ = Object::ReadOnlyHandle();
433 null_array_ = Array::ReadOnlyHandle(); 434 null_array_ = Array::ReadOnlyHandle();
434 null_string_ = String::ReadOnlyHandle(); 435 null_string_ = String::ReadOnlyHandle();
435 null_instance_ = Instance::ReadOnlyHandle(); 436 null_instance_ = Instance::ReadOnlyHandle();
436 null_abstract_type_arguments_ = AbstractTypeArguments::ReadOnlyHandle(); 437 null_abstract_type_arguments_ = AbstractTypeArguments::ReadOnlyHandle();
437 empty_array_ = Array::ReadOnlyHandle(); 438 empty_array_ = Array::ReadOnlyHandle();
439 empty_descriptors_ = PcDescriptors::ReadOnlyHandle();
438 sentinel_ = Instance::ReadOnlyHandle(); 440 sentinel_ = Instance::ReadOnlyHandle();
439 transition_sentinel_ = Instance::ReadOnlyHandle(); 441 transition_sentinel_ = Instance::ReadOnlyHandle();
440 unknown_constant_ = Instance::ReadOnlyHandle(); 442 unknown_constant_ = Instance::ReadOnlyHandle();
441 non_constant_ = Instance::ReadOnlyHandle(); 443 non_constant_ = Instance::ReadOnlyHandle();
442 bool_true_ = Bool::ReadOnlyHandle(); 444 bool_true_ = Bool::ReadOnlyHandle();
443 bool_false_ = Bool::ReadOnlyHandle(); 445 bool_false_ = Bool::ReadOnlyHandle();
444 smi_illegal_cid_ = Smi::ReadOnlyHandle(); 446 smi_illegal_cid_ = Smi::ReadOnlyHandle();
445 snapshot_writer_error_ = LanguageError::ReadOnlyHandle(); 447 snapshot_writer_error_ = LanguageError::ReadOnlyHandle();
446 branch_offset_error_ = LanguageError::ReadOnlyHandle(); 448 branch_offset_error_ = LanguageError::ReadOnlyHandle();
447 449
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 // Allocate and initialize the empty_array instance. 640 // Allocate and initialize the empty_array instance.
639 { 641 {
640 uword address = heap->Allocate(Array::InstanceSize(0), Heap::kOld); 642 uword address = heap->Allocate(Array::InstanceSize(0), Heap::kOld);
641 InitializeObject(address, kArrayCid, Array::InstanceSize(0)); 643 InitializeObject(address, kArrayCid, Array::InstanceSize(0));
642 Array::initializeHandle( 644 Array::initializeHandle(
643 empty_array_, 645 empty_array_,
644 reinterpret_cast<RawArray*>(address + kHeapObjectTag)); 646 reinterpret_cast<RawArray*>(address + kHeapObjectTag));
645 empty_array_->raw()->ptr()->length_ = Smi::New(0); 647 empty_array_->raw()->ptr()->length_ = Smi::New(0);
646 } 648 }
647 649
650 // Allocate and initialize the empty_descriptors instance.
651 {
652 uword address = heap->Allocate(PcDescriptors::InstanceSize(0), Heap::kOld);
653 InitializeObject(address, kPcDescriptorsCid,
654 PcDescriptors::InstanceSize(0));
655 PcDescriptors::initializeHandle(
656 empty_descriptors_,
657 reinterpret_cast<RawPcDescriptors*>(address + kHeapObjectTag));
658 empty_descriptors_->raw()->ptr()->length_ = Smi::New(0);
Ivan Posva 2014/01/21 06:36:05 Can't you use raw_ptr() instead of raw()->ptr()? S
Cutch 2014/01/21 15:49:58 Done here and above.
659 }
660
661
648 cls = Class::New<Instance>(kDynamicCid); 662 cls = Class::New<Instance>(kDynamicCid);
649 cls.set_is_abstract(); 663 cls.set_is_abstract();
650 cls.set_num_type_arguments(0); 664 cls.set_num_type_arguments(0);
651 cls.set_num_own_type_arguments(0); 665 cls.set_num_own_type_arguments(0);
652 cls.set_is_type_finalized(); 666 cls.set_is_type_finalized();
653 cls.set_is_finalized(); 667 cls.set_is_finalized();
654 dynamic_class_ = cls.raw(); 668 dynamic_class_ = cls.raw();
655 669
656 cls = Class::New<Instance>(kVoidCid); 670 cls = Class::New<Instance>(kVoidCid);
657 cls.set_num_type_arguments(0); 671 cls.set_num_type_arguments(0);
(...skipping 9217 matching lines...) Expand 10 before | Expand all | Expand 10 after
9875 Code& result = Code::Handle(); 9889 Code& result = Code::Handle();
9876 { 9890 {
9877 uword size = Code::InstanceSize(pointer_offsets_length); 9891 uword size = Code::InstanceSize(pointer_offsets_length);
9878 RawObject* raw = Object::Allocate(Code::kClassId, size, Heap::kOld); 9892 RawObject* raw = Object::Allocate(Code::kClassId, size, Heap::kOld);
9879 NoGCScope no_gc; 9893 NoGCScope no_gc;
9880 result ^= raw; 9894 result ^= raw;
9881 result.set_pointer_offsets_length(pointer_offsets_length); 9895 result.set_pointer_offsets_length(pointer_offsets_length);
9882 result.set_is_optimized(false); 9896 result.set_is_optimized(false);
9883 result.set_is_alive(true); 9897 result.set_is_alive(true);
9884 result.set_comments(Comments::New(0)); 9898 result.set_comments(Comments::New(0));
9899 result.set_pc_descriptors(Object::empty_descriptors());
9885 } 9900 }
9886 return result.raw(); 9901 return result.raw();
9887 } 9902 }
9888 9903
9889 9904
9890 RawCode* Code::FinalizeCode(const char* name, 9905 RawCode* Code::FinalizeCode(const char* name,
9891 Assembler* assembler, 9906 Assembler* assembler,
9892 bool optimized) { 9907 bool optimized) {
9893 ASSERT(assembler != NULL); 9908 ASSERT(assembler != NULL);
9894 9909
(...skipping 7079 matching lines...) Expand 10 before | Expand all | Expand 10 after
16974 return "_MirrorReference"; 16989 return "_MirrorReference";
16975 } 16990 }
16976 16991
16977 16992
16978 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const { 16993 void MirrorReference::PrintToJSONStream(JSONStream* stream, bool ref) const {
16979 Instance::PrintToJSONStream(stream, ref); 16994 Instance::PrintToJSONStream(stream, ref);
16980 } 16995 }
16981 16996
16982 16997
16983 } // namespace dart 16998 } // namespace dart
OLDNEW
« runtime/vm/object.h ('K') | « runtime/vm/object.h ('k') | runtime/vm/raw_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698