Index: src/objects.h |
diff --git a/src/objects.h b/src/objects.h |
index 4b1b297884c1927938bdd2f0dd7b13be7a419f69..fc25b68514b64e8c1226eaf30023b79f5bbbb201 100644 |
--- a/src/objects.h |
+++ b/src/objects.h |
@@ -2347,6 +2347,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. |
@@ -5654,7 +5658,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. |
@@ -5942,6 +5946,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(); |
@@ -6114,6 +6120,8 @@ class Map: public HeapObject { |
Handle<Object> prototype, |
PrototypeOptimizationMode mode); |
+ static Handle<Map> TransitionToImmutableProto(Handle<Map> map); |
+ |
static const int kMaxPreAllocatedPropertyFields = 255; |
// Layout description. |
@@ -10661,7 +10669,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) |
@@ -10670,9 +10680,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> {}; |
}; |