100 Commits
Author SHA1 Message Date
Igor Sheludko 46d7ec6f7d [api] Fix typo in v8::FunctionCallbackInfo<T>::Data()
Somehow Clang is able to compile the call to GetFunctionTemplateData()
even though it was defined in "api_internal" namespace (the change
was made here: https://crrev.com/c/5587862).
This CL adds a missing namespace prefix.

Bug: 326505377
Change-Id: If880e576a65a1e125b71ebdb2176976a3f37b85f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5623375
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94390}
2024-06-12 09:50:01 +00:00
Igor Sheludko 718d9b613a [api] Remove deprecated v8::Object[Template]::SetAccessor(..)
... and a notion of "special data property" which used to represent
JavaScript spec compliant native data properties. Now all data
properties in V8 are spec-compliant.

Drive-by:
 - remove deprecated typedefs v8::AccessorGetterCallback and
   v8::AccessorSetterCallback,
 - start deprecation of v8::AccessControl enum.

Bug: 336325111
Change-Id: Ie31ac57b40a4fdd5277aaa6e0283a68fb4a0daac
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5607994
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94367}
2024-06-11 11:22:50 +00:00
Igor Sheludko 03202a5fe0 [builtins] Optimize and simplify CallApiCallbackXXX builtins
Simplification:
 - a tighter intergration with the ApiCallbackExitFrame's layout,
   where the v8::FunctionCallbackInfo<T> object and its fields have
   dedicated locations addressable via fp,
 - unification of the Generic and Optimized versions of the builtin,
 - don't store the number of bytes to drop on the stack, use
   FunctionCallbackInfo::length_ instead,
 - cleaner code,
 - it's no longer necessary to attach a frame state when inlining an
   Api call into optimized code in order to support
   --experimental-stack-trace-frames.

Optimization:
 - avoid passing argc and v8::FunctionTemplateInfo twice to the Generic
   version,
 - less code for both generic and optimized versions.

Bug: 326505377
Change-Id: I426459f2784e42c0b1bfcb39259fd04e3512feea
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5587866
Reviewed-by: Patrick Thier <pthier@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94361}
2024-06-11 10:07:21 +00:00
Igor Sheludko 0e2851fe40 [counters] Add counters for document.all() usages
Bug: 345640555
Change-Id: I79f6fd9aa0289ed79bd6c74059228b2178f60d93
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5607993
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94313}
2024-06-07 11:42:24 +00:00
Igor Sheludko 57333e9ab7 Reland "[api] Deprecate v8::FunctionCallbackInfo::Holder() for real"
This is a reland of commit 92e6e59ead
The issue was fixed here: https://crrev.com/c/5604325

Original change's description:
> [api] Deprecate v8::FunctionCallbackInfo::Holder() for real
>
> ... by marking it as V8_DEPRECATED.
>
> Bug: 333672197
> Change-Id: Iab9bc323aaebc2ecbc2df30ab1d9a11d1641748a
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5463126
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Commit-Queue: Igor Sheludko <ishell@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#94291}

Bug: 333672197
Change-Id: I412cdaf71d85123893f908b839b078dfa15e2349
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5604487
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94306}
2024-06-07 09:16:13 +00:00
Igor Sheludko afdfee3367 [api] Mark v8::Object::GetPrototype() for deprecation
... and replace usages with GetPrototypeV2(). The difference between
the two is that the former returns JSGlobalObject for JSGlobalProxy
while the latter behaves like JavaScript's Object.getPrototypeOf(..)
and thus never returns JSGlobalObject.

This is a step towards never exposing JSGlobalObject via Api.

This CL updates usages in tests non-involving global object and
suppresses the deprecation warnings for tests involving global object.

Bug: 333672197
Change-Id: I7b1cb4c5b7234613a39f652fd9bb8d7b8839a3fb
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5600627
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94295}
2024-06-06 18:00:09 +00:00
Igor Sheludko 92e6e59ead [api] Deprecate v8::FunctionCallbackInfo::Holder() for real
... by marking it as V8_DEPRECATED.

Bug: 333672197
Change-Id: Iab9bc323aaebc2ecbc2df30ab1d9a11d1641748a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5463126
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94291}
2024-06-06 14:55:13 +00:00
Igor Sheludko 64ca42b659 [api] Mark v8::Object::SetPrototype() for deprecation
... and replace usages with SetPrototypeV2(). The difference between
the two is that the former works for JSGlobalObject (both as receiver
and prototype value) while the latter behaves like JavaScript's
Object.setPrototypeOf(..) and hits a CHECK failure in case
JSGlobalObject is provided.

This is a step towards never exposing JSGlobalObject via Api.

This CL updates usages in tests non-involving global object and
suppresses the deprecation warnings for tests involving global object.

Bug: 333672197
Change-Id: I053599548ce5b9f7c37bd8927b4d0253e313729e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5600626
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94290}
2024-06-06 14:03:14 +00:00
Igor Sheludko ac2230aacf [api] Mark v8::PropertyCallbackInfo::Holder() for deprecation
... and introduce a replacement HolderV2() which never returns
JSGlobalObject. The new Api is not optimized for performance yet.

Bug: 333672197
Change-Id: I214eb38946d93d932aeaf7e18001767912979041
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5600766
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94289}
2024-06-06 13:57:31 +00:00
Igor Sheludko 1c68c992a6 [builtins] Cleanup side-effects checks for Api functions
This should reduce the overhead of Api function calls with enabled
profiling since we don't have to iterate the stack anymore in order
to get current FunctionTemplateInfo.

Bug: 326505377
Change-Id: I937be23925a8ba11b0a9409c31a364a7b7a98799
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5587864
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94215}
2024-06-03 15:50:50 +00:00
Igor Sheludko eb0bb2596a [builtins] Replace v8::FunctionCallbackInfo::data field with target
Instead of passing FunctionTemplateInfo::callback_data field directly
in v8::FunctionCallbackInfo structure we now pass the target
FunctionTemplateInfo while still allowing lazy access to the data
value via the target.

The motivation is:
 - given that the data value is not needed for Blink's hot Api
   functions we can avoid eager loading of the data value
   in CallApiCallbackGeneric and thus improve non-optimized case,
 - doing so will allow us to remove the second copy of the
   FunctionTemplateInfo that was saved on the stack for
   CallApiCallbackGeneric in order to support (currently disabled)
   --experimental-stack-trace-frames,
 - being able to reach the FunctionTemplateInfo allows us to
   preprocess exceptions thrown from Api functions more lazily and
   reduce the work on Blink side,
 - it will allow us to reduce overhead of Api calls in generic case
   when profiling is enabled.

