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 RUNTIME_VM_RAW_OBJECT_H_ | 5 #ifndef RUNTIME_VM_RAW_OBJECT_H_ |
6 #define RUNTIME_VM_RAW_OBJECT_H_ | 6 #define RUNTIME_VM_RAW_OBJECT_H_ |
7 | 7 |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/atomic.h" | 9 #include "vm/atomic.h" |
10 #include "vm/exceptions.h" | 10 #include "vm/exceptions.h" |
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 RawObject** from() { | 912 RawObject** from() { |
913 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); | 913 return reinterpret_cast<RawObject**>(&ptr()->context_scope_); |
914 } | 914 } |
915 RawContextScope* context_scope_; | 915 RawContextScope* context_scope_; |
916 RawFunction* parent_function_; // Enclosing function of this local function. | 916 RawFunction* parent_function_; // Enclosing function of this local function. |
917 RawType* signature_type_; | 917 RawType* signature_type_; |
918 RawInstance* closure_; // Closure object for static implicit closures. | 918 RawInstance* closure_; // Closure object for static implicit closures. |
919 RawObject** to_snapshot() { | 919 RawObject** to_snapshot() { |
920 return reinterpret_cast<RawObject**>(&ptr()->closure_); | 920 return reinterpret_cast<RawObject**>(&ptr()->closure_); |
921 } | 921 } |
922 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->closure_); } | 922 RawObject* hash_; |
| 923 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } |
923 | 924 |
924 friend class Function; | 925 friend class Function; |
925 }; | 926 }; |
926 | 927 |
927 class RawSignatureData : public RawObject { | 928 class RawSignatureData : public RawObject { |
928 private: | 929 private: |
929 RAW_HEAP_OBJECT_IMPLEMENTATION(SignatureData); | 930 RAW_HEAP_OBJECT_IMPLEMENTATION(SignatureData); |
930 | 931 |
931 RawObject** from() { | 932 RawObject** from() { |
932 return reinterpret_cast<RawObject**>(&ptr()->parent_function_); | 933 return reinterpret_cast<RawObject**>(&ptr()->parent_function_); |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1791 }; | 1792 }; |
1792 | 1793 |
1793 class RawClosure : public RawInstance { | 1794 class RawClosure : public RawInstance { |
1794 private: | 1795 private: |
1795 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); | 1796 RAW_HEAP_OBJECT_IMPLEMENTATION(Closure); |
1796 | 1797 |
1797 RawObject** from() { | 1798 RawObject** from() { |
1798 return reinterpret_cast<RawObject**>(&ptr()->instantiator_type_arguments_); | 1799 return reinterpret_cast<RawObject**>(&ptr()->instantiator_type_arguments_); |
1799 } | 1800 } |
1800 | 1801 |
1801 // No instance fields should be declared before the following fields whose | 1802 // No instance fields should be declared before the following 4 fields whose |
1802 // offsets must be identical in Dart and C++. | 1803 // offsets must be identical in Dart and C++. |
1803 | 1804 |
1804 // The following fields are also declared in the Dart source of class | 1805 // These 4 fields are also declared in the Dart source of class _Closure. |
1805 // _Closure. | |
1806 RawTypeArguments* instantiator_type_arguments_; | 1806 RawTypeArguments* instantiator_type_arguments_; |
1807 RawTypeArguments* function_type_arguments_; | 1807 RawTypeArguments* function_type_arguments_; |
1808 RawFunction* function_; | 1808 RawFunction* function_; |
1809 RawContext* context_; | 1809 RawContext* context_; |
1810 RawSmi* hash_; | |
1811 | 1810 |
1812 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->hash_); } | 1811 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->context_); } |
1813 | 1812 |
1814 // Note that instantiator_type_arguments_ and function_type_arguments_ are | 1813 // Note that instantiator_type_arguments_ and function_type_arguments_ are |
1815 // used to instantiate the signature of function_ when this closure is | 1814 // used to instantiate the signature of function_ when this closure is |
1816 // involved in a type test. In other words, these fields define the function | 1815 // involved in a type test. In other words, these fields define the function |
1817 // type of this closure instance, but they are not used when invoking it. | 1816 // type of this closure instance, but they are not used when invoking it. |
1818 // If this closure is generic, it can be invoked with function type arguments | 1817 // If this closure is generic, it can be invoked with function type arguments |
1819 // that will be processed in the prolog of the closure function_. For example, | 1818 // that will be processed in the prolog of the closure function_. For example, |
1820 // if the generic closure function_ has a generic parent function, the | 1819 // if the generic closure function_ has a generic parent function, the |
1821 // passed-in function type arguments get concatenated to the function type | 1820 // passed-in function type arguments get concatenated to the function type |
1822 // arguments of the parent that are found in the context_. | 1821 // arguments of the parent that are found in the context_. |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2434 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2433 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2435 kTypedDataInt8ArrayViewCid + 15); | 2434 kTypedDataInt8ArrayViewCid + 15); |
2436 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2435 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2437 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2436 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2438 return (kNullCid - kTypedDataInt8ArrayCid); | 2437 return (kNullCid - kTypedDataInt8ArrayCid); |
2439 } | 2438 } |
2440 | 2439 |
2441 } // namespace dart | 2440 } // namespace dart |
2442 | 2441 |
2443 #endif // RUNTIME_VM_RAW_OBJECT_H_ | 2442 #endif // RUNTIME_VM_RAW_OBJECT_H_ |
OLD | NEW |