| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 2613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3302 void SetBit(intptr_t bit_index, bool value) const; | 3308 void SetBit(intptr_t bit_index, bool value) const; |
| 3303 | 3309 |
| 3304 FINAL_HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); | 3310 FINAL_HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); |
| 3305 friend class BitmapBuilder; | 3311 friend class BitmapBuilder; |
| 3306 friend class Class; | 3312 friend class Class; |
| 3307 }; | 3313 }; |
| 3308 | 3314 |
| 3309 | 3315 |
| 3310 class ExceptionHandlers : public Object { | 3316 class ExceptionHandlers : public Object { |
| 3311 public: | 3317 public: |
| 3312 intptr_t Length() const; | 3318 intptr_t num_entries() const; |
| 3313 | 3319 |
| 3314 void GetHandlerInfo(intptr_t try_index, | 3320 void GetHandlerInfo(intptr_t try_index, |
| 3315 RawExceptionHandlers::HandlerInfo* info) const; | 3321 RawExceptionHandlers::HandlerInfo* info) const; |
| 3316 | 3322 |
| 3317 intptr_t HandlerPC(intptr_t try_index) const; | 3323 intptr_t HandlerPC(intptr_t try_index) const; |
| 3318 intptr_t OuterTryIndex(intptr_t try_index) const; | 3324 intptr_t OuterTryIndex(intptr_t try_index) const; |
| 3319 bool NeedsStacktrace(intptr_t try_index) const; | 3325 bool NeedsStacktrace(intptr_t try_index) const; |
| 3320 | 3326 |
| 3321 void SetHandlerInfo(intptr_t try_index, | 3327 void SetHandlerInfo(intptr_t try_index, |
| 3322 intptr_t outer_try_index, | 3328 intptr_t outer_try_index, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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_ |
| OLD | NEW |