[Webkit-unassigned] [Bug 161409] [JSC] Implement parsing of Async Functions

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Fri Sep 9 14:40:23 PDT 2016


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

--- Comment #19 from Yusuke Suzuki <utatane.tea at gmail.com> ---
Comment on attachment 288384
  --> https://bugs.webkit.org/attachment.cgi?id=288384
Patch

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

Could you hide async / await parsing feature behind compile time / run time flag?

> Source/JavaScriptCore/ChangeLog:7
> +

Could you note ChangeLog?

> Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp:2980
> +    ASSERT(func->metadata()->parseMode() == SourceParseMode::ArrowFunctionMode || func->metadata()->parseMode() == SourceParseMode::AsyncArrowFunctionMode);

Let's use SourceParseModeSet here.

> Source/JavaScriptCore/parser/Parser.cpp:264
> +        if (parseMode == SourceParseMode::GeneratorBodyMode || isAsyncFunctionBodyParseMode(parseMode))

Let's use SourceParseModeSet even if there is only one candidate. See the reason why https://bugs.webkit.org/show_bug.cgi?id=156147#c132.

> Source/JavaScriptCore/parser/Parser.cpp:269
> +        if (oneOfSourceParseModes<SourceParseMode::ArrowFunctionMode, SourceParseMode::AsyncArrowFunctionMode>(parseMode) && !hasError()) {

Could you change this oneOfSourceParseModes to one done in https://trac.webkit.org/changeset/201523 (SourceParseModeSet) ?

> Source/JavaScriptCore/parser/Parser.cpp:315
> +    if (oneOfSourceParseModes<SourceParseMode::GeneratorWrapperFunctionMode>(parseMode) || isAsyncFunctionWrapperParseMode(parseMode)) {

Ditto

> Source/JavaScriptCore/parser/Parser.cpp:559
> +    info.parameterCount = 4; // generator, state, value, resume mode

We no longer need this code since createGeneratorParameters automatically set info.parameterCount.
And keep in mind that the updated generator takes 5th argument, @generatorFrame.

> Source/JavaScriptCore/parser/Parser.cpp:629
> +        // FIXME: These branch causes 1% regression in octane code-load jquery.

Since we already solved this, let's drop it.

> Source/JavaScriptCore/parser/Parser.cpp:1748
> +        // FIXME: These branch causes 1% regression in octane code-load jquery.

Ditto.

> Source/JavaScriptCore/parser/Parser.cpp:1946
> +    RELEASE_ASSERT(!(oneOfSourceParseModes<SourceParseMode::ProgramMode, SourceParseMode::ModuleAnalyzeMode, SourceParseMode::ModuleEvaluateMode>(mode)));

Ditto

> Source/JavaScriptCore/parser/Parser.cpp:1950
> +    if (UNLIKELY((oneOfSourceParseModes<SourceParseMode::ArrowFunctionMode, SourceParseMode::AsyncArrowFunctionMode>(mode)))) {

Ditto.

> Source/JavaScriptCore/parser/Parser.cpp:2086
> +            if (UNLIKELY((oneOfSourceParseModes<SourceParseMode::ArrowFunctionMode, SourceParseMode::AsyncArrowFunctionMode>(mode))))

Ditto.

> Source/JavaScriptCore/parser/Parser.cpp:2129
> +    if (UNLIKELY((oneOfSourceParseModes<SourceParseMode::ArrowFunctionMode, SourceParseMode::AsyncArrowFunctionMode>(mode)))) {

Ditto.

> Source/JavaScriptCore/parser/Parser.cpp:2179
> +        if (!(functionDefinitionType == FunctionDefinitionType::Expression && oneOfSourceParseModes<SourceParseMode::NormalFunctionMode, SourceParseMode::AsyncFunctionMode>(mode)))

Ditto.

> Source/JavaScriptCore/parser/Parser.cpp:2294
> +        RELEASE_ASSERT((oneOfSourceParseModes<SourceParseMode::NormalFunctionMode, SourceParseMode::MethodMode, SourceParseMode::ArrowFunctionMode, SourceParseMode::GeneratorBodyMode, SourceParseMode::GeneratorWrapperFunctionMode>(mode)) || isAsyncFunctionWrapperParseMode(mode));

Ditto.

> Source/JavaScriptCore/parser/Parser.cpp:2722
> +        // FIXME: These branch causes 1% regression in octane code-load jquery.

Since it is already solved, we can drop this FIXME.

> Source/JavaScriptCore/parser/Parser.cpp:3353
> +    // FIXME: These branch causes 1% regression in octane code-load jquery.

Ditto.

> Source/JavaScriptCore/parser/Parser.cpp:3512
> +    return context.createYield(location, argument, delegate, divotStart, argumentStart, lastTokenEndPosition());

How about using AwaitNode here and emit the similar code in code generation phase?

> Source/JavaScriptCore/parser/Parser.cpp:4117
> +        // FIXME: These branch causes 1% regression in octane code-load jquery.

Ditto.

> Source/JavaScriptCore/parser/ParserModes.h:76
> +static ALWAYS_INLINE bool oneOfSourceParseModes(SourceParseMode mode)

Change to SourceParseModeSet version.

> Source/JavaScriptCore/parser/ParserModes.h:83
> +    return oneOfSourceParseModes<

Ditto.

> Source/JavaScriptCore/parser/ParserModes.h:100
> +    return oneOfSourceParseModes<

Ditto.

> Source/JavaScriptCore/parser/ParserModes.h:110
> +    return oneOfSourceParseModes<

Ditto.

> Source/JavaScriptCore/parser/ParserModes.h:117
> +    return oneOfSourceParseModes<

Ditto.

> Source/JavaScriptCore/parser/ParserModes.h:125
> +    return oneOfSourceParseModes<

Ditto.

> Source/JavaScriptCore/parser/ParserModes.h:132
> +    return oneOfSourceParseModes<

Ditto.

> Source/JavaScriptCore/parser/ParserModes.h:142
> +    return oneOfSourceParseModes<

Ditto.

> Source/JavaScriptCore/parser/ParserModes.h:149
> +    return oneOfSourceParseModes<SourceParseMode::ProgramMode>(parseMode);

Ditto.

-- 
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/20160909/c8d98907/attachment.html>


More information about the webkit-unassigned mailing list