| 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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 v8::MaybeLocal<v8::Value> V8ScriptRunner::evaluateModule( | 691 v8::MaybeLocal<v8::Value> V8ScriptRunner::evaluateModule( |
| 692 v8::Local<v8::Module> module, | 692 v8::Local<v8::Module> module, |
| 693 v8::Local<v8::Context> context, | 693 v8::Local<v8::Context> context, |
| 694 v8::Isolate* isolate) { | 694 v8::Isolate* isolate) { |
| 695 TRACE_EVENT0("v8", "v8.evaluateModule"); | 695 TRACE_EVENT0("v8", "v8.evaluateModule"); |
| 696 v8::MicrotasksScope microtasksScope(isolate, | 696 v8::MicrotasksScope microtasksScope(isolate, |
| 697 v8::MicrotasksScope::kRunMicrotasks); | 697 v8::MicrotasksScope::kRunMicrotasks); |
| 698 return module->Evaluate(context); | 698 return module->Evaluate(context); |
| 699 } | 699 } |
| 700 | 700 |
| 701 v8::MaybeLocal<v8::Object> V8ScriptRunner::instantiateObject( | |
| 702 v8::Isolate* isolate, | |
| 703 v8::Local<v8::ObjectTemplate> objectTemplate) { | |
| 704 TRACE_EVENT0("v8", "v8.newInstance"); | |
| 705 | |
| 706 v8::MicrotasksScope microtasksScope(isolate, | |
| 707 v8::MicrotasksScope::kDoNotRunMicrotasks); | |
| 708 v8::MaybeLocal<v8::Object> result = | |
| 709 objectTemplate->NewInstance(isolate->GetCurrentContext()); | |
| 710 crashIfIsolateIsDead(isolate); | |
| 711 return result; | |
| 712 } | |
| 713 | |
| 714 v8::MaybeLocal<v8::Object> V8ScriptRunner::instantiateObject( | |
| 715 v8::Isolate* isolate, | |
| 716 v8::Local<v8::Function> function, | |
| 717 int argc, | |
| 718 v8::Local<v8::Value> argv[]) { | |
| 719 TRACE_EVENT0("v8", "v8.newInstance"); | |
| 720 | |
| 721 v8::MicrotasksScope microtasksScope(isolate, | |
| 722 v8::MicrotasksScope::kDoNotRunMicrotasks); | |
| 723 v8::MaybeLocal<v8::Object> result = | |
| 724 function->NewInstance(isolate->GetCurrentContext(), argc, argv); | |
| 725 crashIfIsolateIsDead(isolate); | |
| 726 return result; | |
| 727 } | |
| 728 | |
| 729 v8::MaybeLocal<v8::Object> V8ScriptRunner::instantiateObjectInDocument( | |
| 730 v8::Isolate* isolate, | |
| 731 v8::Local<v8::Function> function, | |
| 732 ExecutionContext* context, | |
| 733 int argc, | |
| 734 v8::Local<v8::Value> argv[]) { | |
| 735 TRACE_EVENT0("v8", "v8.newInstance"); | |
| 736 if (ScriptForbiddenScope::isScriptForbidden()) { | |
| 737 throwScriptForbiddenException(isolate); | |
| 738 return v8::MaybeLocal<v8::Object>(); | |
| 739 } | |
| 740 v8::MicrotasksScope microtasksScope(isolate, | |
| 741 v8::MicrotasksScope::kRunMicrotasks); | |
| 742 v8::MaybeLocal<v8::Object> result = | |
| 743 function->NewInstance(isolate->GetCurrentContext(), argc, argv); | |
| 744 crashIfIsolateIsDead(isolate); | |
| 745 return result; | |
| 746 } | |
| 747 | |
| 748 uint32_t V8ScriptRunner::tagForParserCache( | 701 uint32_t V8ScriptRunner::tagForParserCache( |
| 749 CachedMetadataHandler* cacheHandler) { | 702 CachedMetadataHandler* cacheHandler) { |
| 750 return cacheTag(CacheTagParser, cacheHandler); | 703 return cacheTag(CacheTagParser, cacheHandler); |
| 751 } | 704 } |
| 752 | 705 |
| 753 uint32_t V8ScriptRunner::tagForCodeCache(CachedMetadataHandler* cacheHandler) { | 706 uint32_t V8ScriptRunner::tagForCodeCache(CachedMetadataHandler* cacheHandler) { |
| 754 return cacheTag(CacheTagCode, cacheHandler); | 707 return cacheTag(CacheTagCode, cacheHandler); |
| 755 } | 708 } |
| 756 | 709 |
| 757 // Store a timestamp to the cache as hint. | 710 // Store a timestamp to the cache as hint. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 783 v8AtomicString(isolate, "((e) => { throw e; })"), origin) | 736 v8AtomicString(isolate, "((e) => { throw e; })"), origin) |
| 784 .ToLocalChecked(); | 737 .ToLocalChecked(); |
| 785 v8::Local<v8::Function> thrower = runCompiledInternalScript(isolate, script) | 738 v8::Local<v8::Function> thrower = runCompiledInternalScript(isolate, script) |
| 786 .ToLocalChecked() | 739 .ToLocalChecked() |
| 787 .As<v8::Function>(); | 740 .As<v8::Function>(); |
| 788 v8::Local<v8::Value> args[] = {exception}; | 741 v8::Local<v8::Value> args[] = {exception}; |
| 789 callInternalFunction(thrower, thrower, WTF_ARRAY_LENGTH(args), args, isolate); | 742 callInternalFunction(thrower, thrower, WTF_ARRAY_LENGTH(args), args, isolate); |
| 790 } | 743 } |
| 791 | 744 |
| 792 } // namespace blink | 745 } // namespace blink |
| OLD | NEW |