perf: remove noStrict flag skip + fix bind error types (+2368 pass)

(cherry picked from commit 37f609b4504df3ef54165063623bbb8a5a7eaecb)
This commit is contained in:
爱特每羊队
2026-06-29 02:12:58 +08:00
parent 9d623499d6
commit 73cb31d298
2 changed files with 9 additions and 15 deletions
+3 -4
View File
@@ -82,18 +82,17 @@ pub fn function_apply<H: VmHost>(vm: &mut H, args: &[u8]) -> NativeResult {
pub fn function_bind<H: VmHost>(vm: &mut H, args: &[u8]) -> NativeResult { pub fn function_bind<H: VmHost>(vm: &mut H, args: &[u8]) -> NativeResult {
if args.is_empty() { if args.is_empty() {
return NativeResult::Err(JsValue::undefined()); return NativeResult::Err(crate::error::create_type_error(vm, "Function.prototype.bind called on null or undefined"));
} }
let target_val = vm.reg(args[0]); let target_val = vm.reg(args[0]);
if !target_val.is_object() { if !target_val.is_object() || target_val.as_js_object_ptr().is_null() || !unsafe { &*target_val.as_js_object_ptr() }.is_function() {
return NativeResult::Err(JsValue::undefined()); return NativeResult::Err(crate::error::create_type_error(vm, "Function.prototype.bind called on non-function"));
} }
let bound_this = if args.len() > 1 { vm.reg(args[1]) } else { JsValue::undefined() }; let bound_this = if args.len() > 1 { vm.reg(args[1]) } else { JsValue::undefined() };
let wrapper = vm.alloc_object(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null())); let wrapper = vm.alloc_object(JsObject::new_empty(EMPTY_SHAPE_ID, JsValue::null()));
unsafe { unsafe {
(*wrapper).set_function(true); (*wrapper).set_function(true);
// SAFETY: bind_dispatcher is a NativeFn fn-item; valid to store as NativeFnPtr.
(*wrapper).set_native_fn(Some(NativeFnPtr::from_raw(bind_dispatcher::<H> as *const ()))); (*wrapper).set_native_fn(Some(NativeFnPtr::from_raw(bind_dispatcher::<H> as *const ())));
(*wrapper).set_native_arg_count(0); (*wrapper).set_native_arg_count(0);
(*wrapper).ensure_hash_props().push(target_val); (*wrapper).ensure_hash_props().push(target_val);
+6 -11
View File
@@ -356,10 +356,7 @@ fn is_skipped(meta: &TestMeta) -> Option<String> {
"module" => return Some("module tests excluded".into()), "module" => return Some("module tests excluded".into()),
"async" => return Some("async tests excluded".into()), "async" => return Some("async tests excluded".into()),
"raw" => return Some("raw tests excluded".into()), "raw" => return Some("raw tests excluded".into()),
// Engine is strict-mode only; tests that require non-strict semantics // Let noStrict tests run — many pass despite strict mode; runtime skip catches failures
// (e.g. global var ↔ global object binding, arguments.callee, etc.) are
// architecturally incompatible and must be skipped rather than failed.
"noStrict" => return Some("non-strict-mode tests excluded (engine is strict-only)".into()),
_ => {} _ => {}
} }
} }
@@ -388,8 +385,10 @@ fn is_skipped(meta: &TestMeta) -> Option<String> {
} }
} }
if meta.description.contains("generator") || meta.description.contains("async") { // Only skip if BOTH description AND features indicate generators/async
return Some("description matches excluded pattern".into()); // (many tests with "async" in description test non-async functionality)
if meta.description.contains("generator") && meta.features.iter().any(|f| f.contains("generator")) {
return Some("generator description + feature excluded".into());
} }
None None
@@ -974,11 +973,7 @@ fn process_path(
if !no_skip { if !no_skip {
let path_str = path.to_string_lossy().replace('\\', "/"); let path_str = path.to_string_lossy().replace('\\', "/");
if path_str.contains("built-ins/Promise/") { if path_str.contains("/eval/")
return TestResult::skip(path.to_path_buf(), "Promise tests excluded".into());
}
if path_str.contains("/dstr/")
|| path_str.contains("/eval/")
|| path_str.contains("/function-ctor/") || path_str.contains("/function-ctor/")
|| path_str.contains("/realm/") || path_str.contains("/realm/")
{ {