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

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

Issue 7929001: Initialize pre-allocated fields of JSObject with undefined. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Added ARM port. Created 9 years, 3 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/objects.h ('k') | src/x64/builtins-x64.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 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 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 index -= map()->inobject_properties(); 1587 index -= map()->inobject_properties();
1588 ASSERT(index < 0); 1588 ASSERT(index < 0);
1589 int offset = map()->instance_size() + (index * kPointerSize); 1589 int offset = map()->instance_size() + (index * kPointerSize);
1590 WRITE_FIELD(this, offset, value); 1590 WRITE_FIELD(this, offset, value);
1591 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, mode); 1591 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, offset, mode);
1592 return value; 1592 return value;
1593 } 1593 }
1594 1594
1595 1595
1596 1596
1597 void JSObject::InitializeBody(int object_size, Object* value) { 1597 void JSObject::InitializeBody(Map* map,
1598 ASSERT(!value->IsHeapObject() || !GetHeap()->InNewSpace(value)); 1598 Object* pre_allocated_value,
1599 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { 1599 Object* filler_value) {
1600 WRITE_FIELD(this, offset, value); 1600 ASSERT(!filler_value->IsHeapObject() ||
1601 !GetHeap()->InNewSpace(filler_value));
1602 ASSERT(!pre_allocated_value->IsHeapObject() ||
1603 !GetHeap()->InNewSpace(pre_allocated_value));
1604 int size = map->instance_size();
1605 int offset = kHeaderSize;
1606 if (filler_value != pre_allocated_value) {
1607 int pre_allocated = map->pre_allocated_property_fields();
1608 ASSERT(pre_allocated * kPointerSize + kHeaderSize <= size);
1609 for (int i = 0; i < pre_allocated; i++) {
1610 WRITE_FIELD(this, offset, pre_allocated_value);
1611 offset += kPointerSize;
1612 }
1613 }
1614 while (offset < size) {
1615 WRITE_FIELD(this, offset, filler_value);
1616 offset += kPointerSize;
1601 } 1617 }
1602 } 1618 }
1603 1619
1604 1620
1605 bool JSObject::HasFastProperties() { 1621 bool JSObject::HasFastProperties() {
1606 return !properties()->IsDictionary(); 1622 return !properties()->IsDictionary();
1607 } 1623 }
1608 1624
1609 1625
1610 int JSObject::MaxFastProperties() { 1626 int JSObject::MaxFastProperties() {
(...skipping 3032 matching lines...) Expand 10 before | Expand all | Expand 10 after
4643 #undef WRITE_INT_FIELD 4659 #undef WRITE_INT_FIELD
4644 #undef READ_SHORT_FIELD 4660 #undef READ_SHORT_FIELD
4645 #undef WRITE_SHORT_FIELD 4661 #undef WRITE_SHORT_FIELD
4646 #undef READ_BYTE_FIELD 4662 #undef READ_BYTE_FIELD
4647 #undef WRITE_BYTE_FIELD 4663 #undef WRITE_BYTE_FIELD
4648 4664
4649 4665
4650 } } // namespace v8::internal 4666 } } // namespace v8::internal
4651 4667
4652 #endif // V8_OBJECTS_INL_H_ 4668 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698