Bug: 326505377, 328104148
Change-Id: I1a05e55ca9730077dc6e6fe1c940f8a1384a4aff
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5587862
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94212}
2024-06-03 14:43:22 +00:00
Igor Sheludko 2b52d23e4f [fast-api-calls] Refactor FastApiCall node inputs manipulation
... and duplicate callback data parameter for fast mode calls.

This is a preparation for passing FunctionTemplateInfo to slow mode
builtins (CallApiCallbackOptimizedXXX) instead of callback data
without changing behavior for fast Api calls.

Bug: 326505377
Change-Id: Idcdb56fdb707a778e2217f6338f93108449ccaf9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5587861
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94208}
2024-06-03 13:29:38 +00:00
Igor Sheludko 7fce9ad0b3 [api] Deprecate v8::Object[Template]::SetAccessor(..)
These methods will be removed in V8 12.8.

Also deprecate unused v8::AccessorGetterCallback and
v8::AccessorSetterCallback typedefs and a v8::PropertyCallbackInfo
constructor.

Bug: 336325111
Change-Id: Id16269213072dd1c18672d2fbd5c9997187e6c19
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5587951
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94193}
2024-06-03 09:25:34 +00:00
Igor Sheludko 2793c57088 [builtins] Add ApiAccessorExitFrame for CallApiGetter builtin
This will allow stack iterator to get to the v8::PropertyCallbackInfo
object (and later to AccessorInfo object corresponding to the property
being accessed). This is necessary for preprocessing exceptions thrown
from Api functions more lazily and reduce the work on Blink side.

Bug: 328104148
Change-Id: I685c8eebafab5b0459f401f7934e5dd272ca3020
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5587947
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94192}
2024-06-03 08:58:31 +00:00
Igor Sheludko 5d111063b5 [arm][builtins] Cleanup ExitFrame related code
This CL makes the following changes:
 - adds explicit scratch register argument to Enter/LeaveExitFrame,
 - removes argument dropping from LeaveExitFrame which makes it uniform
   with other main architectures and unblocks accessing the exit frame
   arguments after the exit frame is dropped,
 - refactors register usage in CEntry implementation,
 - uses ExternalReferenceAsOperand(ER, no_reg) to generate less
   instructions.

Bug: 328104148
Change-Id: I3333ea2f05e999fd405565d2d5dcfeba21e3c080
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5570125
Reviewed-by: Patrick Thier <pthier@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#94081}
2024-05-24 16:38:27 +00:00
Igor Sheludko b7e2046e32 [api] Deprecate old indexed interceptors Api
... and remove v8::ObjectTemplate::SetIndexedPropertyHandler() which
was deprecated in V8 12.6.

The old indexed interceptors Api will be removed in V8 12.8.

Bug: 328490288
Change-Id: I8b030ef3199a08bbee80221cdaabcd2235233f47
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5465513
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93937}
2024-05-16 08:32:11 +00:00
Igor Sheludko 8889c7dc21 [api] Mark v8::ObjectTemplate::SetAccessor(..) for deprecation
... and advance deprecation status for v8::Object::SetAccessor(...).

Bug: 336325111
Change-Id: I53fd17680805d7f59beb9bba234d5f8076e08031
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5465511
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93772}
2024-05-07 14:21:00 +00:00
Igor Sheludko 4d06060a08 [inspector] Stop using deprecated v8::ObjectTemplate::SetAccessor(..)
... in inspector tests and use SetNativeDataProperty(..) instead.

In case the setter callback is not provided, SetNativeDataProperty(..)
installs a setter callback that reconfigures the property to a true
data property and thus subsequent reads will no longer trigger the
original getter callback.

Bug: 336325111
Change-Id: I5e53ad3d106bec89e3b294420b6813d8311bfe97
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5512705
Reviewed-by: Simon Zünd <szuend@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93751}
2024-05-07 08:52:35 +00:00
Igor Sheludko 7936ca6d8b [api] Isolatify v8::Context::GetAlignedPointerFromEmbedderData(..)
This will allow to remove a couple of instructions from the hot path.

Bug: 336738728
Change-Id: I9d3311fc386e1c324f2f1ce011c1c45ac6ac64ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5516586
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93742}
2024-05-06 17:08:13 +00:00
Igor Sheludko 3f90a947ba [api] Add v8::Object::GetCreationContext[Checked](v8::Isolate*)
... and an overload of
  v8::Object::GetAlignedPointerFromEmbedderDataInCreationContext()
with v8::Isolate* parameter.

Bug: 336738728
Change-Id: Ia780e99671b51499d3be6a7b6b44665b183c336b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5484027
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93713}
2024-05-05 20:13:31 +00:00
Igor Sheludko f1c90730da [tests] Stop using deprecated v8::ObjectTemplate::SetAccessor(..)
... for interceptor tests.
The getter/setter callbacks were used for checking whether the get/set
request was correctly handled by interceptor in a child object.

The usual replacement SetNativeDataProperty(..) doesn't fit here
because according to JavaScript spec the setter callback should not be
called in case a property is stored to a child object.
So, the tests are updated to use JavaScript accessor callbacks instead.

Bug: 336325111
Change-Id: I8ac6f160635cf1fbbbf90e7037bea18f076cc630
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5498423
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93674}
2024-05-02 11:07:36 +00:00
Igor Sheludko 36a7864eb8 [tests] Replace SetAccessor(..) usages with SetNativeDataProperty(..)
Despite a slight difference in behaviour of data properties defined
via the former from data properties defined via the latter the tests
updated in this CL don't depend on this difference.
So it's just a trivial renaming.

Bug: 336325111
Change-Id: I940f22ae94c3f2eae78a8585a0efa6f299b2674f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5498424
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93673}
2024-05-02 10:19:42 +00:00
Igor Sheludko 340bbc4b04 [d8][tests] Remove recently introduced d8.dom.Document_all
... in favour of %GetCallable(target_name).

d8.dom.Document_all was defined as undetectable which immediately
invalidated the NoUndetectableObjects protector. The CL where it was
introduced regressed benchmarks, this should hopefully recover some
of the regression.

The existing %GetCallable(target_name) function was changed to return
a callable object that redirects [[Call]] requests to
globalThis[target_name] function.

Update existing tests accordingly.

Bug: 335544085
Change-Id: Idd6140c38d6a3fc4cbe4b0a0ac6a8aa4d8a76f62
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5505451
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93672}
2024-05-02 10:18:39 +00:00
Igor Sheludko 5d84c48eb9 [api][cleanup] Remove SetAccessor and SetNativeDataProperty
... which were marked as V8_DEPRECATED in 12.5.

This CL removes
  v8::Template::SetNativeDataProperty(v8::Local<v8::String>, ...);
  v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>, ...);
and
  v8::Template::SetNativeDataProperty(...); with AccessControl parameter.

