OLD | NEW |
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/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/compilation-dependencies.h" | 6 #include "src/compilation-dependencies.h" |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/js-typed-lowering.h" | 9 #include "src/compiler/js-typed-lowering.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 if (number_reduction.Changed()) { | 1056 if (number_reduction.Changed()) { |
1057 value = number_reduction.replacement(); | 1057 value = number_reduction.replacement(); |
1058 } else { | 1058 } else { |
1059 Node* frame_state_for_to_number = | 1059 Node* frame_state_for_to_number = |
1060 NodeProperties::GetFrameStateInput(node, 1); | 1060 NodeProperties::GetFrameStateInput(node, 1); |
1061 value = effect = | 1061 value = effect = |
1062 graph()->NewNode(javascript()->ToNumber(), value, context, | 1062 graph()->NewNode(javascript()->ToNumber(), value, context, |
1063 frame_state_for_to_number, effect, control); | 1063 frame_state_for_to_number, effect, control); |
1064 } | 1064 } |
1065 } | 1065 } |
1066 // For integer-typed arrays, convert to the integer type. | |
1067 if (access.machine_type().semantic() == MachineSemantic::kInt32 && | |
1068 !value_type->Is(Type::Signed32())) { | |
1069 value = graph()->NewNode(simplified()->NumberToInt32(), value); | |
1070 } else if (access.machine_type().semantic() == | |
1071 MachineSemantic::kUint32 && | |
1072 !value_type->Is(Type::Unsigned32())) { | |
1073 value = graph()->NewNode(simplified()->NumberToUint32(), value); | |
1074 } | |
1075 // Check if we can avoid the bounds check. | 1066 // Check if we can avoid the bounds check. |
1076 if (key_type->Min() >= 0 && key_type->Max() < array->length_value()) { | 1067 if (key_type->Min() >= 0 && key_type->Max() < array->length_value()) { |
1077 RelaxControls(node); | 1068 RelaxControls(node); |
1078 node->ReplaceInput(0, buffer); | 1069 node->ReplaceInput(0, buffer); |
1079 DCHECK_EQ(key, node->InputAt(1)); | 1070 DCHECK_EQ(key, node->InputAt(1)); |
1080 node->ReplaceInput(2, value); | 1071 node->ReplaceInput(2, value); |
1081 node->ReplaceInput(3, effect); | 1072 node->ReplaceInput(3, effect); |
1082 node->ReplaceInput(4, control); | 1073 node->ReplaceInput(4, control); |
1083 node->TrimInputCount(5); | 1074 node->TrimInputCount(5); |
1084 NodeProperties::ChangeOp( | 1075 NodeProperties::ChangeOp( |
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2698 } | 2689 } |
2699 | 2690 |
2700 | 2691 |
2701 CompilationDependencies* JSTypedLowering::dependencies() const { | 2692 CompilationDependencies* JSTypedLowering::dependencies() const { |
2702 return dependencies_; | 2693 return dependencies_; |
2703 } | 2694 } |
2704 | 2695 |
2705 } // namespace compiler | 2696 } // namespace compiler |
2706 } // namespace internal | 2697 } // namespace internal |
2707 } // namespace v8 | 2698 } // namespace v8 |
OLD | NEW |