Get the target field index when transitioning.
Review URL: https://chromiumcodereview.appspot.com/11194080 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12772 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
ace5bf3f94
commit
a0c9856bce
@ -289,7 +289,6 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonValue() {
|
||||
// Parse a JSON object. Position must be right at '{'.
|
||||
template <bool seq_ascii>
|
||||
Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
|
||||
int current_index = 0;
|
||||
Handle<Object> prototype;
|
||||
Handle<JSFunction> object_constructor(
|
||||
isolate()->native_context()->object_function());
|
||||
@ -339,11 +338,11 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
|
||||
prototype = value;
|
||||
} else {
|
||||
if (JSObject::TryTransitionToField(json_object, key)) {
|
||||
json_object->FastPropertyAtPut(current_index++, *value);
|
||||
int index = json_object->LastAddedFieldIndex();
|
||||
json_object->FastPropertyAtPut(index, *value);
|
||||
} else {
|
||||
JSObject::SetLocalPropertyIgnoreAttributes(
|
||||
json_object, key, value, NONE);
|
||||
current_index = json_object->NumberOfLocalProperties();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1444,6 +1444,13 @@ bool JSObject::TryTransitionToField(Handle<JSObject> object,
|
||||
}
|
||||
|
||||
|
||||
int JSObject::LastAddedFieldIndex() {
|
||||
Map* map = this->map();
|
||||
int last_added = map->LastAdded();
|
||||
return map->instance_descriptors()->GetFieldIndex(last_added);
|
||||
}
|
||||
|
||||
|
||||
ACCESSORS(Oddball, to_string, String, kToStringOffset)
|
||||
ACCESSORS(Oddball, to_number, Object, kToNumberOffset)
|
||||
|
||||
|
@ -1626,6 +1626,8 @@ class JSObject: public JSReceiver {
|
||||
static inline bool TryTransitionToField(Handle<JSObject> object,
|
||||
Handle<String> key);
|
||||
|
||||
inline int LastAddedFieldIndex();
|
||||
|
||||
// Extend the receiver with a single fast property appeared first in the
|
||||
// passed map. This also extends the property backing store if necessary.
|
||||
static void AddFastPropertyUsingMap(Handle<JSObject> object, Handle<Map> map);
|
||||
|
Loading…
Reference in New Issue
Block a user