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

Side by Side Diff: src/elements.cc

Issue 15691017: Make assertion scopes thread safe. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 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
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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 149
150 static void CopyObjectToObjectElements(FixedArrayBase* from_base, 150 static void CopyObjectToObjectElements(FixedArrayBase* from_base,
151 ElementsKind from_kind, 151 ElementsKind from_kind,
152 uint32_t from_start, 152 uint32_t from_start,
153 FixedArrayBase* to_base, 153 FixedArrayBase* to_base,
154 ElementsKind to_kind, 154 ElementsKind to_kind,
155 uint32_t to_start, 155 uint32_t to_start,
156 int raw_copy_size) { 156 int raw_copy_size) {
157 ASSERT(to_base->map() != HEAP->fixed_cow_array_map()); 157 ASSERT(to_base->map() != HEAP->fixed_cow_array_map());
158 AssertNoAllocation no_allocation; 158 DisallowHeapAllocation no_allocation;
159 int copy_size = raw_copy_size; 159 int copy_size = raw_copy_size;
160 if (raw_copy_size < 0) { 160 if (raw_copy_size < 0) {
161 ASSERT(raw_copy_size == ElementsAccessor::kCopyToEnd || 161 ASSERT(raw_copy_size == ElementsAccessor::kCopyToEnd ||
162 raw_copy_size == ElementsAccessor::kCopyToEndAndInitializeToHole); 162 raw_copy_size == ElementsAccessor::kCopyToEndAndInitializeToHole);
163 copy_size = Min(from_base->length() - from_start, 163 copy_size = Min(from_base->length() - from_start,
164 to_base->length() - to_start); 164 to_base->length() - to_start);
165 if (raw_copy_size == ElementsAccessor::kCopyToEndAndInitializeToHole) { 165 if (raw_copy_size == ElementsAccessor::kCopyToEndAndInitializeToHole) {
166 int start = to_start + copy_size; 166 int start = to_start + copy_size;
167 int length = to_base->length() - start; 167 int length = to_base->length() - start;
168 if (length > 0) { 168 if (length > 0) {
(...skipping 28 matching lines...) Expand all
197 } 197 }
198 198
199 199
200 static void CopyDictionaryToObjectElements(FixedArrayBase* from_base, 200 static void CopyDictionaryToObjectElements(FixedArrayBase* from_base,
201 uint32_t from_start, 201 uint32_t from_start,
202 FixedArrayBase* to_base, 202 FixedArrayBase* to_base,
203 ElementsKind to_kind, 203 ElementsKind to_kind,
204 uint32_t to_start, 204 uint32_t to_start,
205 int raw_copy_size) { 205 int raw_copy_size) {
206 SeededNumberDictionary* from = SeededNumberDictionary::cast(from_base); 206 SeededNumberDictionary* from = SeededNumberDictionary::cast(from_base);
207 AssertNoAllocation no_allocation; 207 DisallowHeapAllocation no_allocation;
208 int copy_size = raw_copy_size; 208 int copy_size = raw_copy_size;
209 Heap* heap = from->GetHeap(); 209 Heap* heap = from->GetHeap();
210 if (raw_copy_size < 0) { 210 if (raw_copy_size < 0) {
211 ASSERT(raw_copy_size == ElementsAccessor::kCopyToEnd || 211 ASSERT(raw_copy_size == ElementsAccessor::kCopyToEnd ||
212 raw_copy_size == ElementsAccessor::kCopyToEndAndInitializeToHole); 212 raw_copy_size == ElementsAccessor::kCopyToEndAndInitializeToHole);
213 copy_size = from->max_number_key() + 1 - from_start; 213 copy_size = from->max_number_key() + 1 - from_start;
214 if (raw_copy_size == ElementsAccessor::kCopyToEndAndInitializeToHole) { 214 if (raw_copy_size == ElementsAccessor::kCopyToEndAndInitializeToHole) {
215 int start = to_start + copy_size; 215 int start = to_start + copy_size;
216 int length = to_base->length() - start; 216 int length = to_base->length() - start;
217 if (length > 0) { 217 if (length > 0) {
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 833
834 if (extra == 0) return to; 834 if (extra == 0) return to;
835 835
836 // Allocate the result 836 // Allocate the result
837 FixedArray* result; 837 FixedArray* result;
838 MaybeObject* maybe_obj = from->GetHeap()->AllocateFixedArray(len0 + extra); 838 MaybeObject* maybe_obj = from->GetHeap()->AllocateFixedArray(len0 + extra);
839 if (!maybe_obj->To(&result)) return maybe_obj; 839 if (!maybe_obj->To(&result)) return maybe_obj;
840 840
841 // Fill in the content 841 // Fill in the content
842 { 842 {
843 AssertNoAllocation no_gc; 843 DisallowHeapAllocation no_gc;
844 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc); 844 WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
845 for (int i = 0; i < len0; i++) { 845 for (int i = 0; i < len0; i++) {
846 Object* e = to->get(i); 846 Object* e = to->get(i);
847 ASSERT(e->IsString() || e->IsNumber()); 847 ASSERT(e->IsString() || e->IsNumber());
848 result->set(i, e, mode); 848 result->set(i, e, mode);
849 } 849 }
850 } 850 }
851 // Fill in the extra values. 851 // Fill in the extra values.
852 uint32_t index = 0; 852 uint32_t index = 0;
853 for (uint32_t y = 0; y < len1; y++) { 853 for (uint32_t y = 0; y < len1; y++) {
(...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 case FAST_HOLEY_SMI_ELEMENTS: 2037 case FAST_HOLEY_SMI_ELEMENTS:
2038 case FAST_SMI_ELEMENTS: { 2038 case FAST_SMI_ELEMENTS: {
2039 FixedArray* smi_elms = FixedArray::cast(elms); 2039 FixedArray* smi_elms = FixedArray::cast(elms);
2040 for (int index = 0; index < number_of_elements; index++) { 2040 for (int index = 0; index < number_of_elements; index++) {
2041 smi_elms->set(index, (*args)[index], SKIP_WRITE_BARRIER); 2041 smi_elms->set(index, (*args)[index], SKIP_WRITE_BARRIER);
2042 } 2042 }
2043 break; 2043 break;
2044 } 2044 }
2045 case FAST_HOLEY_ELEMENTS: 2045 case FAST_HOLEY_ELEMENTS:
2046 case FAST_ELEMENTS: { 2046 case FAST_ELEMENTS: {
2047 AssertNoAllocation no_gc; 2047 DisallowHeapAllocation no_gc;
2048 WriteBarrierMode mode = elms->GetWriteBarrierMode(no_gc); 2048 WriteBarrierMode mode = elms->GetWriteBarrierMode(no_gc);
2049 FixedArray* object_elms = FixedArray::cast(elms); 2049 FixedArray* object_elms = FixedArray::cast(elms);
2050 for (int index = 0; index < number_of_elements; index++) { 2050 for (int index = 0; index < number_of_elements; index++) {
2051 object_elms->set(index, (*args)[index], mode); 2051 object_elms->set(index, (*args)[index], mode);
2052 } 2052 }
2053 break; 2053 break;
2054 } 2054 }
2055 case FAST_HOLEY_DOUBLE_ELEMENTS: 2055 case FAST_HOLEY_DOUBLE_ELEMENTS:
2056 case FAST_DOUBLE_ELEMENTS: { 2056 case FAST_DOUBLE_ELEMENTS: {
2057 FixedDoubleArray* double_elms = FixedDoubleArray::cast(elms); 2057 FixedDoubleArray* double_elms = FixedDoubleArray::cast(elms);
2058 for (int index = 0; index < number_of_elements; index++) { 2058 for (int index = 0; index < number_of_elements; index++) {
2059 double_elms->set(index, (*args)[index]->Number()); 2059 double_elms->set(index, (*args)[index]->Number());
2060 } 2060 }
2061 break; 2061 break;
2062 } 2062 }
2063 default: 2063 default:
2064 UNREACHABLE(); 2064 UNREACHABLE();
2065 break; 2065 break;
2066 } 2066 }
2067 2067
2068 array->set_elements(elms); 2068 array->set_elements(elms);
2069 array->set_length(Smi::FromInt(number_of_elements)); 2069 array->set_length(Smi::FromInt(number_of_elements));
2070 return array; 2070 return array;
2071 } 2071 }
2072 2072
2073 } } // namespace v8::internal 2073 } } // namespace v8::internal
OLDNEW
« src/api.cc ('K') | « src/disassembler.cc ('k') | src/execution.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698