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

Side by Side Diff: src/objects.cc

Issue 11759022: Check for read-only-ness when preparing for array sort. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 11 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 | test/mjsunit/regress/regress-2419.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 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 11878 matching lines...) Expand 10 before | Expand all | Expand 10 after
11889 int capacity = dict->Capacity(); 11889 int capacity = dict->Capacity();
11890 for (int i = 0; i < capacity; i++) { 11890 for (int i = 0; i < capacity; i++) {
11891 Object* k = dict->KeyAt(i); 11891 Object* k = dict->KeyAt(i);
11892 if (dict->IsKey(k)) { 11892 if (dict->IsKey(k)) {
11893 ASSERT(k->IsNumber()); 11893 ASSERT(k->IsNumber());
11894 ASSERT(!k->IsSmi() || Smi::cast(k)->value() >= 0); 11894 ASSERT(!k->IsSmi() || Smi::cast(k)->value() >= 0);
11895 ASSERT(!k->IsHeapNumber() || HeapNumber::cast(k)->value() >= 0); 11895 ASSERT(!k->IsHeapNumber() || HeapNumber::cast(k)->value() >= 0);
11896 ASSERT(!k->IsHeapNumber() || HeapNumber::cast(k)->value() <= kMaxUInt32); 11896 ASSERT(!k->IsHeapNumber() || HeapNumber::cast(k)->value() <= kMaxUInt32);
11897 Object* value = dict->ValueAt(i); 11897 Object* value = dict->ValueAt(i);
11898 PropertyDetails details = dict->DetailsAt(i); 11898 PropertyDetails details = dict->DetailsAt(i);
11899 if (details.type() == CALLBACKS) { 11899 if (details.type() == CALLBACKS || details.IsReadOnly()) {
11900 // Bail out and do the sorting of undefineds and array holes in JS. 11900 // Bail out and do the sorting of undefineds and array holes in JS.
11901 // Also bail out if the element is not supposed to be moved.
11901 return Smi::FromInt(-1); 11902 return Smi::FromInt(-1);
11902 } 11903 }
11903 uint32_t key = NumberToUint32(k); 11904 uint32_t key = NumberToUint32(k);
11904 // In the following we assert that adding the entry to the new dictionary 11905 // In the following we assert that adding the entry to the new dictionary
11905 // does not cause GC. This is the case because we made sure to allocate 11906 // does not cause GC. This is the case because we made sure to allocate
11906 // the dictionary big enough above, so it need not grow. 11907 // the dictionary big enough above, so it need not grow.
11907 if (key < limit) { 11908 if (key < limit) {
11908 if (value->IsUndefined()) { 11909 if (value->IsUndefined()) {
11909 undefs++; 11910 undefs++;
11910 } else { 11911 } else {
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after
13723 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); 13724 set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER);
13724 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); 13725 set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER);
13725 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); 13726 set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER);
13726 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); 13727 set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER);
13727 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); 13728 set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER);
13728 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); 13729 set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER);
13729 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); 13730 set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER);
13730 } 13731 }
13731 13732
13732 } } // namespace v8::internal 13733 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-2419.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698