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

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

Issue 565513002: Optimize LocalVarDescriptor objects for functions that have no local variables (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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 #endif 91 #endif
92 #define RAW_NULL kHeapObjectTag 92 #define RAW_NULL kHeapObjectTag
93 Object* Object::null_object_ = NULL; 93 Object* Object::null_object_ = NULL;
94 Array* Object::null_array_ = NULL; 94 Array* Object::null_array_ = NULL;
95 String* Object::null_string_ = NULL; 95 String* Object::null_string_ = NULL;
96 Instance* Object::null_instance_ = NULL; 96 Instance* Object::null_instance_ = NULL;
97 TypeArguments* Object::null_type_arguments_ = NULL; 97 TypeArguments* Object::null_type_arguments_ = NULL;
98 Array* Object::empty_array_ = NULL; 98 Array* Object::empty_array_ = NULL;
99 Array* Object::zero_array_ = NULL; 99 Array* Object::zero_array_ = NULL;
100 PcDescriptors* Object::empty_descriptors_ = NULL; 100 PcDescriptors* Object::empty_descriptors_ = NULL;
101 LocalVarDescriptors* Object::empty_var_descriptors_ = NULL;
101 Instance* Object::sentinel_ = NULL; 102 Instance* Object::sentinel_ = NULL;
102 Instance* Object::transition_sentinel_ = NULL; 103 Instance* Object::transition_sentinel_ = NULL;
103 Instance* Object::unknown_constant_ = NULL; 104 Instance* Object::unknown_constant_ = NULL;
104 Instance* Object::non_constant_ = NULL; 105 Instance* Object::non_constant_ = NULL;
105 Bool* Object::bool_true_ = NULL; 106 Bool* Object::bool_true_ = NULL;
106 Bool* Object::bool_false_ = NULL; 107 Bool* Object::bool_false_ = NULL;
107 Smi* Object::smi_illegal_cid_ = NULL; 108 Smi* Object::smi_illegal_cid_ = NULL;
108 LanguageError* Object::snapshot_writer_error_ = NULL; 109 LanguageError* Object::snapshot_writer_error_ = NULL;
109 LanguageError* Object::branch_offset_error_ = NULL; 110 LanguageError* Object::branch_offset_error_ = NULL;
110 111
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 429
429 // Allocate the read only object handles here. 430 // Allocate the read only object handles here.
430 null_object_ = Object::ReadOnlyHandle(); 431 null_object_ = Object::ReadOnlyHandle();
431 null_array_ = Array::ReadOnlyHandle(); 432 null_array_ = Array::ReadOnlyHandle();
432 null_string_ = String::ReadOnlyHandle(); 433 null_string_ = String::ReadOnlyHandle();
433 null_instance_ = Instance::ReadOnlyHandle(); 434 null_instance_ = Instance::ReadOnlyHandle();
434 null_type_arguments_ = TypeArguments::ReadOnlyHandle(); 435 null_type_arguments_ = TypeArguments::ReadOnlyHandle();
435 empty_array_ = Array::ReadOnlyHandle(); 436 empty_array_ = Array::ReadOnlyHandle();
436 zero_array_ = Array::ReadOnlyHandle(); 437 zero_array_ = Array::ReadOnlyHandle();
437 empty_descriptors_ = PcDescriptors::ReadOnlyHandle(); 438 empty_descriptors_ = PcDescriptors::ReadOnlyHandle();
439 empty_var_descriptors_ = LocalVarDescriptors::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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 PcDescriptors::InstanceSize(0, RawPcDescriptors::kCompressedRecSize), 660 PcDescriptors::InstanceSize(0, RawPcDescriptors::kCompressedRecSize),
659 Heap::kOld); 661 Heap::kOld);
660 InitializeObject(address, kPcDescriptorsCid, 662 InitializeObject(address, kPcDescriptorsCid,
661 PcDescriptors::InstanceSize(0, RawPcDescriptors::kCompressedRecSize)); 663 PcDescriptors::InstanceSize(0, RawPcDescriptors::kCompressedRecSize));
662 PcDescriptors::initializeHandle( 664 PcDescriptors::initializeHandle(
663 empty_descriptors_, 665 empty_descriptors_,
664 reinterpret_cast<RawPcDescriptors*>(address + kHeapObjectTag)); 666 reinterpret_cast<RawPcDescriptors*>(address + kHeapObjectTag));
665 empty_descriptors_->raw_ptr()->length_ = 0; 667 empty_descriptors_->raw_ptr()->length_ = 0;
666 } 668 }
667 669
670 // Allocate and initialize the canonical empty variable descriptor object.
671 {
672 uword address = heap->Allocate(
673 LocalVarDescriptors::InstanceSize(0), Heap::kOld);
674 InitializeObject(address, kLocalVarDescriptorsCid,
675 LocalVarDescriptors::InstanceSize(0));
676 LocalVarDescriptors::initializeHandle(
677 empty_var_descriptors_,
678 reinterpret_cast<RawLocalVarDescriptors*>(address + kHeapObjectTag));
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();
683 }
668 684
669 cls = Class::New<Instance>(kDynamicCid); 685 cls = Class::New<Instance>(kDynamicCid);
670 cls.set_is_abstract(); 686 cls.set_is_abstract();
671 cls.set_num_type_arguments(0); 687 cls.set_num_type_arguments(0);
672 cls.set_num_own_type_arguments(0); 688 cls.set_num_own_type_arguments(0);
673 cls.set_is_type_finalized(); 689 cls.set_is_type_finalized();
674 cls.set_is_finalized(); 690 cls.set_is_finalized();
675 dynamic_class_ = cls.raw(); 691 dynamic_class_ = cls.raw();
676 692
677 cls = Class::New<Instance>(kVoidCid); 693 cls = Class::New<Instance>(kVoidCid);
(...skipping 19684 matching lines...) Expand 10 before | Expand all | Expand 10 after
20362 return tag_label.ToCString(); 20378 return tag_label.ToCString();
20363 } 20379 }
20364 20380
20365 20381
20366 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20382 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20367 Instance::PrintJSONImpl(stream, ref); 20383 Instance::PrintJSONImpl(stream, ref);
20368 } 20384 }
20369 20385
20370 20386
20371 } // namespace dart 20387 } // 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