Skip to content

Conversation

@zherczeg
Copy link
Member

May increase the memory consumption heavily.

OPTIONS_PROFILE_MIN = ['--profile=minimal']
OPTIONS_PROFILE_ES51 = ['--profile=es5.1']
OPTIONS_PROFILE_ESNEXT = ['--profile=es.next']
OPTIONS_PROFILE_ESNEXT = ['--profile=es.next', '--function-to-string=on']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me know if there is a better place for this config.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function.prototype.toString changes are part of ES2019 spec. Why don't we simple enable it for ES next? Of course we could have an option to be able to disable it if the user don't want to use it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "feature" can be costly from memory use perspective, which is quite the opposite of the aims of this engine. However, if somebody needs this, it can be enabled.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, see.

Comment on lines 31 to 37
<test id="built-ins/Function/prototype/toString/bound-function.js"><reason></reason></test>
<test id="built-ins/Function/prototype/toString/built-in-function-object.js"><reason></reason></test>
<test id="built-ins/Function/prototype/toString/class-declaration-complex-heritage.js"><reason></reason></test>
<test id="built-ins/Function/prototype/toString/class-declaration-explicit-ctor.js"><reason></reason></test>
<test id="built-ins/Function/prototype/toString/class-declaration-implicit-ctor.js"><reason></reason></test>
<test id="built-ins/Function/prototype/toString/class-expression-explicit-ctor.js"><reason></reason></test>
<test id="built-ins/Function/prototype/toString/class-expression-implicit-ctor.js"><reason></reason></test>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many still failing tests in Function/prototype/toString. Do we plan to support them too in a follow-up PR or in this PR in next iterations?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are mostly the "native" and "whole class" variants. We can do them incrementally later. The latter is not exactly trivial.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, sounds good.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turned out the "native" part is quite trivial, so added it to this patch. The "class" part still remains.

Copy link
Contributor

@ossy-szeged ossy-szeged left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see many JERRY_ESNEXT || JERRY_FUNCTION_TO_STRING ifdef guards. This new feature is part of ES2019 spec, so I wouldn't let the user to enable it in case of !JERRY_ESNEXT. I would simple make JERRY_FUNCTION_TO_STRING depends on JERRY_ESNEXT and we should force it in config.h near "JERRY_ESNEXT should be enabled too to enable JERRY_BUILTIN_xxxxx macro." error message.

One more thing. If it is disabled by default but enabled always during testing in case of ESNEXT would cause build failures. Can we test !JERRY_FUNCTION_TO_STRING build configuration by buildoption tests?

Comment on lines 1014 to 1033
#if JERRY_FUNCTION_TO_STRING \
|| !(JERRY_FUNCTION_TO_STRING)
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING__FUNCTION_TO_STRING, "function(){/* ecmascript */}")
#endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

x || !x is always true. Do we know why this strange conditions are generated?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#4751 aims to fix that

Comment on lines 31 to 37
<test id="built-ins/Function/prototype/toString/bound-function.js"><reason></reason></test>
<test id="built-ins/Function/prototype/toString/built-in-function-object.js"><reason></reason></test>
<test id="built-ins/Function/prototype/toString/class-declaration-complex-heritage.js"><reason></reason></test>
<test id="built-ins/Function/prototype/toString/class-declaration-explicit-ctor.js"><reason></reason></test>
<test id="built-ins/Function/prototype/toString/class-declaration-implicit-ctor.js"><reason></reason></test>
<test id="built-ins/Function/prototype/toString/class-expression-explicit-ctor.js"><reason></reason></test>
<test id="built-ins/Function/prototype/toString/class-expression-implicit-ctor.js"><reason></reason></test>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, sounds good.

OPTIONS_PROFILE_MIN = ['--profile=minimal']
OPTIONS_PROFILE_ES51 = ['--profile=es5.1']
OPTIONS_PROFILE_ESNEXT = ['--profile=es.next']
OPTIONS_PROFILE_ESNEXT = ['--profile=es.next', '--function-to-string=on']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, see.

@zherczeg zherczeg force-pushed the to_string branch 2 times, most recently from 93c2e21 to df1f70e Compare August 30, 2021 06:31
Copy link
Contributor

@galpeter galpeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

May increase the memory consumtpion heavily.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
@zherczeg zherczeg merged commit 6649940 into jerryscript-project:master Aug 31, 2021
@zherczeg zherczeg deleted the to_string branch August 31, 2021 11:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants