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

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

Issue 564143003: Revert revision 40228 (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 3 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') | runtime/vm/raw_object.h » ('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/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 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 InitializeObject(address, kPcDescriptorsCid, 662 InitializeObject(address, kPcDescriptorsCid,
663 PcDescriptors::InstanceSize(0, RawPcDescriptors::kCompressedRecSize)); 663 PcDescriptors::InstanceSize(0, RawPcDescriptors::kCompressedRecSize));
664 PcDescriptors::initializeHandle( 664 PcDescriptors::initializeHandle(
665 empty_descriptors_, 665 empty_descriptors_,
666 reinterpret_cast<RawPcDescriptors*>(address + kHeapObjectTag)); 666 reinterpret_cast<RawPcDescriptors*>(address + kHeapObjectTag));
667 empty_descriptors_->raw_ptr()->length_ = 0; 667 empty_descriptors_->raw_ptr()->length_ = 0;
668 } 668 }
669 669
670 // Allocate and initialize the canonical empty variable descriptor object. 670 // Allocate and initialize the canonical empty variable descriptor object.
671 { 671 {
672 uword address = 672 uword address = heap->Allocate(
673 heap->Allocate(LocalVarDescriptors::InstanceSize(0), Heap::kOld); 673 LocalVarDescriptors::InstanceSize(0), Heap::kOld);
674 InitializeObject(address, 674 InitializeObject(address, kLocalVarDescriptorsCid,
675 kLocalVarDescriptorsCid, 675 LocalVarDescriptors::InstanceSize(0));
676 LocalVarDescriptors::InstanceSize(0));
677 LocalVarDescriptors::initializeHandle( 676 LocalVarDescriptors::initializeHandle(
678 empty_var_descriptors_, 677 empty_var_descriptors_,
679 reinterpret_cast<RawLocalVarDescriptors*>(address + kHeapObjectTag)); 678 reinterpret_cast<RawLocalVarDescriptors*>(address + kHeapObjectTag));
680 empty_var_descriptors_->raw_ptr()->num_entries_ = 0; 679 empty_var_descriptors_->raw_ptr()->length_ = 0;
680 // Can't use instance mentod StorePointer() here, but this pointer
681 // assignment is safe (from old space to old space).
682 empty_var_descriptors_->raw_ptr()->names_ = empty_array_->raw_ptr();
681 } 683 }
682 684
683 cls = Class::New<Instance>(kDynamicCid); 685 cls = Class::New<Instance>(kDynamicCid);
684 cls.set_is_abstract(); 686 cls.set_is_abstract();
685 cls.set_num_type_arguments(0); 687 cls.set_num_type_arguments(0);
686 cls.set_num_own_type_arguments(0); 688 cls.set_num_own_type_arguments(0);
687 cls.set_is_type_finalized(); 689 cls.set_is_type_finalized();
688 cls.set_is_finalized(); 690 cls.set_is_finalized();
689 dynamic_class_ = cls.raw(); 691 dynamic_class_ = cls.raw();
690 692
(...skipping 10100 matching lines...) Expand 10 before | Expand all | Expand 10 after
10791 } 10793 }
10792 10794
10793 10795
10794 void Stackmap::PrintJSONImpl(JSONStream* stream, bool ref) const { 10796 void Stackmap::PrintJSONImpl(JSONStream* stream, bool ref) const {
10795 Object::PrintJSONImpl(stream, ref); 10797 Object::PrintJSONImpl(stream, ref);
10796 } 10798 }
10797 10799
10798 10800
10799 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { 10801 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const {
10800 ASSERT(var_index < Length()); 10802 ASSERT(var_index < Length());
10801 ASSERT(Object::Handle(*raw()->nameAddrAt(var_index)).IsString()); 10803 const Array& names = Array::Handle(raw_ptr()->names_);
10802 return *raw()->nameAddrAt(var_index); 10804 ASSERT(Length() == names.Length());
10805 String& name = String::Handle();
10806 name ^= names.At(var_index);
10807 return name.raw();
10803 } 10808 }
10804 10809
10805 10810
10806 void LocalVarDescriptors::SetVar(intptr_t var_index, 10811 void LocalVarDescriptors::SetVar(intptr_t var_index,
10807 const String& name, 10812 const String& name,
10808 RawLocalVarDescriptors::VarInfo* info) const { 10813 RawLocalVarDescriptors::VarInfo* info) const {
10809 ASSERT(var_index < Length()); 10814 ASSERT(var_index < Length());
10810 StorePointer(raw()->nameAddrAt(var_index), name.raw()); 10815 const Array& names = Array::Handle(raw_ptr()->names_);
10811 raw()->data()[var_index] = *info; 10816 ASSERT(Length() == names.Length());
10817 names.SetAt(var_index, name);
10818 raw_ptr()->data()[var_index] = *info;
10812 } 10819 }
10813 10820
10814 10821
10815 void LocalVarDescriptors::GetInfo(intptr_t var_index, 10822 void LocalVarDescriptors::GetInfo(intptr_t var_index,
10816 RawLocalVarDescriptors::VarInfo* info) const { 10823 RawLocalVarDescriptors::VarInfo* info) const {
10817 ASSERT(var_index < Length()); 10824 ASSERT(var_index < Length());
10818 *info = raw()->data()[var_index]; 10825 *info = raw_ptr()->data()[var_index];
10819 } 10826 }
10820 10827
10821 10828
10822 static const char* VarKindString(int kind) { 10829 static const char* VarKindString(int kind) {
10823 switch (kind) { 10830 switch (kind) {
10824 case RawLocalVarDescriptors::kStackVar: 10831 case RawLocalVarDescriptors::kStackVar:
10825 return "StackVar"; 10832 return "StackVar";
10826 break; 10833 break;
10827 case RawLocalVarDescriptors::kContextVar: 10834 case RawLocalVarDescriptors::kContextVar:
10828 return "ContextVar"; 10835 return "ContextVar";
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
10980 num_variables, RawLocalVarDescriptors::kMaxIndex); 10987 num_variables, RawLocalVarDescriptors::kMaxIndex);
10981 } 10988 }
10982 LocalVarDescriptors& result = LocalVarDescriptors::Handle(); 10989 LocalVarDescriptors& result = LocalVarDescriptors::Handle();
10983 { 10990 {
10984 uword size = LocalVarDescriptors::InstanceSize(num_variables); 10991 uword size = LocalVarDescriptors::InstanceSize(num_variables);
10985 RawObject* raw = Object::Allocate(LocalVarDescriptors::kClassId, 10992 RawObject* raw = Object::Allocate(LocalVarDescriptors::kClassId,
10986 size, 10993 size,
10987 Heap::kOld); 10994 Heap::kOld);
10988 NoGCScope no_gc; 10995 NoGCScope no_gc;
10989 result ^= raw; 10996 result ^= raw;
10990 result.raw_ptr()->num_entries_ = num_variables; 10997 result.raw_ptr()->length_ = num_variables;
10991 } 10998 }
10999 const Array& names = (num_variables == 0) ? Object::empty_array() :
11000 Array::Handle(Array::New(num_variables, Heap::kOld));
11001 result.raw_ptr()->names_ = names.raw();
10992 return result.raw(); 11002 return result.raw();
10993 } 11003 }
10994 11004
10995 11005
10996 intptr_t LocalVarDescriptors::Length() const { 11006 intptr_t LocalVarDescriptors::Length() const {
10997 return raw_ptr()->num_entries_; 11007 return raw_ptr()->length_;
10998 } 11008 }
10999 11009
11000 11010
11001 intptr_t ExceptionHandlers::Length() const { 11011 intptr_t ExceptionHandlers::Length() const {
11002 return raw_ptr()->length_; 11012 return raw_ptr()->length_;
11003 } 11013 }
11004 11014
11005 11015
11006 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index, 11016 void ExceptionHandlers::SetHandlerInfo(intptr_t try_index,
11007 intptr_t outer_try_index, 11017 intptr_t outer_try_index,
(...skipping 9334 matching lines...) Expand 10 before | Expand all | Expand 10 after
20342 return tag_label.ToCString(); 20352 return tag_label.ToCString();
20343 } 20353 }
20344 20354
20345 20355
20346 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20356 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20347 Instance::PrintJSONImpl(stream, ref); 20357 Instance::PrintJSONImpl(stream, ref);
20348 } 20358 }
20349 20359
20350 20360
20351 } // namespace dart 20361 } // namespace dart
OLDNEW
« no previous file with comments | « 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