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/js-typed-lowering.cc

Issue 2125593002: [turbofan] Remove eager frame state from add and subtract. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 5 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 | src/compiler/operator-properties.cc » ('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/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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 if (feedback != BinaryOperationHints::kAny) { 448 if (feedback != BinaryOperationHints::kAny) {
449 // Lower to the optimistic number binop. 449 // Lower to the optimistic number binop.
450 return r.ChangeToSpeculativeOperator( 450 return r.ChangeToSpeculativeOperator(
451 simplified()->SpeculativeNumberAdd(feedback), Type::Number()); 451 simplified()->SpeculativeNumberAdd(feedback), Type::Number());
452 } 452 }
453 if (r.BothInputsAre(Type::Number())) { 453 if (r.BothInputsAre(Type::Number())) {
454 // JSAdd(x:number, y:number) => NumberAdd(x, y) 454 // JSAdd(x:number, y:number) => NumberAdd(x, y)
455 r.ConvertInputsToNumber(); 455 r.ConvertInputsToNumber();
456 return r.ChangeToPureOperator(simplified()->NumberAdd(), Type::Number()); 456 return r.ChangeToPureOperator(simplified()->NumberAdd(), Type::Number());
457 } 457 }
458 if (r.NeitherInputCanBe(Type::StringOrReceiver())) { 458 if ((r.BothInputsAre(Type::PlainPrimitive()) ||
459 !(flags() & kDeoptimizationEnabled)) &&
460 r.NeitherInputCanBe(Type::StringOrReceiver())) {
459 // JSAdd(x:-string, y:-string) => NumberAdd(ToNumber(x), ToNumber(y)) 461 // JSAdd(x:-string, y:-string) => NumberAdd(ToNumber(x), ToNumber(y))
460 r.ConvertInputsToNumber(); 462 r.ConvertInputsToNumber();
461 return r.ChangeToPureOperator(simplified()->NumberAdd(), Type::Number()); 463 return r.ChangeToPureOperator(simplified()->NumberAdd(), Type::Number());
462 } 464 }
463 if (r.OneInputIs(Type::String())) { 465 if (r.OneInputIs(Type::String())) {
464 StringAddFlags flags = STRING_ADD_CHECK_NONE; 466 StringAddFlags flags = STRING_ADD_CHECK_NONE;
465 if (!r.LeftInputIs(Type::String())) { 467 if (!r.LeftInputIs(Type::String())) {
466 flags = STRING_ADD_CONVERT_LEFT; 468 flags = STRING_ADD_CONVERT_LEFT;
467 } else if (!r.RightInputIs(Type::String())) { 469 } else if (!r.RightInputIs(Type::String())) {
468 flags = STRING_ADD_CONVERT_RIGHT; 470 flags = STRING_ADD_CONVERT_RIGHT;
469 } 471 }
470 // JSAdd(x:string, y) => CallStub[StringAdd](x, y) 472 // JSAdd(x:string, y) => CallStub[StringAdd](x, y)
471 // JSAdd(x, y:string) => CallStub[StringAdd](x, y) 473 // JSAdd(x, y:string) => CallStub[StringAdd](x, y)
472 Callable const callable = 474 Callable const callable =
473 CodeFactory::StringAdd(isolate(), flags, NOT_TENURED); 475 CodeFactory::StringAdd(isolate(), flags, NOT_TENURED);
474 CallDescriptor const* const desc = Linkage::GetStubCallDescriptor( 476 CallDescriptor const* const desc = Linkage::GetStubCallDescriptor(
475 isolate(), graph()->zone(), callable.descriptor(), 0, 477 isolate(), graph()->zone(), callable.descriptor(), 0,
476 CallDescriptor::kNeedsFrameState, node->op()->properties()); 478 CallDescriptor::kNeedsFrameState, node->op()->properties());
477 DCHECK_EQ(2, OperatorProperties::GetFrameStateInputCount(node->op())); 479 DCHECK_EQ(1, OperatorProperties::GetFrameStateInputCount(node->op()));
478 node->RemoveInput(NodeProperties::FirstFrameStateIndex(node) + 1);
479 node->InsertInput(graph()->zone(), 0, 480 node->InsertInput(graph()->zone(), 0,
480 jsgraph()->HeapConstant(callable.code())); 481 jsgraph()->HeapConstant(callable.code()));
481 NodeProperties::ChangeOp(node, common()->Call(desc)); 482 NodeProperties::ChangeOp(node, common()->Call(desc));
482 return Changed(node); 483 return Changed(node);
483 } 484 }
484 return NoChange(); 485 return NoChange();
485 } 486 }
486 487
487 488
488 Reduction JSTypedLowering::ReduceJSModulus(Node* node) { 489 Reduction JSTypedLowering::ReduceJSModulus(Node* node) {
(...skipping 22 matching lines...) Expand all
511 // => NumberSubtract(ToNumber(x), ToNumber(y)) 512 // => NumberSubtract(ToNumber(x), ToNumber(y))
512 r.ConvertInputsToNumber(); 513 r.ConvertInputsToNumber();
513 return r.ChangeToPureOperator(simplified()->NumberSubtract(), 514 return r.ChangeToPureOperator(simplified()->NumberSubtract(),
514 Type::Number()); 515 Type::Number());
515 } 516 }
516 if (feedback != BinaryOperationHints::kAny) { 517 if (feedback != BinaryOperationHints::kAny) {
517 // Lower to the optimistic number binop. 518 // Lower to the optimistic number binop.
518 return r.ChangeToSpeculativeOperator( 519 return r.ChangeToSpeculativeOperator(
519 simplified()->SpeculativeNumberSubtract(feedback), Type::Number()); 520 simplified()->SpeculativeNumberSubtract(feedback), Type::Number());
520 } 521 }
521 r.ConvertInputsToNumber(); 522
522 return r.ChangeToPureOperator(simplified()->NumberSubtract(), Type::Number()); 523 // If deoptimization is enabled we rely on type feedback.
524 if (r.BothInputsAre(Type::PlainPrimitive()) ||
525 !(flags() & kDeoptimizationEnabled)) {
526 r.ConvertInputsToNumber();
527 return r.ChangeToPureOperator(simplified()->NumberSubtract(),
528 Type::Number());
529 }
530
531 return NoChange();
523 } 532 }
524 533
525 Reduction JSTypedLowering::ReduceJSMultiply(Node* node) { 534 Reduction JSTypedLowering::ReduceJSMultiply(Node* node) {
526 if (flags() & kDisableBinaryOpReduction) return NoChange(); 535 if (flags() & kDisableBinaryOpReduction) return NoChange();
527 JSBinopReduction r(this, node); 536 JSBinopReduction r(this, node);
528 537
529 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback(); 538 BinaryOperationHints::Hint feedback = r.GetNumberBinaryOperationFeedback();
530 if (feedback != BinaryOperationHints::kAny) { 539 if (feedback != BinaryOperationHints::kAny) {
531 return r.ChangeToSpeculativeOperator( 540 return r.ChangeToSpeculativeOperator(
532 simplified()->SpeculativeNumberMultiply(feedback), Type::Number()); 541 simplified()->SpeculativeNumberMultiply(feedback), Type::Number());
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after
2040 } 2049 }
2041 2050
2042 2051
2043 CompilationDependencies* JSTypedLowering::dependencies() const { 2052 CompilationDependencies* JSTypedLowering::dependencies() const {
2044 return dependencies_; 2053 return dependencies_;
2045 } 2054 }
2046 2055
2047 } // namespace compiler 2056 } // namespace compiler
2048 } // namespace internal 2057 } // namespace internal
2049 } // namespace v8 2058 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/operator-properties.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698