[Webkit-unassigned] [Bug 156147] [JSC] implement async functions proposal

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon May 9 09:53:39 PDT 2016


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

--- Comment #78 from Caitlin Potter (:caitp) <caitp at igalia.com> ---
Comment on attachment 277938
  --> https://bugs.webkit.org/attachment.cgi?id=277938
Patch

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

>> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:245
>> +    bool containsArrowOrEvalButNotInArrowBlock = ((functionNode->usesArrowFunction() && functionNode->doAnyInnerArrowFunctionsUseAnyFeature()) || functionNode->usesEval()) && (!m_codeBlock->isArrowFunction() && !m_codeBlock->isAsyncArrowFunction());
> 
> Can we change this to the new `isArrowFunction()` including ArrowFunction / AsyncArrowFunction?
> Or is there any obstacles?

I was considering adding a `isAnyArrowFunction()`, just in case there were things that needed to distinguish between the two --- but I could try making `IsArrowFunction()` cover both cases, and add `IsSyncArrowFunction()` to cover just non-async cases if it's needed

>>>> Source/JavaScriptCore/parser/Parser.cpp:1796
>>>> +                    result = parseAsyncFunctionDeclaration(context);
>>> 
>>> These code is largely the same to the FUNCTION case. So extracting this to some function is recommended.
>> 
>> Sorry, can you clarify what you mean here?
>> 
>> I'm not sure if you're referring to this entire case statement, or the inside of `parseAsyncFunctionDeclaration` (which could share some code with parseFunctionDeclaration maybe), or what
> 
> Ah, sorry. I mean this case statement. (This case clause and FUNCTION cases are function statement special cases, right?)

So would you envision something like

```
case FUNCTION:
  const bool isAsync = false;
  result = parseFunctionDeclarationStatement(context, isAsync);
  break;

case IDENT:
  if ( /* ... is `async` conditional keyword */ ) {
    next();
    const bool isAsync = true;
    result = parseFunctionDeclarationStatement(context, isAsync);
    break;
  }
  /* fall through to expression-or-label-statement handling */
```

--- something like that, so that the duplicated parts are only generated once?

>> Source/JavaScriptCore/parser/Parser.cpp:3602
>> +        }
> 
> Is this safe for `async get value() { }`?

Added an edit which makes this safe (as far as I can tell)

>> Source/JavaScriptCore/runtime/CodeCache.cpp:226
>> +        break;
> 
> Could you extract this to static function?

Done

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160509/c37af9c8/attachment-0001.html>


More information about the webkit-unassigned mailing list