Changeset 49996 in webkit
- Timestamp:
- Oct 23, 2009 1:43:17 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r49995 r49996 1 2009-10-23 Jens Alfke <snej@chromium.org> 2 3 Reviewed by Dimitri Glazkov. 4 5 Slight optimizations to object returning and exception handling in generated V8 bindings. 6 https://bugs.webkit.org/show_bug.cgi?id=30599 7 8 * bindings/scripts/CodeGeneratorV8.pm: Generate better code 9 * bindings/v8/V8DOMWrapper.h: 10 (WebCore::V8DOMWrapper::convertToV8Object): Added overload that takes a Ref<> 11 * bindings/v8/custom/V8InspectorBackendCustom.cpp: 12 (WebCore::CALLBACK_FUNC_DECL): Remove unnecessary template param to prevent compile error 13 1 14 2009-10-23 Alpha Lam <hclam@chromium.org> 2 15 -
trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm
r49949 r49996 308 308 my $result = ""; 309 309 310 $result .= $indent . "if ( ec) {\n";310 $result .= $indent . "if (UNLIKELY(ec)) {\n"; 311 311 $result .= $indent . " V8Proxy::setDOMException(ec);\n"; 312 312 $result .= $indent . " return v8::Handle<v8::Value>();\n"; … … 623 623 push(@implContentDecls, " return v8::Undefined();\n"); 624 624 } 625 push(@implContentDecls, " $nativeType v = ");626 627 push(@implContentDecls, "$getterString;\n");628 625 629 626 if ($useExceptions) { 627 push(@implContentDecls, " $nativeType v = "); 628 push(@implContentDecls, "$getterString;\n"); 630 629 push(@implContentDecls, GenerateSetDOMException(" ")); 631 } 632 633 $result = "v"; 630 $result = "v"; 631 $result .= ".release()" if (IsRefPtrType($returnType)); 632 } else { 633 # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary 634 $result = $getterString; 635 } 634 636 } 635 637 … … 647 649 push(@implContentDecls, " return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper.release());\n"); 648 650 } else { 649 $result .= ".release()" if (IsRefPtrType($attrType));650 651 push(@implContentDecls, " " . ReturnNativeToJSValue($attribute->signature, $result, " ").";\n"); 651 652 } … … 785 786 786 787 if ($useExceptions) { 787 push(@implContentDecls, " V8Proxy::setDOMException(ec);\n"); 788 push(@implContentDecls, " if (UNLIKELY(ec))\n"); 789 push(@implContentDecls, " V8Proxy::setDOMException(ec);\n"); 788 790 } 789 791 … … 918 920 $implIncludes{"ExceptionCode.h"} = 1; 919 921 push(@implContentDecls, 920 " if ( !$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ") {\n" .922 " if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n" . 921 923 " V8Proxy::setDOMException(TYPE_MISMATCH_ERR);\n" . 922 924 " return v8::Handle<v8::Value>();\n" . … … 927 929 $implIncludes{"ExceptionCode.h"} = 1; 928 930 push(@implContentDecls, 929 " if ( $parameterName < 0) {\n" .931 " if (UNLIKELY($parameterName < 0)) {\n" . 930 932 " V8Proxy::setDOMException(INDEX_SIZE_ERR);\n" . 931 933 " return v8::Handle<v8::Value>();\n" . … … 1538 1540 $functionString .= ")"; 1539 1541 1542 my $return = "result"; 1543 my $returnIsRef = IsRefPtrType($returnType); 1544 1540 1545 if ($nodeToReturn) { 1541 1546 # Special case for insertBefore, replaceChild, removeChild and … … 1558 1563 } elsif ($returnsListItemPodType) { 1559 1564 $result .= $indent . "RefPtr<SVGPODListItem<$nativeReturnType> > result = $functionString;\n"; 1565 } elsif (@{$function->raisesExceptions} or $returnsPodType or $isPodType or IsSVGTypeNeedingContextParameter($returnType)) { 1566 $result .= $indent . $nativeReturnType . " result = $functionString;\n"; 1560 1567 } else { 1561 $result .= $indent . $nativeReturnType . " result = $functionString;\n"; 1568 # Can inline the function call into the return statement to avoid overhead of using a Ref<> temporary 1569 $return = $functionString; 1570 $returnIsRef = 0; 1562 1571 } 1563 1572 … … 1565 1574 $result .= GenerateSetDOMException($indent); 1566 1575 } 1567 1568 my $return = "result";1569 1576 1570 1577 # If the return type is a POD type, separate out the wrapper generation … … 1610 1617 $result .= $indent . "return V8DOMWrapper::convertToV8Object(V8ClassIndex::$classIndex, wrapper.release());\n"; 1611 1618 } else { 1612 $return .= ".release()" if ( IsRefPtrType($returnType));1619 $return .= ".release()" if ($returnIsRef); 1613 1620 $result .= $indent . ReturnNativeToJSValue($function->signature, $return, $indent) . ";\n"; 1614 1621 }
Note: See TracChangeset
for help on using the changeset viewer.