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 2373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2384 bool GetBit(intptr_t bit_index) const; | 2384 bool GetBit(intptr_t bit_index) const; |
| 2385 void SetBit(intptr_t bit_index, bool value) const; | 2385 void SetBit(intptr_t bit_index, bool value) const; |
| 2386 | 2386 |
| 2387 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); | 2387 HEAP_OBJECT_IMPLEMENTATION(Stackmap, Object); |
| 2388 friend class BitmapBuilder; | 2388 friend class BitmapBuilder; |
| 2389 friend class Class; | 2389 friend class Class; |
| 2390 }; | 2390 }; |
| 2391 | 2391 |
| 2392 | 2392 |
| 2393 class ExceptionHandlers : public Object { | 2393 class ExceptionHandlers : public Object { |
| 2394 private: | |
| 2395 // Describes the layout of exception handler data. | |
| 2396 enum { | |
| 2397 kTryIndexEntry = 0, // Try block index associated with handler. | |
| 2398 kHandlerPcEntry, // PC value of handler. | |
| 2399 kNumberOfEntries | |
| 2400 }; | |
| 2401 | |
| 2402 public: | 2394 public: |
| 2403 intptr_t Length() const; | 2395 intptr_t Length() const; |
| 2404 | 2396 |
| 2397 void GetHandlerInfo(intptr_t index, | |
| 2398 RawExceptionHandlers::HandlerInfo* info) const; | |
| 2399 | |
| 2405 intptr_t TryIndex(intptr_t index) const; | 2400 intptr_t TryIndex(intptr_t index) const; |
| 2406 intptr_t HandlerPC(intptr_t index) const; | 2401 intptr_t HandlerPC(intptr_t index) const; |
| 2407 | 2402 |
| 2408 void SetHandlerEntry(intptr_t index, | 2403 void SetHandlerInfo(intptr_t index, |
| 2409 intptr_t try_index, | 2404 intptr_t try_index, |
| 2410 intptr_t handler_pc) const { | 2405 intptr_t outer_try_index, |
| 2411 SetTryIndex(index, try_index); | 2406 intptr_t handler_pc) const; |
| 2412 SetHandlerPC(index, handler_pc); | |
| 2413 } | |
| 2414 | 2407 |
|
siva
2013/01/15 22:04:12
I think you still need the kMaxElements constant t
hausner
2013/01/15 22:44:52
Done. Picked a large but otherwise arbitrary numbe
| |
| 2415 static const intptr_t kBytesPerElement = (kNumberOfEntries * kWordSize); | 2408 RawArray* GetHandledTypes(intptr_t index) const; |
| 2416 static const intptr_t kMaxElements = kSmiMax / kBytesPerElement; | 2409 void SetHandledTypes(intptr_t index, const Array& handled_types) const; |
| 2417 | 2410 |
| 2418 static intptr_t InstanceSize() { | 2411 static intptr_t InstanceSize() { |
| 2419 ASSERT(sizeof(RawExceptionHandlers) == OFFSET_OF(RawExceptionHandlers, | 2412 ASSERT(sizeof(RawExceptionHandlers) == OFFSET_OF(RawExceptionHandlers, |
| 2420 data_)); | 2413 data_)); |
| 2421 return 0; | 2414 return 0; |
| 2422 } | 2415 } |
| 2423 static intptr_t InstanceSize(intptr_t len) { | 2416 static intptr_t InstanceSize(intptr_t len) { |
| 2424 ASSERT(0 <= len && len <= kMaxElements); | |
| 2425 return RoundedAllocationSize( | 2417 return RoundedAllocationSize( |
| 2426 sizeof(RawExceptionHandlers) + (len * kBytesPerElement)); | 2418 sizeof(RawExceptionHandlers) + |
| 2419 (len * sizeof(RawExceptionHandlers::HandlerInfo))); | |
| 2427 } | 2420 } |
| 2428 | 2421 |
| 2429 static RawExceptionHandlers* New(intptr_t num_handlers); | 2422 static RawExceptionHandlers* New(intptr_t num_handlers); |
| 2430 | 2423 |
| 2431 // We would have a VisitPointers function here to traverse the | 2424 // We would have a VisitPointers function here to traverse the |
| 2432 // exception handler table to visit objects if any in the table. | 2425 // exception handler table to visit objects if any in the table. |
| 2433 | 2426 |
| 2434 private: | 2427 private: |
| 2435 void SetTryIndex(intptr_t index, intptr_t value) const; | 2428 void set_handled_types_data(const Array& value) const; |
| 2436 void SetHandlerPC(intptr_t index, intptr_t value) const; | |
| 2437 | |
| 2438 void SetLength(intptr_t value) const; | |
| 2439 | |
| 2440 intptr_t* EntryAddr(intptr_t index, intptr_t entry_offset) const { | |
| 2441 ASSERT((index >=0) && (index < Length())); | |
| 2442 intptr_t data_index = (index * kNumberOfEntries) + entry_offset; | |
| 2443 return &raw_ptr()->data_[data_index]; | |
| 2444 } | |
| 2445 | |
| 2446 HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object); | 2429 HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object); |
| 2447 friend class Class; | 2430 friend class Class; |
| 2448 }; | 2431 }; |
| 2449 | 2432 |
| 2450 | 2433 |
| 2451 // Holds deopt information at one deoptimization point. The information | 2434 // Holds deopt information at one deoptimization point. The information |
| 2452 // is a list of DeoptInstr objects, specifying transformation information | 2435 // is a list of DeoptInstr objects, specifying transformation information |
| 2453 // for each slot in unoptimized frame(s). | 2436 // for each slot in unoptimized frame(s). |
| 2454 class DeoptInfo : public Object { | 2437 class DeoptInfo : public Object { |
| 2455 private: | 2438 private: |
| (...skipping 3797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6253 | 6236 |
| 6254 | 6237 |
| 6255 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 6238 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
| 6256 intptr_t index) { | 6239 intptr_t index) { |
| 6257 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 6240 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
| 6258 } | 6241 } |
| 6259 | 6242 |
| 6260 } // namespace dart | 6243 } // namespace dart |
| 6261 | 6244 |
| 6262 #endif // VM_OBJECT_H_ | 6245 #endif // VM_OBJECT_H_ |
| OLD | NEW |