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