Skip to content

Conversation

@obastemur
Copy link
Collaborator

  • Implement RegisterModuleSource
  • es6-modules: add more test cases and move it to separate folder

Fixes #4577

Copy link
Contributor

@jackhorton jackhorton left a comment

Choose a reason for hiding this comment

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

I am pretty sure that there are memory leaks in the new AutoString/FileNode/SourceMap code. Could it be altered to use RAII and const references and fewer pointers?

{
if (!HostConfigFlags::flags.MuteHostErrorMsgIsEnabled)
// check if have it registered
AutoString *data;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since data is a pointer, I don't think the AutoString destructor will run -- is that an issue?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It shouldn't run by design and intention. See constructor. It takes over the ownership (there is a comment). Source code map lifetime == process lifetime.

@obastemur
Copy link
Collaborator Author

I am pretty sure that there are memory leaks in the new AutoString/FileNode/SourceMap code. Could it be altered to use RAII and const references and fewer pointers?

Could you please point them out?

@jackhorton
Copy link
Contributor

So I think the part I am considering leaking is https://github.com/Microsoft/ChakraCore/pull/4582/files#diff-05783da3b8bba4fa92445ddb47da7d51R309, where we new without ever deleting. I suppose thats fine since the FileNodes are never removed from the linked list, but a comment explaining why that new was safe would be nice.

Copy link
Contributor

@jackhorton jackhorton left a comment

Choose a reason for hiding this comment

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

Altering changes requested to a comment.

@rhuanjl
Copy link
Collaborator

rhuanjl commented Jan 20, 2018

Will the idea in time to be to move most tests out of the separate files and into the combined files with this new API?

Seems great from the perspective of making the tests easier to update and keep track of. My only concern would be if we dropped all of the separate tests the file loading routines would stop getting tested - this may be a ch only issue and not a chakracore issue but probably best to keep them intact.

@obastemur
Copy link
Collaborator Author

@rhuanjl there is no greater plan here. I just saw an opportunity to use tests from our internal testing tool and implemented the interface. ++ moved the tests into sep. folder.

I wouldn't change any of the existing tests but going forward we better use the new interface instead of adding more files.

chakrabot pushed a commit that referenced this pull request Jan 21, 2018
Merge pull request #4583 from rhuanjl:moduleAgain

This re-fixes #4482

Notes:
1. Test case was previously dependent on load order. Load order was changed which made the issue appear to be fixed (and test pass) when it wasn't actually fixed. - Test case revised to trigger issue irrespective of load order.
2. Have to complete all ModuleDeclarationInstantiation before we generate any root functions to ensure this issue can never occur.

Conscious the test case may need moving to fit with #4582
@chakrabot chakrabot merged commit a782b4e into chakra-core:release/1.8 Jan 21, 2018
chakrabot pushed a commit that referenced this pull request Jan 21, 2018
…leSource

Merge pull request #4582 from obastemur:module_register__

- Implement RegisterModuleSource
- es6-modules: add more test cases and move it to separate folder

Fixes #4577
chakrabot pushed a commit that referenced this pull request Jan 21, 2018
Merge pull request #4583 from rhuanjl:moduleAgain

This re-fixes #4482

Notes:
1. Test case was previously dependent on load order. Load order was changed which made the issue appear to be fixed (and test pass) when it wasn't actually fixed. - Test case revised to trigger issue irrespective of load order.
2. Have to complete all ModuleDeclarationInstantiation before we generate any root functions to ensure this issue can never occur.

Conscious the test case may need moving to fit with #4582
chakrabot pushed a commit that referenced this pull request Jan 21, 2018
…ircular children

Merge pull request #4583 from rhuanjl:moduleAgain

This re-fixes #4482

Notes:
1. Test case was previously dependent on load order. Load order was changed which made the issue appear to be fixed (and test pass) when it wasn't actually fixed. - Test case revised to trigger issue irrespective of load order.
2. Have to complete all ModuleDeclarationInstantiation before we generate any root functions to ensure this issue can never occur.

Conscious the test case may need moving to fit with #4582
chakrabot pushed a commit that referenced this pull request Jan 22, 2018
…gisterModuleSource

Merge pull request #4582 from obastemur:module_register__

- Implement RegisterModuleSource
- es6-modules: add more test cases and move it to separate folder

Fixes #4577
chakrabot pushed a commit that referenced this pull request Jan 22, 2018
… implement RegisterModuleSource

Merge pull request #4582 from obastemur:module_register__

- Implement RegisterModuleSource
- es6-modules: add more test cases and move it to separate folder

Fixes #4577
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