Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Implement CompletionRecords for the Vm #2618

Closed
wants to merge 23 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Revert to set_frame_pointer
nekevss committed Mar 11, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 2f5cb852acf24f26763005436900d7a6b145539c
7 changes: 2 additions & 5 deletions boa_engine/src/vm/call_frame/mod.rs
Original file line number Diff line number Diff line change
@@ -5,8 +5,6 @@
use crate::{object::JsObject, vm::CodeBlock};
use boa_gc::{Finalize, Gc, Trace};

use core::cmp;

mod abrupt_record;
mod env_stack;

@@ -79,9 +77,8 @@ impl CallFrame {

/// ---- `CallFrame` stack methods ----
impl CallFrame {
pub(crate) fn set_frame_pointer(&mut self, current_stack_len: usize) {
let max = cmp::max(self.arg_count, self.param_count);
self.fp = current_stack_len - max;
pub(crate) fn set_frame_pointer(&mut self, pointer: usize) {
self.fp = pointer;
}

/// Tracks that one environment has been pushed in the current loop block.
4 changes: 2 additions & 2 deletions boa_engine/src/vm/mod.rs
Original file line number Diff line number Diff line change
@@ -325,12 +325,12 @@ impl Context<'_> {
let result = self.vm.pop();
self.vm.stack.truncate(self.vm.frame().fp);
self.vm.frame_mut().early_return = None;
return CompletionRecord::new(execution_completion, result);
return CompletionRecord::new(CompletionType::Normal, result);
}
EarlyReturnType::Yield => {
let result = self.vm.stack.pop().unwrap_or(JsValue::Undefined);
self.vm.frame_mut().early_return = None;
return CompletionRecord::new(execution_completion, result);
return CompletionRecord::new(CompletionType::Return, result);
}
}
}