Thanks for the review Ulan, PTAL.

https://codereview.chromium.org/304143002/diff/20001/src/factory.cc
File src/factory.cc (right):

https://codereview.chromium.org/304143002/diff/20001/src/factory.cc#newcode134
src/factory.cc:134: Handle<ConstantPoolArray>
Factory::NewExtendedConstantPoolArray(
On 2014/06/02 12:32:58, ulan wrote:
Instead of passing this long list arguments around, what if we
introduce
a class NumberOfEntries that stores "int number_of_entries[4]"?

The this function would look like:
NewExtendedConstantPoolArray(NumberOfEntries small, NumberOfEntries
extended);

Constant pool would have a method:
NumberOfEntries ConstantPoolArray::number_of_entries(Section section);

This would also simplify SizeFor* methods.

Good idea - done.

https://codereview.chromium.org/304143002/diff/20001/src/objects-inl.h
File src/objects-inl.h (right):

https://codereview.chromium.org/304143002/diff/20001/src/objects-inl.h#newcode2237
src/objects-inl.h:2237: int index = 0;
On 2014/06/02 12:32:58, ulan wrote:
How about iterating over types and sections in this and other
functions?

Something like this (modulo needs enum casts):

for (int s = 0; s <= section; ++s) {
   for (int t = 0; t < type; ++t) {
     index += number_of_entries(t, s);
   }
}

Done (but only iterating through types).

https://codereview.chromium.org/304143002/diff/20001/src/objects-inl.h#newcode2317
src/objects-inl.h:2317: if (index >= first_index(INT64, section) &&
On 2014/06/02 12:32:58, ulan wrote:
int t = 0;

while (last_index(t, section) < index) ++t;

return t;

Done.

https://codereview.chromium.org/304143002/diff/20001/src/objects.cc
File src/objects.cc (right):

https://codereview.chromium.org/304143002/diff/20001/src/objects.cc#newcode9980
src/objects.cc:9980: if (number_of_entries(CODE_PTR, SMALL_SECTION) > 0)
{
On 2014/06/02 12:32:58, ulan wrote:
Type type[] = {CODE_PTR, HEAP_PTR};
Address value[] = {<illegal builtin entry>, <undefined>};

for (int section = 0; section <= final_section(); ++section) {
   for (int i = 0; i < 2; ++i) {
     if (number_of_entries(type[i], section) > 0) {
       int offset = OffsetOfElementAt(first_index(type[i], section));
       MemsetPointer(
         HeapObject::RawField(this, offset),
         value[i],
         number_of_entries(type[i], section));
     }
   }
}

Done.  I'm not convinced this is clearer though.

https://codereview.chromium.org/304143002/diff/20001/src/objects.h
File src/objects.h (right):

https://codereview.chromium.org/304143002/diff/20001/src/objects.h#newcode3265
src/objects.h:3265: offset += kInt64Size * Min(Max(0, index -
first_index(INT64, section)),
On 2014/06/02 12:32:58, ulan wrote:
int t = 0;
while (last_index(t, section) < index) {
    offset += entry_size(t) * number_of_entries(t, section);
    ++t;
}
offset += entry_size(type) * (index - first_index(t, section));

Done (somewhat differently both to avoid lots of static casts).

https://codereview.chromium.org/304143002/

--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to