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

Side by Side Diff: src/code-stubs.cc

Issue 1743433002: Revert of [compiler] Drop the CompareNilIC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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/code-stubs.h ('k') | src/code-stubs-hydrogen.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/compiler/code-stub-assembler.h" 10 #include "src/compiler/code-stub-assembler.h"
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 DCHECK(*known_map_ != NULL); 444 DCHECK(*known_map_ != NULL);
445 GenerateKnownReceivers(masm); 445 GenerateKnownReceivers(masm);
446 break; 446 break;
447 case CompareICState::GENERIC: 447 case CompareICState::GENERIC:
448 GenerateGeneric(masm); 448 GenerateGeneric(masm);
449 break; 449 break;
450 } 450 }
451 } 451 }
452 452
453 453
454 void CompareNilICStub::UpdateStatus(Handle<Object> object) {
455 State state = this->state();
456 DCHECK(!state.Contains(GENERIC));
457 State old_state = state;
458 if (object->IsNull()) {
459 state.Add(NULL_TYPE);
460 } else if (object->IsUndefined()) {
461 state.Add(UNDEFINED);
462 } else if (object->IsUndetectableObject() || object->IsSmi()) {
463 state.RemoveAll();
464 state.Add(GENERIC);
465 } else if (IsMonomorphic()) {
466 state.RemoveAll();
467 state.Add(GENERIC);
468 } else {
469 state.Add(MONOMORPHIC_MAP);
470 }
471 TraceTransition(old_state, state);
472 set_sub_minor_key(TypesBits::update(sub_minor_key(), state.ToIntegral()));
473 }
474
475
454 Handle<Code> TurboFanCodeStub::GenerateCode() { 476 Handle<Code> TurboFanCodeStub::GenerateCode() {
455 const char* name = CodeStub::MajorName(MajorKey()); 477 const char* name = CodeStub::MajorName(MajorKey());
456 Zone zone; 478 Zone zone;
457 CallInterfaceDescriptor descriptor(GetCallInterfaceDescriptor()); 479 CallInterfaceDescriptor descriptor(GetCallInterfaceDescriptor());
458 compiler::CodeStubAssembler assembler(isolate(), &zone, descriptor, 480 compiler::CodeStubAssembler assembler(isolate(), &zone, descriptor,
459 GetCodeFlags(), name); 481 GetCodeFlags(), name);
460 GenerateAssembly(&assembler); 482 GenerateAssembly(&assembler);
461 return assembler.GenerateCode(); 483 return assembler.GenerateCode();
462 } 484 }
463 485
(...skipping 15 matching lines...) Expand all
479 // bug somewhere in our state transition machinery. 501 // bug somewhere in our state transition machinery.
480 DCHECK(from != to); 502 DCHECK(from != to);
481 if (!FLAG_trace_ic) return; 503 if (!FLAG_trace_ic) return;
482 OFStream os(stdout); 504 OFStream os(stdout);
483 os << "["; 505 os << "[";
484 PrintBaseName(os); 506 PrintBaseName(os);
485 os << ": " << from << "=>" << to << "]" << std::endl; 507 os << ": " << from << "=>" << to << "]" << std::endl;
486 } 508 }
487 509
488 510
511 void CompareNilICStub::PrintBaseName(std::ostream& os) const { // NOLINT
512 CodeStub::PrintBaseName(os);
513 os << ((nil_value() == kNullValue) ? "(NullValue)" : "(UndefinedValue)");
514 }
515
516
517 void CompareNilICStub::PrintState(std::ostream& os) const { // NOLINT
518 os << state();
519 }
520
521
489 // TODO(svenpanne) Make this a real infix_ostream_iterator. 522 // TODO(svenpanne) Make this a real infix_ostream_iterator.
490 class SimpleListPrinter { 523 class SimpleListPrinter {
491 public: 524 public:
492 explicit SimpleListPrinter(std::ostream& os) : os_(os), first_(true) {} 525 explicit SimpleListPrinter(std::ostream& os) : os_(os), first_(true) {}
493 526
494 void Add(const char* s) { 527 void Add(const char* s) {
495 if (first_) { 528 if (first_) {
496 first_ = false; 529 first_ = false;
497 } else { 530 } else {
498 os_ << ","; 531 os_ << ",";
499 } 532 }
500 os_ << s; 533 os_ << s;
501 } 534 }
502 535
503 private: 536 private:
504 std::ostream& os_; 537 std::ostream& os_;
505 bool first_; 538 bool first_;
506 }; 539 };
507 540
508 541
542 std::ostream& operator<<(std::ostream& os, const CompareNilICStub::State& s) {
543 os << "(";
544 SimpleListPrinter p(os);
545 if (s.IsEmpty()) p.Add("None");
546 if (s.Contains(CompareNilICStub::UNDEFINED)) p.Add("Undefined");
547 if (s.Contains(CompareNilICStub::NULL_TYPE)) p.Add("Null");
548 if (s.Contains(CompareNilICStub::MONOMORPHIC_MAP)) p.Add("MonomorphicMap");
549 if (s.Contains(CompareNilICStub::GENERIC)) p.Add("Generic");
550 return os << ")";
551 }
552
553
554 Type* CompareNilICStub::GetType(Zone* zone, Handle<Map> map) {
555 State state = this->state();
556 if (state.Contains(CompareNilICStub::GENERIC)) return Type::Any();
557
558 Type* result = Type::None();
559 if (state.Contains(CompareNilICStub::UNDEFINED)) {
560 result = Type::Union(result, Type::Undefined(), zone);
561 }
562 if (state.Contains(CompareNilICStub::NULL_TYPE)) {
563 result = Type::Union(result, Type::Null(), zone);
564 }
565 if (state.Contains(CompareNilICStub::MONOMORPHIC_MAP)) {
566 Type* type = map.is_null() ? Type::Detectable() : Type::Class(map, zone);
567 result = Type::Union(result, type, zone);
568 }
569
570 return result;
571 }
572
573
574 Type* CompareNilICStub::GetInputType(Zone* zone, Handle<Map> map) {
575 Type* output_type = GetType(zone, map);
576 Type* nil_type = nil_value() == kNullValue ? Type::Null() : Type::Undefined();
577 return Type::Union(output_type, nil_type, zone);
578 }
579
580
509 void CallICStub::PrintState(std::ostream& os) const { // NOLINT 581 void CallICStub::PrintState(std::ostream& os) const { // NOLINT
510 os << state(); 582 os << state();
511 } 583 }
512 584
513 585
514 void JSEntryStub::FinishCode(Handle<Code> code) { 586 void JSEntryStub::FinishCode(Handle<Code> code) {
515 Handle<FixedArray> handler_table = 587 Handle<FixedArray> handler_table =
516 code->GetIsolate()->factory()->NewFixedArray(1, TENURED); 588 code->GetIsolate()->factory()->NewFixedArray(1, TENURED);
517 handler_table->set(0, Smi::FromInt(handler_offset_)); 589 handler_table->set(0, Smi::FromInt(handler_offset_));
518 code->set_handler_table(*handler_table); 590 code->set_handler_table(*handler_table);
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 descriptor->Initialize(); 732 descriptor->Initialize();
661 } 733 }
662 734
663 735
664 void AllocateInNewSpaceStub::InitializeDescriptor( 736 void AllocateInNewSpaceStub::InitializeDescriptor(
665 CodeStubDescriptor* descriptor) { 737 CodeStubDescriptor* descriptor) {
666 descriptor->Initialize(); 738 descriptor->Initialize();
667 } 739 }
668 740
669 741
742 void CompareNilICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
743 descriptor->Initialize(FUNCTION_ADDR(Runtime_CompareNilIC_Miss));
744 descriptor->SetMissHandler(ExternalReference(
745 Runtime::FunctionForId(Runtime::kCompareNilIC_Miss), isolate()));
746 }
747
748
670 void ToBooleanStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { 749 void ToBooleanStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
671 descriptor->Initialize(FUNCTION_ADDR(Runtime_ToBooleanIC_Miss)); 750 descriptor->Initialize(FUNCTION_ADDR(Runtime_ToBooleanIC_Miss));
672 descriptor->SetMissHandler(ExternalReference( 751 descriptor->SetMissHandler(ExternalReference(
673 Runtime::FunctionForId(Runtime::kToBooleanIC_Miss), isolate())); 752 Runtime::FunctionForId(Runtime::kToBooleanIC_Miss), isolate()));
674 } 753 }
675 754
676 755
677 void BinaryOpICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { 756 void BinaryOpICStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
678 descriptor->Initialize(FUNCTION_ADDR(Runtime_BinaryOpIC_Miss)); 757 descriptor->Initialize(FUNCTION_ADDR(Runtime_BinaryOpIC_Miss));
679 descriptor->SetMissHandler(ExternalReference( 758 descriptor->SetMissHandler(ExternalReference(
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 if (type->Is(Type::UntaggedPointer())) { 986 if (type->Is(Type::UntaggedPointer())) {
908 return Representation::External(); 987 return Representation::External();
909 } 988 }
910 989
911 DCHECK(!type->Is(Type::Untagged())); 990 DCHECK(!type->Is(Type::Untagged()));
912 return Representation::Tagged(); 991 return Representation::Tagged();
913 } 992 }
914 993
915 } // namespace internal 994 } // namespace internal
916 } // namespace v8 995 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698