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_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 3610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3621 } | 3621 } |
| 3622 | 3622 |
| 3623 // We would have a VisitPointers function here to traverse all the | 3623 // We would have a VisitPointers function here to traverse all the |
| 3624 // embedded objects in the instructions using pointer_offsets. | 3624 // embedded objects in the instructions using pointer_offsets. |
| 3625 | 3625 |
| 3626 static const intptr_t kBytesPerElement = | 3626 static const intptr_t kBytesPerElement = |
| 3627 sizeof(reinterpret_cast<RawCode*>(0)->data_[0]); | 3627 sizeof(reinterpret_cast<RawCode*>(0)->data_[0]); |
| 3628 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 3628 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
| 3629 | 3629 |
| 3630 static intptr_t InstanceSize() { | 3630 static intptr_t InstanceSize() { |
| 3631 ASSERT(sizeof(RawCode) == OFFSET_OF(RawCode, data_)); | |
|
Ivan Posva
2014/06/04 15:53:14
There are too many things riding on the assertion
Florian Schneider
2014/06/06 09:13:03
Yes, this is fragile: InstanceSize(intptr_t len) n
| |
| 3632 return 0; | 3631 return 0; |
| 3633 } | 3632 } |
| 3634 static intptr_t InstanceSize(intptr_t len) { | 3633 static intptr_t InstanceSize(intptr_t len) { |
| 3635 ASSERT(0 <= len && len <= kMaxElements); | 3634 ASSERT(0 <= len && len <= kMaxElements); |
| 3636 return RoundedAllocationSize(sizeof(RawCode) + (len * kBytesPerElement)); | 3635 return RoundedAllocationSize(sizeof(RawCode) + (len * kBytesPerElement)); |
| 3637 } | 3636 } |
| 3638 static RawCode* FinalizeCode(const Function& function, | 3637 static RawCode* FinalizeCode(const Function& function, |
| 3639 Assembler* assembler, | 3638 Assembler* assembler, |
| 3640 bool optimized = false); | 3639 bool optimized = false); |
| 3641 static RawCode* FinalizeCode(const char* name, | 3640 static RawCode* FinalizeCode(const char* name, |
| (...skipping 3464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7106 | 7105 |
| 7107 | 7106 |
| 7108 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7107 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 7109 intptr_t index) { | 7108 intptr_t index) { |
| 7110 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7109 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 7111 } | 7110 } |
| 7112 | 7111 |
| 7113 } // namespace dart | 7112 } // namespace dart |
| 7114 | 7113 |
| 7115 #endif // VM_OBJECT_H_ | 7114 #endif // VM_OBJECT_H_ |
| OLD | NEW |