The data structure of WebCore: frame contains the data member kjsproxy * m_jscript.CodeAdjusted to jsbridge * m_jscript. For different implementations of javascriptcore and V8, they are:
Class kjsbridge: Public jsbridge {
Public:
Kjsbridge (frame * frame): m_proxy (New kjsproxy (FRAME )){}
Virtual ~ Kjsbridge () {Delete m_proxy ;}
........................
PRIVATE:
Kjsproxy * m_proxy;
};
Class v8bridge: Public jsbridge {
Public:
Explicit v8bridge (frame * frame );
Virtual ~ V8bridge ();
.......................
PRIVATE:
V8proxy * m_proxy;
};
V8bridge: v8bridge (frame * frame ){
M_proxy = new v8proxy (FRAME );
}
V8bridge ::~ V8bridge (){
Delete m_proxy;
}
Different kjsproxy and v8proxy correspond to different JavaScript implementations, which implement the common interfaces with WebCore. Their main data structures are as follows:
Class kjsproxy {
Frame * m_frame;
KJS: protectedptr <KJS: jsdomwindow> m_globalobject;
Int m_handlerlineno;
.........................................
};
Class v8proxy {
Frame * m_frame;
V8: Persistent <V8: context> m_context;
V8: Persistent <V8: Object> m_global;
// Special handling of document wrapper;
V8: Persistent m_document;
Int m_handlerlineno;
...........................
};
Different JavaScript implementation logics are required to understand how different JavaScript implementations implement interfaces with WebCore;
If you are interested in the Implementation logic and basic principles of JavaScript, you can refer to the API and sample provided by JavaScript;
As for the implementation of Dom binding, javascriptcore and V8 are implemented in the same way. For more information, see WebCore of WebKit.
How to integrate the Javascript Implementation described in with WebCore;
From: Introduction to javascriptcore/V8 in WebKit
(Self-supplied ladder)