Bug: 326505377, 336325111
Change-Id: Iba80f26b2350b49cbe5b7532332508b5617f94ae
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5497515
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93657}
2024-04-30 15:15:11 +00:00
Igor Sheludko b1378683b3 [ic] Use slow handlers for non-callable JSFunction accessors
The IsJSFuncton() predicate returns true for class constructors which
are not callable and thus are not expected by CallFunction builtins.

This CL introduces IsCallableJSFuncton() predicate and fixes handling
of class constructors installed as property accessors which was broken
in https://crrev.com/c/5458075.

Bug: 336852492
Change-Id: I3042bbc543bb34a2109fbbf95673201cceaf23a9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5490093
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93613}
2024-04-26 12:16:16 +00:00
Igor Sheludko 201eb6cd45 [api] Deprecate old named interceptors Api
The old named interceptors Api will be removed in V8 12.7.

Bug: chromium:328490288
Change-Id: I7f52e196eba5d92215ec5ea8c60530a3bd6ea714
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5465509
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93521}
2024-04-23 09:10:42 +00:00
Igor Sheludko a8db7b0f3f [api] Deprecate ObjectTemplate::SetIndexedPropertyHandler(...)
It will be removed in V8 12.7.

Bug: chromium:328490288
Change-Id: I998661d28ab6aa368caec051c7f6af8f2dd42a00
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5463131
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93441}
2024-04-18 15:06:59 +00:00
Igor Sheludko a55b86df00 [runtime] Use correct new.target prototype
In case new.target is a constructor function without prototype slot
(i.e. Proxy constructor) we should query the "prototype" property.

Bug: v8:14707
Change-Id: Ice55e13aa230a2a5f4a29296a13160ab7fab9ae3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5461559
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93435}
2024-04-18 11:24:57 +00:00
Igor Sheludko aa07a1ad40 [ic] Store the setter in the FBV
For accessors, instead of storing the descriptor index + holder in the
StoreHandler, store the setter directly (avoiding the
map->descriptor->pair->setter hops). For the non-prototype case, where
there's no StoreHandler, store the AccessorPair directly as a weak
handler instead of the Smi handler. We can't store the setter here
directly, because it could be in new space, and then we can't use it in
the stub cache.

This is a follow-up for http://crrev.com/c/3865557.

Change-Id: I96e0cb4f55c2745a968e8e54e2e674132eaea770
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5458514
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93431}
2024-04-18 09:41:31 +00:00
Igor Sheludko a857c227f1 [csa] Introduce CallFunction
... and use it in IC dispatchers for calling getters and setters which
are known to be JSFunctions.
Use ConvertReceiverMode::kNotNullOrUndefined when applicable.

In case a non-JSFunction callable object is installed as getter or
setter slow stub is used. In order to test this functionality
the CL adds d8.dom.Document_all callable Api object which gets/sets
`globalThis.document_all_property` depending on number of arguments.

Change-Id: Id03b00e3dce848f1e53763b0293860bac1d48910
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5458075
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93417}
2024-04-17 14:13:47 +00:00
Igor Sheludko eee68c9df7 [api] Deprecate v8::FunctionCallbackInfo::Holder()
... in favour of v8::FunctionCallbackInfo::This().

This is a next step towards never exposing so-called hidden prototype
(i.e. JSGlobalObject) via the V8 Api. This will make the JSGlobalObject
a V8 internal thing and make the V8 Api closer to JavaScript spec.

Embedders that store pointers to C++ objects in JSGlobalObject's
internal fields should migrate their code to store the pointers in
internal fields of JSGlobalProxy (AKA v8::Context::Global()).

It's not allowed to use V8_DEPRECATE_SOON functionality in V8 tests,
so this CL temporarily introduces HolderSoonToBeDeprecated() method
preserving the old semantics in order to keep testing the old
machinery until all embedders are migrated to the new Api.

Bug: chromium:333672197
Change-Id: I0d555c8e95c55c46bff71f6db768573c3146deed
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5444829
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93327}
2024-04-11 19:22:12 +00:00
Igor Sheludko 5e139e98d1 [api] Introduce v8::Object::GetPrototypeV2()/SetPrototypeV2()
... as a replacement for soon to be deprecated
v8::Object::GetPrototype() and v8::Object::SetPrototype().

The new versions will act just like getting/setting of "__proto__"
property, i.e. they will never return or accept JSGlobalObject.

This is a first step towards never exposing so-called hidden prototype
(i.e. JSGlobalObject) via the V8 Api. This will make the JSGlobalObject
a V8 internal thing and make the V8 Api closer to JavaScript spec.

Bug: chromium:333672197
Change-Id: Ic850d6a041f443392586b868eccde637ded801d3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5447696
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93325}
2024-04-11 16:16:43 +00:00
Igor Sheludko 5243f676af [parser] Fix reparsing of anonymous classes
Use empty string as an anonymous class name when parsing instead of
nullptr. This makes class parsing and reparsing code uniform (the
latter gets the class name from SharedFunctionInfo where the anonymous
class' name is set to an empty string).

Bug: chromium:329693878
Change-Id: I3272f21d8000ec1c7f5dfb315277630974b917f1
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5380193
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93122}
2024-04-02 16:14:54 +00:00
Igor Sheludko 72d98331b5 [api] Add new v8::PropertyCallbackInfo constructor
This is a temporary workaround to ease migration of Chromium
bindings code to the new interceptors Api.

Bug: chromium:328490288
Change-Id: Ib0c940361766ce1f2adfcbb2eef3062407d0be21
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5401854
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#93073}
2024-03-27 16:32:44 +00:00
Igor Sheludko 6ec883986b [api][cleanup] Deprecate SetAccessor and SetNativeDataProperty
... which were marked as V8_DEPRECATE_SOON in 12.1 and 12.4.

This CL deprecates
  v8::Template::SetNativeDataProperty(v8::Local<v8::String>, ...);
  v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>, ...);
and
  v8::Template::SetNativeDataProperty(...); with AccessControl parameter.

Additionally, the CL marks the following typedefs as V8_DEPRECATE_SOON
  v8::AccessorGetterCallback,
  v8::AccessorSetterCallback.

Bug: chromium:326505377
Change-Id: If6f30b3aba9f55785c573faf4a307c6de0d175ab
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5383482
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92974}
2024-03-22 15:48:40 +00:00
Igor Sheludko e9cd3a6e49 [api][tests] Update tests for new interceptors Api, pt.3
... and mark the old interceptors Api as V8_DEPRECATE_SOON.

Drive-by: use anonymous namespaces instead of `static` in tests.

Bug: chromium:328490288
Change-Id: I58d40618048195e1243ec72c14fad830a59663f0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5372060
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92939}
2024-03-21 11:33:44 +00:00
Igor Sheludko 531bf3a211 [api][tests] Update tests for new interceptors Api, pt.2
... in order to be able to mark the old interceptors Api as
V8_DEPRECATE_SOON.

Drive-by: use anonymous namespaces instead of `static` in tests.

Bug: chromium:328490288
Change-Id: Ieadd0016bf6afa676b6543cc10053afbd7a59137
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5374905
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92897}
2024-03-19 14:56:06 +00:00
Igor Sheludko 28e0aa348e [api][wasm] Update Wasm for new interceptors Api
... in order to be able to mark the old interceptors Api as
V8_DEPRECATE_SOON.

Bug: chromium:328490288
Change-Id: Ibc01ece25f92672d8c5d6012cd16183f82e221a2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5374904
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92888}
2024-03-19 11:10:04 +00:00
Igor Sheludko 1c307dac01 [api][tests] Update tests for new interceptors Api, pt.1
... in order to be able to mark the old interceptors Api as
V8_DEPRECATE_SOON.

Drive-by: use anonymous namespaces instead of `static` in tests.

Bug: chromium:328490288
Change-Id: Ib74d222f479e2f714bc6998d58a4468040b63985
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5374903
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92886}
2024-03-19 10:56:28 +00:00
Igor Sheludko e7763c7710 [zone-stats] Enable resource integrity check for pako_inflate.js
Bug: chromium:328875408
Change-Id: I083095f76f0c84e8bf59767e9b0e1654d6a2a850
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5374906
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92880}
2024-03-18 15:32:08 +00:00
Igor Sheludko 7be1c32c08 [api] Introduce indexed interceptor callbacks with new signature
The new callback should return bool value indicating whether the
operation was intercepted. This replaces the old approach where
the callback used to return the hole value if the request wasn't
intercepted.

The new Api will allow us to remove the hole check for Api function
callback and native data properties accessor callbacks.

Tests will be migrated to the new Api in follow-up CLs.

Bug: chromium:328490288
Change-Id: I9dab518fd3b43daeee6a08a2781a5f0688619144
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5355689
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92733}
2024-03-08 14:03:52 +00:00
Igor Sheludko 42d9b5fc0d [api] Introduce named interceptor callbacks with new signature
The new callback should return bool value indicating whether the
operation was intercepted. This replaces the old approach where
the callback used to return the hole value if the request wasn't
intercepted.

The new Api will allow us to remove the hole check for Api function
callback and native data properties accessor callbacks.

Tests will be migrated to the new Api in follow-up CLs.

Bug: chromium:328490288
Change-Id: I6446529bbd454c698a2432566be853baa68a2f6a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5353146
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92732}
2024-03-08 14:00:20 +00:00
Igor Sheludko b1b4677539 [builtins-pgo] Fix cross-building on Linux host for Windows
Bug: chromium:327457581
Change-Id: I10f5bdd71e6f9697bf8a608cc1671d7064b278d7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5355690
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92728}
2024-03-08 11:13:02 +00:00
Igor Sheludko 46c241eb99 [api][cleanup] Deprecate accessor callbacks with Local<String>
It's been a while since a more generic accessor callbacks accepting
Local<Name> were introduced, so it's time to deprecate the old ones.

This CL deprecates
  v8::Template::SetNativeDataProperty(v8::Local<v8::String>, ...);
  v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>, ...);

Bug: chromium:326505377
Change-Id: Ie2d10de0625d64d40ea526fa05e94dc8fdf5fe51
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5344409
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92668}
2024-03-05 15:57:15 +00:00
Igor Sheludko 5bdda7d5ed [static-roots] Fix fast setting of a function callback return values
This CL ensures that the upper 32-bits of the ReturnValue<T> are never
ever modified by making SetInternal() function a bottleneck and using
it everywhere.

The issue was that setting a Smi value corrupted the upper 32-bits
and subsequent setting of an undefined/null/true/false didn't
recover them.

Drive-by: use SetNonEmpty() for relevant use cases.

Bug: v8:14445
Change-Id: I7f3da1469afed2f5c23e670e13ef89fdd7bf573a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5331689
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92621}
2024-02-29 17:02:59 +00:00
Igor Sheludko 76a5cea860 [runtime] Inline CallHandlerInfo into FunctionTemplateInfo
... and remove the former.

This CL removes one indirection when calling Api functions from
non-optimized code.

Bug: chromium:326505377
Change-Id: I3a9cf9ab27bf2e6dfb3d9edf36441b5310d672bd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5331530
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92611}
2024-02-29 14:17:51 +00:00
Igor Sheludko 4ff2d3237e [runtime] Prepare for inlining CallHandlerInfo into FunctionTemplateInfo
... which will allow to remove one indirection when calling Api
functions.

This CL
 - introduces custom visitor for FunctionTemplateInfo,
 - stores flags, length and instance type values as raw data and
   packs length and instance type into 32-bits value,
 - stores FunctionTemplateInfo instead of CallHandlerInfo as an
   instance call handler for callable ObjectTemplates.

The latter comes with a memory overhead because FunctionTemplateInfo is
bigger than CallHandlerInfo but it's ok since callable ObjectTemplates
are rarely used in practice. It also temporarily adds an additional
indirection when calling callable Api objects until the CallHandlerInfo
is inlined into FunctionTemplateInfo.

Bug: chromium:326505377
Change-Id: I0a6645f228f413ff5412403e05aee1dfceb65966
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5329250
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92597}
2024-02-29 09:09:56 +00:00
Igor Sheludko 792f32c947 [api] Refactor FunctionTemplate::New() and ObjectTemplate::New()
... by moving internal object allocation from api.cc to Factory.

This CL is a preliminary cleanup before inlining CallHandlerInfo object
into FunctionTemplateInfo.

Drive-by fixes:
 - remove unused TemplateInfo::tag field,
 - fix broken instance type range check for FunctionTemplateInfo,
 - untie embedder-provided instance types from V8-internal
   instance type range of JSApiObjects and expect value in the
   range [0, 1000] as proposed in the design doc (see v8:11476).

Bug: chromium:326505377, v8:11476
Change-Id: I109d8cc8b11f61389be58f6e5a7984dbeb8d3c41
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5317945
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92545}
2024-02-27 08:57:43 +00:00
Igor Sheludko 92b543461d [runtime] Fix HeapObject::RehashBasedOnMap()
... which missed some cases that required rehasing according to
HeapObject::NeedsRehashing().

This CL also adds a PushParamsAndDie instrumentation in order to
investigate attempts to rehash objects with non-existing instance
type values.

Bug: chromium:326043780
Change-Id: Ie13af1c335fcbf816e2de66d97ccb964d5d5fc9c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5309919
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92434}
2024-02-20 16:25:24 +00:00
Igor Sheludko 92bff23bde [api] Add missing field type check in DictionaryTemplate
... instance constructor.

Bug: chromium:1499222, b/41497140
Change-Id: I6059e807da378ae166bd33fb8a1e63adb7203935
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5293800
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92313}
2024-02-14 13:53:00 +00:00
Igor Sheludko 0c8b2a9236 [wasm] Fix handling of Wasm object receivers in Reflect.set()
Fixed: chromium:324772606
Change-Id: If464c68372f83faf75302f9c4f5f25c6db4e6449
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5289015
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92284}
2024-02-13 11:26:25 +00:00
Igor Sheludko 1b39b18629 [heap] Fix handling of not-yet deserialized NativeContext
... when accounting per NativeContext memory stats.

Bug: chromium:324117288
Change-Id: I52f3007a53dc915307042f3e53ddf4b28ca6c83f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5279451
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92258}
2024-02-09 17:42:26 +00:00
Igor Sheludko ca5617a78c [test262] Add a new staging test for Array.p.flatMap
Bug: v8:14306
Change-Id: Ibc7a04288a0c31bfcf601aa864e02b6c067045c2
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5259306
Reviewed-by: Shu-yu Guo <syg@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92174}
2024-02-02 17:04:09 +00:00
Igor Sheludko 1497b4f451 [wasm] Avoid wrapping of the module's start function
... in case it's an imported JSFunction. This is simpler than creating
a wrapper and setting its context. This also avoids breaking the
invariant about native context-specific maps:
  function->map->meta_map->native_context == function->native_context.

Drive-by: module's start function is a one-shot one, so we can clear
it once it's called.

Bug: chromium:1522153
Change-Id: Ic86a793ada04e4c9efa812378188a6797632a95f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5245552
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#92071}
2024-01-29 19:00:20 +00:00
Igor Sheludko 7ec811a0c1 [ic] Fix handling of attributes change in DefineOwnICs
DefineOwnICs have to handle stores to a non-enumerable properties
differently than StoreICs. The former must reconfigure the property
attributes to NONE while the latter can just store a value there.

Due to the above reason it's not correct to reuse StoreIC handlers
for DefineOwnICs, so this CL introduces a separate megamorphic stub
cache for DefineOwnICs.

This CL partially reverts https://crrev.com/c/5147214 because proto
handlers are actually used by DefineOwnICs for transitioning element
stores (see StoreHandler::StoreElementTransition).

Drive-by: fix printing of Define(Keyed|Named)OwnIC states.

Bug: v8:14493, chromium:1512391
Change-Id: Ia9f8ed731dfc1e45bb10f3b668734ddda27359b9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5217052
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91939}
2024-01-22 16:45:47 +00:00
Igor Sheludko 1384e75dc3 [builtins] Use CallBuiltin/TailCallBuiltin where possible, pt.9
Mostly mechanical change from
  __ Call(BUILTIN_CODE(isolate, XyZ), RelocInfo::CODE_TARGET);
  __ Jump(BUILTIN_CODE(isolate, XyZ), RelocInfo::CODE_TARGET);

to
  __ CallBuiltin(Builtin::kXyZ);
  __ TailCallBuiltin(Builtin::kXyZ);

Bug: v8:14496
Change-Id: I9a572a37409810b78ddbc055d378275cd4211d51
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5215648
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91922}
2024-01-19 12:15:39 +00:00
Igor Sheludko 2d9bc6737e [ic] Fix handling of proto handlers in DefineOwnICs
Drive-by: deduplicate slow handler code in HandleStoreICProtoHandler.

Bug: chromium:1512391
Change-Id: Icf8187b348cff81da4142b360b5253e9e6565461
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5147214
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91631}
2023-12-22 13:32:09 +00:00
Igor Sheludko 6cee62db89 [runtime] Fix CanSubclassHaveInobjectProperties predicate
... for all JSApiObjects (all of them are allowed to have inobject
properties, not just the first one - JS_API_OBJECT_TYPE).

Bug: chromium:1509910
Change-Id: Ie6a801ddc743372c7013ed020634e50dca5e2ed4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5147787
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91629}
2023-12-22 09:47:54 +00:00
Igor Sheludko 32548386ef [builtins] Track topmost script-having execution context
The topmost script-having execution context is defined by the Web IDL
spec here:
https://html.spec.whatwg.org/multipage/webappapis.html#topmost-script-having-execution-context)
In short it's the context of the topmost user JavaScript code if
available and it's used in the definition of the incumbent context
(see https://html.spec.whatwg.org/multipage/webappapis.html#incumbent-settings-object).

This CL adds machinery for tracking topmost script-having execution
context when it's known "for free" which allows to speed up
v8::Isolate::GetIncumbentContext() for those cases.

Bug: v8:13825
Change-Id: I52d137eabb91962bdde389018bcfa9aada3fde4a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5107110
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91614}
2023-12-20 17:56:53 +00:00
Igor Sheludko 3d40ea2a4f Reland "[builtins-pgo] Enable builtins reordering based on PGO profile"
This is a reland of commit f1d06b5c4a
The issue was fixed here: https://crrev.com/c/5119543

Original change's description:
> [builtins-pgo] Enable builtins reordering based on PGO profile
>
> Bug: v8:13938
> Change-Id: Ib26cb76b301446399cfd9e0e0fbc7486fad404a7
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5097212
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Auto-Submit: Igor Sheludko <ishell@chromium.org>
> Commit-Queue: Leszek Swirski <leszeks@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#91444}

Bug: v8:13938
Change-Id: I722127a9163dc4cfe4d7d489cf08010de88ae4c7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5120291
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91497}
2023-12-13 18:52:16 +00:00
Igor Sheludko d9894120b0 [builtins-pgo] Fix BuiltinsSorter
... which hasn't cleared the errno before calling to strtol().

Bug: v8:13938
Change-Id: I99219d33b95444d7851dc5534b6c3bdd22017d46
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5119543
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91496}
2023-12-13 17:34:04 +00:00
Igor Sheludko abe15d369c [isolate] Move top_backup_incumbent_scope_ to ThreadLocalTop
... in order to ensure that it's stashed with the other execution
state data when an Isolate is unlocked.

Add test/cctest/test-api-incumbent.cc with more tests for
Isolate::GetIncumbentContext() including a regression test for this
issue.

Bug: v8:13825
Change-Id: If6c5c7aec2793af98ae914bc47735ed025a5a1e6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5077502
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91481}
2023-12-13 11:25:31 +00:00
Igor Sheludko 9070edc086 [isolate] Fix broken GCC build
GCC doesn't like anonymous structs with non-trivial member types
introduced in https://crrev.com/c/5116498.

