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

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 empty_var_descriptors_->raw_ptr()->names_ = empty_array_->raw_ptr();
siva 2014/09/11 00:04:29 to be safe: StorePointer(&empty_var_descriptors_-
hausner 2014/09/11 16:08:12 StorePointer() is an instance method, can't use it
681 }
668 682
669 cls = Class::New<Instance>(kDynamicCid); 683 cls = Class::New<Instance>(kDynamicCid);
670 cls.set_is_abstract(); 684 cls.set_is_abstract();
671 cls.set_num_type_arguments(0); 685 cls.set_num_type_arguments(0);
672 cls.set_num_own_type_arguments(0); 686 cls.set_num_own_type_arguments(0);
673 cls.set_is_type_finalized(); 687 cls.set_is_type_finalized();
674 cls.set_is_finalized(); 688 cls.set_is_finalized();
675 dynamic_class_ = cls.raw(); 689 dynamic_class_ = cls.raw();
676 690
677 cls = Class::New<Instance>(kVoidCid); 691 cls = Class::New<Instance>(kVoidCid);
(...skipping 19684 matching lines...) Expand 10 before | Expand all | Expand 10 after
20362 return tag_label.ToCString(); 20376 return tag_label.ToCString();
20363 } 20377 }
20364 20378
20365 20379
20366 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { 20380 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const {
20367 Instance::PrintJSONImpl(stream, ref); 20381 Instance::PrintJSONImpl(stream, ref);
20368 } 20382 }
20369 20383
20370 20384
20371 } // namespace dart 20385 } // 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