feat: 对小整数做额外枚举以优化性能
This commit is contained in:
@@ -113,6 +113,7 @@ impl Vm {
|
||||
.iter()
|
||||
.map(|c| match c {
|
||||
Constant::Number(v) => JsValue::float(*v),
|
||||
Constant::Int(v) => JsValue::int(*v),
|
||||
Constant::String(s) => self.intern(s),
|
||||
Constant::Boolean(b) => JsValue::bool(*b),
|
||||
Constant::Null => JsValue::null(),
|
||||
|
||||
@@ -34,7 +34,7 @@ fn object_create_and_read() {
|
||||
assert!(obj.is_object());
|
||||
let obj_ref = unsafe { &*obj.as_js_object_ptr() };
|
||||
assert_eq!(obj_ref.prop_count(), 1, "object should have 1 property");
|
||||
assert!(obj_ref.get_inline_prop(0).is_double());
|
||||
assert!(obj_ref.get_inline_prop(0).is_int());
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user