OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1931 // | 1931 // |
1932 // /* Allocation not allowed: we cannot handle a GC in this scope. */ | 1932 // /* Allocation not allowed: we cannot handle a GC in this scope. */ |
1933 // { AssertNoAllocation nogc; | 1933 // { AssertNoAllocation nogc; |
1934 // ... | 1934 // ... |
1935 // } | 1935 // } |
1936 | 1936 |
1937 #ifdef DEBUG | 1937 #ifdef DEBUG |
1938 | 1938 |
1939 class DisallowAllocationFailure { | 1939 class DisallowAllocationFailure { |
1940 public: | 1940 public: |
1941 DisallowAllocationFailure() { | 1941 explicit DisallowAllocationFailure(Heap* heap) : heap_(heap) { |
Vitaly Repeshko
2011/04/15 00:29:39
Please don't waste time optimizing debug-only faci
| |
1942 old_state_ = HEAP->disallow_allocation_failure_; | 1942 old_state_ = heap_->disallow_allocation_failure_; |
1943 HEAP->disallow_allocation_failure_ = true; | 1943 heap_->disallow_allocation_failure_ = true; |
1944 } | 1944 } |
1945 ~DisallowAllocationFailure() { | 1945 ~DisallowAllocationFailure() { |
1946 HEAP->disallow_allocation_failure_ = old_state_; | 1946 heap_->disallow_allocation_failure_ = old_state_; |
1947 } | 1947 } |
1948 private: | 1948 private: |
1949 bool old_state_; | 1949 bool old_state_; |
1950 Heap* heap_; | |
1950 }; | 1951 }; |
1951 | 1952 |
1952 class AssertNoAllocation { | 1953 class AssertNoAllocation { |
1953 public: | 1954 public: |
1954 AssertNoAllocation() { | 1955 AssertNoAllocation() { |
1955 old_state_ = HEAP->allow_allocation(false); | 1956 old_state_ = HEAP->allow_allocation(false); |
1956 } | 1957 } |
1957 | 1958 |
1958 ~AssertNoAllocation() { | 1959 ~AssertNoAllocation() { |
1959 HEAP->allow_allocation(old_state_); | 1960 HEAP->allow_allocation(old_state_); |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2255 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2256 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2256 }; | 2257 }; |
2257 #endif // DEBUG || LIVE_OBJECT_LIST | 2258 #endif // DEBUG || LIVE_OBJECT_LIST |
2258 | 2259 |
2259 | 2260 |
2260 } } // namespace v8::internal | 2261 } } // namespace v8::internal |
2261 | 2262 |
2262 #undef HEAP | 2263 #undef HEAP |
2263 | 2264 |
2264 #endif // V8_HEAP_H_ | 2265 #endif // V8_HEAP_H_ |
OLD | NEW |