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 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1406 int64_t value_; | 1406 int64_t value_; |
1407 | 1407 |
1408 friend class Api; | 1408 friend class Api; |
1409 friend class SnapshotReader; | 1409 friend class SnapshotReader; |
1410 }; | 1410 }; |
1411 | 1411 |
1412 | 1412 |
1413 class RawBigint : public RawInteger { | 1413 class RawBigint : public RawInteger { |
1414 RAW_HEAP_OBJECT_IMPLEMENTATION(Bigint); | 1414 RAW_HEAP_OBJECT_IMPLEMENTATION(Bigint); |
1415 | 1415 |
1416 // Actual length in chunks at the time of allocation (later we may | 1416 RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->neg_); } |
1417 // clamp the operational length but we need to maintain a consistent | 1417 RawBool* neg_; |
1418 // object length so that the object can be traversed during GC). | 1418 RawSmi* used_; |
1419 intptr_t allocated_length_; | 1419 RawTypedData* digits_; |
1420 | 1420 RawObject** to() { return reinterpret_cast<RawObject**>(&ptr()->digits_); } |
1421 // Operational length in chunks of the bigint object, clamping can | |
1422 // cause this length to be reduced. If the signed_length_ is | |
1423 // negative then the number is negative. | |
1424 intptr_t signed_length_; | |
1425 | |
1426 // A sequence of Chunks (typedef in Bignum) representing bignum digits. | |
1427 // Bignum::Chunk chunks_[Utils::Abs(signed_length_)]; | |
1428 uint8_t* data() { OPEN_ARRAY_START(uint8_t, uint8_t); } | |
1429 | |
1430 friend class SnapshotReader; | |
1431 }; | 1421 }; |
1432 | 1422 |
1433 | 1423 |
1434 class RawDouble : public RawNumber { | 1424 class RawDouble : public RawNumber { |
1435 RAW_HEAP_OBJECT_IMPLEMENTATION(Double); | 1425 RAW_HEAP_OBJECT_IMPLEMENTATION(Double); |
1436 | 1426 |
1437 double value_; | 1427 double value_; |
1438 | 1428 |
1439 friend class Api; | 1429 friend class Api; |
1440 friend class SnapshotReader; | 1430 friend class SnapshotReader; |
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1984 (index == kTypeArgumentsCid) || | 1974 (index == kTypeArgumentsCid) || |
1985 (index == kInstructionsCid) || | 1975 (index == kInstructionsCid) || |
1986 (index == kPcDescriptorsCid) || | 1976 (index == kPcDescriptorsCid) || |
1987 (index == kStackmapCid) || | 1977 (index == kStackmapCid) || |
1988 (index == kLocalVarDescriptorsCid) || | 1978 (index == kLocalVarDescriptorsCid) || |
1989 (index == kExceptionHandlersCid) || | 1979 (index == kExceptionHandlersCid) || |
1990 (index == kDeoptInfoCid) || | 1980 (index == kDeoptInfoCid) || |
1991 (index == kCodeCid) || | 1981 (index == kCodeCid) || |
1992 (index == kContextScopeCid) || | 1982 (index == kContextScopeCid) || |
1993 (index == kInstanceCid) || | 1983 (index == kInstanceCid) || |
1994 (index == kBigintCid) || | |
1995 (index == kJSRegExpCid); | 1984 (index == kJSRegExpCid); |
1996 } | 1985 } |
1997 | 1986 |
1998 | 1987 |
1999 // This is a set of classes that are not Dart classes whose representation | 1988 // This is a set of classes that are not Dart classes whose representation |
2000 // is defined by the VM but are used in the VM code by computing the | 1989 // is defined by the VM but are used in the VM code by computing the |
2001 // implicit field offsets of the various fields in the dart object. | 1990 // implicit field offsets of the various fields in the dart object. |
2002 inline bool RawObject::IsImplicitFieldClassId(intptr_t index) { | 1991 inline bool RawObject::IsImplicitFieldClassId(intptr_t index) { |
2003 return (IsTypedDataViewClassId(index) || index == kByteBufferCid); | 1992 return (IsTypedDataViewClassId(index) || index == kByteBufferCid); |
2004 } | 1993 } |
2005 | 1994 |
2006 | 1995 |
2007 inline intptr_t RawObject::NumberOfTypedDataClasses() { | 1996 inline intptr_t RawObject::NumberOfTypedDataClasses() { |
2008 // Make sure this is updated when new TypedData types are added. | 1997 // Make sure this is updated when new TypedData types are added. |
2009 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); | 1998 COMPILE_ASSERT(kTypedDataInt8ArrayViewCid == kTypedDataInt8ArrayCid + 14); |
2010 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 1999 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
2011 kTypedDataInt8ArrayViewCid + 15); | 2000 kTypedDataInt8ArrayViewCid + 15); |
2012 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2001 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
2013 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2002 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
2014 return (kNullCid - kTypedDataInt8ArrayCid); | 2003 return (kNullCid - kTypedDataInt8ArrayCid); |
2015 } | 2004 } |
2016 | 2005 |
2017 } // namespace dart | 2006 } // namespace dart |
2018 | 2007 |
2019 #endif // VM_RAW_OBJECT_H_ | 2008 #endif // VM_RAW_OBJECT_H_ |
OLD | NEW |