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

Side by Side Diff: src/objects.cc

Issue 15411003: Don't track representations in context extensions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 | « no previous file | src/objects-debug.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 1783 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); 1794 NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0);
1795 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 1795 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1796 1796
1797 return AddSlowProperty(name, value, attributes); 1797 return AddSlowProperty(name, value, attributes);
1798 } 1798 }
1799 1799
1800 // Compute the new index for new field. 1800 // Compute the new index for new field.
1801 int index = map()->NextFreePropertyIndex(); 1801 int index = map()->NextFreePropertyIndex();
1802 1802
1803 // Allocate new instance descriptors with (name, index) added 1803 // Allocate new instance descriptors with (name, index) added
1804 Representation representation = value->OptimalRepresentation(); 1804 Representation representation = IsJSContextExtensionObject()
1805 ? Representation::Tagged() : value->OptimalRepresentation();
1806
1805 FieldDescriptor new_field(name, index, attributes, representation); 1807 FieldDescriptor new_field(name, index, attributes, representation);
1806 1808
1807 ASSERT(index < map()->inobject_properties() || 1809 ASSERT(index < map()->inobject_properties() ||
1808 (index - map()->inobject_properties()) < properties()->length() || 1810 (index - map()->inobject_properties()) < properties()->length() ||
1809 map()->unused_property_fields() == 0); 1811 map()->unused_property_fields() == 0);
1810 1812
1811 FixedArray* values = NULL; 1813 FixedArray* values = NULL;
1812 1814
1813 // TODO(verwaest): Merge with AddFastPropertyUsingMap. 1815 // TODO(verwaest): Merge with AddFastPropertyUsingMap.
1814 if (map()->unused_property_fields() == 0) { 1816 if (map()->unused_property_fields() == 0) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 Object* new_value, 2100 Object* new_value,
2099 PropertyAttributes attributes) { 2101 PropertyAttributes attributes) {
2100 if (map()->unused_property_fields() == 0 && 2102 if (map()->unused_property_fields() == 0 &&
2101 TooManyFastProperties(properties()->length(), MAY_BE_STORE_FROM_KEYED)) { 2103 TooManyFastProperties(properties()->length(), MAY_BE_STORE_FROM_KEYED)) {
2102 Object* obj; 2104 Object* obj;
2103 MaybeObject* maybe_obj = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); 2105 MaybeObject* maybe_obj = NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0);
2104 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 2106 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
2105 return ReplaceSlowProperty(name, new_value, attributes); 2107 return ReplaceSlowProperty(name, new_value, attributes);
2106 } 2108 }
2107 2109
2108 Representation representation = new_value->OptimalRepresentation(); 2110 Representation representation = IsJSContextExtensionObject()
2111 ? Representation::Tagged() : new_value->OptimalRepresentation();
2109 int index = map()->NextFreePropertyIndex(); 2112 int index = map()->NextFreePropertyIndex();
2110 FieldDescriptor new_field(name, index, attributes, representation); 2113 FieldDescriptor new_field(name, index, attributes, representation);
2111 2114
2112 // Make a new map for the object. 2115 // Make a new map for the object.
2113 Map* new_map; 2116 Map* new_map;
2114 MaybeObject* maybe_new_map = map()->CopyInsertDescriptor(&new_field, 2117 MaybeObject* maybe_new_map = map()->CopyInsertDescriptor(&new_field,
2115 OMIT_TRANSITION); 2118 OMIT_TRANSITION);
2116 if (!maybe_new_map->To(&new_map)) return maybe_new_map; 2119 if (!maybe_new_map->To(&new_map)) return maybe_new_map;
2117 2120
2118 // Make new properties array if necessary. 2121 // Make new properties array if necessary.
(...skipping 13339 matching lines...) Expand 10 before | Expand all | Expand 10 after
15458 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 15461 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
15459 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 15462 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
15460 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 15463 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
15461 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 15464 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
15462 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 15465 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
15463 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 15466 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
15464 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 15467 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
15465 } 15468 }
15466 15469
15467 } } // namespace v8::internal 15470 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698