Commit 06eb555f authored by bmeurer's avatar bmeurer Committed by Commit bot

[turbofan] Move PropertyAccessInfo and friends to a separate file.

Also changed the way that transitioning stores are represented in
a PropertyAccessInfo: There's no dedicated kind, but DataFields
have an optional transition map.

R=jarin@chromium.org
BUG=v8:4470
LOG=n

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

Cr-Commit-Position: refs/heads/master@{#31692}
parent 1d14ebfc
......@@ -825,6 +825,8 @@ source_set("v8_base") {
"src/compiler/pipeline.h",
"src/compiler/pipeline-statistics.cc",
"src/compiler/pipeline-statistics.h",
"src/compiler/property-access-info.cc",
"src/compiler/property-access-info.h",
"src/compiler/raw-machine-assembler.cc",
"src/compiler/raw-machine-assembler.h",
"src/compiler/register-allocator.cc",
......
......@@ -7,6 +7,7 @@
#include "src/base/flags.h"
#include "src/compiler/graph-reducer.h"
#include "src/compiler/property-access-info.h"
#include "src/compiler/simplified-operator.h"
namespace v8 {
......@@ -61,15 +62,6 @@ class JSNativeContextSpecialization final : public AdvancedReducer {
}
Reduction Replace(Node* node, Handle<Object> value);
enum PropertyAccessMode { kLoad, kStore };
class PropertyAccessInfo;
bool ComputePropertyAccessInfo(Handle<Map> map, Handle<Name> name,
PropertyAccessMode access_mode,
PropertyAccessInfo* access_info);
bool ComputePropertyAccessInfos(MapHandleList const& maps, Handle<Name> name,
PropertyAccessMode access_mode,
ZoneVector<PropertyAccessInfo>* access_infos);
Reduction ReduceNamedAccess(Node* node, Node* value,
MapHandleList const& receiver_maps,
Handle<Name> name,
......@@ -96,6 +88,9 @@ class JSNativeContextSpecialization final : public AdvancedReducer {
Handle<Context> native_context() const { return native_context_; }
CompilationDependencies* dependencies() const { return dependencies_; }
Zone* zone() const { return zone_; }
PropertyAccessInfoFactory& access_info_factory() {
return access_info_factory_;
}
JSGraph* const jsgraph_;
Flags const flags_;
......@@ -104,6 +99,7 @@ class JSNativeContextSpecialization final : public AdvancedReducer {
CompilationDependencies* const dependencies_;
Zone* const zone_;
TypeCache const& type_cache_;
PropertyAccessInfoFactory access_info_factory_;
DISALLOW_COPY_AND_ASSIGN(JSNativeContextSpecialization);
};
......
This diff is collapsed.
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_COMPILER_PROPERTY_ACCESS_INFO_H_
#define V8_COMPILER_PROPERTY_ACCESS_INFO_H_
#include <iosfwd>
#include "src/field-index.h"
#include "src/objects.h"
#include "src/zone-containers.h"
namespace v8 {
namespace internal {
// Forward declarations.
class CompilationDependencies;
class Factory;
class TypeCache;
namespace compiler {
// Whether we are loading a property or storing to a property.
enum class PropertyAccessMode { kLoad, kStore };
std::ostream& operator<<(std::ostream&, PropertyAccessMode);
// This class encapsulates all information required to access a certain
// object property, either on the object itself or on the prototype chain.
class PropertyAccessInfo final {
public:
enum Kind { kInvalid, kDataConstant, kDataField };
static PropertyAccessInfo DataConstant(Type* receiver_type,
Handle<Object> constant,
MaybeHandle<JSObject> holder) {
return PropertyAccessInfo(holder, constant, receiver_type);
}
static PropertyAccessInfo DataField(
Type* receiver_type, FieldIndex field_index, Type* field_type,
MaybeHandle<JSObject> holder = MaybeHandle<JSObject>(),
MaybeHandle<Map> transition_map = MaybeHandle<Map>()) {
return PropertyAccessInfo(holder, transition_map, field_index, field_type,
receiver_type);
}
PropertyAccessInfo();
bool IsDataConstant() const { return kind() == kDataConstant; }
bool IsDataField() const { return kind() == kDataField; }
Kind kind() const { return kind_; }
MaybeHandle<JSObject> holder() const { return holder_; }
MaybeHandle<Map> transition_map() const { return transition_map_; }
Handle<Object> constant() const { return constant_; }
FieldIndex field_index() const { return field_index_; }
Type* field_type() const { return field_type_; }
Type* receiver_type() const { return receiver_type_; }
private:
PropertyAccessInfo(MaybeHandle<JSObject> holder, Handle<Object> constant,
Type* receiver_type);
PropertyAccessInfo(MaybeHandle<JSObject> holder,
MaybeHandle<Map> transition_map, FieldIndex field_index,
Type* field_type, Type* receiver_type);
Kind kind_;
Type* receiver_type_;
Handle<Object> constant_;
MaybeHandle<Map> transition_map_;
MaybeHandle<JSObject> holder_;
FieldIndex field_index_;
Type* field_type_;
};
// Factory class for {PropertyAccessInfo}s.
class PropertyAccessInfoFactory final {
public:
PropertyAccessInfoFactory(CompilationDependencies* dependencies,
Handle<Context> native_context, Zone* zone);
bool ComputePropertyAccessInfo(Handle<Map> map, Handle<Name> name,
PropertyAccessMode access_mode,
PropertyAccessInfo* access_info);
bool ComputePropertyAccessInfos(MapHandleList const& maps, Handle<Name> name,
PropertyAccessMode access_mode,
ZoneVector<PropertyAccessInfo>* access_infos);
private:
CompilationDependencies* dependencies() const { return dependencies_; }
Factory* factory() const;
Isolate* isolate() const { return isolate_; }
Handle<Context> native_context() const { return native_context_; }
Zone* zone() const { return zone_; }
CompilationDependencies* const dependencies_;
Handle<Context> const native_context_;
Isolate* const isolate_;
TypeCache const& type_cache_;
Zone* const zone_;
DISALLOW_COPY_AND_ASSIGN(PropertyAccessInfoFactory);
};
} // namespace compiler
} // namespace internal
} // namespace v8
#endif // V8_COMPILER_PROPERTY_ACCESS_INFO_H_
......@@ -583,6 +583,8 @@
'../../src/compiler/pipeline.h',
'../../src/compiler/pipeline-statistics.cc',
'../../src/compiler/pipeline-statistics.h',
'../../src/compiler/property-access-info.cc',
'../../src/compiler/property-access-info.h',
'../../src/compiler/raw-machine-assembler.cc',
'../../src/compiler/raw-machine-assembler.h',
'../../src/compiler/register-allocator.cc',
......
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