tizen beta release
[profile/ivi/webkit-efl.git] / DerivedSources / WebCore / JSJavaScriptCallFrame.cpp
1 /*
2     This file is part of the WebKit open source project.
3     This file has been generated by generate-bindings.pl. DO NOT MODIFY!
4
5     This library is free software; you can redistribute it and/or
6     modify it under the terms of the GNU Library General Public
7     License as published by the Free Software Foundation; either
8     version 2 of the License, or (at your option) any later version.
9
10     This library is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13     Library General Public License for more details.
14
15     You should have received a copy of the GNU Library General Public License
16     along with this library; see the file COPYING.LIB.  If not, write to
17     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18     Boston, MA 02110-1301, USA.
19 */
20
21 #include "config.h"
22
23 #if ENABLE(JAVASCRIPT_DEBUGGER)
24
25 #include "JSJavaScriptCallFrame.h"
26
27 #include "JSJavaScriptCallFrame.h"
28 #include "JavaScriptCallFrame.h"
29 #include "KURL.h"
30 #include <runtime/Error.h>
31 #include <runtime/JSString.h>
32 #include <wtf/GetPtr.h>
33
34 using namespace JSC;
35
36 namespace WebCore {
37
38 ASSERT_CLASS_FITS_IN_CELL(JSJavaScriptCallFrame);
39
40 /* Hash table */
41 #if ENABLE(JIT)
42 #define THUNK_GENERATOR(generator) , generator
43 #else
44 #define THUNK_GENERATOR(generator)
45 #endif
46 #if ENABLE(DFG_JIT)
47 #define INTRINSIC(intrinsic) , intrinsic
48 #else
49 #define INTRINSIC(intrinsic)
50 #endif
51
52 static const HashTableValue JSJavaScriptCallFrameTableValues[] =
53 {
54     { "caller", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameCaller), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
55     { "sourceID", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameSourceID), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
56     { "line", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameLine), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
57     { "column", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameColumn), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
58     { "scopeChain", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameScopeChain), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
59     { "thisObject", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameThisObject), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
60     { "functionName", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameFunctionName), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
61     { "type", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameType), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
62     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
63 };
64
65 #undef THUNK_GENERATOR
66 static const HashTable JSJavaScriptCallFrameTable = { 17, 15, JSJavaScriptCallFrameTableValues, 0 };
67 /* Hash table for prototype */
68 #if ENABLE(JIT)
69 #define THUNK_GENERATOR(generator) , generator
70 #else
71 #define THUNK_GENERATOR(generator)
72 #endif
73 #if ENABLE(DFG_JIT)
74 #define INTRINSIC(intrinsic) , intrinsic
75 #else
76 #define INTRINSIC(intrinsic)
77 #endif
78
79 static const HashTableValue JSJavaScriptCallFramePrototypeTableValues[] =
80 {
81     { "GLOBAL_SCOPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameGLOBAL_SCOPE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
82     { "LOCAL_SCOPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameLOCAL_SCOPE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
83     { "WITH_SCOPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameWITH_SCOPE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
84     { "CLOSURE_SCOPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameCLOSURE_SCOPE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
85     { "CATCH_SCOPE", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsJavaScriptCallFrameCATCH_SCOPE), (intptr_t)0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
86     { "evaluate", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsJavaScriptCallFramePrototypeFunctionEvaluate), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
87     { "scopeType", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsJavaScriptCallFramePrototypeFunctionScopeType), (intptr_t)1 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) },
88     { 0, 0, 0, 0 THUNK_GENERATOR(0) INTRINSIC(DFG::NoIntrinsic) }
89 };
90
91 #undef THUNK_GENERATOR
92 static const HashTable JSJavaScriptCallFramePrototypeTable = { 17, 15, JSJavaScriptCallFramePrototypeTableValues, 0 };
93 const ClassInfo JSJavaScriptCallFramePrototype::s_info = { "JavaScriptCallFramePrototype", &JSC::JSNonFinalObject::s_info, &JSJavaScriptCallFramePrototypeTable, 0, CREATE_METHOD_TABLE(JSJavaScriptCallFramePrototype) };
94
95 JSObject* JSJavaScriptCallFramePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
96 {
97     return getDOMPrototype<JSJavaScriptCallFrame>(exec, globalObject);
98 }
99
100 bool JSJavaScriptCallFramePrototype::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
101 {
102     JSJavaScriptCallFramePrototype* thisObject = jsCast<JSJavaScriptCallFramePrototype*>(cell);
103     return getStaticPropertySlot<JSJavaScriptCallFramePrototype, JSObject>(exec, &JSJavaScriptCallFramePrototypeTable, thisObject, propertyName, slot);
104 }
105
106 bool JSJavaScriptCallFramePrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
107 {
108     JSJavaScriptCallFramePrototype* thisObject = jsCast<JSJavaScriptCallFramePrototype*>(object);
109     return getStaticPropertyDescriptor<JSJavaScriptCallFramePrototype, JSObject>(exec, &JSJavaScriptCallFramePrototypeTable, thisObject, propertyName, descriptor);
110 }
111
112 const ClassInfo JSJavaScriptCallFrame::s_info = { "JavaScriptCallFrame", &JSDOMWrapper::s_info, &JSJavaScriptCallFrameTable, 0 , CREATE_METHOD_TABLE(JSJavaScriptCallFrame) };
113
114 JSJavaScriptCallFrame::JSJavaScriptCallFrame(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<JavaScriptCallFrame> impl)
115     : JSDOMWrapper(structure, globalObject)
116     , m_impl(impl.leakRef())
117 {
118 }
119
120 void JSJavaScriptCallFrame::finishCreation(JSGlobalData& globalData)
121 {
122     Base::finishCreation(globalData);
123     ASSERT(inherits(&s_info));
124 }
125
126 JSObject* JSJavaScriptCallFrame::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
127 {
128     return JSJavaScriptCallFramePrototype::create(exec->globalData(), globalObject, JSJavaScriptCallFramePrototype::createStructure(globalObject->globalData(), globalObject, globalObject->objectPrototype()));
129 }
130
131 bool JSJavaScriptCallFrame::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
132 {
133     JSJavaScriptCallFrame* thisObject = jsCast<JSJavaScriptCallFrame*>(cell);
134     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
135     return getStaticValueSlot<JSJavaScriptCallFrame, Base>(exec, &JSJavaScriptCallFrameTable, thisObject, propertyName, slot);
136 }
137
138 bool JSJavaScriptCallFrame::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
139 {
140     JSJavaScriptCallFrame* thisObject = jsCast<JSJavaScriptCallFrame*>(object);
141     ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
142     return getStaticValueDescriptor<JSJavaScriptCallFrame, Base>(exec, &JSJavaScriptCallFrameTable, thisObject, propertyName, descriptor);
143 }
144
145 JSValue jsJavaScriptCallFrameCaller(ExecState* exec, JSValue slotBase, const Identifier&)
146 {
147     JSJavaScriptCallFrame* castedThis = static_cast<JSJavaScriptCallFrame*>(asObject(slotBase));
148     UNUSED_PARAM(exec);
149     JavaScriptCallFrame* imp = static_cast<JavaScriptCallFrame*>(castedThis->impl());
150     JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->caller()));
151     return result;
152 }
153
154
155 JSValue jsJavaScriptCallFrameSourceID(ExecState* exec, JSValue slotBase, const Identifier&)
156 {
157     JSJavaScriptCallFrame* castedThis = static_cast<JSJavaScriptCallFrame*>(asObject(slotBase));
158     UNUSED_PARAM(exec);
159     JavaScriptCallFrame* imp = static_cast<JavaScriptCallFrame*>(castedThis->impl());
160     JSValue result = jsNumber(imp->sourceID());
161     return result;
162 }
163
164
165 JSValue jsJavaScriptCallFrameLine(ExecState* exec, JSValue slotBase, const Identifier&)
166 {
167     JSJavaScriptCallFrame* castedThis = static_cast<JSJavaScriptCallFrame*>(asObject(slotBase));
168     UNUSED_PARAM(exec);
169     JavaScriptCallFrame* imp = static_cast<JavaScriptCallFrame*>(castedThis->impl());
170     JSValue result = jsNumber(imp->line());
171     return result;
172 }
173
174
175 JSValue jsJavaScriptCallFrameColumn(ExecState* exec, JSValue slotBase, const Identifier&)
176 {
177     JSJavaScriptCallFrame* castedThis = static_cast<JSJavaScriptCallFrame*>(asObject(slotBase));
178     UNUSED_PARAM(exec);
179     JavaScriptCallFrame* imp = static_cast<JavaScriptCallFrame*>(castedThis->impl());
180     JSValue result = jsNumber(imp->column());
181     return result;
182 }
183
184
185 JSValue jsJavaScriptCallFrameScopeChain(ExecState* exec, JSValue slotBase, const Identifier&)
186 {
187     JSJavaScriptCallFrame* castedThis = static_cast<JSJavaScriptCallFrame*>(asObject(slotBase));
188     return castedThis->scopeChain(exec);
189 }
190
191
192 JSValue jsJavaScriptCallFrameThisObject(ExecState* exec, JSValue slotBase, const Identifier&)
193 {
194     JSJavaScriptCallFrame* castedThis = static_cast<JSJavaScriptCallFrame*>(asObject(slotBase));
195     return castedThis->thisObject(exec);
196 }
197
198
199 JSValue jsJavaScriptCallFrameFunctionName(ExecState* exec, JSValue slotBase, const Identifier&)
200 {
201     JSJavaScriptCallFrame* castedThis = static_cast<JSJavaScriptCallFrame*>(asObject(slotBase));
202     UNUSED_PARAM(exec);
203     JavaScriptCallFrame* imp = static_cast<JavaScriptCallFrame*>(castedThis->impl());
204     JSValue result = jsString(exec, imp->functionName());
205     return result;
206 }
207
208
209 JSValue jsJavaScriptCallFrameType(ExecState* exec, JSValue slotBase, const Identifier&)
210 {
211     JSJavaScriptCallFrame* castedThis = static_cast<JSJavaScriptCallFrame*>(asObject(slotBase));
212     return castedThis->type(exec);
213 }
214
215
216 EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFramePrototypeFunctionEvaluate(ExecState* exec)
217 {
218     JSValue thisValue = exec->hostThisValue();
219     if (!thisValue.inherits(&JSJavaScriptCallFrame::s_info))
220         return throwVMTypeError(exec);
221     JSJavaScriptCallFrame* castedThis = static_cast<JSJavaScriptCallFrame*>(asObject(thisValue));
222     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSJavaScriptCallFrame::s_info);
223     return JSValue::encode(castedThis->evaluate(exec));
224 }
225
226 EncodedJSValue JSC_HOST_CALL jsJavaScriptCallFramePrototypeFunctionScopeType(ExecState* exec)
227 {
228     JSValue thisValue = exec->hostThisValue();
229     if (!thisValue.inherits(&JSJavaScriptCallFrame::s_info))
230         return throwVMTypeError(exec);
231     JSJavaScriptCallFrame* castedThis = static_cast<JSJavaScriptCallFrame*>(asObject(thisValue));
232     ASSERT_GC_OBJECT_INHERITS(castedThis, &JSJavaScriptCallFrame::s_info);
233     return JSValue::encode(castedThis->scopeType(exec));
234 }
235
236 // Constant getters
237
238 JSValue jsJavaScriptCallFrameGLOBAL_SCOPE(ExecState* exec, JSValue, const Identifier&)
239 {
240     UNUSED_PARAM(exec);
241     return jsNumber(static_cast<int>(0));
242 }
243
244 JSValue jsJavaScriptCallFrameLOCAL_SCOPE(ExecState* exec, JSValue, const Identifier&)
245 {
246     UNUSED_PARAM(exec);
247     return jsNumber(static_cast<int>(1));
248 }
249
250 JSValue jsJavaScriptCallFrameWITH_SCOPE(ExecState* exec, JSValue, const Identifier&)
251 {
252     UNUSED_PARAM(exec);
253     return jsNumber(static_cast<int>(2));
254 }
255
256 JSValue jsJavaScriptCallFrameCLOSURE_SCOPE(ExecState* exec, JSValue, const Identifier&)
257 {
258     UNUSED_PARAM(exec);
259     return jsNumber(static_cast<int>(3));
260 }
261
262 JSValue jsJavaScriptCallFrameCATCH_SCOPE(ExecState* exec, JSValue, const Identifier&)
263 {
264     UNUSED_PARAM(exec);
265     return jsNumber(static_cast<int>(4));
266 }
267
268 static inline bool isObservable(JSJavaScriptCallFrame* jsJavaScriptCallFrame)
269 {
270     if (jsJavaScriptCallFrame->hasCustomProperties())
271         return true;
272     return false;
273 }
274
275 bool JSJavaScriptCallFrameOwner::isReachableFromOpaqueRoots(JSC::Handle<JSC::Unknown> handle, void*, SlotVisitor& visitor)
276 {
277     JSJavaScriptCallFrame* jsJavaScriptCallFrame = static_cast<JSJavaScriptCallFrame*>(handle.get().asCell());
278     if (!isObservable(jsJavaScriptCallFrame))
279         return false;
280     UNUSED_PARAM(visitor);
281     return false;
282 }
283
284 void JSJavaScriptCallFrameOwner::finalize(JSC::Handle<JSC::Unknown> handle, void* context)
285 {
286     JSJavaScriptCallFrame* jsJavaScriptCallFrame = static_cast<JSJavaScriptCallFrame*>(handle.get().asCell());
287     DOMWrapperWorld* world = static_cast<DOMWrapperWorld*>(context);
288     uncacheWrapper(world, jsJavaScriptCallFrame->impl(), jsJavaScriptCallFrame);
289     jsJavaScriptCallFrame->releaseImpl();
290 }
291
292 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, JavaScriptCallFrame* impl)
293 {
294     return wrap<JSJavaScriptCallFrame>(exec, globalObject, impl);
295 }
296
297 JavaScriptCallFrame* toJavaScriptCallFrame(JSC::JSValue value)
298 {
299     return value.inherits(&JSJavaScriptCallFrame::s_info) ? static_cast<JSJavaScriptCallFrame*>(asObject(value))->impl() : 0;
300 }
301
302 }
303
304 #endif // ENABLE(JAVASCRIPT_DEBUGGER)