Chromium Code Reviews| 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 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 388 ? selectCompileFunction(cacheOptions, resource, streamer) | 388 ? selectCompileFunction(cacheOptions, resource, streamer) |
| 389 : selectCompileFunction(cacheOptions, cacheHandler, code, cacheabilityIf NoHandler); | 389 : selectCompileFunction(cacheOptions, cacheHandler, code, cacheabilityIf NoHandler); |
| 390 | 390 |
| 391 return (*compileFn)(isolate, code, origin); | 391 return (*compileFn)(isolate, code, origin); |
| 392 } | 392 } |
| 393 | 393 |
| 394 v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledScript(v8::Isolate* isolate , v8::Local<v8::Script> script, ExecutionContext* context) | 394 v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledScript(v8::Isolate* isolate , v8::Local<v8::Script> script, ExecutionContext* context) |
| 395 { | 395 { |
| 396 ASSERT(!script.IsEmpty()); | 396 ASSERT(!script.IsEmpty()); |
| 397 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); | 397 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
| 398 TRACE_EVENT1("v8", "v8.run", "fileName", TRACE_STR_COPY(*v8::String::Utf8Val ue(script->GetUnboundScript()->GetScriptName()))); | 398 bool isCrossOrigin = context->isDocument() && toDocument(context)->frame()-> isCrossOrigin(); |
| 399 TRACE_EVENT2("v8", "v8.run", "fileName", TRACE_STR_COPY(*v8::String::Utf8Val ue(script->GetUnboundScript()->GetScriptName())), "origin", (isCrossOrigin ? "cr oss-origin" : "same-origin")); | |
| 399 | 400 |
| 400 if (v8::MicrotasksScope::GetCurrentDepth(isolate) >= kMaxRecursionDepth) | 401 if (v8::MicrotasksScope::GetCurrentDepth(isolate) >= kMaxRecursionDepth) |
| 401 return throwStackOverflowExceptionIfNeeded(isolate); | 402 return throwStackOverflowExceptionIfNeeded(isolate); |
| 402 | 403 |
| 403 RELEASE_ASSERT(!context->isIteratingOverObservers()); | 404 RELEASE_ASSERT(!context->isIteratingOverObservers()); |
| 404 | 405 |
| 405 // Run the script and keep track of the current recursion depth. | 406 // Run the script and keep track of the current recursion depth. |
| 406 v8::MaybeLocal<v8::Value> result; | 407 v8::MaybeLocal<v8::Value> result; |
| 407 { | 408 { |
| 408 if (ScriptForbiddenScope::isScriptForbidden()) { | 409 if (ScriptForbiddenScope::isScriptForbidden()) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 ThreadDebugger::didExecuteScript(isolate); | 480 ThreadDebugger::didExecuteScript(isolate); |
| 480 } | 481 } |
| 481 if (!depth) | 482 if (!depth) |
| 482 TRACE_EVENT_END0("devtools.timeline", "FunctionCall"); | 483 TRACE_EVENT_END0("devtools.timeline", "FunctionCall"); |
| 483 return result; | 484 return result; |
| 484 } | 485 } |
| 485 | 486 |
| 486 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) | 487 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) |
| 487 { | 488 { |
| 488 ScopedFrameBlamer frameBlamer(context->isDocument() ? toDocument(context)->f rame() : nullptr); | 489 ScopedFrameBlamer frameBlamer(context->isDocument() ? toDocument(context)->f rame() : nullptr); |
| 489 TRACE_EVENT0("v8", "v8.callFunction"); | 490 bool isCrossOrigin = context->isDocument() && toDocument(context)->frame()-> isCrossOrigin(); |
|
Sami
2016/06/14 22:36:10
Doesn't frameblamer already give us this? The scop
| |
| 491 TRACE_EVENT1("v8", "v8.callFunction", "origin", (isCrossOrigin ? "cross-orig in" : "same-origin")); | |
| 490 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); | 492 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
| 491 | 493 |
| 492 int depth = v8::MicrotasksScope::GetCurrentDepth(isolate); | 494 int depth = v8::MicrotasksScope::GetCurrentDepth(isolate); |
| 493 if (depth >= kMaxRecursionDepth) | 495 if (depth >= kMaxRecursionDepth) |
| 494 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso late)); | 496 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso late)); |
| 495 | 497 |
| 496 RELEASE_ASSERT(!context->isIteratingOverObservers()); | 498 RELEASE_ASSERT(!context->isIteratingOverObservers()); |
| 497 | 499 |
| 498 if (ScriptForbiddenScope::isScriptForbidden()) { | 500 if (ScriptForbiddenScope::isScriptForbidden()) { |
| 499 throwScriptForbiddenException(isolate); | 501 throwScriptForbiddenException(isolate); |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 575 // Store a timestamp to the cache as hint. | 577 // Store a timestamp to the cache as hint. |
| 576 void V8ScriptRunner::setCacheTimeStamp(CachedMetadataHandler* cacheHandler) | 578 void V8ScriptRunner::setCacheTimeStamp(CachedMetadataHandler* cacheHandler) |
| 577 { | 579 { |
| 578 double now = WTF::currentTime(); | 580 double now = WTF::currentTime(); |
| 579 unsigned tag = cacheTag(CacheTagTimeStamp, cacheHandler); | 581 unsigned tag = cacheTag(CacheTagTimeStamp, cacheHandler); |
| 580 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); | 582 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); |
| 581 cacheHandler->setCachedMetadata(tag, reinterpret_cast<char*>(&now), sizeof(n ow), CachedMetadataHandler::SendToPlatform); | 583 cacheHandler->setCachedMetadata(tag, reinterpret_cast<char*>(&now), sizeof(n ow), CachedMetadataHandler::SendToPlatform); |
| 582 } | 584 } |
| 583 | 585 |
| 584 } // namespace blink | 586 } // namespace blink |
| OLD | NEW |