Commit 22942716 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Remove special case code for generalizing constants to fields.

R=bmeurer@chromium.org

Review URL: https://chromiumcodereview.appspot.com/22911018

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16275 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e886eff3
......@@ -1143,12 +1143,12 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
JSObject::SetLocalPropertyIgnoreAttributes(
result, factory->length_string(),
factory->undefined_value(), DONT_ENUM,
Object::FORCE_TAGGED, JSReceiver::FORCE_FIELD));
Object::FORCE_TAGGED, FORCE_FIELD));
CHECK_NOT_EMPTY_HANDLE(isolate,
JSObject::SetLocalPropertyIgnoreAttributes(
result, factory->callee_string(),
factory->undefined_value(), DONT_ENUM,
Object::FORCE_TAGGED, JSReceiver::FORCE_FIELD));
Object::FORCE_TAGGED, FORCE_FIELD));
#ifdef DEBUG
LookupResult lookup(isolate);
......
......@@ -1615,7 +1615,8 @@ static bool LookupForWrite(Handle<JSObject> receiver,
if (!value->FitsRepresentation(target_details.representation())) {
Handle<Map> target(lookup->GetTransitionMapFromMap(receiver->map()));
Map::GeneralizeRepresentation(
target, target->LastAdded(), value->OptimalRepresentation());
target, target->LastAdded(),
value->OptimalRepresentation(), FORCE_FIELD);
// Lookup the transition again since the transition tree may have changed
// entirely by the migration above.
receiver->map()->LookupTransition(*holder, *name, lookup);
......
......@@ -1569,7 +1569,7 @@ MaybeObject* JSObject::MigrateInstance() {
// transition that matches the object. This achieves what is needed.
Map* original_map = map();
MaybeObject* maybe_result = GeneralizeFieldRepresentation(
0, Representation::None());
0, Representation::None(), ALLOW_AS_CONSTANT);
JSObject* result;
if (FLAG_trace_migration && maybe_result->To(&result)) {
PrintInstanceMigration(stdout, original_map, result->map());
......@@ -2361,6 +2361,7 @@ PropertyType DescriptorArray::GetType(int descriptor_number) {
int DescriptorArray::GetFieldIndex(int descriptor_number) {
ASSERT(GetDetails(descriptor_number).type() == FIELD);
return GetDetails(descriptor_number).field_index();
}
......
This diff is collapsed.
......@@ -232,6 +232,13 @@ static inline bool IsGrowStoreMode(KeyedAccessStoreMode store_mode) {
enum WriteBarrierMode { SKIP_WRITE_BARRIER, UPDATE_WRITE_BARRIER };
// Indicates whether a value can be loaded as a constant.
enum StoreMode {
ALLOW_AS_CONSTANT,
FORCE_FIELD
};
// PropertyNormalizationMode is used to specify whether to keep
// inobject properties when normalizing properties of a JSObject.
enum PropertyNormalizationMode {
......@@ -258,7 +265,6 @@ enum CreationFlag {
// Indicates whether transitions can be added to a source map or not.
enum TransitionFlag {
INSERT_TRANSITION,
OMIT_TRANSITION_KEEP_REPRESENTATIONS,
OMIT_TRANSITION
};
......@@ -1926,12 +1932,6 @@ class JSReceiver: public HeapObject {
CERTAINLY_NOT_STORE_FROM_KEYED
};
// Indicates whether a value can be loaded as a constant.
enum StoreMode {
ALLOW_AS_CONSTANT,
FORCE_FIELD
};
// Internal properties (e.g. the hidden properties dictionary) might
// be added even though the receiver is non-extensible.
enum ExtensibilityCheck {
......@@ -2522,13 +2522,6 @@ class JSObject: public JSReceiver {
MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind);
MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind);
// Replaces an existing transition with a transition to a map with a FIELD.
MUST_USE_RESULT MaybeObject* ConvertTransitionToMapTransition(
int transition_index,
Name* name,
Object* new_value,
PropertyAttributes attributes);
// Converts a descriptor of any other type to a real field, backed by the
// properties array.
MUST_USE_RESULT MaybeObject* ConvertDescriptorToField(
......@@ -2540,7 +2533,8 @@ class JSObject: public JSReceiver {
MUST_USE_RESULT MaybeObject* MigrateToMap(Map* new_map);
MUST_USE_RESULT MaybeObject* GeneralizeFieldRepresentation(
int modify_index,
Representation new_representation);
Representation new_representation,
StoreMode store_mode);
// Add a property to a fast-case object.
MUST_USE_RESULT MaybeObject* AddFastProperty(
......@@ -3190,6 +3184,8 @@ class DescriptorArray: public FixedArray {
MUST_USE_RESULT MaybeObject* Merge(int verbatim,
int valid,
int new_size,
int modify_index,
StoreMode store_mode,
DescriptorArray* other);
bool IsMoreGeneralThan(int verbatim,
......@@ -5619,16 +5615,23 @@ class Map: public HeapObject {
static Handle<Map> GeneralizeRepresentation(
Handle<Map> map,
int modify_index,
Representation new_representation);
Representation new_representation,
StoreMode store_mode);
MUST_USE_RESULT MaybeObject* GeneralizeRepresentation(
int modify_index,
Representation representation);
MUST_USE_RESULT MaybeObject* CopyGeneralizeAllRepresentations();
Representation representation,
StoreMode store_mode);
MUST_USE_RESULT MaybeObject* CopyGeneralizeAllRepresentations(
int modify_index,
StoreMode store_mode,
const char* reason);
void PrintGeneralization(FILE* file,
const char* reason,
int modify_index,
int split,
int descriptors,
bool constant_to_field,
Representation old_representation,
Representation new_representation);
......
......@@ -422,12 +422,10 @@ class LookupResult BASE_EMBEDDED {
PropertyIndex GetFieldIndex() {
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
ASSERT(IsField());
return PropertyIndex::NewFieldIndex(GetFieldIndexFromMap(holder()->map()));
}
int GetLocalFieldIndexFromMap(Map* map) {
ASSERT(IsField());
return GetFieldIndexFromMap(map) - map->inobject_properties();
}
......
......@@ -290,9 +290,7 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
}
Handle<Object> result;
uint32_t element_index = 0;
JSReceiver::StoreMode mode = value->IsJSObject()
? JSReceiver::FORCE_FIELD
: JSReceiver::ALLOW_AS_CONSTANT;
StoreMode mode = value->IsJSObject() ? FORCE_FIELD : ALLOW_AS_CONSTANT;
if (key->IsInternalizedString()) {
if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) {
// Array index as string (uint32).
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment