mirror of
https://github.com/servo/servo.git
synced 2025-08-04 21:20:23 +01:00
parent
dd74572dc0
commit
4f649ac6dd
1 changed files with 26 additions and 2 deletions
|
@ -1445,7 +1445,11 @@ class MethodDefiner(PropertyDefiner):
|
||||||
selfHostedName = "0 as *const i8"
|
selfHostedName = "0 as *const i8"
|
||||||
if m.get("methodInfo", True):
|
if m.get("methodInfo", True):
|
||||||
identifier = m.get("nativeName", m["name"])
|
identifier = m.get("nativeName", m["name"])
|
||||||
jitinfo = "&%s_methodinfo" % identifier
|
# Go through an intermediate type here, because it's not
|
||||||
|
# easy to tell whether the methodinfo is a JSJitInfo or
|
||||||
|
# a JSTypedMethodJitInfo here. The compiler knows, though,
|
||||||
|
# so let it do the work.
|
||||||
|
jitinfo = "&%s_methodinfo as *const _ as *const JSJitInfo" % identifier
|
||||||
accessor = "Some(generic_method)"
|
accessor = "Some(generic_method)"
|
||||||
else:
|
else:
|
||||||
jitinfo = "0 as *const JSJitInfo"
|
jitinfo = "0 as *const JSJitInfo"
|
||||||
|
@ -3085,6 +3089,26 @@ class CGMemberJITInfo(CGThing):
|
||||||
slotIndex=slotIndex)
|
slotIndex=slotIndex)
|
||||||
return initializer.rstrip()
|
return initializer.rstrip()
|
||||||
|
|
||||||
|
if args is not None:
|
||||||
|
argTypes = "%s_argTypes" % infoName
|
||||||
|
args = [CGMemberJITInfo.getJSArgType(arg.type) for arg in args]
|
||||||
|
args.append("ArgType::ArgTypeListEnd as i32")
|
||||||
|
argTypesDecl = (
|
||||||
|
"const %s: [i32; %d] = [ %s ];\n" %
|
||||||
|
(argTypes, len(args), ", ".join(args)))
|
||||||
|
return fill(
|
||||||
|
"""
|
||||||
|
$*{argTypesDecl}
|
||||||
|
const ${infoName}: JSTypedMethodJitInfo = JSTypedMethodJitInfo {
|
||||||
|
base: ${jitInfo},
|
||||||
|
argTypes: &${argTypes} as *const _ as *const ArgType,
|
||||||
|
};
|
||||||
|
""",
|
||||||
|
argTypesDecl=argTypesDecl,
|
||||||
|
infoName=infoName,
|
||||||
|
jitInfo=indent(jitInfoInitializer(True)),
|
||||||
|
argTypes=argTypes)
|
||||||
|
|
||||||
return ("\n"
|
return ("\n"
|
||||||
"const %s: JSJitInfo = %s;\n"
|
"const %s: JSJitInfo = %s;\n"
|
||||||
% (infoName, jitInfoInitializer(False)))
|
% (infoName, jitInfoInitializer(False)))
|
||||||
|
@ -5149,7 +5173,7 @@ class CGBindingRoot(CGThing):
|
||||||
'js::jsapi::{RootedValue, JSNativeWrapper, JSNative, JSObject, JSPropertyDescriptor}',
|
'js::jsapi::{RootedValue, JSNativeWrapper, JSNative, JSObject, JSPropertyDescriptor}',
|
||||||
'js::jsapi::{RootedId, JS_InternString, RootedString, INTERNED_STRING_TO_JSID}',
|
'js::jsapi::{RootedId, JS_InternString, RootedString, INTERNED_STRING_TO_JSID}',
|
||||||
'js::jsapi::{JSPropertySpec}',
|
'js::jsapi::{JSPropertySpec}',
|
||||||
'js::jsapi::{JSString, JSTracer, JSJitInfo, OpType, AliasSet}',
|
'js::jsapi::{JSString, JSTracer, JSJitInfo, JSTypedMethodJitInfo, OpType, AliasSet, ArgType}',
|
||||||
'js::jsapi::{MutableHandle, Handle, HandleId, JSType, JSValueType}',
|
'js::jsapi::{MutableHandle, Handle, HandleId, JSType, JSValueType}',
|
||||||
'js::jsapi::{SymbolCode, ObjectOpResult, HandleValueArray}',
|
'js::jsapi::{SymbolCode, ObjectOpResult, HandleValueArray}',
|
||||||
'js::jsapi::{JSJitGetterCallArgs, JSJitSetterCallArgs, JSJitMethodCallArgs, CallArgs}',
|
'js::jsapi::{JSJitGetterCallArgs, JSJitSetterCallArgs, JSJitMethodCallArgs, CallArgs}',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue