Commit 35f3e9d0 authored by Marja Hölttä's avatar Marja Hölttä Committed by Commit Bot

Reland: [objects.h splitting] Move Map and related classes.

Previous version was https://chromium-review.googlesource.com/502808

BUG=v8:5402

Change-Id: If327f4d7884577b7e5e6159372bf28a80cd21e51
Reviewed-on: https://chromium-review.googlesource.com/506073
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarBenedikt Meurer <bmeurer@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45369}
parent 51f95dea
......@@ -688,6 +688,8 @@ action("postmortem-metadata") {
sources = [
"src/objects.h",
"src/objects-inl.h",
"src/objects/map.h",
"src/objects/map-inl.h",
]
outputs = [
......@@ -1737,6 +1739,8 @@ v8_source_set("v8_base") {
"src/objects/intl-objects.h",
"src/objects/literal-objects.cc",
"src/objects/literal-objects.h",
"src/objects/map-inl.h",
"src/objects/map.h",
"src/objects/module-info.h",
"src/objects/object-macros-undef.h",
"src/objects/object-macros.h",
......
......@@ -19,6 +19,7 @@
#include "src/elements.h"
#include "src/objects-inl.h"
#include "src/objects/literal-objects.h"
#include "src/objects/map.h"
#include "src/property-details.h"
#include "src/property.h"
#include "src/string-stream.h"
......@@ -1030,6 +1031,24 @@ void Expression::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) {
}
}
void SmallMapList::AddMapIfMissing(Handle<Map> map, Zone* zone) {
if (!Map::TryUpdate(map).ToHandle(&map)) return;
for (int i = 0; i < length(); ++i) {
if (at(i).is_identical_to(map)) return;
}
Add(map, zone);
}
void SmallMapList::FilterForPossibleTransitions(Map* root_map) {
for (int i = list_.length() - 1; i >= 0; i--) {
if (at(i)->FindRootMap() != root_map) {
list_.RemoveElement(list_.at(i));
}
}
}
Handle<Map> SmallMapList::at(int i) const { return Handle<Map>(list_.at(i)); }
SmallMapList* Expression::GetReceiverTypes() {
switch (node_type()) {
#define NODE_LIST(V) \
......
......@@ -252,29 +252,15 @@ class SmallMapList final {
bool is_empty() const { return list_.is_empty(); }
int length() const { return list_.length(); }
void AddMapIfMissing(Handle<Map> map, Zone* zone) {
if (!Map::TryUpdate(map).ToHandle(&map)) return;
for (int i = 0; i < length(); ++i) {
if (at(i).is_identical_to(map)) return;
}
Add(map, zone);
}
void AddMapIfMissing(Handle<Map> map, Zone* zone);
void FilterForPossibleTransitions(Map* root_map) {
for (int i = list_.length() - 1; i >= 0; i--) {
if (at(i)->FindRootMap() != root_map) {
list_.RemoveElement(list_.at(i));
}
}
}
void FilterForPossibleTransitions(Map* root_map);
void Add(Handle<Map> handle, Zone* zone) {
list_.Add(handle.location(), zone);
}
Handle<Map> at(int i) const {
return Handle<Map>(list_.at(i));
}
Handle<Map> at(int i) const;
Handle<Map> first() const { return at(0); }
Handle<Map> last() const { return at(length() - 1); }
......
......@@ -7,6 +7,7 @@
#include "src/handles.h"
#include "src/objects.h"
#include "src/objects/map.h"
namespace v8 {
namespace internal {
......
......@@ -29,6 +29,7 @@
#include "src/isolate-inl.h"
#include "src/log-inl.h"
#include "src/messages.h"
#include "src/objects/map.h"
#include "src/parsing/parsing.h"
#include "src/parsing/rewriter.h"
#include "src/parsing/scanner-character-streams.h"
......
......@@ -10,6 +10,7 @@
#include "src/field-index.h"
#include "src/machine-type.h"
#include "src/objects.h"
#include "src/objects/map.h"
#include "src/zone/zone-containers.h"
namespace v8 {
......
......@@ -8,7 +8,7 @@
#include "src/base/flags.h"
#include "src/compiler/graph-reducer.h"
#include "src/deoptimize-reason.h"
#include "src/feedback-vector.h"
#include "src/objects/map.h"
namespace v8 {
namespace internal {
......@@ -16,6 +16,7 @@ namespace internal {
// Forward declarations.
class CompilationDependencies;
class Factory;
class FeedbackNexus;
namespace compiler {
......
......@@ -8,6 +8,7 @@
#include "src/compiler/opcodes.h"
#include "src/compiler/operator.h"
#include "src/compiler/types.h"
#include "src/objects/map.h"
namespace v8 {
namespace internal {
......
......@@ -9,6 +9,7 @@
#include "src/heap/heap.h"
#include "src/objects-inl.h"
#include "src/objects/dictionary.h"
#include "src/objects/map-inl.h"
#include "src/objects/regexp-match-info.h"
namespace v8 {
......
......@@ -42,6 +42,7 @@
// GetRootConstructor
#include "src/ic/ic-inl.h"
#include "src/isolate-inl.h"
#include "src/objects/map.h"
#include "src/runtime/runtime.h"
#if V8_TARGET_ARCH_IA32
......
......@@ -9,7 +9,7 @@
#include "src/base/logging.h"
#include "src/elements-kind.h"
#include "src/objects.h"
#include "src/objects/map.h"
#include "src/type-hints.h"
#include "src/zone/zone-containers.h"
......
......@@ -7,6 +7,7 @@
#include "src/ast/ast-types.h"
#include "src/objects.h"
#include "src/objects/map.h"
#include "src/ostreams.h"
namespace v8 {
......
......@@ -21,6 +21,7 @@
#include "src/heap/marking.h"
#include "src/list.h"
#include "src/objects.h"
#include "src/objects/map.h"
#include "src/utils.h"
namespace v8 {
......
......@@ -10,6 +10,7 @@
#include "src/ic/ic-state.h"
#include "src/macro-assembler.h"
#include "src/messages.h"
#include "src/objects/map.h"
namespace v8 {
namespace internal {
......
......@@ -10,6 +10,7 @@
#include "src/isolate.h"
#include "src/objects.h"
#include "src/objects/descriptor-array.h"
#include "src/objects/map.h"
namespace v8 {
namespace internal {
......
......@@ -2,13 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_MAP_RECONFIGURER_H_
#define V8_MAP_RECONFIGURER_H_
#ifndef V8_MAP_UPDATER_H_
#define V8_MAP_UPDATER_H_
#include "src/elements-kind.h"
#include "src/field-type.h"
#include "src/globals.h"
#include "src/handles.h"
#include "src/objects.h"
#include "src/objects/map.h"
#include "src/property-details.h"
namespace v8 {
......@@ -180,4 +181,4 @@ class MapUpdater {
} // namespace internal
} // namespace v8
#endif // V8_MAP_RECONFIGURER_H_
#endif // V8_MAP_UPDATER_H_
......@@ -523,24 +523,6 @@ bool HeapObject::IsNormalizedMapCache() const {
return NormalizedMapCache::IsNormalizedMapCache(this);
}
int NormalizedMapCache::GetIndex(Handle<Map> map) {
return map->Hash() % NormalizedMapCache::kEntries;
}
bool NormalizedMapCache::IsNormalizedMapCache(const HeapObject* obj) {
if (!obj->IsFixedArray()) return false;
if (FixedArray::cast(obj)->length() != NormalizedMapCache::kEntries) {
return false;
}
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) {
reinterpret_cast<NormalizedMapCache*>(const_cast<HeapObject*>(obj))
->NormalizedMapCacheVerify();
}
#endif
return true;
}
bool HeapObject::IsCompilationCacheTable() const { return IsHashTable(); }
bool HeapObject::IsCodeCacheHashTable() const { return IsHashTable(); }
......@@ -679,7 +661,6 @@ CAST_ACCESSOR(JSWeakCollection)
CAST_ACCESSOR(JSWeakMap)
CAST_ACCESSOR(JSWeakSet)
CAST_ACCESSOR(LayoutDescriptor)
CAST_ACCESSOR(Map)
CAST_ACCESSOR(ModuleInfo)
CAST_ACCESSOR(Name)
CAST_ACCESSOR(NameDictionary)
......@@ -1995,18 +1976,6 @@ InterceptorInfo* JSObject::GetNamedInterceptor() {
return map()->GetNamedInterceptor();
}
InterceptorInfo* Map::GetNamedInterceptor() {
DCHECK(has_named_interceptor());
FunctionTemplateInfo* info = GetFunctionTemplateInfo();
return InterceptorInfo::cast(info->named_property_handler());
}
InterceptorInfo* Map::GetIndexedInterceptor() {
DCHECK(has_indexed_interceptor());
FunctionTemplateInfo* info = GetFunctionTemplateInfo();
return InterceptorInfo::cast(info->indexed_property_handler());
}
double Oddball::to_number_raw() const {
return READ_DOUBLE_FIELD(this, kToNumberRawOffset);
}
......
......@@ -58,6 +58,7 @@
#include "src/objects/code-cache-inl.h"
#include "src/objects/compilation-cache-inl.h"
#include "src/objects/frame-array-inl.h"
#include "src/objects/map.h"
#include "src/property-descriptor.h"
#include "src/prototype.h"
#include "src/regexp/jsregexp.h"
......
This diff is collapsed.
// Copyright 2017 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_OBJECTS_MAP_INL_H_
#define V8_OBJECTS_MAP_INL_H_
#include "src/objects/map.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
CAST_ACCESSOR(Map)
InterceptorInfo* Map::GetNamedInterceptor() {
DCHECK(has_named_interceptor());
FunctionTemplateInfo* info = GetFunctionTemplateInfo();
return InterceptorInfo::cast(info->named_property_handler());
}
InterceptorInfo* Map::GetIndexedInterceptor() {
DCHECK(has_indexed_interceptor());
FunctionTemplateInfo* info = GetFunctionTemplateInfo();
return InterceptorInfo::cast(info->indexed_property_handler());
}
int NormalizedMapCache::GetIndex(Handle<Map> map) {
return map->Hash() % NormalizedMapCache::kEntries;
}
bool NormalizedMapCache::IsNormalizedMapCache(const HeapObject* obj) {
if (!obj->IsFixedArray()) return false;
if (FixedArray::cast(obj)->length() != NormalizedMapCache::kEntries) {
return false;
}
#ifdef VERIFY_HEAP
if (FLAG_verify_heap) {
reinterpret_cast<NormalizedMapCache*>(const_cast<HeapObject*>(obj))
->NormalizedMapCacheVerify();
}
#endif
return true;
}
} // namespace internal
} // namespace v8
#include "src/objects/object-macros-undef.h"
#endif // V8_OBJECTS_MAP_INL_H_
This diff is collapsed.
......@@ -10,6 +10,7 @@
#include "src/isolate.h"
#include "src/objects.h"
#include "src/objects/descriptor-array.h"
#include "src/objects/map.h"
namespace v8 {
namespace internal {
......
......@@ -10,6 +10,7 @@
#include "src/ic/ic.h"
#include "src/ic/stub-cache.h"
#include "src/objects-inl.h"
#include "src/objects/map.h"
namespace v8 {
namespace internal {
......
......@@ -1131,6 +1131,8 @@
'objects/intl-objects.h',
'objects/literal-objects.cc',
'objects/literal-objects.h',
'objects/map-inl.h',
'objects/map.h',
'objects/module-info.h',
'objects/object-macros.h',
'objects/object-macros-undef.h',
......@@ -2452,6 +2454,8 @@
'heapobject_files': [
'objects.h',
'objects-inl.h',
'objects/map.h',
'objects/map-inl.h',
],
},
'actions': [
......
......@@ -335,15 +335,9 @@ def get_base_class(klass):
return get_base_class(k['parent']);
#
# Loads class hierarchy and type information from "objects.h".
# Loads class hierarchy and type information from "objects.h" etc.
#
def load_objects():
objfilename = sys.argv[2];
objfile = open(objfilename, 'r');
in_insttype = False;
typestr = '';
#
# Construct a dictionary for the classes we're sure should be present.
#
......@@ -351,11 +345,29 @@ def load_objects():
for klass in expected_classes:
checktypes[klass] = True;
for filename in sys.argv[2:]:
if not filename.endswith("-inl.h"):
load_objects_from_file(filename, checktypes)
if (len(checktypes) > 0):
for klass in checktypes:
print('error: expected class \"%s\" not found' % klass);
sys.exit(1);
def load_objects_from_file(objfilename, checktypes):
objfile = open(objfilename, 'r');
in_insttype = False;
typestr = '';
#
# Iterate objects.h line-by-line to collect type and class information.
# For types, we accumulate a string representing the entire InstanceType
# enum definition and parse it later because it's easier to do so
# without the embedded newlines.
# Iterate the header file line-by-line to collect type and class
# information. For types, we accumulate a string representing the entire
# InstanceType enum definition and parse it later because it's easier to
# do so without the embedded newlines.
#
for line in objfile:
if (line.startswith('enum InstanceType {')):
......@@ -482,13 +494,6 @@ def load_objects():
if (cctype in checktypes):
del checktypes[cctype];
if (len(checktypes) > 0):
for klass in checktypes:
print('error: expected class \"%s\" not found' % klass);
sys.exit(1);
#
# For a given macro call, pick apart the arguments and return an object
# describing the corresponding output constant. See load_fields().
......@@ -528,11 +533,19 @@ def parse_field(call):
});
#
# Load field offset information from objects-inl.h.
# Load field offset information from objects-inl.h etc.
#
def load_fields():
inlfilename = sys.argv[3];
inlfile = open(inlfilename, 'r');
for filename in sys.argv[2:]:
if filename.endswith("-inl.h"):
load_fields_from_file(filename)
for body in extras_accessors:
fields.append(parse_field('ACCESSORS(%s)' % body));
def load_fields_from_file(filename):
inlfile = open(filename, 'r');
#
# Each class's fields and the corresponding offsets are described in the
......@@ -584,9 +597,6 @@ def load_fields():
fields.append(parse_field(current));
current = '';
for body in extras_accessors:
fields.append(parse_field('ACCESSORS(%s)' % body));
#
# Emit a block of constants.
#
......
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