Commit 2c3e6b41 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Use PropertyAccessInfo to compute stores in crankshaft.

BUG=
R=dcarney@chromium.org

Review URL: https://codereview.chromium.org/153933002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19085 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7de9fc0a
...@@ -4345,7 +4345,8 @@ HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset, ...@@ -4345,7 +4345,8 @@ HObjectAccess HObjectAccess::ForBackingStoreOffset(int offset,
HObjectAccess HObjectAccess::ForField(Handle<Map> map, HObjectAccess HObjectAccess::ForField(Handle<Map> map,
LookupResult *lookup, Handle<String> name) { LookupResult* lookup,
Handle<String> name) {
ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map)); ASSERT(lookup->IsField() || lookup->IsTransitionToField(*map));
int index; int index;
Representation representation; Representation representation;
......
This diff is collapsed.
...@@ -2264,13 +2264,16 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2264,13 +2264,16 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
void VisitDataViewInitialize(CallRuntime* expr); void VisitDataViewInitialize(CallRuntime* expr);
enum PropertyAccessType { LOAD, STORE };
class PropertyAccessInfo { class PropertyAccessInfo {
public: public:
PropertyAccessInfo(HOptimizedGraphBuilder* builder, PropertyAccessInfo(HOptimizedGraphBuilder* builder,
PropertyAccessType access_type,
Type* type, Type* type,
Handle<String> name) Handle<String> name)
: lookup_(builder->isolate()), : lookup_(builder->isolate()),
builder_(builder), builder_(builder),
access_type_(access_type),
type_(type), type_(type),
name_(name), name_(name),
access_(HObjectAccess::ForMap()) { } access_(HObjectAccess::ForMap()) { }
...@@ -2278,7 +2281,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2278,7 +2281,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
// Checkes whether this PropertyAccessInfo can be handled as a monomorphic // Checkes whether this PropertyAccessInfo can be handled as a monomorphic
// load named. It additionally fills in the fields necessary to generate the // load named. It additionally fills in the fields necessary to generate the
// lookup code. // lookup code.
bool CanLoadMonomorphic(); bool CanAccessMonomorphic();
// Checks whether all types behave uniform when loading name. If all maps // Checks whether all types behave uniform when loading name. If all maps
// behave the same, a single monomorphic load instruction can be emitted, // behave the same, a single monomorphic load instruction can be emitted,
...@@ -2286,7 +2289,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2286,7 +2289,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
// an instance of any of the types. // an instance of any of the types.
// This method skips the first type in types, assuming that this // This method skips the first type in types, assuming that this
// PropertyAccessInfo is built for types->first(). // PropertyAccessInfo is built for types->first().
bool CanLoadAsMonomorphic(SmallMapList* types); bool CanAccessAsMonomorphic(SmallMapList* types);
Handle<Map> map() { Handle<Map> map() {
if (type_->Is(Type::Number())) { if (type_->Is(Type::Number())) {
...@@ -2337,6 +2340,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2337,6 +2340,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
Handle<JSObject> holder() { return holder_; } Handle<JSObject> holder() { return holder_; }
Handle<JSFunction> accessor() { return accessor_; } Handle<JSFunction> accessor() { return accessor_; }
Handle<Object> constant() { return constant_; } Handle<Object> constant() { return constant_; }
Handle<Object> transition() { return transition_; }
HObjectAccess access() { return access_; } HObjectAccess access() { return access_; }
private: private:
...@@ -2352,7 +2356,8 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2352,7 +2356,8 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
bool LoadResult(Handle<Map> map); bool LoadResult(Handle<Map> map);
bool LookupDescriptor(); bool LookupDescriptor();
bool LookupInPrototypes(); bool LookupInPrototypes();
bool IsCompatibleForLoad(PropertyAccessInfo* other); bool IsCompatible(PropertyAccessInfo* other);
bool IsLoad() const { return access_type_ == LOAD; }
void GeneralizeRepresentation(Representation r) { void GeneralizeRepresentation(Representation r) {
access_ = access_.WithRepresentation( access_ = access_.WithRepresentation(
...@@ -2361,11 +2366,13 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2361,11 +2366,13 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
LookupResult lookup_; LookupResult lookup_;
HOptimizedGraphBuilder* builder_; HOptimizedGraphBuilder* builder_;
PropertyAccessType access_type_;
Type* type_; Type* type_;
Handle<String> name_; Handle<String> name_;
Handle<JSObject> holder_; Handle<JSObject> holder_;
Handle<JSFunction> accessor_; Handle<JSFunction> accessor_;
Handle<Object> constant_; Handle<Object> constant_;
Handle<Map> transition_;
HObjectAccess access_; HObjectAccess access_;
}; };
...@@ -2376,12 +2383,15 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2376,12 +2383,15 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
BailoutId return_id, BailoutId return_id,
bool can_inline_accessor = true); bool can_inline_accessor = true);
HInstruction* BuildStoreMonomorphic(PropertyAccessInfo* info,
HValue* checked_object,
HValue* value,
BailoutId ast_id,
BailoutId return_id,
bool can_inline_accessor = true);
void HandlePolymorphicStoreNamedField(BailoutId assignment_id, void HandlePolymorphicStoreNamedField(BailoutId assignment_id,
HValue* object, BailoutId return_id,
HValue* value,
SmallMapList* types,
Handle<String> name);
bool TryStorePolymorphicAsMonomorphic(BailoutId assignment_id,
HValue* object, HValue* object,
HValue* value, HValue* value,
SmallMapList* types, SmallMapList* types,
...@@ -2472,18 +2482,13 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2472,18 +2482,13 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
BailoutId return_id, BailoutId return_id,
bool is_uninitialized = false); bool is_uninitialized = false);
HInstruction* BuildStoreNamedField(HValue* object, HInstruction* BuildStoreNamedField(PropertyAccessInfo* info,
Handle<String> name, HValue* checked_object,
HValue* value, HValue* value);
Handle<Map> map,
LookupResult* lookup);
HInstruction* BuildStoreNamedGeneric(HValue* object, HInstruction* BuildStoreNamedGeneric(HValue* object,
Handle<String> name, Handle<String> name,
HValue* value); HValue* value,
HInstruction* BuildStoreNamedMonomorphic(HValue* object, bool is_uninitialized = false);
Handle<String> name,
HValue* value,
Handle<Map> map);
HInstruction* BuildStoreKeyedGeneric(HValue* object, HInstruction* BuildStoreKeyedGeneric(HValue* object,
HValue* key, HValue* key,
HValue* value); HValue* value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment