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