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

Side by Side Diff: src/compiler/effect-control-linearizer.cc

Issue 2549773002: Internalize strings in-place (Closed)
Patch Set: forgot one Created 3 years, 12 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/effect-control-linearizer.h" 5 #include "src/compiler/effect-control-linearizer.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/access-builder.h" 8 #include "src/compiler/access-builder.h"
9 #include "src/compiler/compiler-source-position-table.h" 9 #include "src/compiler/compiler-source-position-table.h"
10 #include "src/compiler/js-graph.h" 10 #include "src/compiler/js-graph.h"
(...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after
2224 2224
2225 return ValueEffectControl(value, effect, control); 2225 return ValueEffectControl(value, effect, control);
2226 } 2226 }
2227 2227
2228 EffectControlLinearizer::ValueEffectControl 2228 EffectControlLinearizer::ValueEffectControl
2229 EffectControlLinearizer::LowerStringCharCodeAt(Node* node, Node* effect, 2229 EffectControlLinearizer::LowerStringCharCodeAt(Node* node, Node* effect,
2230 Node* control) { 2230 Node* control) {
2231 Node* subject = node->InputAt(0); 2231 Node* subject = node->InputAt(0);
2232 Node* index = node->InputAt(1); 2232 Node* index = node->InputAt(1);
2233 2233
2234 // We may need to loop several times for ConsString/SlicedString {subject}s. 2234 // We may need to loop several times for ConsString/SlicedString {subject}s.
Igor Sheludko 2016/12/20 23:46:58 /ThinString
Jakob Kummerow 2017/01/04 12:45:06 Done.
2235 Node* loop = 2235 Node* loop = graph()->NewNode(common()->Loop(5), control, control, control,
2236 graph()->NewNode(common()->Loop(4), control, control, control, control); 2236 control, control);
2237 Node* lsubject = 2237 Node* lsubject =
2238 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 4), 2238 graph()->NewNode(common()->Phi(MachineRepresentation::kTagged, 5),
2239 subject, subject, subject, subject, loop); 2239 subject, subject, subject, subject, subject, loop);
2240 Node* lindex = 2240 Node* lindex =
2241 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 4), index, 2241 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 5), index,
2242 index, index, index, loop); 2242 index, index, index, index, loop);
2243 Node* leffect = graph()->NewNode(common()->EffectPhi(4), effect, effect, 2243 Node* leffect = graph()->NewNode(common()->EffectPhi(5), effect, effect,
2244 effect, effect, loop); 2244 effect, effect, effect, loop);
2245 2245
2246 control = loop; 2246 control = loop;
2247 effect = leffect; 2247 effect = leffect;
2248 2248
2249 // Determine the instance type of {lsubject}. 2249 // Determine the instance type of {lsubject}.
2250 Node* lsubject_map = effect = 2250 Node* lsubject_map = effect =
2251 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), 2251 graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()),
2252 lsubject, effect, control); 2252 lsubject, effect, control);
2253 Node* lsubject_instance_type = effect = graph()->NewNode( 2253 Node* lsubject_instance_type = effect = graph()->NewNode(
2254 simplified()->LoadField(AccessBuilder::ForMapInstanceType()), 2254 simplified()->LoadField(AccessBuilder::ForMapInstanceType()),
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2449 etrue2 = 2449 etrue2 =
2450 graph()->NewNode(common()->EffectPhi(2), etrue3, efalse3, if_true2); 2450 graph()->NewNode(common()->EffectPhi(2), etrue3, efalse3, if_true2);
2451 vtrue2 = 2451 vtrue2 =
2452 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2), 2452 graph()->NewNode(common()->Phi(MachineRepresentation::kWord32, 2),
2453 vtrue3, vfalse3, if_true2); 2453 vtrue3, vfalse3, if_true2);
2454 } 2454 }
2455 2455
2456 Node* if_false2 = graph()->NewNode(common()->IfFalse(), branch2); 2456 Node* if_false2 = graph()->NewNode(common()->IfFalse(), branch2);
2457 Node* efalse2 = efalse1; 2457 Node* efalse2 = efalse1;
2458 { 2458 {
2459 // The {lsubject} is a SlicedString, continue with its parent. 2459 // Check if the {lsubject} is a SlicedString.
2460 Node* lsubject_parent = efalse2 = graph()->NewNode( 2460 Node* check3 = graph()->NewNode(
2461 simplified()->LoadField(AccessBuilder::ForSlicedStringParent()), 2461 machine()->Word32Equal(),
2462 lsubject, efalse2, if_false2); 2462 graph()->NewNode(
2463 Node* lsubject_offset = efalse2 = graph()->NewNode( 2463 machine()->Word32And(), lsubject_instance_type,
2464 simplified()->LoadField(AccessBuilder::ForSlicedStringOffset()), 2464 jsgraph()->Int32Constant(kStringRepresentationMask)),
2465 lsubject, efalse2, if_false2); 2465 jsgraph()->Int32Constant(kSlicedStringTag));
2466 Node* lsubject_index = graph()->NewNode( 2466 Node* branch3 = graph()->NewNode(common()->Branch(), check3, if_false2);
2467 machine()->Int32Add(), lindex, ChangeSmiToInt32(lsubject_offset));
2468 2467
2469 // Retry the {loop} with the parent subject. 2468 Node* if_true3 = graph()->NewNode(common()->IfTrue(), branch3);
2470 loop->ReplaceInput(3, if_false2); 2469 Node* etrue3 = efalse2;
2471 leffect->ReplaceInput(3, efalse2); 2470 {
2472 lindex->ReplaceInput(3, lsubject_index); 2471 // The {lsubject} is a SlicedString, continue with its parent.
2473 lsubject->ReplaceInput(3, lsubject_parent); 2472 Node* lsubject_parent = etrue3 = graph()->NewNode(
2473 simplified()->LoadField(AccessBuilder::ForSlicedStringParent()),
2474 lsubject, etrue3, if_true3);
2475 Node* lsubject_offset = etrue3 = graph()->NewNode(
2476 simplified()->LoadField(AccessBuilder::ForSlicedStringOffset()),
2477 lsubject, etrue3, if_true3);
2478 Node* lsubject_index = graph()->NewNode(
2479 machine()->Int32Add(), lindex, ChangeSmiToInt32(lsubject_offset));
2480
2481 // Retry the {loop} with the parent subject.
2482 loop->ReplaceInput(3, if_true3);
2483 leffect->ReplaceInput(3, etrue3);
2484 lindex->ReplaceInput(3, lsubject_index);
2485 lsubject->ReplaceInput(3, lsubject_parent);
2486 }
2487
2488 Node* if_false3 = graph()->NewNode(common()->IfFalse(), branch3);
2489 Node* efalse3 = efalse2;
2490 {
2491 // The {lsubject} is a ThinString, continue with its actual value.
2492 Node* lsubject_actual = efalse3 = graph()->NewNode(
2493 simplified()->LoadField(AccessBuilder::ForThinStringActual()),
2494 lsubject, efalse3, if_false3);
2495
2496 // Retry the {loop} with the actual subject.
2497 loop->ReplaceInput(4, if_false3);
2498 leffect->ReplaceInput(4, efalse3);
2499 lsubject->ReplaceInput(4, lsubject_actual);
2500 }
2474 } 2501 }
2475 2502
2476 if_false1 = if_true2; 2503 if_false1 = if_true2;
2477 efalse1 = etrue2; 2504 efalse1 = etrue2;
2478 vfalse1 = vtrue2; 2505 vfalse1 = vtrue2;
2479 } 2506 }
2480 2507
2481 if_false0 = if_false1; 2508 if_false0 = if_false1;
2482 efalse0 = efalse1; 2509 efalse0 = efalse1;
2483 vfalse0 = vfalse1; 2510 vfalse0 = vfalse1;
(...skipping 1332 matching lines...) Expand 10 before | Expand all | Expand 10 after
3816 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3843 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3817 Operator::kEliminatable); 3844 Operator::kEliminatable);
3818 to_number_operator_.set(common()->Call(desc)); 3845 to_number_operator_.set(common()->Call(desc));
3819 } 3846 }
3820 return to_number_operator_.get(); 3847 return to_number_operator_.get();
3821 } 3848 }
3822 3849
3823 } // namespace compiler 3850 } // namespace compiler
3824 } // namespace internal 3851 } // namespace internal
3825 } // namespace v8 3852 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698