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

Side by Side Diff: src/heap.h

Issue 198253004: Introduce per-isolate assert scopes and API to guard JS execution. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: add missing file Created 6 years, 9 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
« include/v8.h ('K') | « src/execution.cc ('k') | src/heap.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after
1484 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT }; 1484 enum HeapState { NOT_IN_GC, SCAVENGE, MARK_COMPACT };
1485 inline HeapState gc_state() { return gc_state_; } 1485 inline HeapState gc_state() { return gc_state_; }
1486 1486
1487 inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; } 1487 inline bool IsInGCPostProcessing() { return gc_post_processing_depth_ > 0; }
1488 1488
1489 #ifdef DEBUG 1489 #ifdef DEBUG
1490 void set_allocation_timeout(int timeout) { 1490 void set_allocation_timeout(int timeout) {
1491 allocation_timeout_ = timeout; 1491 allocation_timeout_ = timeout;
1492 } 1492 }
1493 1493
1494 bool disallow_allocation_failure() {
1495 return disallow_allocation_failure_;
1496 }
1497
1498 void TracePathToObjectFrom(Object* target, Object* root); 1494 void TracePathToObjectFrom(Object* target, Object* root);
1499 void TracePathToObject(Object* target); 1495 void TracePathToObject(Object* target);
1500 void TracePathToGlobal(); 1496 void TracePathToGlobal();
1501 #endif 1497 #endif
1502 1498
1503 // Callback function passed to Heap::Iterate etc. Copies an object if 1499 // Callback function passed to Heap::Iterate etc. Copies an object if
1504 // necessary, the object might be promoted to an old space. The caller must 1500 // necessary, the object might be promoted to an old space. The caller must
1505 // ensure the precondition that the object is (a) a heap object and (b) in 1501 // ensure the precondition that the object is (a) a heap object and (b) in
1506 // the heap's from space. 1502 // the heap's from space.
1507 static inline void ScavengePointer(HeapObject** p); 1503 static inline void ScavengePointer(HeapObject** p);
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1997 roots_[k##camel_name##RootIndex] = value; \ 1993 roots_[k##camel_name##RootIndex] = value; \
1998 } 1994 }
1999 ROOT_LIST(ROOT_ACCESSOR) 1995 ROOT_LIST(ROOT_ACCESSOR)
2000 #undef ROOT_ACCESSOR 1996 #undef ROOT_ACCESSOR
2001 1997
2002 #ifdef DEBUG 1998 #ifdef DEBUG
2003 // If the --gc-interval flag is set to a positive value, this 1999 // If the --gc-interval flag is set to a positive value, this
2004 // variable holds the value indicating the number of allocations 2000 // variable holds the value indicating the number of allocations
2005 // remain until the next failure and garbage collection. 2001 // remain until the next failure and garbage collection.
2006 int allocation_timeout_; 2002 int allocation_timeout_;
2007
2008 // Do we expect to be able to handle allocation failure at this
2009 // time?
2010 bool disallow_allocation_failure_;
2011 #endif // DEBUG 2003 #endif // DEBUG
2012 2004
2013 // Indicates that the new space should be kept small due to high promotion 2005 // Indicates that the new space should be kept small due to high promotion
2014 // rates caused by the mutator allocating a lot of long-lived objects. 2006 // rates caused by the mutator allocating a lot of long-lived objects.
2015 // TODO(hpayer): change to bool if no longer accessed from generated code 2007 // TODO(hpayer): change to bool if no longer accessed from generated code
2016 intptr_t new_space_high_promotion_mode_active_; 2008 intptr_t new_space_high_promotion_mode_active_;
2017 2009
2018 // Limit that triggers a global GC on the next (normally caused) GC. This 2010 // Limit that triggers a global GC on the next (normally caused) GC. This
2019 // is checked when we have already decided to do a GC to help determine 2011 // is checked when we have already decided to do a GC to help determine
2020 // which collector to invoke, before expanding a paged space in the old 2012 // which collector to invoke, before expanding a paged space in the old
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2509 // configured through the API until it is set up. 2501 // configured through the API until it is set up.
2510 bool configured_; 2502 bool configured_;
2511 2503
2512 ExternalStringTable external_string_table_; 2504 ExternalStringTable external_string_table_;
2513 2505
2514 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_; 2506 VisitorDispatchTable<ScavengingCallback> scavenging_visitors_table_;
2515 2507
2516 MemoryChunk* chunks_queued_for_free_; 2508 MemoryChunk* chunks_queued_for_free_;
2517 2509
2518 Mutex* relocation_mutex_; 2510 Mutex* relocation_mutex_;
2519 #ifdef DEBUG
2520 bool relocation_mutex_locked_by_optimizer_thread_;
2521 #endif // DEBUG;
2522 2511
2523 friend class Factory; 2512 friend class Factory;
2524 friend class GCTracer; 2513 friend class GCTracer;
2525 friend class DisallowAllocationFailure;
2526 friend class AlwaysAllocateScope; 2514 friend class AlwaysAllocateScope;
2527 friend class Page; 2515 friend class Page;
2528 friend class Isolate; 2516 friend class Isolate;
2529 friend class MarkCompactCollector; 2517 friend class MarkCompactCollector;
2530 friend class MarkCompactMarkingVisitor; 2518 friend class MarkCompactMarkingVisitor;
2531 friend class MapCompact; 2519 friend class MapCompact;
2532 #ifdef VERIFY_HEAP 2520 #ifdef VERIFY_HEAP
2533 friend class NoWeakObjectVerificationScope; 2521 friend class NoWeakObjectVerificationScope;
2534 #endif 2522 #endif
2535 2523
(...skipping 29 matching lines...) Expand all
2565 intptr_t* memory_allocator_capacity; // 20 2553 intptr_t* memory_allocator_capacity; // 20
2566 int* objects_per_type; // 21 2554 int* objects_per_type; // 21
2567 int* size_per_type; // 22 2555 int* size_per_type; // 22
2568 int* os_error; // 23 2556 int* os_error; // 23
2569 int* end_marker; // 24 2557 int* end_marker; // 24
2570 intptr_t* property_cell_space_size; // 25 2558 intptr_t* property_cell_space_size; // 25
2571 intptr_t* property_cell_space_capacity; // 26 2559 intptr_t* property_cell_space_capacity; // 26
2572 }; 2560 };
2573 2561
2574 2562
2575 class DisallowAllocationFailure {
2576 public:
2577 inline DisallowAllocationFailure();
2578 inline ~DisallowAllocationFailure();
2579
2580 #ifdef DEBUG
2581 private:
2582 bool old_state_;
2583 #endif
2584 };
2585
2586
2587 class AlwaysAllocateScope { 2563 class AlwaysAllocateScope {
2588 public: 2564 public:
2589 inline AlwaysAllocateScope(); 2565 explicit inline AlwaysAllocateScope(Isolate* isolate);
2590 inline ~AlwaysAllocateScope(); 2566 inline ~AlwaysAllocateScope();
2591 2567
2592 private: 2568 private:
2593 // Implicitly disable artificial allocation failures. 2569 // Implicitly disable artificial allocation failures.
2594 DisallowAllocationFailure disallow_allocation_failure_; 2570 Heap* heap_;
2571 DisallowAllocationFailure daf_;
2595 }; 2572 };
2596 2573
2597 2574
2598 #ifdef VERIFY_HEAP 2575 #ifdef VERIFY_HEAP
2599 class NoWeakObjectVerificationScope { 2576 class NoWeakObjectVerificationScope {
2600 public: 2577 public:
2601 inline NoWeakObjectVerificationScope(); 2578 inline NoWeakObjectVerificationScope();
2602 inline ~NoWeakObjectVerificationScope(); 2579 inline ~NoWeakObjectVerificationScope();
2603 }; 2580 };
2604 #endif 2581 #endif
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
3124 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. 3101 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
3125 3102
3126 private: 3103 private:
3127 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); 3104 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
3128 }; 3105 };
3129 #endif // DEBUG 3106 #endif // DEBUG
3130 3107
3131 } } // namespace v8::internal 3108 } } // namespace v8::internal
3132 3109
3133 #endif // V8_HEAP_H_ 3110 #endif // V8_HEAP_H_
OLDNEW
« include/v8.h ('K') | « src/execution.cc ('k') | src/heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698