|
|
Created:
4 years, 2 months ago by Leszek Swirski Modified:
4 years, 2 months ago CC:
v8-reviews_googlegroups.com, rmcilroy Target Ref:
refs/pending/heads/master Project:
v8 Visibility:
Public. |
Description[interpreter] Add string type feedback to add
Adds string type feedback to Ignition's AddWithFeedback code stub, for now only
adding a special case for when both lhs and rhs are strings. This improves
octane's splay by >100%.
BUG=v8:5400
Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708
Committed: https://crrev.com/bf1a94f1b269914856a8c8763fd282367f066c67
Committed: https://crrev.com/b3c8b0ce2c9af0528837d8309625118d4096553b
Cr-Original-Original-Commit-Position: refs/heads/master@{#39987}
Cr-Original-Commit-Position: refs/heads/master@{#39996}
Cr-Commit-Position: refs/heads/master@{#40015}
Patch Set 1 #
Total comments: 11
Patch Set 2 : Un-inline calling the stub #
Total comments: 6
Patch Set 3 : Use the fancy new IsStringInstanceType method #
Messages
Total messages: 51 (25 generated)
The CQ bit was checked by leszeks@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.
leszeks@chromium.org changed reviewers: + mythria@chromium.org, rmcilroy@chromium.org
https://codereview.chromium.org/2392533002/diff/1/src/code-stubs.cc File src/code-stubs.cc (right): https://codereview.chromium.org/2392533002/diff/1/src/code-stubs.cc#newcode1100 src/code-stubs.cc:1100: &call_add_stub); We also need a check here. My suggestion would be to add checks here which check the unknown side. The type feedback should be String if one side is a string, and the other is any of a string, number or SMI. So for here you could add: assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map), &check_rhs_string); ... assembler->Bind(&check_rhs_string); { // We know that lhs is a SMI, if rhs is a string type feedback should be kString, otherwise it should be kAny. Node* rhs_instance_type = assembler->LoadMapInstanceType(rhs_map); Node* rhs_is_string = assembler->Int32LessThan(rhs_instance_type, assembler->Int32Constant(FIRST_NONSTRING_TYPE)), var_type_feedback.Bind( assembler->Select(rhs_is_string, assembler->Int32Constant(BinaryOperationFeedback::kString), assembler->Int32Constant(BinaryOperationFeedback::kNumber)); assembler->Goto(&call_add_stub); And removing the "var_type_feedback.Bind(..." from call_add_stub. https://codereview.chromium.org/2392533002/diff/1/src/code-stubs.cc#newcode1137 src/code-stubs.cc:1137: &call_add_stub); Same comment here as above - here you know that lhs is a heap number, so again should only have to check the rhs type (maybe you could have a common branch, although you would need to reload the rhs_map). https://codereview.chromium.org/2392533002/diff/1/src/code-stubs.cc#newcode1147 src/code-stubs.cc:1147: assembler->GotoIf(assembler->WordIsSmi(rhs), &call_add_stub); We should still count this as a string if the lhs is a string even if rhs is a SMI (since the output will be string). Here we know that the lhs is a non-number heap object, but we don't know anything about the rhs, so the code should be something like: assembler->Bind(&check_string); { // Check if lhs is a String. Node* lhs_instance_type = assembler->LoadMapInstanceType(lhs_map); assembler->GotoUnless(assembler->Int32LessThan(rhs_instance_type, assembler->Int32Constant(FIRST_NONSTRING_TYPE), &has_any_type); // Check if rhs is a Smi, HeapNumber or String. assembler->GotoIf(assembler->WordIsSmi(rhs), &has_string_type); Node* rhs_map = assembler->LoadMap(rhs); assembler->GotoIf(assembler->IsHeapNumberMap(rhs_map), &has_string_type); assembler->Branch(assembler->Int32LessThan( rhs_instance_type, assembler->Int32Constant(FIRST_NONSTRING_TYPE) &has_string_type, &has_any_type); assembler->Bind(&has_string_type); { var_type_feedback.Bind( assembler->Int32Constant(BinaryOperationFeedback::kString)); assembler->Goto(&call_add_stub); } ... https://codereview.chromium.org/2392533002/diff/1/src/code-stubs.cc#newcode1166 src/code-stubs.cc:1166: var_result.Bind(assembler->CallStub(callable, context, lhs, rhs)); Let's keep the calling of the stub and updating of the type feedback in one place (see comments above). https://codereview.chromium.org/2392533002/diff/1/src/globals.h File src/globals.h (right): https://codereview.chromium.org/2392533002/diff/1/src/globals.h#newcode1223 src/globals.h:1223: kString = 0x4, This needs to keep the or-combining from kNumber->kString->kAny, so kString should be 0x7 and kAny should be 0xF (update comment above too).
Replies without any code changes yet, the enum one needs clarification. https://codereview.chromium.org/2392533002/diff/1/src/code-stubs.cc File src/code-stubs.cc (right): https://codereview.chromium.org/2392533002/diff/1/src/code-stubs.cc#newcode1100 src/code-stubs.cc:1100: &call_add_stub); On 2016/10/04 08:05:31, rmcilroy wrote: > We also need a check here. My suggestion would be to add checks here which check > the unknown side. The type feedback should be String if one side is a string, > and the other is any of a string, number or SMI. So for here you could add: > > assembler->GotoUnless(assembler->IsHeapNumberMap(rhs_map), > &check_rhs_string); > > ... > > assembler->Bind(&check_rhs_string); > { > // We know that lhs is a SMI, if rhs is a string type feedback should be > kString, otherwise it should be kAny. > Node* rhs_instance_type = assembler->LoadMapInstanceType(rhs_map); > Node* rhs_is_string = assembler->Int32LessThan(rhs_instance_type, > assembler->Int32Constant(FIRST_NONSTRING_TYPE)), > var_type_feedback.Bind( > assembler->Select(rhs_is_string, > assembler->Int32Constant(BinaryOperationFeedback::kString), > assembler->Int32Constant(BinaryOperationFeedback::kNumber)); > assembler->Goto(&call_add_stub); > > And removing the "var_type_feedback.Bind(..." from call_add_stub. Ah, this patch was only adding string + string = string feedback, I can add string + number = string feedback too if you want. https://codereview.chromium.org/2392533002/diff/1/src/code-stubs.cc#newcode1137 src/code-stubs.cc:1137: &call_add_stub); On 2016/10/04 08:05:31, rmcilroy wrote: > Same comment here as above - here you know that lhs is a heap number, so again > should only have to check the rhs type (maybe you could have a common branch, > although you would need to reload the rhs_map). As above. https://codereview.chromium.org/2392533002/diff/1/src/code-stubs.cc#newcode1147 src/code-stubs.cc:1147: assembler->GotoIf(assembler->WordIsSmi(rhs), &call_add_stub); On 2016/10/04 08:05:31, rmcilroy wrote: > We should still count this as a string if the lhs is a string even if rhs is a > SMI (since the output will be string). Here we know that the lhs is a non-number > heap object, but we don't know anything about the rhs, so the code should be > something like: > > assembler->Bind(&check_string); > { > // Check if lhs is a String. > Node* lhs_instance_type = assembler->LoadMapInstanceType(lhs_map); > assembler->GotoUnless(assembler->Int32LessThan(rhs_instance_type, > assembler->Int32Constant(FIRST_NONSTRING_TYPE), &has_any_type); > > // Check if rhs is a Smi, HeapNumber or String. > assembler->GotoIf(assembler->WordIsSmi(rhs), &has_string_type); > Node* rhs_map = assembler->LoadMap(rhs); > assembler->GotoIf(assembler->IsHeapNumberMap(rhs_map), > &has_string_type); > assembler->Branch(assembler->Int32LessThan( > rhs_instance_type, > assembler->Int32Constant(FIRST_NONSTRING_TYPE) > &has_string_type, > &has_any_type); > > assembler->Bind(&has_string_type); > { > var_type_feedback.Bind( > assembler->Int32Constant(BinaryOperationFeedback::kString)); > assembler->Goto(&call_add_stub); > } > ... As above. https://codereview.chromium.org/2392533002/diff/1/src/code-stubs.cc#newcode1166 src/code-stubs.cc:1166: var_result.Bind(assembler->CallStub(callable, context, lhs, rhs)); On 2016/10/04 08:05:31, rmcilroy wrote: > Let's keep the calling of the stub and updating of the type feedback in one > place (see comments above). Not sure about this, calling the stub is a small amount of code and I think it might be better to inline it to skip a jump (no pun intended). https://codereview.chromium.org/2392533002/diff/1/src/globals.h File src/globals.h (right): https://codereview.chromium.org/2392533002/diff/1/src/globals.h#newcode1223 src/globals.h:1223: kString = 0x4, On 2016/10/04 08:05:32, rmcilroy wrote: > This needs to keep the or-combining from kNumber->kString->kAny, so kString > should be 0x7 and kAny should be 0xF (update comment above too). Should it? or-combining kNumber and kString shouldn't output kString, I wouldn't have thought?
https://codereview.chromium.org/2392533002/diff/1/src/globals.h File src/globals.h (right): https://codereview.chromium.org/2392533002/diff/1/src/globals.h#newcode1223 src/globals.h:1223: kString = 0x4, On 2016/10/04 08:30:40, Leszek Swirski wrote: > On 2016/10/04 08:05:32, rmcilroy wrote: > > This needs to keep the or-combining from kNumber->kString->kAny, so kString > > should be 0x7 and kAny should be 0xF (update comment above too). > > Should it? or-combining kNumber and kString shouldn't output kString, I wouldn't > have thought? Never mind, Mythri explained f2f that number is a subtype of string, which doesn't make sense in my heart but at least now makes sense in my brain.
The CQ bit was checked by leszeks@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...
PTAL. After some more f2f discussion, it seems that I was right to follow my heart -- numbers don't seem to be treated by FCG or turbofan as a subtype of strings, and so we can only give string binop feedback for string + string operations, and kNumber | kString != kString. FWIW, Benedikt claims that there is evidence that the string + number type feedback in Crankshaft has little performance benefit.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
Thanks, lgtm. https://codereview.chromium.org/2392533002/diff/20001/src/code-stubs.cc File src/code-stubs.cc (right): https://codereview.chromium.org/2392533002/diff/20001/src/code-stubs.cc#newco... src/code-stubs.cc:1165: assembler->Goto(&call_add_stub); I am not sure if it makes sense, but would it be possible to directly have code to add two strings rather than going to calling the add stub. If the operation is too complex it may increase the code size, but if it is simple enough we may avoid some checks.
LGTM thanks. https://codereview.chromium.org/2392533002/diff/20001/src/code-stubs.cc File src/code-stubs.cc (right): https://codereview.chromium.org/2392533002/diff/20001/src/code-stubs.cc#newco... src/code-stubs.cc:1153: &do_add_any); Could you use IsStringInstanceType (as added in https://codereview.chromium.org/2395453002/). https://codereview.chromium.org/2392533002/diff/20001/src/code-stubs.cc#newco... src/code-stubs.cc:1161: &do_add_any); ditto
The CQ bit was checked by leszeks@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 leszeks@chromium.org
The CQ bit was checked by leszeks@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from rmcilroy@chromium.org, mythria@chromium.org Link to the patchset: https://codereview.chromium.org/2392533002/#ps40001 (title: "Use the fancy new IsStringInstanceType method")
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 #3 (id:40001)
Message was sent while issue was closed.
Description was changed from ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 ========== to ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Cr-Commit-Position: refs/heads/master@{#39987} ==========
Message was sent while issue was closed.
Patchset 3 (id:??) landed as https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Cr-Commit-Position: refs/heads/master@{#39987}
Message was sent while issue was closed.
A revert of this CL (patchset #3 id:40001) has been created in https://codereview.chromium.org/2395743004/ by machenbach@chromium.org. The reason for reverting is: Fails unittests on win32 debug: https://build.chromium.org/p/client.v8/builders/V8%20Win32%20-%20debug/builds....
Message was sent while issue was closed.
FYI: win dbg bots don't run by default on the CQ, but can be added manually on a reland of this CL
Message was sent while issue was closed.
https://codereview.chromium.org/2392533002/diff/20001/src/code-stubs.cc File src/code-stubs.cc (right): https://codereview.chromium.org/2392533002/diff/20001/src/code-stubs.cc#newco... src/code-stubs.cc:1153: &do_add_any); On 2016/10/05 11:03:12, rmcilroy wrote: > Could you use IsStringInstanceType (as added in > https://codereview.chromium.org/2395453002/). Done. https://codereview.chromium.org/2392533002/diff/20001/src/code-stubs.cc#newco... src/code-stubs.cc:1161: &do_add_any); On 2016/10/05 11:03:12, rmcilroy wrote: > ditto Done. https://codereview.chromium.org/2392533002/diff/20001/src/code-stubs.cc#newco... src/code-stubs.cc:1165: assembler->Goto(&call_add_stub); On 2016/10/05 08:28:00, mythria wrote: > I am not sure if it makes sense, but would it be possible to directly have code > to add two strings rather than going to calling the add stub. If the operation > is too complex it may increase the code size, but if it is simple enough we may > avoid some checks. Nice idea, I'll punt on this for this CL and will investigate for a subsequent one.
Message was sent while issue was closed.
Description was changed from ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Cr-Commit-Position: refs/heads/master@{#39987} ========== to ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Cr-Commit-Position: refs/heads/master@{#39987} ==========
Description was changed from ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Cr-Commit-Position: refs/heads/master@{#39987} ========== to ========== Reland: [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Cr-Commit-Position: refs/heads/master@{#39987} ==========
Strangely https://build.chromium.org/p/client.v8/builders/V8%20Win32%20-%20debug/builds... was green before the revert. Maybe it's flaky? Or wrong infra?
On 2016/10/05 13:21:12, machenbach (slow) wrote: > Strangely > https://build.chromium.org/p/client.v8/builders/V8%20Win32%20-%20debug/builds... > was green before the revert. Maybe it's flaky? Or wrong infra? Maybe flaky, I took a look at the broken tests and it doesn't seem that any should have been broken by this patch. I'm running the win_dbg try bots again on this.
Description was changed from ========== Reland: [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Cr-Commit-Position: refs/heads/master@{#39987} ========== to ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Cr-Commit-Position: refs/heads/master@{#39987} ==========
Well, three successes and one failure on v8_win_dbg. Has this bot been flaky before like this?
On 2016/10/05 14:31:04, Leszek Swirski wrote: > Well, three successes and one failure on v8_win_dbg. Has this bot been flaky > before like this? Maybe we have a build dependency problem again. I also see this strange problem: https://build.chromium.org/p/tryserver.v8/builders/v8_win_dbg/builds/409 Looks similar but is way older. Maybe just reland... If we get more problems, lets land a landmine.
The CQ bit was checked by leszeks@chromium.org
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
sgtm
Message was sent while issue was closed.
Description was changed from ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Cr-Commit-Position: refs/heads/master@{#39987} ========== to ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Cr-Commit-Position: refs/heads/master@{#39987} ==========
Message was sent while issue was closed.
Committed patchset #3 (id:40001)
Message was sent while issue was closed.
Description was changed from ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Cr-Commit-Position: refs/heads/master@{#39987} ========== to ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Committed: https://crrev.com/bf1a94f1b269914856a8c8763fd282367f066c67 Cr-Original-Commit-Position: refs/heads/master@{#39987} Cr-Commit-Position: refs/heads/master@{#39996} ==========
Message was sent while issue was closed.
Patchset 3 (id:??) landed as https://crrev.com/bf1a94f1b269914856a8c8763fd282367f066c67 Cr-Commit-Position: refs/heads/master@{#39996}
Message was sent while issue was closed.
A revert of this CL (patchset #3 id:40001) has been created in https://codereview.chromium.org/2393193002/ by leszeks@chromium.org. The reason for reverting is: Broke the tree again, for no obvious reason :/.
Message was sent while issue was closed.
Description was changed from ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Committed: https://crrev.com/bf1a94f1b269914856a8c8763fd282367f066c67 Cr-Original-Commit-Position: refs/heads/master@{#39987} Cr-Commit-Position: refs/heads/master@{#39996} ========== to ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Committed: https://crrev.com/bf1a94f1b269914856a8c8763fd282367f066c67 Cr-Original-Commit-Position: refs/heads/master@{#39987} Cr-Commit-Position: refs/heads/master@{#39996} ==========
Landmine is in, and another suspect reverted. Relanding this.
The CQ bit was checked by machenbach@chromium.org
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.
Description was changed from ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Committed: https://crrev.com/bf1a94f1b269914856a8c8763fd282367f066c67 Cr-Original-Commit-Position: refs/heads/master@{#39987} Cr-Commit-Position: refs/heads/master@{#39996} ========== to ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Committed: https://crrev.com/bf1a94f1b269914856a8c8763fd282367f066c67 Cr-Original-Commit-Position: refs/heads/master@{#39987} Cr-Commit-Position: refs/heads/master@{#39996} ==========
Message was sent while issue was closed.
Committed patchset #3 (id:40001)
Message was sent while issue was closed.
Description was changed from ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Committed: https://crrev.com/bf1a94f1b269914856a8c8763fd282367f066c67 Cr-Original-Commit-Position: refs/heads/master@{#39987} Cr-Commit-Position: refs/heads/master@{#39996} ========== to ========== [interpreter] Add string type feedback to add Adds string type feedback to Ignition's AddWithFeedback code stub, for now only adding a special case for when both lhs and rhs are strings. This improves octane's splay by >100%. BUG=v8:5400 Committed: https://crrev.com/fb4ae2239d37adaf0321165034050316914de708 Committed: https://crrev.com/bf1a94f1b269914856a8c8763fd282367f066c67 Committed: https://crrev.com/b3c8b0ce2c9af0528837d8309625118d4096553b Cr-Original-Original-Commit-Position: refs/heads/master@{#39987} Cr-Original-Commit-Position: refs/heads/master@{#39996} Cr-Commit-Position: refs/heads/master@{#40015} ==========
Message was sent while issue was closed.
Patchset 3 (id:??) landed as https://crrev.com/b3c8b0ce2c9af0528837d8309625118d4096553b Cr-Commit-Position: refs/heads/master@{#40015} |