OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 static inline bool ApiCheck(bool condition, | 134 static inline bool ApiCheck(bool condition, |
135 const char* location, | 135 const char* location, |
136 const char* message) { | 136 const char* message) { |
137 return condition ? true : Utils::ReportApiFailure(location, message); | 137 return condition ? true : Utils::ReportApiFailure(location, message); |
138 } | 138 } |
139 | 139 |
140 | 140 |
141 static bool ReportV8Dead(const char* location) { | 141 static bool ReportV8Dead(const char* location) { |
142 FatalErrorCallback callback = GetFatalErrorHandler(); | 142 FatalErrorCallback callback = GetFatalErrorHandler(); |
143 callback(location, "V8 is no longer useable"); | 143 callback(location, "V8 is no longer usable"); |
144 return true; | 144 return true; |
145 } | 145 } |
146 | 146 |
147 | 147 |
148 static bool ReportEmptyHandle(const char* location) { | 148 static bool ReportEmptyHandle(const char* location) { |
149 FatalErrorCallback callback = GetFatalErrorHandler(); | 149 FatalErrorCallback callback = GetFatalErrorHandler(); |
150 callback(location, "Reading from empty handle"); | 150 callback(location, "Reading from empty handle"); |
151 return true; | 151 return true; |
152 } | 152 } |
153 | 153 |
154 | 154 |
155 /** | 155 /** |
156 * IsDeadCheck checks that the vm is useable. If, for instance, the vm has been | 156 * IsDeadCheck checks that the vm is usable. If, for instance, the vm has been |
157 * out of memory at some point this check will fail. It should be called on | 157 * out of memory at some point this check will fail. It should be called on |
158 * entry to all methods that touch anything in the heap, except destructors | 158 * entry to all methods that touch anything in the heap, except destructors |
159 * which you sometimes can't avoid calling after the vm has crashed. Functions | 159 * which you sometimes can't avoid calling after the vm has crashed. Functions |
160 * that call EnsureInitialized or ON_BAILOUT don't have to also call | 160 * that call EnsureInitialized or ON_BAILOUT don't have to also call |
161 * IsDeadCheck. ON_BAILOUT has the advantage over EnsureInitialized that you | 161 * IsDeadCheck. ON_BAILOUT has the advantage over EnsureInitialized that you |
162 * can arrange to return if the VM is dead. This is needed to ensure that no VM | 162 * can arrange to return if the VM is dead. This is needed to ensure that no VM |
163 * heap allocations are attempted on a dead VM. EnsureInitialized has the | 163 * heap allocations are attempted on a dead VM. EnsureInitialized has the |
164 * advantage over ON_BAILOUT that it actually initializes the VM if this has not | 164 * advantage over ON_BAILOUT that it actually initializes the VM if this has not |
165 * yet been done. | 165 * yet been done. |
166 */ | 166 */ |
(...skipping 2844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3011 reinterpret_cast<HandleScopeImplementer*>(storage); | 3011 reinterpret_cast<HandleScopeImplementer*>(storage); |
3012 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); | 3012 List<void**>* blocks_of_archived_thread = thread_local->Blocks(); |
3013 ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = | 3013 ImplementationUtilities::HandleScopeData* handle_data_of_archived_thread = |
3014 &thread_local->handle_scope_data_; | 3014 &thread_local->handle_scope_data_; |
3015 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); | 3015 Iterate(v, blocks_of_archived_thread, handle_data_of_archived_thread); |
3016 | 3016 |
3017 return storage + ArchiveSpacePerThread(); | 3017 return storage + ArchiveSpacePerThread(); |
3018 } | 3018 } |
3019 | 3019 |
3020 } } // namespace v8::internal | 3020 } } // namespace v8::internal |
OLD | NEW |