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

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

Issue 947123002: [bindings] Split toUInt32 into faster inline and non-inline slower path. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 5 years, 10 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 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 { 425 {
426 return toInt32(value, NormalConversion, exceptionState); 426 return toInt32(value, NormalConversion, exceptionState);
427 } 427 }
428 428
429 // Convert a value to a 32-bit integer assuming the conversion cannot fail. 429 // Convert a value to a 32-bit integer assuming the conversion cannot fail.
430 int32_t toInt32(v8::Handle<v8::Value>); 430 int32_t toInt32(v8::Handle<v8::Value>);
431 431
432 // Convert a value to a 32-bit unsigned integer. The conversion fails if the 432 // Convert a value to a 32-bit unsigned integer. The conversion fails if the
433 // value cannot be converted to a number or the range violated per WebIDL: 433 // value cannot be converted to a number or the range violated per WebIDL:
434 // http://www.w3.org/TR/WebIDL/#es-unsigned-long 434 // http://www.w3.org/TR/WebIDL/#es-unsigned-long
435 uint32_t toUInt32(v8::Handle<v8::Value>, IntegerConversionConfiguration, Excepti onState&); 435 uint32_t toUInt32Slow(v8::Handle<v8::Value>, IntegerConversionConfiguration, Exc eptionState&);
436 inline uint32_t toUInt32(v8::Handle<v8::Value> value, IntegerConversionConfigura tion configuration, ExceptionState& exceptionState)
437 {
438 // Fast case. The value is already a 32-bit unsigned integer.
439 if (value->IsUint32())
440 return value->Uint32Value();
441
442 // Fast case. The value is a 32-bit signed integer with NormalConversion con figuration.
443 if (value->IsInt32() && configuration == NormalConversion)
444 return value->Int32Value();
445
446 return toUInt32Slow(value, configuration, exceptionState);
447 }
448
436 inline uint32_t toUInt32(v8::Handle<v8::Value> value, ExceptionState& exceptionS tate) 449 inline uint32_t toUInt32(v8::Handle<v8::Value> value, ExceptionState& exceptionS tate)
437 { 450 {
438 return toUInt32(value, NormalConversion, exceptionState); 451 return toUInt32(value, NormalConversion, exceptionState);
439 } 452 }
440 453
441 // Convert a value to a 32-bit unsigned integer assuming the conversion cannot f ail. 454 // Convert a value to a 32-bit unsigned integer assuming the conversion cannot f ail.
442 uint32_t toUInt32(v8::Handle<v8::Value>); 455 uint32_t toUInt32(v8::Handle<v8::Value>);
443 456
444 // Convert a value to a 64-bit signed integer. The conversion fails if the 457 // Convert a value to a 64-bit signed integer. The conversion fails if the
445 // value cannot be converted to a number or the range violated per WebIDL: 458 // value cannot be converted to a number or the range violated per WebIDL:
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1011 1024
1012 private: 1025 private:
1013 v8::TryCatch& m_block; 1026 v8::TryCatch& m_block;
1014 }; 1027 };
1015 1028
1016 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*); 1029 typedef void (*InstallTemplateFunction)(v8::Local<v8::FunctionTemplate>, v8::Iso late*);
1017 1030
1018 } // namespace blink 1031 } // namespace blink
1019 1032
1020 #endif // V8Binding_h 1033 #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