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

Side by Side Diff: src/compiler/code-generator.cc

Issue 1015423002: [turbofan] Remember types for deoptimization during simplified lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address review comments Created 5 years, 9 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/common-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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/compiler/code-generator-impl.h" 7 #include "src/compiler/code-generator-impl.h"
8 #include "src/compiler/linkage.h" 8 #include "src/compiler/linkage.h"
9 #include "src/compiler/pipeline.h" 9 #include "src/compiler/pipeline.h"
10 10
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 502
503 return deoptimization_id; 503 return deoptimization_id;
504 } 504 }
505 505
506 506
507 void CodeGenerator::AddTranslationForOperand(Translation* translation, 507 void CodeGenerator::AddTranslationForOperand(Translation* translation,
508 Instruction* instr, 508 Instruction* instr,
509 InstructionOperand* op, 509 InstructionOperand* op,
510 MachineType type) { 510 MachineType type) {
511 if (op->IsStackSlot()) { 511 if (op->IsStackSlot()) {
512 if (type == kMachBool || type == kMachInt32 || type == kMachInt8 || 512 // TODO(jarin) kMachBool and kRepBit should materialize true and false
513 type == kMachInt16) { 513 // rather than creating an int value.
514 if (type == kMachBool || type == kRepBit || type == kMachInt32 ||
515 type == kMachInt8 || type == kMachInt16) {
514 translation->StoreInt32StackSlot(op->index()); 516 translation->StoreInt32StackSlot(op->index());
515 } else if (type == kMachUint32 || type == kMachUint16 || 517 } else if (type == kMachUint32 || type == kMachUint16 ||
516 type == kMachUint8) { 518 type == kMachUint8) {
517 translation->StoreUint32StackSlot(op->index()); 519 translation->StoreUint32StackSlot(op->index());
518 } else if ((type & kRepMask) == kRepTagged) { 520 } else if ((type & kRepMask) == kRepTagged) {
519 translation->StoreStackSlot(op->index()); 521 translation->StoreStackSlot(op->index());
520 } else { 522 } else {
521 CHECK(false); 523 CHECK(false);
522 } 524 }
523 } else if (op->IsDoubleStackSlot()) { 525 } else if (op->IsDoubleStackSlot()) {
524 DCHECK((type & (kRepFloat32 | kRepFloat64)) != 0); 526 DCHECK((type & (kRepFloat32 | kRepFloat64)) != 0);
525 translation->StoreDoubleStackSlot(op->index()); 527 translation->StoreDoubleStackSlot(op->index());
526 } else if (op->IsRegister()) { 528 } else if (op->IsRegister()) {
527 InstructionOperandConverter converter(this, instr); 529 InstructionOperandConverter converter(this, instr);
528 if (type == kMachBool || type == kMachInt32 || type == kMachInt8 || 530 // TODO(jarin) kMachBool and kRepBit should materialize true and false
529 type == kMachInt16) { 531 // rather than creating an int value.
532 if (type == kMachBool || type == kRepBit || type == kMachInt32 ||
533 type == kMachInt8 || type == kMachInt16) {
530 translation->StoreInt32Register(converter.ToRegister(op)); 534 translation->StoreInt32Register(converter.ToRegister(op));
531 } else if (type == kMachUint32 || type == kMachUint16 || 535 } else if (type == kMachUint32 || type == kMachUint16 ||
532 type == kMachUint8) { 536 type == kMachUint8) {
533 translation->StoreUint32Register(converter.ToRegister(op)); 537 translation->StoreUint32Register(converter.ToRegister(op));
534 } else if ((type & kRepMask) == kRepTagged) { 538 } else if ((type & kRepMask) == kRepTagged) {
535 translation->StoreRegister(converter.ToRegister(op)); 539 translation->StoreRegister(converter.ToRegister(op));
536 } else { 540 } else {
537 CHECK(false); 541 CHECK(false);
538 } 542 }
539 } else if (op->IsDoubleRegister()) { 543 } else if (op->IsDoubleRegister()) {
540 DCHECK((type & (kRepFloat32 | kRepFloat64)) != 0); 544 DCHECK((type & (kRepFloat32 | kRepFloat64)) != 0);
541 InstructionOperandConverter converter(this, instr); 545 InstructionOperandConverter converter(this, instr);
542 translation->StoreDoubleRegister(converter.ToDoubleRegister(op)); 546 translation->StoreDoubleRegister(converter.ToDoubleRegister(op));
543 } else if (op->IsImmediate()) { 547 } else if (op->IsImmediate()) {
544 InstructionOperandConverter converter(this, instr); 548 InstructionOperandConverter converter(this, instr);
545 Constant constant = converter.ToConstant(op); 549 Constant constant = converter.ToConstant(op);
546 Handle<Object> constant_object; 550 Handle<Object> constant_object;
547 switch (constant.type()) { 551 switch (constant.type()) {
548 case Constant::kInt32: 552 case Constant::kInt32:
549 DCHECK(type == kMachInt32 || type == kMachUint32); 553 DCHECK(type == kMachInt32 || type == kMachUint32 || type == kRepBit);
550 constant_object = 554 constant_object =
551 isolate()->factory()->NewNumberFromInt(constant.ToInt32()); 555 isolate()->factory()->NewNumberFromInt(constant.ToInt32());
552 break; 556 break;
553 case Constant::kFloat64: 557 case Constant::kFloat64:
554 DCHECK(type == kMachFloat64 || type == kMachAnyTagged); 558 DCHECK(type == kMachFloat64 || type == kMachAnyTagged ||
559 type == kRepTagged || type == (kTypeInt32 | kRepTagged) ||
560 type == (kTypeUint32 | kRepTagged));
555 constant_object = isolate()->factory()->NewNumber(constant.ToFloat64()); 561 constant_object = isolate()->factory()->NewNumber(constant.ToFloat64());
556 break; 562 break;
557 case Constant::kHeapObject: 563 case Constant::kHeapObject:
558 DCHECK((type & kRepMask) == kRepTagged); 564 DCHECK((type & kRepMask) == kRepTagged);
559 constant_object = constant.ToHeapObject(); 565 constant_object = constant.ToHeapObject();
560 break; 566 break;
561 default: 567 default:
562 CHECK(false); 568 CHECK(false);
563 } 569 }
564 int literal_id = DefineDeoptimizationLiteral(constant_object); 570 int literal_id = DefineDeoptimizationLiteral(constant_object);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 : masm_(gen->masm()), next_(gen->ools_) { 639 : masm_(gen->masm()), next_(gen->ools_) {
634 gen->ools_ = this; 640 gen->ools_ = this;
635 } 641 }
636 642
637 643
638 OutOfLineCode::~OutOfLineCode() {} 644 OutOfLineCode::~OutOfLineCode() {}
639 645
640 } // namespace compiler 646 } // namespace compiler
641 } // namespace internal 647 } // namespace internal
642 } // namespace v8 648 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/common-operator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698