| 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 432 TRACE_EVENT0("v8", "v8.run"); | 432 TRACE_EVENT0("v8", "v8.run"); |
| 433 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); | 433 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
| 434 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM
icrotasks); | 434 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM
icrotasks); |
| 435 v8::MaybeLocal<v8::Value> result = script->Run(isolate->GetCurrentContext())
; | 435 v8::MaybeLocal<v8::Value> result = script->Run(isolate->GetCurrentContext())
; |
| 436 crashIfIsolateIsDead(isolate); | 436 crashIfIsolateIsDead(isolate); |
| 437 return result; | 437 return result; |
| 438 } | 438 } |
| 439 | 439 |
| 440 v8::MaybeLocal<v8::Value> V8ScriptRunner::callFunction(v8::Local<v8::Function> f
unction, ExecutionContext* context, v8::Local<v8::Value> receiver, int argc, v8:
:Local<v8::Value> args[], v8::Isolate* isolate) | 440 v8::MaybeLocal<v8::Value> V8ScriptRunner::callFunction(v8::Local<v8::Function> f
unction, ExecutionContext* context, v8::Local<v8::Value> receiver, int argc, v8:
:Local<v8::Value> args[], v8::Isolate* isolate) |
| 441 { | 441 { |
| 442 TRACE_EVENT1("devtools.timeline,v8", "FunctionCall", "data", InspectorFuncti
onCallEvent::data(context, function)); | 442 TRACE_EVENT0("v8", "v8.callFunction"); |
| 443 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); | 443 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
| 444 | 444 |
| 445 if (v8::MicrotasksScope::GetCurrentDepth(isolate) >= kMaxRecursionDepth) | 445 int depth = v8::MicrotasksScope::GetCurrentDepth(isolate); |
| 446 if (depth >= kMaxRecursionDepth) |
| 446 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso
late)); | 447 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso
late)); |
| 447 | 448 |
| 448 RELEASE_ASSERT(!context->isIteratingOverObservers()); | 449 RELEASE_ASSERT(!context->isIteratingOverObservers()); |
| 449 | 450 |
| 450 if (ScriptForbiddenScope::isScriptForbidden()) { | 451 if (ScriptForbiddenScope::isScriptForbidden()) { |
| 451 throwScriptForbiddenException(isolate); | 452 throwScriptForbiddenException(isolate); |
| 452 return v8::MaybeLocal<v8::Value>(); | 453 return v8::MaybeLocal<v8::Value>(); |
| 453 } | 454 } |
| 455 if (!depth) |
| 456 TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data", Inspecto
rFunctionCallEvent::data(context, function)); |
| 454 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrot
asks); | 457 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrot
asks); |
| 455 ThreadDebugger::willExecuteScript(isolate, function->ScriptId()); | 458 ThreadDebugger::willExecuteScript(isolate, function->ScriptId()); |
| 456 v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext
(), receiver, argc, args); | 459 v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext
(), receiver, argc, args); |
| 457 crashIfIsolateIsDead(isolate); | 460 crashIfIsolateIsDead(isolate); |
| 458 ThreadDebugger::didExecuteScript(isolate); | 461 ThreadDebugger::didExecuteScript(isolate); |
| 462 if (!depth) |
| 463 TRACE_EVENT_END0("devtools.timeline", "FunctionCall"); |
| 459 return result; | 464 return result; |
| 460 } | 465 } |
| 461 | 466 |
| 462 v8::MaybeLocal<v8::Value> V8ScriptRunner::callInternalFunction(v8::Local<v8::Fun
ction> function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> a
rgs[], v8::Isolate* isolate) | 467 v8::MaybeLocal<v8::Value> V8ScriptRunner::callInternalFunction(v8::Local<v8::Fun
ction> function, v8::Local<v8::Value> receiver, int argc, v8::Local<v8::Value> a
rgs[], v8::Isolate* isolate) |
| 463 { | 468 { |
| 464 TRACE_EVENT0("v8", "v8.callFunction"); | 469 TRACE_EVENT0("v8", "v8.callFunction"); |
| 465 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); | 470 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
| 466 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM
icrotasks); | 471 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM
icrotasks); |
| 467 v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext
(), receiver, argc, args); | 472 v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext
(), receiver, argc, args); |
| 468 crashIfIsolateIsDead(isolate); | 473 crashIfIsolateIsDead(isolate); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 // Store a timestamp to the cache as hint. | 523 // Store a timestamp to the cache as hint. |
| 519 void V8ScriptRunner::setCacheTimeStamp(CachedMetadataHandler* cacheHandler) | 524 void V8ScriptRunner::setCacheTimeStamp(CachedMetadataHandler* cacheHandler) |
| 520 { | 525 { |
| 521 double now = WTF::currentTime(); | 526 double now = WTF::currentTime(); |
| 522 unsigned tag = cacheTag(CacheTagTimeStamp, cacheHandler); | 527 unsigned tag = cacheTag(CacheTagTimeStamp, cacheHandler); |
| 523 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); | 528 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); |
| 524 cacheHandler->setCachedMetadata(tag, reinterpret_cast<char*>(&now), sizeof(n
ow), CachedMetadataHandler::SendToPlatform); | 529 cacheHandler->setCachedMetadata(tag, reinterpret_cast<char*>(&now), sizeof(n
ow), CachedMetadataHandler::SendToPlatform); |
| 525 } | 530 } |
| 526 | 531 |
| 527 } // namespace blink | 532 } // namespace blink |
| OLD | NEW |