Bug: v8:13825
Change-Id: Id665b61549ac9f568fc57b4ff0a7e6c644328d29
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5119598
Reviewed-by: Patrick Thier <pthier@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91479}
2023-12-13 10:06:13 +00:00
Igor Sheludko dfb729c9bf [isolate] Align Isolate object by OS page size
... in order to make the layout of IsolateData in memory more
predictable so that we can ensure that the fields that are updated
together don't cross the CPU cache line boundary (assuming it's 64
bytes). This should make performance slightly less flaky.

Also group fields that are updated together
 - on every CEntry/CallApiCallback/CallApiGetter
   (see MacroAssembler::EnterExitFrame/LeaveExitFrame),
 - on every MacroAssembler::CallCFunction.

Bug: v8:13825
Change-Id: I74a1f0b47fa3ef793391b2c99438b7209be1a87c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5116498
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91477}
2023-12-13 08:37:34 +00:00
Igor Sheludko f1d06b5c4a [builtins-pgo] Enable builtins reordering based on PGO profile
Bug: v8:13938
Change-Id: Ib26cb76b301446399cfd9e0e0fbc7486fad404a7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5097212
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91444}
2023-12-11 10:28:35 +00:00
Igor Sheludko 412ecec107 [csa] Use CallBuiltin/TailCallBuiltin where possible, pt.8
... instead of CallStub/TailCallStub(Callable&, ...).

This will allow CSA to control which builtin calls/tailcalls what and
ensure that propagation of incumbent context through builtins is
correct.

Drive-by:
 - introduce code-stub-assembler-inl.h,
 - make it possible to call CodeAssembler::CallJS() not only with
   CallTrampoline descriptor (without new_target parameter) but also
   with JSTrampoline one (with new_target parameter).

Bug: v8:14496
Change-Id: I4391d310364d5a134af6647d45817adfa05c845b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5077500
Reviewed-by: Patrick Thier <pthier@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91431}
2023-12-08 13:54:38 +00:00
Igor Sheludko cf3e066e73 [builtin][tq] Fix bad DCHECK in Array.prototype.flat
Bug: v8:14306, chromium:1507416, chromium:1509252
Change-Id: I48ac9a43c8c9d8469f541b6ab7b715a09e37d3ad
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5097307
Commit-Queue: Patrick Thier <pthier@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91407}
2023-12-07 11:15:53 +00:00
Igor Sheludko b456a546ea [csa][interpreter] Use CallBuiltin/TailCallBuiltin where possible, pt.7
... instead of CallStub/TailCallStub(Callable&, ...).

This will allow CSA to control which builtin calls/tailcalls what and
ensure that propagation of incumbent context through builtins is
correct.

Bug: v8:14496
Change-Id: Ief3c858d422a34fd9a6eff2df60548eae87a2ab8
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5077499
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91369}
2023-12-06 13:09:27 +00:00
Igor Sheludko 8de6dcc377 [builtins][csa] Use CallBuiltin/TailCallBuiltin where possible, pt.6
... instead of CallStub/TailCallStub(Callable&, ...) and
Call/Jump(Handle<Code>, ...) for calling CEntry variants.

This will allow CSA to control which builtin calls/tailcalls what and
ensure that propagation of incumbent context through builtins is
correct.

Bug: v8:14496
Change-Id: I974e34a6459ce179f3afc18b0d38e7fceaa1a53a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5081997
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Darius Mercadier <dmercadier@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91368}
2023-12-06 11:59:33 +00:00
Igor Sheludko 05122fe4bf [builtin][tq] Fix Array.prototype.flat again
The case when the array growns during iteration was broken by the
previous fix (https://crrev.com/c/5087850).

Bug: v8:14306, chromium:1507416
Change-Id: Ic6756527beaa5f0c73cffe02fe4603853b88aa01
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5093835
Reviewed-by: Patrick Thier <pthier@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91367}
2023-12-06 11:54:49 +00:00
Igor Sheludko 5cf2a571d2 [csa] Use CallBuiltin/TailCallBuiltin where possible, pt.5
... instead of CallStub/TailCallStub(Callable&, ...).

This will allow CSA to control which builtin calls/tailcalls what and
ensure that propagation of incumbent context through builtins is
correct.

Bug: v8:14496
Change-Id: I01b1d14521831ab2c4bc2294c960d50f495dcef5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5079351
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Olivier Flückiger <olivf@chromium.org>
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91353}
2023-12-05 14:09:59 +00:00
Igor Sheludko d429a14600 [builtin][tq] Fix Array.prototype.flat
... which missed bounds check guarding against array length change.

Bug: v8:14306, chromium:1507416
Change-Id: I9f19deb16f0949120dff62459114369807281db0
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5087850
Reviewed-by: Olivier Flückiger <olivf@chromium.org>
Commit-Queue: Olivier Flückiger <olivf@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91350}
2023-12-05 13:03:05 +00:00
Igor Sheludko 02f1df5a60 [csa] Use CallBuiltin/TailCallBuiltin where possible, pt.4
... instead of CallStub/TailCallStub(Callable&, ...).

This will allow CSA to control which builtin calls/tailcalls what and
ensure that propagation of incumbent context through builtins is
correct.

Bug: v8:14496
Change-Id: Idafc2d7966117b43c379f80d88f0a021a0855dcd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5080875
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91345}
2023-12-05 11:19:53 +00:00
Igor Sheludko 4202afccdd [builtins] Use CallBuiltin/TailCallBuiltin where possible, pt.3
Mostly mechanical change from
  __ Call(BUILTIN_CODE(isolate, XyZ), RelocInfo::CODE_TARGET);
  __ Jump(BUILTIN_CODE(isolate, XyZ), RelocInfo::CODE_TARGET);

to
  __ CallBuiltin(Builtin::kXyZ);
  __ TailCallBuiltin(Builtin::kXyZ);

Bug: v8:14496
Change-Id: Ie425e672415d953ea864034fa05586c4b8677c3c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5079408
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91343}
2023-12-05 10:31:55 +00:00
Igor Sheludko 85fddc8861 [builtins] Use CallBuiltin/TailCallBuiltin where possible, pt.2
Use Builtins::Call/CallFunction instead of CodeFactory versions.

Drive-by:
 - in Generate_InterpreterPushArgsThenCallImpl use Call with given
   convert receiver mode instead of generic
   Call(ConvertReceiverMode::kAny) (x64 did it right unlike other
   architectures),
 - remove unnecessary jump in Generate_CallOrConstructForwardVarargs.

Bug: v8:14496
Change-Id: I13b0c18e25c5e63d8f8ff0326e8518728942f349
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5080235
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91333}
2023-12-04 19:15:36 +00:00
Igor Sheludko 063210c08c [builtins][masm] Use CallBuiltin/TailCallBuiltin where possible
... instead of Call/Jump via Handle<Code>. The latter ends up in the
former anyway but after several unnecessary checks.

