2015-12-16 14:27:15 +00:00
|
|
|
// Copyright 2015 the V8 project authors. All rights reserved.
|
2014-04-29 06:42:26 +00:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
#ifndef V8_OBJECTS_H_
|
|
|
|
#define V8_OBJECTS_H_
|
|
|
|
|
2014-09-30 10:29:32 +00:00
|
|
|
#include <iosfwd>
|
2016-07-25 10:24:45 +00:00
|
|
|
#include <memory>
|
2014-09-30 10:29:32 +00:00
|
|
|
|
2018-09-07 09:03:35 +00:00
|
|
|
#include "include/v8-internal.h"
|
2018-05-16 10:49:30 +00:00
|
|
|
#include "include/v8.h"
|
|
|
|
#include "include/v8config.h"
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/assert-scope.h"
|
2014-09-02 13:36:35 +00:00
|
|
|
#include "src/base/bits.h"
|
2018-05-16 10:49:30 +00:00
|
|
|
#include "src/base/build_config.h"
|
2015-11-25 13:46:09 +00:00
|
|
|
#include "src/base/flags.h"
|
2018-05-16 10:49:30 +00:00
|
|
|
#include "src/base/logging.h"
|
2014-06-30 13:25:46 +00:00
|
|
|
#include "src/checks.h"
|
2018-10-24 22:52:04 +00:00
|
|
|
#include "src/constants-arch.h"
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/elements-kind.h"
|
2014-06-10 14:01:08 +00:00
|
|
|
#include "src/field-index.h"
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/flags.h"
|
2018-10-11 21:35:34 +00:00
|
|
|
#include "src/message-template.h"
|
2018-07-03 14:27:16 +00:00
|
|
|
#include "src/objects-definitions.h"
|
2014-06-03 08:12:43 +00:00
|
|
|
#include "src/property-details.h"
|
2018-07-03 08:37:51 +00:00
|
|
|
#include "src/roots.h"
|
2018-05-16 10:49:30 +00:00
|
|
|
#include "src/utils.h"
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-06-20 08:40:11 +00:00
|
|
|
|
2017-01-10 16:05:34 +00:00
|
|
|
// Has to be the last include (doesn't have include guards):
|
|
|
|
#include "src/objects/object-macros.h"
|
2011-10-21 10:32:38 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
//
|
2010-07-20 07:14:19 +00:00
|
|
|
// Most object types in the V8 JavaScript are described in this file.
|
2008-07-03 15:10:15 +00:00
|
|
|
//
|
|
|
|
// Inheritance hierarchy:
|
2014-04-30 12:25:18 +00:00
|
|
|
// - Object
|
|
|
|
// - Smi (immediate small integer)
|
|
|
|
// - HeapObject (superclass for everything allocated in the heap)
|
|
|
|
// - JSReceiver (suitable for property access)
|
|
|
|
// - JSObject
|
|
|
|
// - JSArray
|
|
|
|
// - JSArrayBuffer
|
|
|
|
// - JSArrayBufferView
|
|
|
|
// - JSTypedArray
|
|
|
|
// - JSDataView
|
2015-12-27 06:30:53 +00:00
|
|
|
// - JSBoundFunction
|
2014-07-10 10:54:47 +00:00
|
|
|
// - JSCollection
|
|
|
|
// - JSSet
|
|
|
|
// - JSMap
|
2016-09-21 14:17:42 +00:00
|
|
|
// - JSStringIterator
|
2014-04-30 12:25:18 +00:00
|
|
|
// - JSSetIterator
|
|
|
|
// - JSMapIterator
|
|
|
|
// - JSWeakCollection
|
|
|
|
// - JSWeakMap
|
|
|
|
// - JSWeakSet
|
|
|
|
// - JSRegExp
|
|
|
|
// - JSFunction
|
|
|
|
// - JSGeneratorObject
|
2015-11-02 14:57:59 +00:00
|
|
|
// - JSGlobalObject
|
2014-04-30 12:25:18 +00:00
|
|
|
// - JSGlobalProxy
|
|
|
|
// - JSValue
|
|
|
|
// - JSDate
|
|
|
|
// - JSMessageObject
|
2016-10-07 19:37:04 +00:00
|
|
|
// - JSModuleNamespace
|
2018-09-05 02:17:38 +00:00
|
|
|
// - JSV8BreakIterator // If V8_INTL_SUPPORT enabled.
|
2018-08-08 09:23:07 +00:00
|
|
|
// - JSCollator // If V8_INTL_SUPPORT enabled.
|
2018-08-29 04:40:53 +00:00
|
|
|
// - JSDateTimeFormat // If V8_INTL_SUPPORT enabled.
|
2018-08-08 09:23:07 +00:00
|
|
|
// - JSListFormat // If V8_INTL_SUPPORT enabled.
|
|
|
|
// - JSLocale // If V8_INTL_SUPPORT enabled.
|
2018-09-04 18:32:51 +00:00
|
|
|
// - JSNumberFormat // If V8_INTL_SUPPORT enabled.
|
2018-08-08 09:23:07 +00:00
|
|
|
// - JSPluralRules // If V8_INTL_SUPPORT enabled.
|
2018-07-10 12:52:05 +00:00
|
|
|
// - JSRelativeTimeFormat // If V8_INTL_SUPPORT enabled.
|
2018-10-18 07:59:28 +00:00
|
|
|
// - JSSegmentIterator // If V8_INTL_SUPPORT enabled.
|
2018-10-05 01:57:05 +00:00
|
|
|
// - JSSegmenter // If V8_INTL_SUPPORT enabled.
|
2018-09-10 10:28:00 +00:00
|
|
|
// - WasmExceptionObject
|
2018-04-03 18:17:57 +00:00
|
|
|
// - WasmGlobalObject
|
2017-07-07 12:27:56 +00:00
|
|
|
// - WasmInstanceObject
|
|
|
|
// - WasmMemoryObject
|
|
|
|
// - WasmModuleObject
|
|
|
|
// - WasmTableObject
|
2014-04-30 12:25:18 +00:00
|
|
|
// - JSProxy
|
|
|
|
// - FixedArrayBase
|
|
|
|
// - ByteArray
|
2015-07-24 12:02:41 +00:00
|
|
|
// - BytecodeArray
|
2014-04-30 12:25:18 +00:00
|
|
|
// - FixedArray
|
|
|
|
// - DescriptorArray
|
2016-08-24 08:48:34 +00:00
|
|
|
// - FrameArray
|
2014-04-30 12:25:18 +00:00
|
|
|
// - HashTable
|
|
|
|
// - Dictionary
|
|
|
|
// - StringTable
|
2016-03-31 05:58:42 +00:00
|
|
|
// - StringSet
|
2014-04-30 12:25:18 +00:00
|
|
|
// - CompilationCacheTable
|
|
|
|
// - MapCache
|
|
|
|
// - OrderedHashTable
|
|
|
|
// - OrderedHashSet
|
|
|
|
// - OrderedHashMap
|
|
|
|
// - Context
|
2017-02-07 14:05:02 +00:00
|
|
|
// - FeedbackMetadata
|
2016-08-01 14:28:06 +00:00
|
|
|
// - TemplateList
|
2014-04-30 12:25:18 +00:00
|
|
|
// - TransitionArray
|
2016-08-01 14:28:06 +00:00
|
|
|
// - ScopeInfo
|
2016-08-31 14:25:28 +00:00
|
|
|
// - ModuleInfo
|
2014-11-12 11:34:09 +00:00
|
|
|
// - ScriptContextTable
|
2014-04-30 12:25:18 +00:00
|
|
|
// - FixedDoubleArray
|
|
|
|
// - Name
|
|
|
|
// - String
|
|
|
|
// - SeqString
|
|
|
|
// - SeqOneByteString
|
|
|
|
// - SeqTwoByteString
|
|
|
|
// - SlicedString
|
|
|
|
// - ConsString
|
2017-01-19 13:27:59 +00:00
|
|
|
// - ThinString
|
2014-04-30 12:25:18 +00:00
|
|
|
// - ExternalString
|
2014-09-10 12:38:12 +00:00
|
|
|
// - ExternalOneByteString
|
2014-04-30 12:25:18 +00:00
|
|
|
// - ExternalTwoByteString
|
|
|
|
// - InternalizedString
|
|
|
|
// - SeqInternalizedString
|
|
|
|
// - SeqOneByteInternalizedString
|
|
|
|
// - SeqTwoByteInternalizedString
|
|
|
|
// - ConsInternalizedString
|
|
|
|
// - ExternalInternalizedString
|
2014-09-10 12:38:12 +00:00
|
|
|
// - ExternalOneByteInternalizedString
|
2014-04-30 12:25:18 +00:00
|
|
|
// - ExternalTwoByteInternalizedString
|
|
|
|
// - Symbol
|
|
|
|
// - HeapNumber
|
2017-09-11 13:16:27 +00:00
|
|
|
// - BigInt
|
2014-04-30 12:25:18 +00:00
|
|
|
// - Cell
|
2015-03-18 12:54:02 +00:00
|
|
|
// - PropertyCell
|
2017-07-11 20:56:40 +00:00
|
|
|
// - PropertyArray
|
2014-04-30 12:25:18 +00:00
|
|
|
// - Code
|
2016-01-28 12:11:55 +00:00
|
|
|
// - AbstractCode, a wrapper around Code or BytecodeArray
|
2014-04-30 12:25:18 +00:00
|
|
|
// - Map
|
|
|
|
// - Oddball
|
|
|
|
// - Foreign
|
2017-06-19 23:19:16 +00:00
|
|
|
// - SmallOrderedHashTable
|
|
|
|
// - SmallOrderedHashMap
|
|
|
|
// - SmallOrderedHashSet
|
2014-04-30 12:25:18 +00:00
|
|
|
// - SharedFunctionInfo
|
|
|
|
// - Struct
|
|
|
|
// - AccessorInfo
|
2018-02-08 16:36:52 +00:00
|
|
|
// - PromiseReaction
|
2017-08-30 17:03:38 +00:00
|
|
|
// - PromiseCapability
|
2014-04-30 12:25:18 +00:00
|
|
|
// - AccessorPair
|
|
|
|
// - AccessCheckInfo
|
|
|
|
// - InterceptorInfo
|
|
|
|
// - CallHandlerInfo
|
2017-08-30 04:21:29 +00:00
|
|
|
// - EnumCache
|
2014-04-30 12:25:18 +00:00
|
|
|
// - TemplateInfo
|
|
|
|
// - FunctionTemplateInfo
|
|
|
|
// - ObjectTemplateInfo
|
|
|
|
// - Script
|
|
|
|
// - DebugInfo
|
2017-08-01 16:41:20 +00:00
|
|
|
// - BreakPoint
|
2014-04-30 12:25:18 +00:00
|
|
|
// - BreakPointInfo
|
2017-04-03 14:58:49 +00:00
|
|
|
// - StackFrameInfo
|
2017-05-23 13:01:29 +00:00
|
|
|
// - SourcePositionTableWithFrameCache
|
2014-04-30 12:25:18 +00:00
|
|
|
// - CodeCache
|
2015-04-07 10:42:45 +00:00
|
|
|
// - PrototypeInfo
|
2018-02-08 16:36:52 +00:00
|
|
|
// - Microtask
|
|
|
|
// - CallbackTask
|
|
|
|
// - CallableTask
|
|
|
|
// - PromiseReactionJobTask
|
|
|
|
// - PromiseFulfillReactionJobTask
|
|
|
|
// - PromiseRejectReactionJobTask
|
|
|
|
// - PromiseResolveThenableJobTask
|
2018-09-04 20:33:24 +00:00
|
|
|
// - MicrotaskQueue
|
2016-09-16 16:47:07 +00:00
|
|
|
// - Module
|
2016-11-04 09:37:22 +00:00
|
|
|
// - ModuleInfoEntry
|
2018-02-22 12:04:01 +00:00
|
|
|
// - FeedbackCell
|
2017-07-27 12:45:00 +00:00
|
|
|
// - FeedbackVector
|
2018-07-10 16:05:04 +00:00
|
|
|
// - PreParsedScopeData
|
2018-07-09 09:34:34 +00:00
|
|
|
// - UncompiledData
|
|
|
|
// - UncompiledDataWithoutPreParsedScope
|
|
|
|
// - UncompiledDataWithPreParsedScope
|
2008-07-03 15:10:15 +00:00
|
|
|
//
|
|
|
|
// Formats of Object*:
|
|
|
|
// Smi: [31 bit signed int] 0
|
|
|
|
// HeapObject: [32 bit direct pointer] (4 byte aligned) | 01
|
|
|
|
|
2009-05-25 10:05:56 +00:00
|
|
|
namespace v8 {
|
|
|
|
namespace internal {
|
2008-07-03 15:10:15 +00:00
|
|
|
|
This CL enables precise source positions for all V8 compilers. It merges compiler::SourcePosition and internal::SourcePosition to a single class used throughout the codebase. The new internal::SourcePosition instances store an id identifying an inlined function in addition to a script offset.
SourcePosition::InliningId() refers to a the new table DeoptimizationInputData::InliningPositions(), which provides the following data for every inlining id:
- The inlined SharedFunctionInfo as an offset into DeoptimizationInfo::LiteralArray
- The SourcePosition of the inlining. Recursively, this yields the full inlining stack.
Before the Code object is created, the same information can be found in CompilationInfo::inlined_functions().
If SourcePosition::InliningId() is SourcePosition::kNotInlined, it refers to the outer (non-inlined) function.
So every SourcePosition has full information about its inlining stack, as long as the corresponding Code object is known. The internal represenation of a source position is a positive 64bit integer.
All compilers create now appropriate source positions for inlined functions. In the case of Turbofan, this required using AstGraphBuilderWithPositions for inlined functions too. So this class is now moved to a header file.
At the moment, the additional information in source positions is only used in --trace-deopt and --code-comments. The profiler needs to be updated, at the moment it gets the correct script offsets from the deopt info, but the wrong script id from the reconstructed deopt stack, which can lead to wrong outputs. This should be resolved by making the profiler use the new inlining information for deopts.
I activated the inlined deoptimization tests in test-cpu-profiler.cc for Turbofan, changing them to a case where the deopt stack and the inlining position agree. It is currently still broken for other cases.
The following additional changes were necessary:
- The source position table (internal::SourcePositionTableBuilder etc.) supports now 64bit source positions. Encoding source positions in a single 64bit int together with the difference encoding in the source position table results in very little overhead for the inlining id, since only 12% of the source positions in Octane have a changed inlining id.
- The class HPositionInfo was effectively dead code and is now removed.
- SourcePosition has new printing and information facilities, including computing a full inlining stack.
- I had to rename compiler/source-position.{h,cc} to compiler/compiler-source-position-table.{h,cc} to avoid clashes with the new src/source-position.cc file.
- I wrote the new wrapper PodArray for ByteArray. It is a template working with any POD-type. This is used in DeoptimizationInputData::InliningPositions().
- I removed HInlinedFunctionInfo and HGraph::inlined_function_infos, because they were only used for the now obsolete Crankshaft inlining ids.
- Crankshaft managed a list of inlined functions in Lithium: LChunk::inlined_functions. This is an analog structure to CompilationInfo::inlined_functions. So I removed LChunk::inlined_functions and made Crankshaft use CompilationInfo::inlined_functions instead, because this was necessary to register the offsets into the literal array in a uniform way. This is a safe change because LChunk::inlined_functions has no other uses and the functions in CompilationInfo::inlined_functions have a strictly longer lifespan, being created earlier (in Hydrogen already).
BUG=v8:5432
Review-Url: https://codereview.chromium.org/2451853002
Cr-Commit-Position: refs/heads/master@{#40975}
2016-11-14 17:21:37 +00:00
|
|
|
struct InliningPosition;
|
2017-09-25 08:21:07 +00:00
|
|
|
class PropertyDescriptorObject;
|
This CL enables precise source positions for all V8 compilers. It merges compiler::SourcePosition and internal::SourcePosition to a single class used throughout the codebase. The new internal::SourcePosition instances store an id identifying an inlined function in addition to a script offset.
SourcePosition::InliningId() refers to a the new table DeoptimizationInputData::InliningPositions(), which provides the following data for every inlining id:
- The inlined SharedFunctionInfo as an offset into DeoptimizationInfo::LiteralArray
- The SourcePosition of the inlining. Recursively, this yields the full inlining stack.
Before the Code object is created, the same information can be found in CompilationInfo::inlined_functions().
If SourcePosition::InliningId() is SourcePosition::kNotInlined, it refers to the outer (non-inlined) function.
So every SourcePosition has full information about its inlining stack, as long as the corresponding Code object is known. The internal represenation of a source position is a positive 64bit integer.
All compilers create now appropriate source positions for inlined functions. In the case of Turbofan, this required using AstGraphBuilderWithPositions for inlined functions too. So this class is now moved to a header file.
At the moment, the additional information in source positions is only used in --trace-deopt and --code-comments. The profiler needs to be updated, at the moment it gets the correct script offsets from the deopt info, but the wrong script id from the reconstructed deopt stack, which can lead to wrong outputs. This should be resolved by making the profiler use the new inlining information for deopts.
I activated the inlined deoptimization tests in test-cpu-profiler.cc for Turbofan, changing them to a case where the deopt stack and the inlining position agree. It is currently still broken for other cases.
The following additional changes were necessary:
- The source position table (internal::SourcePositionTableBuilder etc.) supports now 64bit source positions. Encoding source positions in a single 64bit int together with the difference encoding in the source position table results in very little overhead for the inlining id, since only 12% of the source positions in Octane have a changed inlining id.
- The class HPositionInfo was effectively dead code and is now removed.
- SourcePosition has new printing and information facilities, including computing a full inlining stack.
- I had to rename compiler/source-position.{h,cc} to compiler/compiler-source-position-table.{h,cc} to avoid clashes with the new src/source-position.cc file.
- I wrote the new wrapper PodArray for ByteArray. It is a template working with any POD-type. This is used in DeoptimizationInputData::InliningPositions().
- I removed HInlinedFunctionInfo and HGraph::inlined_function_infos, because they were only used for the now obsolete Crankshaft inlining ids.
- Crankshaft managed a list of inlined functions in Lithium: LChunk::inlined_functions. This is an analog structure to CompilationInfo::inlined_functions. So I removed LChunk::inlined_functions and made Crankshaft use CompilationInfo::inlined_functions instead, because this was necessary to register the offsets into the literal array in a uniform way. This is a safe change because LChunk::inlined_functions has no other uses and the functions in CompilationInfo::inlined_functions have a strictly longer lifespan, being created earlier (in Hydrogen already).
BUG=v8:5432
Review-Url: https://codereview.chromium.org/2451853002
Cr-Commit-Position: refs/heads/master@{#40975}
2016-11-14 17:21:37 +00:00
|
|
|
|
2015-05-27 14:13:04 +00:00
|
|
|
// SKIP_WRITE_BARRIER skips the write barrier.
|
|
|
|
// UPDATE_WEAK_WRITE_BARRIER skips the marking part of the write barrier and
|
|
|
|
// only performs the generational part.
|
|
|
|
// UPDATE_WRITE_BARRIER is doing the full barrier, marking and generational.
|
|
|
|
enum WriteBarrierMode {
|
|
|
|
SKIP_WRITE_BARRIER,
|
|
|
|
UPDATE_WEAK_WRITE_BARRIER,
|
|
|
|
UPDATE_WRITE_BARRIER
|
|
|
|
};
|
2008-10-23 08:46:32 +00:00
|
|
|
|
2009-01-12 10:59:58 +00:00
|
|
|
|
2009-01-12 11:07:02 +00:00
|
|
|
// PropertyNormalizationMode is used to specify whether to keep
|
|
|
|
// inobject properties when normalizing properties of a JSObject.
|
2009-01-12 10:59:58 +00:00
|
|
|
enum PropertyNormalizationMode {
|
|
|
|
CLEAR_INOBJECT_PROPERTIES,
|
|
|
|
KEEP_INOBJECT_PROPERTIES
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-07-17 13:50:19 +00:00
|
|
|
// Indicates whether transitions can be added to a source map or not.
|
|
|
|
enum TransitionFlag {
|
|
|
|
INSERT_TRANSITION,
|
|
|
|
OMIT_TRANSITION
|
|
|
|
};
|
|
|
|
|
2012-09-19 09:54:10 +00:00
|
|
|
|
|
|
|
// Indicates whether the transition is simple: the target map of the transition
|
|
|
|
// either extends the current map with a new property, or it modifies the
|
|
|
|
// property that was added last to the current map.
|
2014-12-10 15:18:44 +00:00
|
|
|
enum SimpleTransitionFlag {
|
|
|
|
SIMPLE_PROPERTY_TRANSITION,
|
|
|
|
PROPERTY_TRANSITION,
|
2017-07-21 15:57:33 +00:00
|
|
|
SPECIAL_TRANSITION
|
2014-12-10 15:18:44 +00:00
|
|
|
};
|
2012-09-19 09:54:10 +00:00
|
|
|
|
Sharing of descriptor arrays.
This CL adds multiple things:
Transition arrays do not directly point at their descriptor array anymore, but rather do so via an indirect pointer (a JSGlobalPropertyCell).
An ownership bit is added to maps indicating whether it owns its own descriptor array or not.
Maps owning a descriptor array can pass on ownership if a transition from that map is generated; but only if the descriptor array stays exactly the same; or if a descriptor is added.
Maps that don't have ownership get ownership back if their direct child to which ownership was passed is cleared in ClearNonLiveTransitions.
To detect which descriptors in an array are valid, each map knows its own NumberOfOwnDescriptors. Since the descriptors are sorted in order of addition, if we search and find a descriptor with index bigger than this number, it is not valid for the given map.
We currently still build up an enumeration cache (although this may disappear). The enumeration cache is always built for the entire descriptor array, even if not all descriptors are owned by the map. Once a descriptor array has an enumeration cache for a given map; this invariant will always be true, even if the descriptor array was extended. The extended array will inherit the enumeration cache from the smaller descriptor array. If a map with more descriptors needs an enumeration cache, it's EnumLength will still be set to invalid, so it will have to recompute the enumeration cache. This new cache will also be valid for smaller maps since they have their own enumlength; and use this to loop over the cache. If the EnumLength is still invalid, but there is already a cache present that is big enough; we just initialize the EnumLength field for the map.
When we apply ClearNonLiveTransitions and descriptor ownership is passed back to a parent map, the descriptor array is trimmed in-place and resorted. At the same time, the enumeration cache is trimmed in-place.
Only transition arrays contain descriptor arrays. If we transition to a map and pass ownership of the descriptor array along, the child map will not store the descriptor array it owns. Rather its parent will keep the pointer. So for every leaf-map, we find the descriptor array by following the back pointer, reading out the transition array, and fetching the descriptor array from the JSGlobalPropertyCell. If a map has a transition array, we fetch it from there. If a map has undefined as its back-pointer and has no transition array; it is considered to have an empty descriptor array.
When we modify properties, we cannot share the descriptor array. To accommodate this, the child map will get its own transition array; even if there are not necessarily any transitions leaving from the child map. This is necessary since it's the only way to store its own descriptor array.
Review URL: https://chromiumcodereview.appspot.com/10909007
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12492 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-09-12 16:43:57 +00:00
|
|
|
// Indicates whether we are only interested in the descriptors of a particular
|
|
|
|
// map, or in all descriptors in the descriptor array.
|
|
|
|
enum DescriptorFlag {
|
|
|
|
ALL_DESCRIPTORS,
|
|
|
|
OWN_DESCRIPTORS
|
|
|
|
};
|
|
|
|
|
2010-08-18 13:00:38 +00:00
|
|
|
// Instance size sentinel for objects of variable size.
|
2011-11-29 10:56:11 +00:00
|
|
|
const int kVariableSizeSentinel = 0;
|
2010-08-18 13:00:38 +00:00
|
|
|
|
2014-07-31 07:50:26 +00:00
|
|
|
// We may store the unsigned bit field as signed Smi value and do not
|
|
|
|
// use the sign bit.
|
2016-04-13 13:51:23 +00:00
|
|
|
const int kStubMajorKeyBits = 8;
|
2014-07-31 07:50:26 +00:00
|
|
|
const int kStubMinorKeyBits = kSmiValueSize - kStubMajorKeyBits - 1;
|
2010-08-18 13:00:38 +00:00
|
|
|
|
2017-11-22 18:04:36 +00:00
|
|
|
// We use the full 16 bits of the instance_type field to encode heap object
|
|
|
|
// instance types. All the high-order bits (bit 7-15) are cleared if the object
|
|
|
|
// is a string, and contain set bits if it is not a string.
|
|
|
|
const uint32_t kIsNotStringMask = 0xff80;
|
2008-07-03 15:10:15 +00:00
|
|
|
const uint32_t kStringTag = 0x0;
|
|
|
|
|
2013-02-28 17:03:34 +00:00
|
|
|
// Bit 6 indicates that the object is an internalized string (if set) or not.
|
2013-06-27 13:39:44 +00:00
|
|
|
// Bit 7 has to be clear as well.
|
2013-07-19 11:29:11 +00:00
|
|
|
const uint32_t kIsNotInternalizedMask = 0x40;
|
|
|
|
const uint32_t kNotInternalizedTag = 0x40;
|
|
|
|
const uint32_t kInternalizedTag = 0x0;
|
2008-10-27 12:39:34 +00:00
|
|
|
|
2017-01-19 13:27:59 +00:00
|
|
|
// If bit 7 is clear then bit 3 indicates whether the string consists of
|
2008-10-27 12:39:34 +00:00
|
|
|
// two-byte characters or one-byte characters.
|
2017-01-19 13:27:59 +00:00
|
|
|
const uint32_t kStringEncodingMask = 0x8;
|
2008-07-03 15:10:15 +00:00
|
|
|
const uint32_t kTwoByteStringTag = 0x0;
|
2017-01-19 13:27:59 +00:00
|
|
|
const uint32_t kOneByteStringTag = 0x8;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2017-01-19 13:27:59 +00:00
|
|
|
// If bit 7 is clear, the low-order 3 bits indicate the representation
|
2008-07-03 15:10:15 +00:00
|
|
|
// of the string.
|
2017-01-19 13:27:59 +00:00
|
|
|
const uint32_t kStringRepresentationMask = 0x07;
|
2008-07-03 15:10:15 +00:00
|
|
|
enum StringRepresentationTag {
|
|
|
|
kSeqStringTag = 0x0,
|
|
|
|
kConsStringTag = 0x1,
|
2011-08-26 13:03:30 +00:00
|
|
|
kExternalStringTag = 0x2,
|
2017-01-19 13:27:59 +00:00
|
|
|
kSlicedStringTag = 0x3,
|
|
|
|
kThinStringTag = 0x5
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
2011-08-26 13:03:30 +00:00
|
|
|
const uint32_t kIsIndirectStringMask = 0x1;
|
|
|
|
const uint32_t kIsIndirectStringTag = 0x1;
|
2014-06-03 15:45:38 +00:00
|
|
|
STATIC_ASSERT((kSeqStringTag & kIsIndirectStringMask) == 0); // NOLINT
|
|
|
|
STATIC_ASSERT((kExternalStringTag & kIsIndirectStringMask) == 0); // NOLINT
|
|
|
|
STATIC_ASSERT((kConsStringTag &
|
|
|
|
kIsIndirectStringMask) == kIsIndirectStringTag); // NOLINT
|
|
|
|
STATIC_ASSERT((kSlicedStringTag &
|
|
|
|
kIsIndirectStringMask) == kIsIndirectStringTag); // NOLINT
|
2017-01-19 13:27:59 +00:00
|
|
|
STATIC_ASSERT((kThinStringTag & kIsIndirectStringMask) == kIsIndirectStringTag);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2017-01-19 13:27:59 +00:00
|
|
|
// If bit 7 is clear, then bit 4 indicates whether this two-byte
|
2013-04-26 11:34:44 +00:00
|
|
|
// string actually contains one byte data.
|
2017-01-19 13:27:59 +00:00
|
|
|
const uint32_t kOneByteDataHintMask = 0x10;
|
|
|
|
const uint32_t kOneByteDataHintTag = 0x10;
|
2010-06-17 16:19:28 +00:00
|
|
|
|
2011-11-23 13:08:28 +00:00
|
|
|
// If bit 7 is clear and string representation indicates an external string,
|
2017-01-19 13:27:59 +00:00
|
|
|
// then bit 5 indicates whether the data pointer is cached.
|
2018-08-23 13:01:35 +00:00
|
|
|
const uint32_t kUncachedExternalStringMask = 0x20;
|
|
|
|
const uint32_t kUncachedExternalStringTag = 0x20;
|
2009-04-14 12:00:56 +00:00
|
|
|
|
|
|
|
// A ConsString with an empty string as the right side is a candidate
|
2014-07-15 09:19:22 +00:00
|
|
|
// for being shortcut by the garbage collector. We don't allocate any
|
|
|
|
// non-flat internalized strings, so we do not shortcut them thereby
|
|
|
|
// avoiding turning internalized strings into strings. The bit-masks
|
|
|
|
// below contain the internalized bit as additional safety.
|
|
|
|
// See heap.cc, mark-compact.cc and objects-visiting.cc.
|
2009-04-14 12:00:56 +00:00
|
|
|
const uint32_t kShortcutTypeMask =
|
|
|
|
kIsNotStringMask |
|
2013-07-19 11:29:11 +00:00
|
|
|
kIsNotInternalizedMask |
|
2009-04-14 12:00:56 +00:00
|
|
|
kStringRepresentationMask;
|
2013-07-19 11:29:11 +00:00
|
|
|
const uint32_t kShortcutTypeTag = kConsStringTag | kNotInternalizedTag;
|
2009-04-14 12:00:56 +00:00
|
|
|
|
2014-07-15 09:19:22 +00:00
|
|
|
static inline bool IsShortcutCandidate(int type) {
|
|
|
|
return ((type & kShortcutTypeMask) == kShortcutTypeTag);
|
|
|
|
}
|
|
|
|
|
2017-11-22 18:04:36 +00:00
|
|
|
enum InstanceType : uint16_t {
|
2009-12-22 13:34:02 +00:00
|
|
|
// String types.
|
2015-08-11 19:36:04 +00:00
|
|
|
INTERNALIZED_STRING_TYPE = kTwoByteStringTag | kSeqStringTag |
|
|
|
|
kInternalizedTag, // FIRST_PRIMITIVE_TYPE
|
2014-09-10 12:38:12 +00:00
|
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE =
|
|
|
|
kOneByteStringTag | kSeqStringTag | kInternalizedTag,
|
|
|
|
EXTERNAL_INTERNALIZED_STRING_TYPE =
|
|
|
|
kTwoByteStringTag | kExternalStringTag | kInternalizedTag,
|
|
|
|
EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE =
|
|
|
|
kOneByteStringTag | kExternalStringTag | kInternalizedTag,
|
2013-04-26 11:34:44 +00:00
|
|
|
EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE =
|
2014-09-10 12:38:12 +00:00
|
|
|
EXTERNAL_INTERNALIZED_STRING_TYPE | kOneByteDataHintTag |
|
|
|
|
kInternalizedTag,
|
2018-08-23 13:01:35 +00:00
|
|
|
UNCACHED_EXTERNAL_INTERNALIZED_STRING_TYPE =
|
|
|
|
EXTERNAL_INTERNALIZED_STRING_TYPE | kUncachedExternalStringTag |
|
2014-09-10 12:38:12 +00:00
|
|
|
kInternalizedTag,
|
2018-08-23 13:01:35 +00:00
|
|
|
UNCACHED_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE =
|
|
|
|
EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE | kUncachedExternalStringTag |
|
|
|
|
kInternalizedTag,
|
|
|
|
UNCACHED_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE =
|
2014-09-10 12:38:12 +00:00
|
|
|
EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE |
|
2018-08-23 13:01:35 +00:00
|
|
|
kUncachedExternalStringTag | kInternalizedTag,
|
2013-07-19 11:29:11 +00:00
|
|
|
STRING_TYPE = INTERNALIZED_STRING_TYPE | kNotInternalizedTag,
|
2014-09-10 12:38:12 +00:00
|
|
|
ONE_BYTE_STRING_TYPE =
|
|
|
|
ONE_BYTE_INTERNALIZED_STRING_TYPE | kNotInternalizedTag,
|
2014-04-01 11:30:31 +00:00
|
|
|
CONS_STRING_TYPE = kTwoByteStringTag | kConsStringTag | kNotInternalizedTag,
|
2014-09-10 12:38:12 +00:00
|
|
|
CONS_ONE_BYTE_STRING_TYPE =
|
2014-04-01 11:30:31 +00:00
|
|
|
kOneByteStringTag | kConsStringTag | kNotInternalizedTag,
|
2018-05-02 15:30:06 +00:00
|
|
|
SLICED_STRING_TYPE =
|
|
|
|
kTwoByteStringTag | kSlicedStringTag | kNotInternalizedTag,
|
2014-09-10 12:38:12 +00:00
|
|
|
SLICED_ONE_BYTE_STRING_TYPE =
|
2018-05-02 15:30:06 +00:00
|
|
|
kOneByteStringTag | kSlicedStringTag | kNotInternalizedTag,
|
2013-07-19 11:29:11 +00:00
|
|
|
EXTERNAL_STRING_TYPE =
|
2014-09-10 12:38:12 +00:00
|
|
|
EXTERNAL_INTERNALIZED_STRING_TYPE | kNotInternalizedTag,
|
|
|
|
EXTERNAL_ONE_BYTE_STRING_TYPE =
|
|
|
|
EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE | kNotInternalizedTag,
|
2013-07-19 11:29:11 +00:00
|
|
|
EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE =
|
2014-09-10 12:38:12 +00:00
|
|
|
EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE |
|
|
|
|
kNotInternalizedTag,
|
2018-08-23 13:01:35 +00:00
|
|
|
UNCACHED_EXTERNAL_STRING_TYPE =
|
|
|
|
UNCACHED_EXTERNAL_INTERNALIZED_STRING_TYPE | kNotInternalizedTag,
|
|
|
|
UNCACHED_EXTERNAL_ONE_BYTE_STRING_TYPE =
|
|
|
|
UNCACHED_EXTERNAL_ONE_BYTE_INTERNALIZED_STRING_TYPE | kNotInternalizedTag,
|
|
|
|
UNCACHED_EXTERNAL_STRING_WITH_ONE_BYTE_DATA_TYPE =
|
|
|
|
UNCACHED_EXTERNAL_INTERNALIZED_STRING_WITH_ONE_BYTE_DATA_TYPE |
|
2014-09-10 12:38:12 +00:00
|
|
|
kNotInternalizedTag,
|
2017-01-19 13:27:59 +00:00
|
|
|
THIN_STRING_TYPE = kTwoByteStringTag | kThinStringTag | kNotInternalizedTag,
|
|
|
|
THIN_ONE_BYTE_STRING_TYPE =
|
|
|
|
kOneByteStringTag | kThinStringTag | kNotInternalizedTag,
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2013-03-01 10:34:31 +00:00
|
|
|
// Non-string names
|
2017-11-22 18:04:36 +00:00
|
|
|
SYMBOL_TYPE =
|
2018-08-23 13:01:35 +00:00
|
|
|
1 + (kIsNotInternalizedMask | kUncachedExternalStringMask |
|
2017-11-22 18:04:36 +00:00
|
|
|
kOneByteDataHintMask | kStringEncodingMask |
|
|
|
|
kStringRepresentationMask), // FIRST_NONSTRING_TYPE, LAST_NAME_TYPE
|
2013-03-01 10:34:31 +00:00
|
|
|
|
2015-08-11 19:36:04 +00:00
|
|
|
// Other primitives (cannot contain non-map-word pointers to heap objects).
|
|
|
|
HEAP_NUMBER_TYPE,
|
2017-09-11 13:16:27 +00:00
|
|
|
BIGINT_TYPE,
|
2015-08-11 19:36:04 +00:00
|
|
|
ODDBALL_TYPE, // LAST_PRIMITIVE_TYPE
|
|
|
|
|
2009-12-22 13:34:02 +00:00
|
|
|
// Objects allocated in their own spaces (never in new space).
|
2013-03-01 10:34:31 +00:00
|
|
|
MAP_TYPE,
|
2008-07-03 15:10:15 +00:00
|
|
|
CODE_TYPE,
|
2009-12-22 13:34:02 +00:00
|
|
|
|
|
|
|
// "Data", objects that cannot contain non-map-word pointers to heap
|
|
|
|
// objects.
|
2014-07-01 15:02:31 +00:00
|
|
|
MUTABLE_HEAP_NUMBER_TYPE,
|
2011-05-19 11:47:34 +00:00
|
|
|
FOREIGN_TYPE,
|
2008-07-03 15:10:15 +00:00
|
|
|
BYTE_ARRAY_TYPE,
|
2015-07-24 12:02:41 +00:00
|
|
|
BYTECODE_ARRAY_TYPE,
|
2011-09-19 18:36:47 +00:00
|
|
|
FREE_SPACE_TYPE,
|
2015-08-03 13:02:39 +00:00
|
|
|
FIXED_INT8_ARRAY_TYPE, // FIRST_FIXED_TYPED_ARRAY_TYPE
|
2014-01-16 17:08:45 +00:00
|
|
|
FIXED_UINT8_ARRAY_TYPE,
|
|
|
|
FIXED_INT16_ARRAY_TYPE,
|
|
|
|
FIXED_UINT16_ARRAY_TYPE,
|
|
|
|
FIXED_INT32_ARRAY_TYPE,
|
|
|
|
FIXED_UINT32_ARRAY_TYPE,
|
|
|
|
FIXED_FLOAT32_ARRAY_TYPE,
|
|
|
|
FIXED_FLOAT64_ARRAY_TYPE,
|
2018-02-17 07:44:01 +00:00
|
|
|
FIXED_UINT8_CLAMPED_ARRAY_TYPE,
|
|
|
|
FIXED_BIGINT64_ARRAY_TYPE,
|
|
|
|
FIXED_BIGUINT64_ARRAY_TYPE, // LAST_FIXED_TYPED_ARRAY_TYPE
|
2011-06-09 10:03:35 +00:00
|
|
|
FIXED_DOUBLE_ARRAY_TYPE,
|
2018-03-09 12:52:04 +00:00
|
|
|
FEEDBACK_METADATA_TYPE,
|
2009-12-22 13:34:02 +00:00
|
|
|
FILLER_TYPE, // LAST_DATA_TYPE
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2009-12-22 13:34:02 +00:00
|
|
|
// Structs.
|
2017-12-19 13:21:23 +00:00
|
|
|
ACCESS_CHECK_INFO_TYPE,
|
2016-01-18 15:08:36 +00:00
|
|
|
ACCESSOR_INFO_TYPE,
|
2012-01-10 16:11:33 +00:00
|
|
|
ACCESSOR_PAIR_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
ALIASED_ARGUMENTS_ENTRY_TYPE,
|
|
|
|
ALLOCATION_MEMENTO_TYPE,
|
|
|
|
ASYNC_GENERATOR_REQUEST_TYPE,
|
|
|
|
DEBUG_INFO_TYPE,
|
2008-07-03 15:10:15 +00:00
|
|
|
FUNCTION_TEMPLATE_INFO_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
INTERCEPTOR_INFO_TYPE,
|
2018-04-10 14:31:06 +00:00
|
|
|
INTERPRETER_DATA_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
MODULE_INFO_ENTRY_TYPE,
|
|
|
|
MODULE_TYPE,
|
2008-07-03 15:10:15 +00:00
|
|
|
OBJECT_TEMPLATE_INFO_TYPE,
|
2018-02-08 16:36:52 +00:00
|
|
|
PROMISE_CAPABILITY_TYPE,
|
|
|
|
PROMISE_REACTION_TYPE,
|
2015-04-07 10:42:45 +00:00
|
|
|
PROTOTYPE_INFO_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
SCRIPT_TYPE,
|
|
|
|
STACK_FRAME_INFO_TYPE,
|
2016-12-02 10:03:18 +00:00
|
|
|
TUPLE2_TYPE,
|
2016-10-13 16:18:53 +00:00
|
|
|
TUPLE3_TYPE,
|
2018-07-05 18:34:09 +00:00
|
|
|
ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
|
2018-03-01 18:48:50 +00:00
|
|
|
WASM_DEBUG_INFO_TYPE,
|
2018-05-07 15:40:56 +00:00
|
|
|
WASM_EXPORTED_FUNCTION_DATA_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
|
2018-02-08 16:36:52 +00:00
|
|
|
CALLABLE_TASK_TYPE, // FIRST_MICROTASK_TYPE
|
|
|
|
CALLBACK_TASK_TYPE,
|
|
|
|
PROMISE_FULFILL_REACTION_JOB_TASK_TYPE,
|
|
|
|
PROMISE_REJECT_REACTION_JOB_TASK_TYPE,
|
2018-10-29 11:53:52 +00:00
|
|
|
PROMISE_RESOLVE_THENABLE_JOB_TASK_TYPE,
|
|
|
|
WEAK_FACTORY_CLEANUP_JOB_TASK_TYPE, // LAST_MICROTASK_TYPE
|
2018-02-08 16:36:52 +00:00
|
|
|
|
2018-09-04 20:33:24 +00:00
|
|
|
MICROTASK_QUEUE_TYPE,
|
|
|
|
|
2018-06-12 14:15:04 +00:00
|
|
|
ALLOCATION_SITE_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
// FixedArrays.
|
2017-11-23 10:45:46 +00:00
|
|
|
FIXED_ARRAY_TYPE, // FIRST_FIXED_ARRAY_TYPE
|
2018-07-05 18:34:09 +00:00
|
|
|
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
|
2018-06-29 14:01:29 +00:00
|
|
|
HASH_TABLE_TYPE, // FIRST_HASH_TABLE_TYPE
|
|
|
|
ORDERED_HASH_MAP_TYPE, // FIRST_DICTIONARY_TYPE
|
|
|
|
ORDERED_HASH_SET_TYPE,
|
2018-11-12 10:31:52 +00:00
|
|
|
ORDERED_NAME_DICTIONARY_TYPE,
|
2018-06-29 14:01:29 +00:00
|
|
|
NAME_DICTIONARY_TYPE,
|
|
|
|
GLOBAL_DICTIONARY_TYPE,
|
|
|
|
NUMBER_DICTIONARY_TYPE,
|
|
|
|
SIMPLE_NUMBER_DICTIONARY_TYPE, // LAST_DICTIONARY_TYPE
|
|
|
|
STRING_TABLE_TYPE, // LAST_HASH_TABLE_TYPE
|
2018-06-07 18:47:29 +00:00
|
|
|
EPHEMERON_HASH_TABLE_TYPE,
|
2018-02-16 12:36:47 +00:00
|
|
|
SCOPE_INFO_TYPE,
|
2018-06-29 14:01:29 +00:00
|
|
|
SCRIPT_CONTEXT_TABLE_TYPE,
|
2018-09-27 20:11:42 +00:00
|
|
|
AWAIT_CONTEXT_TYPE, // FIRST_CONTEXT_TYPE
|
|
|
|
BLOCK_CONTEXT_TYPE,
|
2018-03-23 21:33:06 +00:00
|
|
|
CATCH_CONTEXT_TYPE,
|
|
|
|
DEBUG_EVALUATE_CONTEXT_TYPE,
|
|
|
|
EVAL_CONTEXT_TYPE,
|
|
|
|
FUNCTION_CONTEXT_TYPE,
|
|
|
|
MODULE_CONTEXT_TYPE,
|
|
|
|
NATIVE_CONTEXT_TYPE,
|
|
|
|
SCRIPT_CONTEXT_TYPE,
|
|
|
|
WITH_CONTEXT_TYPE, // LAST_FIXED_ARRAY_TYPE, LAST_CONTEXT_TYPE
|
2017-12-19 13:21:23 +00:00
|
|
|
|
2018-04-18 13:29:58 +00:00
|
|
|
WEAK_FIXED_ARRAY_TYPE, // FIRST_WEAK_FIXED_ARRAY_TYPE
|
2018-06-04 08:20:28 +00:00
|
|
|
DESCRIPTOR_ARRAY_TYPE,
|
2018-04-18 13:29:58 +00:00
|
|
|
TRANSITION_ARRAY_TYPE, // LAST_WEAK_FIXED_ARRAY_TYPE
|
|
|
|
|
2017-12-19 13:21:23 +00:00
|
|
|
// Misc.
|
2018-04-02 23:21:30 +00:00
|
|
|
CALL_HANDLER_INFO_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
CELL_TYPE,
|
|
|
|
CODE_DATA_CONTAINER_TYPE,
|
2018-02-22 12:04:01 +00:00
|
|
|
FEEDBACK_CELL_TYPE,
|
2017-07-27 12:45:00 +00:00
|
|
|
FEEDBACK_VECTOR_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
LOAD_HANDLER_TYPE,
|
2018-07-10 16:05:04 +00:00
|
|
|
PRE_PARSED_SCOPE_DATA_TYPE,
|
2017-07-25 07:59:54 +00:00
|
|
|
PROPERTY_ARRAY_TYPE,
|
2016-12-19 12:50:30 +00:00
|
|
|
PROPERTY_CELL_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
SHARED_FUNCTION_INFO_TYPE,
|
2017-06-19 23:19:16 +00:00
|
|
|
SMALL_ORDERED_HASH_MAP_TYPE,
|
2017-05-29 09:29:19 +00:00
|
|
|
SMALL_ORDERED_HASH_SET_TYPE,
|
2018-11-12 13:24:48 +00:00
|
|
|
SMALL_ORDERED_NAME_DICTIONARY_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
STORE_HANDLER_TYPE,
|
2018-07-09 09:34:34 +00:00
|
|
|
UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE,
|
|
|
|
UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE,
|
2018-04-16 07:28:28 +00:00
|
|
|
WEAK_ARRAY_LIST_TYPE,
|
2009-12-22 13:34:02 +00:00
|
|
|
|
2011-09-21 14:46:54 +00:00
|
|
|
// All the following types are subtypes of JSReceiver, which corresponds to
|
|
|
|
// objects in the JS sense. The first and the last type in this range are
|
|
|
|
// the two forms of function. This organization enables using the same
|
2015-11-30 09:49:19 +00:00
|
|
|
// compares for checking the JS_RECEIVER and the NONCALLABLE_JS_OBJECT range.
|
2017-12-19 13:21:23 +00:00
|
|
|
// Some of the following instance types are exposed in v8.h, so to not
|
|
|
|
// unnecessarily change the ABI when we introduce new instance types in the
|
|
|
|
// future, we leave some space between instance types.
|
2017-12-22 17:20:47 +00:00
|
|
|
JS_PROXY_TYPE = 0x0400, // FIRST_JS_RECEIVER_TYPE
|
2017-12-19 13:21:23 +00:00
|
|
|
JS_GLOBAL_OBJECT_TYPE, // FIRST_JS_OBJECT_TYPE
|
2016-03-04 11:51:55 +00:00
|
|
|
JS_GLOBAL_PROXY_TYPE,
|
2017-07-25 11:09:35 +00:00
|
|
|
JS_MODULE_NAMESPACE_TYPE,
|
2016-04-12 10:31:38 +00:00
|
|
|
// Like JS_API_OBJECT_TYPE, but requires access checks and/or has
|
|
|
|
// interceptors.
|
2017-12-22 17:20:47 +00:00
|
|
|
JS_SPECIAL_API_OBJECT_TYPE = 0x0410, // LAST_SPECIAL_RECEIVER_TYPE
|
2017-12-19 13:21:23 +00:00
|
|
|
JS_VALUE_TYPE, // LAST_CUSTOM_ELEMENTS_RECEIVER
|
2016-04-12 10:31:38 +00:00
|
|
|
// Like JS_OBJECT_TYPE, but created from API function.
|
2017-12-22 17:20:47 +00:00
|
|
|
JS_API_OBJECT_TYPE = 0x0420,
|
2008-07-03 15:10:15 +00:00
|
|
|
JS_OBJECT_TYPE,
|
2016-06-23 14:39:30 +00:00
|
|
|
JS_ARGUMENTS_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
JS_ARRAY_BUFFER_TYPE,
|
[es2015] Refactor the JSArrayIterator.
This changes the JSArrayIterator to always have only a single instance
type, instead of the zoo of instance types that we had before, and
which became less useful with the specification update to when "next"
is loaded from the iterator now. This greatly simplifies the baseline
implementation of the array iterator, which now only looks at the
iterated object during %ArrayIteratorPrototype%.next invocations.
In TurboFan we introduce a new JSCreateArrayIterator operator, that
holds the IterationKind and get's the iterated object as input. When
optimizing %ArrayIteratorPrototype%.next in the JSCallReducer, we
check whether the receiver is a JSCreateArrayIterator, and if so,
we try to infer maps for the iterated object from there. If we find
any, we speculatively assume that these won't have changed during
iteration (as we did before with the previous approach), and generate
fast code for both JSArray and JSTypedArray iteration.
Drive-by-fix: Drop the fast_array_iteration protector, it's not
necessary anymore since we have the deoptimization guard bit in
the JSCallReducer now.
This addresses the performance cliff noticed in webpack 4. The minimal
repro on the tracking bug goes from
console.timeEnd: mono, 124.773000
console.timeEnd: poly, 670.353000
to
console.timeEnd: mono, 118.709000
console.timeEnd: poly, 141.393000
so that's a 4.7x improvement.
Also make presubmit happy by adding the missing #undef's.
Bug: v8:7510, v7:7514
Change-Id: I79a46bfa2cd0f0710e09365ef72519b1bbb667b5
Reviewed-on: https://chromium-review.googlesource.com/946098
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51725}
2018-03-02 19:31:01 +00:00
|
|
|
JS_ARRAY_ITERATOR_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
JS_ARRAY_TYPE,
|
|
|
|
JS_ASYNC_FROM_SYNC_ITERATOR_TYPE,
|
2018-10-11 08:35:56 +00:00
|
|
|
JS_ASYNC_FUNCTION_OBJECT_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
JS_ASYNC_GENERATOR_OBJECT_TYPE,
|
2009-01-14 12:13:26 +00:00
|
|
|
JS_CONTEXT_EXTENSION_OBJECT_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
JS_DATE_TYPE,
|
|
|
|
JS_ERROR_TYPE,
|
2013-04-15 12:29:44 +00:00
|
|
|
JS_GENERATOR_OBJECT_TYPE,
|
2011-10-25 14:14:56 +00:00
|
|
|
JS_MAP_TYPE,
|
2017-07-10 06:46:56 +00:00
|
|
|
JS_MAP_KEY_ITERATOR_TYPE,
|
|
|
|
JS_MAP_KEY_VALUE_ITERATOR_TYPE,
|
|
|
|
JS_MAP_VALUE_ITERATOR_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
JS_MESSAGE_OBJECT_TYPE,
|
2015-11-19 16:11:00 +00:00
|
|
|
JS_PROMISE_TYPE,
|
2011-09-21 14:46:54 +00:00
|
|
|
JS_REGEXP_TYPE,
|
2018-04-05 14:41:26 +00:00
|
|
|
JS_REGEXP_STRING_ITERATOR_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
JS_SET_TYPE,
|
|
|
|
JS_SET_KEY_VALUE_ITERATOR_TYPE,
|
|
|
|
JS_SET_VALUE_ITERATOR_TYPE,
|
2016-09-21 14:17:42 +00:00
|
|
|
JS_STRING_ITERATOR_TYPE,
|
2018-11-05 14:21:02 +00:00
|
|
|
JS_WEAK_CELL_TYPE, // FIRST_JS_WEAK_CELL_TYPE
|
|
|
|
JS_WEAK_REF_TYPE, // LAST_JS_WEAK_CELL_TYPE
|
2018-10-09 12:08:23 +00:00
|
|
|
JS_WEAK_FACTORY_CLEANUP_ITERATOR_TYPE,
|
|
|
|
JS_WEAK_FACTORY_TYPE,
|
2017-12-19 13:21:23 +00:00
|
|
|
JS_WEAK_MAP_TYPE,
|
|
|
|
JS_WEAK_SET_TYPE,
|
|
|
|
|
|
|
|
JS_TYPED_ARRAY_TYPE,
|
|
|
|
JS_DATA_VIEW_TYPE,
|
2016-10-18 02:42:42 +00:00
|
|
|
|
2018-05-15 20:50:46 +00:00
|
|
|
#ifdef V8_INTL_SUPPORT
|
2018-09-05 02:17:38 +00:00
|
|
|
JS_INTL_V8_BREAK_ITERATOR_TYPE,
|
2018-08-08 09:23:07 +00:00
|
|
|
JS_INTL_COLLATOR_TYPE,
|
2018-08-29 04:40:53 +00:00
|
|
|
JS_INTL_DATE_TIME_FORMAT_TYPE,
|
2018-07-24 21:07:50 +00:00
|
|
|
JS_INTL_LIST_FORMAT_TYPE,
|
2018-05-15 20:50:46 +00:00
|
|
|
JS_INTL_LOCALE_TYPE,
|
2018-09-04 18:32:51 +00:00
|
|
|
JS_INTL_NUMBER_FORMAT_TYPE,
|
2018-08-06 09:31:26 +00:00
|
|
|
JS_INTL_PLURAL_RULES_TYPE,
|
2018-07-10 12:52:05 +00:00
|
|
|
JS_INTL_RELATIVE_TIME_FORMAT_TYPE,
|
2018-10-18 07:59:28 +00:00
|
|
|
JS_INTL_SEGMENT_ITERATOR_TYPE,
|
2018-10-05 01:57:05 +00:00
|
|
|
JS_INTL_SEGMENTER_TYPE,
|
2018-05-15 20:50:46 +00:00
|
|
|
#endif // V8_INTL_SUPPORT
|
|
|
|
|
2018-09-10 10:28:00 +00:00
|
|
|
WASM_EXCEPTION_TYPE,
|
2018-04-03 18:17:57 +00:00
|
|
|
WASM_GLOBAL_TYPE,
|
[es2015] Refactor the JSArrayIterator.
This changes the JSArrayIterator to always have only a single instance
type, instead of the zoo of instance types that we had before, and
which became less useful with the specification update to when "next"
is loaded from the iterator now. This greatly simplifies the baseline
implementation of the array iterator, which now only looks at the
iterated object during %ArrayIteratorPrototype%.next invocations.
In TurboFan we introduce a new JSCreateArrayIterator operator, that
holds the IterationKind and get's the iterated object as input. When
optimizing %ArrayIteratorPrototype%.next in the JSCallReducer, we
check whether the receiver is a JSCreateArrayIterator, and if so,
we try to infer maps for the iterated object from there. If we find
any, we speculatively assume that these won't have changed during
iteration (as we did before with the previous approach), and generate
fast code for both JSArray and JSTypedArray iteration.
Drive-by-fix: Drop the fast_array_iteration protector, it's not
necessary anymore since we have the deoptimization guard bit in
the JSCallReducer now.
This addresses the performance cliff noticed in webpack 4. The minimal
repro on the tracking bug goes from
console.timeEnd: mono, 124.773000
console.timeEnd: poly, 670.353000
to
console.timeEnd: mono, 118.709000
console.timeEnd: poly, 141.393000
so that's a 4.7x improvement.
Also make presubmit happy by adding the missing #undef's.
Bug: v8:7510, v7:7514
Change-Id: I79a46bfa2cd0f0710e09365ef72519b1bbb667b5
Reviewed-on: https://chromium-review.googlesource.com/946098
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51725}
2018-03-02 19:31:01 +00:00
|
|
|
WASM_INSTANCE_TYPE,
|
2017-07-07 12:27:56 +00:00
|
|
|
WASM_MEMORY_TYPE,
|
|
|
|
WASM_MODULE_TYPE,
|
|
|
|
WASM_TABLE_TYPE,
|
2015-12-27 06:30:53 +00:00
|
|
|
JS_BOUND_FUNCTION_TYPE,
|
2011-09-21 14:46:54 +00:00
|
|
|
JS_FUNCTION_TYPE, // LAST_JS_OBJECT_TYPE, LAST_JS_RECEIVER_TYPE
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Pseudo-types
|
|
|
|
FIRST_TYPE = 0x0,
|
2011-09-21 14:46:54 +00:00
|
|
|
LAST_TYPE = JS_FUNCTION_TYPE,
|
2013-03-01 13:28:55 +00:00
|
|
|
FIRST_NAME_TYPE = FIRST_TYPE,
|
2013-03-01 10:34:31 +00:00
|
|
|
LAST_NAME_TYPE = SYMBOL_TYPE,
|
2013-03-01 13:28:55 +00:00
|
|
|
FIRST_UNIQUE_NAME_TYPE = INTERNALIZED_STRING_TYPE,
|
|
|
|
LAST_UNIQUE_NAME_TYPE = SYMBOL_TYPE,
|
2013-03-01 10:34:31 +00:00
|
|
|
FIRST_NONSTRING_TYPE = SYMBOL_TYPE,
|
2015-08-11 19:36:04 +00:00
|
|
|
FIRST_PRIMITIVE_TYPE = FIRST_NAME_TYPE,
|
|
|
|
LAST_PRIMITIVE_TYPE = ODDBALL_TYPE,
|
2015-12-27 06:30:53 +00:00
|
|
|
FIRST_FUNCTION_TYPE = JS_BOUND_FUNCTION_TYPE,
|
|
|
|
LAST_FUNCTION_TYPE = JS_FUNCTION_TYPE,
|
2017-11-23 10:45:46 +00:00
|
|
|
// Boundaries for testing if given HeapObject is a subclass of FixedArray.
|
|
|
|
FIRST_FIXED_ARRAY_TYPE = FIXED_ARRAY_TYPE,
|
2018-03-23 21:33:06 +00:00
|
|
|
LAST_FIXED_ARRAY_TYPE = WITH_CONTEXT_TYPE,
|
2018-06-29 14:01:29 +00:00
|
|
|
// Boundaries for testing if given HeapObject is a subclass of HashTable
|
|
|
|
FIRST_HASH_TABLE_TYPE = HASH_TABLE_TYPE,
|
|
|
|
LAST_HASH_TABLE_TYPE = STRING_TABLE_TYPE,
|
|
|
|
// Boundaries for testing if given HeapObject is a subclass of Dictionary
|
|
|
|
FIRST_DICTIONARY_TYPE = ORDERED_HASH_MAP_TYPE,
|
|
|
|
LAST_DICTIONARY_TYPE = SIMPLE_NUMBER_DICTIONARY_TYPE,
|
2018-04-18 13:29:58 +00:00
|
|
|
// Boundaries for testing if given HeapObject is a subclass of WeakFixedArray.
|
|
|
|
FIRST_WEAK_FIXED_ARRAY_TYPE = WEAK_FIXED_ARRAY_TYPE,
|
|
|
|
LAST_WEAK_FIXED_ARRAY_TYPE = TRANSITION_ARRAY_TYPE,
|
2018-03-23 21:33:06 +00:00
|
|
|
// Boundaries for testing if given HeapObject is a Context
|
2018-09-27 20:11:42 +00:00
|
|
|
FIRST_CONTEXT_TYPE = AWAIT_CONTEXT_TYPE,
|
2018-03-23 21:33:06 +00:00
|
|
|
LAST_CONTEXT_TYPE = WITH_CONTEXT_TYPE,
|
2018-02-08 16:36:52 +00:00
|
|
|
// Boundaries for testing if given HeapObject is a subclass of Microtask.
|
|
|
|
FIRST_MICROTASK_TYPE = CALLABLE_TASK_TYPE,
|
2018-10-29 11:53:52 +00:00
|
|
|
LAST_MICROTASK_TYPE = WEAK_FACTORY_CLEANUP_JOB_TASK_TYPE,
|
2014-01-16 17:08:45 +00:00
|
|
|
// Boundaries for testing for a fixed typed array.
|
|
|
|
FIRST_FIXED_TYPED_ARRAY_TYPE = FIXED_INT8_ARRAY_TYPE,
|
2018-02-17 07:44:01 +00:00
|
|
|
LAST_FIXED_TYPED_ARRAY_TYPE = FIXED_BIGUINT64_ARRAY_TYPE,
|
2015-04-07 11:31:57 +00:00
|
|
|
// Boundary for promotion to old space.
|
2009-12-22 13:34:02 +00:00
|
|
|
LAST_DATA_TYPE = FILLER_TYPE,
|
Implement set trap for proxies, and revamp class hierarchy in preparation:
- Introduce a class JSReceiver, that is a common superclass of JSObject and
JSProxy. Use JSReceiver where appropriate (probably lots of places that we
still have to migrate, but we will find those later with proxy test suite).
- Move appropriate methods to JSReceiver class (SetProperty,
GetPropertyAttribute, Get/SetPrototype, Lookup, and so on).
- Introduce new JSFunctionProxy subclass of JSProxy. Currently only a stub.
- Overhaul enum InstanceType:
* Introduce FIRST/LAST_SPEC_OBJECT_TYPE that ranges over all types that
represent JS objects, and use that consistently to check language types.
* Rename FIRST/LAST_JS_OBJECT_TYPE and FIRST/LAST_FUNCTION_CLASS_TYPE
to FIRST/LAST_[NON]CALLABLE_SPEC_OBJECT_TYPE for clarity.
* Eliminate the overlap over JS_REGEXP_TYPE.
* Also replace FIRST_JS_OBJECT with FIRST_JS_RECEIVER, but only use it where
we exclusively talk about the internal representation type.
* Insert JS_PROXY and JS_FUNCTION_PROXY in the appropriate places.
- Fix all checks concerning classification, especially for functions, to
use the CALLABLE_SPEC_OBJECT range (that includes funciton proxies).
- Handle proxies in SetProperty (that was the easiest part :) ).
- A few simple test cases.
R=kmillikin@chromium.org
Review URL: http://codereview.chromium.org/6992072
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8126 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-31 16:38:40 +00:00
|
|
|
// Boundary for objects represented as JSReceiver (i.e. JSObject or JSProxy).
|
|
|
|
// Note that there is no range for JSObject or JSProxy, since their subtypes
|
|
|
|
// are not continuous in this enum! The enum ranges instead reflect the
|
|
|
|
// external class names, where proxies are treated as either ordinary objects,
|
|
|
|
// or functions.
|
2015-12-04 13:49:08 +00:00
|
|
|
FIRST_JS_RECEIVER_TYPE = JS_PROXY_TYPE,
|
Implement set trap for proxies, and revamp class hierarchy in preparation:
- Introduce a class JSReceiver, that is a common superclass of JSObject and
JSProxy. Use JSReceiver where appropriate (probably lots of places that we
still have to migrate, but we will find those later with proxy test suite).
- Move appropriate methods to JSReceiver class (SetProperty,
GetPropertyAttribute, Get/SetPrototype, Lookup, and so on).
- Introduce new JSFunctionProxy subclass of JSProxy. Currently only a stub.
- Overhaul enum InstanceType:
* Introduce FIRST/LAST_SPEC_OBJECT_TYPE that ranges over all types that
represent JS objects, and use that consistently to check language types.
* Rename FIRST/LAST_JS_OBJECT_TYPE and FIRST/LAST_FUNCTION_CLASS_TYPE
to FIRST/LAST_[NON]CALLABLE_SPEC_OBJECT_TYPE for clarity.
* Eliminate the overlap over JS_REGEXP_TYPE.
* Also replace FIRST_JS_OBJECT with FIRST_JS_RECEIVER, but only use it where
we exclusively talk about the internal representation type.
* Insert JS_PROXY and JS_FUNCTION_PROXY in the appropriate places.
- Fix all checks concerning classification, especially for functions, to
use the CALLABLE_SPEC_OBJECT range (that includes funciton proxies).
- Handle proxies in SetProperty (that was the easiest part :) ).
- A few simple test cases.
R=kmillikin@chromium.org
Review URL: http://codereview.chromium.org/6992072
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8126 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2011-05-31 16:38:40 +00:00
|
|
|
LAST_JS_RECEIVER_TYPE = LAST_TYPE,
|
2011-09-21 14:46:54 +00:00
|
|
|
// Boundaries for testing the types represented as JSObject
|
2016-03-04 11:51:55 +00:00
|
|
|
FIRST_JS_OBJECT_TYPE = JS_GLOBAL_OBJECT_TYPE,
|
2011-09-21 14:46:54 +00:00
|
|
|
LAST_JS_OBJECT_TYPE = LAST_TYPE,
|
2016-03-04 11:51:55 +00:00
|
|
|
// Boundary for testing JSReceivers that need special property lookup handling
|
|
|
|
LAST_SPECIAL_RECEIVER_TYPE = JS_SPECIAL_API_OBJECT_TYPE,
|
2016-03-21 14:14:39 +00:00
|
|
|
// Boundary case for testing JSReceivers that may have elements while having
|
|
|
|
// an empty fixed array as elements backing store. This is true for string
|
|
|
|
// wrappers.
|
|
|
|
LAST_CUSTOM_ELEMENTS_RECEIVER = JS_VALUE_TYPE,
|
2016-10-18 02:42:42 +00:00
|
|
|
|
2017-07-14 05:35:21 +00:00
|
|
|
FIRST_SET_ITERATOR_TYPE = JS_SET_KEY_VALUE_ITERATOR_TYPE,
|
|
|
|
LAST_SET_ITERATOR_TYPE = JS_SET_VALUE_ITERATOR_TYPE,
|
|
|
|
|
|
|
|
FIRST_MAP_ITERATOR_TYPE = JS_MAP_KEY_ITERATOR_TYPE,
|
|
|
|
LAST_MAP_ITERATOR_TYPE = JS_MAP_VALUE_ITERATOR_TYPE,
|
2018-11-05 14:21:02 +00:00
|
|
|
|
|
|
|
FIRST_JS_WEAK_CELL_TYPE = JS_WEAK_CELL_TYPE,
|
|
|
|
LAST_JS_WEAK_CELL_TYPE = JS_WEAK_REF_TYPE,
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2017-11-22 18:04:36 +00:00
|
|
|
STATIC_ASSERT((FIRST_NONSTRING_TYPE & kIsNotStringMask) != kStringTag);
|
2014-05-27 13:43:29 +00:00
|
|
|
STATIC_ASSERT(JS_OBJECT_TYPE == Internals::kJSObjectType);
|
2016-04-12 10:31:38 +00:00
|
|
|
STATIC_ASSERT(JS_API_OBJECT_TYPE == Internals::kJSApiObjectType);
|
2017-10-18 18:57:27 +00:00
|
|
|
STATIC_ASSERT(JS_SPECIAL_API_OBJECT_TYPE == Internals::kJSSpecialApiObjectType);
|
2014-05-27 13:43:29 +00:00
|
|
|
STATIC_ASSERT(FIRST_NONSTRING_TYPE == Internals::kFirstNonstringType);
|
|
|
|
STATIC_ASSERT(ODDBALL_TYPE == Internals::kOddballType);
|
|
|
|
STATIC_ASSERT(FOREIGN_TYPE == Internals::kForeignType);
|
2010-06-18 10:52:59 +00:00
|
|
|
|
2016-10-14 08:55:40 +00:00
|
|
|
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
|
|
|
|
InstanceType instance_type);
|
2015-12-03 10:02:46 +00:00
|
|
|
|
2015-09-18 06:35:36 +00:00
|
|
|
// Result of an abstract relational comparison of x and y, implemented according
|
|
|
|
// to ES6 section 7.2.11 Abstract Relational Comparison.
|
|
|
|
enum class ComparisonResult {
|
|
|
|
kLessThan, // x < y
|
|
|
|
kEqual, // x = y
|
2015-09-28 18:05:56 +00:00
|
|
|
kGreaterThan, // x > y
|
2015-09-18 06:35:36 +00:00
|
|
|
kUndefined // at least one of x or y was undefined or NaN
|
|
|
|
};
|
|
|
|
|
2017-10-24 09:39:35 +00:00
|
|
|
// (Returns false whenever {result} is kUndefined.)
|
2017-10-25 17:43:04 +00:00
|
|
|
bool ComparisonResultToBool(Operation op, ComparisonResult result);
|
2017-10-24 09:39:35 +00:00
|
|
|
|
2018-07-05 09:06:51 +00:00
|
|
|
enum class OnNonExistent { kThrowReferenceError, kReturnUndefined };
|
|
|
|
|
2016-08-24 08:48:34 +00:00
|
|
|
class AbstractCode;
|
2012-05-24 10:40:24 +00:00
|
|
|
class AccessorPair;
|
2018-04-30 13:27:37 +00:00
|
|
|
class AccessCheckInfo;
|
2013-10-16 08:10:36 +00:00
|
|
|
class AllocationSite;
|
2017-12-01 11:33:03 +00:00
|
|
|
class ByteArray;
|
2015-06-25 12:19:55 +00:00
|
|
|
class Cell;
|
2014-11-26 11:53:27 +00:00
|
|
|
class ConsString;
|
2017-10-13 13:24:26 +00:00
|
|
|
class DependentCode;
|
2011-08-03 11:12:46 +00:00
|
|
|
class ElementsAccessor;
|
2017-08-30 04:21:29 +00:00
|
|
|
class EnumCache;
|
2011-08-12 13:54:27 +00:00
|
|
|
class FixedArrayBase;
|
2018-11-03 00:13:22 +00:00
|
|
|
class FixedDoubleArray;
|
2015-02-12 13:21:06 +00:00
|
|
|
class FunctionLiteral;
|
2018-04-27 08:31:07 +00:00
|
|
|
class FunctionTemplateInfo;
|
2018-11-07 03:24:08 +00:00
|
|
|
class JSAsyncGeneratorObject;
|
2018-11-03 00:13:22 +00:00
|
|
|
class JSGlobalProxy;
|
|
|
|
class JSPromise;
|
|
|
|
class JSProxy;
|
2015-10-19 13:47:24 +00:00
|
|
|
class KeyAccumulator;
|
2014-11-11 10:24:52 +00:00
|
|
|
class LayoutDescriptor;
|
2014-11-10 17:43:51 +00:00
|
|
|
class LookupIterator;
|
2016-01-26 15:03:40 +00:00
|
|
|
class FieldType;
|
2018-10-23 23:02:20 +00:00
|
|
|
class MaybeObjectSlot;
|
2018-09-04 20:33:24 +00:00
|
|
|
class MicrotaskQueue;
|
2016-10-07 19:37:04 +00:00
|
|
|
class Module;
|
2016-09-12 12:54:47 +00:00
|
|
|
class ModuleInfoEntry;
|
2015-06-25 12:19:55 +00:00
|
|
|
class ObjectHashTable;
|
2018-04-27 08:31:07 +00:00
|
|
|
class ObjectTemplateInfo;
|
2014-11-11 10:24:52 +00:00
|
|
|
class ObjectVisitor;
|
2018-07-10 16:05:04 +00:00
|
|
|
class PreParsedScopeData;
|
2018-11-03 00:13:22 +00:00
|
|
|
class PropertyArray;
|
2015-06-25 12:19:55 +00:00
|
|
|
class PropertyCell;
|
2015-10-13 14:38:16 +00:00
|
|
|
class PropertyDescriptor;
|
2018-11-03 00:13:22 +00:00
|
|
|
class RegExpMatchInfo;
|
2017-04-25 13:32:18 +00:00
|
|
|
class RootVisitor;
|
2015-06-25 12:19:55 +00:00
|
|
|
class SafepointEntry;
|
2018-11-03 00:13:22 +00:00
|
|
|
class ScriptContextTable;
|
2015-06-25 12:19:55 +00:00
|
|
|
class SharedFunctionInfo;
|
2011-08-12 13:54:27 +00:00
|
|
|
class StringStream;
|
2018-11-03 00:13:22 +00:00
|
|
|
class Symbol;
|
2018-02-22 12:04:01 +00:00
|
|
|
class FeedbackCell;
|
2017-02-07 14:05:02 +00:00
|
|
|
class FeedbackMetadata;
|
|
|
|
class FeedbackVector;
|
2018-07-09 09:34:34 +00:00
|
|
|
class UncompiledData;
|
2018-04-27 08:31:07 +00:00
|
|
|
class TemplateInfo;
|
2015-12-03 13:18:19 +00:00
|
|
|
class TransitionArray;
|
2016-08-01 14:28:06 +00:00
|
|
|
class TemplateList;
|
2018-11-03 00:13:22 +00:00
|
|
|
class WasmInstanceObject;
|
|
|
|
class WasmMemoryObject;
|
2017-06-28 12:56:11 +00:00
|
|
|
template <typename T>
|
|
|
|
class ZoneForwardList;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2012-12-13 10:17:37 +00:00
|
|
|
#ifdef OBJECT_PRINT
|
2017-06-29 13:14:20 +00:00
|
|
|
#define DECL_PRINTER(Name) void Name##Print(std::ostream& os); // NOLINT
|
2012-12-13 10:17:37 +00:00
|
|
|
#else
|
2017-06-29 13:14:20 +00:00
|
|
|
#define DECL_PRINTER(Name)
|
2012-12-13 10:17:37 +00:00
|
|
|
#endif
|
|
|
|
|
2014-09-10 12:38:12 +00:00
|
|
|
#define OBJECT_TYPE_LIST(V) \
|
|
|
|
V(Smi) \
|
2016-02-16 12:57:29 +00:00
|
|
|
V(LayoutDescriptor) \
|
2014-09-10 12:38:12 +00:00
|
|
|
V(HeapObject) \
|
2016-02-16 12:57:29 +00:00
|
|
|
V(Primitive) \
|
2017-10-23 10:49:42 +00:00
|
|
|
V(Number) \
|
|
|
|
V(Numeric)
|
2014-09-10 12:38:12 +00:00
|
|
|
|
2018-05-15 20:50:46 +00:00
|
|
|
#define HEAP_OBJECT_ORDINARY_TYPE_LIST_BASE(V) \
|
|
|
|
V(AbstractCode) \
|
|
|
|
V(AccessCheckNeeded) \
|
2018-06-12 14:15:04 +00:00
|
|
|
V(AllocationSite) \
|
2018-05-15 20:50:46 +00:00
|
|
|
V(ArrayList) \
|
|
|
|
V(BigInt) \
|
|
|
|
V(BigIntWrapper) \
|
2018-07-05 18:34:09 +00:00
|
|
|
V(ObjectBoilerplateDescription) \
|
2018-05-15 20:50:46 +00:00
|
|
|
V(Boolean) \
|
|
|
|
V(BooleanWrapper) \
|
|
|
|
V(BreakPoint) \
|
|
|
|
V(BreakPointInfo) \
|
|
|
|
V(ByteArray) \
|
|
|
|
V(BytecodeArray) \
|
|
|
|
V(CallHandlerInfo) \
|
|
|
|
V(Callable) \
|
|
|
|
V(Cell) \
|
|
|
|
V(ClassBoilerplate) \
|
|
|
|
V(Code) \
|
|
|
|
V(CodeDataContainer) \
|
|
|
|
V(CompilationCacheTable) \
|
|
|
|
V(ConsString) \
|
|
|
|
V(Constructor) \
|
|
|
|
V(Context) \
|
|
|
|
V(CoverageInfo) \
|
|
|
|
V(DataHandler) \
|
|
|
|
V(DeoptimizationData) \
|
|
|
|
V(DependentCode) \
|
|
|
|
V(DescriptorArray) \
|
2018-06-07 05:57:16 +00:00
|
|
|
V(EphemeronHashTable) \
|
2018-05-15 20:50:46 +00:00
|
|
|
V(EnumCache) \
|
|
|
|
V(ExternalOneByteString) \
|
|
|
|
V(ExternalString) \
|
|
|
|
V(ExternalTwoByteString) \
|
|
|
|
V(FeedbackCell) \
|
|
|
|
V(FeedbackMetadata) \
|
|
|
|
V(FeedbackVector) \
|
|
|
|
V(Filler) \
|
|
|
|
V(FixedArray) \
|
|
|
|
V(FixedArrayBase) \
|
|
|
|
V(FixedArrayExact) \
|
|
|
|
V(FixedBigInt64Array) \
|
|
|
|
V(FixedBigUint64Array) \
|
|
|
|
V(FixedDoubleArray) \
|
|
|
|
V(FixedFloat32Array) \
|
|
|
|
V(FixedFloat64Array) \
|
|
|
|
V(FixedInt16Array) \
|
|
|
|
V(FixedInt32Array) \
|
|
|
|
V(FixedInt8Array) \
|
|
|
|
V(FixedTypedArrayBase) \
|
|
|
|
V(FixedUint16Array) \
|
|
|
|
V(FixedUint32Array) \
|
|
|
|
V(FixedUint8Array) \
|
|
|
|
V(FixedUint8ClampedArray) \
|
|
|
|
V(Foreign) \
|
|
|
|
V(FrameArray) \
|
|
|
|
V(FreeSpace) \
|
|
|
|
V(Function) \
|
|
|
|
V(GlobalDictionary) \
|
|
|
|
V(HandlerTable) \
|
|
|
|
V(HeapNumber) \
|
|
|
|
V(InternalizedString) \
|
|
|
|
V(JSArgumentsObject) \
|
|
|
|
V(JSArray) \
|
|
|
|
V(JSArrayBuffer) \
|
|
|
|
V(JSArrayBufferView) \
|
|
|
|
V(JSArrayIterator) \
|
|
|
|
V(JSAsyncFromSyncIterator) \
|
2018-10-11 08:35:56 +00:00
|
|
|
V(JSAsyncFunctionObject) \
|
2018-05-15 20:50:46 +00:00
|
|
|
V(JSAsyncGeneratorObject) \
|
|
|
|
V(JSBoundFunction) \
|
|
|
|
V(JSCollection) \
|
|
|
|
V(JSContextExtensionObject) \
|
|
|
|
V(JSDataView) \
|
|
|
|
V(JSDate) \
|
|
|
|
V(JSError) \
|
|
|
|
V(JSFunction) \
|
|
|
|
V(JSGeneratorObject) \
|
|
|
|
V(JSGlobalObject) \
|
|
|
|
V(JSGlobalProxy) \
|
|
|
|
V(JSMap) \
|
|
|
|
V(JSMapIterator) \
|
|
|
|
V(JSMessageObject) \
|
|
|
|
V(JSModuleNamespace) \
|
|
|
|
V(JSObject) \
|
|
|
|
V(JSPromise) \
|
|
|
|
V(JSProxy) \
|
|
|
|
V(JSReceiver) \
|
|
|
|
V(JSRegExp) \
|
2018-08-13 13:12:03 +00:00
|
|
|
V(JSRegExpResult) \
|
2018-05-15 20:50:46 +00:00
|
|
|
V(JSRegExpStringIterator) \
|
|
|
|
V(JSSet) \
|
|
|
|
V(JSSetIterator) \
|
|
|
|
V(JSSloppyArgumentsObject) \
|
|
|
|
V(JSStringIterator) \
|
|
|
|
V(JSTypedArray) \
|
|
|
|
V(JSValue) \
|
2018-10-09 12:08:23 +00:00
|
|
|
V(JSWeakCell) \
|
2018-11-05 14:21:02 +00:00
|
|
|
V(JSWeakRef) \
|
2018-05-15 20:50:46 +00:00
|
|
|
V(JSWeakCollection) \
|
2018-10-09 12:08:23 +00:00
|
|
|
V(JSWeakFactory) \
|
|
|
|
V(JSWeakFactoryCleanupIterator) \
|
2018-05-15 20:50:46 +00:00
|
|
|
V(JSWeakMap) \
|
|
|
|
V(JSWeakSet) \
|
|
|
|
V(LoadHandler) \
|
|
|
|
V(Map) \
|
|
|
|
V(MapCache) \
|
|
|
|
V(Microtask) \
|
|
|
|
V(ModuleInfo) \
|
|
|
|
V(MutableHeapNumber) \
|
|
|
|
V(Name) \
|
|
|
|
V(NameDictionary) \
|
|
|
|
V(NativeContext) \
|
|
|
|
V(NormalizedMapCache) \
|
|
|
|
V(NumberDictionary) \
|
|
|
|
V(NumberWrapper) \
|
|
|
|
V(ObjectHashSet) \
|
|
|
|
V(ObjectHashTable) \
|
|
|
|
V(Oddball) \
|
|
|
|
V(OrderedHashMap) \
|
|
|
|
V(OrderedHashSet) \
|
2018-11-12 10:31:52 +00:00
|
|
|
V(OrderedNameDictionary) \
|
2018-05-15 20:50:46 +00:00
|
|
|
V(PreParsedScopeData) \
|
|
|
|
V(PromiseReactionJobTask) \
|
|
|
|
V(PropertyArray) \
|
|
|
|
V(PropertyCell) \
|
|
|
|
V(PropertyDescriptorObject) \
|
|
|
|
V(RegExpMatchInfo) \
|
|
|
|
V(ScopeInfo) \
|
|
|
|
V(ScriptContextTable) \
|
|
|
|
V(ScriptWrapper) \
|
|
|
|
V(SeqOneByteString) \
|
|
|
|
V(SeqString) \
|
|
|
|
V(SeqTwoByteString) \
|
|
|
|
V(SharedFunctionInfo) \
|
|
|
|
V(SimpleNumberDictionary) \
|
|
|
|
V(SlicedString) \
|
|
|
|
V(SloppyArgumentsElements) \
|
|
|
|
V(SmallOrderedHashMap) \
|
|
|
|
V(SmallOrderedHashSet) \
|
2018-11-12 13:24:48 +00:00
|
|
|
V(SmallOrderedNameDictionary) \
|
2018-05-15 20:50:46 +00:00
|
|
|
V(SourcePositionTableWithFrameCache) \
|
|
|
|
V(StoreHandler) \
|
|
|
|
V(String) \
|
|
|
|
V(StringSet) \
|
|
|
|
V(StringTable) \
|
|
|
|
V(StringWrapper) \
|
|
|
|
V(Struct) \
|
|
|
|
V(Symbol) \
|
|
|
|
V(SymbolWrapper) \
|
|
|
|
V(TemplateInfo) \
|
|
|
|
V(TemplateList) \
|
|
|
|
V(TemplateObjectDescription) \
|
|
|
|
V(ThinString) \
|
|
|
|
V(TransitionArray) \
|
2018-07-09 09:34:34 +00:00
|
|
|
V(UncompiledData) \
|
|
|
|
V(UncompiledDataWithPreParsedScope) \
|
|
|
|
V(UncompiledDataWithoutPreParsedScope) \
|
2018-05-15 20:50:46 +00:00
|
|
|
V(Undetectable) \
|
|
|
|
V(UniqueName) \
|
2018-09-10 10:28:00 +00:00
|
|
|
V(WasmExceptionObject) \
|
2018-05-15 20:50:46 +00:00
|
|
|
V(WasmGlobalObject) \
|
|
|
|
V(WasmInstanceObject) \
|
|
|
|
V(WasmMemoryObject) \
|
|
|
|
V(WasmModuleObject) \
|
|
|
|
V(WasmTableObject) \
|
|
|
|
V(WeakFixedArray) \
|
2018-04-16 07:28:28 +00:00
|
|
|
V(WeakArrayList)
|
2013-08-02 09:53:11 +00:00
|
|
|
|
2018-05-15 20:50:46 +00:00
|
|
|
#ifdef V8_INTL_SUPPORT
|
|
|
|
#define HEAP_OBJECT_ORDINARY_TYPE_LIST(V) \
|
|
|
|
HEAP_OBJECT_ORDINARY_TYPE_LIST_BASE(V) \
|
2018-09-05 02:17:38 +00:00
|
|
|
V(JSV8BreakIterator) \
|
2018-08-08 09:23:07 +00:00
|
|
|
V(JSCollator) \
|
2018-08-29 04:40:53 +00:00
|
|
|
V(JSDateTimeFormat) \
|
2018-07-24 21:07:50 +00:00
|
|
|
V(JSListFormat) \
|
2018-07-10 12:52:05 +00:00
|
|
|
V(JSLocale) \
|
2018-09-04 18:32:51 +00:00
|
|
|
V(JSNumberFormat) \
|
2018-08-06 09:31:26 +00:00
|
|
|
V(JSPluralRules) \
|
2018-10-05 01:57:05 +00:00
|
|
|
V(JSRelativeTimeFormat) \
|
2018-10-18 07:59:28 +00:00
|
|
|
V(JSSegmentIterator) \
|
2018-10-05 01:57:05 +00:00
|
|
|
V(JSSegmenter)
|
2018-05-15 20:50:46 +00:00
|
|
|
#else
|
|
|
|
#define HEAP_OBJECT_ORDINARY_TYPE_LIST(V) HEAP_OBJECT_ORDINARY_TYPE_LIST_BASE(V)
|
|
|
|
#endif // V8_INTL_SUPPORT
|
|
|
|
|
2017-08-03 14:27:11 +00:00
|
|
|
#define HEAP_OBJECT_TEMPLATE_TYPE_LIST(V) \
|
|
|
|
V(Dictionary) \
|
2017-11-19 10:06:32 +00:00
|
|
|
V(HashTable)
|
2017-08-03 14:27:11 +00:00
|
|
|
|
|
|
|
#define HEAP_OBJECT_TYPE_LIST(V) \
|
|
|
|
HEAP_OBJECT_ORDINARY_TYPE_LIST(V) \
|
|
|
|
HEAP_OBJECT_TEMPLATE_TYPE_LIST(V)
|
|
|
|
|
2016-06-14 10:08:44 +00:00
|
|
|
#define ODDBALL_LIST(V) \
|
|
|
|
V(Undefined, undefined_value) \
|
|
|
|
V(Null, null_value) \
|
|
|
|
V(TheHole, the_hole_value) \
|
|
|
|
V(Exception, exception) \
|
|
|
|
V(Uninitialized, uninitialized_value) \
|
|
|
|
V(True, true_value) \
|
|
|
|
V(False, false_value) \
|
|
|
|
V(ArgumentsMarker, arguments_marker) \
|
|
|
|
V(OptimizedOut, optimized_out) \
|
|
|
|
V(StaleRegister, stale_register)
|
2016-02-16 12:57:29 +00:00
|
|
|
|
2018-07-30 09:52:51 +00:00
|
|
|
// List of object types that have a single unique instance type.
|
2018-10-09 12:08:23 +00:00
|
|
|
#define INSTANCE_TYPE_CHECKERS_SINGLE_BASE(V) \
|
|
|
|
V(AllocationSite, ALLOCATION_SITE_TYPE) \
|
|
|
|
V(BigInt, BIGINT_TYPE) \
|
|
|
|
V(ObjectBoilerplateDescription, OBJECT_BOILERPLATE_DESCRIPTION_TYPE) \
|
|
|
|
V(BreakPoint, TUPLE2_TYPE) \
|
|
|
|
V(BreakPointInfo, TUPLE2_TYPE) \
|
|
|
|
V(ByteArray, BYTE_ARRAY_TYPE) \
|
|
|
|
V(BytecodeArray, BYTECODE_ARRAY_TYPE) \
|
|
|
|
V(CallHandlerInfo, CALL_HANDLER_INFO_TYPE) \
|
|
|
|
V(Cell, CELL_TYPE) \
|
|
|
|
V(Code, CODE_TYPE) \
|
|
|
|
V(CodeDataContainer, CODE_DATA_CONTAINER_TYPE) \
|
|
|
|
V(CoverageInfo, FIXED_ARRAY_TYPE) \
|
|
|
|
V(DescriptorArray, DESCRIPTOR_ARRAY_TYPE) \
|
|
|
|
V(EphemeronHashTable, EPHEMERON_HASH_TABLE_TYPE) \
|
|
|
|
V(FeedbackCell, FEEDBACK_CELL_TYPE) \
|
|
|
|
V(FeedbackMetadata, FEEDBACK_METADATA_TYPE) \
|
|
|
|
V(FeedbackVector, FEEDBACK_VECTOR_TYPE) \
|
|
|
|
V(FixedArrayExact, FIXED_ARRAY_TYPE) \
|
|
|
|
V(FixedDoubleArray, FIXED_DOUBLE_ARRAY_TYPE) \
|
|
|
|
V(Foreign, FOREIGN_TYPE) \
|
|
|
|
V(FreeSpace, FREE_SPACE_TYPE) \
|
|
|
|
V(GlobalDictionary, GLOBAL_DICTIONARY_TYPE) \
|
|
|
|
V(HeapNumber, HEAP_NUMBER_TYPE) \
|
|
|
|
V(JSArgumentsObject, JS_ARGUMENTS_TYPE) \
|
|
|
|
V(JSArray, JS_ARRAY_TYPE) \
|
|
|
|
V(JSArrayBuffer, JS_ARRAY_BUFFER_TYPE) \
|
|
|
|
V(JSArrayIterator, JS_ARRAY_ITERATOR_TYPE) \
|
|
|
|
V(JSAsyncFromSyncIterator, JS_ASYNC_FROM_SYNC_ITERATOR_TYPE) \
|
2018-10-11 08:35:56 +00:00
|
|
|
V(JSAsyncFunctionObject, JS_ASYNC_FUNCTION_OBJECT_TYPE) \
|
2018-10-09 12:08:23 +00:00
|
|
|
V(JSAsyncGeneratorObject, JS_ASYNC_GENERATOR_OBJECT_TYPE) \
|
|
|
|
V(JSBoundFunction, JS_BOUND_FUNCTION_TYPE) \
|
|
|
|
V(JSContextExtensionObject, JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
|
|
|
|
V(JSDataView, JS_DATA_VIEW_TYPE) \
|
|
|
|
V(JSDate, JS_DATE_TYPE) \
|
|
|
|
V(JSError, JS_ERROR_TYPE) \
|
|
|
|
V(JSFunction, JS_FUNCTION_TYPE) \
|
|
|
|
V(JSGlobalObject, JS_GLOBAL_OBJECT_TYPE) \
|
|
|
|
V(JSGlobalProxy, JS_GLOBAL_PROXY_TYPE) \
|
|
|
|
V(JSMap, JS_MAP_TYPE) \
|
|
|
|
V(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) \
|
|
|
|
V(JSModuleNamespace, JS_MODULE_NAMESPACE_TYPE) \
|
|
|
|
V(JSPromise, JS_PROMISE_TYPE) \
|
|
|
|
V(JSProxy, JS_PROXY_TYPE) \
|
|
|
|
V(JSRegExp, JS_REGEXP_TYPE) \
|
|
|
|
V(JSRegExpResult, JS_ARRAY_TYPE) \
|
|
|
|
V(JSRegExpStringIterator, JS_REGEXP_STRING_ITERATOR_TYPE) \
|
|
|
|
V(JSSet, JS_SET_TYPE) \
|
|
|
|
V(JSStringIterator, JS_STRING_ITERATOR_TYPE) \
|
|
|
|
V(JSTypedArray, JS_TYPED_ARRAY_TYPE) \
|
|
|
|
V(JSValue, JS_VALUE_TYPE) \
|
|
|
|
V(JSWeakFactory, JS_WEAK_FACTORY_TYPE) \
|
|
|
|
V(JSWeakFactoryCleanupIterator, JS_WEAK_FACTORY_CLEANUP_ITERATOR_TYPE) \
|
|
|
|
V(JSWeakMap, JS_WEAK_MAP_TYPE) \
|
2018-11-05 14:21:02 +00:00
|
|
|
V(JSWeakRef, JS_WEAK_REF_TYPE) \
|
2018-10-09 12:08:23 +00:00
|
|
|
V(JSWeakSet, JS_WEAK_SET_TYPE) \
|
|
|
|
V(LoadHandler, LOAD_HANDLER_TYPE) \
|
|
|
|
V(Map, MAP_TYPE) \
|
|
|
|
V(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE) \
|
|
|
|
V(NameDictionary, NAME_DICTIONARY_TYPE) \
|
|
|
|
V(NativeContext, NATIVE_CONTEXT_TYPE) \
|
|
|
|
V(NumberDictionary, NUMBER_DICTIONARY_TYPE) \
|
|
|
|
V(Oddball, ODDBALL_TYPE) \
|
|
|
|
V(OrderedHashMap, ORDERED_HASH_MAP_TYPE) \
|
|
|
|
V(OrderedHashSet, ORDERED_HASH_SET_TYPE) \
|
2018-11-12 10:31:52 +00:00
|
|
|
V(OrderedNameDictionary, ORDERED_NAME_DICTIONARY_TYPE) \
|
2018-10-09 12:08:23 +00:00
|
|
|
V(PreParsedScopeData, PRE_PARSED_SCOPE_DATA_TYPE) \
|
|
|
|
V(PropertyArray, PROPERTY_ARRAY_TYPE) \
|
|
|
|
V(PropertyCell, PROPERTY_CELL_TYPE) \
|
|
|
|
V(PropertyDescriptorObject, FIXED_ARRAY_TYPE) \
|
|
|
|
V(ScopeInfo, SCOPE_INFO_TYPE) \
|
|
|
|
V(ScriptContextTable, SCRIPT_CONTEXT_TABLE_TYPE) \
|
|
|
|
V(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) \
|
|
|
|
V(SimpleNumberDictionary, SIMPLE_NUMBER_DICTIONARY_TYPE) \
|
|
|
|
V(SmallOrderedHashMap, SMALL_ORDERED_HASH_MAP_TYPE) \
|
|
|
|
V(SmallOrderedHashSet, SMALL_ORDERED_HASH_SET_TYPE) \
|
2018-11-12 13:24:48 +00:00
|
|
|
V(SmallOrderedNameDictionary, SMALL_ORDERED_NAME_DICTIONARY_TYPE) \
|
2018-10-09 12:08:23 +00:00
|
|
|
V(SourcePositionTableWithFrameCache, TUPLE2_TYPE) \
|
|
|
|
V(StoreHandler, STORE_HANDLER_TYPE) \
|
|
|
|
V(StringTable, STRING_TABLE_TYPE) \
|
|
|
|
V(Symbol, SYMBOL_TYPE) \
|
|
|
|
V(TemplateObjectDescription, TUPLE2_TYPE) \
|
|
|
|
V(TransitionArray, TRANSITION_ARRAY_TYPE) \
|
|
|
|
V(UncompiledDataWithoutPreParsedScope, \
|
|
|
|
UNCOMPILED_DATA_WITHOUT_PRE_PARSED_SCOPE_TYPE) \
|
|
|
|
V(UncompiledDataWithPreParsedScope, \
|
|
|
|
UNCOMPILED_DATA_WITH_PRE_PARSED_SCOPE_TYPE) \
|
|
|
|
V(WasmExceptionObject, WASM_EXCEPTION_TYPE) \
|
|
|
|
V(WasmGlobalObject, WASM_GLOBAL_TYPE) \
|
|
|
|
V(WasmInstanceObject, WASM_INSTANCE_TYPE) \
|
|
|
|
V(WasmMemoryObject, WASM_MEMORY_TYPE) \
|
|
|
|
V(WasmModuleObject, WASM_MODULE_TYPE) \
|
|
|
|
V(WasmTableObject, WASM_TABLE_TYPE) \
|
2018-08-14 07:18:05 +00:00
|
|
|
V(WeakArrayList, WEAK_ARRAY_LIST_TYPE)
|
2018-07-30 09:52:51 +00:00
|
|
|
#ifdef V8_INTL_SUPPORT
|
|
|
|
|
2018-10-05 01:57:05 +00:00
|
|
|
#define INSTANCE_TYPE_CHECKERS_SINGLE(V) \
|
|
|
|
INSTANCE_TYPE_CHECKERS_SINGLE_BASE(V) \
|
|
|
|
V(JSV8BreakIterator, JS_INTL_V8_BREAK_ITERATOR_TYPE) \
|
|
|
|
V(JSCollator, JS_INTL_COLLATOR_TYPE) \
|
|
|
|
V(JSDateTimeFormat, JS_INTL_DATE_TIME_FORMAT_TYPE) \
|
|
|
|
V(JSListFormat, JS_INTL_LIST_FORMAT_TYPE) \
|
|
|
|
V(JSLocale, JS_INTL_LOCALE_TYPE) \
|
|
|
|
V(JSNumberFormat, JS_INTL_NUMBER_FORMAT_TYPE) \
|
|
|
|
V(JSPluralRules, JS_INTL_PLURAL_RULES_TYPE) \
|
|
|
|
V(JSRelativeTimeFormat, JS_INTL_RELATIVE_TIME_FORMAT_TYPE) \
|
2018-10-18 07:59:28 +00:00
|
|
|
V(JSSegmentIterator, JS_INTL_SEGMENT_ITERATOR_TYPE) \
|
2018-10-05 01:57:05 +00:00
|
|
|
V(JSSegmenter, JS_INTL_SEGMENTER_TYPE)
|
2018-07-30 09:52:51 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define INSTANCE_TYPE_CHECKERS_SINGLE(V) INSTANCE_TYPE_CHECKERS_SINGLE_BASE(V)
|
|
|
|
|
|
|
|
#endif // V8_INTL_SUPPORT
|
|
|
|
|
|
|
|
#define INSTANCE_TYPE_CHECKERS_RANGE(V) \
|
|
|
|
V(Context, FIRST_CONTEXT_TYPE, LAST_CONTEXT_TYPE) \
|
|
|
|
V(Dictionary, FIRST_DICTIONARY_TYPE, LAST_DICTIONARY_TYPE) \
|
|
|
|
V(FixedArray, FIRST_FIXED_ARRAY_TYPE, LAST_FIXED_ARRAY_TYPE) \
|
|
|
|
V(FixedTypedArrayBase, FIRST_FIXED_TYPED_ARRAY_TYPE, \
|
|
|
|
LAST_FIXED_TYPED_ARRAY_TYPE) \
|
|
|
|
V(HashTable, FIRST_HASH_TABLE_TYPE, LAST_HASH_TABLE_TYPE) \
|
|
|
|
V(JSMapIterator, FIRST_MAP_ITERATOR_TYPE, LAST_MAP_ITERATOR_TYPE) \
|
|
|
|
V(JSSetIterator, FIRST_SET_ITERATOR_TYPE, LAST_SET_ITERATOR_TYPE) \
|
2018-11-05 14:21:02 +00:00
|
|
|
V(JSWeakCell, FIRST_JS_WEAK_CELL_TYPE, LAST_JS_WEAK_CELL_TYPE) \
|
2018-07-30 09:52:51 +00:00
|
|
|
V(Microtask, FIRST_MICROTASK_TYPE, LAST_MICROTASK_TYPE) \
|
|
|
|
V(Name, FIRST_TYPE, LAST_NAME_TYPE) \
|
|
|
|
V(String, FIRST_TYPE, FIRST_NONSTRING_TYPE - 1) \
|
|
|
|
V(WeakFixedArray, FIRST_WEAK_FIXED_ARRAY_TYPE, LAST_WEAK_FIXED_ARRAY_TYPE)
|
|
|
|
|
|
|
|
#define INSTANCE_TYPE_CHECKERS_CUSTOM(V) \
|
|
|
|
V(FixedArrayBase) \
|
|
|
|
V(InternalizedString) \
|
2018-09-14 09:38:28 +00:00
|
|
|
V(JSObject) \
|
|
|
|
V(JSReceiver)
|
2018-07-30 09:52:51 +00:00
|
|
|
|
|
|
|
#define INSTANCE_TYPE_CHECKERS(V) \
|
|
|
|
INSTANCE_TYPE_CHECKERS_SINGLE(V) \
|
|
|
|
INSTANCE_TYPE_CHECKERS_RANGE(V) \
|
|
|
|
INSTANCE_TYPE_CHECKERS_CUSTOM(V)
|
|
|
|
|
|
|
|
namespace InstanceTypeChecker {
|
|
|
|
#define IS_TYPE_FUNCTION_DECL(Type, ...) \
|
|
|
|
V8_INLINE bool Is##Type(InstanceType instance_type);
|
|
|
|
|
|
|
|
INSTANCE_TYPE_CHECKERS(IS_TYPE_FUNCTION_DECL)
|
|
|
|
|
|
|
|
#define TYPED_ARRAY_IS_TYPE_FUNCTION_DECL(Type, ...) \
|
|
|
|
IS_TYPE_FUNCTION_DECL(Fixed##Type##Array)
|
|
|
|
TYPED_ARRAYS(TYPED_ARRAY_IS_TYPE_FUNCTION_DECL)
|
|
|
|
#undef TYPED_ARRAY_IS_TYPE_FUNCTION_DECL
|
|
|
|
|
|
|
|
#define STRUCT_IS_TYPE_FUNCTION_DECL(NAME, Name, name) \
|
|
|
|
IS_TYPE_FUNCTION_DECL(Name)
|
|
|
|
STRUCT_LIST(STRUCT_IS_TYPE_FUNCTION_DECL)
|
|
|
|
#undef STRUCT_IS_TYPE_FUNCTION_DECL
|
|
|
|
|
|
|
|
#undef IS_TYPE_FUNCTION_DECL
|
|
|
|
} // namespace InstanceTypeChecker
|
|
|
|
|
2015-12-17 08:40:49 +00:00
|
|
|
// The element types selection for CreateListFromArrayLike.
|
|
|
|
enum class ElementTypes { kAll, kStringAndSymbol };
|
|
|
|
|
2018-11-03 00:13:22 +00:00
|
|
|
// TODO(3770): Get rid of this indirection when the migration is complete.
|
|
|
|
typedef AbstractCode* AbstractCodeArgType;
|
|
|
|
typedef ByteArray* ByteArrayArgType;
|
|
|
|
typedef FixedArray* FixedArrayArgType;
|
|
|
|
typedef FixedDoubleArray* FixedDoubleArrayArgType;
|
|
|
|
typedef Foreign* ForeignArgType;
|
|
|
|
typedef HeapObject* HeapObjectArgType;
|
|
|
|
typedef JSArray* JSArrayArgType;
|
2018-11-07 03:24:08 +00:00
|
|
|
typedef JSAsyncGeneratorObject* JSAsyncGeneratorObjectArgType;
|
2018-11-03 00:13:22 +00:00
|
|
|
typedef JSFunction* JSFunctionArgType;
|
|
|
|
typedef JSGlobalProxy* JSGlobalProxyArgType;
|
|
|
|
typedef JSObject* JSObjectArgType;
|
|
|
|
typedef JSPromise* JSPromiseArgType;
|
|
|
|
typedef JSProxy* JSProxyArgType;
|
|
|
|
typedef Map* MapArgType;
|
|
|
|
typedef Object* ObjectArgType;
|
|
|
|
typedef RegExpMatchInfo* RegExpMatchInfoArgType;
|
|
|
|
typedef ScriptContextTable* ScriptContextTableArgType;
|
|
|
|
typedef SharedFunctionInfo* SharedFunctionInfoArgType;
|
|
|
|
typedef SimpleNumberDictionary* SimpleNumberDictionaryArgType;
|
|
|
|
typedef Smi SmiArgType;
|
|
|
|
typedef String* StringArgType;
|
|
|
|
typedef Symbol* SymbolArgType;
|
|
|
|
typedef TemplateList* TemplateListArgType;
|
|
|
|
typedef WasmInstanceObject* WasmInstanceObjectArgType;
|
|
|
|
typedef WasmMemoryObject* WasmMemoryObjectArgType;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Object is the abstract superclass for all classes in the
|
|
|
|
// object hierarchy.
|
|
|
|
// Object does not use any virtual functions to avoid the
|
|
|
|
// allocation of the C++ vtable.
|
2014-04-30 12:25:18 +00:00
|
|
|
// Since both Smi and HeapObject are subclasses of Object no
|
2008-07-03 15:10:15 +00:00
|
|
|
// data members can be present in Object.
|
2014-04-30 12:25:18 +00:00
|
|
|
class Object {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
|
|
|
// Type testing.
|
2014-06-24 09:47:25 +00:00
|
|
|
bool IsObject() const { return true; }
|
Make the runtime entry for setting/changing accessors "atomic".
Previously, there were 1 or 2 calls to the runtime when accessors were changed
or set. This doesn't really work well with property attributes, leading to some
hacks and complicates things even further when trying to share maps in presence
of accessors. Therefore, the runtime entry now takes the full triple (getter,
setter, attributes), where the getter and/or the setter can be null in case they
shouldn't be changed.
For now, we do basically the same on the native side as we did before on the
JavaScript side, but this will change in future CLs, the current CL is already
large enough.
Note that object literals with a getter and a setter for the same property still
do 2 calls, but this is a little bit more tricky to fix and will be handled in a
separate CL.
Review URL: https://chromiumcodereview.appspot.com/9616016
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10956 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
2012-03-07 13:24:44 +00:00
|
|
|
|
2018-10-24 01:44:19 +00:00
|
|
|
// Syntax compatibility with ObjectPtr, so the same macros can consume
|
|
|
|
// arguments of either type.
|
|
|
|
Address ptr() const { return reinterpret_cast<Address>(this); }
|
|
|
|
|
2018-06-22 11:19:13 +00:00
|
|
|
#define IS_TYPE_FUNCTION_DECL(Type) V8_INLINE bool Is##Type() const;
|
2011-01-19 08:04:48 +00:00
|
|
|
OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
|
|
|
|
HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
|
2016-06-14 10:08:44 +00:00
|
|
|
#undef IS_TYPE_FUNCTION_DECL
|
2017-01-09 13:40:51 +00:00
|
|
|
|
2018-06-22 11:19:13 +00:00
|
|
|
V8_INLINE bool IsExternal(Isolate* isolate) const;
|
2018-06-20 16:32:59 +00:00
|
|
|
|
2018-07-05 09:02:40 +00:00
|
|
|
// Oddball checks are faster when they are raw pointer comparisons, so the
|
|
|
|
// isolate/read-only roots overloads should be preferred where possible.
|
|
|
|
#define IS_TYPE_FUNCTION_DECL(Type, Value) \
|
|
|
|
V8_INLINE bool Is##Type(Isolate* isolate) const; \
|
|
|
|
V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \
|
|
|
|
V8_INLINE bool Is##Type() const;
|
2016-02-16 12:57:29 +00:00
|
|
|
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
|
2011-01-19 08:04:48 +00:00
|
|
|
#undef IS_TYPE_FUNCTION_DECL
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2018-06-22 11:19:13 +00:00
|
|
|
V8_INLINE bool IsNullOrUndefined(Isolate* isolate) const;
|
2018-07-05 09:02:40 +00:00
|
|
|
V8_INLINE bool IsNullOrUndefined(ReadOnlyRoots roots) const;
|
2018-06-22 11:19:13 +00:00
|
|
|
V8_INLINE bool IsNullOrUndefined() const;
|
2018-06-12 09:16:35 +00:00
|
|
|
|
2017-10-10 16:00:31 +00:00
|
|
|
enum class Conversion { kToNumber, kToNumeric };
|
|
|
|
|
2015-10-23 09:39:37 +00:00
|
|
|
#define RETURN_FAILURE(isolate, should_throw, call) \
|
|
|
|
do { \
|
2017-10-25 18:07:04 +00:00
|
|
|
if ((should_throw) == kDontThrow) { \
|
2015-10-23 09:39:37 +00:00
|
|
|
return Just(false); \
|
|
|
|
} else { \
|
|
|
|
isolate->Throw(*isolate->factory()->call); \
|
|
|
|
return Nothing<bool>(); \
|
|
|
|
} \
|
|
|
|
} while (false)
|
|
|
|
|
|
|
|
#define MAYBE_RETURN(call, value) \
|
|
|
|
do { \
|
|
|
|
if ((call).IsNothing()) return value; \
|
|
|
|
} while (false)
|
|
|
|
|
|
|
|
#define MAYBE_RETURN_NULL(call) MAYBE_RETURN(call, MaybeHandle<Object>())
|
|
|
|
|
2018-07-18 13:21:06 +00:00
|
|
|
#define MAYBE_ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, dst, call) \
|
|
|
|
do { \
|
|
|
|
Isolate* __isolate__ = (isolate); \
|
|
|
|
if (!(call).To(&dst)) { \
|
|
|
|
DCHECK(__isolate__->has_pending_exception()); \
|
|
|
|
return ReadOnlyRoots(__isolate__).exception(); \
|
|
|
|
} \
|
|
|
|
} while (false)
|
|
|
|
|
2018-06-22 11:19:13 +00:00
|
|
|
#define DECL_STRUCT_PREDICATE(NAME, Name, name) V8_INLINE bool Is##Name() const;
|
2017-06-29 13:14:20 +00:00
|
|
|
STRUCT_LIST(DECL_STRUCT_PREDICATE)
|
|
|
|
#undef DECL_STRUCT_PREDICATE
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2017-06-06 15:55:33 +00:00
|
|
|
// ES6, #sec-isarray. NOT to be confused with %_IsArray.
|
2018-06-22 11:19:13 +00:00
|
|
|
V8_INLINE
|
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> IsArray(Handle<Object> object);
|
2015-12-03 12:51:15 +00:00
|
|
|
|
2018-06-22 11:19:13 +00:00
|
|
|
V8_INLINE bool IsSmallOrderedHashTable() const;
|
2011-07-21 13:51:04 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Extract the number.
|
2015-09-15 13:14:36 +00:00
|
|
|
inline double Number() const;
|
2018-06-22 11:19:13 +00:00
|
|
|
V8_INLINE bool IsNaN() const;
|
|
|
|
V8_INLINE bool IsMinusZero() const;
|
2017-05-03 09:58:03 +00:00
|
|
|
V8_EXPORT_PRIVATE bool ToInt32(int32_t* value);
|
2017-07-03 13:29:23 +00:00
|
|
|
inline bool ToUint32(uint32_t* value) const;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-08-13 11:49:01 +00:00
|
|
|
inline Representation OptimalRepresentation();
|
2013-04-26 15:30:41 +00:00
|
|
|
|
2015-08-13 11:49:01 +00:00
|
|
|
inline ElementsKind OptimalElementsKind();
|
2015-06-23 11:35:43 +00:00
|
|
|
|
2015-08-13 11:49:01 +00:00
|
|
|
inline bool FitsRepresentation(Representation representation);
|
2013-04-26 15:30:41 +00:00
|
|
|
|
2015-05-20 17:03:21 +00:00
|
|
|
// Checks whether two valid primitive encodings of a property name resolve to
|
|
|
|
// the same logical property. E.g., the smi 1, the string "1" and the double
|
|
|
|
// 1 all refer to the same property, so this helper will return true.
|
|
|
|
inline bool KeyEquals(Object* other);
|
|
|
|
|
2015-12-02 16:30:06 +00:00
|
|
|
inline bool FilterKey(PropertyFilter filter);
|
2015-10-19 13:47:24 +00:00
|
|
|
|
2016-01-26 15:03:40 +00:00
|
|
|
Handle<FieldType> OptimalType(Isolate* isolate,
|
|
|
|
Representation representation);
|
2014-04-15 07:36:47 +00:00
|
|
|
|
2014-04-15 12:11:39 +00:00
|
|
|
inline static Handle<Object> NewStorageFor(Isolate* isolate,
|
|
|
|
Handle<Object> object,
|
|
|
|
Representation representation);
|
2013-05-08 15:02:08 +00:00
|
|
|
|
2014-07-01 15:02:31 +00:00
|
|
|
inline static Handle<Object> WrapForRead(Isolate* isolate,
|
|
|
|
Handle<Object> object,
|
|
|
|
Representation representation);
|
|
|
|
|
2011-06-09 10:03:35 +00:00
|
|
|
// Returns true if the object is of the correct type to be used as a
|
|
|
|
// implementation of a JSObject's elements.
|
|
|
|
inline bool HasValidElements();
|
|
|
|
|
2018-05-25 13:39:45 +00:00
|
|
|
// ECMA-262 9.2.
|
|
|
|
bool BooleanValue(Isolate* isolate);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-09-18 06:35:36 +00:00
|
|
|
// ES6 section 7.2.11 Abstract Relational Comparison
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<ComparisonResult> Compare(
|
2018-06-20 12:44:39 +00:00
|
|
|
Isolate* isolate, Handle<Object> x, Handle<Object> y);
|
2015-09-18 06:35:36 +00:00
|
|
|
|
2015-09-15 13:14:36 +00:00
|
|
|
// ES6 section 7.2.12 Abstract Equality Comparison
|
2018-06-20 12:44:39 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> Equals(Isolate* isolate,
|
|
|
|
Handle<Object> x,
|
2018-04-09 15:12:07 +00:00
|
|
|
Handle<Object> y);
|
2015-09-15 13:14:36 +00:00
|
|
|
|
2015-08-17 08:01:55 +00:00
|
|
|
// ES6 section 7.2.13 Strict Equality Comparison
|
|
|
|
bool StrictEquals(Object* that);
|
|
|
|
|
2017-04-24 20:53:37 +00:00
|
|
|
// ES6 section 7.1.13 ToObject
|
2008-07-03 15:10:15 +00:00
|
|
|
// Convert to a JSObject if needed.
|
2012-08-17 09:03:08 +00:00
|
|
|
// native_context is used when creating wrapper object.
|
2017-04-24 20:53:37 +00:00
|
|
|
//
|
|
|
|
// Passing a non-null method_name allows us to give a more informative
|
|
|
|
// error message for those cases where ToObject is being called on
|
|
|
|
// the receiver of a built-in method.
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<JSReceiver> ToObject(
|
2017-04-24 20:53:37 +00:00
|
|
|
Isolate* isolate, Handle<Object> object,
|
|
|
|
const char* method_name = nullptr);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<JSReceiver> ToObject(
|
2017-04-24 20:53:37 +00:00
|
|
|
Isolate* isolate, Handle<Object> object, Handle<Context> native_context,
|
|
|
|
const char* method_name = nullptr);
|
2015-08-27 12:50:31 +00:00
|
|
|
|
2016-04-29 10:14:42 +00:00
|
|
|
// ES6 section 9.2.1.2, OrdinaryCallBindThis for sloppy callee.
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<JSReceiver> ConvertReceiver(
|
2016-04-29 10:14:42 +00:00
|
|
|
Isolate* isolate, Handle<Object> object);
|
|
|
|
|
2015-08-28 09:21:23 +00:00
|
|
|
// ES6 section 7.1.14 ToPropertyKey
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Name> ToName(
|
|
|
|
Isolate* isolate, Handle<Object> input);
|
2015-08-28 09:21:23 +00:00
|
|
|
|
|
|
|
// ES6 section 7.1.1 ToPrimitive
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToPrimitive(
|
2015-08-28 09:21:23 +00:00
|
|
|
Handle<Object> input, ToPrimitiveHint hint = ToPrimitiveHint::kDefault);
|
|
|
|
|
|
|
|
// ES6 section 7.1.3 ToNumber
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToNumber(
|
2018-07-13 09:17:37 +00:00
|
|
|
Isolate* isolate, Handle<Object> input);
|
2015-08-28 09:21:23 +00:00
|
|
|
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToNumeric(
|
2018-07-13 09:17:37 +00:00
|
|
|
Isolate* isolate, Handle<Object> input);
|
2017-10-10 16:00:31 +00:00
|
|
|
|
2015-09-29 07:41:03 +00:00
|
|
|
// ES6 section 7.1.4 ToInteger
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToInteger(
|
2016-12-16 14:30:05 +00:00
|
|
|
Isolate* isolate, Handle<Object> input);
|
2015-09-29 07:41:03 +00:00
|
|
|
|
|
|
|
// ES6 section 7.1.5 ToInt32
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToInt32(
|
2016-12-16 14:30:05 +00:00
|
|
|
Isolate* isolate, Handle<Object> input);
|
2015-09-29 07:41:03 +00:00
|
|
|
|
|
|
|
// ES6 section 7.1.6 ToUint32
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT inline static MaybeHandle<Object> ToUint32(
|
2016-12-16 14:30:05 +00:00
|
|
|
Isolate* isolate, Handle<Object> input);
|
2015-09-29 07:41:03 +00:00
|
|
|
|
2015-08-28 09:21:23 +00:00
|
|
|
// ES6 section 7.1.12 ToString
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<String> ToString(
|
2016-12-16 14:30:05 +00:00
|
|
|
Isolate* isolate, Handle<Object> input);
|
2015-08-28 09:21:23 +00:00
|
|
|
|
2016-08-03 12:20:39 +00:00
|
|
|
static Handle<String> NoSideEffectsToString(Isolate* isolate,
|
|
|
|
Handle<Object> input);
|
|
|
|
|
2016-04-29 10:14:42 +00:00
|
|
|
// ES6 section 7.1.14 ToPropertyKey
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToPropertyKey(
|
2016-04-29 10:14:42 +00:00
|
|
|
Isolate* isolate, Handle<Object> value);
|
|
|
|
|
2015-09-29 07:41:03 +00:00
|
|
|
// ES6 section 7.1.15 ToLength
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToLength(
|
2016-12-20 12:21:00 +00:00
|
|
|
Isolate* isolate, Handle<Object> input);
|
2015-09-29 07:41:03 +00:00
|
|
|
|
Reland of Amend DataView, ArrayBuffer, and TypedArray methods to use ToIndex. (patchset #2 id:170001 of https://codereview.chromium.org/2113593002/ )
Reason for revert:
WebGL tests have been updated and rolled (at https://codereview.chromium.org/2227023002), so this should no longer fail outdated tests.
Original issue's description:
> Revert of Amend DataView, ArrayBuffer, and TypedArray methods to use ToIndex. (patchset #8 id:140001 of https://codereview.chromium.org/2090353003/ )
>
> Reason for revert:
> Speculative revert to unblock roll: https://codereview.chromium.org/2107223003/
>
> Original issue's description:
> > Amend DataView, ArrayBuffer, and TypedArray methods to use ToIndex.
> >
> > The spec was modified to relax some requirements which implementors had not been
> > enforcing. Part of this process involved introducing a new abstract operation
> > ToIndex, which had partial overlap with our existing semantics as well as some
> > differences (most notably treating undefined as 0). Test262 tests were introduced to
> > check for the new semantics, some of which we were failing. This patch amends the
> > parts of our implementation corresponding to specification algorithms which use
> > ToIndex to follow its semantics precisely.
> >
> > BUG=v8:4784,v8:5120
> >
> > Committed: https://crrev.com/09720349ea058d178521ec58d0a5676443a5a132
> > Cr-Commit-Position: refs/heads/master@{#37406}
>
> TBR=littledan@chromium.org,adamk@chromium.org,bakkot@google.com
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=v8:4784,v8:5120
>
> Committed: https://crrev.com/b1f7f1f4e41a723d5f997738a07e35a031713b8f
> Cr-Commit-Position: refs/heads/master@{#37417}
TBR=littledan@chromium.org,adamk@chromium.org,hablich@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=v8:4784,v8:5120
Review-Url: https://codereview.chromium.org/2247073004
Cr-Commit-Position: refs/heads/master@{#38689}
2016-08-17 17:38:34 +00:00
|
|
|
// ES6 section 7.1.17 ToIndex
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> ToIndex(
|
2018-10-11 21:35:34 +00:00
|
|
|
Isolate* isolate, Handle<Object> input, MessageTemplate error_index);
|
Reland of Amend DataView, ArrayBuffer, and TypedArray methods to use ToIndex. (patchset #2 id:170001 of https://codereview.chromium.org/2113593002/ )
Reason for revert:
WebGL tests have been updated and rolled (at https://codereview.chromium.org/2227023002), so this should no longer fail outdated tests.
Original issue's description:
> Revert of Amend DataView, ArrayBuffer, and TypedArray methods to use ToIndex. (patchset #8 id:140001 of https://codereview.chromium.org/2090353003/ )
>
> Reason for revert:
> Speculative revert to unblock roll: https://codereview.chromium.org/2107223003/
>
> Original issue's description:
> > Amend DataView, ArrayBuffer, and TypedArray methods to use ToIndex.
> >
> > The spec was modified to relax some requirements which implementors had not been
> > enforcing. Part of this process involved introducing a new abstract operation
> > ToIndex, which had partial overlap with our existing semantics as well as some
> > differences (most notably treating undefined as 0). Test262 tests were introduced to
> > check for the new semantics, some of which we were failing. This patch amends the
> > parts of our implementation corresponding to specification algorithms which use
> > ToIndex to follow its semantics precisely.
> >
> > BUG=v8:4784,v8:5120
> >
> > Committed: https://crrev.com/09720349ea058d178521ec58d0a5676443a5a132
> > Cr-Commit-Position: refs/heads/master@{#37406}
>
> TBR=littledan@chromium.org,adamk@chromium.org,bakkot@google.com
> # Skipping CQ checks because original CL landed less than 1 days ago.
> NOPRESUBMIT=true
> NOTREECHECKS=true
> NOTRY=true
> BUG=v8:4784,v8:5120
>
> Committed: https://crrev.com/b1f7f1f4e41a723d5f997738a07e35a031713b8f
> Cr-Commit-Position: refs/heads/master@{#37417}
TBR=littledan@chromium.org,adamk@chromium.org,hablich@chromium.org
# Not skipping CQ checks because original CL landed more than 1 days ago.
BUG=v8:4784,v8:5120
Review-Url: https://codereview.chromium.org/2247073004
Cr-Commit-Position: refs/heads/master@{#38689}
2016-08-17 17:38:34 +00:00
|
|
|
|
2015-08-28 09:21:23 +00:00
|
|
|
// ES6 section 7.3.9 GetMethod
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> GetMethod(
|
2015-08-28 09:21:23 +00:00
|
|
|
Handle<JSReceiver> receiver, Handle<Name> name);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-12-17 08:40:49 +00:00
|
|
|
// ES6 section 7.3.17 CreateListFromArrayLike
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<FixedArray> CreateListFromArrayLike(
|
2015-12-17 08:40:49 +00:00
|
|
|
Isolate* isolate, Handle<Object> object, ElementTypes element_types);
|
|
|
|
|
2016-05-20 13:19:02 +00:00
|
|
|
// Get length property and apply ToLength.
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> GetLengthFromArrayLike(
|
2018-08-06 23:02:30 +00:00
|
|
|
Isolate* isolate, Handle<JSReceiver> object);
|
2016-05-20 13:19:02 +00:00
|
|
|
|
2015-09-03 06:01:12 +00:00
|
|
|
// ES6 section 12.5.6 The typeof Operator
|
|
|
|
static Handle<String> TypeOf(Isolate* isolate, Handle<Object> object);
|
|
|
|
|
2015-09-10 13:04:15 +00:00
|
|
|
// ES6 section 12.7 Additive Operators
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> Add(Isolate* isolate,
|
|
|
|
Handle<Object> lhs,
|
|
|
|
Handle<Object> rhs);
|
2015-09-10 13:04:15 +00:00
|
|
|
|
2015-09-18 06:35:36 +00:00
|
|
|
// ES6 section 12.9 Relational Operators
|
2018-06-20 12:44:39 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline Maybe<bool> GreaterThan(Isolate* isolate,
|
|
|
|
Handle<Object> x,
|
2018-04-09 15:12:07 +00:00
|
|
|
Handle<Object> y);
|
|
|
|
V8_WARN_UNUSED_RESULT static inline Maybe<bool> GreaterThanOrEqual(
|
2018-06-20 12:44:39 +00:00
|
|
|
Isolate* isolate, Handle<Object> x, Handle<Object> y);
|
|
|
|
V8_WARN_UNUSED_RESULT static inline Maybe<bool> LessThan(Isolate* isolate,
|
|
|
|
Handle<Object> x,
|
2018-04-09 15:12:07 +00:00
|
|
|
Handle<Object> y);
|
|
|
|
V8_WARN_UNUSED_RESULT static inline Maybe<bool> LessThanOrEqual(
|
2018-06-20 12:44:39 +00:00
|
|
|
Isolate* isolate, Handle<Object> x, Handle<Object> y);
|
2015-09-18 06:35:36 +00:00
|
|
|
|
2016-05-17 11:23:59 +00:00
|
|
|
// ES6 section 7.3.19 OrdinaryHasInstance (C, O).
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> OrdinaryHasInstance(
|
2016-05-17 11:23:59 +00:00
|
|
|
Isolate* isolate, Handle<Object> callable, Handle<Object> object);
|
|
|
|
|
|
|
|
// ES6 section 12.10.4 Runtime Semantics: InstanceofOperator(O, C)
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> InstanceOf(
|
2016-05-17 11:23:59 +00:00
|
|
|
Isolate* isolate, Handle<Object> object, Handle<Object> callable);
|
|
|
|
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_EXPORT_PRIVATE V8_WARN_UNUSED_RESULT static MaybeHandle<Object>
|
2018-07-05 09:06:51 +00:00
|
|
|
GetProperty(LookupIterator* it,
|
|
|
|
OnNonExistent on_non_existent = OnNonExistent::kReturnUndefined);
|
2014-07-22 08:28:49 +00:00
|
|
|
|
2017-10-25 18:07:04 +00:00
|
|
|
// ES6 [[Set]] (when passed kDontThrow)
|
2015-10-23 09:39:37 +00:00
|
|
|
// Invariants for this and related functions (unless stated otherwise):
|
|
|
|
// 1) When the result is Nothing, an exception is pending.
|
2017-10-25 18:07:04 +00:00
|
|
|
// 2) When passed kThrowOnError, the result is never Just(false).
|
2015-10-23 09:39:37 +00:00
|
|
|
// In some cases, an exception is thrown regardless of the ShouldThrow
|
|
|
|
// argument. These cases are either in accordance with the spec or not
|
|
|
|
// covered by it (eg., concerning API callbacks).
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> SetProperty(
|
|
|
|
LookupIterator* it, Handle<Object> value, LanguageMode language_mode,
|
2018-09-10 10:49:08 +00:00
|
|
|
StoreOrigin store_origin);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> SetProperty(
|
2018-07-17 08:49:20 +00:00
|
|
|
Isolate* isolate, Handle<Object> object, Handle<Name> name,
|
|
|
|
Handle<Object> value, LanguageMode language_mode,
|
2018-09-10 10:49:08 +00:00
|
|
|
StoreOrigin store_origin = StoreOrigin::kMaybeKeyed);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> SetPropertyOrElement(
|
2018-07-13 09:17:37 +00:00
|
|
|
Isolate* isolate, Handle<Object> object, Handle<Name> name,
|
|
|
|
Handle<Object> value, LanguageMode language_mode,
|
2018-09-10 10:49:08 +00:00
|
|
|
StoreOrigin store_origin = StoreOrigin::kMaybeKeyed);
|
2015-02-19 16:15:25 +00:00
|
|
|
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> SetSuperProperty(
|
2015-02-19 16:15:25 +00:00
|
|
|
LookupIterator* it, Handle<Object> value, LanguageMode language_mode,
|
2018-09-10 10:49:08 +00:00
|
|
|
StoreOrigin store_origin);
|
2015-02-19 16:15:25 +00:00
|
|
|
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> CannotCreateProperty(
|
2015-10-09 09:12:28 +00:00
|
|
|
Isolate* isolate, Handle<Object> receiver, Handle<Object> name,
|
2015-10-30 10:45:30 +00:00
|
|
|
Handle<Object> value, ShouldThrow should_throw);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> WriteToReadOnlyProperty(
|
2015-10-30 10:45:30 +00:00
|
|
|
LookupIterator* it, Handle<Object> value, ShouldThrow should_throw);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> WriteToReadOnlyProperty(
|
2015-06-30 15:24:27 +00:00
|
|
|
Isolate* isolate, Handle<Object> receiver, Handle<Object> name,
|
2015-10-30 10:45:30 +00:00
|
|
|
Handle<Object> value, ShouldThrow should_throw);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> RedefineIncompatibleProperty(
|
2015-02-19 16:15:25 +00:00
|
|
|
Isolate* isolate, Handle<Object> name, Handle<Object> value,
|
2015-10-30 10:45:30 +00:00
|
|
|
ShouldThrow should_throw);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> SetDataProperty(
|
|
|
|
LookupIterator* it, Handle<Object> value);
|
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> AddDataProperty(
|
2015-10-23 09:39:37 +00:00
|
|
|
LookupIterator* it, Handle<Object> value, PropertyAttributes attributes,
|
2018-09-10 10:49:08 +00:00
|
|
|
ShouldThrow should_throw, StoreOrigin store_origin);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> GetPropertyOrElement(
|
2018-07-13 09:17:37 +00:00
|
|
|
Isolate* isolate, Handle<Object> object, Handle<Name> name);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> GetPropertyOrElement(
|
2016-02-17 10:30:10 +00:00
|
|
|
Handle<Object> receiver, Handle<Name> name, Handle<JSReceiver> holder);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> GetProperty(
|
2018-07-17 08:49:20 +00:00
|
|
|
Isolate* isolate, Handle<Object> object, Handle<Name> name);
|
2011-10-18 12:19:18 +00:00
|
|
|
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> GetPropertyWithAccessor(
|
2016-02-17 10:30:10 +00:00
|
|
|
LookupIterator* it);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> SetPropertyWithAccessor(
|
2015-10-30 10:45:30 +00:00
|
|
|
LookupIterator* it, Handle<Object> value, ShouldThrow should_throw);
|
2014-05-28 09:29:27 +00:00
|
|
|
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> GetPropertyWithDefinedGetter(
|
|
|
|
Handle<Object> receiver, Handle<JSReceiver> getter);
|
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> SetPropertyWithDefinedSetter(
|
2015-10-23 09:39:37 +00:00
|
|
|
Handle<Object> receiver, Handle<JSReceiver> setter, Handle<Object> value,
|
|
|
|
ShouldThrow should_throw);
|
2010-10-25 15:22:03 +00:00
|
|
|
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> GetElement(
|
2016-02-17 10:30:10 +00:00
|
|
|
Isolate* isolate, Handle<Object> object, uint32_t index);
|
2014-03-18 12:34:02 +00:00
|
|
|
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline MaybeHandle<Object> SetElement(
|
2015-07-10 16:11:00 +00:00
|
|
|
Isolate* isolate, Handle<Object> object, uint32_t index,
|
|
|
|
Handle<Object> value, LanguageMode language_mode);
|
|
|
|
|
2013-11-05 11:47:11 +00:00
|
|
|
// Returns the permanent hash code associated with this object. May return
|
|
|
|
// undefined if not yet created.
|
2018-05-15 00:17:04 +00:00
|
|
|
inline Object* GetHash();
|
2013-11-05 11:47:11 +00:00
|
|
|
|
2011-10-25 14:14:56 +00:00
|
|
|
// Returns the permanent hash code associated with this object depending on
|
2013-11-05 11:47:11 +00:00
|
|
|
// the actual object type. May create and store a hash code if needed and none
|
|
|
|
// exists.
|
2018-11-03 00:13:22 +00:00
|
|
|
Smi GetOrCreateHash(Isolate* isolate);
|
|
|
|
// Returns a tagged Smi as a raw Address for ExternalReference usage.
|
|
|
|
static Address GetOrCreateHash(Isolate* isolate, Object* key);
|
2011-10-25 14:14:56 +00:00
|
|
|
|
|
|
|
// Checks whether this object has the same value as the given one. This
|
|
|
|
// function is implemented according to ES5, section 9.12 and can be used
|
2018-10-12 09:55:44 +00:00
|
|
|
// to implement the Object.is function.
|
2016-10-17 10:01:42 +00:00
|
|
|
V8_EXPORT_PRIVATE bool SameValue(Object* other);
|
2011-10-25 14:14:56 +00:00
|
|
|
|
2014-05-21 08:47:02 +00:00
|
|
|
// Checks whether this object has the same value as the given one.
|
|
|
|
// +0 and -0 are treated equal. Everything else is the same as SameValue.
|
|
|
|
// This function is implemented according to ES6, section 7.2.4 and is used
|
|
|
|
// by ES6 Map and Set.
|
|
|
|
bool SameValueZero(Object* other);
|
|
|
|
|
2016-01-07 02:29:50 +00:00
|
|
|
// ES6 section 9.4.2.3 ArraySpeciesCreate (part of it)
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ArraySpeciesConstructor(
|
2016-01-07 02:29:50 +00:00
|
|
|
Isolate* isolate, Handle<Object> original_array);
|
|
|
|
|
2017-02-28 20:31:02 +00:00
|
|
|
// ES6 section 7.3.20 SpeciesConstructor ( O, defaultConstructor )
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> SpeciesConstructor(
|
2017-02-28 20:31:02 +00:00
|
|
|
Isolate* isolate, Handle<JSReceiver> recv,
|
|
|
|
Handle<JSFunction> default_ctor);
|
|
|
|
|
2015-06-02 10:42:16 +00:00
|
|
|
// Tries to convert an object to an array length. Returns true and sets the
|
|
|
|
// output parameter if it succeeds.
|
2017-07-03 13:29:23 +00:00
|
|
|
inline bool ToArrayLength(uint32_t* index) const;
|
2015-06-02 10:42:16 +00:00
|
|
|
|
|
|
|
// Tries to convert an object to an array index. Returns true and sets the
|
|
|
|
// output parameter if it succeeds. Equivalent to ToArrayLength, but does not
|
|
|
|
// allow kMaxUInt32.
|
2018-10-16 09:56:41 +00:00
|
|
|
V8_WARN_UNUSED_RESULT inline bool ToArrayIndex(uint32_t* index) const;
|
2010-05-27 12:30:45 +00:00
|
|
|
|
2016-12-07 08:34:51 +00:00
|
|
|
// Returns true if the result of iterating over the object is the same
|
|
|
|
// (including observable effects) as simply accessing the properties between 0
|
|
|
|
// and length.
|
|
|
|
bool IterationHasObservableEffects();
|
|
|
|
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_VERIFIER(Object)
|
2012-10-12 11:41:14 +00:00
|
|
|
#ifdef VERIFY_HEAP
|
2008-07-03 15:10:15 +00:00
|
|
|
// Verify a pointer is a valid object pointer.
|
2018-07-17 13:28:38 +00:00
|
|
|
static void VerifyPointer(Isolate* isolate, Object* p);
|
2008-07-03 15:10:15 +00:00
|
|
|
#endif
|
|
|
|
|
2012-09-10 13:38:21 +00:00
|
|
|
inline void VerifyApiCallResultType();
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Prints this object without details.
|
2013-08-30 07:41:24 +00:00
|
|
|
void ShortPrint(FILE* out = stdout);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Prints this object without details to a message accumulator.
|
|
|
|
void ShortPrint(StringStream* accumulator);
|
|
|
|
|
2014-12-08 09:26:04 +00:00
|
|
|
void ShortPrint(std::ostream& os); // NOLINT
|
|
|
|
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_CAST(Object)
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Layout description.
|
2008-09-23 11:45:43 +00:00
|
|
|
static const int kHeaderSize = 0; // Object does not take up any space.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-04-30 12:25:18 +00:00
|
|
|
#ifdef OBJECT_PRINT
|
2014-07-08 08:43:20 +00:00
|
|
|
// For our gdb macros, we should perhaps change these in the future.
|
2018-07-12 10:06:42 +00:00
|
|
|
void Print();
|
2014-07-08 08:43:20 +00:00
|
|
|
|
2014-04-30 12:25:18 +00:00
|
|
|
// Prints this object with details.
|
2018-07-12 10:06:42 +00:00
|
|
|
void Print(std::ostream& os); // NOLINT
|
2014-12-08 09:26:04 +00:00
|
|
|
#else
|
2018-07-12 10:06:42 +00:00
|
|
|
void Print() { ShortPrint(); }
|
|
|
|
void Print(std::ostream& os) { ShortPrint(os); } // NOLINT
|
2014-04-30 12:25:18 +00:00
|
|
|
#endif
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
private:
|
2014-07-14 10:54:24 +00:00
|
|
|
friend class LookupIterator;
|
2016-02-08 13:49:47 +00:00
|
|
|
friend class StringStream;
|
2014-07-14 07:19:49 +00:00
|
|
|
|
|
|
|
// Return the map of the root of object's prototype chain.
|
2017-07-03 13:29:23 +00:00
|
|
|
Map* GetPrototypeChainRootMap(Isolate* isolate) const;
|
2014-07-14 07:19:49 +00:00
|
|
|
|
2018-05-15 00:17:04 +00:00
|
|
|
// Returns a non-SMI for JSReceivers, but returns the hash code for
|
|
|
|
// simple objects. This avoids a double lookup in the cases where
|
|
|
|
// we know we will add the hash to the JSReceiver if it does not
|
|
|
|
// already exist.
|
|
|
|
//
|
|
|
|
// Despite its size, this needs to be inlined for performance
|
|
|
|
// reasons.
|
|
|
|
static inline Object* GetSimpleHash(Object* object);
|
|
|
|
|
2015-02-19 16:15:25 +00:00
|
|
|
// Helper for SetProperty and SetSuperProperty.
|
2015-10-23 09:39:37 +00:00
|
|
|
// Return value is only meaningful if [found] is set to true on return.
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static Maybe<bool> SetPropertyInternal(
|
2015-02-19 16:15:25 +00:00
|
|
|
LookupIterator* it, Handle<Object> value, LanguageMode language_mode,
|
2018-09-10 10:49:08 +00:00
|
|
|
StoreOrigin store_origin, bool* found);
|
2015-02-19 16:15:25 +00:00
|
|
|
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Name> ConvertToName(
|
|
|
|
Isolate* isolate, Handle<Object> input);
|
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToPropertyKey(
|
2016-12-20 12:21:00 +00:00
|
|
|
Isolate* isolate, Handle<Object> value);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<String> ConvertToString(
|
2016-12-16 14:30:05 +00:00
|
|
|
Isolate* isolate, Handle<Object> input);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToNumberOrNumeric(
|
2017-10-10 16:00:31 +00:00
|
|
|
Isolate* isolate, Handle<Object> input, Conversion mode);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToInteger(
|
2016-12-16 14:30:05 +00:00
|
|
|
Isolate* isolate, Handle<Object> input);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToInt32(
|
2016-12-16 14:30:05 +00:00
|
|
|
Isolate* isolate, Handle<Object> input);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToUint32(
|
2016-12-16 14:30:05 +00:00
|
|
|
Isolate* isolate, Handle<Object> input);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToLength(
|
2016-12-20 12:21:00 +00:00
|
|
|
Isolate* isolate, Handle<Object> input);
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static MaybeHandle<Object> ConvertToIndex(
|
2018-10-11 21:35:34 +00:00
|
|
|
Isolate* isolate, Handle<Object> input, MessageTemplate error_index);
|
2016-12-20 12:21:00 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Object);
|
|
|
|
};
|
|
|
|
|
2015-08-14 08:48:11 +00:00
|
|
|
// In objects.h to be usable without objects-inl.h inclusion.
|
2018-10-26 00:23:24 +00:00
|
|
|
bool Object::IsSmi() const { return HAS_SMI_TAG(ptr()); }
|
2017-02-27 09:07:25 +00:00
|
|
|
bool Object::IsHeapObject() const {
|
2018-10-26 00:23:24 +00:00
|
|
|
DCHECK_EQ(!IsSmi(), Internals::HasHeapObjectTag(ptr()));
|
2017-02-27 09:07:25 +00:00
|
|
|
return !IsSmi();
|
|
|
|
}
|
2015-08-14 08:48:11 +00:00
|
|
|
|
2014-07-07 09:57:29 +00:00
|
|
|
struct Brief {
|
2018-08-16 14:23:02 +00:00
|
|
|
V8_EXPORT_PRIVATE explicit Brief(const Object* v);
|
2018-10-26 00:23:24 +00:00
|
|
|
explicit Brief(const MaybeObject v);
|
|
|
|
// {value} is a tagged heap object reference (weak or strong), equivalent to
|
|
|
|
// a MaybeObject's payload. It has a plain Address type to keep #includes
|
|
|
|
// lightweight.
|
|
|
|
const Address value;
|
2018-04-05 09:33:56 +00:00
|
|
|
};
|
|
|
|
|
2016-10-17 10:01:42 +00:00
|
|
|
V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os, const Brief& v);
|
2014-07-07 09:57:29 +00:00
|
|
|
|
2008-07-30 08:49:36 +00:00
|
|
|
// Heap objects typically have a map pointer in their first word. However,
|
2012-01-16 12:38:59 +00:00
|
|
|
// during GC other data (e.g. mark bits, forwarding addresses) is sometimes
|
2008-07-30 08:49:36 +00:00
|
|
|
// encoded in the first word. The class MapWord is an abstraction of the
|
|
|
|
// value in a heap object's first word.
|
2018-09-06 09:08:10 +00:00
|
|
|
class MapWord {
|
2008-07-30 08:49:36 +00:00
|
|
|
public:
|
|
|
|
// Normal state: the map word contains a map pointer.
|
|
|
|
|
|
|
|
// Create a map word from a map pointer.
|
2014-06-20 10:31:17 +00:00
|
|
|
static inline MapWord FromMap(const Map* map);
|
2008-07-30 08:49:36 +00:00
|
|
|
|
|
|
|
// View this map word as a map pointer.
|
2017-07-03 13:29:23 +00:00
|
|
|
inline Map* ToMap() const;
|
2008-07-30 08:49:36 +00:00
|
|
|
|
|
|
|
// Scavenge collection: the map word of live objects in the from space
|
|
|
|
// contains a forwarding address (a heap object pointer in the to space).
|
|
|
|
|
|
|
|
// True if this map word is a forwarding address for a scavenge
|
|
|
|
// collection. Only valid during a scavenge collection (specifically,
|
2012-01-16 12:38:59 +00:00
|
|
|
// when all map words are heap object pointers, i.e. not during a full GC).
|
2016-06-22 12:21:16 +00:00
|
|
|
inline bool IsForwardingAddress() const;
|
2008-07-30 08:49:36 +00:00
|
|
|
|
|
|
|
// Create a map word from a forwarding address.
|
|
|
|
static inline MapWord FromForwardingAddress(HeapObject* object);
|
|
|
|
|
|
|
|
// View this map word as a forwarding address.
|
|
|
|
inline HeapObject* ToForwardingAddress();
|
|
|
|
|
2011-09-19 18:36:47 +00:00
|
|
|
static inline MapWord FromRawValue(uintptr_t value) {
|
|
|
|
return MapWord(value);
|
|
|
|
}
|
2008-07-30 08:49:36 +00:00
|
|
|
|
2011-09-19 18:36:47 +00:00
|
|
|
inline uintptr_t ToRawValue() {
|
|
|
|
return value_;
|
|
|
|
}
|
2009-07-09 11:13:08 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
// HeapObject calls the private constructor and directly reads the value.
|
|
|
|
friend class HeapObject;
|
|
|
|
|
|
|
|
explicit MapWord(uintptr_t value) : value_(value) {}
|
|
|
|
|
|
|
|
uintptr_t value_;
|
2008-07-30 08:49:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// HeapObject is the superclass for all classes describing heap allocated
|
|
|
|
// objects.
|
2013-08-20 10:52:23 +00:00
|
|
|
class HeapObject: public Object {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
2008-07-30 08:49:36 +00:00
|
|
|
// [map]: Contains a map which contains the object's reflective
|
|
|
|
// information.
|
2014-06-20 10:31:17 +00:00
|
|
|
inline Map* map() const;
|
2008-07-03 15:10:15 +00:00
|
|
|
inline void set_map(Map* value);
|
2017-05-05 17:41:44 +00:00
|
|
|
|
2018-10-23 23:02:20 +00:00
|
|
|
inline ObjectSlot map_slot();
|
2017-05-05 17:41:44 +00:00
|
|
|
|
2011-12-07 08:43:18 +00:00
|
|
|
// The no-write-barrier version. This is OK if the object is white and in
|
|
|
|
// new space, or if the value is an immortal immutable object, like the maps
|
|
|
|
// of primitive (non-JS) objects like strings, heap numbers etc.
|
|
|
|
inline void set_map_no_write_barrier(Map* value);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-03-31 14:29:01 +00:00
|
|
|
// Get the map using acquire load.
|
2017-07-03 13:29:23 +00:00
|
|
|
inline Map* synchronized_map() const;
|
2014-06-20 10:31:17 +00:00
|
|
|
inline MapWord synchronized_map_word() const;
|
2014-03-31 14:29:01 +00:00
|
|
|
|
|
|
|
// Set the map using release store
|
|
|
|
inline void synchronized_set_map(Map* value);
|
|
|
|
inline void synchronized_set_map_word(MapWord map_word);
|
|
|
|
|
2017-05-18 19:24:22 +00:00
|
|
|
// Initialize the map immediately after the object is allocated.
|
|
|
|
// Do not use this outside Heap.
|
|
|
|
inline void set_map_after_allocation(
|
|
|
|
Map* value, WriteBarrierMode mode = UPDATE_WRITE_BARRIER);
|
|
|
|
|
2008-07-30 08:49:36 +00:00
|
|
|
// During garbage collection, the map word of a heap object does not
|
|
|
|
// necessarily contain a map pointer.
|
2014-06-20 10:31:17 +00:00
|
|
|
inline MapWord map_word() const;
|
2008-07-30 08:49:36 +00:00
|
|
|
inline void set_map_word(MapWord map_word);
|
|
|
|
|
2018-07-03 08:37:51 +00:00
|
|
|
// TODO(v8:7464): Once RO_SPACE is shared between isolates, this method can be
|
|
|
|
// removed as ReadOnlyRoots will be accessible from a global variable. For now
|
|
|
|
// this method exists to help remove GetIsolate/GetHeap from HeapObject, in a
|
|
|
|
// way that doesn't require passing Isolate/Heap down huge call chains or to
|
|
|
|
// places where it might not be safe to access it.
|
|
|
|
inline ReadOnlyRoots GetReadOnlyRoots() const;
|
|
|
|
|
2018-06-22 11:19:13 +00:00
|
|
|
#define IS_TYPE_FUNCTION_DECL(Type) V8_INLINE bool Is##Type() const;
|
2016-02-16 12:57:29 +00:00
|
|
|
HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DECL)
|
2016-06-14 10:08:44 +00:00
|
|
|
#undef IS_TYPE_FUNCTION_DECL
|
|
|
|
|
2018-06-22 11:19:13 +00:00
|
|
|
V8_INLINE bool IsExternal(Isolate* isolate) const;
|
2018-06-20 16:32:59 +00:00
|
|
|
|
2018-07-05 09:02:40 +00:00
|
|
|
// Oddball checks are faster when they are raw pointer comparisons, so the
|
|
|
|
// isolate/read-only roots overloads should be preferred where possible.
|
|
|
|
#define IS_TYPE_FUNCTION_DECL(Type, Value) \
|
|
|
|
V8_INLINE bool Is##Type(Isolate* isolate) const; \
|
|
|
|
V8_INLINE bool Is##Type(ReadOnlyRoots roots) const; \
|
|
|
|
V8_INLINE bool Is##Type() const;
|
2016-02-16 12:57:29 +00:00
|
|
|
ODDBALL_LIST(IS_TYPE_FUNCTION_DECL)
|
|
|
|
#undef IS_TYPE_FUNCTION_DECL
|
2016-06-14 10:08:44 +00:00
|
|
|
|
2018-06-22 11:19:13 +00:00
|
|
|
V8_INLINE bool IsNullOrUndefined(Isolate* isolate) const;
|
2018-07-05 09:02:40 +00:00
|
|
|
V8_INLINE bool IsNullOrUndefined(ReadOnlyRoots roots) const;
|
2018-06-22 11:19:13 +00:00
|
|
|
V8_INLINE bool IsNullOrUndefined() const;
|
2018-06-12 09:16:35 +00:00
|
|
|
|
2018-06-22 11:19:13 +00:00
|
|
|
#define DECL_STRUCT_PREDICATE(NAME, Name, name) V8_INLINE bool Is##Name() const;
|
2017-06-29 13:14:20 +00:00
|
|
|
STRUCT_LIST(DECL_STRUCT_PREDICATE)
|
|
|
|
#undef DECL_STRUCT_PREDICATE
|
2016-02-16 12:57:29 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Converts an address to a HeapObject pointer.
|
2015-08-13 11:49:01 +00:00
|
|
|
static inline HeapObject* FromAddress(Address address) {
|
|
|
|
DCHECK_TAG_ALIGNED(address);
|
|
|
|
return reinterpret_cast<HeapObject*>(address + kHeapObjectTag);
|
|
|
|
}
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Returns the address of this HeapObject.
|
2017-07-03 13:29:23 +00:00
|
|
|
inline Address address() const {
|
2018-04-13 22:28:05 +00:00
|
|
|
return reinterpret_cast<Address>(this) - kHeapObjectTag;
|
2015-08-13 11:49:01 +00:00
|
|
|
}
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-11-13 12:32:08 +00:00
|
|
|
// Iterates over pointers contained in the object (including the Map).
|
|
|
|
// If it's not performance critical iteration use the non-templatized
|
|
|
|
// version.
|
2008-07-03 15:10:15 +00:00
|
|
|
void Iterate(ObjectVisitor* v);
|
|
|
|
|
2015-11-13 12:32:08 +00:00
|
|
|
template <typename ObjectVisitor>
|
|
|
|
inline void IterateFast(ObjectVisitor* v);
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Iterates over all pointers contained in the object except the
|
|
|
|
// first map pointer. The object type is given in the first
|
|
|
|
// parameter. This function does not access the map pointer in the
|
|
|
|
// object, and so is safe to call while the map pointer is modified.
|
2015-11-13 12:32:08 +00:00
|
|
|
// If it's not performance critical iteration use the non-templatized
|
|
|
|
// version.
|
|
|
|
void IterateBody(ObjectVisitor* v);
|
2018-03-26 11:03:28 +00:00
|
|
|
void IterateBody(Map* map, int object_size, ObjectVisitor* v);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-11-13 12:32:08 +00:00
|
|
|
template <typename ObjectVisitor>
|
|
|
|
inline void IterateBodyFast(ObjectVisitor* v);
|
|
|
|
|
|
|
|
template <typename ObjectVisitor>
|
2018-03-26 11:03:28 +00:00
|
|
|
inline void IterateBodyFast(Map* map, int object_size, ObjectVisitor* v);
|
2015-11-13 12:32:08 +00:00
|
|
|
|
|
|
|
// Returns true if the object contains a tagged value at given offset.
|
|
|
|
// It is used for invalid slots filtering. If the offset points outside
|
|
|
|
// of the object or to the map word, the result is UNDEFINED (!!!).
|
2018-03-26 11:03:28 +00:00
|
|
|
bool IsValidSlot(Map* map, int offset);
|
2015-11-13 12:32:08 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Returns the heap object's size in bytes
|
2017-07-03 13:29:23 +00:00
|
|
|
inline int Size() const;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Given a heap object's map pointer, returns the heap size in bytes
|
|
|
|
// Useful when the map pointer field is used for other purposes.
|
|
|
|
// GC internal.
|
2017-07-03 13:29:23 +00:00
|
|
|
inline int SizeFromMap(Map* map) const;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2008-10-29 10:37:14 +00:00
|
|
|
// Returns the field at offset in obj, as a read/write Object* reference.
|
|
|
|
// Does no checking, and is safe to use during GC, while maps are invalid.
|
2010-05-27 12:30:45 +00:00
|
|
|
// Does not invoke write barrier, so should only be assigned to
|
2008-10-29 10:37:14 +00:00
|
|
|
// during marking GC.
|
2018-10-24 01:44:19 +00:00
|
|
|
inline ObjectSlot RawField(int byte_offset) const;
|
2018-10-23 23:02:20 +00:00
|
|
|
static inline ObjectSlot RawField(const HeapObject* obj, int offset);
|
2018-10-24 01:44:19 +00:00
|
|
|
inline MaybeObjectSlot RawMaybeWeakField(int byte_offset) const;
|
2018-10-23 23:02:20 +00:00
|
|
|
static inline MaybeObjectSlot RawMaybeWeakField(HeapObject* obj, int offset);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_CAST(HeapObject)
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2010-01-29 11:46:55 +00:00
|
|
|
// Return the write barrier mode for this. Callers of this function
|
2013-06-10 16:31:55 +00:00
|
|
|
// must be able to present a reference to an DisallowHeapAllocation
|
2010-01-29 11:46:55 +00:00
|
|
|
// object as a sign that they are not going to use this function
|
|
|
|
// from code that allocates and thus invalidates the returned write
|
|
|
|
// barrier mode.
|
2013-06-03 15:32:22 +00:00
|
|
|
inline WriteBarrierMode GetWriteBarrierMode(
|
|
|
|
const DisallowHeapAllocation& promise);
|
2008-10-23 08:46:32 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Dispatched behavior.
|
2014-09-30 10:29:32 +00:00
|
|
|
void HeapObjectShortPrint(std::ostream& os); // NOLINT
|
2010-12-20 10:38:19 +00:00
|
|
|
#ifdef OBJECT_PRINT
|
2014-09-30 10:29:32 +00:00
|
|
|
void PrintHeader(std::ostream& os, const char* id); // NOLINT
|
2010-12-20 10:38:19 +00:00
|
|
|
#endif
|
2018-07-12 10:06:42 +00:00
|
|
|
DECL_PRINTER(HeapObject)
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_VERIFIER(HeapObject)
|
2012-10-12 11:41:14 +00:00
|
|
|
#ifdef VERIFY_HEAP
|
2018-07-17 13:28:38 +00:00
|
|
|
inline void VerifyObjectField(Isolate* isolate, int offset);
|
2010-05-27 12:30:45 +00:00
|
|
|
inline void VerifySmiField(int offset);
|
2018-07-17 13:28:38 +00:00
|
|
|
inline void VerifyMaybeObjectField(Isolate* isolate, int offset);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Verify a pointer is a valid HeapObject pointer that points to object
|
|
|
|
// areas in the heap.
|
2018-07-17 13:28:38 +00:00
|
|
|
static void VerifyHeapPointer(Isolate* isolate, Object* p);
|
2008-07-03 15:10:15 +00:00
|
|
|
#endif
|
|
|
|
|
2018-02-27 10:07:26 +00:00
|
|
|
static inline AllocationAlignment RequiredAlignment(Map* map);
|
2014-11-27 09:22:10 +00:00
|
|
|
|
2017-11-07 06:50:22 +00:00
|
|
|
// Whether the object needs rehashing. That is the case if the object's
|
|
|
|
// content depends on FLAG_hash_seed. When the object is deserialized into
|
|
|
|
// a heap with a different hash seed, these objects need to adapt.
|
|
|
|
inline bool NeedsRehashing() const;
|
|
|
|
|
|
|
|
// Rehashing support is not implemented for all objects that need rehashing.
|
|
|
|
// With objects that need rehashing but cannot be rehashed, rehashing has to
|
|
|
|
// be disabled.
|
|
|
|
bool CanBeRehashed() const;
|
|
|
|
|
|
|
|
// Rehash the object based on the layout inferred from its map.
|
2018-07-12 11:04:18 +00:00
|
|
|
void RehashBasedOnMap(Isolate* isolate);
|
2017-11-07 06:50:22 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Layout description.
|
|
|
|
// First field in a heap object is map.
|
2008-09-23 11:45:43 +00:00
|
|
|
static const int kMapOffset = Object::kHeaderSize;
|
|
|
|
static const int kHeaderSize = kMapOffset + kPointerSize;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-05-27 13:43:29 +00:00
|
|
|
STATIC_ASSERT(kMapOffset == Internals::kHeapObjectMapOffset);
|
2009-08-26 10:33:11 +00:00
|
|
|
|
2018-07-16 13:28:49 +00:00
|
|
|
inline Address GetFieldAddress(int field_offset) const;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
private:
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(HeapObject);
|
|
|
|
};
|
|
|
|
|
2018-06-19 10:11:40 +00:00
|
|
|
// Mixin class for objects that can never be in RO space.
|
|
|
|
// TODO(leszeks): Add checks in the factory that we never allocate these objects
|
|
|
|
// in RO space.
|
|
|
|
class NeverReadOnlySpaceObject {
|
|
|
|
public:
|
|
|
|
// The Heap the object was allocated in. Used also to access Isolate.
|
|
|
|
inline Heap* GetHeap() const;
|
|
|
|
|
|
|
|
// Convenience method to get current isolate.
|
|
|
|
inline Isolate* GetIsolate() const;
|
|
|
|
};
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-11-05 14:02:35 +00:00
|
|
|
template <int start_offset, int end_offset, int size>
|
2015-11-13 12:32:08 +00:00
|
|
|
class FixedBodyDescriptor;
|
2010-08-11 14:30:14 +00:00
|
|
|
|
2015-11-05 14:02:35 +00:00
|
|
|
template <int start_offset>
|
2015-11-13 12:32:08 +00:00
|
|
|
class FlexibleBodyDescriptor;
|
2015-11-05 14:02:35 +00:00
|
|
|
|
[sfi] Remove SFI function identifier field
Remove the function identifier field from SharedFunctionInfo. This field
would store one of a) the function's inferred name, b) the "builtin
function id", or c) debug info. We remove these in turn:
a) The function's inferred name is available on the ScopeInfo, so like
the start/end position we read it off either the ScopeInfo (for
compiled functions) or the UncompiledData (for uncompiled functions).
As a side-effect, now both UncompiledData and its subclass,
UncompiledDataWithPreparsedScope, contain a pointer field. To keep
BodyDescriptors manageable, we introduce a SubclassBodyDescriptor
which effectively appends two BodyDescriptors together.
b) The builtin function id is < 255, so we can steal a byte from
expected no. of properies (also <255) and store these together.
Eventually we want to get rid of this field and use the builtin ID,
but this is pending JS builtin removal.
As a side-effect, BuiltinFunctionId becomes an enum class (for better
storage size guarantees).
c) The debug info can hang off anything (since it stores the field it
replaces), so we can attach it to the script field instead.
This saves a word on compiled function (uncompiled functions
unfortunately still have to store it in UncompiledData).
Bug: chromium:818642
Change-Id: I8b4b3a070f0fe328aafcaeac58842d144d12d996
Reviewed-on: https://chromium-review.googlesource.com/1138328
Reviewed-by: Yang Guo <yangguo@chromium.org>
Reviewed-by: Ulan Degenbaev <ulan@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54543}
2018-07-18 15:11:31 +00:00
|
|
|
template <class ParentBodyDescriptor, class ChildBodyDescriptor>
|
|
|
|
class SubclassBodyDescriptor;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// The HeapNumber class describes heap allocated numbers that cannot be
|
2018-06-26 11:01:19 +00:00
|
|
|
// represented in a Smi (small integer). MutableHeapNumber is the same, but its
|
|
|
|
// number value can change over time (it is used only as property storage).
|
|
|
|
// HeapNumberBase merely exists to avoid code duplication.
|
|
|
|
class HeapNumberBase : public HeapObject {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
|
|
|
// [value]: number value.
|
2014-06-24 09:47:25 +00:00
|
|
|
inline double value() const;
|
2008-07-03 15:10:15 +00:00
|
|
|
inline void set_value(double value);
|
|
|
|
|
2017-01-23 18:18:48 +00:00
|
|
|
inline uint64_t value_as_bits() const;
|
|
|
|
inline void set_value_as_bits(uint64_t bits);
|
|
|
|
|
2010-03-18 13:00:57 +00:00
|
|
|
inline int get_exponent();
|
|
|
|
inline int get_sign();
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// Layout description.
|
2008-09-23 11:45:43 +00:00
|
|
|
static const int kValueOffset = HeapObject::kHeaderSize;
|
2009-06-10 10:20:37 +00:00
|
|
|
// IEEE doubles are two 32 bit words. The first is just mantissa, the second
|
2014-04-15 16:39:21 +00:00
|
|
|
// is a mixture of sign, exponent and mantissa. The offsets of two 32 bit
|
|
|
|
// words within double numbers are endian dependent and they are set
|
|
|
|
// accordingly.
|
|
|
|
#if defined(V8_TARGET_LITTLE_ENDIAN)
|
2009-06-10 10:20:37 +00:00
|
|
|
static const int kMantissaOffset = kValueOffset;
|
|
|
|
static const int kExponentOffset = kValueOffset + 4;
|
2014-04-15 16:39:21 +00:00
|
|
|
#elif defined(V8_TARGET_BIG_ENDIAN)
|
|
|
|
static const int kMantissaOffset = kValueOffset + 4;
|
|
|
|
static const int kExponentOffset = kValueOffset;
|
|
|
|
#else
|
|
|
|
#error Unknown byte ordering
|
|
|
|
#endif
|
2011-04-11 09:04:30 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
static const int kSize = kValueOffset + kDoubleSize;
|
2009-06-10 10:20:37 +00:00
|
|
|
static const uint32_t kSignMask = 0x80000000u;
|
|
|
|
static const uint32_t kExponentMask = 0x7ff00000u;
|
|
|
|
static const uint32_t kMantissaMask = 0xfffffu;
|
2010-05-03 10:43:49 +00:00
|
|
|
static const int kMantissaBits = 52;
|
2010-06-14 11:20:36 +00:00
|
|
|
static const int kExponentBits = 11;
|
2009-06-10 10:20:37 +00:00
|
|
|
static const int kExponentBias = 1023;
|
|
|
|
static const int kExponentShift = 20;
|
2013-04-09 08:42:57 +00:00
|
|
|
static const int kInfinityOrNanExponent =
|
|
|
|
(kExponentMask >> kExponentShift) - kExponentBias;
|
2009-06-10 10:20:37 +00:00
|
|
|
static const int kMantissaBitsInTopWord = 20;
|
|
|
|
static const int kNonMantissaBitsInTopWord = 12;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
private:
|
2018-06-26 11:01:19 +00:00
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumberBase)
|
|
|
|
};
|
|
|
|
|
|
|
|
class HeapNumber : public HeapNumberBase {
|
|
|
|
public:
|
|
|
|
DECL_CAST(HeapNumber)
|
|
|
|
V8_EXPORT_PRIVATE void HeapNumberPrint(std::ostream& os);
|
|
|
|
|
|
|
|
private:
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(HeapNumber)
|
|
|
|
};
|
|
|
|
|
|
|
|
class MutableHeapNumber : public HeapNumberBase {
|
|
|
|
public:
|
|
|
|
DECL_CAST(MutableHeapNumber)
|
|
|
|
V8_EXPORT_PRIVATE void MutableHeapNumberPrint(std::ostream& os);
|
|
|
|
|
|
|
|
private:
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(MutableHeapNumber)
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2011-12-09 08:50:19 +00:00
|
|
|
enum EnsureElementsMode {
|
|
|
|
DONT_ALLOW_DOUBLE_ELEMENTS,
|
|
|
|
ALLOW_COPIED_DOUBLE_ELEMENTS,
|
|
|
|
ALLOW_CONVERTED_DOUBLE_ELEMENTS
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2012-03-05 12:11:28 +00:00
|
|
|
// Indicator for one component of an AccessorPair.
|
|
|
|
enum AccessorComponent {
|
|
|
|
ACCESSOR_GETTER,
|
|
|
|
ACCESSOR_SETTER
|
|
|
|
};
|
|
|
|
|
2018-02-12 12:50:50 +00:00
|
|
|
enum class GetKeysConversion {
|
|
|
|
kKeepNumbers = static_cast<int>(v8::KeyConversionMode::kKeepNumbers),
|
|
|
|
kConvertToString = static_cast<int>(v8::KeyConversionMode::kConvertToString)
|
|
|
|
};
|
2012-03-05 12:11:28 +00:00
|
|
|
|
2016-05-30 15:52:56 +00:00
|
|
|
enum class KeyCollectionMode {
|
|
|
|
kOwnOnly = static_cast<int>(v8::KeyCollectionMode::kOwnOnly),
|
|
|
|
kIncludePrototypes =
|
|
|
|
static_cast<int>(v8::KeyCollectionMode::kIncludePrototypes)
|
|
|
|
};
|
2015-10-19 13:47:24 +00:00
|
|
|
|
2015-01-27 14:56:51 +00:00
|
|
|
// FreeSpace are fixed-size free memory blocks used by the heap and GC.
|
|
|
|
// They look like heap objects (are heap object tagged and have a map) so that
|
|
|
|
// the heap remains iterable. They have a size and a next pointer.
|
|
|
|
// The next pointer is the raw address of the next FreeSpace object (or NULL)
|
|
|
|
// in the free list.
|
2013-08-20 10:52:23 +00:00
|
|
|
class FreeSpace: public HeapObject {
|
2011-09-19 18:36:47 +00:00
|
|
|
public:
|
|
|
|
// [size]: size of the free space including the header.
|
2014-06-20 10:31:17 +00:00
|
|
|
inline int size() const;
|
2011-09-19 18:36:47 +00:00
|
|
|
inline void set_size(int value);
|
|
|
|
|
2017-05-30 07:44:37 +00:00
|
|
|
inline int relaxed_read_size() const;
|
|
|
|
inline void relaxed_write_size(int value);
|
2014-04-08 16:31:57 +00:00
|
|
|
|
2015-08-13 11:49:01 +00:00
|
|
|
inline int Size();
|
2011-09-19 18:36:47 +00:00
|
|
|
|
2015-01-27 14:56:51 +00:00
|
|
|
// Accessors for the next field.
|
|
|
|
inline FreeSpace* next();
|
|
|
|
inline void set_next(FreeSpace* next);
|
|
|
|
|
|
|
|
inline static FreeSpace* cast(HeapObject* obj);
|
2011-09-19 18:36:47 +00:00
|
|
|
|
2012-12-13 10:17:37 +00:00
|
|
|
// Dispatched behavior.
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_PRINTER(FreeSpace)
|
|
|
|
DECL_VERIFIER(FreeSpace)
|
2011-09-19 18:36:47 +00:00
|
|
|
|
|
|
|
// Layout description.
|
|
|
|
// Size is smi tagged when it is stored.
|
|
|
|
static const int kSizeOffset = HeapObject::kHeaderSize;
|
2015-01-27 14:56:51 +00:00
|
|
|
static const int kNextOffset = POINTER_SIZE_ALIGN(kSizeOffset + kPointerSize);
|
2016-09-06 11:02:21 +00:00
|
|
|
static const int kSize = kNextOffset + kPointerSize;
|
2011-09-19 18:36:47 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(FreeSpace);
|
|
|
|
};
|
|
|
|
|
2015-04-27 12:59:55 +00:00
|
|
|
class PrototypeInfo;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// An abstract superclass, a marker class really, for simple structure classes.
|
2011-05-13 10:58:25 +00:00
|
|
|
// It doesn't carry much functionality but allows struct classes to be
|
2008-07-03 15:10:15 +00:00
|
|
|
// identified in the type system.
|
|
|
|
class Struct: public HeapObject {
|
|
|
|
public:
|
|
|
|
inline void InitializeBody(int object_size);
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_CAST(Struct)
|
2017-08-24 13:53:20 +00:00
|
|
|
void BriefPrintDetails(std::ostream& os);
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2017-10-23 08:23:37 +00:00
|
|
|
class Tuple2 : public Struct {
|
|
|
|
public:
|
|
|
|
DECL_ACCESSORS(value1, Object)
|
|
|
|
DECL_ACCESSORS(value2, Object)
|
|
|
|
|
|
|
|
DECL_CAST(Tuple2)
|
|
|
|
|
|
|
|
// Dispatched behavior.
|
|
|
|
DECL_PRINTER(Tuple2)
|
|
|
|
DECL_VERIFIER(Tuple2)
|
|
|
|
void BriefPrintDetails(std::ostream& os);
|
|
|
|
|
|
|
|
static const int kValue1Offset = HeapObject::kHeaderSize;
|
|
|
|
static const int kValue2Offset = kValue1Offset + kPointerSize;
|
|
|
|
static const int kSize = kValue2Offset + kPointerSize;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple2);
|
|
|
|
};
|
|
|
|
|
|
|
|
class Tuple3 : public Tuple2 {
|
|
|
|
public:
|
|
|
|
DECL_ACCESSORS(value3, Object)
|
|
|
|
|
|
|
|
DECL_CAST(Tuple3)
|
|
|
|
|
|
|
|
// Dispatched behavior.
|
|
|
|
DECL_PRINTER(Tuple3)
|
|
|
|
DECL_VERIFIER(Tuple3)
|
|
|
|
void BriefPrintDetails(std::ostream& os);
|
|
|
|
|
|
|
|
static const int kValue3Offset = Tuple2::kSize;
|
|
|
|
static const int kSize = kValue3Offset + kPointerSize;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Tuple3);
|
|
|
|
};
|
|
|
|
|
[async-iteration] implement AsyncGenerator
- Introduce new struct AsyncGeneratorRequest, which holds
information pertinent to resuming execution of an
AsyncGenerator, such as the Promise associated with the async
generator request. It is intended to be used as a singly
linked list, and holds a pointer to the next item in te queue.
- Introduce JSAsyncGeneratorObject (subclass of
JSGeneratorObject), which includes several new internal fields
(`queue` which contains a singly linked list of
AsyncGeneratorRequest objects, and `await_input` which
contains the sent value from an Await expression (This is
necessary to prevent function.sent (used by yield*) from
having the sent value observably overwritten during
execution).
- Modify SuspendGenerator to accept a set of Flags, which
indicate whether the suspend is for a Yield or Await, and
whether it takes place on an async generator or ES6
generator.
- Introduce interpreter intrinsics and TF intrinsic lowering for
accessing the await input of an async generator
- Modify the JSGeneratorStore operator to understand whether or
not it's suspending for a normal yield, or an AsyncGenerator
Await. This ensures appropriate registers are stored.
- Add versions of ResumeGeneratorTrampoline which store the
input value in a different field depending on wether it's an
AsyncGenerator Await resume, or an ordinary resume. Also modifies
whether debug code will assert that the generator object is a
JSGeneratorObject or a JSAsyncGeneratorObject depending on the
resume type.
BUG=v8:5855
R=bmeurer@chromium.org, rmcilroy@chromium.org, jgruber@chromium.org,
littledan@chromium.org, neis@chromium.org
TBR=marja@chromium.org
Change-Id: I9d58df1d344465fc937fe7eed322424204497187
Reviewed-on: https://chromium-review.googlesource.com/446961
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44240}
2017-03-29 13:41:45 +00:00
|
|
|
class AsyncGeneratorRequest : public Struct {
|
|
|
|
public:
|
|
|
|
// Holds an AsyncGeneratorRequest, or Undefined.
|
|
|
|
DECL_ACCESSORS(next, Object)
|
|
|
|
DECL_INT_ACCESSORS(resume_mode)
|
|
|
|
DECL_ACCESSORS(value, Object)
|
|
|
|
DECL_ACCESSORS(promise, Object)
|
|
|
|
|
|
|
|
static const int kNextOffset = Struct::kHeaderSize;
|
|
|
|
static const int kResumeModeOffset = kNextOffset + kPointerSize;
|
|
|
|
static const int kValueOffset = kResumeModeOffset + kPointerSize;
|
|
|
|
static const int kPromiseOffset = kValueOffset + kPointerSize;
|
|
|
|
static const int kSize = kPromiseOffset + kPointerSize;
|
|
|
|
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_CAST(AsyncGeneratorRequest)
|
|
|
|
DECL_PRINTER(AsyncGeneratorRequest)
|
|
|
|
DECL_VERIFIER(AsyncGeneratorRequest)
|
[async-iteration] implement AsyncGenerator
- Introduce new struct AsyncGeneratorRequest, which holds
information pertinent to resuming execution of an
AsyncGenerator, such as the Promise associated with the async
generator request. It is intended to be used as a singly
linked list, and holds a pointer to the next item in te queue.
- Introduce JSAsyncGeneratorObject (subclass of
JSGeneratorObject), which includes several new internal fields
(`queue` which contains a singly linked list of
AsyncGeneratorRequest objects, and `await_input` which
contains the sent value from an Await expression (This is
necessary to prevent function.sent (used by yield*) from
having the sent value observably overwritten during
execution).
- Modify SuspendGenerator to accept a set of Flags, which
indicate whether the suspend is for a Yield or Await, and
whether it takes place on an async generator or ES6
generator.
- Introduce interpreter intrinsics and TF intrinsic lowering for
accessing the await input of an async generator
- Modify the JSGeneratorStore operator to understand whether or
not it's suspending for a normal yield, or an AsyncGenerator
Await. This ensures appropriate registers are stored.
- Add versions of ResumeGeneratorTrampoline which store the
input value in a different field depending on wether it's an
AsyncGenerator Await resume, or an ordinary resume. Also modifies
whether debug code will assert that the generator object is a
JSGeneratorObject or a JSAsyncGeneratorObject depending on the
resume type.
BUG=v8:5855
R=bmeurer@chromium.org, rmcilroy@chromium.org, jgruber@chromium.org,
littledan@chromium.org, neis@chromium.org
TBR=marja@chromium.org
Change-Id: I9d58df1d344465fc937fe7eed322424204497187
Reviewed-on: https://chromium-review.googlesource.com/446961
Commit-Queue: Caitlin Potter <caitp@igalia.com>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#44240}
2017-03-29 13:41:45 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(AsyncGeneratorRequest);
|
|
|
|
};
|
|
|
|
|
2009-09-30 12:25:46 +00:00
|
|
|
// 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.
|
2018-09-06 09:08:10 +00:00
|
|
|
class Relocatable {
|
2009-10-01 06:27:29 +00:00
|
|
|
public:
|
2011-03-18 20:35:07 +00:00
|
|
|
explicit inline Relocatable(Isolate* isolate);
|
|
|
|
inline virtual ~Relocatable();
|
2017-04-25 13:32:18 +00:00
|
|
|
virtual void IterateInstance(RootVisitor* v) {}
|
2009-09-30 12:25:46 +00:00
|
|
|
virtual void PostGarbageCollection() { }
|
|
|
|
|
2013-09-04 10:34:42 +00:00
|
|
|
static void PostGarbageCollectionProcessing(Isolate* isolate);
|
2013-09-04 11:09:55 +00:00
|
|
|
static int ArchiveSpacePerThread();
|
2011-05-05 18:55:31 +00:00
|
|
|
static char* ArchiveState(Isolate* isolate, char* to);
|
|
|
|
static char* RestoreState(Isolate* isolate, char* from);
|
2017-04-25 13:32:18 +00:00
|
|
|
static void Iterate(Isolate* isolate, RootVisitor* v);
|
|
|
|
static void Iterate(RootVisitor* v, Relocatable* top);
|
|
|
|
static char* Iterate(RootVisitor* v, char* t);
|
2013-09-04 10:34:42 +00:00
|
|
|
|
2009-10-01 06:27:29 +00:00
|
|
|
private:
|
2011-03-18 20:35:07 +00:00
|
|
|
Isolate* isolate_;
|
2009-09-30 12:25:46 +00:00
|
|
|
Relocatable* prev_;
|
|
|
|
};
|
|
|
|
|
2008-10-09 08:08:04 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// The Oddball describes objects null, undefined, true, and false.
|
2013-08-20 10:52:23 +00:00
|
|
|
class Oddball: public HeapObject {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
2016-04-25 09:16:57 +00:00
|
|
|
// [to_number_raw]: Cached raw to_number computed at startup.
|
|
|
|
inline double to_number_raw() const;
|
|
|
|
inline void set_to_number_raw(double value);
|
2017-04-12 10:10:48 +00:00
|
|
|
inline void set_to_number_raw_as_bits(uint64_t bits);
|
2016-04-25 09:16:57 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
// [to_string]: Cached to_string computed at startup.
|
|
|
|
DECL_ACCESSORS(to_string, String)
|
|
|
|
|
|
|
|
// [to_number]: Cached to_number computed at startup.
|
|
|
|
DECL_ACCESSORS(to_number, Object)
|
|
|
|
|
2015-08-11 10:47:24 +00:00
|
|
|
// [typeof]: Cached type_of computed at startup.
|
|
|
|
DECL_ACCESSORS(type_of, String)
|
|
|
|
|
2014-06-24 09:47:25 +00:00
|
|
|
inline byte kind() const;
|
2011-03-18 20:35:07 +00:00
|
|
|
inline void set_kind(byte kind);
|
|
|
|
|
2015-09-15 13:14:36 +00:00
|
|
|
// ES6 section 7.1.3 ToNumber for Boolean, Null, Undefined.
|
2018-04-09 15:12:07 +00:00
|
|
|
V8_WARN_UNUSED_RESULT static inline Handle<Object> ToNumber(
|
2018-07-11 11:49:07 +00:00
|
|
|
Isolate* isolate, Handle<Oddball> input);
|
2015-09-15 13:14:36 +00:00
|
|
|
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_CAST(Oddball)
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Dispatched behavior.
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_VERIFIER(Oddball)
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Initialize the fields.
|
2015-08-11 10:47:24 +00:00
|
|
|
static void Initialize(Isolate* isolate, Handle<Oddball> oddball,
|
|
|
|
const char* to_string, Handle<Object> to_number,
|
2016-07-19 06:13:34 +00:00
|
|
|
const char* type_of, byte kind);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Layout description.
|
2016-04-25 09:16:57 +00:00
|
|
|
static const int kToNumberRawOffset = HeapObject::kHeaderSize;
|
|
|
|
static const int kToStringOffset = kToNumberRawOffset + kDoubleSize;
|
2008-07-03 15:10:15 +00:00
|
|
|
static const int kToNumberOffset = kToStringOffset + kPointerSize;
|
2016-07-19 06:13:34 +00:00
|
|
|
static const int kTypeOfOffset = kToNumberOffset + kPointerSize;
|
2015-08-11 10:47:24 +00:00
|
|
|
static const int kKindOffset = kTypeOfOffset + kPointerSize;
|
2011-03-18 20:35:07 +00:00
|
|
|
static const int kSize = kKindOffset + kPointerSize;
|
|
|
|
|
|
|
|
static const byte kFalse = 0;
|
|
|
|
static const byte kTrue = 1;
|
2017-03-17 15:18:18 +00:00
|
|
|
static const byte kNotBooleanMask = static_cast<byte>(~1);
|
2011-03-18 20:35:07 +00:00
|
|
|
static const byte kTheHole = 2;
|
|
|
|
static const byte kNull = 3;
|
2016-02-16 12:57:29 +00:00
|
|
|
static const byte kArgumentsMarker = 4;
|
2011-03-18 20:35:07 +00:00
|
|
|
static const byte kUndefined = 5;
|
2013-06-06 14:21:35 +00:00
|
|
|
static const byte kUninitialized = 6;
|
|
|
|
static const byte kOther = 7;
|
2014-04-22 07:33:20 +00:00
|
|
|
static const byte kException = 8;
|
2016-03-16 14:30:15 +00:00
|
|
|
static const byte kOptimizedOut = 9;
|
2016-04-28 14:54:39 +00:00
|
|
|
static const byte kStaleRegister = 10;
|
2018-05-02 11:54:25 +00:00
|
|
|
static const byte kSelfReferenceMarker = 10;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2015-08-11 10:47:24 +00:00
|
|
|
typedef FixedBodyDescriptor<kToStringOffset, kTypeOfOffset + kPointerSize,
|
2010-08-11 14:30:14 +00:00
|
|
|
kSize> BodyDescriptor;
|
|
|
|
|
2016-04-25 09:16:57 +00:00
|
|
|
STATIC_ASSERT(kToNumberRawOffset == HeapNumber::kValueOffset);
|
2014-05-27 13:43:29 +00:00
|
|
|
STATIC_ASSERT(kKindOffset == Internals::kOddballKindOffset);
|
|
|
|
STATIC_ASSERT(kNull == Internals::kNullOddballKind);
|
|
|
|
STATIC_ASSERT(kUndefined == Internals::kUndefinedOddballKind);
|
2012-04-18 15:51:34 +00:00
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
private:
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Oddball);
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2013-08-20 10:52:23 +00:00
|
|
|
class Cell: public HeapObject {
|
2009-06-30 10:05:36 +00:00
|
|
|
public:
|
2015-03-18 11:43:51 +00:00
|
|
|
// [value]: value of the cell.
|
2009-06-30 10:05:36 +00:00
|
|
|
DECL_ACCESSORS(value, Object)
|
|
|
|
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_CAST(Cell)
|
2009-06-30 10:05:36 +00:00
|
|
|
|
2013-06-12 15:03:44 +00:00
|
|
|
static inline Cell* FromValueAddress(Address value) {
|
|
|
|
Object* result = FromAddress(value - kValueOffset);
|
|
|
|
return static_cast<Cell*>(result);
|
2012-07-31 09:25:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline Address ValueAddress() {
|
|
|
|
return address() + kValueOffset;
|
|
|
|
}
|
|
|
|
|
2012-12-13 10:17:37 +00:00
|
|
|
// Dispatched behavior.
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_PRINTER(Cell)
|
|
|
|
DECL_VERIFIER(Cell)
|
2012-10-12 11:41:14 +00:00
|
|
|
|
2009-06-30 10:05:36 +00:00
|
|
|
// Layout description.
|
|
|
|
static const int kValueOffset = HeapObject::kHeaderSize;
|
|
|
|
static const int kSize = kValueOffset + kPointerSize;
|
|
|
|
|
2010-08-11 14:30:14 +00:00
|
|
|
typedef FixedBodyDescriptor<kValueOffset,
|
|
|
|
kValueOffset + kPointerSize,
|
|
|
|
kSize> BodyDescriptor;
|
|
|
|
|
2009-06-30 10:05:36 +00:00
|
|
|
private:
|
2013-06-12 15:03:44 +00:00
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Cell);
|
|
|
|
};
|
|
|
|
|
2018-02-22 12:04:01 +00:00
|
|
|
// This is a special cell used to maintain both the link between a
|
|
|
|
// closure and it's feedback vector, as well as a way to count the
|
|
|
|
// number of closures created for a certain function per native
|
|
|
|
// context. There's at most one FeedbackCell for each function in
|
|
|
|
// a native context.
|
|
|
|
class FeedbackCell : public Struct {
|
|
|
|
public:
|
|
|
|
// [value]: value of the cell.
|
|
|
|
DECL_ACCESSORS(value, HeapObject)
|
|
|
|
|
|
|
|
DECL_CAST(FeedbackCell)
|
|
|
|
|
|
|
|
// Dispatched behavior.
|
2018-07-12 10:06:42 +00:00
|
|
|
DECL_PRINTER(FeedbackCell)
|
2018-02-22 12:04:01 +00:00
|
|
|
DECL_VERIFIER(FeedbackCell)
|
|
|
|
|
|
|
|
static const int kValueOffset = HeapObject::kHeaderSize;
|
|
|
|
static const int kSize = kValueOffset + kPointerSize;
|
|
|
|
|
|
|
|
typedef FixedBodyDescriptor<kValueOffset, kValueOffset + kPointerSize, kSize>
|
|
|
|
BodyDescriptor;
|
|
|
|
|
|
|
|
private:
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(FeedbackCell);
|
|
|
|
};
|
2013-06-12 15:03:44 +00:00
|
|
|
|
2015-03-18 12:54:02 +00:00
|
|
|
class PropertyCell : public HeapObject {
|
2013-06-12 15:03:44 +00:00
|
|
|
public:
|
2017-06-27 11:57:13 +00:00
|
|
|
// [name]: the name of the global property.
|
|
|
|
DECL_ACCESSORS(name, Name)
|
2015-06-02 10:29:12 +00:00
|
|
|
// [property_details]: details of the global property.
|
|
|
|
DECL_ACCESSORS(property_details_raw, Object)
|
2015-03-18 11:43:51 +00:00
|
|
|
// [value]: value of the global property.
|
|
|
|
DECL_ACCESSORS(value, Object)
|
2013-06-26 16:17:12 +00:00
|
|
|
// [dependent_code]: dependent code that depends on the type of the global
|
|
|
|
// property.
|
|
|
|
DECL_ACCESSORS(dependent_code, DependentCode)
|
|
|
|
|
2018-07-17 14:20:47 +00:00
|
|
|
inline PropertyDetails property_details() const;
|
2015-08-13 11:49:01 +00:00
|
|
|
inline void set_property_details(PropertyDetails details);
|
2015-06-02 10:29:12 +00:00
|
|
|
|
2015-04-27 14:01:15 +00:00
|
|
|
PropertyCellConstantType GetConstantType();
|
|
|
|
|
2013-10-21 13:55:24 +00:00
|
|
|
// Computes the new type of the cell's contents for the given value, but
|
2015-03-17 13:27:25 +00:00
|
|
|
// without actually modifying the details.
|
2018-06-23 09:07:20 +00:00
|
|
|
static PropertyCellType UpdatedType(Isolate* isolate,
|
|
|
|
Handle<PropertyCell> cell,
|
2015-03-17 13:27:25 +00:00
|
|
|
Handle<Object> value,
|
|
|
|
PropertyDetails details);
|
2016-07-07 12:32:15 +00:00
|
|
|
// Prepares property cell at given entry for receiving given value.
|
|
|
|
// As a result the old cell could be invalidated and/or dependent code could
|
|
|
|
// be deoptimized. Returns the prepared property cell.
|
|
|
|
static Handle<PropertyCell> PrepareForValue(
|
2018-06-23 09:07:20 +00:00
|
|
|
Isolate* isolate, Handle<GlobalDictionary> dictionary, int entry,
|
|
|
|
Handle<Object> value, PropertyDetails details);
|
2015-03-17 13:27:25 +00:00
|
|
|
|
2015-06-01 16:24:59 +00:00
|
|
|
static Handle<PropertyCell> InvalidateEntry(
|
2018-06-23 09:07:20 +00:00
|
|
|
Isolate* isolate, Handle<GlobalDictionary> dictionary, int entry);
|
2013-10-21 13:55:24 +00:00
|
|
|
|
2018-06-23 09:07:20 +00:00
|
|
|
static void SetValueWithInvalidation(Isolate* isolate,
|
|
|
|
Handle<PropertyCell> cell,
|
2015-04-22 10:35:23 +00:00
|
|
|
Handle<Object> new_value);
|
|
|
|
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_CAST(PropertyCell)
|
2013-06-12 15:03:44 +00:00
|
|
|
|
|
|
|
// Dispatched behavior.
|
2018-07-05 09:02:40 +00:00
|
|
|
DECL_PRINTER(PropertyCell)
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_VERIFIER(PropertyCell)
|
2013-06-12 15:03:44 +00:00
|
|
|
|
|
|
|
// Layout description.
|
2015-06-02 10:29:12 +00:00
|
|
|
static const int kDetailsOffset = HeapObject::kHeaderSize;
|
2017-06-27 11:57:13 +00:00
|
|
|
static const int kNameOffset = kDetailsOffset + kPointerSize;
|
|
|
|
static const int kValueOffset = kNameOffset + kPointerSize;
|
2015-03-17 13:27:25 +00:00
|
|
|
static const int kDependentCodeOffset = kValueOffset + kPointerSize;
|
2013-06-26 16:17:12 +00:00
|
|
|
static const int kSize = kDependentCodeOffset + kPointerSize;
|
|
|
|
|
2017-06-27 11:57:13 +00:00
|
|
|
typedef FixedBodyDescriptor<kNameOffset, kSize, kSize> BodyDescriptor;
|
2013-06-26 16:17:12 +00:00
|
|
|
|
2013-06-12 15:03:44 +00:00
|
|
|
private:
|
2013-06-14 16:06:12 +00:00
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(PropertyCell);
|
2009-06-30 10:05:36 +00:00
|
|
|
};
|
|
|
|
|
2011-05-19 11:47:34 +00:00
|
|
|
// Foreign describes objects pointing from JavaScript to C structures.
|
2013-08-20 10:52:23 +00:00
|
|
|
class Foreign: public HeapObject {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
2011-05-19 11:47:34 +00:00
|
|
|
// [address]: field containing the address.
|
2011-10-28 12:37:29 +00:00
|
|
|
inline Address foreign_address();
|
2017-12-08 13:54:55 +00:00
|
|
|
|
|
|
|
static inline bool IsNormalized(Object* object);
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_CAST(Foreign)
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2012-12-13 10:17:37 +00:00
|
|
|
// Dispatched behavior.
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_PRINTER(Foreign)
|
|
|
|
DECL_VERIFIER(Foreign)
|
2008-07-03 15:10:15 +00:00
|
|
|
|
|
|
|
// Layout description.
|
|
|
|
|
2011-10-28 12:37:29 +00:00
|
|
|
static const int kForeignAddressOffset = HeapObject::kHeaderSize;
|
|
|
|
static const int kSize = kForeignAddressOffset + kPointerSize;
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2014-05-27 13:43:29 +00:00
|
|
|
STATIC_ASSERT(kForeignAddressOffset == Internals::kForeignAddressOffset);
|
2009-08-26 10:33:11 +00:00
|
|
|
|
2015-11-13 12:32:08 +00:00
|
|
|
class BodyDescriptor;
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
private:
|
2018-04-09 19:11:22 +00:00
|
|
|
friend class Factory;
|
2017-12-08 13:54:55 +00:00
|
|
|
friend class SerializerDeserializer;
|
|
|
|
friend class StartupSerializer;
|
|
|
|
|
|
|
|
inline void set_foreign_address(Address value);
|
|
|
|
|
2011-05-19 11:47:34 +00:00
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(Foreign);
|
2008-07-03 15:10:15 +00:00
|
|
|
};
|
|
|
|
|
2012-01-10 16:11:33 +00:00
|
|
|
// Support for JavaScript accessors: A pair of a getter and a setter. Each
|
|
|
|
// accessor can either be
|
2017-08-25 10:40:07 +00:00
|
|
|
// * a JavaScript function or proxy: a real accessor
|
|
|
|
// * a FunctionTemplateInfo: a real (lazy) accessor
|
2012-01-10 16:11:33 +00:00
|
|
|
// * undefined: considered an accessor by the spec, too, strangely enough
|
2017-08-25 10:40:07 +00:00
|
|
|
// * null: an accessor which has not been set
|
2013-08-20 10:52:23 +00:00
|
|
|
class AccessorPair: public Struct {
|
2012-01-10 16:11:33 +00:00
|
|
|
public:
|
|
|
|
DECL_ACCESSORS(getter, Object)
|
|
|
|
DECL_ACCESSORS(setter, Object)
|
|
|
|
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_CAST(AccessorPair)
|
2012-01-10 16:11:33 +00:00
|
|
|
|
2018-07-13 09:32:35 +00:00
|
|
|
static Handle<AccessorPair> Copy(Isolate* isolate, Handle<AccessorPair> pair);
|
2012-02-13 14:15:43 +00:00
|
|
|
|
2015-08-13 11:49:01 +00:00
|
|
|
inline Object* get(AccessorComponent component);
|
|
|
|
inline void set(AccessorComponent component, Object* value);
|
2012-05-24 10:40:24 +00:00
|
|
|
|
2017-08-25 10:40:07 +00:00
|
|
|
// Note: Returns undefined if the component is not set.
|
2018-07-13 09:32:35 +00:00
|
|
|
static Handle<Object> GetComponent(Isolate* isolate,
|
|
|
|
Handle<AccessorPair> accessor_pair,
|
2016-02-09 16:28:02 +00:00
|
|
|
AccessorComponent component);
|
2012-03-05 12:11:28 +00:00
|
|
|
|
2012-03-23 09:51:56 +00:00
|
|
|
// Set both components, skipping arguments which are a JavaScript null.
|
2015-08-13 11:49:01 +00:00
|
|
|
inline void SetComponents(Object* getter, Object* setter);
|
2012-02-22 10:52:57 +00:00
|
|
|
|
2015-08-13 11:49:01 +00:00
|
|
|
inline bool Equals(AccessorPair* pair);
|
|
|
|
inline bool Equals(Object* getter_value, Object* setter_value);
|
2015-02-16 15:25:33 +00:00
|
|
|
|
2015-08-13 11:49:01 +00:00
|
|
|
inline bool ContainsAccessor();
|
2012-03-02 14:03:59 +00:00
|
|
|
|
2012-12-13 10:17:37 +00:00
|
|
|
// Dispatched behavior.
|
2017-06-29 13:14:20 +00:00
|
|
|
DECL_PRINTER(AccessorPair)
|
|
|
|
DECL_VERIFIER(AccessorPair)
|
2012-01-10 16:11:33 +00:00
|
|
|
|
|
|
|
static const int kGetterOffset = HeapObject::kHeaderSize;
|
|
|
|
static const int kSetterOffset = kGetterOffset + kPointerSize;
|
2014-06-23 09:02:16 +00:00
|
|
|
static const int kSize = kSetterOffset + kPointerSize;
|
2012-01-10 16:11:33 +00:00
|
|
|
|
|
|
|
private:
|
2012-03-02 14:03:59 +00:00
|
|
|
// Strangely enough, in addition to functions and harmony proxies, the spec
|
|
|
|
// requires us to consider undefined as a kind of accessor, too:
|
|
|
|
// var obj = {};
|
|
|
|
// Object.defineProperty(obj, "foo", {get: undefined});
|
|
|
|
// assertTrue("foo" in obj);
|
2015-08-13 11:49:01 +00:00
|
|
|
inline bool IsJSAccessor(Object* obj);
|
2012-03-02 14:03:59 +00:00
|
|
|
|
2012-01-10 16:11:33 +00:00
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(AccessorPair);
|
|
|
|
};
|
|
|
|
|
2015-09-28 13:10:13 +00:00
|
|
|
// BooleanBit is a helper class for setting and getting a bit in an integer.
|
2013-08-20 10:52:23 +00:00
|
|
|
class BooleanBit : public AllStatic {
|
2008-07-03 15:10:15 +00:00
|
|
|
public:
|
|
|
|
static inline bool get(int value, int bit_position) {
|
|
|
|
return (value & (1 << bit_position)) != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int set(int value, int bit_position, bool v) {
|
|
|
|
if (v) {
|
|
|
|
value |= (1 << bit_position);
|
|
|
|
} else {
|
|
|
|
value &= ~(1 << bit_position);
|
|
|
|
}
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2015-09-17 12:52:37 +00:00
|
|
|
|
2015-09-30 13:46:56 +00:00
|
|
|
} // NOLINT, false-positive due to second-order macros.
|
|
|
|
} // NOLINT, false-positive due to second-order macros.
|
2008-07-03 15:10:15 +00:00
|
|
|
|
2016-12-20 14:08:21 +00:00
|
|
|
#include "src/objects/object-macros-undef.h"
|
|
|
|
|
2008-07-03 15:10:15 +00:00
|
|
|
#endif // V8_OBJECTS_H_
|