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

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

Issue 1874693002: Version 5.1.294.2 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.1.294
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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 return environment()->Pop(); 563 return environment()->Pop();
564 } 564 }
565 565
566 566
567 Handle<Code> FastCloneShallowArrayStub::GenerateCode() { 567 Handle<Code> FastCloneShallowArrayStub::GenerateCode() {
568 return DoGenerateCode(this); 568 return DoGenerateCode(this);
569 } 569 }
570 570
571 571
572 template <> 572 template <>
573 HValue* CodeStubGraphBuilder<FastCloneShallowObjectStub>::BuildCodeStub() {
574 HValue* undefined = graph()->GetConstantUndefined();
575 HValue* closure = GetParameter(0);
576 HValue* literal_index = GetParameter(1);
577
578 HValue* literals_array = Add<HLoadNamedField>(
579 closure, nullptr, HObjectAccess::ForLiteralsPointer());
580
581 HInstruction* allocation_site = Add<HLoadKeyed>(
582 literals_array, literal_index, nullptr, nullptr, FAST_ELEMENTS,
583 NEVER_RETURN_HOLE, LiteralsArray::kOffsetToFirstLiteral - kHeapObjectTag);
584
585 IfBuilder checker(this);
586 checker.IfNot<HCompareObjectEqAndBranch, HValue*>(allocation_site,
587 undefined);
588 checker.And();
589
590 HObjectAccess access = HObjectAccess::ForAllocationSiteOffset(
591 AllocationSite::kTransitionInfoOffset);
592 HInstruction* boilerplate =
593 Add<HLoadNamedField>(allocation_site, nullptr, access);
594
595 int length = casted_stub()->length();
596 if (length == 0) {
597 // Empty objects have some slack added to them.
598 length = JSObject::kInitialGlobalObjectUnusedPropertiesCount;
599 }
600 int size = JSObject::kHeaderSize + length * kPointerSize;
601 int object_size = size;
602 if (FLAG_allocation_site_pretenuring) {
603 size += AllocationMemento::kSize;
604 }
605
606 HValue* boilerplate_map =
607 Add<HLoadNamedField>(boilerplate, nullptr, HObjectAccess::ForMap());
608 HValue* boilerplate_size = Add<HLoadNamedField>(
609 boilerplate_map, nullptr, HObjectAccess::ForMapInstanceSize());
610 HValue* size_in_words = Add<HConstant>(object_size >> kPointerSizeLog2);
611 checker.If<HCompareNumericAndBranch>(boilerplate_size,
612 size_in_words, Token::EQ);
613 checker.Then();
614
615 HValue* size_in_bytes = Add<HConstant>(size);
616
617 HInstruction* object = Add<HAllocate>(size_in_bytes, HType::JSObject(),
618 NOT_TENURED, JS_OBJECT_TYPE);
619
620 for (int i = 0; i < object_size; i += kPointerSize) {
621 HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset(i);
622 Add<HStoreNamedField>(object, access,
623 Add<HLoadNamedField>(boilerplate, nullptr, access));
624 }
625
626 DCHECK(FLAG_allocation_site_pretenuring || (size == object_size));
627 if (FLAG_allocation_site_pretenuring) {
628 BuildCreateAllocationMemento(
629 object, Add<HConstant>(object_size), allocation_site);
630 }
631
632 environment()->Push(object);
633 checker.ElseDeopt(Deoptimizer::kUninitializedBoilerplateInFastClone);
634 checker.End();
635
636 return environment()->Pop();
637 }
638
639
640 Handle<Code> FastCloneShallowObjectStub::GenerateCode() {
641 return DoGenerateCode(this);
642 }
643
644
645 template <>
646 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() { 573 HValue* CodeStubGraphBuilder<CreateAllocationSiteStub>::BuildCodeStub() {
647 // This stub is performance sensitive, the generated code must be tuned 574 // This stub is performance sensitive, the generated code must be tuned
648 // so that it doesn't build an eager frame. 575 // so that it doesn't build an eager frame.
649 info()->MarkMustNotHaveEagerFrame(); 576 info()->MarkMustNotHaveEagerFrame();
650 577
651 HValue* size = Add<HConstant>(AllocationSite::kSize); 578 HValue* size = Add<HConstant>(AllocationSite::kSize);
652 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED, 579 HInstruction* object = Add<HAllocate>(size, HType::JSObject(), TENURED,
653 JS_OBJECT_TYPE); 580 JS_OBJECT_TYPE);
654 581
655 // Store the map 582 // Store the map
(...skipping 1918 matching lines...) Expand 10 before | Expand all | Expand 10 after
2574 return Pop(); 2501 return Pop();
2575 } 2502 }
2576 2503
2577 2504
2578 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 2505 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
2579 return DoGenerateCode(this); 2506 return DoGenerateCode(this);
2580 } 2507 }
2581 2508
2582 } // namespace internal 2509 } // namespace internal
2583 } // namespace v8 2510 } // 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