Commit a61c16b0 authored by Peter Marshall's avatar Peter Marshall Committed by Commit Bot

[cleanup] Fix more header includes to allow individual compilation

Fixes:
  src/map-updater.h
  src/objects/property-descriptor-object.h
  src/objects/prototype-info-inl.h
  src/objects/regexp-match-info.h
  src/objects/shared-function-info-inl.h

Bug: v8:7754,v8:7490,v8:7965

Change-Id: I7ae9dc86491c8e147d628f5fd8362534e861b15e
Reviewed-on: https://chromium-review.googlesource.com/1154221Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Peter Marshall <petermarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54780}
parent 612adf65
......@@ -11,6 +11,7 @@
#include "src/objects/dictionary.h"
#include "src/objects/map-inl.h"
#include "src/objects/regexp-match-info.h"
#include "src/objects/scope-info.h"
#include "src/objects/shared-function-info-inl.h"
#include "src/objects/template-objects.h"
......
......@@ -81,5 +81,12 @@ void FieldType::PrintTo(std::ostream& os) {
}
}
bool FieldType::NowContains(Object* value) {
if (this == Any()) return true;
if (this == None()) return false;
if (!value->IsHeapObject()) return false;
return HeapObject::cast(value)->map() == Map::cast(this);
}
} // namespace internal
} // namespace v8
......@@ -24,12 +24,7 @@ class FieldType : public Object {
static Handle<FieldType> Class(i::Handle<i::Map> map, Isolate* isolate);
static FieldType* cast(Object* object);
bool NowContains(Object* value) {
if (this == Any()) return true;
if (this == None()) return false;
if (!value->IsHeapObject()) return false;
return HeapObject::cast(value)->map() == Map::cast(this);
}
bool NowContains(Object* value);
bool NowContains(Handle<Object> value) { return NowContains(*value); }
......
......@@ -8,10 +8,117 @@
#include "src/lookup.h"
#include "src/handles-inl.h"
#include "src/heap/factory-inl.h"
#include "src/objects-inl.h"
#include "src/objects/api-callbacks.h"
#include "src/objects/name-inl.h"
#include "src/objects/map-inl.h"
namespace v8 {
namespace internal {
LookupIterator::LookupIterator(Handle<Object> receiver, Handle<Name> name,
Handle<JSReceiver> holder,
Configuration configuration)
: LookupIterator(holder->GetIsolate(), receiver, name, holder,
configuration) {}
LookupIterator::LookupIterator(Isolate* isolate, Handle<Object> receiver,
Handle<Name> name, Handle<JSReceiver> holder,
Configuration configuration)
: configuration_(ComputeConfiguration(configuration, name)),
interceptor_state_(InterceptorState::kUninitialized),
property_details_(PropertyDetails::Empty()),
isolate_(isolate),
name_(isolate_->factory()->InternalizeName(name)),
receiver_(receiver),
initial_holder_(holder),
// kMaxUInt32 isn't a valid index.
index_(kMaxUInt32),
number_(static_cast<uint32_t>(DescriptorArray::kNotFound)) {
#ifdef DEBUG
uint32_t index; // Assert that the name is not an array index.
DCHECK(!name->AsArrayIndex(&index));
#endif // DEBUG
Start<false>();
}
LookupIterator LookupIterator::PropertyOrElement(
Isolate* isolate, Handle<Object> receiver, Handle<Name> name,
Handle<JSReceiver> holder, Configuration configuration) {
uint32_t index;
if (name->AsArrayIndex(&index)) {
LookupIterator it =
LookupIterator(isolate, receiver, index, holder, configuration);
it.name_ = name;
return it;
}
return LookupIterator(receiver, name, holder, configuration);
}
LookupIterator LookupIterator::PropertyOrElement(
Isolate* isolate, Handle<Object> receiver, Handle<Name> name,
Configuration configuration) {
uint32_t index;
if (name->AsArrayIndex(&index)) {
LookupIterator it = LookupIterator(isolate, receiver, index, configuration);
it.name_ = name;
return it;
}
return LookupIterator(isolate, receiver, name, configuration);
}
Handle<Name> LookupIterator::GetName() {
if (name_.is_null()) {
DCHECK(IsElement());
name_ = factory()->Uint32ToString(index_);
}
return name_;
}
bool LookupIterator::is_dictionary_holder() const {
return !holder_->HasFastProperties();
}
bool LookupIterator::ExtendingNonExtensible(Handle<JSReceiver> receiver) {
DCHECK(receiver.is_identical_to(GetStoreTarget<JSReceiver>()));
return !receiver->map()->is_extensible() &&
(IsElement() || !name_->IsPrivate());
}
bool LookupIterator::IsCacheableTransition() {
DCHECK_EQ(TRANSITION, state_);
return transition_->IsPropertyCell() ||
(transition_map()->is_dictionary_map() &&
!GetStoreTarget<JSReceiver>()->HasFastProperties()) ||
transition_map()->GetBackPointer()->IsMap();
}
void LookupIterator::UpdateProtector() {
if (IsElement()) return;
// This list must be kept in sync with
// CodeStubAssembler::CheckForAssociatedProtector!
ReadOnlyRoots roots(heap());
if (*name_ == roots.is_concat_spreadable_symbol() ||
*name_ == roots.constructor_string() || *name_ == roots.next_string() ||
*name_ == roots.species_symbol() || *name_ == roots.iterator_symbol() ||
*name_ == roots.resolve_string() || *name_ == roots.then_string()) {
InternalUpdateProtector();
}
}
LookupIterator::Configuration LookupIterator::ComputeConfiguration(
Configuration configuration, Handle<Name> name) {
return name->IsPrivate() ? OWN_SKIP_INTERCEPTOR : configuration;
}
Handle<JSReceiver> LookupIterator::GetRoot(Isolate* isolate,
Handle<Object> receiver,
uint32_t index) {
if (receiver->IsJSReceiver()) return Handle<JSReceiver>::cast(receiver);
return GetRootForNonJSReceiver(isolate, receiver, index);
}
template <class T>
Handle<T> LookupIterator::GetStoreTarget() const {
DCHECK(receiver_->IsJSReceiver());
......
......@@ -49,31 +49,13 @@ class V8_EXPORT_PRIVATE LookupIterator final BASE_EMBEDDED {
: LookupIterator(isolate, receiver, name, GetRoot(isolate, receiver),
configuration) {}
LookupIterator(Handle<Object> receiver, Handle<Name> name,
Handle<JSReceiver> holder,
Configuration configuration = DEFAULT)
: LookupIterator(holder->GetIsolate(), receiver, name, holder,
configuration) {}
inline LookupIterator(Handle<Object> receiver, Handle<Name> name,
Handle<JSReceiver> holder,
Configuration configuration = DEFAULT);
LookupIterator(Isolate* isolate, Handle<Object> receiver, Handle<Name> name,
Handle<JSReceiver> holder,
Configuration configuration = DEFAULT)
: configuration_(ComputeConfiguration(configuration, name)),
interceptor_state_(InterceptorState::kUninitialized),
property_details_(PropertyDetails::Empty()),
isolate_(isolate),
name_(isolate_->factory()->InternalizeName(name)),
receiver_(receiver),
initial_holder_(holder),
// kMaxUInt32 isn't a valid index.
index_(kMaxUInt32),
number_(static_cast<uint32_t>(DescriptorArray::kNotFound)) {
#ifdef DEBUG
uint32_t index; // Assert that the name is not an array index.
DCHECK(!name->AsArrayIndex(&index));
#endif // DEBUG
Start<false>();
}
inline LookupIterator(Isolate* isolate, Handle<Object> receiver,
Handle<Name> name, Handle<JSReceiver> holder,
Configuration configuration = DEFAULT);
LookupIterator(Isolate* isolate, Handle<Object> receiver, uint32_t index,
Configuration configuration = DEFAULT)
......@@ -96,31 +78,13 @@ class V8_EXPORT_PRIVATE LookupIterator final BASE_EMBEDDED {
Start<true>();
}
static LookupIterator PropertyOrElement(
static inline LookupIterator PropertyOrElement(
Isolate* isolate, Handle<Object> receiver, Handle<Name> name,
Configuration configuration = DEFAULT) {
uint32_t index;
if (name->AsArrayIndex(&index)) {
LookupIterator it =
LookupIterator(isolate, receiver, index, configuration);
it.name_ = name;
return it;
}
return LookupIterator(isolate, receiver, name, configuration);
}
Configuration configuration = DEFAULT);
static LookupIterator PropertyOrElement(
static inline LookupIterator PropertyOrElement(
Isolate* isolate, Handle<Object> receiver, Handle<Name> name,
Handle<JSReceiver> holder, Configuration configuration = DEFAULT) {
uint32_t index;
if (name->AsArrayIndex(&index)) {
LookupIterator it =
LookupIterator(isolate, receiver, index, holder, configuration);
it.name_ = name;
return it;
}
return LookupIterator(receiver, name, holder, configuration);
}
Handle<JSReceiver> holder, Configuration configuration = DEFAULT);
static LookupIterator PropertyOrElement(
Isolate* isolate, Handle<Object> receiver, Handle<Object> key,
......@@ -147,13 +111,7 @@ class V8_EXPORT_PRIVATE LookupIterator final BASE_EMBEDDED {
DCHECK(!IsElement());
return name_;
}
Handle<Name> GetName() {
if (name_.is_null()) {
DCHECK(IsElement());
name_ = factory()->Uint32ToString(index_);
}
return name_;
}
inline Handle<Name> GetName();
uint32_t index() const { return index_; }
bool IsElement() const { return index_ != kMaxUInt32; }
......@@ -171,7 +129,7 @@ class V8_EXPORT_PRIVATE LookupIterator final BASE_EMBEDDED {
template <class T>
inline Handle<T> GetStoreTarget() const;
bool is_dictionary_holder() const { return !holder_->HasFastProperties(); }
inline bool is_dictionary_holder() const;
Handle<Map> transition_map() const {
DCHECK_EQ(TRANSITION, state_);
return Handle<Map>::cast(transition_);
......@@ -197,23 +155,13 @@ class V8_EXPORT_PRIVATE LookupIterator final BASE_EMBEDDED {
bool HasAccess() const;
/* PROPERTY */
bool ExtendingNonExtensible(Handle<JSReceiver> receiver) {
DCHECK(receiver.is_identical_to(GetStoreTarget<JSReceiver>()));
return !receiver->map()->is_extensible() &&
(IsElement() || !name_->IsPrivate());
}
inline bool ExtendingNonExtensible(Handle<JSReceiver> receiver);
void PrepareForDataProperty(Handle<Object> value);
void PrepareTransitionToDataProperty(Handle<JSReceiver> receiver,
Handle<Object> value,
PropertyAttributes attributes,
Object::StoreFromKeyed store_mode);
bool IsCacheableTransition() {
DCHECK_EQ(TRANSITION, state_);
return transition_->IsPropertyCell() ||
(transition_map()->is_dictionary_map() &&
!GetStoreTarget<JSReceiver>()->HasFastProperties()) ||
transition_map()->GetBackPointer()->IsMap();
}
inline bool IsCacheableTransition();
void ApplyTransitionToDataProperty(Handle<JSReceiver> receiver);
void ReconfigureDataProperty(Handle<Object> value,
PropertyAttributes attributes);
......@@ -250,18 +198,7 @@ class V8_EXPORT_PRIVATE LookupIterator final BASE_EMBEDDED {
Handle<InterceptorInfo> GetInterceptorForFailedAccessCheck() const;
Handle<Object> GetDataValue() const;
void WriteDataValue(Handle<Object> value, bool initializing_store);
inline void UpdateProtector() {
if (IsElement()) return;
// This list must be kept in sync with
// CodeStubAssembler::CheckForAssociatedProtector!
ReadOnlyRoots roots(heap());
if (*name_ == roots.is_concat_spreadable_symbol() ||
*name_ == roots.constructor_string() || *name_ == roots.next_string() ||
*name_ == roots.species_symbol() || *name_ == roots.iterator_symbol() ||
*name_ == roots.resolve_string() || *name_ == roots.then_string()) {
InternalUpdateProtector();
}
}
inline void UpdateProtector();
// Lookup a 'cached' private property for an accessor.
// If not found returns false and leaves the LookupIterator unmodified.
......@@ -335,19 +272,14 @@ class V8_EXPORT_PRIVATE LookupIterator final BASE_EMBEDDED {
return number_;
}
static Configuration ComputeConfiguration(
Configuration configuration, Handle<Name> name) {
return name->IsPrivate() ? OWN_SKIP_INTERCEPTOR : configuration;
}
static inline Configuration ComputeConfiguration(
Configuration configuration, Handle<Name> name);
static Handle<JSReceiver> GetRootForNonJSReceiver(
Isolate* isolate, Handle<Object> receiver, uint32_t index = kMaxUInt32);
inline static Handle<JSReceiver> GetRoot(Isolate* isolate,
static inline Handle<JSReceiver> GetRoot(Isolate* isolate,
Handle<Object> receiver,
uint32_t index = kMaxUInt32) {
if (receiver->IsJSReceiver()) return Handle<JSReceiver>::cast(receiver);
return GetRootForNonJSReceiver(isolate, receiver, index);
}
uint32_t index = kMaxUInt32);
State NotFound(JSReceiver* const holder) const;
......
......@@ -24,6 +24,20 @@ inline bool EqualImmutableValues(Object* obj1, Object* obj2) {
} // namespace
MapUpdater::MapUpdater(Isolate* isolate, Handle<Map> old_map)
: isolate_(isolate),
old_map_(old_map),
old_descriptors_(old_map->instance_descriptors(), isolate_),
old_nof_(old_map_->NumberOfOwnDescriptors()),
new_elements_kind_(old_map_->elements_kind()),
is_transitionable_fast_elements_kind_(
IsTransitionableFastElementsKind(new_elements_kind_)) {
// We shouldn't try to update remote objects.
DCHECK(!old_map->FindRootMap(isolate)
->GetConstructor()
->IsFunctionTemplateInfo());
}
Name* MapUpdater::GetKey(int descriptor) const {
return old_descriptors_->GetKey(descriptor);
}
......
......@@ -44,19 +44,7 @@ namespace internal {
// replace its transition tree with a new branch for the updated descriptors.
class MapUpdater {
public:
MapUpdater(Isolate* isolate, Handle<Map> old_map)
: isolate_(isolate),
old_map_(old_map),
old_descriptors_(old_map->instance_descriptors(), isolate_),
old_nof_(old_map_->NumberOfOwnDescriptors()),
new_elements_kind_(old_map_->elements_kind()),
is_transitionable_fast_elements_kind_(
IsTransitionableFastElementsKind(new_elements_kind_)) {
// We shouldn't try to update remote objects.
DCHECK(!old_map->FindRootMap(isolate)
->GetConstructor()
->IsFunctionTemplateInfo());
}
MapUpdater(Isolate* isolate, Handle<Map> old_map);
// Prepares for reconfiguring of a property at |descriptor| to data field
// with given |attributes| and |representation|/|field_type| and
......
......@@ -6,6 +6,7 @@
#define V8_OBJECTS_PROPERTY_DESCRIPTOR_OBJECT_H_
#include "src/objects.h"
#include "src/objects/fixed-array.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
......
......@@ -7,6 +7,8 @@
#include "src/objects/prototype-info.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/objects/map.h"
#include "src/objects/maybe-object.h"
// Has to be the last include (doesn't have include guards):
......
......@@ -7,6 +7,7 @@
#include "src/base/compiler-specific.h"
#include "src/objects.h"
#include "src/objects/fixed-array.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
......
......@@ -5,11 +5,12 @@
#ifndef V8_OBJECTS_SHARED_FUNCTION_INFO_INL_H_
#define V8_OBJECTS_SHARED_FUNCTION_INFO_INL_H_
#include "src/objects/shared-function-info.h"
#include "src/handles-inl.h"
#include "src/heap/heap-inl.h"
#include "src/objects/debug-objects-inl.h"
#include "src/objects/scope-info.h"
#include "src/objects/shared-function-info.h"
#include "src/objects/templates.h"
// Has to be the last include (doesn't have include guards):
......
......@@ -58,12 +58,6 @@ AUTO_EXCLUDE = [
'src/keys.h',
'src/layout-descriptor.h',
'src/lookup.h',
'src/lookup-inl.h',
'src/map-updater.h',
'src/objects/property-descriptor-object.h',
'src/objects/prototype-info-inl.h',
'src/objects/regexp-match-info.h',
'src/objects/shared-function-info-inl.h',
'src/parsing/parse-info.h',
'src/parsing/parser.h',
'src/parsing/preparsed-scope-data.h',
......
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