| 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 #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/become.h" | 10 #include "vm/become.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // These are initialized to a value that will force a illegal memory access if | 102 // These are initialized to a value that will force a illegal memory access if |
| 103 // they are being used. | 103 // they are being used. |
| 104 #if defined(RAW_NULL) | 104 #if defined(RAW_NULL) |
| 105 #error RAW_NULL should not be defined. | 105 #error RAW_NULL should not be defined. |
| 106 #endif | 106 #endif |
| 107 #define RAW_NULL kHeapObjectTag | 107 #define RAW_NULL kHeapObjectTag |
| 108 Object* Object::null_object_ = NULL; | 108 Object* Object::null_object_ = NULL; |
| 109 Array* Object::null_array_ = NULL; | 109 Array* Object::null_array_ = NULL; |
| 110 String* Object::null_string_ = NULL; | 110 String* Object::null_string_ = NULL; |
| 111 Instance* Object::null_instance_ = NULL; | 111 Instance* Object::null_instance_ = NULL; |
| 112 Function* Object::null_function_ = NULL; |
| 112 TypeArguments* Object::null_type_arguments_ = NULL; | 113 TypeArguments* Object::null_type_arguments_ = NULL; |
| 113 TypeArguments* Object::empty_type_arguments_ = NULL; | 114 TypeArguments* Object::empty_type_arguments_ = NULL; |
| 114 Array* Object::empty_array_ = NULL; | 115 Array* Object::empty_array_ = NULL; |
| 115 Array* Object::zero_array_ = NULL; | 116 Array* Object::zero_array_ = NULL; |
| 116 Context* Object::empty_context_ = NULL; | 117 Context* Object::empty_context_ = NULL; |
| 117 ContextScope* Object::empty_context_scope_ = NULL; | 118 ContextScope* Object::empty_context_scope_ = NULL; |
| 118 ObjectPool* Object::empty_object_pool_ = NULL; | 119 ObjectPool* Object::empty_object_pool_ = NULL; |
| 119 PcDescriptors* Object::empty_descriptors_ = NULL; | 120 PcDescriptors* Object::empty_descriptors_ = NULL; |
| 120 LocalVarDescriptors* Object::empty_var_descriptors_ = NULL; | 121 LocalVarDescriptors* Object::empty_var_descriptors_ = NULL; |
| 121 ExceptionHandlers* Object::empty_exception_handlers_ = NULL; | 122 ExceptionHandlers* Object::empty_exception_handlers_ = NULL; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 Smi::handle_vtable_ = fake_smi.vtable(); | 497 Smi::handle_vtable_ = fake_smi.vtable(); |
| 497 } | 498 } |
| 498 | 499 |
| 499 Heap* heap = isolate->heap(); | 500 Heap* heap = isolate->heap(); |
| 500 | 501 |
| 501 // Allocate the read only object handles here. | 502 // Allocate the read only object handles here. |
| 502 null_object_ = Object::ReadOnlyHandle(); | 503 null_object_ = Object::ReadOnlyHandle(); |
| 503 null_array_ = Array::ReadOnlyHandle(); | 504 null_array_ = Array::ReadOnlyHandle(); |
| 504 null_string_ = String::ReadOnlyHandle(); | 505 null_string_ = String::ReadOnlyHandle(); |
| 505 null_instance_ = Instance::ReadOnlyHandle(); | 506 null_instance_ = Instance::ReadOnlyHandle(); |
| 507 null_function_ = Function::ReadOnlyHandle(); |
| 506 null_type_arguments_ = TypeArguments::ReadOnlyHandle(); | 508 null_type_arguments_ = TypeArguments::ReadOnlyHandle(); |
| 507 empty_type_arguments_ = TypeArguments::ReadOnlyHandle(); | 509 empty_type_arguments_ = TypeArguments::ReadOnlyHandle(); |
| 508 empty_array_ = Array::ReadOnlyHandle(); | 510 empty_array_ = Array::ReadOnlyHandle(); |
| 509 zero_array_ = Array::ReadOnlyHandle(); | 511 zero_array_ = Array::ReadOnlyHandle(); |
| 510 empty_context_ = Context::ReadOnlyHandle(); | 512 empty_context_ = Context::ReadOnlyHandle(); |
| 511 empty_context_scope_ = ContextScope::ReadOnlyHandle(); | 513 empty_context_scope_ = ContextScope::ReadOnlyHandle(); |
| 512 empty_object_pool_ = ObjectPool::ReadOnlyHandle(); | 514 empty_object_pool_ = ObjectPool::ReadOnlyHandle(); |
| 513 empty_descriptors_ = PcDescriptors::ReadOnlyHandle(); | 515 empty_descriptors_ = PcDescriptors::ReadOnlyHandle(); |
| 514 empty_var_descriptors_ = LocalVarDescriptors::ReadOnlyHandle(); | 516 empty_var_descriptors_ = LocalVarDescriptors::ReadOnlyHandle(); |
| 515 empty_exception_handlers_ = ExceptionHandlers::ReadOnlyHandle(); | 517 empty_exception_handlers_ = ExceptionHandlers::ReadOnlyHandle(); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 528 background_compilation_error_ = LanguageError::ReadOnlyHandle(); | 530 background_compilation_error_ = LanguageError::ReadOnlyHandle(); |
| 529 vm_isolate_snapshot_object_table_ = Array::ReadOnlyHandle(); | 531 vm_isolate_snapshot_object_table_ = Array::ReadOnlyHandle(); |
| 530 dynamic_type_ = Type::ReadOnlyHandle(); | 532 dynamic_type_ = Type::ReadOnlyHandle(); |
| 531 void_type_ = Type::ReadOnlyHandle(); | 533 void_type_ = Type::ReadOnlyHandle(); |
| 532 vector_type_ = Type::ReadOnlyHandle(); | 534 vector_type_ = Type::ReadOnlyHandle(); |
| 533 | 535 |
| 534 *null_object_ = Object::null(); | 536 *null_object_ = Object::null(); |
| 535 *null_array_ = Array::null(); | 537 *null_array_ = Array::null(); |
| 536 *null_string_ = String::null(); | 538 *null_string_ = String::null(); |
| 537 *null_instance_ = Instance::null(); | 539 *null_instance_ = Instance::null(); |
| 540 *null_function_ = Function::null(); |
| 538 *null_type_arguments_ = TypeArguments::null(); | 541 *null_type_arguments_ = TypeArguments::null(); |
| 539 | 542 |
| 540 // Initialize the empty and zero array handles to null_ in order to be able to | 543 // Initialize the empty and zero array handles to null_ in order to be able to |
| 541 // check if the empty and zero arrays were allocated (RAW_NULL is not | 544 // check if the empty and zero arrays were allocated (RAW_NULL is not |
| 542 // available). | 545 // available). |
| 543 *empty_array_ = Array::null(); | 546 *empty_array_ = Array::null(); |
| 544 *zero_array_ = Array::null(); | 547 *zero_array_ = Array::null(); |
| 545 | 548 |
| 546 Class& cls = Class::Handle(); | 549 Class& cls = Class::Handle(); |
| 547 | 550 |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 thr->clear_sticky_error(); | 943 thr->clear_sticky_error(); |
| 941 thr->clear_pending_functions(); | 944 thr->clear_pending_functions(); |
| 942 | 945 |
| 943 ASSERT(!null_object_->IsSmi()); | 946 ASSERT(!null_object_->IsSmi()); |
| 944 ASSERT(!null_array_->IsSmi()); | 947 ASSERT(!null_array_->IsSmi()); |
| 945 ASSERT(null_array_->IsArray()); | 948 ASSERT(null_array_->IsArray()); |
| 946 ASSERT(!null_string_->IsSmi()); | 949 ASSERT(!null_string_->IsSmi()); |
| 947 ASSERT(null_string_->IsString()); | 950 ASSERT(null_string_->IsString()); |
| 948 ASSERT(!null_instance_->IsSmi()); | 951 ASSERT(!null_instance_->IsSmi()); |
| 949 ASSERT(null_instance_->IsInstance()); | 952 ASSERT(null_instance_->IsInstance()); |
| 953 ASSERT(!null_function_->IsSmi()); |
| 954 ASSERT(null_function_->IsFunction()); |
| 950 ASSERT(!null_type_arguments_->IsSmi()); | 955 ASSERT(!null_type_arguments_->IsSmi()); |
| 951 ASSERT(null_type_arguments_->IsTypeArguments()); | 956 ASSERT(null_type_arguments_->IsTypeArguments()); |
| 952 ASSERT(!empty_type_arguments_->IsSmi()); | 957 ASSERT(!empty_type_arguments_->IsSmi()); |
| 953 ASSERT(empty_type_arguments_->IsTypeArguments()); | 958 ASSERT(empty_type_arguments_->IsTypeArguments()); |
| 954 ASSERT(!empty_array_->IsSmi()); | 959 ASSERT(!empty_array_->IsSmi()); |
| 955 ASSERT(empty_array_->IsArray()); | 960 ASSERT(empty_array_->IsArray()); |
| 956 ASSERT(!zero_array_->IsSmi()); | 961 ASSERT(!zero_array_->IsSmi()); |
| 957 ASSERT(zero_array_->IsArray()); | 962 ASSERT(zero_array_->IsArray()); |
| 958 ASSERT(!empty_context_->IsSmi()); | 963 ASSERT(!empty_context_->IsSmi()); |
| 959 ASSERT(empty_context_->IsContext()); | 964 ASSERT(empty_context_->IsContext()); |
| (...skipping 21579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 22539 } | 22544 } |
| 22540 return UserTag::null(); | 22545 return UserTag::null(); |
| 22541 } | 22546 } |
| 22542 | 22547 |
| 22543 const char* UserTag::ToCString() const { | 22548 const char* UserTag::ToCString() const { |
| 22544 const String& tag_label = String::Handle(label()); | 22549 const String& tag_label = String::Handle(label()); |
| 22545 return tag_label.ToCString(); | 22550 return tag_label.ToCString(); |
| 22546 } | 22551 } |
| 22547 | 22552 |
| 22548 } // namespace dart | 22553 } // namespace dart |
| OLD | NEW |