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

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

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 | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')
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 #ifndef VM_OBJECT_H_ 5 #ifndef VM_OBJECT_H_
6 #define VM_OBJECT_H_ 6 #define VM_OBJECT_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 #include "platform/assert.h" 9 #include "platform/assert.h"
10 #include "platform/utils.h" 10 #include "platform/utils.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 static const Array& zero_array() { 386 static const Array& zero_array() {
387 ASSERT(zero_array_ != NULL); 387 ASSERT(zero_array_ != NULL);
388 return *zero_array_; 388 return *zero_array_;
389 } 389 }
390 390
391 static const PcDescriptors& empty_descriptors() { 391 static const PcDescriptors& empty_descriptors() {
392 ASSERT(empty_descriptors_ != NULL); 392 ASSERT(empty_descriptors_ != NULL);
393 return *empty_descriptors_; 393 return *empty_descriptors_;
394 } 394 }
395 395
396 static const LocalVarDescriptors& empty_var_descriptors() {
397 ASSERT(empty_var_descriptors_ != NULL);
398 return *empty_var_descriptors_;
399 }
400
396 // The sentinel is a value that cannot be produced by Dart code. 401 // The sentinel is a value that cannot be produced by Dart code.
397 // It can be used to mark special values, for example to distinguish 402 // It can be used to mark special values, for example to distinguish
398 // "uninitialized" fields. 403 // "uninitialized" fields.
399 static const Instance& sentinel() { 404 static const Instance& sentinel() {
400 ASSERT(sentinel_ != NULL); 405 ASSERT(sentinel_ != NULL);
401 return *sentinel_; 406 return *sentinel_;
402 } 407 }
403 // Value marking that we are transitioning from sentinel, e.g., computing 408 // Value marking that we are transitioning from sentinel, e.g., computing
404 // a field value. Used to detect circular initialization. 409 // a field value. Used to detect circular initialization.
405 static const Instance& transition_sentinel() { 410 static const Instance& transition_sentinel() {
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 // The static values below are read-only handle pointers for singleton 668 // The static values below are read-only handle pointers for singleton
664 // objects that are shared between the different isolates. 669 // objects that are shared between the different isolates.
665 static Object* null_object_; 670 static Object* null_object_;
666 static Array* null_array_; 671 static Array* null_array_;
667 static String* null_string_; 672 static String* null_string_;
668 static Instance* null_instance_; 673 static Instance* null_instance_;
669 static TypeArguments* null_type_arguments_; 674 static TypeArguments* null_type_arguments_;
670 static Array* empty_array_; 675 static Array* empty_array_;
671 static Array* zero_array_; 676 static Array* zero_array_;
672 static PcDescriptors* empty_descriptors_; 677 static PcDescriptors* empty_descriptors_;
678 static LocalVarDescriptors* empty_var_descriptors_;
673 static Instance* sentinel_; 679 static Instance* sentinel_;
674 static Instance* transition_sentinel_; 680 static Instance* transition_sentinel_;
675 static Instance* unknown_constant_; 681 static Instance* unknown_constant_;
676 static Instance* non_constant_; 682 static Instance* non_constant_;
677 static Bool* bool_true_; 683 static Bool* bool_true_;
678 static Bool* bool_false_; 684 static Bool* bool_false_;
679 static Smi* smi_illegal_cid_; 685 static Smi* smi_illegal_cid_;
680 static LanguageError* snapshot_writer_error_; 686 static LanguageError* snapshot_writer_error_;
681 static LanguageError* branch_offset_error_; 687 static LanguageError* branch_offset_error_;
682 688
(...skipping 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after
3092 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement)); 3098 sizeof(RawLocalVarDescriptors) + (len * kBytesPerElement));
3093 } 3099 }
3094 3100
3095 static RawLocalVarDescriptors* New(intptr_t num_variables); 3101 static RawLocalVarDescriptors* New(intptr_t num_variables);
3096 3102
3097 static const char* KindToStr(intptr_t kind); 3103 static const char* KindToStr(intptr_t kind);
3098 3104
3099 private: 3105 private:
3100 FINAL_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object); 3106 FINAL_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors, Object);
3101 friend class Class; 3107 friend class Class;
3108 friend class Object;
3102 }; 3109 };
3103 3110
3104 3111
3105 class PcDescriptors : public Object { 3112 class PcDescriptors : public Object {
3106 public: 3113 public:
3107 void AddDescriptor(intptr_t index, 3114 void AddDescriptor(intptr_t index,
3108 uword pc, 3115 uword pc,
3109 RawPcDescriptors::Kind kind, 3116 RawPcDescriptors::Kind kind,
3110 int64_t deopt_id, 3117 int64_t deopt_id,
3111 int64_t token_pos, // Or deopt reason. 3118 int64_t token_pos, // Or deopt reason.
(...skipping 4340 matching lines...) Expand 10 before | Expand all | Expand 10 after
7452 7459
7453 7460
7454 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 7461 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
7455 intptr_t index) { 7462 intptr_t index) {
7456 return array.At((index * kEntryLength) + kTargetFunctionIndex); 7463 return array.At((index * kEntryLength) + kTargetFunctionIndex);
7457 } 7464 }
7458 7465
7459 } // namespace dart 7466 } // namespace dart
7460 7467
7461 #endif // VM_OBJECT_H_ 7468 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | runtime/vm/object.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698