| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 if (V8Location::wrapperTypeInfo.equals(type)) | 83 if (V8Location::wrapperTypeInfo.equals(type)) |
| 84 return V8Location::toImpl(host)->frame(); | 84 return V8Location::toImpl(host)->frame(); |
| 85 | 85 |
| 86 // This function can handle only those types listed above. | 86 // This function can handle only those types listed above. |
| 87 ASSERT_NOT_REACHED(); | 87 ASSERT_NOT_REACHED(); |
| 88 return 0; | 88 return 0; |
| 89 } | 89 } |
| 90 | 90 |
| 91 static void reportFatalErrorInMainThread(const char* location, const char* messa
ge) | 91 static void reportFatalErrorInMainThread(const char* location, const char* messa
ge) |
| 92 { | 92 { |
| 93 int memoryUsageMB = blink::Platform::current()->actualMemoryUsageMB(); | 93 int memoryUsageMB = Platform::current()->actualMemoryUsageMB(); |
| 94 printf("V8 error: %s (%s). Current memory usage: %d MB\n", message, locatio
n, memoryUsageMB); | 94 printf("V8 error: %s (%s). Current memory usage: %d MB\n", message, locatio
n, memoryUsageMB); |
| 95 CRASH(); | 95 CRASH(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 static PassRefPtrWillBeRawPtr<ScriptCallStack> extractCallStack(v8::Isolate* iso
late, v8::Handle<v8::Message> message, int* const scriptId) | 98 static PassRefPtrWillBeRawPtr<ScriptCallStack> extractCallStack(v8::Isolate* iso
late, v8::Handle<v8::Message> message, int* const scriptId) |
| 99 { | 99 { |
| 100 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); | 100 v8::Handle<v8::StackTrace> stackTrace = message->GetStackTrace(); |
| 101 RefPtrWillBeRawPtr<ScriptCallStack> callStack = nullptr; | 101 RefPtrWillBeRawPtr<ScriptCallStack> callStack = nullptr; |
| 102 *scriptId = message->GetScriptOrigin().ScriptID()->Value(); | 102 *scriptId = message->GetScriptOrigin().ScriptID()->Value(); |
| 103 // Currently stack trace is only collected when inspector is open. | 103 // Currently stack trace is only collected when inspector is open. |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 | 470 |
| 471 v8::V8::AddMessageListener(messageHandlerInWorker); | 471 v8::V8::AddMessageListener(messageHandlerInWorker); |
| 472 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); | 472 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); |
| 473 | 473 |
| 474 uint32_t here; | 474 uint32_t here; |
| 475 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); | 475 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); |
| 476 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 476 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
| 477 } | 477 } |
| 478 | 478 |
| 479 } // namespace blink | 479 } // namespace blink |
| OLD | NEW |