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

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

Issue 1838283003: Migrate FastCloneShallowObjectStub to TurboFan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comment Created 4 years, 8 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.cc ('k') | src/compiler/code-stub-assembler.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 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 "src/bailout-reason.h" 7 #include "src/bailout-reason.h"
8 #include "src/crankshaft/hydrogen.h" 8 #include "src/crankshaft/hydrogen.h"
9 #include "src/crankshaft/lithium.h" 9 #include "src/crankshaft/lithium.h"
10 #include "src/field-index.h" 10 #include "src/field-index.h"
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 return environment()->Pop(); 543 return environment()->Pop();
544 } 544 }
545 545
546 546
547 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { 547 Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
548 return DoGenerateCode(this); 548 return DoGenerateCode(this);
549 } 549 }
550 550
551 551
552 template <> 552 template <>
553 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
554 HValue* undefined = graph()->GetConstantUndefined();
555 HValue* closure = GetParameter(0);
556 HValue* literal_index = GetParameter(1);
557
558 HValue* literals_array = Add<HLoadNamedField>(
559 closure, nullptr, HObjectAccess::ForLiteralsPointer());
560
561 HInstruction* allocation_site = Add<HLoadKeyed>(
562 literals_array, literal_index, nullptr, nullptr, FAST_ELEMENTS,
563 NEVER_RETURN_HOLE, LiteralsArray::kOffsetToFirstLiteral - kHeapObjectTag);
564
565 IfBuilder checker(this);
566 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site,
567 undefined);
568 checker.And();
569
570 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
571 AllocationSite::kTransitionInfoOffset);
572 HInstruction* boilerplate =
573 Add<HLoadNamedField>(allocation_site, nullptr, access);
574
575 int length = casted_stub()->length();
576 if (length == 0) {
577 // Empty objects have some slack added to them.
578 length = JSObject::kInitialGlobalObjectUnusedPropertiesCount;
579 }
580 int size = JSObject::kHeaderSize + length * kPointerSize;
581 int object_size = size;
582 if (FLAG_allocation_site_pretenuring) {
583 size += AllocationMemento::kSize;
584 }
585
586 HValue* boilerplate_map =
587 Add<HLoadNamedField>(boilerplate, nullptr, HObjectAccess::ForMap());
588 HValue* boilerplate_size = Add<HLoadNamedField>(
589 boilerplate_map, nullptr, HObjectAccess::ForMapInstanceSize());
590 HValue* size_in_words = Add<HConstant>(object_size >> kPointerSizeLog2);
591 checker.If<HCompareNumericAndBranch>(boilerplate_size,
592 size_in_words, Token::EQ);
593 checker.Then();
594
595 HValue* size_in_bytes = Add<HConstant>(size);
596
597 HInstruction* object = Add<HAllocate>(size_in_bytes, HType::JSObject(),
598 NOT_TENURED, JS_OBJECT_TYPE);
599
600 for (int i = 0; i < object_size; i += kPointerSize) {
601 HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset(i);
602 Add<HStoreNamedField>(object, access,
603 Add<HLoadNamedField>(boilerplate, nullptr, access));
604 }
605
606 DCHECK(FLAG_allocation_site_pretenuring || (size == object_size));
607 if (FLAG_allocation_site_pretenuring) {
608 BuildCreateAllocationMemento(
609 object, Add<HConstant>(object_size), allocation_site);
610 }
611
612 environment()->Push(object);
613 checker.ElseDeopt(Deoptimizer::kUninitializedBoilerplateInFastClone);
614 checker.End();
615
616 return environment()->Pop();
617 }
618
619
620 Handle<Code> FastCloneShallowObjectStub::GenerateCode() {
621 return DoGenerateCode(this);
622 }
623
624
625 template <>
626 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { 553 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
627 // This stub is performance sensitive, the generated code must be tuned 554 // This stub is performance sensitive, the generated code must be tuned
628 // so that it doesn't build an eager frame. 555 // so that it doesn't build an eager frame.
629 info()->MarkMustNotHaveEagerFrame(); 556 info()->MarkMustNotHaveEagerFrame();
630 557
631 HValue* size = Add<HConstant>(AllocationSite::kSize); 558 HValue* size = Add<HConstant>(AllocationSite::kSize);
632 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, 559 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED,
633 JS_OBJECT_TYPE); 560 JS_OBJECT_TYPE);
634 561
635 // Store the map 562 // Store the map
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 return Pop(); 2304 return Pop();
2378 } 2305 }
2379 2306
2380 2307
2381 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 2308 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
2382 return DoGenerateCode(this); 2309 return DoGenerateCode(this);
2383 } 2310 }
2384 2311
2385 } // namespace internal 2312 } // namespace internal
2386 } // namespace v8 2313 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler/code-stub-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698