Chromium Code Reviews| 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/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 893 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 904 } | 904 } |
| 905 | 905 |
| 906 // Convert inputs to the output representation of this phi, pass the | 906 // Convert inputs to the output representation of this phi, pass the |
| 907 // truncation along. | 907 // truncation along. |
| 908 UseInfo input_use(output, truncation); | 908 UseInfo input_use(output, truncation); |
| 909 for (int i = 0; i < node->InputCount(); i++) { | 909 for (int i = 0; i < node->InputCount(); i++) { |
| 910 ProcessInput(node, i, i < values ? input_use : UseInfo::None()); | 910 ProcessInput(node, i, i < values ? input_use : UseInfo::None()); |
| 911 } | 911 } |
| 912 } | 912 } |
| 913 | 913 |
| 914 void VisitObjectIs(Node* node, Type* type, SimplifiedLowering* lowering) { | |
| 915 Type* const input_type = TypeOf(node->InputAt(0)); | |
| 916 if (input_type->Is(type)) { | |
| 917 VisitUnop(node, UseInfo::None(), MachineRepresentation::kBit); | |
|
Jarin
2016/09/16 15:37:11
Does it really buy you anything to send UseInfo::N
Benedikt Meurer
2016/09/16 17:14:32
I guess that would work. Do you want me to change
| |
| 918 if (lower()) { | |
| 919 DeferReplacement(node, lowering->jsgraph()->Int32Constant(1)); | |
| 920 } | |
| 921 } else { | |
| 922 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit); | |
| 923 if (lower() && !input_type->Maybe(type)) { | |
| 924 DeferReplacement(node, lowering->jsgraph()->Int32Constant(0)); | |
| 925 } | |
| 926 } | |
| 927 } | |
| 928 | |
| 914 void VisitCall(Node* node, SimplifiedLowering* lowering) { | 929 void VisitCall(Node* node, SimplifiedLowering* lowering) { |
| 915 const CallDescriptor* desc = CallDescriptorOf(node->op()); | 930 const CallDescriptor* desc = CallDescriptorOf(node->op()); |
| 916 int params = static_cast<int>(desc->ParameterCount()); | 931 int params = static_cast<int>(desc->ParameterCount()); |
| 917 int value_input_count = node->op()->ValueInputCount(); | 932 int value_input_count = node->op()->ValueInputCount(); |
| 918 // Propagate representation information from call descriptor. | 933 // Propagate representation information from call descriptor. |
| 919 for (int i = 0; i < value_input_count; i++) { | 934 for (int i = 0; i < value_input_count; i++) { |
| 920 if (i == 0) { | 935 if (i == 0) { |
| 921 // The target of the call. | 936 // The target of the call. |
| 922 ProcessInput(node, i, UseInfo::Any()); | 937 ProcessInput(node, i, UseInfo::Any()); |
| 923 } else if ((i - 1) < params) { | 938 } else if ((i - 1) < params) { |
| (...skipping 1408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2332 if (lower()) { | 2347 if (lower()) { |
| 2333 NodeProperties::ChangeOp(node, | 2348 NodeProperties::ChangeOp(node, |
| 2334 simplified()->PlainPrimitiveToFloat64()); | 2349 simplified()->PlainPrimitiveToFloat64()); |
| 2335 } | 2350 } |
| 2336 } | 2351 } |
| 2337 } else { | 2352 } else { |
| 2338 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); | 2353 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kTagged); |
| 2339 } | 2354 } |
| 2340 return; | 2355 return; |
| 2341 } | 2356 } |
| 2342 case IrOpcode::kObjectIsCallable: | 2357 case IrOpcode::kObjectIsCallable: { |
| 2343 case IrOpcode::kObjectIsNumber: | 2358 // TODO(turbofan): Add Type::Callable to optimize this? |
| 2344 case IrOpcode::kObjectIsReceiver: | 2359 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit); |
| 2345 case IrOpcode::kObjectIsSmi: | 2360 return; |
| 2346 case IrOpcode::kObjectIsString: | 2361 } |
| 2347 case IrOpcode::kObjectIsUndetectable: | 2362 case IrOpcode::kObjectIsNumber: { |
| 2363 VisitObjectIs(node, Type::Number(), lowering); | |
| 2364 return; | |
| 2365 } | |
| 2366 case IrOpcode::kObjectIsReceiver: { | |
| 2367 VisitObjectIs(node, Type::Receiver(), lowering); | |
| 2368 return; | |
| 2369 } | |
| 2370 case IrOpcode::kObjectIsSmi: { | |
| 2371 // TODO(turbofan): Optimize based on input representation. | |
| 2372 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit); | |
| 2373 return; | |
| 2374 } | |
| 2375 case IrOpcode::kObjectIsString: { | |
| 2376 VisitObjectIs(node, Type::String(), lowering); | |
| 2377 return; | |
| 2378 } | |
| 2379 case IrOpcode::kObjectIsUndetectable: { | |
| 2380 VisitObjectIs(node, Type::Undetectable(), lowering); | |
| 2381 return; | |
| 2382 } | |
| 2348 case IrOpcode::kArrayBufferWasNeutered: { | 2383 case IrOpcode::kArrayBufferWasNeutered: { |
| 2349 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit); | 2384 VisitUnop(node, UseInfo::AnyTagged(), MachineRepresentation::kBit); |
| 2350 return; | 2385 return; |
| 2351 } | 2386 } |
| 2352 case IrOpcode::kCheckFloat64Hole: { | 2387 case IrOpcode::kCheckFloat64Hole: { |
| 2353 if (truncation.IsUnused()) return VisitUnused(node); | 2388 if (truncation.IsUnused()) return VisitUnused(node); |
| 2354 CheckFloat64HoleMode mode = CheckFloat64HoleModeOf(node->op()); | 2389 CheckFloat64HoleMode mode = CheckFloat64HoleModeOf(node->op()); |
| 2355 ProcessInput(node, 0, UseInfo::TruncatingFloat64()); | 2390 ProcessInput(node, 0, UseInfo::TruncatingFloat64()); |
| 2356 ProcessRemainingInputs(node, 1); | 2391 ProcessRemainingInputs(node, 1); |
| 2357 SetOutput(node, MachineRepresentation::kFloat64); | 2392 SetOutput(node, MachineRepresentation::kFloat64); |
| (...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3225 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3260 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
| 3226 Operator::kNoProperties); | 3261 Operator::kNoProperties); |
| 3227 to_number_operator_.set(common()->Call(desc)); | 3262 to_number_operator_.set(common()->Call(desc)); |
| 3228 } | 3263 } |
| 3229 return to_number_operator_.get(); | 3264 return to_number_operator_.get(); |
| 3230 } | 3265 } |
| 3231 | 3266 |
| 3232 } // namespace compiler | 3267 } // namespace compiler |
| 3233 } // namespace internal | 3268 } // namespace internal |
| 3234 } // namespace v8 | 3269 } // namespace v8 |
| OLD | NEW |