|
|
Description[runtime] Intercept function declarations.
We used to intercept function definitions, but not declarations.
GenericNamedPropertySetterCallback now also intercepts function declarations.
For definitions, we call DeclareGlobal and then InitializeVarGlobal. For
declarations, we never call InitializeVarGlobal, thus we must check for
interceptors in DeclareGlobal.
If the semantics of a redeclaration are wrong, e.g., redeclaring a read-only
property, an exception is thrown independent of whether an interceptor is
installed. Usually, i.e., not during a declaration, we only throw if
the call is not successfully intercepted.
BUG=v8:5375
Committed: https://crrev.com/8439401d2dfdb9fa328c758cca689289922a32d1
Cr-Commit-Position: refs/heads/master@{#39450}
Patch Set 1 #Patch Set 2 : Only restart for function declarations #Patch Set 3 : Fix decl test #Patch Set 4 : Fix remaining decl tests. #Patch Set 5 : Fix block-sloppy-function test. #Patch Set 6 : Delete unused should_throw variable. #Patch Set 7 : Add test for function re-declaration. #Patch Set 8 : Add tests for re-declaration and read only. #Patch Set 9 : Add more tests #Patch Set 10 : Simplify test. #Patch Set 11 : Use cctest isolate. #Patch Set 12 : Small test refactoring. #Patch Set 13 : Simplify tests. #Patch Set 14 : Fix test. #
Messages
Total messages: 70 (55 generated)
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Description was changed from ========== [runtime] Intercept function declarations. BUG=v8:5375 ========== to ========== [runtime] Intercept function declarations. GenericNamedPropertySetterCallback now also intercepts function declarations. For definitions, we call DeclareGlobal and then InitializeVarGlobal. For declarations, we never call InitializeVarGlobal, thus we must check for interceptors in DeclareGlobal. BUG=v8:5375 ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux_dbg_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_dbg_ng/builds/12541) v8_linux_dbg_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux_dbg_ng_triggered/b...)
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux64_gyp_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_gyp_rel_ng/build...) v8_linux64_gyp_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_gyp_rel_ng_trigg...)
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux64_gyp_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_gyp_rel_ng/build...) v8_linux64_gyp_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_gyp_rel_ng_trigg...)
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux64_avx2_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_avx2_rel_ng/buil...) v8_linux64_avx2_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_avx2_rel_ng_trig...)
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
franzih@chromium.org changed reviewers: + jochen@chromium.org
Hi Jochen, Please take a look. Thanks, Franzi
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
adamk@chromium.org changed reviewers: + adamk@chromium.org
I'm a little worried about the possible performance effects of this. Does this mean that when loading a script like: <script> function foo() {} function bar() {} ... </script> each of those function declarations will trigger an interceptor call?
On 2016/09/13 at 22:22:17, adamk wrote: > I'm a little worried about the possible performance effects of this. Does this mean that when loading a script like: > > <script> > function foo() {} > function bar() {} > ... > </script> > > each of those function declarations will trigger an interceptor call? Just like <script> foo = function() {} bar = function() {} ... </script> already does. Are declarations faster than definitions (because of the missing interceptor)? Is that something we rely on?
it's only slow if we had an interceptor on the global object, no?
what happens if you redeclare a function?
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
On 2016/09/14 at 08:48:32, jochen wrote: > what happens if you redeclare a function? I first check if it's OK to redeclare and then intercept the request. I should change the order to be consistent with the other interceptors.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
On 2016/09/14 at 11:40:34, franzih wrote: > On 2016/09/14 at 08:48:32, jochen wrote: > > what happens if you redeclare a function? > > I first check if it's OK to redeclare and then intercept the request. I should change the order to be consistent with the other interceptors. I guess bailing out if it's not ok is fine. Assuming blink doesn't have such an interceptor and therefore won't get an performance impact this lgtm
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
On 2016/09/14 at 14:07:11, jochen wrote: > On 2016/09/14 at 11:40:34, franzih wrote: > > On 2016/09/14 at 08:48:32, jochen wrote: > > > what happens if you redeclare a function? > > > > I first check if it's OK to redeclare and then intercept the request. I should change the order to be consistent with the other interceptors. > > I guess bailing out if it's not ok is fine. Assuming blink doesn't have such an interceptor and therefore won't get an performance impact this lgtm Yes, I agree it's OK to throw if the semantics of a redeclaration are wrong rather than calling the interceptor first. So invalid redeclare throws rather than calling the interceptor first. I added tests for that. I checked that Blink doesn't have an interceptor on the global object, i.e., we never make function declarations with a LookupIterator::Interceptor.
Description was changed from ========== [runtime] Intercept function declarations. GenericNamedPropertySetterCallback now also intercepts function declarations. For definitions, we call DeclareGlobal and then InitializeVarGlobal. For declarations, we never call InitializeVarGlobal, thus we must check for interceptors in DeclareGlobal. BUG=v8:5375 ========== to ========== [runtime] Intercept function declarations. GenericNamedPropertySetterCallback now also intercepts function declarations. For definitions, we call DeclareGlobal and then InitializeVarGlobal. For declarations, we never call InitializeVarGlobal, thus we must check for interceptors in DeclareGlobal. If the semantics of a redeclaration are wrong, e.g., redeclaring a read-only property, an exception is thrown independent of whether an interceptor is installed. In usual behavior, i.e., not during a declaration, is different, namely to throw only if the call is not successfully intercepted. BUG=v8:5375 ==========
Description was changed from ========== [runtime] Intercept function declarations. GenericNamedPropertySetterCallback now also intercepts function declarations. For definitions, we call DeclareGlobal and then InitializeVarGlobal. For declarations, we never call InitializeVarGlobal, thus we must check for interceptors in DeclareGlobal. If the semantics of a redeclaration are wrong, e.g., redeclaring a read-only property, an exception is thrown independent of whether an interceptor is installed. In usual behavior, i.e., not during a declaration, is different, namely to throw only if the call is not successfully intercepted. BUG=v8:5375 ========== to ========== [runtime] Intercept function declarations. GenericNamedPropertySetterCallback now also intercepts function declarations. For definitions, we call DeclareGlobal and then InitializeVarGlobal. For declarations, we never call InitializeVarGlobal, thus we must check for interceptors in DeclareGlobal. If the semantics of a redeclaration are wrong, e.g., redeclaring a read-only property, an exception is thrown independent of whether an interceptor is installed. The usual behavior, i.e., not during a declaration, is different, namely to throw only if the call is not successfully intercepted. BUG=v8:5375 ==========
Description was changed from ========== [runtime] Intercept function declarations. GenericNamedPropertySetterCallback now also intercepts function declarations. For definitions, we call DeclareGlobal and then InitializeVarGlobal. For declarations, we never call InitializeVarGlobal, thus we must check for interceptors in DeclareGlobal. If the semantics of a redeclaration are wrong, e.g., redeclaring a read-only property, an exception is thrown independent of whether an interceptor is installed. The usual behavior, i.e., not during a declaration, is different, namely to throw only if the call is not successfully intercepted. BUG=v8:5375 ========== to ========== [runtime] Intercept function declarations. We used to intercept function definitions, but not declarations. GenericNamedPropertySetterCallback now also intercepts function declarations. For definitions, we call DeclareGlobal and then InitializeVarGlobal. For declarations, we never call InitializeVarGlobal, thus we must check for interceptors in DeclareGlobal. If the semantics of a redeclaration are wrong, e.g., redeclaring a read-only property, an exception is thrown independent of whether an interceptor is installed. Usually, i.e., not during a declaration, we only throw if the call is not successfully intercepted. BUG=v8:5375 ==========
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: Try jobs failed on following builders: v8_linux64_rel_ng on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_rel_ng/builds/12742) v8_linux64_rel_ng_triggered on master.tryserver.v8 (JOB_FAILED, http://build.chromium.org/p/tryserver.v8/builders/v8_linux64_rel_ng_triggered...)
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
On 2016/09/14 02:50:35, Franzi wrote: > On 2016/09/13 at 22:22:17, adamk wrote: > > I'm a little worried about the possible performance effects of this. Does this > mean that when loading a script like: > > > > <script> > > function foo() {} > > function bar() {} > > ... > > </script> > > > > each of those function declarations will trigger an interceptor call? > > Just like > > <script> > foo = function() {} > bar = function() {} > ... > </script> > > already does. Are declarations faster than definitions (because of the missing > interceptor)? Is that something we rely on? The function declaration pattern is very common (and certainly less common than "foo = function() {}"). I would be surprised if we weren't implicitly relying on that being fast, especially on pages with lots of function declarations. To Jochen's point, don't we always have an interceptor on the global object when running in Blink?
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
> To Jochen's point, don't we always have an interceptor on the global object when running in Blink? I tried it in Chrome: crash, if we have a function declaration and if iterator.state() is interceptor. Didn't crash. Tried it in tests where I intercept the global object: crashed as expected. I'm pretty confident with this test. I think we have interceptors on e.g., window, so any request on window is intercepted and passed on to the global object, like here https://codesearch.chromium.org/chromium/src/out/Debug/gen/blink/bindings/cor.... But not the other way round. Jochen, can you shed some light on this?
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
On 2016/09/14 at 18:25:52, franzih wrote: > > To Jochen's point, don't we always have an interceptor on the global object when running in Blink? > > I tried it in Chrome: crash, if we have a function declaration and if iterator.state() is interceptor. Didn't crash. Tried it in tests where I intercept the global object: crashed as expected. I'm pretty confident with this test. I think we have interceptors on e.g., window, so any request on window is intercepted and passed on to the global object, like here https://codesearch.chromium.org/chromium/src/out/Debug/gen/blink/bindings/cor.... But not the other way round. Jochen, can you shed some light on this? this is how the global object in blink looks like: https://codesearch.chromium.org/chromium/src/third_party/WebKit/Source/bindin... if you have an <img id=foo> then window.foo will return that element, this is implemented by this interceptor. however, the interceptor is not on the global object itself (and it doesn't have a setter anyways), so we should be good
On 2016/09/15 at 10:16:13, jochen wrote: > On 2016/09/14 at 18:25:52, franzih wrote: > > > To Jochen's point, don't we always have an interceptor on the global object when running in Blink? > > > > I tried it in Chrome: crash, if we have a function declaration and if iterator.state() is interceptor. Didn't crash. Tried it in tests where I intercept the global object: crashed as expected. I'm pretty confident with this test. I think we have interceptors on e.g., window, so any request on window is intercepted and passed on to the global object, like here https://codesearch.chromium.org/chromium/src/out/Debug/gen/blink/bindings/cor.... But not the other way round. Jochen, can you shed some light on this? > > this is how the global object in blink looks like: https://codesearch.chromium.org/chromium/src/third_party/WebKit/Source/bindin... > > if you have an <img id=foo> then window.foo will return that element, this is implemented by this interceptor. however, the interceptor is not on the global object itself (and it doesn't have a setter anyways), so we should be good Thanks!
The CQ bit was checked by franzih@chromium.org to run a CQ dry run
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by franzih@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from jochen@chromium.org Link to the patchset: https://codereview.chromium.org/2334733002/#ps250001 (title: "Fix test.")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #14 (id:250001)
Message was sent while issue was closed.
Description was changed from ========== [runtime] Intercept function declarations. We used to intercept function definitions, but not declarations. GenericNamedPropertySetterCallback now also intercepts function declarations. For definitions, we call DeclareGlobal and then InitializeVarGlobal. For declarations, we never call InitializeVarGlobal, thus we must check for interceptors in DeclareGlobal. If the semantics of a redeclaration are wrong, e.g., redeclaring a read-only property, an exception is thrown independent of whether an interceptor is installed. Usually, i.e., not during a declaration, we only throw if the call is not successfully intercepted. BUG=v8:5375 ========== to ========== [runtime] Intercept function declarations. We used to intercept function definitions, but not declarations. GenericNamedPropertySetterCallback now also intercepts function declarations. For definitions, we call DeclareGlobal and then InitializeVarGlobal. For declarations, we never call InitializeVarGlobal, thus we must check for interceptors in DeclareGlobal. If the semantics of a redeclaration are wrong, e.g., redeclaring a read-only property, an exception is thrown independent of whether an interceptor is installed. Usually, i.e., not during a declaration, we only throw if the call is not successfully intercepted. BUG=v8:5375 Committed: https://crrev.com/8439401d2dfdb9fa328c758cca689289922a32d1 Cr-Commit-Position: refs/heads/master@{#39450} ==========
Message was sent while issue was closed.
Patchset 14 (id:??) landed as https://crrev.com/8439401d2dfdb9fa328c758cca689289922a32d1 Cr-Commit-Position: refs/heads/master@{#39450} |