OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (exception_behavior == NULL) { | 118 if (exception_behavior == NULL) { |
119 exception_behavior = DefaultFatalErrorHandler; | 119 exception_behavior = DefaultFatalErrorHandler; |
120 } | 120 } |
121 return exception_behavior; | 121 return exception_behavior; |
122 } | 122 } |
123 | 123 |
124 | 124 |
125 | 125 |
126 // When V8 cannot allocated memory FatalProcessOutOfMemory is called. | 126 // When V8 cannot allocated memory FatalProcessOutOfMemory is called. |
127 // The default fatal error handler is called and execution is stopped. | 127 // The default fatal error handler is called and execution is stopped. |
128 void i::V8::FatalProcessOutOfMemory(const char* location) { | 128 static void ExecuteFatalProcessOutOfMemory(const char* location, |
| 129 i::HeapStats* heap_stats) { |
129 i::V8::SetFatalError(); | 130 i::V8::SetFatalError(); |
130 FatalErrorCallback callback = GetFatalErrorHandler(); | 131 FatalErrorCallback callback = GetFatalErrorHandler(); |
131 { | 132 { |
132 LEAVE_V8; | 133 LEAVE_V8; |
133 callback(location, "Allocation failed - process out of memory"); | 134 callback(location, "Allocation failed - process out of memory"); |
134 } | 135 } |
135 // If the callback returns, we stop execution. | 136 // If the callback returns, we stop execution. |
136 UNREACHABLE(); | 137 UNREACHABLE(); |
137 } | 138 } |
138 | 139 |
139 | 140 |
| 141 void i::V8::FatalProcessOutOfMemory(const char* location) { |
| 142 i::HeapStats heap_stats; |
| 143 i::Heap::RecordStats(&heap_stats); |
| 144 ExecuteFatalProcessOutOfMemory(location, &heap_stats); |
| 145 } |
| 146 |
| 147 |
140 void V8::SetFatalErrorHandler(FatalErrorCallback that) { | 148 void V8::SetFatalErrorHandler(FatalErrorCallback that) { |
141 exception_behavior = that; | 149 exception_behavior = that; |
142 } | 150 } |
143 | 151 |
144 | 152 |
145 bool Utils::ReportApiFailure(const char* location, const char* message) { | 153 bool Utils::ReportApiFailure(const char* location, const char* message) { |
146 FatalErrorCallback callback = GetFatalErrorHandler(); | 154 FatalErrorCallback callback = GetFatalErrorHandler(); |
147 callback(location, message); | 155 callback(location, message); |
148 i::V8::SetFatalError(); | 156 i::V8::SetFatalError(); |
149 return false; | 157 return false; |
(...skipping 3716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3866 | 3874 |
3867 | 3875 |
3868 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { | 3876 char* HandleScopeImplementer::Iterate(ObjectVisitor* v, char* storage) { |
3869 HandleScopeImplementer* thread_local = | 3877 HandleScopeImplementer* thread_local = |
3870 reinterpret_cast<HandleScopeImplementer*>(storage); | 3878 reinterpret_cast<HandleScopeImplementer*>(storage); |
3871 thread_local->IterateThis(v); | 3879 thread_local->IterateThis(v); |
3872 return storage + ArchiveSpacePerThread(); | 3880 return storage + ArchiveSpacePerThread(); |
3873 } | 3881 } |
3874 | 3882 |
3875 } } // namespace v8::internal | 3883 } } // namespace v8::internal |
OLD | NEW |