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

[objects.h splitting] Move argument-related classes.

This is an unexciting CL (doesn't make the build step situation any better)
but enables moving FixedArray & co next.

BUG=v8:5402,v8:6474

Change-Id: Ia36eb3973e6242f6f68e02b9f583dc552d48422f
Reviewed-on: https://chromium-review.googlesource.com/529168
Commit-Queue: Marja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarMichael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#45889}
parent 15970238
......@@ -1766,6 +1766,8 @@ v8_source_set("v8_base") {
"src/objects-printer.cc",
"src/objects.cc",
"src/objects.h",
"src/objects/arguments-inl.h",
"src/objects/arguments.h",
"src/objects/code-cache-inl.h",
"src/objects/code-cache.h",
"src/objects/compilation-cache-inl.h",
......
......@@ -18,6 +18,7 @@
namespace v8 {
namespace internal {
class AliasedArgumentsEntry;
class BreakPointInfo;
class BoilerplateDescription;
class ConstantElementsPair;
......
......@@ -31,6 +31,7 @@
#include "src/lookup-cache-inl.h"
#include "src/lookup.h"
#include "src/objects.h"
#include "src/objects/arguments-inl.h"
#include "src/objects/hash-table.h"
#include "src/objects/literal-objects.h"
#include "src/objects/module-info.h"
......@@ -79,7 +80,6 @@ TYPE_CHECKER(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE)
TYPE_CHECKER(Foreign, FOREIGN_TYPE)
TYPE_CHECKER(FreeSpace, FREE_SPACE_TYPE)
TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE)
TYPE_CHECKER(JSArgumentsObject, JS_ARGUMENTS_TYPE)
TYPE_CHECKER(JSArray, JS_ARRAY_TYPE)
TYPE_CHECKER(JSArrayBuffer, JS_ARRAY_BUFFER_TYPE)
TYPE_CHECKER(JSAsyncGeneratorObject, JS_ASYNC_GENERATOR_OBJECT_TYPE)
......@@ -532,7 +532,6 @@ CAST_ACCESSOR(AbstractCode)
CAST_ACCESSOR(AccessCheckInfo)
CAST_ACCESSOR(AccessorInfo)
CAST_ACCESSOR(AccessorPair)
CAST_ACCESSOR(AliasedArgumentsEntry)
CAST_ACCESSOR(AllocationMemento)
CAST_ACCESSOR(AllocationSite)
CAST_ACCESSOR(ArrayList)
......@@ -559,7 +558,6 @@ CAST_ACCESSOR(GlobalDictionary)
CAST_ACCESSOR(HandlerTable)
CAST_ACCESSOR(HeapObject)
CAST_ACCESSOR(InterceptorInfo)
CAST_ACCESSOR(JSArgumentsObject);
CAST_ACCESSOR(JSArray)
CAST_ACCESSOR(JSArrayBuffer)
CAST_ACCESSOR(JSArrayBufferView)
......@@ -585,7 +583,6 @@ CAST_ACCESSOR(JSReceiver)
CAST_ACCESSOR(JSRegExp)
CAST_ACCESSOR(JSSet)
CAST_ACCESSOR(JSSetIterator)
CAST_ACCESSOR(JSSloppyArgumentsObject)
CAST_ACCESSOR(JSStringIterator)
CAST_ACCESSOR(JSTypedArray)
CAST_ACCESSOR(JSValue)
......@@ -612,7 +609,6 @@ CAST_ACCESSOR(PrototypeInfo)
CAST_ACCESSOR(RegExpMatchInfo)
CAST_ACCESSOR(ScopeInfo)
CAST_ACCESSOR(SeededNumberDictionary)
CAST_ACCESSOR(SloppyArgumentsElements)
CAST_ACCESSOR(Smi)
CAST_ACCESSOR(SourcePositionTableWithFrameCache)
CAST_ACCESSOR(StackFrameInfo)
......@@ -1109,30 +1105,6 @@ FixedArrayBase* JSObject::elements() const {
return static_cast<FixedArrayBase*>(array);
}
Context* SloppyArgumentsElements::context() {
return Context::cast(get(kContextIndex));
}
FixedArray* SloppyArgumentsElements::arguments() {
return FixedArray::cast(get(kArgumentsIndex));
}
void SloppyArgumentsElements::set_arguments(FixedArray* arguments) {
set(kArgumentsIndex, arguments);
}
uint32_t SloppyArgumentsElements::parameter_map_length() {
return length() - kParameterMapStart;
}
Object* SloppyArgumentsElements::get_mapped_entry(uint32_t entry) {
return get(entry + kParameterMapStart);
}
void SloppyArgumentsElements::set_mapped_entry(uint32_t entry, Object* object) {
set(entry + kParameterMapStart, object);
}
void AllocationSite::Initialize() {
set_transition_info(Smi::kZero);
SetElementsKind(GetInitialFastElementsKind());
......@@ -4543,9 +4515,6 @@ void Map::SetBackPointer(Object* value, WriteBarrierMode mode) {
set_constructor_or_backpointer(value, mode);
}
ACCESSORS(JSArgumentsObject, length, Object, kLengthOffset);
ACCESSORS(JSSloppyArgumentsObject, callee, Object, kCalleeOffset);
ACCESSORS(Map, code_cache, FixedArray, kCodeCacheOffset)
ACCESSORS(Map, dependent_code, DependentCode, kDependentCodeOffset)
ACCESSORS(Map, weak_cell_cache, Object, kWeakCellCacheOffset)
......@@ -6442,10 +6411,6 @@ bool TypeFeedbackInfo::matches_inlined_type_change_checksum(int checksum) {
return InlinedTypeChangeChecksum::decode(value) == (checksum & mask);
}
SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot)
Relocatable::Relocatable(Isolate* isolate) {
isolate_ = isolate;
prev_ = isolate->relocatable_top();
......
......@@ -22,7 +22,6 @@
#include "src/property-details.h"
#include "src/unicode-decoder.h"
#include "src/unicode.h"
#include "src/zone/zone.h"
#if V8_TARGET_ARCH_ARM
#include "src/arm/constants-arm.h" // NOLINT
......@@ -2698,59 +2697,6 @@ class JSIteratorResult: public JSObject {
};
// Common superclass for JSSloppyArgumentsObject and JSStrictArgumentsObject.
class JSArgumentsObject: public JSObject {
public:
// Offsets of object fields.
static const int kLengthOffset = JSObject::kHeaderSize;
static const int kHeaderSize = kLengthOffset + kPointerSize;
// Indices of in-object properties.
static const int kLengthIndex = 0;
DECL_ACCESSORS(length, Object)
DECLARE_VERIFIER(JSArgumentsObject)
DECLARE_CAST(JSArgumentsObject)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSArgumentsObject);
};
// JSSloppyArgumentsObject is just a JSObject with specific initial map.
// This initial map adds in-object properties for "length" and "callee".
class JSSloppyArgumentsObject: public JSArgumentsObject {
public:
// Offsets of object fields.
static const int kCalleeOffset = JSArgumentsObject::kHeaderSize;
static const int kSize = kCalleeOffset + kPointerSize;
// Indices of in-object properties.
static const int kCalleeIndex = kLengthIndex + 1;
DECL_ACCESSORS(callee, Object)
DECLARE_VERIFIER(JSSloppyArgumentsObject)
DECLARE_CAST(JSSloppyArgumentsObject)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSSloppyArgumentsObject);
};
// JSStrictArgumentsObject is just a JSObject with specific initial map.
// This initial map adds an in-object property for "length".
class JSStrictArgumentsObject: public JSArgumentsObject {
public:
// Offsets of object fields.
static const int kSize = JSArgumentsObject::kHeaderSize;
DECLARE_CAST(JSStrictArgumentsObject)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSStrictArgumentsObject);
};
// Common superclass for FixedArrays that allow implementations to share
// common accessors and some code paths.
class FixedArrayBase: public HeapObject {
......@@ -2921,50 +2867,6 @@ class FixedDoubleArray: public FixedArrayBase {
DISALLOW_IMPLICIT_CONSTRUCTORS(FixedDoubleArray);
};
// Helper class to access FAST_ and SLOW_SLOPPY_ARGUMENTS_ELEMENTS
//
// +---+-----------------------+
// | 0 | Context* context |
// +---------------------------+
// | 1 | FixedArray* arguments +----+ FAST_HOLEY_ELEMENTS
// +---------------------------+ v-----+-----------+
// | 2 | Object* param_1_map | | 0 | the_hole |
// |...| ... | | ... | ... |
// |n+1| Object* param_n_map | | n-1 | the_hole |
// +---------------------------+ | n | element_1 |
// | ... | ... |
// |n+m-1| element_m |
// +-----------------+
//
// Parameter maps give the index into the provided context. If a map entry is
// the_hole it means that the given entry has been deleted from the arguments
// object.
// The arguments backing store kind depends on the ElementsKind of the outer
// JSArgumentsObject:
// - FAST_SLOPPY_ARGUMENTS_ELEMENTS: FAST_HOLEY_ELEMENTS
// - SLOW_SLOPPY_ARGUMENTS_ELEMENTS: DICTIONARY_ELEMENTS
class SloppyArgumentsElements : public FixedArray {
public:
static const int kContextIndex = 0;
static const int kArgumentsIndex = 1;
static const uint32_t kParameterMapStart = 2;
inline Context* context();
inline FixedArray* arguments();
inline void set_arguments(FixedArray* arguments);
inline uint32_t parameter_map_length();
inline Object* get_mapped_entry(uint32_t entry);
inline void set_mapped_entry(uint32_t entry, Object* object);
DECLARE_CAST(SloppyArgumentsElements)
#ifdef VERIFY_HEAP
void SloppyArgumentsElementsVerify(JSSloppyArgumentsObject* holder);
#endif
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(SloppyArgumentsElements);
};
class WeakFixedArray : public FixedArray {
public:
// If |maybe_array| is not a WeakFixedArray, a fresh one will be allocated.
......@@ -6009,32 +5911,6 @@ class AllocationMemento: public Struct {
};
// Representation of a slow alias as part of a sloppy arguments objects.
// For fast aliases (if HasSloppyArgumentsElements()):
// - the parameter map contains an index into the context
// - all attributes of the element have default values
// For slow aliases (if HasDictionaryArgumentsElements()):
// - the parameter map contains no fast alias mapping (i.e. the hole)
// - this struct (in the slow backing store) contains an index into the context
// - all attributes are available as part if the property details
class AliasedArgumentsEntry: public Struct {
public:
inline int aliased_context_slot() const;
inline void set_aliased_context_slot(int count);
DECLARE_CAST(AliasedArgumentsEntry)
// Dispatched behavior.
DECLARE_PRINTER(AliasedArgumentsEntry)
DECLARE_VERIFIER(AliasedArgumentsEntry)
static const int kAliasedContextSlot = HeapObject::kHeaderSize;
static const int kSize = kAliasedContextSlot + kPointerSize;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(AliasedArgumentsEntry);
};
// Utility superclass for stack-allocated objects that must be updated
// on gc. It provides two ways for the gc to update instances, either
// iterating or updating after gc.
......
// 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_ARGUMENTS_INL_H_
#define V8_OBJECTS_ARGUMENTS_INL_H_
#include "src/objects/arguments.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
CAST_ACCESSOR(AliasedArgumentsEntry)
CAST_ACCESSOR(JSArgumentsObject)
CAST_ACCESSOR(JSSloppyArgumentsObject)
CAST_ACCESSOR(SloppyArgumentsElements)
ACCESSORS(JSArgumentsObject, length, Object, kLengthOffset);
ACCESSORS(JSSloppyArgumentsObject, callee, Object, kCalleeOffset);
SMI_ACCESSORS(AliasedArgumentsEntry, aliased_context_slot, kAliasedContextSlot)
TYPE_CHECKER(JSArgumentsObject, JS_ARGUMENTS_TYPE)
Context* SloppyArgumentsElements::context() {
return Context::cast(get(kContextIndex));
}
FixedArray* SloppyArgumentsElements::arguments() {
return FixedArray::cast(get(kArgumentsIndex));
}
void SloppyArgumentsElements::set_arguments(FixedArray* arguments) {
set(kArgumentsIndex, arguments);
}
uint32_t SloppyArgumentsElements::parameter_map_length() {
return length() - kParameterMapStart;
}
Object* SloppyArgumentsElements::get_mapped_entry(uint32_t entry) {
return get(entry + kParameterMapStart);
}
void SloppyArgumentsElements::set_mapped_entry(uint32_t entry, Object* object) {
set(entry + kParameterMapStart, object);
}
} // namespace internal
} // namespace v8
#include "src/objects/object-macros-undef.h"
#endif // V8_OBJECTS_ARGUMENTS_INL_H_
// 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_ARGUMENTS_H_
#define V8_OBJECTS_ARGUMENTS_H_
#include "src/objects.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
// Common superclass for JSSloppyArgumentsObject and JSStrictArgumentsObject.
class JSArgumentsObject : public JSObject {
public:
// Offsets of object fields.
static const int kLengthOffset = JSObject::kHeaderSize;
static const int kHeaderSize = kLengthOffset + kPointerSize;
// Indices of in-object properties.
static const int kLengthIndex = 0;
DECL_ACCESSORS(length, Object)
DECLARE_VERIFIER(JSArgumentsObject)
DECLARE_CAST(JSArgumentsObject)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSArgumentsObject);
};
// JSSloppyArgumentsObject is just a JSObject with specific initial map.
// This initial map adds in-object properties for "length" and "callee".
class JSSloppyArgumentsObject : public JSArgumentsObject {
public:
// Offsets of object fields.
static const int kCalleeOffset = JSArgumentsObject::kHeaderSize;
static const int kSize = kCalleeOffset + kPointerSize;
// Indices of in-object properties.
static const int kCalleeIndex = kLengthIndex + 1;
DECL_ACCESSORS(callee, Object)
DECLARE_VERIFIER(JSSloppyArgumentsObject)
DECLARE_CAST(JSSloppyArgumentsObject)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSSloppyArgumentsObject);
};
// JSStrictArgumentsObject is just a JSObject with specific initial map.
// This initial map adds an in-object property for "length".
class JSStrictArgumentsObject : public JSArgumentsObject {
public:
// Offsets of object fields.
static const int kSize = JSArgumentsObject::kHeaderSize;
DECLARE_CAST(JSStrictArgumentsObject)
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(JSStrictArgumentsObject);
};
// Helper class to access FAST_ and SLOW_SLOPPY_ARGUMENTS_ELEMENTS
//
// +---+-----------------------+
// | 0 | Context* context |
// +---------------------------+
// | 1 | FixedArray* arguments +----+ FAST_HOLEY_ELEMENTS
// +---------------------------+ v-----+-----------+
// | 2 | Object* param_1_map | | 0 | the_hole |
// |...| ... | | ... | ... |
// |n+1| Object* param_n_map | | n-1 | the_hole |
// +---------------------------+ | n | element_1 |
// | ... | ... |
// |n+m-1| element_m |
// +-----------------+
//
// Parameter maps give the index into the provided context. If a map entry is
// the_hole it means that the given entry has been deleted from the arguments
// object.
// The arguments backing store kind depends on the ElementsKind of the outer
// JSArgumentsObject:
// - FAST_SLOPPY_ARGUMENTS_ELEMENTS: FAST_HOLEY_ELEMENTS
// - SLOW_SLOPPY_ARGUMENTS_ELEMENTS: DICTIONARY_ELEMENTS
class SloppyArgumentsElements : public FixedArray {
public:
static const int kContextIndex = 0;
static const int kArgumentsIndex = 1;
static const uint32_t kParameterMapStart = 2;
inline Context* context();
inline FixedArray* arguments();
inline void set_arguments(FixedArray* arguments);
inline uint32_t parameter_map_length();
inline Object* get_mapped_entry(uint32_t entry);
inline void set_mapped_entry(uint32_t entry, Object* object);
DECLARE_CAST(SloppyArgumentsElements)
#ifdef VERIFY_HEAP
void SloppyArgumentsElementsVerify(JSSloppyArgumentsObject* holder);
#endif
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(SloppyArgumentsElements);
};
// Representation of a slow alias as part of a sloppy arguments objects.
// For fast aliases (if HasSloppyArgumentsElements()):
// - the parameter map contains an index into the context
// - all attributes of the element have default values
// For slow aliases (if HasDictionaryArgumentsElements()):
// - the parameter map contains no fast alias mapping (i.e. the hole)
// - this struct (in the slow backing store) contains an index into the context
// - all attributes are available as part if the property details
class AliasedArgumentsEntry : public Struct {
public:
inline int aliased_context_slot() const;
inline void set_aliased_context_slot(int count);
DECLARE_CAST(AliasedArgumentsEntry)
// Dispatched behavior.
DECLARE_PRINTER(AliasedArgumentsEntry)
DECLARE_VERIFIER(AliasedArgumentsEntry)
static const int kAliasedContextSlot = HeapObject::kHeaderSize;
static const int kSize = kAliasedContextSlot + kPointerSize;
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(AliasedArgumentsEntry);
};
} // namespace internal
} // namespace v8
#include "src/objects/object-macros-undef.h"
#endif // V8_OBJECTS_ARGUMENTS_H_
......@@ -1224,6 +1224,8 @@
'objects-printer.cc',
'objects.cc',
'objects.h',
'objects/arguments-inl.h',
'objects/arguments.h',
'objects/code-cache.h',
'objects/code-cache-inl.h',
'objects/compilation-cache.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