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 10 matching lines...) Expand all Loading... | |
21 namespace dart { | 21 namespace dart { |
22 | 22 |
23 // Forward declarations. | 23 // Forward declarations. |
24 #define DEFINE_FORWARD_DECLARATION(clazz) \ | 24 #define DEFINE_FORWARD_DECLARATION(clazz) \ |
25 class clazz; | 25 class clazz; |
26 CLASS_LIST(DEFINE_FORWARD_DECLARATION) | 26 CLASS_LIST(DEFINE_FORWARD_DECLARATION) |
27 #undef DEFINE_FORWARD_DECLARATION | 27 #undef DEFINE_FORWARD_DECLARATION |
28 class Api; | 28 class Api; |
29 class Assembler; | 29 class Assembler; |
30 class Code; | 30 class Code; |
31 class DeoptInstr; | |
31 class LocalScope; | 32 class LocalScope; |
32 class Symbols; | 33 class Symbols; |
33 | 34 |
34 #define OBJECT_IMPLEMENTATION(object, super) \ | 35 #define OBJECT_IMPLEMENTATION(object, super) \ |
35 public: /* NOLINT */ \ | 36 public: /* NOLINT */ \ |
36 Raw##object* raw() const { return reinterpret_cast<Raw##object*>(raw_); } \ | 37 Raw##object* raw() const { return reinterpret_cast<Raw##object*>(raw_); } \ |
37 void operator=(Raw##object* value) { \ | 38 void operator=(Raw##object* value) { \ |
38 initializeHandle(this, value); \ | 39 initializeHandle(this, value); \ |
39 } \ | 40 } \ |
40 bool Is##object() const { return true; } \ | 41 bool Is##object() const { return true; } \ |
(...skipping 2271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2312 private: | 2313 private: |
2313 // Describes the layout of deopt info data. The index of a deopt-info entry | 2314 // Describes the layout of deopt info data. The index of a deopt-info entry |
2314 // is implicitly the target slot in which the value is written into. | 2315 // is implicitly the target slot in which the value is written into. |
2315 enum { | 2316 enum { |
2316 kInstruction = 0, | 2317 kInstruction = 0, |
2317 kFromIndex, | 2318 kFromIndex, |
2318 kNumberOfEntries, | 2319 kNumberOfEntries, |
2319 }; | 2320 }; |
2320 | 2321 |
2321 public: | 2322 public: |
2322 intptr_t Length() const; | 2323 // The number of instructions. |
2324 intptr_t GetLength() const; | |
Kevin Millikin (Google)
2012/10/05 14:31:55
Accidental rename. I'll rename it back to Length(
srdjan
2012/10/08 16:37:58
Please upload the most recent version.
| |
2325 | |
2326 // The number of real (non-suffix) instructions needed to execute the | |
2327 // deoptimization translation. | |
2328 intptr_t TranslationLength() const; | |
2323 | 2329 |
2324 static RawDeoptInfo* New(intptr_t num_commands); | 2330 static RawDeoptInfo* New(intptr_t num_commands); |
2325 | 2331 |
2326 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); | 2332 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); |
2327 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 2333 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; |
2328 | 2334 |
2329 static intptr_t InstanceSize() { | 2335 static intptr_t InstanceSize() { |
2330 ASSERT(sizeof(RawDeoptInfo) == OFFSET_OF(RawDeoptInfo, data_)); | 2336 ASSERT(sizeof(RawDeoptInfo) == OFFSET_OF(RawDeoptInfo, data_)); |
2331 return 0; | 2337 return 0; |
2332 } | 2338 } |
2333 | 2339 |
2334 static intptr_t InstanceSize(intptr_t len) { | 2340 static intptr_t InstanceSize(intptr_t len) { |
2335 ASSERT(0 <= len && len <= kMaxElements); | 2341 ASSERT(0 <= len && len <= kMaxElements); |
2336 return RoundedAllocationSize(sizeof(RawDeoptInfo) + | 2342 return RoundedAllocationSize(sizeof(RawDeoptInfo) + |
2337 (len * kBytesPerElement)); | 2343 (len * kBytesPerElement)); |
2338 } | 2344 } |
2339 | 2345 |
2340 // 'index' corresponds to target, to-index. | 2346 // 'index' corresponds to target, to-index. |
2341 void SetAt(intptr_t index, | 2347 void SetAt(intptr_t index, |
2342 intptr_t instr_kind, | 2348 intptr_t instr_kind, |
2343 intptr_t from_index) const; | 2349 intptr_t from_index) const; |
2344 | 2350 |
2345 intptr_t Instruction(intptr_t index) const; | 2351 intptr_t Instruction(intptr_t index) const; |
2346 intptr_t FromIndex(intptr_t index) const; | 2352 intptr_t FromIndex(intptr_t index) const; |
2347 intptr_t ToIndex(intptr_t index) const { | 2353 intptr_t ToIndex(intptr_t index) const { |
2348 return index; | 2354 return index; |
2349 } | 2355 } |
2350 | 2356 |
2357 // Unpack the entire translation into an array of deoptimization | |
2358 // instructions. This copies any shared suffixes into the array. | |
2359 void ToInstructions(const Array& table, | |
2360 GrowableArray<DeoptInstr*>* instructions) const; | |
2361 | |
2351 private: | 2362 private: |
2352 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { | 2363 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { |
2353 ASSERT((index >=0) && (index < Length())); | 2364 ASSERT((index >=0) && (index < GetLength())); |
2354 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; | 2365 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; |
2355 return &raw_ptr()->data_[data_index]; | 2366 return &raw_ptr()->data_[data_index]; |
2356 } | 2367 } |
2357 | 2368 |
2358 void SetLength(intptr_t value) const; | 2369 void SetLength(intptr_t value) const; |
2359 | 2370 |
2360 HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object); | 2371 HEAP_OBJECT_IMPLEMENTATION(DeoptInfo, Object); |
2361 friend class Class; | 2372 friend class Class; |
2362 }; | 2373 }; |
2363 | 2374 |
(...skipping 3362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5726 if (this->CharAt(i) != str.CharAt(begin_index + i)) { | 5737 if (this->CharAt(i) != str.CharAt(begin_index + i)) { |
5727 return false; | 5738 return false; |
5728 } | 5739 } |
5729 } | 5740 } |
5730 return true; | 5741 return true; |
5731 } | 5742 } |
5732 | 5743 |
5733 } // namespace dart | 5744 } // namespace dart |
5734 | 5745 |
5735 #endif // VM_OBJECT_H_ | 5746 #endif // VM_OBJECT_H_ |
OLD | NEW |