| 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 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledInternalScript(v8::Isolate*
isolate, v8::Local<v8::Script> script) | 461 v8::MaybeLocal<v8::Value> V8ScriptRunner::runCompiledInternalScript(v8::Isolate*
isolate, v8::Local<v8::Script> script) |
| 462 { | 462 { |
| 463 TRACE_EVENT0("v8", "v8.run"); | 463 TRACE_EVENT0("v8", "v8.run"); |
| 464 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); | 464 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
| 465 V8RecursionScope::MicrotaskSuppression recursionScope(isolate); | 465 V8RecursionScope::MicrotaskSuppression recursionScope(isolate); |
| 466 v8::MaybeLocal<v8::Value> result = script->Run(isolate->GetCurrentContext())
; | 466 v8::MaybeLocal<v8::Value> result = script->Run(isolate->GetCurrentContext())
; |
| 467 crashIfV8IsDead(); | 467 crashIfV8IsDead(); |
| 468 return result; | 468 return result; |
| 469 } | 469 } |
| 470 | 470 |
| 471 v8::Local<v8::Value> V8ScriptRunner::callFunction(v8::Local<v8::Function> functi
on, ExecutionContext* context, v8::Local<v8::Value> receiver, int argc, v8::Loca
l<v8::Value> args[], v8::Isolate* isolate) | 471 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) |
| 472 { | 472 { |
| 473 TRACE_EVENT0("v8", "v8.callFunction"); | 473 TRACE_EVENT0("v8", "v8.callFunction"); |
| 474 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); | 474 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
| 475 | 475 |
| 476 if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth) | 476 if (V8RecursionScope::recursionLevel(isolate) >= kMaxRecursionDepth) |
| 477 return throwStackOverflowExceptionIfNeeded(isolate); | 477 return v8::MaybeLocal<v8::Value>(throwStackOverflowExceptionIfNeeded(iso
late)); |
| 478 | 478 |
| 479 RELEASE_ASSERT(!context->isIteratingOverObservers()); | 479 RELEASE_ASSERT(!context->isIteratingOverObservers()); |
| 480 | 480 |
| 481 if (ScriptForbiddenScope::isScriptForbidden()) { | 481 if (ScriptForbiddenScope::isScriptForbidden()) { |
| 482 throwScriptForbiddenException(isolate); | 482 throwScriptForbiddenException(isolate); |
| 483 return v8::Local<v8::Value>(); | 483 return v8::MaybeLocal<v8::Value>(); |
| 484 } | 484 } |
| 485 V8RecursionScope recursionScope(isolate); | 485 V8RecursionScope recursionScope(isolate); |
| 486 v8::Local<v8::Value> result = function->Call(receiver, argc, args); | 486 v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext
(), receiver, argc, args); |
| 487 crashIfV8IsDead(); | 487 crashIfV8IsDead(); |
| 488 return result; | 488 return result; |
| 489 } | 489 } |
| 490 | 490 |
| 491 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) | 491 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) |
| 492 { | 492 { |
| 493 TRACE_EVENT0("v8", "v8.callFunction"); | 493 TRACE_EVENT0("v8", "v8.callFunction"); |
| 494 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); | 494 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
| 495 V8RecursionScope::MicrotaskSuppression recursionScope(isolate); | 495 V8RecursionScope::MicrotaskSuppression recursionScope(isolate); |
| 496 v8::MaybeLocal<v8::Value> result = function->Call(receiver, argc, args); | 496 v8::MaybeLocal<v8::Value> result = function->Call(isolate->GetCurrentContext
(), receiver, argc, args); |
| 497 crashIfV8IsDead(); | 497 crashIfV8IsDead(); |
| 498 return result; | 498 return result; |
| 499 } | 499 } |
| 500 | 500 |
| 501 v8::MaybeLocal<v8::Object> V8ScriptRunner::instantiateObject(v8::Isolate* isolat
e, v8::Local<v8::ObjectTemplate> objectTemplate) | 501 v8::MaybeLocal<v8::Object> V8ScriptRunner::instantiateObject(v8::Isolate* isolat
e, v8::Local<v8::ObjectTemplate> objectTemplate) |
| 502 { | 502 { |
| 503 TRACE_EVENT0("v8", "v8.newInstance"); | 503 TRACE_EVENT0("v8", "v8.newInstance"); |
| 504 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); | 504 TRACE_EVENT_SCOPED_SAMPLING_STATE("v8", "V8Execution"); |
| 505 | 505 |
| 506 V8RecursionScope::MicrotaskSuppression scope(isolate); | 506 V8RecursionScope::MicrotaskSuppression scope(isolate); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 { | 538 { |
| 539 return cacheTag(CacheTagParser, cacheHandler); | 539 return cacheTag(CacheTagParser, cacheHandler); |
| 540 } | 540 } |
| 541 | 541 |
| 542 unsigned V8ScriptRunner::tagForCodeCache(CachedMetadataHandler* cacheHandler) | 542 unsigned V8ScriptRunner::tagForCodeCache(CachedMetadataHandler* cacheHandler) |
| 543 { | 543 { |
| 544 return cacheTag(CacheTagCode, cacheHandler); | 544 return cacheTag(CacheTagCode, cacheHandler); |
| 545 } | 545 } |
| 546 | 546 |
| 547 } // namespace blink | 547 } // namespace blink |
| OLD | NEW |