|
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 #include "JSConsole.h" |
|
23 |
|
24 #include "Console.h" |
|
25 #include "JSMemoryInfo.h" |
|
26 #include "MemoryInfo.h" |
|
27 #include "ScriptCallStack.h" |
|
28 #include <runtime/Error.h> |
|
29 #include <wtf/GetPtr.h> |
|
30 |
|
31 using namespace JSC; |
|
32 |
|
33 namespace WebCore { |
|
34 |
|
35 ASSERT_CLASS_FITS_IN_CELL(JSConsole); |
|
36 |
|
37 /* Hash table */ |
|
38 #if ENABLE(JIT) |
|
39 #define THUNK_GENERATOR(generator) , generator |
|
40 #else |
|
41 #define THUNK_GENERATOR(generator) |
|
42 #endif |
|
43 |
|
44 static const HashTableValue JSConsoleTableValues[3] = |
|
45 { |
|
46 { "profiles", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsConsoleProfiles), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
47 { "memory", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsConsoleMemory), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
48 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
49 }; |
|
50 |
|
51 #undef THUNK_GENERATOR |
|
52 static JSC_CONST_HASHTABLE HashTable JSConsoleTable = { 4, 3, JSConsoleTableValues, 0 }; |
|
53 /* Hash table for prototype */ |
|
54 #if ENABLE(JIT) |
|
55 #define THUNK_GENERATOR(generator) , generator |
|
56 #else |
|
57 #define THUNK_GENERATOR(generator) |
|
58 #endif |
|
59 |
|
60 static const HashTableValue JSConsolePrototypeTableValues[19] = |
|
61 { |
|
62 { "debug", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionDebug), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
63 { "error", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionError), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
64 { "info", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionInfo), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
65 { "log", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionLog), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
66 { "warn", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionWarn), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
67 { "dir", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionDir), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
68 { "dirxml", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionDirxml), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
69 { "trace", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionTrace), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
70 { "assert", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionAssert), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
71 { "count", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionCount), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
72 { "markTimeline", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionMarkTimeline), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
73 { "profile", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionProfile), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
74 { "profileEnd", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionProfileEnd), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
75 { "time", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionTime), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
76 { "timeEnd", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionTimeEnd), (intptr_t)1 THUNK_GENERATOR(0) }, |
|
77 { "group", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionGroup), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
78 { "groupCollapsed", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionGroupCollapsed), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
79 { "groupEnd", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsConsolePrototypeFunctionGroupEnd), (intptr_t)0 THUNK_GENERATOR(0) }, |
|
80 { 0, 0, 0, 0 THUNK_GENERATOR(0) } |
|
81 }; |
|
82 |
|
83 #undef THUNK_GENERATOR |
|
84 static JSC_CONST_HASHTABLE HashTable JSConsolePrototypeTable = { 65, 63, JSConsolePrototypeTableValues, 0 }; |
|
85 const ClassInfo JSConsolePrototype::s_info = { "ConsolePrototype", 0, &JSConsolePrototypeTable, 0 }; |
|
86 |
|
87 JSObject* JSConsolePrototype::self(ExecState* exec, JSGlobalObject* globalObject) |
|
88 { |
|
89 return getDOMPrototype<JSConsole>(exec, globalObject); |
|
90 } |
|
91 |
|
92 bool JSConsolePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
93 { |
|
94 return getStaticFunctionSlot<JSObject>(exec, &JSConsolePrototypeTable, this, propertyName, slot); |
|
95 } |
|
96 |
|
97 bool JSConsolePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
98 { |
|
99 return getStaticFunctionDescriptor<JSObject>(exec, &JSConsolePrototypeTable, this, propertyName, descriptor); |
|
100 } |
|
101 |
|
102 const ClassInfo JSConsole::s_info = { "Console", 0, &JSConsoleTable, 0 }; |
|
103 |
|
104 JSConsole::JSConsole(NonNullPassRefPtr<Structure> structure, JSDOMGlobalObject* globalObject, PassRefPtr<Console> impl) |
|
105 : DOMObjectWithGlobalPointer(structure, globalObject) |
|
106 , m_impl(impl) |
|
107 { |
|
108 } |
|
109 |
|
110 JSConsole::~JSConsole() |
|
111 { |
|
112 forgetDOMObject(this, impl()); |
|
113 } |
|
114 |
|
115 JSObject* JSConsole::createPrototype(ExecState* exec, JSGlobalObject* globalObject) |
|
116 { |
|
117 return new (exec) JSConsolePrototype(globalObject, JSConsolePrototype::createStructure(globalObject->objectPrototype())); |
|
118 } |
|
119 |
|
120 bool JSConsole::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) |
|
121 { |
|
122 return getStaticValueSlot<JSConsole, Base>(exec, &JSConsoleTable, this, propertyName, slot); |
|
123 } |
|
124 |
|
125 bool JSConsole::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) |
|
126 { |
|
127 return getStaticValueDescriptor<JSConsole, Base>(exec, &JSConsoleTable, this, propertyName, descriptor); |
|
128 } |
|
129 |
|
130 JSValue jsConsoleProfiles(ExecState* exec, JSValue slotBase, const Identifier&) |
|
131 { |
|
132 JSConsole* castedThis = static_cast<JSConsole*>(asObject(slotBase)); |
|
133 return castedThis->profiles(exec); |
|
134 } |
|
135 |
|
136 JSValue jsConsoleMemory(ExecState* exec, JSValue slotBase, const Identifier&) |
|
137 { |
|
138 JSConsole* castedThis = static_cast<JSConsole*>(asObject(slotBase)); |
|
139 UNUSED_PARAM(exec); |
|
140 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
141 JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->memory())); |
|
142 return result; |
|
143 } |
|
144 |
|
145 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionDebug(ExecState* exec) |
|
146 { |
|
147 JSValue thisValue = exec->hostThisValue(); |
|
148 if (!thisValue.inherits(&JSConsole::s_info)) |
|
149 return throwVMTypeError(exec); |
|
150 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
151 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
152 ScriptCallStack callStack(exec, 0); |
|
153 |
|
154 imp->debug(&callStack); |
|
155 return JSValue::encode(jsUndefined()); |
|
156 } |
|
157 |
|
158 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionError(ExecState* exec) |
|
159 { |
|
160 JSValue thisValue = exec->hostThisValue(); |
|
161 if (!thisValue.inherits(&JSConsole::s_info)) |
|
162 return throwVMTypeError(exec); |
|
163 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
164 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
165 ScriptCallStack callStack(exec, 0); |
|
166 |
|
167 imp->error(&callStack); |
|
168 return JSValue::encode(jsUndefined()); |
|
169 } |
|
170 |
|
171 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionInfo(ExecState* exec) |
|
172 { |
|
173 JSValue thisValue = exec->hostThisValue(); |
|
174 if (!thisValue.inherits(&JSConsole::s_info)) |
|
175 return throwVMTypeError(exec); |
|
176 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
177 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
178 ScriptCallStack callStack(exec, 0); |
|
179 |
|
180 imp->info(&callStack); |
|
181 return JSValue::encode(jsUndefined()); |
|
182 } |
|
183 |
|
184 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionLog(ExecState* exec) |
|
185 { |
|
186 JSValue thisValue = exec->hostThisValue(); |
|
187 if (!thisValue.inherits(&JSConsole::s_info)) |
|
188 return throwVMTypeError(exec); |
|
189 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
190 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
191 ScriptCallStack callStack(exec, 0); |
|
192 |
|
193 imp->log(&callStack); |
|
194 return JSValue::encode(jsUndefined()); |
|
195 } |
|
196 |
|
197 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionWarn(ExecState* exec) |
|
198 { |
|
199 JSValue thisValue = exec->hostThisValue(); |
|
200 if (!thisValue.inherits(&JSConsole::s_info)) |
|
201 return throwVMTypeError(exec); |
|
202 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
203 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
204 ScriptCallStack callStack(exec, 0); |
|
205 |
|
206 imp->warn(&callStack); |
|
207 return JSValue::encode(jsUndefined()); |
|
208 } |
|
209 |
|
210 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionDir(ExecState* exec) |
|
211 { |
|
212 JSValue thisValue = exec->hostThisValue(); |
|
213 if (!thisValue.inherits(&JSConsole::s_info)) |
|
214 return throwVMTypeError(exec); |
|
215 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
216 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
217 ScriptCallStack callStack(exec, 0); |
|
218 |
|
219 imp->dir(&callStack); |
|
220 return JSValue::encode(jsUndefined()); |
|
221 } |
|
222 |
|
223 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionDirxml(ExecState* exec) |
|
224 { |
|
225 JSValue thisValue = exec->hostThisValue(); |
|
226 if (!thisValue.inherits(&JSConsole::s_info)) |
|
227 return throwVMTypeError(exec); |
|
228 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
229 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
230 ScriptCallStack callStack(exec, 0); |
|
231 |
|
232 imp->dirxml(&callStack); |
|
233 return JSValue::encode(jsUndefined()); |
|
234 } |
|
235 |
|
236 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionTrace(ExecState* exec) |
|
237 { |
|
238 JSValue thisValue = exec->hostThisValue(); |
|
239 if (!thisValue.inherits(&JSConsole::s_info)) |
|
240 return throwVMTypeError(exec); |
|
241 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
242 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
243 ScriptCallStack callStack(exec, 0); |
|
244 |
|
245 imp->trace(&callStack); |
|
246 return JSValue::encode(jsUndefined()); |
|
247 } |
|
248 |
|
249 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionAssert(ExecState* exec) |
|
250 { |
|
251 JSValue thisValue = exec->hostThisValue(); |
|
252 if (!thisValue.inherits(&JSConsole::s_info)) |
|
253 return throwVMTypeError(exec); |
|
254 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
255 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
256 ScriptCallStack callStack(exec, 1); |
|
257 bool condition = exec->argument(0).toBoolean(exec); |
|
258 |
|
259 imp->assertCondition(condition, &callStack); |
|
260 return JSValue::encode(jsUndefined()); |
|
261 } |
|
262 |
|
263 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionCount(ExecState* exec) |
|
264 { |
|
265 JSValue thisValue = exec->hostThisValue(); |
|
266 if (!thisValue.inherits(&JSConsole::s_info)) |
|
267 return throwVMTypeError(exec); |
|
268 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
269 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
270 ScriptCallStack callStack(exec, 0); |
|
271 |
|
272 imp->count(&callStack); |
|
273 return JSValue::encode(jsUndefined()); |
|
274 } |
|
275 |
|
276 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionMarkTimeline(ExecState* exec) |
|
277 { |
|
278 JSValue thisValue = exec->hostThisValue(); |
|
279 if (!thisValue.inherits(&JSConsole::s_info)) |
|
280 return throwVMTypeError(exec); |
|
281 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
282 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
283 ScriptCallStack callStack(exec, 0); |
|
284 |
|
285 imp->markTimeline(&callStack); |
|
286 return JSValue::encode(jsUndefined()); |
|
287 } |
|
288 |
|
289 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionProfile(ExecState* exec) |
|
290 { |
|
291 JSValue thisValue = exec->hostThisValue(); |
|
292 if (!thisValue.inherits(&JSConsole::s_info)) |
|
293 return throwVMTypeError(exec); |
|
294 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
295 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
296 ScriptCallStack callStack(exec, 1); |
|
297 const String& title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)); |
|
298 |
|
299 imp->profile(title, &callStack); |
|
300 return JSValue::encode(jsUndefined()); |
|
301 } |
|
302 |
|
303 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionProfileEnd(ExecState* exec) |
|
304 { |
|
305 JSValue thisValue = exec->hostThisValue(); |
|
306 if (!thisValue.inherits(&JSConsole::s_info)) |
|
307 return throwVMTypeError(exec); |
|
308 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
309 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
310 ScriptCallStack callStack(exec, 1); |
|
311 const String& title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)); |
|
312 |
|
313 imp->profileEnd(title, &callStack); |
|
314 return JSValue::encode(jsUndefined()); |
|
315 } |
|
316 |
|
317 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionTime(ExecState* exec) |
|
318 { |
|
319 JSValue thisValue = exec->hostThisValue(); |
|
320 if (!thisValue.inherits(&JSConsole::s_info)) |
|
321 return throwVMTypeError(exec); |
|
322 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
323 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
324 const String& title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)); |
|
325 |
|
326 imp->time(title); |
|
327 return JSValue::encode(jsUndefined()); |
|
328 } |
|
329 |
|
330 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionTimeEnd(ExecState* exec) |
|
331 { |
|
332 JSValue thisValue = exec->hostThisValue(); |
|
333 if (!thisValue.inherits(&JSConsole::s_info)) |
|
334 return throwVMTypeError(exec); |
|
335 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
336 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
337 ScriptCallStack callStack(exec, 1); |
|
338 const String& title = valueToStringWithUndefinedOrNullCheck(exec, exec->argument(0)); |
|
339 |
|
340 imp->timeEnd(title, &callStack); |
|
341 return JSValue::encode(jsUndefined()); |
|
342 } |
|
343 |
|
344 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionGroup(ExecState* exec) |
|
345 { |
|
346 JSValue thisValue = exec->hostThisValue(); |
|
347 if (!thisValue.inherits(&JSConsole::s_info)) |
|
348 return throwVMTypeError(exec); |
|
349 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
350 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
351 ScriptCallStack callStack(exec, 0); |
|
352 |
|
353 imp->group(&callStack); |
|
354 return JSValue::encode(jsUndefined()); |
|
355 } |
|
356 |
|
357 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionGroupCollapsed(ExecState* exec) |
|
358 { |
|
359 JSValue thisValue = exec->hostThisValue(); |
|
360 if (!thisValue.inherits(&JSConsole::s_info)) |
|
361 return throwVMTypeError(exec); |
|
362 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
363 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
364 ScriptCallStack callStack(exec, 0); |
|
365 |
|
366 imp->groupCollapsed(&callStack); |
|
367 return JSValue::encode(jsUndefined()); |
|
368 } |
|
369 |
|
370 EncodedJSValue JSC_HOST_CALL jsConsolePrototypeFunctionGroupEnd(ExecState* exec) |
|
371 { |
|
372 JSValue thisValue = exec->hostThisValue(); |
|
373 if (!thisValue.inherits(&JSConsole::s_info)) |
|
374 return throwVMTypeError(exec); |
|
375 JSConsole* castedThis = static_cast<JSConsole*>(asObject(thisValue)); |
|
376 Console* imp = static_cast<Console*>(castedThis->impl()); |
|
377 |
|
378 imp->groupEnd(); |
|
379 return JSValue::encode(jsUndefined()); |
|
380 } |
|
381 |
|
382 JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Console* object) |
|
383 { |
|
384 return getDOMObjectWrapper<JSConsole>(exec, globalObject, object); |
|
385 } |
|
386 Console* toConsole(JSC::JSValue value) |
|
387 { |
|
388 return value.inherits(&JSConsole::s_info) ? static_cast<JSConsole*>(asObject(value))->impl() : 0; |
|
389 } |
|
390 |
|
391 } |