|
|
@ -16,19 +16,6 @@ pub(crate) struct CallEval; |
|
|
|
|
|
|
|
|
|
|
|
impl CallEval { |
|
|
|
impl CallEval { |
|
|
|
fn operation(context: &mut Context<'_>, argument_count: usize) -> JsResult<CompletionType> { |
|
|
|
fn operation(context: &mut Context<'_>, argument_count: usize) -> JsResult<CompletionType> { |
|
|
|
if context.vm.runtime_limits.recursion_limit() <= context.vm.frames.len() { |
|
|
|
|
|
|
|
return Err(JsNativeError::runtime_limit() |
|
|
|
|
|
|
|
.with_message(format!( |
|
|
|
|
|
|
|
"Maximum recursion limit {} exceeded", |
|
|
|
|
|
|
|
context.vm.runtime_limits.recursion_limit() |
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
.into()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if context.vm.runtime_limits.stack_size_limit() <= context.vm.stack.len() { |
|
|
|
|
|
|
|
return Err(JsNativeError::runtime_limit() |
|
|
|
|
|
|
|
.with_message("Maximum call stack size exceeded") |
|
|
|
|
|
|
|
.into()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
let mut arguments = Vec::with_capacity(argument_count); |
|
|
|
let mut arguments = Vec::with_capacity(argument_count); |
|
|
|
for _ in 0..argument_count { |
|
|
|
for _ in 0..argument_count { |
|
|
|
arguments.push(context.vm.pop()); |
|
|
|
arguments.push(context.vm.pop()); |
|
|
@ -95,20 +82,6 @@ impl Operation for CallEvalSpread { |
|
|
|
const INSTRUCTION: &'static str = "INST - CallEvalSpread"; |
|
|
|
const INSTRUCTION: &'static str = "INST - CallEvalSpread"; |
|
|
|
|
|
|
|
|
|
|
|
fn execute(context: &mut Context<'_>) -> JsResult<CompletionType> { |
|
|
|
fn execute(context: &mut Context<'_>) -> JsResult<CompletionType> { |
|
|
|
if context.vm.runtime_limits.recursion_limit() <= context.vm.frames.len() { |
|
|
|
|
|
|
|
return Err(JsNativeError::runtime_limit() |
|
|
|
|
|
|
|
.with_message(format!( |
|
|
|
|
|
|
|
"Maximum recursion limit {} exceeded", |
|
|
|
|
|
|
|
context.vm.runtime_limits.recursion_limit() |
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
.into()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if context.vm.runtime_limits.stack_size_limit() <= context.vm.stack.len() { |
|
|
|
|
|
|
|
return Err(JsNativeError::runtime_limit() |
|
|
|
|
|
|
|
.with_message("Maximum call stack size exceeded") |
|
|
|
|
|
|
|
.into()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get the arguments that are stored as an array object on the stack.
|
|
|
|
// Get the arguments that are stored as an array object on the stack.
|
|
|
|
let arguments_array = context.vm.pop(); |
|
|
|
let arguments_array = context.vm.pop(); |
|
|
|
let arguments_array_object = arguments_array |
|
|
|
let arguments_array_object = arguments_array |
|
|
@ -158,19 +131,6 @@ pub(crate) struct Call; |
|
|
|
|
|
|
|
|
|
|
|
impl Call { |
|
|
|
impl Call { |
|
|
|
fn operation(context: &mut Context<'_>, argument_count: usize) -> JsResult<CompletionType> { |
|
|
|
fn operation(context: &mut Context<'_>, argument_count: usize) -> JsResult<CompletionType> { |
|
|
|
if context.vm.runtime_limits.recursion_limit() <= context.vm.frames.len() { |
|
|
|
|
|
|
|
return Err(JsNativeError::runtime_limit() |
|
|
|
|
|
|
|
.with_message(format!( |
|
|
|
|
|
|
|
"Maximum recursion limit {} exceeded", |
|
|
|
|
|
|
|
context.vm.runtime_limits.recursion_limit() |
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
.into()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if context.vm.runtime_limits.stack_size_limit() <= context.vm.stack.len() { |
|
|
|
|
|
|
|
return Err(JsNativeError::runtime_limit() |
|
|
|
|
|
|
|
.with_message("Maximum call stack size exceeded") |
|
|
|
|
|
|
|
.into()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
let mut arguments = Vec::with_capacity(argument_count); |
|
|
|
let mut arguments = Vec::with_capacity(argument_count); |
|
|
|
for _ in 0..argument_count { |
|
|
|
for _ in 0..argument_count { |
|
|
|
arguments.push(context.vm.pop()); |
|
|
|
arguments.push(context.vm.pop()); |
|
|
@ -221,20 +181,6 @@ impl Operation for CallSpread { |
|
|
|
const INSTRUCTION: &'static str = "INST - CallSpread"; |
|
|
|
const INSTRUCTION: &'static str = "INST - CallSpread"; |
|
|
|
|
|
|
|
|
|
|
|
fn execute(context: &mut Context<'_>) -> JsResult<CompletionType> { |
|
|
|
fn execute(context: &mut Context<'_>) -> JsResult<CompletionType> { |
|
|
|
if context.vm.runtime_limits.recursion_limit() <= context.vm.frames.len() { |
|
|
|
|
|
|
|
return Err(JsNativeError::runtime_limit() |
|
|
|
|
|
|
|
.with_message(format!( |
|
|
|
|
|
|
|
"Maximum recursion limit {} exceeded", |
|
|
|
|
|
|
|
context.vm.runtime_limits.recursion_limit() |
|
|
|
|
|
|
|
)) |
|
|
|
|
|
|
|
.into()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if context.vm.runtime_limits.stack_size_limit() <= context.vm.stack.len() { |
|
|
|
|
|
|
|
return Err(JsNativeError::runtime_limit() |
|
|
|
|
|
|
|
.with_message("Maximum call stack size exceeded") |
|
|
|
|
|
|
|
.into()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Get the arguments that are stored as an array object on the stack.
|
|
|
|
// Get the arguments that are stored as an array object on the stack.
|
|
|
|
let arguments_array = context.vm.pop(); |
|
|
|
let arguments_array = context.vm.pop(); |
|
|
|
let arguments_array_object = arguments_array |
|
|
|
let arguments_array_object = arguments_array |
|
|
|