| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = 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 PassRefPtr<ScriptCallStack> extractCallStack(v8::Isolate* isolate, v8::Lo
cal<v8::Message> message, int* const scriptId) | 98 static PassRefPtr<ScriptCallStack> extractCallStack(v8::Isolate* isolate, v8::Lo
cal<v8::Message> message, int* const scriptId) |
| 99 { | 99 { |
| 100 v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace(); | 100 v8::Local<v8::StackTrace> stackTrace = message->GetStackTrace(); |
| 101 RefPtr<ScriptCallStack> callStack = nullptr; | 101 RefPtr<ScriptCallStack> callStack = ScriptCallStack::create(isolate, stackTr
ace); |
| 102 *scriptId = message->GetScriptOrigin().ScriptID()->Value(); | 102 *scriptId = message->GetScriptOrigin().ScriptID()->Value(); |
| 103 // Currently stack trace is only collected when inspector is open. | |
| 104 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) { | 103 if (!stackTrace.IsEmpty() && stackTrace->GetFrameCount() > 0) { |
| 105 callStack = ScriptCallStack::create(isolate, stackTrace); | |
| 106 int topScriptId = stackTrace->GetFrame(0)->GetScriptId(); | 104 int topScriptId = stackTrace->GetFrame(0)->GetScriptId(); |
| 107 if (topScriptId == *scriptId) | 105 if (topScriptId == *scriptId) |
| 108 *scriptId = 0; | 106 *scriptId = 0; |
| 109 } | 107 } |
| 110 return callStack.release(); | 108 return callStack.release(); |
| 111 } | 109 } |
| 112 | 110 |
| 113 static String extractResourceName(v8::Local<v8::Message> message, const Executio
nContext* context) | 111 static String extractResourceName(v8::Local<v8::Message> message, const Executio
nContext* context) |
| 114 { | 112 { |
| 115 v8::Local<v8::Value> resourceName = message->GetScriptOrigin().ResourceName(
); | 113 v8::Local<v8::Value> resourceName = message->GetScriptOrigin().ResourceName(
); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 | 470 |
| 473 isolate->AddMessageListener(messageHandlerInWorker); | 471 isolate->AddMessageListener(messageHandlerInWorker); |
| 474 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); | 472 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); |
| 475 | 473 |
| 476 uint32_t here; | 474 uint32_t here; |
| 477 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*))); |
| 478 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 476 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
| 479 } | 477 } |
| 480 | 478 |
| 481 } // namespace blink | 479 } // namespace blink |
| OLD | NEW |