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

Side by Side Diff: src/objects-inl.h

Issue 1481493003: Fix JSFunction's in-object properties initialization. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments Created 5 years 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
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/mjsunit.status » ('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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // Review notes: 5 // Review notes:
6 // 6 //
7 // - The use of macros in these inline functions may seem superfluous 7 // - The use of macros in these inline functions may seem superfluous
8 // but it is absolutely needed to make sure gcc generates optimal 8 // but it is absolutely needed to make sure gcc generates optimal
9 // code. gcc is not happy when attempting to inline too deep. 9 // code. gcc is not happy when attempting to inline too deep.
10 // 10 //
(...skipping 2270 matching lines...) Expand 10 before | Expand all | Expand 10 after
2281 Object* value, 2281 Object* value,
2282 WriteBarrierMode mode) { 2282 WriteBarrierMode mode) {
2283 // Adjust for the number of properties stored in the object. 2283 // Adjust for the number of properties stored in the object.
2284 int offset = GetInObjectPropertyOffset(index); 2284 int offset = GetInObjectPropertyOffset(index);
2285 WRITE_FIELD(this, offset, value); 2285 WRITE_FIELD(this, offset, value);
2286 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode); 2286 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, value, mode);
2287 return value; 2287 return value;
2288 } 2288 }
2289 2289
2290 2290
2291 void JSObject::InitializeBody(Map* map, 2291 void JSObject::InitializeBody(Map* map, int start_offset,
2292 Object* pre_allocated_value, 2292 Object* pre_allocated_value,
2293 Object* filler_value) { 2293 Object* filler_value) {
2294 DCHECK(!filler_value->IsHeapObject() || 2294 DCHECK(!filler_value->IsHeapObject() ||
2295 !GetHeap()->InNewSpace(filler_value)); 2295 !GetHeap()->InNewSpace(filler_value));
2296 DCHECK(!pre_allocated_value->IsHeapObject() || 2296 DCHECK(!pre_allocated_value->IsHeapObject() ||
2297 !GetHeap()->InNewSpace(pre_allocated_value)); 2297 !GetHeap()->InNewSpace(pre_allocated_value));
2298 int size = map->instance_size(); 2298 int size = map->instance_size();
2299 int offset = kHeaderSize; 2299 int offset = start_offset;
2300 if (filler_value != pre_allocated_value) { 2300 if (filler_value != pre_allocated_value) {
2301 int end_of_pre_allocated_offset = 2301 int end_of_pre_allocated_offset =
2302 size - (map->unused_property_fields() * kPointerSize); 2302 size - (map->unused_property_fields() * kPointerSize);
2303 DCHECK_LE(kHeaderSize, end_of_pre_allocated_offset); 2303 DCHECK_LE(kHeaderSize, end_of_pre_allocated_offset);
2304 while (offset < end_of_pre_allocated_offset) { 2304 while (offset < end_of_pre_allocated_offset) {
2305 WRITE_FIELD(this, offset, pre_allocated_value); 2305 WRITE_FIELD(this, offset, pre_allocated_value);
2306 offset += kPointerSize; 2306 offset += kPointerSize;
2307 } 2307 }
2308 } 2308 }
2309 while (offset < size) { 2309 while (offset < size) {
(...skipping 5581 matching lines...) Expand 10 before | Expand all | Expand 10 after
7891 #undef WRITE_INT64_FIELD 7891 #undef WRITE_INT64_FIELD
7892 #undef READ_BYTE_FIELD 7892 #undef READ_BYTE_FIELD
7893 #undef WRITE_BYTE_FIELD 7893 #undef WRITE_BYTE_FIELD
7894 #undef NOBARRIER_READ_BYTE_FIELD 7894 #undef NOBARRIER_READ_BYTE_FIELD
7895 #undef NOBARRIER_WRITE_BYTE_FIELD 7895 #undef NOBARRIER_WRITE_BYTE_FIELD
7896 7896
7897 } // namespace internal 7897 } // namespace internal
7898 } // namespace v8 7898 } // namespace v8
7899 7899
7900 #endif // V8_OBJECTS_INL_H_ 7900 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | test/mjsunit/mjsunit.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698