OLD | NEW |
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 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 bool* caught_exception) { | 199 bool* caught_exception) { |
200 // Enter a try-block while executing the JavaScript code. To avoid | 200 // Enter a try-block while executing the JavaScript code. To avoid |
201 // duplicate error printing it must be non-verbose. Also, to avoid | 201 // duplicate error printing it must be non-verbose. Also, to avoid |
202 // creating message objects during stack overflow we shouldn't | 202 // creating message objects during stack overflow we shouldn't |
203 // capture messages. | 203 // capture messages. |
204 v8::TryCatch catcher; | 204 v8::TryCatch catcher; |
205 catcher.SetVerbose(false); | 205 catcher.SetVerbose(false); |
206 catcher.SetCaptureMessage(false); | 206 catcher.SetCaptureMessage(false); |
207 *caught_exception = false; | 207 *caught_exception = false; |
208 | 208 |
| 209 // Get isolate now, because handle might be persistent |
| 210 // and get destroyed in the next call. |
| 211 Isolate* isolate = func->GetIsolate(); |
209 Handle<Object> result = Invoke(false, func, receiver, argc, args, | 212 Handle<Object> result = Invoke(false, func, receiver, argc, args, |
210 caught_exception); | 213 caught_exception); |
211 | 214 |
212 Isolate* isolate = func->GetIsolate(); | |
213 if (*caught_exception) { | 215 if (*caught_exception) { |
214 ASSERT(catcher.HasCaught()); | 216 ASSERT(catcher.HasCaught()); |
215 ASSERT(isolate->has_pending_exception()); | 217 ASSERT(isolate->has_pending_exception()); |
216 ASSERT(isolate->external_caught_exception()); | 218 ASSERT(isolate->external_caught_exception()); |
217 if (isolate->is_out_of_memory() && !isolate->ignore_out_of_memory()) { | 219 if (isolate->is_out_of_memory() && !isolate->ignore_out_of_memory()) { |
218 V8::FatalProcessOutOfMemory("OOM during Execution::TryCall"); | 220 V8::FatalProcessOutOfMemory("OOM during Execution::TryCall"); |
219 } | 221 } |
220 if (isolate->pending_exception() == | 222 if (isolate->pending_exception() == |
221 isolate->heap()->termination_exception()) { | 223 isolate->heap()->termination_exception()) { |
222 result = isolate->factory()->termination_exception(); | 224 result = isolate->factory()->termination_exception(); |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 } | 925 } |
924 if (stack_guard->IsFullDeopt()) { | 926 if (stack_guard->IsFullDeopt()) { |
925 stack_guard->Continue(FULL_DEOPT); | 927 stack_guard->Continue(FULL_DEOPT); |
926 Deoptimizer::DeoptimizeAll(isolate); | 928 Deoptimizer::DeoptimizeAll(isolate); |
927 } | 929 } |
928 return isolate->heap()->undefined_value(); | 930 return isolate->heap()->undefined_value(); |
929 } | 931 } |
930 | 932 |
931 | 933 |
932 } } // namespace v8::internal | 934 } } // namespace v8::internal |
OLD | NEW |