Skip to content

Instantiation of Arguments object #102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 29, 2015

Conversation

ruben-ayrapetyan
Copy link
Contributor

Commit pack that enables instantiation of Arguments object.

Related issue: #53

@ruben-ayrapetyan ruben-ayrapetyan added normal ecma core Related to core ECMA functionality development Feature implementation labels May 26, 2015
@ruben-ayrapetyan ruben-ayrapetyan added this to the Core ECMA features milestone May 26, 2015
@egavrin
Copy link
Contributor

egavrin commented May 27, 2015

@ruben-ayrapetyan there are some tests related to Arguments in
https://github.com/Samsung/jerryscript/blob/master/tests/jerry-test-suite/unsupported_list.
Could you enable them?

@egavrin egavrin self-assigned this May 27, 2015
*/
typedef enum : idx_t
{
OPCODE_SCOPE_CODE_FLAGS__NO_FLAGS = (0u), /**< initializer for empty flag set */
Copy link
Contributor

Choose a reason for hiding this comment

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

Why double _?
Maybe OPCODE_SCOPE_CODE_FLAGS_EMPTY would be the better name?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Double _, because the value doesn't actually represent any functional flag.
So, it is a special value. To separate it from other values, I've added second _.
The syntax is also used in other places, like __COUNT in the following:

/**
 * Identifiers of ECMA and implementation-defined magic string constants
 */
typedef enum
{
#define ECMA_MAGIC_STRING_DEF(id, ascii_zt_string) \
     id,
#include "ecma-magic-strings.inc.h"
#undef ECMA_MAGIC_STRING_DEF

  ECMA_MAGIC_STRING__COUNT /**< number of magic strings */
} ecma_magic_string_id_t;

or

ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_COLON_CHAR, ":")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_COMMA_CHAR, ",")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING_SPACE_CHAR, " ")
ECMA_MAGIC_STRING_DEF (ECMA_MAGIC_STRING__EMPTY, "")

`OPCODE_SCOPE_CODE_FLAGS_EMPTY` would be similar to naming of other flags, so code `scope_flags = OPCODE_SCOPE_CODE_FLAGS_EMPTY;` could be read as something like "we mark that the scope's code has some 'empty' property".

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. OPCODE_SCOPE_CODE_FLAGS__EMPTY?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@ruben-ayrapetyan
Copy link
Contributor Author

@ruben-ayrapetyan there are some tests related to Arguments in
https://github.com/Samsung/jerryscript/blob/master/tests/jerry-test-suite/unsupported_list.
Could you enable them?

@egavrin , ok. Should the changes be placed in separate commit?

@ruben-ayrapetyan ruben-ayrapetyan force-pushed the Ruben-instantiate-arguments-object branch from a6bd26f to 74ac051 Compare May 27, 2015 13:02
@ruben-ayrapetyan
Copy link
Contributor Author

I've updated pull request:

  • fixed changes according to notes;
  • enabled tests from jerry-test-suite;
  • fixed an issue, revealed with enabled tests.

Please, review.

@sand1k
Copy link
Contributor

sand1k commented May 27, 2015

LGTM (regarding changes in parser).

@egavrin
Copy link
Contributor

egavrin commented May 27, 2015

@egavrin , ok. Should the changes be placed in separate commit?

@ruben-ayrapetyan please, add this with a separate commit to this branch.

@ruben-ayrapetyan ruben-ayrapetyan force-pushed the Ruben-instantiate-arguments-object branch 2 times, most recently from 87eda19 to f7dd511 Compare May 27, 2015 17:49
@ruben-ayrapetyan
Copy link
Contributor Author

@egavrin , I've updated pull request:

  • separated commit that enables jerry-test-suite's tests related to Argument object.

@ruben-ayrapetyan ruben-ayrapetyan force-pushed the Ruben-instantiate-arguments-object branch from f7dd511 to 297d976 Compare May 27, 2015 18:05
@ruben-ayrapetyan
Copy link
Contributor Author

@egavrin , I've updated pull request:

  • replaced OPCODE_SCOPE_CODE_FLAGS__NO_FLAGS with OPCODE_SCOPE_CODE_FLAGS__EMPTY.

@ILyoan ILyoan mentioned this pull request May 28, 2015
9 tasks
@ruben-ayrapetyan ruben-ayrapetyan assigned galpeter and unassigned egavrin May 28, 2015
@ruben-ayrapetyan
Copy link
Contributor Author

@galpeter , please, review.


void
rewrite_scope_code_flags (opcode_counter_t scope_code_flags_oc,
opcode_scope_code_flags_t scope_flags)
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing comments on parameters and about the method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I'll add.
Unfortunately, in the component the style was not used before.
However, maybe, it is better to update the component step by step, fixing style in it.

@ruben-ayrapetyan ruben-ayrapetyan force-pushed the Ruben-instantiate-arguments-object branch 2 times, most recently from d832d9c to 193ad5e Compare May 28, 2015 14:18
@ruben-ayrapetyan
Copy link
Contributor Author

@galpeter , I've updated pull request according to your comments. Please, review.

@galpeter
Copy link
Contributor

@ruben-ayrapetyan, looks good to me.

@ruben-ayrapetyan ruben-ayrapetyan assigned egavrin and unassigned galpeter May 28, 2015
@ruben-ayrapetyan
Copy link
Contributor Author

@galpeter, ok, thank you for review.

 init_int -> vm_init;
 run_int -> vm_run_global;
 run_int_loop -> vm_loop;
 run_int_from_pos -> vm_run_from_pos;
 read_opcode -> vm_get_opcode.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
…e various properties of a scope; replacing 'strict mode' meta opcode with a flag in the flags set.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
…ce 'arguments' and 'eval' identifiers.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
…ect should be instantiated upon call of the function.

 The Arguments object is supposed to be unnecessary if function's code:
  - doesn't reference 'arguments' identifier;
  - doesn't reference 'eval' identifier (so, it doesn't perform direct call to eval).

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
…g and removing them from unsupported list.

JerryScript-DCO-1.0-Signed-off-by: Ruben Ayrapetyan [email protected]
@ruben-ayrapetyan ruben-ayrapetyan force-pushed the Ruben-instantiate-arguments-object branch from 193ad5e to 77df022 Compare May 28, 2015 16:13
@egavrin
Copy link
Contributor

egavrin commented May 29, 2015

OK, make push

@ruben-ayrapetyan ruben-ayrapetyan merged commit 77df022 into master May 29, 2015
@ruben-ayrapetyan ruben-ayrapetyan deleted the Ruben-instantiate-arguments-object branch May 29, 2015 08:17
@ruben-ayrapetyan
Copy link
Contributor Author

I'm not sure how it happened, but it seems that update, adding comments to dump_scope_code_flags_for_rewrite and rewrite_scope_code_flags, was somehow lost - there are no comments in master, nor in the pull request.

I'll fix this, adding the changes through separate pull request.

@ruben-ayrapetyan
Copy link
Contributor Author

The same for update, adding test function f (arguments) { ... }.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Feature implementation ecma core Related to core ECMA functionality normal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants