CacheFlush, ctiTrampoline, ctiVMThrowTrampoline & ctiOpThrowNotCaught

42 篇文章 0 订阅

CacheFlush,ctiTrampoline, ctiVMThrowTrampoline & ctiOpThrowNotCaught


JS--Lexer-->Token--bison-->Node--emitBytecode-->ByteCode--JIT 编译---->NativeCode-->JIT 执行.

JS的执行是分段执行的,但每次都是把当前段的代码全部编译,这是与TraceMonkey不一样的地方。


these are the entry/leave functions which implemented in assembly for all ports. It 
is faster this way. (Previously, the jit generated these functions, but the reviewers convinced us to do this way)


JIT has a fixed stack layout (see JITStubs.h : struct JITStackFrame). The cti trampolines setup and cleanup the necessary stack layout (since the JIT code assumes the stack layout has already been initialized)

cti = context threaded interpreter
jit = just-in-time compiler

Basically cti refers to C++ implementation of opcodes.


ctiTrampoline: wrapper (helper) function to call the JIT code from C++
ctiVMThrowTrampoline: wrapper (helper) function to call the cti_wmThrow  (exception handling function) from the JIT.
ctiOpThrowNotCaught: return to C++ if an exception is unhandled by the JIT code. Kinda side exit.

>       ctiTrampoline
cc++代码执行进入到JIT Generated Code.
ctiTrampoline 功能:设置 stack frame, preserves  registers, etc,
JIT cc++代码
<span lang="ZH-CN" style="" color:#222222;"="">功能:查找需要被恢复执行的异常处理函数
 
To perform certain operations the JIT will call back into C code.   
Usually the C callback can just return in a perfectly normal fashion  
and continue execution once it has completed, however in the case that  
an exception is thrown special handling is required to change the  
control flow.  The return address of the C callback is instead changed  
to point to this, and this piece of code handles looking up the  
exception handler at which execution will be resumed.
 
>         ctiOpThrowNotCaught
异常未处理后需要的后续动作,中止JIT 执行。



This is used to from within cti_op_throw, which implements the 'throw'  
keyword in JavaScript.  The cti_op_throw method will attempt to look  
up a handler routine that catches the exception.  However if the  
exception is not caught it is necessary to force an early termination  
of JIT execution.  The cti_op_throw C callback always modifies its  
return address, either to point to the code for the appropriate  
exception handler to catch the exception, or to ctiOpThrowNotCaught if  
no handler is found.

cti_##op:This is referring to the callbacks from JIT code defined in JITStubs.cpp.
These methods have their signatures defined by the DEFINE_STUB_FUNCTION macros, which prefix cti_ to the function names.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值