Chromium Code Reviews| 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 1079 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1090 int32_t index() const { | 1090 int32_t index() const { |
| 1091 return IndexBits::decode(index_kind) - kIndexBias; | 1091 return IndexBits::decode(index_kind) - kIndexBias; |
| 1092 } | 1092 } |
| 1093 void set_index(int32_t index) { | 1093 void set_index(int32_t index) { |
| 1094 index_kind = IndexBits::update(index + kIndexBias, index_kind); | 1094 index_kind = IndexBits::update(index + kIndexBias, index_kind); |
| 1095 } | 1095 } |
| 1096 }; | 1096 }; |
| 1097 | 1097 |
| 1098 private: | 1098 private: |
| 1099 RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors); | 1099 RAW_HEAP_OBJECT_IMPLEMENTATION(LocalVarDescriptors); |
| 1100 RawArray* names_; // Array of [length_] variable names. | 1100 int32_t num_entries_; // Number of descriptors. |
| 1101 int32_t length_; // Number of descriptors. | |
| 1102 | 1101 |
| 1103 // Variable info with [length_] entries. | 1102 RawObject** from() { |
| 1104 VarInfo* data() { OPEN_ARRAY_START(VarInfo, int32_t); } | 1103 return reinterpret_cast<RawObject**>(&ptr()->names()[0]); |
| 1104 } | |
| 1105 RawString** names() { | |
| 1106 // Array of [num_entries_] variable names. | |
| 1107 OPEN_ARRAY_START(RawString*, RawString*); | |
| 1108 } | |
|
siva
2014/09/12 22:08:39
For better readability I think it would make sense
hausner
2014/09/12 23:48:04
Added a function to return the address of name[i].
| |
| 1109 RawObject** to(intptr_t num_entries) { | |
| 1110 return reinterpret_cast<RawObject**>(&ptr()->names()[num_entries - 1]); | |
|
siva
2014/09/12 22:08:39
return reinterpret_cast<RawObject**>(&nameAt(num_e
hausner
2014/09/12 23:48:04
You can't take the address of a return value.
| |
| 1111 } | |
| 1112 | |
| 1113 // Variable info with [num_entries_] entries. | |
| 1114 VarInfo* data() { | |
| 1115 return reinterpret_cast<VarInfo*>(&(names()[num_entries_])); | |
| 1116 } | |
| 1105 | 1117 |
| 1106 friend class Object; | 1118 friend class Object; |
| 1107 }; | 1119 }; |
| 1108 | 1120 |
| 1109 | 1121 |
| 1110 class RawExceptionHandlers : public RawObject { | 1122 class RawExceptionHandlers : public RawObject { |
| 1111 public: | 1123 public: |
| 1112 // The index into the ExceptionHandlers table corresponds to | 1124 // The index into the ExceptionHandlers table corresponds to |
| 1113 // the try_index of the handler. | 1125 // the try_index of the handler. |
| 1114 struct HandlerInfo { | 1126 struct HandlerInfo { |
| (...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2036 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == | 2048 COMPILE_ASSERT(kExternalTypedDataInt8ArrayCid == |
| 2037 kTypedDataInt8ArrayViewCid + 15); | 2049 kTypedDataInt8ArrayViewCid + 15); |
| 2038 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); | 2050 COMPILE_ASSERT(kByteBufferCid == kExternalTypedDataInt8ArrayCid + 14); |
| 2039 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); | 2051 COMPILE_ASSERT(kNullCid == kByteBufferCid + 1); |
| 2040 return (kNullCid - kTypedDataInt8ArrayCid); | 2052 return (kNullCid - kTypedDataInt8ArrayCid); |
| 2041 } | 2053 } |
| 2042 | 2054 |
| 2043 } // namespace dart | 2055 } // namespace dart |
| 2044 | 2056 |
| 2045 #endif // VM_RAW_OBJECT_H_ | 2057 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |