Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Unified Diff: src/compiler/js-intrinsic-lowering.cc

Issue 1013753016: Add full TurboFan support for accessing SeqString contents. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixed return value Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/js-intrinsic-lowering.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/js-intrinsic-lowering.cc
diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc
index 5a03f5dbbd69c39ce274d8934bf41b36a4d7db9f..b0beafbd6fd3da98212dd3d4495587103e2c383e 100644
--- a/src/compiler/js-intrinsic-lowering.cc
+++ b/src/compiler/js-intrinsic-lowering.cc
@@ -53,8 +53,16 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceMathFloor(node);
case Runtime::kInlineMathSqrt:
return ReduceMathSqrt(node);
+ case Runtime::kInlineOneByteSeqStringGetChar:
+ return ReduceSeqStringGetChar(node, String::ONE_BYTE_ENCODING);
+ case Runtime::kInlineOneByteSeqStringSetChar:
+ return ReduceSeqStringSetChar(node, String::ONE_BYTE_ENCODING);
case Runtime::kInlineStringGetLength:
return ReduceStringGetLength(node);
+ case Runtime::kInlineTwoByteSeqStringGetChar:
+ return ReduceSeqStringGetChar(node, String::TWO_BYTE_ENCODING);
+ case Runtime::kInlineTwoByteSeqStringSetChar:
+ return ReduceSeqStringSetChar(node, String::TWO_BYTE_ENCODING);
case Runtime::kInlineValueOf:
return ReduceValueOf(node);
default:
@@ -221,6 +229,42 @@ Reduction JSIntrinsicLowering::ReduceMathSqrt(Node* node) {
}
+Reduction JSIntrinsicLowering::ReduceSeqStringGetChar(
+ Node* node, String::Encoding encoding) {
+ Node* effect = NodeProperties::GetEffectInput(node);
+ Node* control = NodeProperties::GetControlInput(node);
+ node->set_op(
+ simplified()->LoadElement(AccessBuilder::ForSeqStringChar(encoding)));
+ node->ReplaceInput(2, effect);
+ node->ReplaceInput(3, control);
+ node->TrimInputCount(4);
+ NodeProperties::ReplaceWithValue(node, node, node);
+ return Changed(node);
+}
+
+
+Reduction JSIntrinsicLowering::ReduceSeqStringSetChar(
+ Node* node, String::Encoding encoding) {
+ // Note: The intrinsic has a strange argument order, so we need to reshuffle.
+ Node* index = NodeProperties::GetValueInput(node, 0);
+ Node* chr = NodeProperties::GetValueInput(node, 1);
+ Node* string = NodeProperties::GetValueInput(node, 2);
+ Node* effect = NodeProperties::GetEffectInput(node);
+ Node* control = NodeProperties::GetControlInput(node);
+ node->set_op(
+ simplified()->StoreElement(AccessBuilder::ForSeqStringChar(encoding)));
+ node->ReplaceInput(0, string);
+ node->ReplaceInput(1, index);
+ node->ReplaceInput(2, chr);
+ node->ReplaceInput(3, effect);
+ node->ReplaceInput(4, control);
+ node->TrimInputCount(5);
+ NodeProperties::RemoveBounds(node);
+ NodeProperties::ReplaceWithValue(node, string, node);
+ return Changed(node);
+}
+
+
Reduction JSIntrinsicLowering::ReduceStringGetLength(Node* node) {
Node* value = NodeProperties::GetValueInput(node, 0);
Node* effect = NodeProperties::GetEffectInput(node);
« no previous file with comments | « src/compiler/js-intrinsic-lowering.h ('k') | src/runtime/runtime.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698