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

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: Inline 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
« src/objects.h ('K') | « 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 int size =
danno 2012/10/17 13:54:23 As discussed, please convert this into something a
Toon Verwaest 2012/10/17 14:03:40 Done.
1419 map->NumberOfOwnDescriptors() -
1420 map->inobject_properties() +
1421 map->unused_property_fields();
1422 if (properties()->length() == size) {
1423 set_map(map);
1424 return this;
1425 }
1426 FixedArray* new_properties;
1427 MaybeObject* maybe_properties = properties()->CopySize(size);
1428 if (!maybe_properties->To(&new_properties)) return maybe_properties;
1429 set_properties(new_properties);
1430 set_map(map);
1431 return new_properties;
1432 }
1433
1434
1435 bool JSObject::TryTransitionToField(String* key) {
danno 2012/10/17 13:54:23 This should only be called by handlified code, it
Toon Verwaest 2012/10/17 14:03:40 Done.
1436 Map* own_map = map();
1437 if (!own_map->HasTransitionArray()) return false;
1438 TransitionArray* transitions = own_map->transitions();
1439 int transition = transitions->Search(key);
1440 if (transition == TransitionArray::kNotFound) return false;
1441 PropertyDetails target_details = transitions->GetTargetDetails(transition);
1442 if (target_details.type() != FIELD) return false;
1443 if (target_details.attributes() != NONE) return false;
1444 Handle<JSObject> self(this);
1445 Handle<Map> target(transitions->GetTarget(transition));
1446 JSObject::AddFastPropertyUsingMap(self, target);
1447 return true;
1448 }
1449
1450
1417 ACCESSORS(Oddball, to_string, String, kToStringOffset) 1451 ACCESSORS(Oddball, to_string, String, kToStringOffset)
1418 ACCESSORS(Oddball, to_number, Object, kToNumberOffset) 1452 ACCESSORS(Oddball, to_number, Object, kToNumberOffset)
1419 1453
1420 1454
1421 byte Oddball::kind() { 1455 byte Oddball::kind() {
1422 return Smi::cast(READ_FIELD(this, kKindOffset))->value(); 1456 return Smi::cast(READ_FIELD(this, kKindOffset))->value();
1423 } 1457 }
1424 1458
1425 1459
1426 void Oddball::set_kind(byte value) { 1460 void Oddball::set_kind(byte value) {
(...skipping 4113 matching lines...) Expand 10 before | Expand all | Expand 10 after
5540 #undef WRITE_UINT32_FIELD 5574 #undef WRITE_UINT32_FIELD
5541 #undef READ_SHORT_FIELD 5575 #undef READ_SHORT_FIELD
5542 #undef WRITE_SHORT_FIELD 5576 #undef WRITE_SHORT_FIELD
5543 #undef READ_BYTE_FIELD 5577 #undef READ_BYTE_FIELD
5544 #undef WRITE_BYTE_FIELD 5578 #undef WRITE_BYTE_FIELD
5545 5579
5546 5580
5547 } } // namespace v8::internal 5581 } } // namespace v8::internal
5548 5582
5549 #endif // V8_OBJECTS_INL_H_ 5583 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects.h ('K') | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698