[webkit-reviews] review granted: [Bug 112506] [JSC] Implement EnforceRange IDL attribute for integer conversions : [Attachment 193841] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 19 17:22:34 PDT 2013


Kentaro Hara <haraken at chromium.org> has granted Michael Pruett
<michael at 68k.org>'s request for review:
Bug 112506: [JSC] Implement EnforceRange IDL attribute for integer conversions
https://bugs.webkit.org/show_bug.cgi?id=112506

Attachment 193841: Patch
https://bugs.webkit.org/attachment.cgi?id=193841&action=review

------- Additional Comments from Kentaro Hara <haraken at chromium.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=193841&action=review


> Source/WebCore/bindings/js/JSDOMBinding.cpp:268
> +static double enforceRange(ExecState* exec, double x, double minimum, double
maximum)

This helper method looks great; it is easy to understand that the
implementation is conformed to the spec. I'd be happy if you could clean up
V8Binding.cpp similarly in a follow-up patch:)

> Source/WebCore/bindings/js/JSDOMBinding.h:278
> +    inline int32_t toInt32(JSC::ExecState* exec, JSC::JSValue value,
IntegerConversionConfiguration configuration)
> +    {
> +	   if (configuration == EnforceRange)
> +	       return toInt32EnforceRange(exec, value);
> +	   return value.toInt32(exec);
> +    }
> +
> +    inline uint32_t toUInt32(JSC::ExecState* exec, JSC::JSValue value,
IntegerConversionConfiguration configuration)
> +    {
> +	   if (configuration == EnforceRange)
> +	       return toUInt32EnforceRange(exec, value);
> +	   return value.toUInt32(exec);
> +    }
> +
> +    int64_t toInt64(JSC::ExecState*, JSC::JSValue,
IntegerConversionConfiguration);
> +    uint64_t toUInt64(JSC::ExecState*, JSC::JSValue,
IntegerConversionConfiguration);

In a follow-up patch, let's make IntegerConversionConfiguration an optional
parameter and set NormalConversion by default (in both CodeGeneratorJS.pm and
CodeGeneratorV8.pm). Then you don't need to care about the parameter in caller
sites in common cases.


More information about the webkit-reviews mailing list