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

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

Issue 443873002: Hydrogenize (and share) StoreField except heapobject (for now). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « src/code-stubs.h ('k') | src/field-index.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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/field-index.h" 8 #include "src/field-index.h"
9 #include "src/hydrogen.h" 9 #include "src/hydrogen.h"
10 #include "src/lithium.h" 10 #include "src/lithium.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 DCHECK(arguments_length_ != NULL); 55 DCHECK(arguments_length_ != NULL);
56 return arguments_length_; 56 return arguments_length_;
57 } 57 }
58 CompilationInfo* info() { return &info_; } 58 CompilationInfo* info() { return &info_; }
59 HydrogenCodeStub* stub() { return info_.code_stub(); } 59 HydrogenCodeStub* stub() { return info_.code_stub(); }
60 HContext* context() { return context_; } 60 HContext* context() { return context_; }
61 Isolate* isolate() { return info_.isolate(); } 61 Isolate* isolate() { return info_.isolate(); }
62 62
63 HLoadNamedField* BuildLoadNamedField(HValue* object, 63 HLoadNamedField* BuildLoadNamedField(HValue* object,
64 FieldIndex index); 64 FieldIndex index);
65 void BuildStoreNamedField(HValue* object, HValue* value, FieldIndex index,
66 Representation representation);
65 67
66 enum ArgumentClass { 68 enum ArgumentClass {
67 NONE, 69 NONE,
68 SINGLE, 70 SINGLE,
69 MULTIPLE 71 MULTIPLE
70 }; 72 };
71 73
72 HValue* BuildArrayConstructor(ElementsKind kind, 74 HValue* BuildArrayConstructor(ElementsKind kind,
73 AllocationSiteOverrideMode override_mode, 75 AllocationSiteOverrideMode override_mode,
74 ArgumentClass argument_class); 76 ArgumentClass argument_class);
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 HObjectAccess value_access = HObjectAccess::ForObservableJSObjectOffset( 602 HObjectAccess value_access = HObjectAccess::ForObservableJSObjectOffset(
601 DescriptorArray::GetValueOffset(casted_stub()->descriptor())); 603 DescriptorArray::GetValueOffset(casted_stub()->descriptor()));
602 return Add<HLoadNamedField>(descriptors, static_cast<HValue*>(NULL), 604 return Add<HLoadNamedField>(descriptors, static_cast<HValue*>(NULL),
603 value_access); 605 value_access);
604 } 606 }
605 607
606 608
607 Handle<Code> LoadConstantStub::GenerateCode() { return DoGenerateCode(this); } 609 Handle<Code> LoadConstantStub::GenerateCode() { return DoGenerateCode(this); }
608 610
609 611
612 void CodeStubGraphBuilderBase::BuildStoreNamedField(
613 HValue* object, HValue* value, FieldIndex index,
614 Representation representation) {
615 DCHECK(!index.is_double() || representation.IsDouble());
616 int offset = index.offset();
617 HObjectAccess access =
618 index.is_inobject()
619 ? HObjectAccess::ForObservableJSObjectOffset(offset, representation)
620 : HObjectAccess::ForBackingStoreOffset(offset, representation);
621
622 if (representation.IsDouble()) {
623 // Load the heap number.
624 object = Add<HLoadNamedField>(
625 object, static_cast<HValue*>(NULL),
626 access.WithRepresentation(Representation::Tagged()));
627 // Store the double value into it.
628 access = HObjectAccess::ForHeapNumberValue();
629 } else if (representation.IsHeapObject()) {
630 BuildCheckHeapObject(value);
631 }
632
633 Add<HStoreNamedField>(object, access, value, STORE_TO_INITIALIZED_ENTRY);
634 }
635
636
637 template <>
638 HValue* CodeStubGraphBuilder<StoreFieldStub>::BuildCodeStub() {
639 BuildStoreNamedField(GetParameter(0), GetParameter(2), casted_stub()->index(),
640 casted_stub()->representation());
641 return GetParameter(2);
642 }
643
644
645 Handle<Code> StoreFieldStub::GenerateCode() { return DoGenerateCode(this); }
646
647
610 template <> 648 template <>
611 HValue* CodeStubGraphBuilder<StringLengthStub>::BuildCodeStub() { 649 HValue* CodeStubGraphBuilder<StringLengthStub>::BuildCodeStub() {
612 HValue* string = BuildLoadNamedField(GetParameter(0), 650 HValue* string = BuildLoadNamedField(GetParameter(0),
613 FieldIndex::ForInObjectOffset(JSValue::kValueOffset)); 651 FieldIndex::ForInObjectOffset(JSValue::kValueOffset));
614 return BuildLoadNamedField(string, 652 return BuildLoadNamedField(string,
615 FieldIndex::ForInObjectOffset(String::kLengthOffset)); 653 FieldIndex::ForInObjectOffset(String::kLengthOffset));
616 } 654 }
617 655
618 656
619 Handle<Code> StringLengthStub::GenerateCode() { 657 Handle<Code> StringLengthStub::GenerateCode() {
(...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 return Pop(); 1772 return Pop();
1735 } 1773 }
1736 1774
1737 1775
1738 Handle<Code> KeyedLoadGenericStub::GenerateCode() { 1776 Handle<Code> KeyedLoadGenericStub::GenerateCode() {
1739 return DoGenerateCode(this); 1777 return DoGenerateCode(this);
1740 } 1778 }
1741 1779
1742 1780
1743 } } // namespace v8::internal 1781 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/field-index.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698