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

Side by Side Diff: src/objects.cc

Issue 6286060: Fix bugs 992, 1083 and 1092 (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Address review comments 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 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
2281 } 2283 }
2282 2284
2283 2285
2284 MaybeObject* JSObject::NormalizeProperties(PropertyNormalizationMode mode, 2286 MaybeObject* JSObject::NormalizeProperties(PropertyNormalizationMode mode,
2285 int expected_additional_properties) { 2287 int expected_additional_properties) {
2286 if (!HasFastProperties()) return this; 2288 if (!HasFastProperties()) return this;
2287 2289
2288 // The global object is always normalized. 2290 // The global object is always normalized.
2289 ASSERT(!IsGlobalObject()); 2291 ASSERT(!IsGlobalObject());
2290 2292
2293 // JSGlobalProxy must never be normalized
2294 ASSERT(!IsJSGlobalProxy());
2295
2291 // Allocate new content. 2296 // Allocate new content.
2292 int property_count = map()->NumberOfDescribedProperties(); 2297 int property_count = map()->NumberOfDescribedProperties();
2293 if (expected_additional_properties > 0) { 2298 if (expected_additional_properties > 0) {
2294 property_count += expected_additional_properties; 2299 property_count += expected_additional_properties;
2295 } else { 2300 } else {
2296 property_count += 2; // Make space for two more properties. 2301 property_count += 2; // Make space for two more properties.
2297 } 2302 }
2298 Object* obj; 2303 Object* obj;
2299 { MaybeObject* maybe_obj = 2304 { MaybeObject* maybe_obj =
2300 StringDictionary::Allocate(property_count); 2305 StringDictionary::Allocate(property_count);
(...skipping 7577 matching lines...) Expand 10 before | Expand all | Expand 10 after
9878 if (break_point_objects()->IsUndefined()) return 0; 9883 if (break_point_objects()->IsUndefined()) return 0;
9879 // Single beak point. 9884 // Single beak point.
9880 if (!break_point_objects()->IsFixedArray()) return 1; 9885 if (!break_point_objects()->IsFixedArray()) return 1;
9881 // Multiple break points. 9886 // Multiple break points.
9882 return FixedArray::cast(break_point_objects())->length(); 9887 return FixedArray::cast(break_point_objects())->length();
9883 } 9888 }
9884 #endif 9889 #endif
9885 9890
9886 9891
9887 } } // namespace v8::internal 9892 } } // 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