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

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

Issue 575663002: Eliminate 99% of allocated ExceptionHandler objects (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
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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() { 396 static const LocalVarDescriptors& empty_var_descriptors() {
397 ASSERT(empty_var_descriptors_ != NULL); 397 ASSERT(empty_var_descriptors_ != NULL);
398 return *empty_var_descriptors_; 398 return *empty_var_descriptors_;
399 } 399 }
400 400
401 static const ExceptionHandlers& empty_exception_handlers() {
402 ASSERT(empty_exception_handlers_ != NULL);
403 return *empty_exception_handlers_;
404 }
405
401 // The sentinel is a value that cannot be produced by Dart code. 406 // The sentinel is a value that cannot be produced by Dart code.
402 // It can be used to mark special values, for example to distinguish 407 // It can be used to mark special values, for example to distinguish
403 // "uninitialized" fields. 408 // "uninitialized" fields.
404 static const Instance& sentinel() { 409 static const Instance& sentinel() {
405 ASSERT(sentinel_ != NULL); 410 ASSERT(sentinel_ != NULL);
406 return *sentinel_; 411 return *sentinel_;
407 } 412 }
408 // Value marking that we are transitioning from sentinel, e.g., computing 413 // Value marking that we are transitioning from sentinel, e.g., computing
409 // a field value. Used to detect circular initialization. 414 // a field value. Used to detect circular initialization.
410 static const Instance& transition_sentinel() { 415 static const Instance& transition_sentinel() {
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 // objects that are shared between the different isolates. 674 // objects that are shared between the different isolates.
670 static Object* null_object_; 675 static Object* null_object_;
671 static Array* null_array_; 676 static Array* null_array_;
672 static String* null_string_; 677 static String* null_string_;
673 static Instance* null_instance_; 678 static Instance* null_instance_;
674 static TypeArguments* null_type_arguments_; 679 static TypeArguments* null_type_arguments_;
675 static Array* empty_array_; 680 static Array* empty_array_;
676 static Array* zero_array_; 681 static Array* zero_array_;
677 static PcDescriptors* empty_descriptors_; 682 static PcDescriptors* empty_descriptors_;
678 static LocalVarDescriptors* empty_var_descriptors_; 683 static LocalVarDescriptors* empty_var_descriptors_;
684 static ExceptionHandlers* empty_exception_handlers_;
679 static Instance* sentinel_; 685 static Instance* sentinel_;
680 static Instance* transition_sentinel_; 686 static Instance* transition_sentinel_;
681 static Instance* unknown_constant_; 687 static Instance* unknown_constant_;
682 static Instance* non_constant_; 688 static Instance* non_constant_;
683 static Bool* bool_true_; 689 static Bool* bool_true_;
684 static Bool* bool_false_; 690 static Bool* bool_false_;
685 static Smi* smi_illegal_cid_; 691 static Smi* smi_illegal_cid_;
686 static LanguageError* snapshot_writer_error_; 692 static LanguageError* snapshot_writer_error_;
687 static LanguageError* branch_offset_error_; 693 static LanguageError* branch_offset_error_;
688 694
(...skipping 2658 matching lines...) Expand 10 before | Expand all | Expand 10 after
3347 private: 3353 private:
3348 // Pick somewhat arbitrary maximum number of exception handlers 3354 // Pick somewhat arbitrary maximum number of exception handlers
3349 // for a function. This value is used to catch potentially 3355 // for a function. This value is used to catch potentially
3350 // malicious code. 3356 // malicious code.
3351 static const intptr_t kMaxHandlers = 1024 * 1024; 3357 static const intptr_t kMaxHandlers = 1024 * 1024;
3352 3358
3353 void set_handled_types_data(const Array& value) const; 3359 void set_handled_types_data(const Array& value) const;
3354 3360
3355 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object); 3361 FINAL_HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object);
3356 friend class Class; 3362 friend class Class;
3363 friend class Object;
3357 }; 3364 };
3358 3365
3359 3366
3360 // Holds deopt information at one deoptimization point. The information consists 3367 // Holds deopt information at one deoptimization point. The information consists
3361 // of two parts: 3368 // of two parts:
3362 // - first a prefix consiting of kMaterializeObject instructions describing 3369 // - first a prefix consiting of kMaterializeObject instructions describing
3363 // objects which had their allocation removed as part of AllocationSinking 3370 // objects which had their allocation removed as part of AllocationSinking
3364 // pass and have to be materialized; 3371 // pass and have to be materialized;
3365 // - followed by a list of DeoptInstr objects, specifying transformation 3372 // - followed by a list of DeoptInstr objects, specifying transformation
3366 // information for each slot in unoptimized frame(s). 3373 // information for each slot in unoptimized frame(s).
(...skipping 4085 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

Powered by Google App Engine
This is Rietveld 408576698