File tree Expand file tree Collapse file tree 3 files changed +4
-26
lines changed Expand file tree Collapse file tree 3 files changed +4
-26
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ pub struct ContextState {
67
67
// We don't explicitly re-read this prop but need the slice to live alongside
68
68
// the context
69
69
pub ( crate ) op_ctxs : Box < [ OpCtx ] > ,
70
- pub ( crate ) isolate : Option < * mut v8:: OwnedIsolate > ,
70
+ pub ( crate ) isolate : Option < * mut v8:: Isolate > ,
71
71
pub ( crate ) exception_state : Rc < ExceptionState > ,
72
72
pub ( crate ) has_next_tick_scheduled : Cell < bool > ,
73
73
pub ( crate ) get_error_class_fn : GetErrorClassFn ,
@@ -77,7 +77,7 @@ pub struct ContextState {
77
77
impl ContextState {
78
78
pub ( crate ) fn new (
79
79
op_driver : Rc < OpDriverImpl > ,
80
- isolate_ptr : * mut v8:: OwnedIsolate ,
80
+ isolate_ptr : * mut v8:: Isolate ,
81
81
get_error_class_fn : GetErrorClassFn ,
82
82
op_ctxs : Box < [ OpCtx ] > ,
83
83
external_ops_tracker : ExternalOpsTracker ,
Original file line number Diff line number Diff line change @@ -934,20 +934,12 @@ impl JsRuntime {
934
934
) ;
935
935
}
936
936
937
+ let isolate_ptr = isolate. as_mut ( ) as * mut Isolate ;
937
938
// ...isolate is fully set up, we can forward its pointer to the ops to finish
938
939
// their' setup...
939
940
for op_ctx in op_ctxs. iter_mut ( ) {
940
- op_ctx. isolate = isolate . as_mut ( ) as * mut Isolate ;
941
+ op_ctx. isolate = isolate_ptr ;
941
942
}
942
-
943
- // TODO(Bartlomieju): this can be simplified
944
- let isolate_ptr = setup:: create_isolate_ptr ( ) ;
945
- // SAFETY: this is first use of `isolate_ptr` so we are sure we're
946
- // not overwriting an existing pointer.
947
- isolate = unsafe {
948
- isolate_ptr. write ( isolate) ;
949
- isolate_ptr. read ( )
950
- } ;
951
943
op_state. borrow_mut ( ) . put ( isolate_ptr) ;
952
944
953
945
let mut fast_fn_infos = Vec :: with_capacity ( op_ctxs. len ( ) ) ;
Original file line number Diff line number Diff line change @@ -118,20 +118,6 @@ fn create_cpp_heap() -> v8::UniqueRef<v8::cppgc::Heap> {
118
118
)
119
119
}
120
120
121
- pub fn create_isolate_ptr ( ) -> * mut v8:: OwnedIsolate {
122
- let align = std:: mem:: align_of :: < usize > ( ) ;
123
- let layout = std:: alloc:: Layout :: from_size_align (
124
- std:: mem:: size_of :: < * mut v8:: OwnedIsolate > ( ) ,
125
- align,
126
- )
127
- . unwrap ( ) ;
128
- assert ! ( layout. size( ) > 0 ) ;
129
- let isolate_ptr: * mut v8:: OwnedIsolate =
130
- // SAFETY: we just asserted that layout has non-0 size.
131
- unsafe { std:: alloc:: alloc ( layout) as * mut _ } ;
132
- isolate_ptr
133
- }
134
-
135
121
pub fn create_isolate (
136
122
will_snapshot : bool ,
137
123
maybe_create_params : Option < v8:: CreateParams > ,
You can’t perform that action at this time.
0 commit comments