diff --git a/crates/oxide_runtime_api/src/lib.rs b/crates/oxide_runtime_api/src/lib.rs index 2bb3b30..113b421 100644 --- a/crates/oxide_runtime_api/src/lib.rs +++ b/crates/oxide_runtime_api/src/lib.rs @@ -147,7 +147,7 @@ pub fn string_value_eq(a: JsValue, b: JsValue) -> bool { } let sa = unsafe { &*a.as_string_ptr() }; let sb = unsafe { &*b.as_string_ptr() }; - sa.hash == sb.hash && sa.data == sb.data + sa.data == sb.data } pub fn to_number(val: JsValue) -> f64 { diff --git a/crates/oxide_types/src/object.rs b/crates/oxide_types/src/object.rs index ba6d025..0c324d3 100644 --- a/crates/oxide_types/src/object.rs +++ b/crates/oxide_types/src/object.rs @@ -1,27 +1,17 @@ -use std::hash::{Hash, Hasher}; - -use rustc_hash::FxHasher; - use crate::value::JsValue; /// Heap-allocated JS string value. /// /// String *values* are NaN-boxed as 48-bit pointers to a `JsString` (see -/// `JsValue::string`), replacing the old interner `(index, hash16)` pair. `hash` -/// is a full 64-bit FxHash computed once at construction and used as a fast -/// inequality reject before content comparison. +/// `JsValue::string`). #[derive(Debug)] pub struct JsString { pub data: String, - pub hash: u64, } impl JsString { pub fn new(data: String) -> Self { - let mut h = FxHasher::default(); - data.hash(&mut h); - let hash = h.finish(); - Self { data, hash } + Self { data } } pub fn len(&self) -> usize { @@ -484,7 +474,9 @@ impl JsObject { pub fn set_upvalues(&mut self, v: Box>) { if !self.upvalues.is_null() { - unsafe { drop(Box::from_raw(self.upvalues as *mut Vec<*mut Cell>)); } + unsafe { + drop(Box::from_raw(self.upvalues as *mut Vec<*mut Cell>)); + } } self.upvalues = Box::into_raw(v) as *mut u8; }