Drive-by:
 - introduce builtins-inl.h and move there constexpr methods that
   compute Builtin id from various other parameters,
 - rename Builtins::GetXXXStub(...) to just Builtins::XXX(...).

Bug: v8:14496
Change-Id: Icc229c916a894a9f9011e72540ec6bea987eb50e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5079307
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91310}
2023-12-02 01:08:28 +00:00
Igor Sheludko 3ac31d5e88 [maps][snapshot] Fix serialization of contextful meta maps
The serialization machinery does not support forward references in
the map slot, i.e. when serialization of a map's map could cause
serialization of the map itself.
However with contextful meta maps this could potentially happen
because of the following reference chain:
  MAP -> meta map -> NativeContext -> ... -> MAP

We break this cycle by deferring serialization of the meta map's
native context.

Bug: chromium:1495743, v8:14460
Change-Id: I125cf7a6eedb085c26f27b3a7037088f92cf00b4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5054540
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91160}
2023-11-24 13:54:23 +00:00
Igor Sheludko acc1917b9d [maglev] Enable inlining of Api call builtin behind --future
Bug: chromium:1445925
Change-Id: Icf9774b829835477be55567cea299830eea89571
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5055809
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91137}
2023-11-23 11:13:50 +00:00
Igor Sheludko bb8a9b8a9e [maps] Remove incorrect DCHECK in CallOptimization::GetAccessorContext()
... as an object might have an accessor function from another context.
The DCHECK was added in https://crrev.com/c/5030191.

Bug: chromium:1495743, chromium:1503565
Change-Id: If5f0c5ff81ed2989072ebc2fa657c245c9b9fd7a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5050062
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#91096}
2023-11-21 17:17:15 +00:00
Igor Sheludko 3685b1eb2f [maps] Get object's creation context from the meta map
This CL simplifies implementation of JSReceiver::GetCreationContext()
which now loads creation context via
  object -> map -> meta map -> native context

instead of walking back the transition tree to the root map to get
the constructor to read the context from.

Bug: chromium:1495743
Change-Id: I466ddb05e4774ab134a436656569f536727d707e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5030191
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90934}
2023-11-14 18:34:02 +00:00
Igor Sheludko 3d1b64181c [maps] Use native context specific meta maps for all JSReceiver
... objects that must be tied to some native context.

The following JSReceiver objects are the exceptions:
 - JSObjects allocated in shared space,
 - remote Api objects,
 - JSMessageObject and JSExternalObject (they are just wrappers around
   a set of primitive values and exist only for the purpose of passing
   the data across V8 Api).

JSReceiver::GetCreationContext() still uses the old machinery but in
a follow-up CL it'll be replaced with a constant time version loading
the native context via
  object -> map -> meta map -> native context

Bug: chromium:1495743
Change-Id: I9f4765ca4a102d3617c5485e87b60471b5214387
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5017893
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90919}
2023-11-14 12:55:25 +00:00
Igor Sheludko 88347a628f [maps] Introduce native context specific meta maps
... and use them for all Context maps. Previously there was only one
meta map referencing itself via the map field.
Note that since meta map is not unique anymore the IsMap(obj)
predicate must check instance type.

This is a first step towards using native context specific meta maps
for all objects tied to a certain native context. This will allow us
to compute object's creation context in constant time via just the
following hops:
  object -> map -> meta map -> native context

Bug: chromium:1495743
Change-Id: If145c676677e77e2236591387a2c406634b50ff7
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5017773
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90891}
2023-11-13 15:13:43 +00:00
Igor Sheludko 6d09b90017 [runtime] Mark --feedback-normalization flag as experimental
... until we decide to move forward with it.

Bug: chromium:1417121, chromium:1495933
Change-Id: Ic56526e7a838ba2dd1c3eb2c4be5ae730b5c7c40
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5020713
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90890}
2023-11-13 15:12:40 +00:00
Igor Sheludko edd9a860d2 [message] Also clear pending message when swallowing an exception
... thrown during formatting of an error message.

Bug: chromium:1500898, v8:12439
Change-Id: I95a2490b19e992dc646cf236c93102b217121021
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5020709
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90880}
2023-11-13 11:21:29 +00:00
Igor Sheludko 67ccae7497 [promise] Clear pending message in PromiseConstructorLazyDeoptContinuation
Bug: chromium:1499200, chromium:1445821
Change-Id: I245035101d295b6d12efa12786f04136b806119e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5008114
Reviewed-by: Patrick Thier <pthier@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90784}
2023-11-07 10:50:17 +00:00
Igor Sheludko 961dd29ccf Reland "[maglev] Fix inlining Api call builtin"
This is a reland of commit 3281d2b6b0
The temporary fix is to disable code space compaction when
--maglev-inline-api-calls is enabled.

Original change's description:
> [maglev] Fix inlining Api call builtin
>
> ... which didn't work when the Maglev code had to be lazy
> deoptimized.
>
> Bug: v8:13825, chromium:1445925, chromium:1496606
> Change-Id: I640791a0ce1f8180cdc280382c0f7b0e5668d5dd
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4994337
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Commit-Queue: Igor Sheludko <ishell@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#90715}

Bug: v8:13825, chromium:1445925, chromium:1496606
Change-Id: Ic2c08540e6095d21d58c2e6058fe14006cd6ac5e
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5003146
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90763}
2023-11-06 16:02:12 +00:00
Igor Sheludko 3281d2b6b0 [maglev] Fix inlining Api call builtin
... which didn't work when the Maglev code had to be lazy
deoptimized.

Bug: v8:13825, chromium:1445925, chromium:1496606
Change-Id: I640791a0ce1f8180cdc280382c0f7b0e5668d5dd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4994337
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90715}
2023-11-02 16:40:38 +00:00
Igor Sheludko 62f65c5c08 [turbofan][promise] Clear pending message on Promise rejection
Bug: chromium:1445821
Change-Id: I3caf9157870444e0f05c203ae0b1c6fa87f9ba5a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4997346
Commit-Queue: Nico Hartmann <nicohartmann@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90712}
2023-11-02 15:02:29 +00:00
Igor Sheludko de71083aef [cleanup] Merge entered context and entered microtask context
Migration to context-based microtask queue has been completed in 2019.

Bug: v8:8124, v8:13825
Change-Id: I3981398c7fbf832f0a899f3110fdf317e0dbfd63
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4927208
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90388}
2023-10-12 13:43:52 +00:00
Igor Sheludko 665b9429c2 [ic] KeyedStoreIC_Megamorphic: lookup handlers in the stub cache
... and miss/put new handlers into the cache.

This improves manual property copying pattern where the KeyedStoreIC
becomes megamorphic because it sees different names while the target
object shape and a set of property names are mostly the same.

The idea is that in certain cases it's still cheaper to compute a
handler, put it into the megamorphic cache and perform lookups instead
of always doing a runtime call. This CL uses conservative approach and
enables such lookups only for JSApiObjects which usually have accessor
properties backed by Api functions in the prototype chain.

This CL improves Speedometer2.1/Inferno-TodoMVC by ~2-4%.

Change-Id: I08538d9533bb897df1d08940535cba1a3d8205a9
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4906266
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90386}
2023-10-12 12:59:30 +00:00
Igor Sheludko da8f97b63d [ic] Fix feedback vector update tracing
... when IC is called from an inlined function. Previous implementation
loaded feedback vector from an IC caller's frame's JSFunction instead
of using an explicitly provided one.

Drive-by: unify tracing output.

Change-Id: Iab72162ed0f3f64f783130aac84a27fdebfebded
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4906275
Commit-Queue: Patrick Thier <pthier@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90239}
2023-10-04 09:17:13 +00:00
Igor Sheludko 87bc3c7dbf [class][ic] Define private name on global object via runtime
Bug: chromium:1483944
Change-Id: I3ab3b0ac174041ea23d95d818b2e07d7199635ea
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4892850
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90144}
2023-09-26 14:29:46 +00:00
Igor Sheludko 475c8cdf9a [ptr-compr] Fix multi-cage mode
This CL introduces PtrComprCageAccessScope which sets/restores current
thread's pointer compression cage base values. It's supposed to be used
by V8 jobs accessing V8 heap outside of v8::Isolate::Scope or
i::LocalHeap or i::LocalIsolate scopes (they already ensure that the
cage base values are properly initialized).
For all other build modes PtrComprCageAccessScope is a no-op.

For simplicity reasons the multi-cage mode is made incompatible with
external code space.

Bug: v8:13788, v8:14292
Change-Id: I06c2d19a1eb7254fa7af07a17617e22d98abea9f
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4846592
Reviewed-by: Jakob Linke <jgruber@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Dominik Inführ <dinfuehr@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90075}
2023-09-21 10:49:18 +00:00
Igor Sheludko a2b5bc06e2 [maglev] Inline Api call builtin into generated code
... behind --maglev-inline-api-calls flag (disabled by default).

Bug: v8:13825, chromium:1445925
Change-Id: Ib1d262b80e852751da73319cc8d9773f310f50ac
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4714689
Reviewed-by: Jakob Linke <jgruber@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#90074}
2023-09-21 10:12:02 +00:00
Igor Sheludko 6aadb0a389 [builtins] Fix TypedArray constructor case for array like argument
The ConstructByArrayLike case didn't handle JSArray with hole values
properly on the fast path. Even though the JSArray is a fast one and
Array prototype and Symbol.iterator in untouched the hole values must
be converted to undefined because conversion of a value to number
might modify the Array's prototype chain and thus alter the result of
reading a hole from a temporary JSArray object created as a part of
IteratorToList step.

Bug: chromium:1470560
Change-Id: I6395df541aa41675df63c9d8dad86b0201cf8fed
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4852525
Reviewed-by: Jakob Linke <jgruber@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#89927}
2023-09-12 09:49:48 +00:00
Igor Sheludko a90aea1076 [runtime] Ensure that failed access check always throw
... even if the embedder's FailedAccessCheckCallback forgets to do so.

This cleans up handling of failed access checks and removes
unnecessary d8 flags --throw-on-failed-access-check and
--noop-on-failed-access-check.

Drive-by: Fix discovered issue with propagation of exceptions in
v8::Object::DefineOwnProperty and v8::Object::DefineProperty.

Bug: v8:13825, chromium:1453572
Change-Id: I4d91ac8f9115ea9d20a0aa8a079c862a01198715
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4594617
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#89766}
2023-09-04 09:46:11 +00:00
Igor Sheludko e701381964 [builtins] Prepare Api-calls related builtins for refactoring
1) expose FunctionCallbackInfo field offsets and size via
   FunctionCallbackArguments class,
2) [x64] make ExitFrameStackSlotOperand() accept offsets instead of
   slot indicies,
3) [ia32] rename ApiParameterOperand() to ExitFrameStackSlotOperand()
   and make it accept offsets instead of indices,
4) move all ExitFrameStackSlotOperand() to macro-assembler-XX.h,
5) move CallApiFunctionAndReturn() function from builtins-XX.cc to
   macro-assembler-XX.cc without any changes.

These are preliminary steps for inlining Api call builtin into Maglev.

Bug: v8:13825, chromium:1445925
Change-Id: Ida22ce8fe9a2b84aa48a4847d3642201abc26556
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4712105
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Victor Gomes <victorgomes@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#89155}
2023-07-24 15:27:33 +00:00
Igor Sheludko 15406f77ff [class] Remove DCHECK related to class member initializers reparsing
... introduced in crrev.com/c/4681439 by mistake.

Bug: chromium:1458565
Fixed: chromium:1467028
Change-Id: I660452bd3f7659fc6314d58ed259f030db06cb53
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4709586
Auto-Submit: Igor Sheludko <ishell@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#89130}
2023-07-24 08:24:30 +00:00
Igor Sheludko 14a1bbb2f4 [sparkplug] Enable Sparkplug and concurrent Sparkplug on mobile
... in order to unify mobile and desktop behaviour since all known
issues are fixed.

Bug: v8:12054
Change-Id: I8e75667c0ee7eb9f8620259a8830caefd38a2a3c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4705913
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#89090}
2023-07-21 10:39:46 +00:00
Igor Sheludko 5c8f1e6aed [class] Fix reparsing of class member initializers
... by parsing just the class body block.

Previously, when class member initializer functions were reparsed we
parsed the whole class declaration from scratch and then took only
the resulting instance/static member initializer function from the
class literal while throwing everything else away.

Such an approach works fine for most of the cases however some
expressions in the "extends" clause might require all class outer
scopes to be in place while some of them might not be available
anymore after scopes chain deserialization (i.e. they might be
optimzed away if the respective context objects don't have to be
allocated).

The solution is to parse just the class body. In order to achieve
that we
 - record class body positions as start/end positions for class member
   initializer functions,
 - record class name in a member initializer function (it might be
   necessary for creating proper class variable in the class scope).

We explicitly ignore the existence of the extends clause in the
original class definition since it only affects the resulting
class function's functions kind and parsing of 'super' expressions
(which might cause SyntaxErrors in non-derived classes).
The class constructor function is thrown away anyway when we reparse
a class member initializers and SyntaxErrors must have been thrown
during initial parsing, thus we can parse the class as a derived one.

Bug: chromium:1458565
Change-Id: Ie8c281cec90262f5955a3eacc21aebb2cf3de365
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/4681439
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Toon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#89089}
2023-07-21 10:29:29 +00:00