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 12 matching lines...) Expand all Loading... | |
| 23 * THE POSSIBILITY OF SUCH DAMAGE. | 23 * THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #include "bindings/core/v8/V8ScriptRunner.h" | 26 #include "bindings/core/v8/V8ScriptRunner.h" |
| 27 | 27 |
| 28 #include "bindings/core/v8/ScriptSourceCode.h" | 28 #include "bindings/core/v8/ScriptSourceCode.h" |
| 29 #include "bindings/core/v8/ScriptStreamer.h" | 29 #include "bindings/core/v8/ScriptStreamer.h" |
| 30 #include "bindings/core/v8/V8Binding.h" | 30 #include "bindings/core/v8/V8Binding.h" |
| 31 #include "bindings/core/v8/V8GCController.h" | 31 #include "bindings/core/v8/V8GCController.h" |
| 32 #include "bindings/core/v8/V8ThrowException.h" | 32 #include "bindings/core/v8/V8ThrowException.h" |
| 33 #include "core/dom/Document.h" | |
| 33 #include "core/dom/ExecutionContext.h" | 34 #include "core/dom/ExecutionContext.h" |
| 34 #include "core/fetch/CachedMetadata.h" | 35 #include "core/fetch/CachedMetadata.h" |
| 35 #include "core/fetch/ScriptResource.h" | 36 #include "core/fetch/ScriptResource.h" |
| 37 #include "core/frame/LocalFrame.h" | |
| 36 #include "core/inspector/InspectorTraceEvents.h" | 38 #include "core/inspector/InspectorTraceEvents.h" |
| 37 #include "core/inspector/ThreadDebugger.h" | 39 #include "core/inspector/ThreadDebugger.h" |
| 38 #include "platform/Histogram.h" | 40 #include "platform/Histogram.h" |
| 39 #include "platform/ScriptForbiddenScope.h" | 41 #include "platform/ScriptForbiddenScope.h" |
| 40 #include "platform/TraceEvent.h" | 42 #include "platform/TraceEvent.h" |
| 41 #include "public/platform/Platform.h" | 43 #include "public/platform/Platform.h" |
| 42 #include "wtf/CurrentTime.h" | 44 #include "wtf/CurrentTime.h" |
| 43 | 45 |
| 44 #if OS(WIN) | 46 #if OS(WIN) |
| 45 #include <malloc.h> | 47 #include <malloc.h> |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 436 TRACE_EVENT0("v8", "v8.run"); | 438 TRACE_EVENT0("v8", "v8.run"); |
| 437 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); | 439 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
| 438 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks); | 440 v8::MicrotasksScope microtasksScope(isolate, v8::MicrotasksScope::kDoNotRunM icrotasks); |
| 439 v8::MaybeLocal<v8::Value> result = script->Run(isolate->GetCurrentContext()) ; | 441 v8::MaybeLocal<v8::Value> result = script->Run(isolate->GetCurrentContext()) ; |
| 440 crashIfIsolateIsDead(isolate); | 442 crashIfIsolateIsDead(isolate); |
| 441 return result; | 443 return result; |
| 442 } | 444 } |
| 443 | 445 |
| 444 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) | 446 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) |
| 445 { | 447 { |
| 448 ScopedFrameBlamer frameBlamer(context->isDocument() ? toDocument(context)->f rame() : nullptr); | |
|
yhirano
2016/06/01 12:26:05
Do you want to put the frame blamer only in callFu
Xiaocheng
2016/06/02 03:17:19
Nope.
| |
| 446 TRACE_EVENT0("v8", "v8.callFunction"); | 449 TRACE_EVENT0("v8", "v8.callFunction"); |
| 447 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); | 450 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
| 448 | 451 |
| 449 int depth = v8::MicrotasksScope::GetCurrentDepth(isolate); | 452 int depth = v8::MicrotasksScope::GetCurrentDepth(isolate); |
| 450 if (depth >= kMaxRecursionDepth) | 453 if (depth >= kMaxRecursionDepth) |
| 451 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso late)); | 454 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso late)); |
| 452 | 455 |
| 453 RELEASE_ASSERT(!context->isIteratingOverObservers()); | 456 RELEASE_ASSERT(!context->isIteratingOverObservers()); |
| 454 | 457 |
| 455 if (ScriptForbiddenScope::isScriptForbidden()) { | 458 if (ScriptForbiddenScope::isScriptForbidden()) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 532 // Store a timestamp to the cache as hint. | 535 // Store a timestamp to the cache as hint. |
| 533 void V8ScriptRunner::setCacheTimeStamp(CachedMetadataHandler* cacheHandler) | 536 void V8ScriptRunner::setCacheTimeStamp(CachedMetadataHandler* cacheHandler) |
| 534 { | 537 { |
| 535 double now = WTF::currentTime(); | 538 double now = WTF::currentTime(); |
| 536 unsigned tag = cacheTag(CacheTagTimeStamp, cacheHandler); | 539 unsigned tag = cacheTag(CacheTagTimeStamp, cacheHandler); |
| 537 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); | 540 cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); |
| 538 cacheHandler->setCachedMetadata(tag, reinterpret_cast<char*>(&now), sizeof(n ow), CachedMetadataHandler::SendToPlatform); | 541 cacheHandler->setCachedMetadata(tag, reinterpret_cast<char*>(&now), sizeof(n ow), CachedMetadataHandler::SendToPlatform); |
| 539 } | 542 } |
| 540 | 543 |
| 541 } // namespace blink | 544 } // namespace blink |
| OLD | NEW |