Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: runtime/vm/object.h

Issue 11883023: Collect debugging info for catch clauses (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 // Pick somewhat arbitrary maximum number of exception handlers
2436 void SetHandlerPC(intptr_t index, intptr_t value) const; 2429 // for a function. This value is used to catch potentially
2430 // malicious code.
2431 static const intptr_t kMaxHandlers = 1024 * 1024;
2437 2432
2438 void SetLength(intptr_t value) const; 2433 void set_handled_types_data(const Array& 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); 2434 HEAP_OBJECT_IMPLEMENTATION(ExceptionHandlers, Object);
2447 friend class Class; 2435 friend class Class;
2448 }; 2436 };
2449 2437
2450 2438
2451 // Holds deopt information at one deoptimization point. The information 2439 // Holds deopt information at one deoptimization point. The information
2452 // is a list of DeoptInstr objects, specifying transformation information 2440 // is a list of DeoptInstr objects, specifying transformation information
2453 // for each slot in unoptimized frame(s). 2441 // for each slot in unoptimized frame(s).
2454 class DeoptInfo : public Object { 2442 class DeoptInfo : public Object {
2455 private: 2443 private:
(...skipping 3806 matching lines...) Expand 10 before | Expand all | Expand 10 after
6262 6250
6263 6251
6264 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 6252 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
6265 intptr_t index) { 6253 intptr_t index) {
6266 return array.At((index * kEntryLength) + kTargetFunctionIndex); 6254 return array.At((index * kEntryLength) + kTargetFunctionIndex);
6267 } 6255 }
6268 6256
6269 } // namespace dart 6257 } // namespace dart
6270 6258
6271 #endif // VM_OBJECT_H_ 6259 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698