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

Side by Side Diff: src/heap.cc

Issue 10695120: Ensure that all descriptors have a valid enumeration index, and replace NextEnumIndex with LastAdde… (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comment. Created 8 years, 5 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/factory.cc ('k') | src/ia32/full-codegen-ia32.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 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 3865 matching lines...) Expand 10 before | Expand all | Expand 10 after
3876 { MaybeObject* maybe_descriptors_obj = 3876 { MaybeObject* maybe_descriptors_obj =
3877 DescriptorArray::Allocate(count, DescriptorArray::MAY_BE_SHARED); 3877 DescriptorArray::Allocate(count, DescriptorArray::MAY_BE_SHARED);
3878 if (!maybe_descriptors_obj->To<DescriptorArray>(&descriptors)) { 3878 if (!maybe_descriptors_obj->To<DescriptorArray>(&descriptors)) {
3879 return maybe_descriptors_obj; 3879 return maybe_descriptors_obj;
3880 } 3880 }
3881 } 3881 }
3882 DescriptorArray::WhitenessWitness witness(descriptors); 3882 DescriptorArray::WhitenessWitness witness(descriptors);
3883 for (int i = 0; i < count; i++) { 3883 for (int i = 0; i < count; i++) {
3884 String* name = fun->shared()->GetThisPropertyAssignmentName(i); 3884 String* name = fun->shared()->GetThisPropertyAssignmentName(i);
3885 ASSERT(name->IsSymbol()); 3885 ASSERT(name->IsSymbol());
3886 FieldDescriptor field(name, i, NONE); 3886 FieldDescriptor field(name, i, NONE, i + 1);
3887 field.SetEnumerationIndex(i);
3888 descriptors->Set(i, &field, witness); 3887 descriptors->Set(i, &field, witness);
3889 } 3888 }
3890 descriptors->SetNextEnumerationIndex(count);
3891 descriptors->SortUnchecked(witness); 3889 descriptors->SortUnchecked(witness);
3892 3890
3893 // The descriptors may contain duplicates because the compiler does not 3891 // The descriptors may contain duplicates because the compiler does not
3894 // guarantee the uniqueness of property names (it would have required 3892 // guarantee the uniqueness of property names (it would have required
3895 // quadratic time). Once the descriptors are sorted we can check for 3893 // quadratic time). Once the descriptors are sorted we can check for
3896 // duplicates in linear time. 3894 // duplicates in linear time.
3897 if (HasDuplicates(descriptors)) { 3895 if (HasDuplicates(descriptors)) {
3898 fun->shared()->ForbidInlineConstructor(); 3896 fun->shared()->ForbidInlineConstructor();
3899 } else { 3897 } else {
3900 map->set_instance_descriptors(descriptors); 3898 map->set_instance_descriptors(descriptors);
(...skipping 3320 matching lines...) Expand 10 before | Expand all | Expand 10 after
7221 } else { 7219 } else {
7222 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died. 7220 p ^= 0x1d1ed & (Page::kPageSize - 1); // I died.
7223 } 7221 }
7224 remembered_unmapped_pages_[remembered_unmapped_pages_index_] = 7222 remembered_unmapped_pages_[remembered_unmapped_pages_index_] =
7225 reinterpret_cast<Address>(p); 7223 reinterpret_cast<Address>(p);
7226 remembered_unmapped_pages_index_++; 7224 remembered_unmapped_pages_index_++;
7227 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages; 7225 remembered_unmapped_pages_index_ %= kRememberedUnmappedPages;
7228 } 7226 }
7229 7227
7230 } } // namespace v8::internal 7228 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/factory.cc ('k') | src/ia32/full-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698