[Webkit-unassigned] [Bug 112506] [JSC] Implement EnforceRange IDL attribute for integer conversions

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sun Mar 17 17:32:29 PDT 2013


https://bugs.webkit.org/show_bug.cgi?id=112506





--- Comment #7 from Kentaro Hara <haraken at chromium.org>  2013-03-17 17:34:53 PST ---
(From update of attachment 193456)
View in context: https://bugs.webkit.org/attachment.cgi?id=193456&action=review

Thank you very much for making JSC and V8 consistent!

> Source/WebCore/ChangeLog:33
> +        * bindings/js/JSIntegerConversion.cpp: Added.
> +        (enforceRange):
> +        (WebCore):
> +        (WebCore::toInt32):
> +        (WebCore::toUInt32):
> +        (WebCore::toInt64):
> +        (WebCore::toUInt64):
> +        * bindings/js/JSIntegerConversion.h: Added.
> +        (WebCore):

It looks like we have toXXX() helpers in JSDOMBinding.{h,cpp}. How about just adding integer conversion methods to JSDOMBindings ?

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:3189
> +    if ($type eq "short" or
> +        $type eq "unsigned short" or
> +        $type eq "long" or
> +        $type eq "unsigned long" or
> +        $type eq "long long" or
> +        $type eq "unsigned long long") {

Why do you need the if statement ?

> Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:3199
> +            return "$value.toInt32(exec)" if $type eq "long" or $type eq "short";
> +            return "$value.toUInt32(exec)" if $type eq "unsigned long" or $type eq "unsigned short";
> +

Shall we define toInt32(exec, value, NormalConversion) and toUInt32(exec, value, NormalConversion) and use them here? (They can just redirect to value.toInt32() or value.toUInt32().)

Then you will be able to clean up the code like this:

  my $intConversion = $signature->extendedAttributes->{"EnforceRange"} ? "EnforceRange" : "NormalConversion";
  return "toInt32(exec, $value, $intConversion)" if $type eq "long" or $type eq "short";
  return "toUInt32(exec, $value, $intConversion)" if $type eq "unsigned long" or $type eq "unsigned short";
  ...;

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list