| 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_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
| 6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
| 10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
| (...skipping 4161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4172 sizeof(RawContextScope) + (len * kBytesPerElement)); | 4172 sizeof(RawContextScope) + (len * kBytesPerElement)); |
| 4173 } | 4173 } |
| 4174 | 4174 |
| 4175 static RawContextScope* New(intptr_t num_variables); | 4175 static RawContextScope* New(intptr_t num_variables); |
| 4176 | 4176 |
| 4177 private: | 4177 private: |
| 4178 void set_num_variables(intptr_t num_variables) const { | 4178 void set_num_variables(intptr_t num_variables) const { |
| 4179 StoreNonPointer(&raw_ptr()->num_variables_, num_variables); | 4179 StoreNonPointer(&raw_ptr()->num_variables_, num_variables); |
| 4180 } | 4180 } |
| 4181 | 4181 |
| 4182 RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const { | 4182 const RawContextScope::VariableDesc* VariableDescAddr(intptr_t index) const { |
| 4183 ASSERT((index >= 0) && (index < num_variables())); | 4183 return raw_ptr()->VariableDescAddr(index); |
| 4184 uword raw_addr = reinterpret_cast<uword>(raw_ptr()); | |
| 4185 raw_addr += sizeof(RawContextScope) + | |
| 4186 (index * sizeof(RawContextScope::VariableDesc)); | |
| 4187 return reinterpret_cast<RawContextScope::VariableDesc*>(raw_addr); | |
| 4188 } | 4184 } |
| 4189 | 4185 |
| 4190 FINAL_HEAP_OBJECT_IMPLEMENTATION(ContextScope, Object); | 4186 FINAL_HEAP_OBJECT_IMPLEMENTATION(ContextScope, Object); |
| 4191 friend class Class; | 4187 friend class Class; |
| 4192 }; | 4188 }; |
| 4193 | 4189 |
| 4194 | 4190 |
| 4195 class MegamorphicCache : public Object { | 4191 class MegamorphicCache : public Object { |
| 4196 public: | 4192 public: |
| 4197 static const int kInitialCapacity = 16; | 4193 static const int kInitialCapacity = 16; |
| (...skipping 3353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7551 | 7547 |
| 7552 | 7548 |
| 7553 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7549 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 7554 intptr_t index) { | 7550 intptr_t index) { |
| 7555 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7551 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 7556 } | 7552 } |
| 7557 | 7553 |
| 7558 } // namespace dart | 7554 } // namespace dart |
| 7559 | 7555 |
| 7560 #endif // VM_OBJECT_H_ | 7556 #endif // VM_OBJECT_H_ |
| OLD | NEW |