Bug 70157

Summary: FunctionExecutable should expose the ability to create unattached FunctionCodeBlocks
Product: WebKit Reporter: Filip Pizlo <fpizlo>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 69996    
Attachments:
Description Flags
the patch
none
the patch - fix style ggaren: review+

Description Filip Pizlo 2011-10-14 16:43:04 PDT
Inlining requires being able to create a CodeBlock that is populated with bytecode for any callee that constitutes an inlining candidate.  Currently this is not possible without a non-trivial amount of code duplication.  Since FunctionExecutable already has the code for creating FunctionCodeBlocks that are populated with bytecode (in fact it has this functionality twice), this should simply be exposed as a method.  This will also provide an opportunity to reduce some of the redundant code in FunctionExecutable.
Comment 1 Filip Pizlo 2011-10-14 16:48:22 PDT
Created attachment 111107 [details]
the patch
Comment 2 WebKit Review Bot 2011-10-14 16:50:52 PDT
Attachment 111107 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/JavaScriptCore/ChangeLog', u'Source..." exit_code: 1

Source/JavaScriptCore/runtime/Executable.h:465:  The parameter name "exec" adds no information, so it should be removed.  [readability/parameter_name] [5]
Source/JavaScriptCore/runtime/Executable.h:465:  The parameter name "scopeChainNode" adds no information, so it should be removed.  [readability/parameter_name] [5]
Source/JavaScriptCore/runtime/Executable.h:465:  The parameter name "compilationKind" adds no information, so it should be removed.  [readability/parameter_name] [5]
Source/JavaScriptCore/runtime/Executable.h:465:  The parameter name "kind" adds no information, so it should be removed.  [readability/parameter_name] [5]
Total errors found: 4 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 3 Filip Pizlo 2011-10-14 16:54:43 PDT
Created attachment 111108 [details]
the patch - fix style
Comment 4 Geoffrey Garen 2011-10-14 17:10:57 PDT
Comment on attachment 111108 [details]
the patch - fix style

View in context: https://bugs.webkit.org/attachment.cgi?id=111108&action=review

r=me

> Source/JavaScriptCore/runtime/Executable.cpp:416
> +        return PassOwnPtr<FunctionCodeBlock>();

I think you can just return nullptr here.

> Source/JavaScriptCore/runtime/Executable.cpp:427
> +    result = adoptPtr(new FunctionCodeBlock(this, FunctionCode, globalObject, source().provider(), source().startOffset(), specializationKind == CodeForConstruct, PassOwnPtr<FunctionCodeBlock>()));

nullptr, or maybe just make that the default function argument.

> Source/JavaScriptCore/runtime/Executable.cpp:432
> +        return PassOwnPtr<FunctionCodeBlock>();

nullptr
Comment 5 Filip Pizlo 2011-10-15 14:44:23 PDT
Landed in r97564.