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

Side by Side Diff: src/compiler/js-typed-lowering.cc

Issue 2645523002: [turbofan] Mark fast StringAdd as not causing side effects. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/js-typed-lowering.h" 5 #include "src/compiler/js-typed-lowering.h"
6 6
7 #include "src/ast/modules.h" 7 #include "src/ast/modules.h"
8 #include "src/builtins/builtins-utils.h" 8 #include "src/builtins/builtins-utils.h"
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/compilation-dependencies.h" 10 #include "src/compilation-dependencies.h"
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 if (r.OneInputIs(Type::String())) { 565 if (r.OneInputIs(Type::String())) {
566 if (r.ShouldCreateConsString()) { 566 if (r.ShouldCreateConsString()) {
567 return ReduceCreateConsString(node); 567 return ReduceCreateConsString(node);
568 } 568 }
569 StringAddFlags flags = STRING_ADD_CHECK_NONE; 569 StringAddFlags flags = STRING_ADD_CHECK_NONE;
570 if (!r.LeftInputIs(Type::String())) { 570 if (!r.LeftInputIs(Type::String())) {
571 flags = STRING_ADD_CONVERT_LEFT; 571 flags = STRING_ADD_CONVERT_LEFT;
572 } else if (!r.RightInputIs(Type::String())) { 572 } else if (!r.RightInputIs(Type::String())) {
573 flags = STRING_ADD_CONVERT_RIGHT; 573 flags = STRING_ADD_CONVERT_RIGHT;
574 } 574 }
575 Operator::Properties properties = node->op()->properties();
576 if (r.NeitherInputCanBe(Type::Receiver())) {
577 // Both sides are already strings, so we know that the
578 // string addition will not cause any observable side
579 // effects; it can still throw obviously.
580 properties = Operator::kNoWrite | Operator::kNoDeopt;
581 }
575 // JSAdd(x:string, y) => CallStub[StringAdd](x, y) 582 // JSAdd(x:string, y) => CallStub[StringAdd](x, y)
576 // JSAdd(x, y:string) => CallStub[StringAdd](x, y) 583 // JSAdd(x, y:string) => CallStub[StringAdd](x, y)
577 Callable const callable = 584 Callable const callable =
578 CodeFactory::StringAdd(isolate(), flags, NOT_TENURED); 585 CodeFactory::StringAdd(isolate(), flags, NOT_TENURED);
579 CallDescriptor const* const desc = Linkage::GetStubCallDescriptor( 586 CallDescriptor const* const desc = Linkage::GetStubCallDescriptor(
580 isolate(), graph()->zone(), callable.descriptor(), 0, 587 isolate(), graph()->zone(), callable.descriptor(), 0,
581 CallDescriptor::kNeedsFrameState, node->op()->properties()); 588 CallDescriptor::kNeedsFrameState, properties);
582 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op())); 589 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
583 node->InsertInput(graph()->zone(), 0, 590 node->InsertInput(graph()->zone(), 0,
584 jsgraph()->HeapConstant(callable.code())); 591 jsgraph()->HeapConstant(callable.code()));
585 NodeProperties::ChangeOp(node, common()->Call(desc)); 592 NodeProperties::ChangeOp(node, common()->Call(desc));
586 return Changed(node); 593 return Changed(node);
587 } 594 }
588 return NoChange(); 595 return NoChange();
589 } 596 }
590 597
591 Reduction JSTypedLowering::ReduceNumberBinop(Node* node) { 598 Reduction JSTypedLowering::ReduceNumberBinop(Node* node) {
(...skipping 1794 matching lines...) Expand 10 before | Expand all | Expand 10 after
2386 } 2393 }
2387 2394
2388 2395
2389 CompilationDependencies* JSTypedLowering::dependencies() const { 2396 CompilationDependencies* JSTypedLowering::dependencies() const {
2390 return dependencies_; 2397 return dependencies_;
2391 } 2398 }
2392 2399
2393 } // namespace compiler 2400 } // namespace compiler
2394 } // namespace internal 2401 } // namespace internal
2395 } // namespace v8 2402 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698