Revision: 23164
Author: [email protected]
Date: Mon Aug 18 14:27:24 2014 UTC
Log: Remove the extensibility flag. Instead just rely on hidden_string
as indication.
BUG=
[email protected]
Review URL: https://codereview.chromium.org/466033002
http://code.google.com/p/v8/source/detail?r=23164
Modified:
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/objects.h
/branches/bleeding_edge/src/runtime.cc
=======================================
--- /branches/bleeding_edge/src/objects.cc Mon Aug 18 14:26:30 2014 UTC
+++ /branches/bleeding_edge/src/objects.cc Mon Aug 18 14:27:24 2014 UTC
@@ -2923,8 +2923,7 @@
if (done) break;
}
- return AddDataProperty(it, value, NONE, strict_mode, store_mode,
- PERFORM_EXTENSIBILITY_CHECK);
+ return AddDataProperty(it, value, NONE, strict_mode, store_mode);
}
@@ -2979,8 +2978,7 @@
Handle<Object> value,
PropertyAttributes attributes,
StrictMode strict_mode,
- StoreFromKeyed store_mode,
- ExtensibilityCheck check) {
+ StoreFromKeyed store_mode) {
DCHECK(!it->GetReceiver()->IsJSProxy());
if (!it->GetReceiver()->IsJSObject()) {
// TODO(verwaest): Throw a TypeError with a more specific message.
@@ -2998,7 +2996,7 @@
Handle<JSGlobalObject>::cast(PrototypeIterator::GetCurrent(iter));
}
- if (check == PERFORM_EXTENSIBILITY_CHECK &&
+ if
(!it->name().is_identical_to(it->isolate()->factory()->hidden_string()) &&
!receiver->map()->is_extensible()) {
if (strict_mode == SLOPPY) return value;
@@ -3873,18 +3871,19 @@
void JSObject::AddProperty(Handle<JSObject> object, Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes) {
+ LookupIterator it(object, name, LookupIterator::CHECK_OWN_REAL);
#ifdef DEBUG
uint32_t index;
DCHECK(!object->IsJSProxy());
DCHECK(!name->AsArrayIndex(&index));
- LookupIterator it(object, name, LookupIterator::CHECK_OWN_REAL);
Maybe<PropertyAttributes> maybe = GetPropertyAttributes(&it);
DCHECK(maybe.has_value);
DCHECK(!it.IsFound());
- DCHECK(object->map()->is_extensible());
+ DCHECK(object->map()->is_extensible() ||
+ name.is_identical_to(it.isolate()->factory()->hidden_string()));
#endif
- SetOwnPropertyIgnoreAttributes(object, name, value, attributes,
- OMIT_EXTENSIBILITY_CHECK).Check();
+ AddDataProperty(&it, value, attributes, STRICT,
+ CERTAINLY_NOT_STORE_FROM_KEYED).Check();
}
@@ -3895,7 +3894,6 @@
Handle<Name> name,
Handle<Object> value,
PropertyAttributes attributes,
- ExtensibilityCheck extensibility_check,
StoreFromKeyed store_from_keyed,
ExecutableAccessorInfoHandling handling) {
DCHECK(!value->IsTheHole());
@@ -4014,8 +4012,7 @@
}
}
- return AddDataProperty(&it, value, attributes, STRICT, store_from_keyed,
- extensibility_check);
+ return AddDataProperty(&it, value, attributes, STRICT, store_from_keyed);
}
@@ -4843,10 +4840,7 @@
inline_value);
}
- JSObject::SetOwnPropertyIgnoreAttributes(
- object, isolate->factory()->hidden_string(),
- hashtable, DONT_ENUM).Assert();
-
+ SetHiddenPropertiesHashTable(object, hashtable);
return hashtable;
}
@@ -4854,31 +4848,9 @@
Handle<Object> JSObject::SetHiddenPropertiesHashTable(Handle<JSObject>
object,
Handle<Object>
value) {
DCHECK(!object->IsJSGlobalProxy());
-
Isolate* isolate = object->GetIsolate();
-
- // We can store the identity hash inline iff there is no backing store
- // for hidden properties yet.
- DCHECK(JSObject::HasHiddenProperties(object) != value->IsSmi());
- if (object->HasFastProperties()) {
- // If the object has fast properties, check whether the first slot
- // in the descriptor array matches the hidden string. Since the
- // hidden strings hash code is zero (and no other name has hash
- // code zero) it will always occupy the first entry if present.
- DescriptorArray* descriptors = object->map()->instance_descriptors();
- if (descriptors->number_of_descriptors() > 0) {
- int sorted_index = descriptors->GetSortedKeyIndex(0);
- if (descriptors->GetKey(sorted_index) ==
isolate->heap()->hidden_string()
- && sorted_index < object->map()->NumberOfOwnDescriptors()) {
- object->WriteToField(sorted_index, *value);
- return object;
- }
- }
- }
-
- SetOwnPropertyIgnoreAttributes(object,
isolate->factory()->hidden_string(),
- value, DONT_ENUM,
- OMIT_EXTENSIBILITY_CHECK).Assert();
+ Handle<Name> name = isolate->factory()->hidden_string();
+ SetOwnPropertyIgnoreAttributes(object, name, value, DONT_ENUM).Assert();
return object;
}
=======================================
--- /branches/bleeding_edge/src/objects.h Mon Aug 18 14:26:30 2014 UTC
+++ /branches/bleeding_edge/src/objects.h Mon Aug 18 14:27:24 2014 UTC
@@ -247,14 +247,6 @@
};
-// Internal properties (e.g. the hidden properties dictionary) might
-// be added even though the receiver is non-extensible.
-enum ExtensibilityCheck {
- PERFORM_EXTENSIBILITY_CHECK,
- OMIT_EXTENSIBILITY_CHECK
-};
-
-
// Indicates how aggressively the prototype should be optimized.
FAST_PROTOTYPE
// will give the fastest result by tailoring the map to the prototype, but
that
// will cause polymorphism with other objects. REGULAR_PROTOTYPE is to be
used
@@ -1500,8 +1492,7 @@
LookupIterator* it, Handle<Object> value);
MUST_USE_RESULT static MaybeHandle<Object> AddDataProperty(
LookupIterator* it, Handle<Object> value, PropertyAttributes
attributes,
- StrictMode strict_mode, StoreFromKeyed store_mode,
- ExtensibilityCheck check);
+ StrictMode strict_mode, StoreFromKeyed store_mode);
MUST_USE_RESULT static inline MaybeHandle<Object> GetPropertyOrElement(
Handle<Object> object,
Handle<Name> key);
@@ -2149,7 +2140,6 @@
Handle<Name> key,
Handle<Object> value,
PropertyAttributes attributes,
- ExtensibilityCheck extensibility_check = PERFORM_EXTENSIBILITY_CHECK,
StoreFromKeyed store_mode = MAY_BE_STORE_FROM_KEYED,
ExecutableAccessorInfoHandling handling = DEFAULT_HANDLING);
=======================================
--- /branches/bleeding_edge/src/runtime.cc Mon Aug 18 14:26:30 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc Mon Aug 18 14:27:24 2014 UTC
@@ -5041,7 +5041,7 @@
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
isolate, result,
JSObject::SetOwnPropertyIgnoreAttributes(
- js_object, name, obj_value, attr, PERFORM_EXTENSIBILITY_CHECK,
+ js_object, name, obj_value, attr,
JSReceiver::MAY_BE_STORE_FROM_KEYED,
JSObject::DONT_FORCE_FIELD));
return *result;
}
@@ -5195,9 +5195,8 @@
SLOPPY, false, DEFINE_PROPERTY);
} else {
if (name->IsString()) name =
String::Flatten(Handle<String>::cast(name));
- return JSObject::SetOwnPropertyIgnoreAttributes(
- js_object, name, value, attr, PERFORM_EXTENSIBILITY_CHECK,
- store_from_keyed);
+ return JSObject::SetOwnPropertyIgnoreAttributes(js_object, name,
value,
+ attr,
store_from_keyed);
}
}
@@ -5211,9 +5210,8 @@
return JSObject::SetElement(js_object, index, value, attr,
SLOPPY, false, DEFINE_PROPERTY);
} else {
- return JSObject::SetOwnPropertyIgnoreAttributes(
- js_object, name, value, attr, PERFORM_EXTENSIBILITY_CHECK,
- store_from_keyed);
+ return JSObject::SetOwnPropertyIgnoreAttributes(js_object, name, value,
+ attr,
store_from_keyed);
}
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.