Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1415)

Side by Side Diff: Source/bindings/tests/results/V8TestTypedefs.cpp

Issue 23471005: Use UNLIKELY() macro in generated bindings for minimum argument count checks (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/bindings/tests/results/V8TestOverloadedConstructors.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 This file is part of the Blink open source project. 2 This file is part of the Blink open source project.
3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY! 3 This file has been auto-generated by CodeGeneratorV8.pm. DO NOT MODIFY!
4 4
5 This library is free software; you can redistribute it and/or 5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public 6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either 7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version. 8 version 2 of the License, or (at your option) any later version.
9 9
10 This library is distributed in the hope that it will be useful, 10 This library is distributed in the hope that it will be useful,
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 } 269 }
270 270
271 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info) 271 static void TestTypedefsReplaceableAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<void>& info)
272 { 272 {
273 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, value, info); 273 TestTypedefsV8Internal::TestTypedefsReplaceableAttributeSetter(name, value, info);
274 } 274 }
275 275
276 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 276 static void funcMethod(const v8::FunctionCallbackInfo<v8::Value>& args)
277 { 277 {
278 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder()); 278 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder());
279 if (args.Length() <= 0) { 279 if (UNLIKELY(args.Length() <= 0)) {
280 imp->func(); 280 imp->func();
281 281
282 return; 282 return;
283 } 283 }
284 V8TRYCATCH_VOID(Vector<int>, x, toNativeArray<int>(args[0], args.GetIsolate( ))); 284 V8TRYCATCH_VOID(Vector<int>, x, toNativeArray<int>(args[0], args.GetIsolate( )));
285 imp->func(x); 285 imp->func(x);
286 286
287 return; 287 return;
288 } 288 }
289 289
290 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args) 290 static void funcMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& args)
291 { 291 {
292 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 292 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
293 TestTypedefsV8Internal::funcMethod(args); 293 TestTypedefsV8Internal::funcMethod(args);
294 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 294 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
295 } 295 }
296 296
297 static void setShadowMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 297 static void setShadowMethod(const v8::FunctionCallbackInfo<v8::Value>& args)
298 { 298 {
299 if (args.Length() < 3) { 299 if (UNLIKELY(args.Length() < 3)) {
300 throwNotEnoughArgumentsError(args.GetIsolate()); 300 throwNotEnoughArgumentsError(args.GetIsolate());
301 return; 301 return;
302 } 302 }
303 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder()); 303 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder());
304 V8TRYCATCH_VOID(float, width, static_cast<float>(args[0]->NumberValue())); 304 V8TRYCATCH_VOID(float, width, static_cast<float>(args[0]->NumberValue()));
305 V8TRYCATCH_VOID(float, height, static_cast<float>(args[1]->NumberValue())); 305 V8TRYCATCH_VOID(float, height, static_cast<float>(args[1]->NumberValue()));
306 V8TRYCATCH_VOID(float, blur, static_cast<float>(args[2]->NumberValue())); 306 V8TRYCATCH_VOID(float, blur, static_cast<float>(args[2]->NumberValue()));
307 if (args.Length() <= 3) { 307 if (UNLIKELY(args.Length() <= 3)) {
308 imp->setShadow(width, height, blur); 308 imp->setShadow(width, height, blur);
309 309
310 return; 310 return;
311 } 311 }
312 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, color, args[3]); 312 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, color, args[3]);
313 if (args.Length() <= 4) { 313 if (UNLIKELY(args.Length() <= 4)) {
314 imp->setShadow(width, height, blur, color); 314 imp->setShadow(width, height, blur, color);
315 315
316 return; 316 return;
317 } 317 }
318 V8TRYCATCH_VOID(float, alpha, static_cast<float>(args[4]->NumberValue())); 318 V8TRYCATCH_VOID(float, alpha, static_cast<float>(args[4]->NumberValue()));
319 imp->setShadow(width, height, blur, color, alpha); 319 imp->setShadow(width, height, blur, color, alpha);
320 320
321 return; 321 return;
322 } 322 }
323 323
324 static void setShadowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& a rgs) 324 static void setShadowMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& a rgs)
325 { 325 {
326 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 326 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
327 TestTypedefsV8Internal::setShadowMethod(args); 327 TestTypedefsV8Internal::setShadowMethod(args);
328 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 328 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
329 } 329 }
330 330
331 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value >& args) 331 static void methodWithSequenceArgMethod(const v8::FunctionCallbackInfo<v8::Value >& args)
332 { 332 {
333 if (args.Length() < 1) { 333 if (UNLIKELY(args.Length() < 1)) {
334 throwNotEnoughArgumentsError(args.GetIsolate()); 334 throwNotEnoughArgumentsError(args.GetIsolate());
335 return; 335 return;
336 } 336 }
337 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder()); 337 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder());
338 V8TRYCATCH_VOID(Vector<RefPtr<SerializedScriptValue> >, sequenceArg, (toRefP trNativeArray<SerializedScriptValue, V8SerializedScriptValue>(args[0], args.GetI solate()))); 338 V8TRYCATCH_VOID(Vector<RefPtr<SerializedScriptValue> >, sequenceArg, (toRefP trNativeArray<SerializedScriptValue, V8SerializedScriptValue>(args[0], args.GetI solate())));
339 v8SetReturnValue(args, static_cast<double>(imp->methodWithSequenceArg(sequen ceArg))); 339 v8SetReturnValue(args, static_cast<double>(imp->methodWithSequenceArg(sequen ceArg)));
340 return; 340 return;
341 } 341 }
342 342
343 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v 8::Value>& args) 343 static void methodWithSequenceArgMethodCallback(const v8::FunctionCallbackInfo<v 8::Value>& args)
344 { 344 {
345 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 345 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
346 TestTypedefsV8Internal::methodWithSequenceArgMethod(args); 346 TestTypedefsV8Internal::methodWithSequenceArgMethod(args);
347 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 347 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
348 } 348 }
349 349
350 static void nullableArrayArgMethod(const v8::FunctionCallbackInfo<v8::Value>& ar gs) 350 static void nullableArrayArgMethod(const v8::FunctionCallbackInfo<v8::Value>& ar gs)
351 { 351 {
352 if (args.Length() < 1) { 352 if (UNLIKELY(args.Length() < 1)) {
353 throwNotEnoughArgumentsError(args.GetIsolate()); 353 throwNotEnoughArgumentsError(args.GetIsolate());
354 return; 354 return;
355 } 355 }
356 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder()); 356 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder());
357 V8TRYCATCH_VOID(Vector<String>, arrayArg, toNativeArray<String>(args[0], arg s.GetIsolate())); 357 V8TRYCATCH_VOID(Vector<String>, arrayArg, toNativeArray<String>(args[0], arg s.GetIsolate()));
358 imp->nullableArrayArg(arrayArg); 358 imp->nullableArrayArg(arrayArg);
359 359
360 return; 360 return;
361 } 361 }
362 362
363 static void nullableArrayArgMethodCallback(const v8::FunctionCallbackInfo<v8::Va lue>& args) 363 static void nullableArrayArgMethodCallback(const v8::FunctionCallbackInfo<v8::Va lue>& args)
364 { 364 {
365 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 365 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
366 TestTypedefsV8Internal::nullableArrayArgMethod(args); 366 TestTypedefsV8Internal::nullableArrayArgMethod(args);
367 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 367 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
368 } 368 }
369 369
370 static void funcWithClampMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 370 static void funcWithClampMethod(const v8::FunctionCallbackInfo<v8::Value>& args)
371 { 371 {
372 if (args.Length() < 1) { 372 if (UNLIKELY(args.Length() < 1)) {
373 throwNotEnoughArgumentsError(args.GetIsolate()); 373 throwNotEnoughArgumentsError(args.GetIsolate());
374 return; 374 return;
375 } 375 }
376 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder()); 376 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder());
377 unsigned long long arg1 = 0; 377 unsigned long long arg1 = 0;
378 V8TRYCATCH_VOID(double, arg1NativeValue, args[0]->NumberValue()); 378 V8TRYCATCH_VOID(double, arg1NativeValue, args[0]->NumberValue());
379 if (!std::isnan(arg1NativeValue)) 379 if (!std::isnan(arg1NativeValue))
380 arg1 = clampTo<unsigned long long>(arg1NativeValue); 380 arg1 = clampTo<unsigned long long>(arg1NativeValue);
381 if (args.Length() <= 1) { 381 if (UNLIKELY(args.Length() <= 1)) {
382 imp->funcWithClamp(arg1); 382 imp->funcWithClamp(arg1);
383 383
384 return; 384 return;
385 } 385 }
386 unsigned long long arg2 = 0; 386 unsigned long long arg2 = 0;
387 V8TRYCATCH_VOID(double, arg2NativeValue, args[1]->NumberValue()); 387 V8TRYCATCH_VOID(double, arg2NativeValue, args[1]->NumberValue());
388 if (!std::isnan(arg2NativeValue)) 388 if (!std::isnan(arg2NativeValue))
389 arg2 = clampTo<unsigned long long>(arg2NativeValue); 389 arg2 = clampTo<unsigned long long>(arg2NativeValue);
390 imp->funcWithClamp(arg1, arg2); 390 imp->funcWithClamp(arg1, arg2);
391 391
(...skipping 16 matching lines...) Expand all
408 408
409 static void immutablePointFunctionMethodCallback(const v8::FunctionCallbackInfo< v8::Value>& args) 409 static void immutablePointFunctionMethodCallback(const v8::FunctionCallbackInfo< v8::Value>& args)
410 { 410 {
411 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 411 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
412 TestTypedefsV8Internal::immutablePointFunctionMethod(args); 412 TestTypedefsV8Internal::immutablePointFunctionMethod(args);
413 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 413 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
414 } 414 }
415 415
416 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& args) 416 static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo<v8::Value>& args)
417 { 417 {
418 if (args.Length() < 1) { 418 if (UNLIKELY(args.Length() < 1)) {
419 throwNotEnoughArgumentsError(args.GetIsolate()); 419 throwNotEnoughArgumentsError(args.GetIsolate());
420 return; 420 return;
421 } 421 }
422 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder()); 422 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder());
423 ExceptionState es(args.GetIsolate()); 423 ExceptionState es(args.GetIsolate());
424 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(args[0], args. GetIsolate())); 424 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(args[0], args. GetIsolate()));
425 Vector<String> result = imp->stringArrayFunction(values, es); 425 Vector<String> result = imp->stringArrayFunction(values, es);
426 if (es.throwIfNeeded()) 426 if (es.throwIfNeeded())
427 return; 427 return;
428 v8SetReturnValue(args, v8Array(result, args.GetIsolate())); 428 v8SetReturnValue(args, v8Array(result, args.GetIsolate()));
429 return; 429 return;
430 } 430 }
431 431
432 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& args) 432 static void stringArrayFunctionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& args)
433 { 433 {
434 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 434 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
435 TestTypedefsV8Internal::stringArrayFunctionMethod(args); 435 TestTypedefsV8Internal::stringArrayFunctionMethod(args);
436 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 436 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
437 } 437 }
438 438
439 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value> & args) 439 static void stringArrayFunction2Method(const v8::FunctionCallbackInfo<v8::Value> & args)
440 { 440 {
441 if (args.Length() < 1) { 441 if (UNLIKELY(args.Length() < 1)) {
442 throwNotEnoughArgumentsError(args.GetIsolate()); 442 throwNotEnoughArgumentsError(args.GetIsolate());
443 return; 443 return;
444 } 444 }
445 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder()); 445 TestTypedefs* imp = V8TestTypedefs::toNative(args.Holder());
446 ExceptionState es(args.GetIsolate()); 446 ExceptionState es(args.GetIsolate());
447 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(args[0], args. GetIsolate())); 447 V8TRYCATCH_VOID(Vector<String>, values, toNativeArray<String>(args[0], args. GetIsolate()));
448 Vector<String> result = imp->stringArrayFunction2(values, es); 448 Vector<String> result = imp->stringArrayFunction2(values, es);
449 if (es.throwIfNeeded()) 449 if (es.throwIfNeeded())
450 return; 450 return;
451 v8SetReturnValue(args, v8Array(result, args.GetIsolate())); 451 v8SetReturnValue(args, v8Array(result, args.GetIsolate()));
(...skipping 20 matching lines...) Expand all
472 472
473 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& args) 473 static void methodWithExceptionMethodCallback(const v8::FunctionCallbackInfo<v8: :Value>& args)
474 { 474 {
475 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod"); 475 TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
476 TestTypedefsV8Internal::methodWithExceptionMethod(args); 476 TestTypedefsV8Internal::methodWithExceptionMethod(args);
477 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution"); 477 TRACE_EVENT_SET_SAMPLING_STATE("V8", "Execution");
478 } 478 }
479 479
480 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args) 480 static void constructor(const v8::FunctionCallbackInfo<v8::Value>& args)
481 { 481 {
482 if (args.Length() < 2) { 482 if (UNLIKELY(args.Length() < 2)) {
483 throwNotEnoughArgumentsError(args.GetIsolate()); 483 throwNotEnoughArgumentsError(args.GetIsolate());
484 return; 484 return;
485 } 485 }
486 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, hello, args[0]); 486 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, hello, args[0]);
487 if (args.Length() <= 1 || !args[1]->IsFunction()) { 487 if (args.Length() <= 1 || !args[1]->IsFunction()) {
488 throwTypeError(args.GetIsolate()); 488 throwTypeError(args.GetIsolate());
489 return; 489 return;
490 } 490 }
491 RefPtr<TestCallback> testCallback = V8TestCallback::create(args[1], getScrip tExecutionContext()); 491 RefPtr<TestCallback> testCallback = V8TestCallback::create(args[1], getScrip tExecutionContext());
492 492
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl, &info, wrappe r, isolate, WrapperConfiguration::Independent); 604 V8DOMWrapper::associateObjectWithWrapper<V8TestTypedefs>(impl, &info, wrappe r, isolate, WrapperConfiguration::Independent);
605 return wrapper; 605 return wrapper;
606 } 606 }
607 607
608 void V8TestTypedefs::derefObject(void* object) 608 void V8TestTypedefs::derefObject(void* object)
609 { 609 {
610 fromInternalPointer(object)->deref(); 610 fromInternalPointer(object)->deref();
611 } 611 }
612 612
613 } // namespace WebCore 613 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/bindings/tests/results/V8TestOverloadedConstructors.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698