| 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 #include "bindings/core/v8/ScriptSourceCode.h" | 29 #include "bindings/core/v8/ScriptSourceCode.h" |
| 30 #include "bindings/core/v8/ScriptStreamer.h" | 30 #include "bindings/core/v8/ScriptStreamer.h" |
| 31 #include "bindings/core/v8/V8Binding.h" | 31 #include "bindings/core/v8/V8Binding.h" |
| 32 #include "bindings/core/v8/V8GCController.h" | 32 #include "bindings/core/v8/V8GCController.h" |
| 33 #include "bindings/core/v8/V8RecursionScope.h" | 33 #include "bindings/core/v8/V8RecursionScope.h" |
| 34 #include "bindings/core/v8/V8ThrowException.h" | 34 #include "bindings/core/v8/V8ThrowException.h" |
| 35 #include "core/dom/ExecutionContext.h" | 35 #include "core/dom/ExecutionContext.h" |
| 36 #include "core/fetch/CachedMetadata.h" | 36 #include "core/fetch/CachedMetadata.h" |
| 37 #include "core/fetch/ScriptResource.h" | 37 #include "core/fetch/ScriptResource.h" |
| 38 #include "core/inspector/InspectorInstrumentation.h" |
| 38 #include "core/inspector/InspectorTraceEvents.h" | 39 #include "core/inspector/InspectorTraceEvents.h" |
| 39 #include "platform/ScriptForbiddenScope.h" | 40 #include "platform/ScriptForbiddenScope.h" |
| 40 #include "platform/TraceEvent.h" | 41 #include "platform/TraceEvent.h" |
| 41 #include "public/platform/Platform.h" | 42 #include "public/platform/Platform.h" |
| 42 #include "wtf/CurrentTime.h" | 43 #include "wtf/CurrentTime.h" |
| 43 | 44 |
| 44 #if defined(WTF_OS_WIN) | 45 #if defined(WTF_OS_WIN) |
| 45 #include <malloc.h> | 46 #include <malloc.h> |
| 46 #else | 47 #else |
| 47 #include <alloca.h> | 48 #include <alloca.h> |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 RELEASE_ASSERT(!context->isIteratingOverObservers()); | 382 RELEASE_ASSERT(!context->isIteratingOverObservers()); |
| 382 | 383 |
| 383 // Run the script and keep track of the current recursion depth. | 384 // Run the script and keep track of the current recursion depth. |
| 384 v8::MaybeLocal<v8::Value> result; | 385 v8::MaybeLocal<v8::Value> result; |
| 385 { | 386 { |
| 386 if (ScriptForbiddenScope::isScriptForbidden()) { | 387 if (ScriptForbiddenScope::isScriptForbidden()) { |
| 387 throwScriptForbiddenException(isolate); | 388 throwScriptForbiddenException(isolate); |
| 388 return v8::MaybeLocal<v8::Value>(); | 389 return v8::MaybeLocal<v8::Value>(); |
| 389 } | 390 } |
| 390 V8RecursionScope recursionScope(isolate); | 391 V8RecursionScope recursionScope(isolate); |
| 392 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willEx
ecuteScript(context, script->GetUnboundScript()->GetId()); |
| 391 result = script->Run(isolate->GetCurrentContext()); | 393 result = script->Run(isolate->GetCurrentContext()); |
| 394 InspectorInstrumentation::didExecuteScript(cookie); |
| 392 } | 395 } |
| 393 | 396 |
| 394 crashIfV8IsDead(); | 397 crashIfV8IsDead(); |
| 395 return result; | 398 return result; |
| 396 } | 399 } |
| 397 | 400 |
| 398 v8::MaybeLocal<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Local<
v8::String> source, v8::Isolate* isolate, const String& fileName, const TextPosi
tion& scriptStartPosition) | 401 v8::MaybeLocal<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Local<
v8::String> source, v8::Isolate* isolate, const String& fileName, const TextPosi
tion& scriptStartPosition) |
| 399 { | 402 { |
| 400 v8::Local<v8::Script> script; | 403 v8::Local<v8::Script> script; |
| 401 if (!V8ScriptRunner::compileScript(source, fileName, String(), scriptStartPo
sition, isolate, nullptr, nullptr, nullptr, SharableCrossOrigin, V8CacheOptionsD
efault, true).ToLocal(&script)) | 404 if (!V8ScriptRunner::compileScript(source, fileName, String(), scriptStartPo
sition, isolate, nullptr, nullptr, nullptr, SharableCrossOrigin, V8CacheOptionsD
efault, true).ToLocal(&script)) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 427 if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth) | 430 if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth) |
| 428 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso
late)); | 431 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso
late)); |
| 429 | 432 |
| 430 RELEASE_ASSERT(!context->isIteratingOverObservers()); | 433 RELEASE_ASSERT(!context->isIteratingOverObservers()); |
| 431 | 434 |
| 432 if (ScriptForbiddenScope::isScriptForbidden()) { | 435 if (ScriptForbiddenScope::isScriptForbidden()) { |
| 433 throwScriptForbiddenException(isolate); | 436 throwScriptForbiddenException(isolate); |
| 434 return v8::MaybeLocal<v8::Value>(); | 437 return v8::MaybeLocal<v8::Value>(); |
| 435 } | 438 } |
| 436 V8RecursionScope recursionScope(isolate); | 439 V8RecursionScope recursionScope(isolate); |
| 440 InspectorInstrumentationCookie cookie = InspectorInstrumentation::willExecut
eScript(context, function->ScriptId()); |
| 437 v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext
(), receiver, argc, args); | 441 v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext
(), receiver, argc, args); |
| 438 crashIfV8IsDead(); | 442 crashIfV8IsDead(); |
| 443 InspectorInstrumentation::didExecuteScript(cookie); |
| 439 return result; | 444 return result; |
| 440 } | 445 } |
| 441 | 446 |
| 442 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) | 447 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) |
| 443 { | 448 { |
| 444 TRACE_EVENT0("v8", "v8.callFunction"); | 449 TRACE_EVENT0("v8", "v8.callFunction"); |
| 445 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); | 450 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
| 446 V8RecursionScope::MicrotaskSuppression recursionScope(isolate); | 451 V8RecursionScope::MicrotaskSuppression recursionScope(isolate); |
| 447 v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext
(), receiver, argc, args); | 452 v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext
(), receiver, argc, args); |
| 448 crashIfV8IsDead(); | 453 crashIfV8IsDead(); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 { | 494 { |
| 490 return cacheTag(CacheTagParser, cacheHandler); | 495 return cacheTag(CacheTagParser, cacheHandler); |
| 491 } | 496 } |
| 492 | 497 |
| 493 unsigned V8ScriptRunner::tagForCodeCache(CachedMetadataHandler* cacheHandler) | 498 unsigned V8ScriptRunner::tagForCodeCache(CachedMetadataHandler* cacheHandler) |
| 494 { | 499 { |
| 495 return cacheTag(CacheTagCode, cacheHandler); | 500 return cacheTag(CacheTagCode, cacheHandler); |
| 496 } | 501 } |
| 497 | 502 |
| 498 } // namespace blink | 503 } // namespace blink |
| OLD | NEW |