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

Side by Side Diff: src/compiler/simplified-lowering.cc

Issue 2925793002: [turbofan] Try harder to avoid write barriers when writing Smis. (Closed)
Patch Set: Created 3 years, 6 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/simplified-lowering.h" 5 #include "src/compiler/simplified-lowering.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "src/address-map.h" 9 #include "src/address-map.h"
10 #include "src/base/bits.h" 10 #include "src/base/bits.h"
(...skipping 2454 matching lines...) Expand 10 before | Expand all | Expand 10 after
2465 if (truncation.IsUnused()) return VisitUnused(node); 2465 if (truncation.IsUnused()) return VisitUnused(node);
2466 FieldAccess access = FieldAccessOf(node->op()); 2466 FieldAccess access = FieldAccessOf(node->op());
2467 MachineRepresentation const representation = 2467 MachineRepresentation const representation =
2468 access.machine_type.representation(); 2468 access.machine_type.representation();
2469 VisitUnop(node, UseInfoForBasePointer(access), representation); 2469 VisitUnop(node, UseInfoForBasePointer(access), representation);
2470 return; 2470 return;
2471 } 2471 }
2472 case IrOpcode::kStoreField: { 2472 case IrOpcode::kStoreField: {
2473 FieldAccess access = FieldAccessOf(node->op()); 2473 FieldAccess access = FieldAccessOf(node->op());
2474 NodeInfo* input_info = GetInfo(node->InputAt(1)); 2474 NodeInfo* input_info = GetInfo(node->InputAt(1));
2475 MachineRepresentation field_representation =
2476 access.machine_type.representation();
2477
2478 // Make sure we convert to Smi if possible. This should help write
2479 // barrier elimination.
2480 if (field_representation == MachineRepresentation::kTagged &&
2481 TypeOf(node->InputAt(1))->Is(Type::SignedSmall())) {
2482 field_representation = MachineRepresentation::kTaggedSigned;
2483 }
2475 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor( 2484 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor(
2476 access.base_is_tagged, access.machine_type.representation(), 2485 access.base_is_tagged, field_representation, access.offset,
2477 access.offset, access.type, input_info->representation(), 2486 access.type, input_info->representation(), node->InputAt(1));
Benedikt Meurer 2017/06/06 10:32:47 Please give the node->InputAt(1) a name. (Same bel
2478 node->InputAt(1)); 2487
2479 ProcessInput(node, 0, UseInfoForBasePointer(access)); 2488 ProcessInput(node, 0, UseInfoForBasePointer(access));
2480 ProcessInput(node, 1, TruncatingUseInfoFromRepresentation( 2489 ProcessInput(node, 1,
2481 access.machine_type.representation())); 2490 TruncatingUseInfoFromRepresentation(field_representation));
2482 ProcessRemainingInputs(node, 2); 2491 ProcessRemainingInputs(node, 2);
2483 SetOutput(node, MachineRepresentation::kNone); 2492 SetOutput(node, MachineRepresentation::kNone);
2484 if (lower()) { 2493 if (lower()) {
2485 if (write_barrier_kind < access.write_barrier_kind) { 2494 if (write_barrier_kind < access.write_barrier_kind) {
2486 access.write_barrier_kind = write_barrier_kind; 2495 access.write_barrier_kind = write_barrier_kind;
2487 NodeProperties::ChangeOp( 2496 NodeProperties::ChangeOp(
2488 node, jsgraph_->simplified()->StoreField(access)); 2497 node, jsgraph_->simplified()->StoreField(access));
2489 } 2498 }
2490 } 2499 }
2491 return; 2500 return;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2541 if (truncation.IsUnused()) return VisitUnused(node); 2550 if (truncation.IsUnused()) return VisitUnused(node);
2542 ElementAccess access = ElementAccessOf(node->op()); 2551 ElementAccess access = ElementAccessOf(node->op());
2543 VisitBinop(node, UseInfoForBasePointer(access), 2552 VisitBinop(node, UseInfoForBasePointer(access),
2544 UseInfo::TruncatingWord32(), 2553 UseInfo::TruncatingWord32(),
2545 access.machine_type.representation()); 2554 access.machine_type.representation());
2546 return; 2555 return;
2547 } 2556 }
2548 case IrOpcode::kStoreElement: { 2557 case IrOpcode::kStoreElement: {
2549 ElementAccess access = ElementAccessOf(node->op()); 2558 ElementAccess access = ElementAccessOf(node->op());
2550 NodeInfo* input_info = GetInfo(node->InputAt(2)); 2559 NodeInfo* input_info = GetInfo(node->InputAt(2));
2560 MachineRepresentation element_representation =
2561 access.machine_type.representation();
2562
2563 // Make sure we convert to Smi if possible. This should help write
2564 // barrier elimination.
2565 if (element_representation == MachineRepresentation::kTagged &&
2566 TypeOf(node->InputAt(2))->Is(Type::SignedSmall())) {
2567 element_representation = MachineRepresentation::kTaggedSigned;
2568 }
2551 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor( 2569 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor(
2552 access.base_is_tagged, access.machine_type.representation(), 2570 access.base_is_tagged, element_representation, access.type,
2553 access.type, input_info->representation(), node->InputAt(2)); 2571 input_info->representation(), node->InputAt(2));
2554 ProcessInput(node, 0, UseInfoForBasePointer(access)); // base 2572 ProcessInput(node, 0, UseInfoForBasePointer(access)); // base
2555 ProcessInput(node, 1, UseInfo::TruncatingWord32()); // index 2573 ProcessInput(node, 1, UseInfo::TruncatingWord32()); // index
2556 ProcessInput(node, 2, 2574 ProcessInput(node, 2,
2557 TruncatingUseInfoFromRepresentation( 2575 TruncatingUseInfoFromRepresentation(
2558 access.machine_type.representation())); // value 2576 element_representation)); // value
2559 ProcessRemainingInputs(node, 3); 2577 ProcessRemainingInputs(node, 3);
2560 SetOutput(node, MachineRepresentation::kNone); 2578 SetOutput(node, MachineRepresentation::kNone);
2561 if (lower()) { 2579 if (lower()) {
2562 if (write_barrier_kind < access.write_barrier_kind) { 2580 if (write_barrier_kind < access.write_barrier_kind) {
2563 access.write_barrier_kind = write_barrier_kind; 2581 access.write_barrier_kind = write_barrier_kind;
2564 NodeProperties::ChangeOp( 2582 NodeProperties::ChangeOp(
2565 node, jsgraph_->simplified()->StoreElement(access)); 2583 node, jsgraph_->simplified()->StoreElement(access));
2566 } 2584 }
2567 } 2585 }
2568 return; 2586 return;
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3716 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3734 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3717 Operator::kNoProperties); 3735 Operator::kNoProperties);
3718 to_number_operator_.set(common()->Call(desc)); 3736 to_number_operator_.set(common()->Call(desc));
3719 } 3737 }
3720 return to_number_operator_.get(); 3738 return to_number_operator_.get();
3721 } 3739 }
3722 3740
3723 } // namespace compiler 3741 } // namespace compiler
3724 } // namespace internal 3742 } // namespace internal
3725 } // namespace v8 3743 } // 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