mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 02:31:59 +00:00
Bug 1834483 - Part 11: Add JS::SetNativeStackQuota for JS::FrontendContext. r=bthrall
Differential Revision: https://phabricator.services.mozilla.com/D179012
This commit is contained in:
parent
ac6e513814
commit
c053846bd3
@ -33,6 +33,9 @@ JS_PUBLIC_API JS::FrontendContext* NewFrontendContext();
|
||||
// Destroy a front-end context allocated with NewFrontendContext.
|
||||
JS_PUBLIC_API void DestroyFrontendContext(JS::FrontendContext* fc);
|
||||
|
||||
JS_PUBLIC_API void SetNativeStackQuota(JS::FrontendContext* fc,
|
||||
JS::NativeStackSize stackSize);
|
||||
|
||||
/*
|
||||
* Set supported import assertions on a FrontendContext to be used with
|
||||
* CompileModuleScriptToStencil. May only be set once for each FrontendContext.
|
||||
|
@ -27,6 +27,11 @@ JS_PUBLIC_API void JS::DestroyFrontendContext(FrontendContext* fc) {
|
||||
return js::DestroyFrontendContext(fc);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API void JS::SetNativeStackQuota(JS::FrontendContext* fc,
|
||||
JS::NativeStackSize stackSize) {
|
||||
fc->setStackQuota(stackSize);
|
||||
}
|
||||
|
||||
JS_PUBLIC_API bool JS::SetSupportedImportAssertions(
|
||||
FrontendContext* fc,
|
||||
const JS::ImportAssertionVector& supportedImportAssertions) {
|
||||
|
@ -9,11 +9,13 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "frontend/FrontendContext.h" // js::FrontendContext
|
||||
#include "js/CompileOptions.h"
|
||||
#include "js/experimental/CompileScript.h"
|
||||
#include "js/SourceText.h"
|
||||
#include "js/Stack.h"
|
||||
#include "jsapi-tests/tests.h"
|
||||
#include "util/NativeStack.h" // js::GetNativeStackBase
|
||||
|
||||
using namespace JS;
|
||||
|
||||
@ -21,6 +23,15 @@ BEGIN_FRONTEND_TEST(testFrontendContextCompileGlobalScriptToStencil) {
|
||||
JS::FrontendContext* fc = JS::NewFrontendContext();
|
||||
CHECK(fc);
|
||||
|
||||
static constexpr JS::NativeStackSize stackSize = 128 * sizeof(size_t) * 1024;
|
||||
|
||||
JS::SetNativeStackQuota(fc, stackSize);
|
||||
|
||||
#ifndef __wasi__
|
||||
CHECK(fc->stackLimit() ==
|
||||
JS::GetNativeStackLimit(js::GetNativeStackBase(), stackSize - 1));
|
||||
#endif
|
||||
|
||||
JS::CompileOptions options((JS::CompileOptions::ForFrontendContext()));
|
||||
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user