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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stubs.h ('k') | src/field-index.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index 2306da6db7e84af9e6342db942a04b777eb9768f..ba647bab8487caf3545888dc74776e57036afc0a 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -62,6 +62,8 @@ class CodeStubGraphBuilderBase : public HGraphBuilder {
HLoadNamedField* BuildLoadNamedField(HValue* object,
FieldIndex index);
+ void BuildStoreNamedField(HValue* object, HValue* value, FieldIndex index,
+ Representation representation);
enum ArgumentClass {
NONE,
@@ -607,6 +609,42 @@ HValue* CodeStubGraphBuilder<LoadConstantStub>::BuildCodeStub() {
Handle<Code> LoadConstantStub::GenerateCode() { return DoGenerateCode(this); }
+void CodeStubGraphBuilderBase::BuildStoreNamedField(
+ HValue* object, HValue* value, FieldIndex index,
+ Representation representation) {
+ DCHECK(!index.is_double() || representation.IsDouble());
+ int offset = index.offset();
+ HObjectAccess access =
+ index.is_inobject()
+ ? HObjectAccess::ForObservableJSObjectOffset(offset, representation)
+ : HObjectAccess::ForBackingStoreOffset(offset, representation);
+
+ if (representation.IsDouble()) {
+ // Load the heap number.
+ object = Add<HLoadNamedField>(
+ object, static_cast<HValue*>(NULL),
+ access.WithRepresentation(Representation::Tagged()));
+ // Store the double value into it.
+ access = HObjectAccess::ForHeapNumberValue();
+ } else if (representation.IsHeapObject()) {
+ BuildCheckHeapObject(value);
+ }
+
+ Add<HStoreNamedField>(object, access, value, STORE_TO_INITIALIZED_ENTRY);
+}
+
+
+template <>
+HValue* CodeStubGraphBuilder<StoreFieldStub>::BuildCodeStub() {
+ BuildStoreNamedField(GetParameter(0), GetParameter(2), casted_stub()->index(),
+ casted_stub()->representation());
+ return GetParameter(2);
+}
+
+
+Handle<Code> StoreFieldStub::GenerateCode() { return DoGenerateCode(this); }
+
+
template <>
HValue* CodeStubGraphBuilder<StringLengthStub>::BuildCodeStub() {
HValue* string = BuildLoadNamedField(GetParameter(0),
« 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