| 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_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
| 6 #define VM_RAW_OBJECT_H_ | 6 #define 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/globals.h" | 10 #include "vm/globals.h" |
| (...skipping 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1304 RawBool* is_const; | 1304 RawBool* is_const; |
| 1305 union { | 1305 union { |
| 1306 RawAbstractType* type; | 1306 RawAbstractType* type; |
| 1307 RawInstance* value; // iff is_const is true | 1307 RawInstance* value; // iff is_const is true |
| 1308 }; | 1308 }; |
| 1309 RawSmi* context_index; | 1309 RawSmi* context_index; |
| 1310 RawSmi* context_level; | 1310 RawSmi* context_level; |
| 1311 }; | 1311 }; |
| 1312 | 1312 |
| 1313 int32_t num_variables_; | 1313 int32_t num_variables_; |
| 1314 bool is_implicit_; // true, if this context scope is for an implicit closure. |
| 1314 | 1315 |
| 1315 RawObject** from() { | 1316 RawObject** from() { |
| 1316 VariableDesc* begin = const_cast<VariableDesc*>(ptr()->VariableDescAddr(0)); | 1317 VariableDesc* begin = const_cast<VariableDesc*>(ptr()->VariableDescAddr(0)); |
| 1317 return reinterpret_cast<RawObject**>(begin); | 1318 return reinterpret_cast<RawObject**>(begin); |
| 1318 } | 1319 } |
| 1319 // Variable length data follows here. | 1320 // Variable length data follows here. |
| 1320 RawObject* const* data() const { OPEN_ARRAY_START(RawObject*, RawObject*); } | 1321 RawObject* const* data() const { OPEN_ARRAY_START(RawObject*, RawObject*); } |
| 1321 const VariableDesc* VariableDescAddr(intptr_t index) const { | 1322 const VariableDesc* VariableDescAddr(intptr_t index) const { |
| 1322 ASSERT((index >= 0) && (index < num_variables_ + 1)); | 1323 ASSERT((index >= 0) && (index < num_variables_ + 1)); |
| 1323 // data() points to the first component of the first descriptor. | 1324 // data() points to the first component of the first descriptor. |
| 1324 return &(reinterpret_cast<const VariableDesc*>(data())[index]); | 1325 return &(reinterpret_cast<const VariableDesc*>(data())[index]); |
| 1325 } | 1326 } |
| 1326 RawObject** to(intptr_t num_vars) { | 1327 RawObject** to(intptr_t num_vars) { |
| 1327 uword end = reinterpret_cast<uword>(ptr()->VariableDescAddr(num_vars)); | 1328 uword end = reinterpret_cast<uword>(ptr()->VariableDescAddr(num_vars)); |
| 1328 // 'end' is the address just beyond the last descriptor, so step back. | 1329 // 'end' is the address just beyond the last descriptor, so step back. |
| 1329 return reinterpret_cast<RawObject**>(end - kWordSize); | 1330 return reinterpret_cast<RawObject**>(end - kWordSize); |
| 1330 } | 1331 } |
| 1332 |
| 1333 friend class Object; |
| 1334 friend class RawClosureData; |
| 1331 }; | 1335 }; |
| 1332 | 1336 |
| 1333 | 1337 |
| 1334 class RawICData : public RawObject { | 1338 class RawICData : public RawObject { |
| 1335 RAW_HEAP_OBJECT_IMPLEMENTATION(ICData); | 1339 RAW_HEAP_OBJECT_IMPLEMENTATION(ICData); |
| 1336 | 1340 |
| 1337 RawObject** from() { | 1341 RawObject** from() { |
| 1338 return reinterpret_cast<RawObject**>(&ptr()->owner_); | 1342 return reinterpret_cast<RawObject**>(&ptr()->owner_); |
| 1339 } | 1343 } |
| 1340 RawFunction* owner_; // Parent/calling function of this IC. | 1344 RawFunction* owner_; // Parent/calling function of this IC. |
| (...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2198 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2202 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
| 2199 kTypedDataInt8ArrayViewCid + 15); | 2203 kTypedDataInt8ArrayViewCid + 15); |
| 2200 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2204 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
| 2201 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2205 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
| 2202 return (kNullCid - kTypedDataInt8ArrayCid); | 2206 return (kNullCid - kTypedDataInt8ArrayCid); |
| 2203 } | 2207 } |
| 2204 | 2208 |
| 2205 } // namespace dart | 2209 } // namespace dart |
| 2206 | 2210 |
| 2207 #endif // VM_RAW_OBJECT_H_ | 2211 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |