-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Implemented every, some, includes, and reduce for array.prototype as JsBuiltIn #5723
Implemented every, some, includes, and reduce for array.prototype as JsBuiltIn #5723
Conversation
Oh no, I wrote all of my initial comments on your other PR. Please cross-reference as needed :) |
PS, for rebasing, I find it easiest to make the bytecode updates completely separate. So, when you have local changes, |
a65f6fd
to
e2a493e
Compare
Just thought I should note; I experimented with an Array.prototype.every implementation ages ago: rhuanjl@71ee608 That was in response to this discussion on node-chakracore: nodejs/node-chakracore#527 But I did not submit it as it actually showed a performance regression - I tried re-running the case from that issue today but it doesn't run at all with the latest node-chakracore with cc master so can't check the performance impact of this on it anymore. |
@rhuanjl Thank you for the input, do you know of a another way to repro the testing in that previous discussion? |
@rhuanjl I don't think I'd block on that. I can take a look separately and see why it's not working with the latest node-chakracore, it did build successfully with 10.6.0, but I haven't tried with a newer version. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. have you run test262 to confirm there are no regressions in spec compliance?
@@ -363,27 +365,245 @@ | |||
platform.registerFunction(platform.FunctionKind.Array_forEach, function (callbackfn, thisArg = undefined) { | |||
// ECMAScript 2017 #sec-array.prototype.foreach | |||
|
|||
//Let O be ? ToObject(this value). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for adding the spec comments.
@kfarnung I just wanted to flag it as whilst that test doesn't run at all now when I experimented with a Jsbuiltin Array.prototype.every before - intending to improve its performance it actually made it worse. |
return undefined; | ||
}); | ||
|
||
platform.registerFunction(platform.FunctionKind.Array_some, function (callbackfn, thisArg = undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spoken in person, but please check the typedarray performance change on these apis.
d4db7c0
to
53017fb
Compare
@dotnet-bot test this please |
lib/Runtime/Library/JsBuiltInEngineInterfaceExtensionObject.cpp
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dotnet-bot test Windows 10 x64_debug |
Temporarily retargeted this PR to master-ci to use a different Jenkins server. Please target back to master before merging. |
318beb1
to
dc65f46
Compare
JavascriptError::ThrowTypeError(scriptContext, VBSERR_ActionNotSupported); | ||
if (typedArrayBase) | ||
{ | ||
JavascriptError::ThrowTypeError(scriptContext, JSERR_EmptyArrayAndInitValueNotPresent, _u("TypedArray.prototype.reduce")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypedArray [](start = 111, length = 10)
TypedArray is a synthetic/catch-all type (not a user visible type) -- would this error message be confusing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's pretty well-known for a type that never actually shows up in JS code (it's on MDN, for example). Elsewhere in this file we use [TypedArray]
to hint at it not being a real type; would that be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jackhorton We spoke on this [TypedArray] vs TypeArray, I'm curious on your thoughts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
V8 doesnt say TypedArray" in its error, but the TypedArray constructor is technically visible. Also, the actual method is TypedArray.prototype.reduce -- all of the actual constructors (UInt8Array, etc) get it from the TypedArray prototype. So I voted in favor of just calling it what MDN calls it, which is TypedArray.prototype.reduce
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ENABLE_JS_BUILTINS is a compile-time macro. IsJsBuiltInEnabled is controlled by the -jsBuiltIns flag. |
…recursive loop to iterative in MayHaveSideEffectOnNode to avoid a stack overflow. Merge pull request chakra-core#5739 from wyrichte:build/wyrichte/stack_overflow_1
Merge pull request chakra-core#5733 from yullin-ms:argLenAndConstOptPhaseTwo This is to do inline arg optimization when we do argument length and argument constant optimizations
… not number for float type specialization Merge pull request chakra-core#5743 from nhat-nguyen:BailOutFloatTypeSpec
…ackArgsOpt Merge pull request chakra-core#5744 from nhat-nguyen:stackargs `DoStackArgsOpt` takes a `topFunc` parameter but doesn't use it. It seems like the intention is to pass it to `IsStackArgsEnabled`, but `topFunc` is actually referenced inside `IsStackArgsEnabled` through a pointer in m_func, making passing in the argument unnecessary.
dc65f46
to
540a95d
Compare
540a95d
to
45c0553
Compare
…, and reduce for array.prototype as JsBuiltIn Merge pull request chakra-core#5723 from yullin-ms:arrayEverySomeIncludesReduce Implemented every, some, includes, and reduce for array.prototype as JsBuiltIn
Implemented every, some, includes, and reduce for array.prototype as JsBuiltIn