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