[V8] Simplify implementation of EnforceRange conversions
https://bugs.webkit.org/show_bug.cgi?id=112758

Patch by Michael Pruett <michael@68k.org> on 2013-03-20
Reviewed by Kentaro Hara.

Factor out EnforceRange conversion into a helper function.
Simplify calculation for truncation.

Tests: fast/js/webidl-type-mapping.html
       storage/indexeddb/cursor-advance.html
       storage/indexeddb/cursor-advance-workers.html
       storage/indexeddb/intversion-bad-parameters.html

* bindings/v8/V8Binding.cpp:
(WebCore::enforceRange):
(WebCore):
(WebCore::toInt32):
(WebCore::toUInt32):
(WebCore::toInt64):
(WebCore::toUInt64):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146365 268f45cc-cd09-0410-ab3c-d52691b4dbfc