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

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

Issue 1011613004: [bindings] Split toUInt64 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 459 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 // http://www.w3.org/TR/WebIDL/#es-long-long 470 // http://www.w3.org/TR/WebIDL/#es-long-long
471 CORE_EXPORT int64_t toInt64(v8::Handle<v8::Value>, IntegerConversionConfiguratio n, ExceptionState&); 471 CORE_EXPORT int64_t toInt64(v8::Handle<v8::Value>, IntegerConversionConfiguratio n, ExceptionState&);
472 inline int64_t toInt64(v8::Handle<v8::Value> value, ExceptionState& exceptionSta te) 472 inline int64_t toInt64(v8::Handle<v8::Value> value, ExceptionState& exceptionSta te)
473 { 473 {
474 return toInt64(value, NormalConversion, exceptionState); 474 return toInt64(value, NormalConversion, exceptionState);
475 } 475 }
476 476
477 // Convert a value to a 64-bit integer assuming the conversion cannot fail. 477 // Convert a value to a 64-bit integer assuming the conversion cannot fail.
478 int64_t toInt64(v8::Handle<v8::Value>); 478 int64_t toInt64(v8::Handle<v8::Value>);
479 479
480 CORE_EXPORT uint64_t toUInt64Slow(v8::Handle<v8::Value>, IntegerConversionConfig uration, ExceptionState&);
481
480 // Convert a value to a 64-bit unsigned integer. The conversion fails if the 482 // 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: 483 // value cannot be converted to a number or the range violated per WebIDL:
482 // http://www.w3.org/TR/WebIDL/#es-unsigned-long-long 484 // http://www.w3.org/TR/WebIDL/#es-unsigned-long-long
483 CORE_EXPORT uint64_t toUInt64(v8::Handle<v8::Value>, IntegerConversionConfigurat ion, ExceptionState&); 485 inline uint64_t toUInt64(v8::Handle<v8::Value> value, IntegerConversionConfigura tion configuration, ExceptionState& exceptionState)
486 {
487 // Fast case. The value is a 32-bit unsigned integer.
488 if (value->IsUint32())
489 return value->Uint32Value();
490
491 if (value->IsInt32() && configuration == NormalConversion)
492 return value->Int32Value();
493
494 return toUInt64Slow(value, configuration, exceptionState);
495 }
496
484 inline uint64_t toUInt64(v8::Handle<v8::Value> value, ExceptionState& exceptionS tate) 497 inline uint64_t toUInt64(v8::Handle<v8::Value> value, ExceptionState& exceptionS tate)
485 { 498 {
486 return toUInt64(value, NormalConversion, exceptionState); 499 return toUInt64(value, NormalConversion, exceptionState);
487 } 500 }
488 501
489 // Convert a value to a 64-bit unsigned integer assuming the conversion cannot f ail. 502 // Convert a value to a 64-bit unsigned integer assuming the conversion cannot f ail.
490 uint64_t toUInt64(v8::Handle<v8::Value>); 503 uint64_t toUInt64(v8::Handle<v8::Value>);
491 504
492 // Convert a value to a double precision float, which might fail. 505 // Convert a value to a double precision float, which might fail.
493 CORE_EXPORT double toDoubleSlow(v8::Handle<v8::Value>, ExceptionState&); 506 CORE_EXPORT double toDoubleSlow(v8::Handle<v8::Value>, ExceptionState&);
(...skipping 540 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