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

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

Issue 1888043006: Revert of Migrate FastCloneShallowObjectStub to TurboFan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 <>
553 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { 626 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
554 // This stub is performance sensitive, the generated code must be tuned 627 // This stub is performance sensitive, the generated code must be tuned
555 // so that it doesn't build an eager frame. 628 // so that it doesn't build an eager frame.
556 info()->MarkMustNotHaveEagerFrame(); 629 info()->MarkMustNotHaveEagerFrame();
557 630
558 HValue* size = Add<HConstant>(AllocationSite::kSize); 631 HValue* size = Add<HConstant>(AllocationSite::kSize);
559 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, 632 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED,
560 JS_OBJECT_TYPE); 633 JS_OBJECT_TYPE);
561 634
562 // Store the map 635 // Store the map
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after
2304 return Pop(); 2377 return Pop();
2305 } 2378 }
2306 2379
2307 2380
2308 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 2381 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
2309 return DoGenerateCode(this); 2382 return DoGenerateCode(this);
2310 } 2383 }
2311 2384
2312 } // namespace internal 2385 } // namespace internal
2313 } // namespace v8 2386 } // 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