Torquefy Oddball, PropertyArray

Bug: v8:8952
Change-Id: I07b3491e644634f9712e89d1566718084a3686d4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1518812
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Simon Zünd <szuend@chromium.org>
Commit-Queue: Z Nguyen-Huu <duongn@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#60307}
This commit is contained in:
Z Duong Nguyen-Huu 2019-03-14 14:10:37 -07:00 committed by Commit Bot
parent a402686eb6
commit d5be67a58c
4 changed files with 22 additions and 25 deletions

View File

@ -60,7 +60,13 @@ type Code extends AbstractCode generates 'TNode<Code>';
type BuiltinPtr extends Smi generates 'TNode<BuiltinPtr>';
type Context extends HeapObject generates 'TNode<Context>';
type NativeContext extends Context;
type Oddball extends HeapObject generates 'TNode<Oddball>';
extern class Oddball extends HeapObject {
to_number_raw: float64;
to_string: String;
to_number: Number;
type_of: String;
kind: Smi;
}
type HeapNumber extends HeapObject generates 'TNode<HeapNumber>';
type Number = Smi | HeapNumber;
type BigInt extends HeapObject generates 'TNode<BigInt>';
@ -456,6 +462,8 @@ extern class ObjectTemplateInfo extends TemplateInfo {
data: Object;
}
extern class PropertyArray extends HeapObject { length_and_hash: Smi; }
type JSDataView extends JSArrayBufferView generates 'TNode<JSDataView>';
type InstanceType generates 'TNode<Int32T>' constexpr 'InstanceType';

View File

@ -737,6 +737,7 @@ void PropertyArray::PropertyArrayVerify(Isolate* isolate) {
Object e = get(i);
Object::VerifyPointer(isolate, e);
}
VerifySmiField(kLengthAndHashOffset);
}
void FixedDoubleArray::FixedDoubleArrayVerify(Isolate* isolate) {
@ -1197,6 +1198,8 @@ void Oddball::OddballVerify(Isolate* isolate) {
} else {
UNREACHABLE();
}
CHECK(to_string()->IsString());
CHECK(type_of()->IsString());
}
void Cell::CellVerify(Isolate* isolate) {

View File

@ -6,6 +6,7 @@
#define V8_OBJECTS_ODDBALL_H_
#include "src/objects/heap-object.h"
#include "torque-generated/class-definitions-from-dsl.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
@ -47,22 +48,11 @@ class Oddball : public HeapObject {
const char* to_string, Handle<Object> to_number,
const char* type_of, byte kind);
// Layout description.
#define ODDBALL_FIELDS(V) \
V(kToNumberRawOffset, kDoubleSize) \
/* Tagged fields. */ \
V(kTaggedFieldsStartOffset, 0) \
V(kToStringOffset, kTaggedSize) \
V(kToNumberOffset, kTaggedSize) \
V(kTypeOfOffset, kTaggedSize) \
V(kTaggedFieldsEndOffset, 0) \
/* Raw data but still encoded as Smi. */ \
V(kKindOffset, kTaggedSize) \
/* Total size. */ \
V(kSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, ODDBALL_FIELDS)
#undef ODDBALL_FIELDS
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_ODDBALL_FIELDS)
// TODO(v8:8989): [torque] Support marker constants.
static const int kTaggedFieldsStartOffset = kToStringOffset;
static const int kTaggedFieldsEndOffset = kKindOffset;
static const byte kFalse = 0;
static const byte kTrue = 1;

View File

@ -6,6 +6,7 @@
#define V8_OBJECTS_PROPERTY_ARRAY_H_
#include "src/objects/heap-object.h"
#include "torque-generated/class-definitions-from-dsl.h"
// Has to be the last include (doesn't have include guards):
#include "src/objects/object-macros.h"
@ -47,14 +48,9 @@ class PropertyArray : public HeapObject {
DECL_PRINTER(PropertyArray)
DECL_VERIFIER(PropertyArray)
// Layout description.
#define PROPERTY_ARRAY_FIELDS(V) \
V(kLengthAndHashOffset, kTaggedSize) \
/* Header size. */ \
V(kHeaderSize, 0)
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize, PROPERTY_ARRAY_FIELDS)
#undef PROPERTY_ARRAY_FIELDS
DEFINE_FIELD_OFFSET_CONSTANTS(HeapObject::kHeaderSize,
TORQUE_GENERATED_PROPERTY_ARRAY_FIELDS)
static const int kHeaderSize = kSize;
// Garbage collection support.
typedef FlexibleBodyDescriptor<kHeaderSize> BodyDescriptor;