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

Side by Side Diff: src/runtime.cc

Issue 7129017: Fix bug in Object.defineProperty where a growing lements dictionary was ignored. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 6 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') | test/mjsunit/object-define-property.js » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 3896 matching lines...) Expand 10 before | Expand all | Expand 10 after
3907 // If proxy is detached, ignore the assignment. Alternatively, 3907 // If proxy is detached, ignore the assignment. Alternatively,
3908 // we could throw an exception. 3908 // we could throw an exception.
3909 if (proto->IsNull()) return *obj_value; 3909 if (proto->IsNull()) return *obj_value;
3910 js_object = Handle<JSObject>::cast(proto); 3910 js_object = Handle<JSObject>::cast(proto);
3911 } 3911 }
3912 NormalizeElements(js_object); 3912 NormalizeElements(js_object);
3913 Handle<NumberDictionary> dictionary(js_object->element_dictionary()); 3913 Handle<NumberDictionary> dictionary(js_object->element_dictionary());
3914 // Make sure that we never go back to fast case. 3914 // Make sure that we never go back to fast case.
3915 dictionary->set_requires_slow_elements(); 3915 dictionary->set_requires_slow_elements();
3916 PropertyDetails details = PropertyDetails(attr, NORMAL); 3916 PropertyDetails details = PropertyDetails(attr, NORMAL);
3917 NumberDictionarySet(dictionary, index, obj_value, details); 3917 Handle<NumberDictionary> extended_dictionary =
3918 NumberDictionarySet(dictionary, index, obj_value, details);
3919 if (*extended_dictionary != *dictionary) {
3920 js_object->set_elements(*extended_dictionary);
3921 }
3918 return *obj_value; 3922 return *obj_value;
3919 } 3923 }
3920 3924
3921 LookupResult result; 3925 LookupResult result;
3922 js_object->LookupRealNamedProperty(*name, &result); 3926 js_object->LookupRealNamedProperty(*name, &result);
3923 3927
3924 // To be compatible with safari we do not change the value on API objects 3928 // To be compatible with safari we do not change the value on API objects
3925 // in defineProperty. Firefox disagrees here, and actually changes the value. 3929 // in defineProperty. Firefox disagrees here, and actually changes the value.
3926 if (result.IsProperty() && 3930 if (result.IsProperty() &&
3927 (result.type() == CALLBACKS) && 3931 (result.type() == CALLBACKS) &&
(...skipping 8424 matching lines...) Expand 10 before | Expand all | Expand 10 after
12352 } else { 12356 } else {
12353 // Handle last resort GC and make sure to allow future allocations 12357 // Handle last resort GC and make sure to allow future allocations
12354 // to grow the heap without causing GCs (if possible). 12358 // to grow the heap without causing GCs (if possible).
12355 isolate->counters()->gc_last_resort_from_js()->Increment(); 12359 isolate->counters()->gc_last_resort_from_js()->Increment();
12356 isolate->heap()->CollectAllGarbage(false); 12360 isolate->heap()->CollectAllGarbage(false);
12357 } 12361 }
12358 } 12362 }
12359 12363
12360 12364
12361 } } // namespace v8::internal 12365 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/handles.cc ('k') | test/mjsunit/object-define-property.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698