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

Unified Diff: src/objects-inl.h

Issue 376973002: [Arm]: Optimize ConstantPoolBuilder::Populate code by minimizing calls to OffsetOfElementAt (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 434ae95ac65e47f92f3af6c1973a66c4d6fa9c95..b841ee60f2b5ee544944dfe1000175486155c851 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -2462,6 +2462,15 @@ int ConstantPoolArray::number_of_entries(Type type, LayoutSection section) {
}
+bool ConstantPoolArray::offset_is_type(int offset, Type type) {
+ return (offset >= OffsetOfElementAt(first_index(type, SMALL_SECTION)) &&
+ offset <= OffsetOfElementAt(last_index(type, SMALL_SECTION))) ||
+ (is_extended_layout() &&
+ offset >= OffsetOfElementAt(first_index(type, EXTENDED_SECTION)) &&
+ offset <= OffsetOfElementAt(last_index(type, EXTENDED_SECTION)));
+}
+
+
ConstantPoolArray::Type ConstantPoolArray::get_type(int index) {
LayoutSection section;
if (is_extended_layout() && index >= first_extended_section_index()) {
@@ -2552,6 +2561,43 @@ void ConstantPoolArray::set(int index, int32_t value) {
}
+void ConstantPoolArray::set_at_offset(int offset, int32_t value) {
+ ASSERT(map() == GetHeap()->constant_pool_array_map());
+ ASSERT(offset_is_type(offset, INT32));
+ WRITE_INT32_FIELD(this, offset, value);
+}
+
+
+void ConstantPoolArray::set_at_offset(int offset, int64_t value) {
+ ASSERT(map() == GetHeap()->constant_pool_array_map());
+ ASSERT(offset_is_type(offset, INT64));
+ WRITE_INT64_FIELD(this, offset, value);
+}
+
+
+void ConstantPoolArray::set_at_offset(int offset, double value) {
+ ASSERT(map() == GetHeap()->constant_pool_array_map());
+ ASSERT(offset_is_type(offset, INT64));
+ WRITE_DOUBLE_FIELD(this, offset, value);
+}
+
+
+void ConstantPoolArray::set_at_offset(int offset, Address value) {
+ ASSERT(map() == GetHeap()->constant_pool_array_map());
+ ASSERT(offset_is_type(offset, CODE_PTR));
+ WRITE_FIELD(this, offset, reinterpret_cast<Object*>(value));
+ WRITE_BARRIER(GetHeap(), this, offset, reinterpret_cast<Object*>(value));
+}
+
+
+void ConstantPoolArray::set_at_offset(int offset, Object* value) {
+ ASSERT(map() == GetHeap()->constant_pool_array_map());
+ ASSERT(offset_is_type(offset, HEAP_PTR));
+ WRITE_FIELD(this, offset, value);
+ WRITE_BARRIER(GetHeap(), this, offset, value);
+}
+
+
void ConstantPoolArray::Init(const NumberOfEntries& small) {
uint32_t small_layout_1 =
Int64CountField::encode(small.count_of(INT64)) |
« 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