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

Side by Side Diff: Source/bindings/core/v8/V8Binding.h

Issue 1009283002: [bindings] Split toInt64 into fast inline vs slow non-inline code paths. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8Binding.cpp » ('j') | 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 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2012 Ericsson AB. All rights reserved. 3 * Copyright (C) 2012 Ericsson AB. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 } 458 }
459 459
460 inline uint32_t toUInt32(v8::Handle<v8::Value> value, ExceptionState& exceptionS tate) 460 inline uint32_t toUInt32(v8::Handle<v8::Value> value, ExceptionState& exceptionS tate)
461 { 461 {
462 return toUInt32(value, NormalConversion, exceptionState); 462 return toUInt32(value, NormalConversion, exceptionState);
463 } 463 }
464 464
465 // Convert a value to a 32-bit unsigned integer assuming the conversion cannot f ail. 465 // Convert a value to a 32-bit unsigned integer assuming the conversion cannot f ail.
466 uint32_t toUInt32(v8::Handle<v8::Value>); 466 uint32_t toUInt32(v8::Handle<v8::Value>);
467 467
468 CORE_EXPORT int64_t toInt64Slow(v8::Handle<v8::Value>, IntegerConversionConfigur ation, ExceptionState&);
469
468 // Convert a value to a 64-bit signed integer. The conversion fails if the 470 // Convert a value to a 64-bit signed integer. The conversion fails if the
469 // value cannot be converted to a number or the range violated per WebIDL: 471 // value cannot be converted to a number or the range violated per WebIDL:
470 // http://www.w3.org/TR/WebIDL/#es-long-long 472 // http://www.w3.org/TR/WebIDL/#es-long-long
471 CORE_EXPORT int64_t toInt64(v8::Handle<v8::Value>, IntegerConversionConfiguratio n, ExceptionState&); 473 inline int64_t toInt64(v8::Handle<v8::Value> value, IntegerConversionConfigurati on configuration, ExceptionState& exceptionState)
474 {
475 // Clamping not supported for int64_t/long long int. See Source/wtf/MathExtr as.h.
476 ASSERT(configuration != Clamp);
477
478 // Fast case. The value is a 32-bit integer.
479 if (value->IsInt32())
480 return value->Int32Value();
481
482 return toInt64Slow(value, configuration, exceptionState);
483 }
484
472 inline int64_t toInt64(v8::Handle<v8::Value> value, ExceptionState& exceptionSta te) 485 inline int64_t toInt64(v8::Handle<v8::Value> value, ExceptionState& exceptionSta te)
473 { 486 {
474 return toInt64(value, NormalConversion, exceptionState); 487 return toInt64(value, NormalConversion, exceptionState);
475 } 488 }
476 489
477 // Convert a value to a 64-bit integer assuming the conversion cannot fail. 490 // Convert a value to a 64-bit integer assuming the conversion cannot fail.
478 int64_t toInt64(v8::Handle<v8::Value>); 491 int64_t toInt64(v8::Handle<v8::Value>);
479 492
480 // Convert a value to a 64-bit unsigned integer. The conversion fails if the 493 // Convert a value to a 64-bit unsigned integer. The conversion fails if the
481 // value cannot be converted to a number or the range violated per WebIDL: 494 // value cannot be converted to a number or the range violated per WebIDL:
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 1047
1035 // Callback functions used by generated code. 1048 // Callback functions used by generated code.
1036 void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>&); 1049 void v8ConstructorAttributeGetterAsProperty(v8::Local<v8::String> propertyName, const v8::PropertyCallbackInfo<v8::Value>&);
1037 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>&); 1050 void v8ConstructorAttributeGetterAsAccessor(const v8::FunctionCallbackInfo<v8::V alue>&);
1038 1051
1039 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); 1052 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*);
1040 1053
1041 } // namespace blink 1054 } // namespace blink
1042 1055
1043 #endif // V8Binding_h 1056 #endif // V8Binding_h
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/core/v8/V8Binding.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698