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

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

Issue 8572003: Avoid write barrier when writing an external pointer to an internal field. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 1 month 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') | no next file » | 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 1367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1378 ASSERT(index < GetInternalFieldCount() && index >= 0); 1378 ASSERT(index < GetInternalFieldCount() && index >= 0);
1379 // Internal objects do follow immediately after the header, whereas in-object 1379 // Internal objects do follow immediately after the header, whereas in-object
1380 // properties are at the end of the object. Therefore there is no need 1380 // properties are at the end of the object. Therefore there is no need
1381 // to adjust the index here. 1381 // to adjust the index here.
1382 int offset = GetHeaderSize() + (kPointerSize * index); 1382 int offset = GetHeaderSize() + (kPointerSize * index);
1383 WRITE_FIELD(this, offset, value); 1383 WRITE_FIELD(this, offset, value);
1384 WRITE_BARRIER(GetHeap(), this, offset, value); 1384 WRITE_BARRIER(GetHeap(), this, offset, value);
1385 } 1385 }
1386 1386
1387 1387
1388 void JSObject::SetInternalField(int index, Smi* value) {
1389 ASSERT(index < GetInternalFieldCount() && index >= 0);
1390 // Internal objects do follow immediately after the header, whereas in-object
1391 // properties are at the end of the object. Therefore there is no need
1392 // to adjust the index here.
1393 int offset = GetHeaderSize() + (kPointerSize * index);
1394 WRITE_FIELD(this, offset, value);
1395 }
1396
1397
1388 // Access fast-case object properties at index. The use of these routines 1398 // Access fast-case object properties at index. The use of these routines
1389 // is needed to correctly distinguish between properties stored in-object and 1399 // is needed to correctly distinguish between properties stored in-object and
1390 // properties stored in the properties array. 1400 // properties stored in the properties array.
1391 Object* JSObject::FastPropertyAt(int index) { 1401 Object* JSObject::FastPropertyAt(int index) {
1392 // Adjust for the number of properties stored in the object. 1402 // Adjust for the number of properties stored in the object.
1393 index -= map()->inobject_properties(); 1403 index -= map()->inobject_properties();
1394 if (index < 0) { 1404 if (index < 0) {
1395 int offset = map()->instance_size() + (index * kPointerSize); 1405 int offset = map()->instance_size() + (index * kPointerSize);
1396 return READ_FIELD(this, offset); 1406 return READ_FIELD(this, offset);
1397 } else { 1407 } else {
(...skipping 3220 matching lines...) Expand 10 before | Expand all | Expand 10 after
4618 #undef WRITE_INT_FIELD 4628 #undef WRITE_INT_FIELD
4619 #undef READ_SHORT_FIELD 4629 #undef READ_SHORT_FIELD
4620 #undef WRITE_SHORT_FIELD 4630 #undef WRITE_SHORT_FIELD
4621 #undef READ_BYTE_FIELD 4631 #undef READ_BYTE_FIELD
4622 #undef WRITE_BYTE_FIELD 4632 #undef WRITE_BYTE_FIELD
4623 4633
4624 4634
4625 } } // namespace v8::internal 4635 } } // namespace v8::internal
4626 4636
4627 #endif // V8_OBJECTS_INL_H_ 4637 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698