Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index a8a07c0a47f512f8c18a36715a34c06795743e7b..9e8f5c0a221729d60f829d115e2edf31cdb51c28 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -2346,6 +2346,10 @@ class JSObject: public JSReceiver { |
bool from_javascript, |
ShouldThrow should_throw); |
+ // Makes the object prototype immutable |
+ // Never called from JavaScript |
+ static void SetImmutableProto(Handle<JSObject> object); |
+ |
// Initializes the body starting at |start_offset|. It is responsibility of |
// the caller to initialize object header. Fill the pre-allocated fields with |
// pre_allocated_value and the rest with filler_value. |
@@ -5702,7 +5706,7 @@ class Map: public HeapObject { |
class Deprecated : public BitField<bool, 23, 1> {}; |
class IsUnstable : public BitField<bool, 24, 1> {}; |
class IsMigrationTarget : public BitField<bool, 25, 1> {}; |
- // Bit 26 is free. |
+ class ImmutablePrototype : public BitField<bool, 26, 1> {}; |
class NewTargetIsBase : public BitField<bool, 27, 1> {}; |
// Bit 28 is free. |
@@ -5990,6 +5994,8 @@ class Map: public HeapObject { |
inline bool is_stable(); |
inline void set_migration_target(bool value); |
inline bool is_migration_target(); |
+ inline void set_immutable_proto(bool value); |
+ inline bool is_immutable_proto(); |
inline void set_construction_counter(int value); |
inline int construction_counter(); |
inline void deprecate(); |
@@ -6162,6 +6168,8 @@ class Map: public HeapObject { |
Handle<Object> prototype, |
PrototypeOptimizationMode mode); |
+ static Handle<Map> TransitionToImmutableProto(Handle<Map> map); |
+ |
static const int kMaxPreAllocatedPropertyFields = 255; |
// Layout description. |
@@ -10708,7 +10716,9 @@ class FunctionTemplateInfo: public TemplateInfo { |
class ObjectTemplateInfo: public TemplateInfo { |
public: |
DECL_ACCESSORS(constructor, Object) |
- DECL_ACCESSORS(internal_field_count, Object) |
+ DECL_ACCESSORS(data, Object) |
+ DECL_INT_ACCESSORS(internal_field_count) |
+ DECL_BOOLEAN_ACCESSORS(immutable_proto) |
DECLARE_CAST(ObjectTemplateInfo) |
@@ -10717,9 +10727,14 @@ class ObjectTemplateInfo: public TemplateInfo { |
DECLARE_VERIFIER(ObjectTemplateInfo) |
static const int kConstructorOffset = TemplateInfo::kHeaderSize; |
- static const int kInternalFieldCountOffset = |
- kConstructorOffset + kPointerSize; |
- static const int kSize = kInternalFieldCountOffset + kPointerSize; |
+ // LSB is for immutable_proto, higher bits for internal_field_count |
+ static const int kDataOffset = kConstructorOffset + kPointerSize; |
+ static const int kSize = kDataOffset + kPointerSize; |
+ |
+ private: |
+ class IsImmutablePrototype : public BitField<bool, 0, 1> {}; |
+ class InternalFieldCount |
+ : public BitField<int, IsImmutablePrototype::kNext, 29> {}; |
}; |