OLD | NEW |
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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
10 #include "src/crankshaft/hydrogen.h" | 10 #include "src/crankshaft/hydrogen.h" |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 return environment()->Pop(); | 537 return environment()->Pop(); |
538 } | 538 } |
539 | 539 |
540 | 540 |
541 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { | 541 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { |
542 return DoGenerateCode(this); | 542 return DoGenerateCode(this); |
543 } | 543 } |
544 | 544 |
545 | 545 |
546 template <> | 546 template <> |
547 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { | |
548 // This stub is performance sensitive, the generated code must be tuned | |
549 // so that it doesn't build an eager frame. | |
550 info()->MarkMustNotHaveEagerFrame(); | |
551 | |
552 HValue* size = Add<HConstant>(AllocationSite::kSize); | |
553 HInstruction* object = | |
554 Add<HAllocate>(size, HType::JSObject(), TENURED, JS_OBJECT_TYPE, | |
555 graph()->GetConstant0()); | |
556 | |
557 // Store the map | |
558 Handle<Map> allocation_site_map = isolate()->factory()->allocation_site_map(); | |
559 AddStoreMapConstant(object, allocation_site_map); | |
560 | |
561 // Store the payload (smi elements kind) | |
562 HValue* initial_elements_kind = Add<HConstant>(GetInitialFastElementsKind()); | |
563 Add<HStoreNamedField>(object, | |
564 HObjectAccess::ForAllocationSiteOffset( | |
565 AllocationSite::kTransitionInfoOffset), | |
566 initial_elements_kind); | |
567 | |
568 // Unlike literals, constructed arrays don't have nested sites | |
569 Add<HStoreNamedField>(object, | |
570 HObjectAccess::ForAllocationSiteOffset( | |
571 AllocationSite::kNestedSiteOffset), | |
572 graph()->GetConstant0()); | |
573 | |
574 // Pretenuring calculation field. | |
575 Add<HStoreNamedField>(object, | |
576 HObjectAccess::ForAllocationSiteOffset( | |
577 AllocationSite::kPretenureDataOffset), | |
578 graph()->GetConstant0()); | |
579 | |
580 // Pretenuring memento creation count field. | |
581 Add<HStoreNamedField>(object, | |
582 HObjectAccess::ForAllocationSiteOffset( | |
583 AllocationSite::kPretenureCreateCountOffset), | |
584 graph()->GetConstant0()); | |
585 | |
586 // Store an empty fixed array for the code dependency. | |
587 HConstant* empty_fixed_array = | |
588 Add<HConstant>(isolate()->factory()->empty_fixed_array()); | |
589 Add<HStoreNamedField>( | |
590 object, | |
591 HObjectAccess::ForAllocationSiteOffset( | |
592 AllocationSite::kDependentCodeOffset), | |
593 empty_fixed_array); | |
594 | |
595 // Link the object to the allocation site list | |
596 HValue* site_list = Add<HConstant>( | |
597 ExternalReference::allocation_sites_list_address(isolate())); | |
598 HValue* site = Add<HLoadNamedField>(site_list, nullptr, | |
599 HObjectAccess::ForAllocationSiteList()); | |
600 // TODO(mvstanton): This is a store to a weak pointer, which we may want to | |
601 // mark as such in order to skip the write barrier, once we have a unified | |
602 // system for weakness. For now we decided to keep it like this because having | |
603 // an initial write barrier backed store makes this pointer strong until the | |
604 // next GC, and allocation sites are designed to survive several GCs anyway. | |
605 Add<HStoreNamedField>( | |
606 object, | |
607 HObjectAccess::ForAllocationSiteOffset(AllocationSite::kWeakNextOffset), | |
608 site); | |
609 Add<HStoreNamedField>(site_list, HObjectAccess::ForAllocationSiteList(), | |
610 object); | |
611 | |
612 HInstruction* feedback_vector = GetParameter(Descriptor::kVector); | |
613 HInstruction* slot = GetParameter(Descriptor::kSlot); | |
614 Add<HStoreKeyed>(feedback_vector, slot, object, nullptr, FAST_ELEMENTS, | |
615 INITIALIZING_STORE); | |
616 return feedback_vector; | |
617 } | |
618 | |
619 | |
620 Handle<Code> CreateAllocationSiteStub::GenerateCode() { | |
621 return DoGenerateCode(this); | |
622 } | |
623 | |
624 | |
625 template <> | |
626 HValue* CodeStubGraphBuilder<CreateWeakCellStub>::BuildCodeStub() { | 547 HValue* CodeStubGraphBuilder<CreateWeakCellStub>::BuildCodeStub() { |
627 // This stub is performance sensitive, the generated code must be tuned | 548 // This stub is performance sensitive, the generated code must be tuned |
628 // so that it doesn't build an eager frame. | 549 // so that it doesn't build an eager frame. |
629 info()->MarkMustNotHaveEagerFrame(); | 550 info()->MarkMustNotHaveEagerFrame(); |
630 | 551 |
631 HValue* size = Add<HConstant>(WeakCell::kSize); | 552 HValue* size = Add<HConstant>(WeakCell::kSize); |
632 HInstruction* object = | 553 HInstruction* object = |
633 Add<HAllocate>(size, HType::JSObject(), TENURED, JS_OBJECT_TYPE, | 554 Add<HAllocate>(size, HType::JSObject(), TENURED, JS_OBJECT_TYPE, |
634 graph()->GetConstant0()); | 555 graph()->GetConstant0()); |
635 | 556 |
(...skipping 1577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2213 return Pop(); | 2134 return Pop(); |
2214 } | 2135 } |
2215 | 2136 |
2216 | 2137 |
2217 Handle<Code> KeyedLoadGenericStub::GenerateCode() { | 2138 Handle<Code> KeyedLoadGenericStub::GenerateCode() { |
2218 return DoGenerateCode(this); | 2139 return DoGenerateCode(this); |
2219 } | 2140 } |
2220 | 2141 |
2221 } // namespace internal | 2142 } // namespace internal |
2222 } // namespace v8 | 2143 } // namespace v8 |
OLD | NEW |