mirror of
https://github.com/pjh456/OxideJS.git
synced 2026-10-25 19:21:11 +08:00
perf: new_string_owned 零拷贝路径替代 new_string 二次克隆
This commit is contained in:
@@ -275,7 +275,7 @@ pub fn regexp_to_string<H: VmHost>(vm: &mut H, args: &[u8]) -> NativeResult {
|
||||
vm.lookup_str(val).unwrap_or_default()
|
||||
};
|
||||
let result = format!("/{}/{}", source, flags);
|
||||
NativeResult::Ok(vm.new_string(&result))
|
||||
NativeResult::Ok(vm.new_string_owned(result))
|
||||
}
|
||||
|
||||
// RegExp 对象 hash 槽中属性的固定下标(构造顺序:lastIndex/source/flags/global/...)。
|
||||
|
||||
Reference in New Issue
Block a user