Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/V8ScriptRunner.cpp

Issue 2331363002: DevTools: Do not include RunMicrotasks event into FunctionCall. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 465
466 // TODO(dominicc): When inspector supports tracing object 466 // TODO(dominicc): When inspector supports tracing object
467 // invocation, change this to use v8::Object instead of 467 // invocation, change this to use v8::Object instead of
468 // v8::Function. All callers use functions because 468 // v8::Function. All callers use functions because
469 // CustomElementRegistry#define's IDL signature is Function. 469 // CustomElementRegistry#define's IDL signature is Function.
470 CHECK(constructor->IsFunction()); 470 CHECK(constructor->IsFunction());
471 v8::Local<v8::Function> function = constructor.As<v8::Function>(); 471 v8::Local<v8::Function> function = constructor.As<v8::Function>();
472 472
473 if (!depth) 473 if (!depth)
474 TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data", Inspecto rFunctionCallEvent::data(context, function)); 474 TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data", Inspecto rFunctionCallEvent::data(context, function));
475 v8::MaybeLocal<v8::Value> result; 475 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrot asks);
476 { 476 ThreadDebugger::willExecuteScript(isolate, function->ScriptId());
477 // Create an extra block so FunctionCall trace event end phase is record ed after 477 v8::MaybeLocal<v8::Value> result = constructor->CallAsConstructor(isolate->G etCurrentContext(), argc, argv);
478 // v8::MicrotasksScope destructor, as the latter is running microtasks. 478 crashIfIsolateIsDead(isolate);
479 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMi crotasks); 479 ThreadDebugger::didExecuteScript(isolate);
480 ThreadDebugger::willExecuteScript(isolate, function->ScriptId());
481 result = constructor->CallAsConstructor(isolate->GetCurrentContext(), ar gc, argv);
482 crashIfIsolateIsDead(isolate);
483 ThreadDebugger::didExecuteScript(isolate);
484 }
485 if (!depth) 480 if (!depth)
486 TRACE_EVENT_END0("devtools.timeline", "FunctionCall"); 481 TRACE_EVENT_END0("devtools.timeline", "FunctionCall");
487 return result; 482 return result;
488 } 483 }
489 484
490 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) 485 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)
491 { 486 {
492 ScopedFrameBlamer frameBlamer(context->isDocument() ? toDocument(context)->f rame() : nullptr); 487 ScopedFrameBlamer frameBlamer(context->isDocument() ? toDocument(context)->f rame() : nullptr);
493 TRACE_EVENT0("v8", "v8.callFunction"); 488 TRACE_EVENT0("v8", "v8.callFunction");
494 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); 489 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
495 490
496 int depth = v8::MicrotasksScope::GetCurrentDepth(isolate); 491 int depth = v8::MicrotasksScope::GetCurrentDepth(isolate);
497 if (depth >= kMaxRecursionDepth) 492 if (depth >= kMaxRecursionDepth)
498 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso late)); 493 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso late));
499 494
500 RELEASE_ASSERT(!context->isIteratingOverObservers()); 495 RELEASE_ASSERT(!context->isIteratingOverObservers());
501 496
502 if (ScriptForbiddenScope::isScriptForbidden()) { 497 if (ScriptForbiddenScope::isScriptForbidden()) {
503 throwScriptForbiddenException(isolate); 498 throwScriptForbiddenException(isolate);
504 return v8::MaybeLocal<v8::Value>(); 499 return v8::MaybeLocal<v8::Value>();
505 } 500 }
506 if (!depth) 501 if (!depth)
507 TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data", Inspecto rFunctionCallEvent::data(context, function)); 502 TRACE_EVENT_BEGIN1("devtools.timeline", "FunctionCall", "data", Inspecto rFunctionCallEvent::data(context, function));
508 503
509 v8::MaybeLocal<v8::Value> result; 504 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMicrot asks);
510 { 505 InspectorInstrumentation::willExecuteScript(context);
511 // Create an extra block so FunctionCall trace event end phase is record ed after 506 ThreadDebugger::willExecuteScript(isolate, function->ScriptId());
512 // v8::MicrotasksScope destructor, as the latter is running microtasks. 507 v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext (), receiver, argc, args);
513 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kRunMi crotasks); 508 crashIfIsolateIsDead(isolate);
514 InspectorInstrumentation::willExecuteScript(context); 509 ThreadDebugger::didExecuteScript(isolate);
515 ThreadDebugger::willExecuteScript(isolate, function->ScriptId()); 510 InspectorInstrumentation::didExecuteScript(context);
516 result = function->Call(isolate->GetCurrentContext(), receiver, argc, ar gs);
517 crashIfIsolateIsDead(isolate);
518 ThreadDebugger::didExecuteScript(isolate);
519 InspectorInstrumentation::didExecuteScript(context);
520 }
521 if (!depth) 511 if (!depth)
522 TRACE_EVENT_END0("devtools.timeline", "FunctionCall"); 512 TRACE_EVENT_END0("devtools.timeline", "FunctionCall");
523 return result; 513 return result;
524 } 514 }
525 515
526 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) 516 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)
527 { 517 {
528 TRACE_EVENT0("v8", "v8.callFunction"); 518 TRACE_EVENT0("v8", "v8.callFunction");
529 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); 519 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution");
530 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks); 520 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 V8CompileHistogram::Cacheability::Noncacheable, isolate, 594 V8CompileHistogram::Cacheability::Noncacheable, isolate,
605 v8AtomicString(isolate, "((e) => { throw e; })"), origin) 595 v8AtomicString(isolate, "((e) => { throw e; })"), origin)
606 .ToLocalChecked(); 596 .ToLocalChecked();
607 v8::Local<v8::Function> thrower = runCompiledInternalScript(isolate, script) 597 v8::Local<v8::Function> thrower = runCompiledInternalScript(isolate, script)
608 .ToLocalChecked().As<v8::Function>(); 598 .ToLocalChecked().As<v8::Function>();
609 v8::Local<v8::Value> args[] = { exception }; 599 v8::Local<v8::Value> args[] = { exception };
610 callInternalFunction(thrower, thrower, WTF_ARRAY_LENGTH(args), args, isolate ); 600 callInternalFunction(thrower, thrower, WTF_ARRAY_LENGTH(args), args, isolate );
611 } 601 }
612 602
613 } // namespace blink 603 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/inspector/tracing/timeline-misc/timeline-receive-response-event-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698