Skip to content
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

BAAS-16552: update goja to latest changes (part 1) #71

Merged
merged 26 commits into from
Feb 23, 2023
Merged

BAAS-16552: update goja to latest changes (part 1) #71

merged 26 commits into from
Feb 23, 2023

Conversation

Gabri3l
Copy link

@Gabri3l Gabri3l commented Oct 19, 2022

Included commits

BAAS patch

Link to baas patch running against baas 🤞🏼

Our changes

  • I had to make a change here to make sure we grabbed the wrapped error since the value used in these changes is always nil now.
  • Just a small fix after rebasing here
  • Fixing the formatting as a drive-by from this ticket in a separate commit

dop251 and others added 23 commits February 10, 2023 12:53
…alue. See dop251#340

Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 4549f2c)
With this simplified code it skips some allocations of byte slices

```
 benchstat old.bench new.bench
 name           old time/op    new time/op    delta
 ASCIIConcat-8    44.3µs ± 5%    40.2µs ±12%   -9.18%  (p=0.000 n=10+10)

 name           old alloc/op   new alloc/op   delta
 ASCIIConcat-8    14.0kB ± 0%     9.9kB ± 0%  -29.28%  (p=0.000 n=10+10)

 name           old allocs/op  new allocs/op  delta
 ASCIIConcat-8       131 ± 0%       121 ± 0%   -7.63%  (p=0.000 n=10+10)
```

Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 989602c)
…or messages. Fixes dop251#343

Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 1309139)
…uplicate names. Fixes dop251#344.

Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 676aa9f)
… but widely implemented Error.stack property. Closes dop251#337.

Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 100e3a1)
Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit dd589aa)
Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 0bc6d0e)
…#351

Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit a03b258)
Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 68467fa)
Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 06ae6b2)
Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 3649f4d)
Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 6e6f57d)
Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 336e1ad)
Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit d9c6733)
Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit f397cb3)
Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 1408985)
Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit c487fa8)
Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit d26b426)
… for the date being unset. Upgraded tc39 tests.

Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 945df7a)
…ssable structs and arrays are copied in ToValue() so they remain writable in ES. Subsequent Export() returns the value including any changes made.

Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 47311be)
…on-array values into slices. Fixes dop251#369, closes dop251#370.

Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit 93b7349)
…o function. Do not treat callables (functions) as array-like when exporting to slices. Fixes dop251#369.

Signed-off-by: Gabri <gabriele.cimato@gmail.com>
(cherry picked from commit a23ee90)
@kpatel71716
Copy link

Looks like some changes need to be pulled into this branch, but this LGTM otherwise

Copy link

@kpatel71716 kpatel71716 left a comment

Choose a reason for hiding this comment

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

LGTM this looks great! I went through areas we know we have custom logic and am relying on these tests and baas tests for sanity checks

runtime_test.go Show resolved Hide resolved
Comment on lines -299 to -316
func toIntIgnoreNegZero(v Value) (int64, bool) {
num := v.ToNumber()
if i, ok := num.(valueInt); ok {
return int64(i), true
}
if i, ok := num.(valueInt64); ok {
return int64(i), true
}
if f, ok := num.(valueFloat); ok {
if v == _negativeZero {
return 0, true
}
if i, ok := floatToInt(float64(f)); ok {
return i, true
}
}
return 0, false
}

Choose a reason for hiding this comment

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

nice! This has been a minor pain historically

@@ -367,7 +367,6 @@ func TestMemCheck(t *testing.T) {
`,
7 + 3 + // Error "message" field + len("abc")
4 + 5 + // Error "name" field + len("Error")
5 + // Error "stack" field + len("") since stack is currently always set to an empty string

Choose a reason for hiding this comment

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

nice! Good too see this temporary stubbing go away

@Gabri3l Gabri3l merged commit 2311753 into mongodb-forks:realm Feb 23, 2023
@Gabri3l Gabri3l deleted the BAAS-16552-part-1 branch February 23, 2023 22:21
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.

5 participants