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

Side by Side Diff: src/objects.cc

Issue 6479012: Merge revision 6627 to the 3.0 branch. (Closed) Base URL: http://v8.googlecode.com/svn/branches/3.0/
Patch Set: '' Created 9 years, 10 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/handles.cc ('k') | src/runtime.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1206 set_properties(FixedArray::cast(values)); 1206 set_properties(FixedArray::cast(values));
1207 } 1207 }
1208 set_map(new_map); 1208 set_map(new_map);
1209 return FastPropertyAtPut(index, value); 1209 return FastPropertyAtPut(index, value);
1210 } 1210 }
1211 1211
1212 1212
1213 MaybeObject* JSObject::AddFastProperty(String* name, 1213 MaybeObject* JSObject::AddFastProperty(String* name,
1214 Object* value, 1214 Object* value,
1215 PropertyAttributes attributes) { 1215 PropertyAttributes attributes) {
1216 ASSERT(!IsJSGlobalProxy());
1217
1216 // Normalize the object if the name is an actual string (not the 1218 // Normalize the object if the name is an actual string (not the
1217 // hidden symbols) and is not a real identifier. 1219 // hidden symbols) and is not a real identifier.
1218 StringInputBuffer buffer(name); 1220 StringInputBuffer buffer(name);
1219 if (!ScannerConstants::IsIdentifier(&buffer) 1221 if (!ScannerConstants::IsIdentifier(&buffer)
1220 && name != Heap::hidden_symbol()) { 1222 && name != Heap::hidden_symbol()) {
1221 Object* obj; 1223 Object* obj;
1222 { MaybeObject* maybe_obj = 1224 { MaybeObject* maybe_obj =
1223 NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); 1225 NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0);
1224 if (!maybe_obj->ToObject(&obj)) return maybe_obj; 1226 if (!maybe_obj->ToObject(&obj)) return maybe_obj;
1225 } 1227 }
(...skipping 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after
2283 } 2285 }
2284 2286
2285 2287
2286 MaybeObject* JSObject::NormalizeProperties(PropertyNormalizationMode mode, 2288 MaybeObject* JSObject::NormalizeProperties(PropertyNormalizationMode mode,
2287 int expected_additional_properties) { 2289 int expected_additional_properties) {
2288 if (!HasFastProperties()) return this; 2290 if (!HasFastProperties()) return this;
2289 2291
2290 // The global object is always normalized. 2292 // The global object is always normalized.
2291 ASSERT(!IsGlobalObject()); 2293 ASSERT(!IsGlobalObject());
2292 2294
2295 // JSGlobalProxy must never be normalized
2296 ASSERT(!IsJSGlobalProxy());
2297
2293 // Allocate new content. 2298 // Allocate new content.
2294 int property_count = map()->NumberOfDescribedProperties(); 2299 int property_count = map()->NumberOfDescribedProperties();
2295 if (expected_additional_properties > 0) { 2300 if (expected_additional_properties > 0) {
2296 property_count += expected_additional_properties; 2301 property_count += expected_additional_properties;
2297 } else { 2302 } else {
2298 property_count += 2; // Make space for two more properties. 2303 property_count += 2; // Make space for two more properties.
2299 } 2304 }
2300 Object* obj; 2305 Object* obj;
2301 { MaybeObject* maybe_obj = 2306 { MaybeObject* maybe_obj =
2302 StringDictionary::Allocate(property_count); 2307 StringDictionary::Allocate(property_count);
(...skipping 7588 matching lines...) Expand 10 before | Expand all | Expand 10 after
9891 if (break_point_objects()->IsUndefined()) return 0; 9896 if (break_point_objects()->IsUndefined()) return 0;
9892 // Single beak point. 9897 // Single beak point.
9893 if (!break_point_objects()->IsFixedArray()) return 1; 9898 if (!break_point_objects()->IsFixedArray()) return 1;
9894 // Multiple break points. 9899 // Multiple break points.
9895 return FixedArray::cast(break_point_objects())->length(); 9900 return FixedArray::cast(break_point_objects())->length();
9896 } 9901 }
9897 #endif 9902 #endif
9898 9903
9899 9904
9900 } } // namespace v8::internal 9905 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698