Incorporate patches by Paolo Giarrusso to allow profiling

C++ functions in shared libraries, building in directories
containing spaces, and using named constants better.
Review URL: http://codereview.chromium.org/7864

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@550 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
kasperl@chromium.org 2008-10-22 09:46:09 +00:00
parent 1aae797ddd
commit 50d9f5e256
5 changed files with 20 additions and 12 deletions

View File

@ -109,7 +109,7 @@ def ConfigureObjectFiles():
env.Replace(**context.flags['v8'])
context.ApplyEnvOverrides(env)
env['BUILDERS']['JS2C'] = Builder(action=js2c.JS2C)
env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET --logfile $LOGFILE')
env['BUILDERS']['Snapshot'] = Builder(action='$SOURCE $TARGET --logfile "$LOGFILE"')
# Build the standard platform-independent source files.
source_files = context.GetRelevantSources(SOURCES)

View File

@ -1160,7 +1160,7 @@ void DescriptorArray::Swap(int first, int second) {
bool Dictionary::requires_slow_elements() {
Object* max_index_object = get(kPrefixStartIndex);
Object* max_index_object = get(kMaxNumberKeyIndex);
if (!max_index_object->IsSmi()) return false;
return 0 !=
(Smi::cast(max_index_object)->value() & kRequiresSlowElementsMask);
@ -1169,7 +1169,7 @@ bool Dictionary::requires_slow_elements() {
uint32_t Dictionary::max_number_key() {
ASSERT(!requires_slow_elements());
Object* max_index_object = get(kPrefixStartIndex);
Object* max_index_object = get(kMaxNumberKeyIndex);
if (!max_index_object->IsSmi()) return 0;
uint32_t value = static_cast<uint32_t>(Smi::cast(max_index_object)->value());
return value >> kRequiresSlowElementsTagSize;

View File

@ -3924,7 +3924,10 @@ bool String::SlowAsArrayIndex(uint32_t* index) {
static inline uint32_t HashField(uint32_t hash, bool is_array_index) {
return (hash << String::kLongLengthShift) | (is_array_index ? 3 : 1);
uint32_t result =
(hash << String::kLongLengthShift) | String::kHashComputedMask;
if (is_array_index) result |= String::kIsArrayIndexMask;
return result;
}
@ -6067,13 +6070,13 @@ void Dictionary::UpdateMaxNumberKey(uint32_t key) {
// Check if this index is high enough that we should require slow
// elements.
if (key > kRequiresSlowElementsLimit) {
set(kPrefixStartIndex, Smi::FromInt(kRequiresSlowElementsMask));
set(kMaxNumberKeyIndex, Smi::FromInt(kRequiresSlowElementsMask));
return;
}
// Update max key value.
Object* max_index_object = get(kPrefixStartIndex);
Object* max_index_object = get(kMaxNumberKeyIndex);
if (!max_index_object->IsSmi() || max_number_key() < key) {
set(kPrefixStartIndex, Smi::FromInt(key << kRequiresSlowElementsTagSize));
set(kMaxNumberKeyIndex, Smi::FromInt(key << kRequiresSlowElementsTagSize));
}
}

View File

@ -1966,11 +1966,11 @@ class Dictionary: public DictionaryBase {
// Accessors for next enumeration index.
void SetNextEnumerationIndex(int index) {
fast_set(this, kNextEnumnerationIndexIndex, Smi::FromInt(index));
fast_set(this, kNextEnumerationIndexIndex, Smi::FromInt(index));
}
int NextEnumerationIndex() {
return Smi::cast(get(kNextEnumnerationIndexIndex))->value();
return Smi::cast(get(kNextEnumerationIndexIndex))->value();
}
// Returns a new array for dictionary usage. Might return Failure.
@ -2014,7 +2014,7 @@ class Dictionary: public DictionaryBase {
Object* GenerateNewEnumerationIndices();
static const int kMaxNumberKeyIndex = kPrefixStartIndex;
static const int kNextEnumnerationIndexIndex = kMaxNumberKeyIndex + 1;
static const int kNextEnumerationIndexIndex = kMaxNumberKeyIndex + 1;
DISALLOW_IMPLICIT_CONSTRUCTORS(Dictionary);
};

View File

@ -30,13 +30,18 @@
# Usage: process-ticks.py <logfile>
# Where <logfile> is the log file name (eg, v8.log).
import os, re, sys, tickprocessor, getopt;
import subprocess, re, sys, tickprocessor, getopt
class LinuxTickProcessor(tickprocessor.TickProcessor):
def ParseVMSymbols(self, filename, start, end):
"""Extract symbols and add them to the cpp entries."""
pipe = os.popen('nm -n %s | c++filt' % filename, 'r')
# Extra both dynamic and non-dynamic symbols.
command = 'nm -C -n "%s"; nm -C -n -D "%s"' % (filename, filename)
process = subprocess.Popen(command, shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
pipe = process.stdout
try:
for line in pipe:
row = re.match('^([0-9a-fA-F]{8}) . (.*)$', line)