Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Side by Side Diff: src/objects-inl.h

Issue 11184006: Eagerly follow transitions to existing maps while json parsing. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1396 matching lines...) Expand 10 before | Expand all | Expand 10 after
1407 } 1407 }
1408 MaybeObject* maybe_obj = GetElementsTransitionMap(GetIsolate(), 1408 MaybeObject* maybe_obj = GetElementsTransitionMap(GetIsolate(),
1409 elements_kind); 1409 elements_kind);
1410 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 1410 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1411 set_map(Map::cast(obj)); 1411 set_map(Map::cast(obj));
1412 initialize_elements(); 1412 initialize_elements();
1413 return this; 1413 return this;
1414 } 1414 }
1415 1415
1416 1416
1417 MaybeObject* JSObject::AddFastPropertyUsingMap(Map* map) {
1418 ASSERT(this->map()->NumberOfOwnDescriptors() + 1 ==
1419 map->NumberOfOwnDescriptors());
1420 if (this->map()->unused_property_fields() == 0) {
1421 int new_size = properties()->length() + map->unused_property_fields() + 1;
1422 FixedArray* new_properties;
1423 MaybeObject* maybe_properties = properties()->CopySize(new_size);
1424 if (!maybe_properties->To(&new_properties)) return maybe_properties;
1425 set_properties(new_properties);
1426 }
1427 set_map(map);
1428 return this;
1429 }
1430
1431
1432 bool JSObject::TryTransitionToField(Handle<JSObject> object,
1433 Handle<String> key) {
1434 if (!object->map()->HasTransitionArray()) return false;
1435 Handle<TransitionArray> transitions(object->map()->transitions());
1436 int transition = transitions->Search(*key);
1437 if (transition == TransitionArray::kNotFound) return false;
1438 PropertyDetails target_details = transitions->GetTargetDetails(transition);
1439 if (target_details.type() != FIELD) return false;
1440 if (target_details.attributes() != NONE) return false;
1441 Handle<Map> target(transitions->GetTarget(transition));
1442 JSObject::AddFastPropertyUsingMap(object, target);
1443 return true;
1444 }
1445
1446
1417 ACCESSORS(Oddball, to_string, String, kToStringOffset) 1447 ACCESSORS(Oddball, to_string, String, kToStringOffset)
1418 ACCESSORS(Oddball, to_number, Object, kToNumberOffset) 1448 ACCESSORS(Oddball, to_number, Object, kToNumberOffset)
1419 1449
1420 1450
1421 byte Oddball::kind() { 1451 byte Oddball::kind() {
1422 return Smi::cast(READ_FIELD(this, kKindOffset))->value(); 1452 return Smi::cast(READ_FIELD(this, kKindOffset))->value();
1423 } 1453 }
1424 1454
1425 1455
1426 void Oddball::set_kind(byte value) { 1456 void Oddball::set_kind(byte value) {
(...skipping 4113 matching lines...) Expand 10 before | Expand all | Expand 10 after
5540 #undef WRITE_UINT32_FIELD 5570 #undef WRITE_UINT32_FIELD
5541 #undef READ_SHORT_FIELD 5571 #undef READ_SHORT_FIELD
5542 #undef WRITE_SHORT_FIELD 5572 #undef WRITE_SHORT_FIELD
5543 #undef READ_BYTE_FIELD 5573 #undef READ_BYTE_FIELD
5544 #undef WRITE_BYTE_FIELD 5574 #undef WRITE_BYTE_FIELD
5545 5575
5546 5576
5547 } } // namespace v8::internal 5577 } } // namespace v8::internal
5548 5578
5549 #endif // V8_OBJECTS_INL_H_ 5579 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698