963ff849df
This patch implements inspector support for private instance methods: - Previously to implement brand checking for instances with private instance methods we store the brand both as the value with the brand itself as the key in the stances. Now we make the value the context associated with the class instead. - To retrieve the private instance methods and accessors from the instances at runtime, we look into the contexts stored with the brands, and analyze the scope info to get the names as well as context slot indices of them. - This patch extends the `PrivatePropertyDescriptor` in the inspector protocol to include optional `get` and `set` fields, and make the `value` field optional (similar to `PropertyDescriptor`s). Private fields or private instance methods are returned in the `value` field while private accessors are returned in the `get` and/or `set` field. Property previews for the instaces containing private instance methods and accessors are also updated similarly, although no additional protocol change is necessary since the `PropertyPreview` type can already be used to display accessors. Design doc: https://docs.google.com/document/d/1N91LObhQexnB0eE7EvGe57HsvNMFX16CaWu-XCTnnmY/edit Bug: v8:9839, v8:8330 Change-Id: If37090bd23833a18f75deb1249ca5c4405ca2bf2 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1934407 Commit-Queue: Joyee Cheung <joyee@igalia.com> Reviewed-by: Yang Guo <yangguo@chromium.org> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Cr-Commit-Position: refs/heads/master@{#65337}
31 lines
701 B
Plaintext
31 lines
701 B
Plaintext
Check private methods in object preview.
|
|
|
|
Running test: testPrivateMethods
|
|
expression: new class extends class { constructor() { return new Proxy({}, {}); } } { #method() { return 1; } }
|
|
[
|
|
]
|
|
expression: new class { #method() { return 1; } get #accessor() { } set #accessor(val) { } }
|
|
[
|
|
[0] : {
|
|
name : #method
|
|
type : function
|
|
value :
|
|
}
|
|
[1] : {
|
|
name : #accessor
|
|
type : accessor
|
|
}
|
|
]
|
|
expression: new class extends class { #method() { return 1; } } { get #accessor() { } set #accessor(val) { } }
|
|
[
|
|
[0] : {
|
|
name : #method
|
|
type : function
|
|
value :
|
|
}
|
|
[1] : {
|
|
name : #accessor
|
|
type : accessor
|
|
}
|
|
]
|