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

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

Issue 2167593002: [turbofan] Introduce TruncateTaggedToBit operator for ToBoolean truncation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix remaining bugs. Created 4 years, 3 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 | « src/compiler/representation-change.cc ('k') | src/compiler/simplified-operator.h » ('j') | 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 1325 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 case IrOpcode::kSelect: 1336 case IrOpcode::kSelect:
1337 return VisitSelect(node, truncation, lowering); 1337 return VisitSelect(node, truncation, lowering);
1338 case IrOpcode::kPhi: 1338 case IrOpcode::kPhi:
1339 return VisitPhi(node, truncation, lowering); 1339 return VisitPhi(node, truncation, lowering);
1340 case IrOpcode::kCall: 1340 case IrOpcode::kCall:
1341 return VisitCall(node, lowering); 1341 return VisitCall(node, lowering);
1342 1342
1343 //------------------------------------------------------------------ 1343 //------------------------------------------------------------------
1344 // JavaScript operators. 1344 // JavaScript operators.
1345 //------------------------------------------------------------------ 1345 //------------------------------------------------------------------
1346 case IrOpcode::kJSToBoolean: {
1347 if (truncation.IsUsedAsBool()) {
1348 ProcessInput(node, 0, UseInfo::Bool());
1349 ProcessInput(node, 1, UseInfo::None());
1350 SetOutput(node, MachineRepresentation::kBit);
1351 if (lower()) DeferReplacement(node, node->InputAt(0));
1352 } else {
1353 VisitInputs(node);
1354 SetOutput(node, MachineRepresentation::kTagged);
1355 }
1356 return;
1357 }
1346 case IrOpcode::kJSToNumber: { 1358 case IrOpcode::kJSToNumber: {
1347 VisitInputs(node); 1359 VisitInputs(node);
1348 // TODO(bmeurer): Optimize somewhat based on input type? 1360 // TODO(bmeurer): Optimize somewhat based on input type?
1349 if (truncation.IsUsedAsWord32()) { 1361 if (truncation.IsUsedAsWord32()) {
1350 SetOutput(node, MachineRepresentation::kWord32); 1362 SetOutput(node, MachineRepresentation::kWord32);
1351 if (lower()) lowering->DoJSToNumberTruncatesToWord32(node, this); 1363 if (lower()) lowering->DoJSToNumberTruncatesToWord32(node, this);
1352 } else if (truncation.IsUsedAsFloat64()) { 1364 } else if (truncation.IsUsedAsFloat64()) {
1353 SetOutput(node, MachineRepresentation::kFloat64); 1365 SetOutput(node, MachineRepresentation::kFloat64);
1354 if (lower()) lowering->DoJSToNumberTruncatesToFloat64(node, this); 1366 if (lower()) lowering->DoJSToNumberTruncatesToFloat64(node, this);
1355 } else { 1367 } else {
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 case IrOpcode::kProjection: 2470 case IrOpcode::kProjection:
2459 case IrOpcode::kObjectState: 2471 case IrOpcode::kObjectState:
2460 // All JavaScript operators except JSToNumber have uniform handling. 2472 // All JavaScript operators except JSToNumber have uniform handling.
2461 #define OPCODE_CASE(name) case IrOpcode::k##name: 2473 #define OPCODE_CASE(name) case IrOpcode::k##name:
2462 JS_SIMPLE_BINOP_LIST(OPCODE_CASE) 2474 JS_SIMPLE_BINOP_LIST(OPCODE_CASE)
2463 JS_OTHER_UNOP_LIST(OPCODE_CASE) 2475 JS_OTHER_UNOP_LIST(OPCODE_CASE)
2464 JS_OBJECT_OP_LIST(OPCODE_CASE) 2476 JS_OBJECT_OP_LIST(OPCODE_CASE)
2465 JS_CONTEXT_OP_LIST(OPCODE_CASE) 2477 JS_CONTEXT_OP_LIST(OPCODE_CASE)
2466 JS_OTHER_OP_LIST(OPCODE_CASE) 2478 JS_OTHER_OP_LIST(OPCODE_CASE)
2467 #undef OPCODE_CASE 2479 #undef OPCODE_CASE
2468 case IrOpcode::kJSToBoolean:
2469 case IrOpcode::kJSToInteger: 2480 case IrOpcode::kJSToInteger:
2470 case IrOpcode::kJSToLength: 2481 case IrOpcode::kJSToLength:
2471 case IrOpcode::kJSToName: 2482 case IrOpcode::kJSToName:
2472 case IrOpcode::kJSToObject: 2483 case IrOpcode::kJSToObject:
2473 case IrOpcode::kJSToString: 2484 case IrOpcode::kJSToString:
2474 VisitInputs(node); 2485 VisitInputs(node);
2475 // Assume the output is tagged. 2486 // Assume the output is tagged.
2476 return SetOutput(node, MachineRepresentation::kTagged); 2487 return SetOutput(node, MachineRepresentation::kTagged);
2477 2488
2478 default: 2489 default:
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after
3238 isolate(), graph()->zone(), callable.descriptor(), 0, flags, 3249 isolate(), graph()->zone(), callable.descriptor(), 0, flags,
3239 Operator::kNoProperties); 3250 Operator::kNoProperties);
3240 to_number_operator_.set(common()->Call(desc)); 3251 to_number_operator_.set(common()->Call(desc));
3241 } 3252 }
3242 return to_number_operator_.get(); 3253 return to_number_operator_.get();
3243 } 3254 }
3244 3255
3245 } // namespace compiler 3256 } // namespace compiler
3246 } // namespace internal 3257 } // namespace internal
3247 } // namespace v8 3258 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/representation-change.cc ('k') | src/compiler/simplified-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698