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

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

Issue 2925793002: [turbofan] Try harder to avoid write barriers when writing Smis. (Closed)
Patch Set: Address reviewer comments 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 2453 matching lines...) Expand 10 before | Expand all | Expand 10 after
2464 case IrOpcode::kLoadField: { 2464 case IrOpcode::kLoadField: {
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 Node* value_node = node->InputAt(1);
2475 NodeInfo* input_info = GetInfo(value_node);
2476 MachineRepresentation field_representation =
2477 access.machine_type.representation();
2478
2479 // Make sure we convert to Smi if possible. This should help write
2480 // barrier elimination.
2481 if (field_representation == MachineRepresentation::kTagged &&
2482 TypeOf(value_node)->Is(Type::SignedSmall())) {
2483 field_representation = MachineRepresentation::kTaggedSigned;
2484 }
2475 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor( 2485 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor(
2476 access.base_is_tagged, access.machine_type.representation(), 2486 access.base_is_tagged, field_representation, access.offset,
2477 access.offset, access.type, input_info->representation(), 2487 access.type, input_info->representation(), value_node);
2478 node->InputAt(1)); 2488
2479 ProcessInput(node, 0, UseInfoForBasePointer(access)); 2489 ProcessInput(node, 0, UseInfoForBasePointer(access));
2480 ProcessInput(node, 1, TruncatingUseInfoFromRepresentation( 2490 ProcessInput(node, 1,
2481 access.machine_type.representation())); 2491 TruncatingUseInfoFromRepresentation(field_representation));
2482 ProcessRemainingInputs(node, 2); 2492 ProcessRemainingInputs(node, 2);
2483 SetOutput(node, MachineRepresentation::kNone); 2493 SetOutput(node, MachineRepresentation::kNone);
2484 if (lower()) { 2494 if (lower()) {
2485 if (write_barrier_kind < access.write_barrier_kind) { 2495 if (write_barrier_kind < access.write_barrier_kind) {
2486 access.write_barrier_kind = write_barrier_kind; 2496 access.write_barrier_kind = write_barrier_kind;
2487 NodeProperties::ChangeOp( 2497 NodeProperties::ChangeOp(
2488 node, jsgraph_->simplified()->StoreField(access)); 2498 node, jsgraph_->simplified()->StoreField(access));
2489 } 2499 }
2490 } 2500 }
2491 return; 2501 return;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
2540 case IrOpcode::kLoadElement: { 2550 case IrOpcode::kLoadElement: {
2541 if (truncation.IsUnused()) return VisitUnused(node); 2551 if (truncation.IsUnused()) return VisitUnused(node);
2542 ElementAccess access = ElementAccessOf(node->op()); 2552 ElementAccess access = ElementAccessOf(node->op());
2543 VisitBinop(node, UseInfoForBasePointer(access), 2553 VisitBinop(node, UseInfoForBasePointer(access),
2544 UseInfo::TruncatingWord32(), 2554 UseInfo::TruncatingWord32(),
2545 access.machine_type.representation()); 2555 access.machine_type.representation());
2546 return; 2556 return;
2547 } 2557 }
2548 case IrOpcode::kStoreElement: { 2558 case IrOpcode::kStoreElement: {
2549 ElementAccess access = ElementAccessOf(node->op()); 2559 ElementAccess access = ElementAccessOf(node->op());
2550 NodeInfo* input_info = GetInfo(node->InputAt(2)); 2560 Node* value_node = node->InputAt(2);
2561 NodeInfo* input_info = GetInfo(value_node);
2562 MachineRepresentation element_representation =
2563 access.machine_type.representation();
2564
2565 // Make sure we convert to Smi if possible. This should help write
2566 // barrier elimination.
2567 if (element_representation == MachineRepresentation::kTagged &&
2568 TypeOf(value_node)->Is(Type::SignedSmall())) {
2569 element_representation = MachineRepresentation::kTaggedSigned;
2570 }
2551 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor( 2571 WriteBarrierKind write_barrier_kind = WriteBarrierKindFor(
2552 access.base_is_tagged, access.machine_type.representation(), 2572 access.base_is_tagged, element_representation, access.type,
2553 access.type, input_info->representation(), node->InputAt(2)); 2573 input_info->representation(), value_node);
2554 ProcessInput(node, 0, UseInfoForBasePointer(access)); // base 2574 ProcessInput(node, 0, UseInfoForBasePointer(access)); // base
2555 ProcessInput(node, 1, UseInfo::TruncatingWord32()); // index 2575 ProcessInput(node, 1, UseInfo::TruncatingWord32()); // index
2556 ProcessInput(node, 2, 2576 ProcessInput(node, 2,
2557 TruncatingUseInfoFromRepresentation( 2577 TruncatingUseInfoFromRepresentation(
2558 access.machine_type.representation())); // value 2578 element_representation)); // value
2559 ProcessRemainingInputs(node, 3); 2579 ProcessRemainingInputs(node, 3);
2560 SetOutput(node, MachineRepresentation::kNone); 2580 SetOutput(node, MachineRepresentation::kNone);
2561 if (lower()) { 2581 if (lower()) {
2562 if (write_barrier_kind < access.write_barrier_kind) { 2582 if (write_barrier_kind < access.write_barrier_kind) {
2563 access.write_barrier_kind = write_barrier_kind; 2583 access.write_barrier_kind = write_barrier_kind;
2564 NodeProperties::ChangeOp( 2584 NodeProperties::ChangeOp(
2565 node, jsgraph_->simplified()->StoreElement(access)); 2585 node, jsgraph_->simplified()->StoreElement(access));
2566 } 2586 }
2567 } 2587 }
2568 return; 2588 return;
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after
3716 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3736 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3717 Operator::kNoProperties); 3737 Operator::kNoProperties);
3718 to_number_operator_.set(common()->Call(desc)); 3738 to_number_operator_.set(common()->Call(desc));
3719 } 3739 }
3720 return to_number_operator_.get(); 3740 return to_number_operator_.get();
3721 } 3741 }
3722 3742
3723 } // namespace compiler 3743 } // namespace compiler
3724 } // namespace internal 3744 } // namespace internal
3725 } // namespace v8 3745 } // 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