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

Side by Side Diff: src/log.cc

Issue 8139027: Version 3.6.5 (Closed) Base URL: http://v8.googlecode.com/svn/trunk/
Patch Set: '' Created 9 years, 2 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/log.h ('k') | src/macro-assembler.h » ('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 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 1349
1350 private: 1350 private:
1351 Handle<SharedFunctionInfo>* sfis_; 1351 Handle<SharedFunctionInfo>* sfis_;
1352 Handle<Code>* code_objects_; 1352 Handle<Code>* code_objects_;
1353 int* count_; 1353 int* count_;
1354 }; 1354 };
1355 1355
1356 1356
1357 static int EnumerateCompiledFunctions(Handle<SharedFunctionInfo>* sfis, 1357 static int EnumerateCompiledFunctions(Handle<SharedFunctionInfo>* sfis,
1358 Handle<Code>* code_objects) { 1358 Handle<Code>* code_objects) {
1359 HeapIterator iterator;
1359 AssertNoAllocation no_alloc; 1360 AssertNoAllocation no_alloc;
1360 int compiled_funcs_count = 0; 1361 int compiled_funcs_count = 0;
1361 1362
1362 // Iterate the heap to find shared function info objects and record 1363 // Iterate the heap to find shared function info objects and record
1363 // the unoptimized code for them. 1364 // the unoptimized code for them.
1364 HeapIterator iterator;
1365 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1365 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1366 if (!obj->IsSharedFunctionInfo()) continue; 1366 if (!obj->IsSharedFunctionInfo()) continue;
1367 SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj); 1367 SharedFunctionInfo* sfi = SharedFunctionInfo::cast(obj);
1368 if (sfi->is_compiled() 1368 if (sfi->is_compiled()
1369 && (!sfi->script()->IsScript() 1369 && (!sfi->script()->IsScript()
1370 || Script::cast(sfi->script())->HasValidSource())) { 1370 || Script::cast(sfi->script())->HasValidSource())) {
1371 if (sfis != NULL) { 1371 if (sfis != NULL) {
1372 sfis[compiled_funcs_count] = Handle<SharedFunctionInfo>(sfi); 1372 sfis[compiled_funcs_count] = Handle<SharedFunctionInfo>(sfi);
1373 } 1373 }
1374 if (code_objects != NULL) { 1374 if (code_objects != NULL) {
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 1512
1513 1513
1514 void Logger::LowLevelLogWriteBytes(const char* bytes, int size) { 1514 void Logger::LowLevelLogWriteBytes(const char* bytes, int size) {
1515 size_t rv = fwrite(bytes, 1, size, log_->ll_output_handle_); 1515 size_t rv = fwrite(bytes, 1, size, log_->ll_output_handle_);
1516 ASSERT(static_cast<size_t>(size) == rv); 1516 ASSERT(static_cast<size_t>(size) == rv);
1517 USE(rv); 1517 USE(rv);
1518 } 1518 }
1519 1519
1520 1520
1521 void Logger::LogCodeObjects() { 1521 void Logger::LogCodeObjects() {
1522 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask);
1523 HeapIterator iterator;
1522 AssertNoAllocation no_alloc; 1524 AssertNoAllocation no_alloc;
1523 HeapIterator iterator;
1524 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1525 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1525 if (obj->IsCode()) LogCodeObject(obj); 1526 if (obj->IsCode()) LogCodeObject(obj);
1526 } 1527 }
1527 } 1528 }
1528 1529
1529 1530
1530 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared, 1531 void Logger::LogExistingFunction(Handle<SharedFunctionInfo> shared,
1531 Handle<Code> code) { 1532 Handle<Code> code) {
1532 Handle<String> func_name(shared->DebugName()); 1533 Handle<String> func_name(shared->DebugName());
1533 if (shared->script()->IsScript()) { 1534 if (shared->script()->IsScript()) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
1566 } 1567 }
1567 } else { 1568 } else {
1568 PROFILE(ISOLATE, 1569 PROFILE(ISOLATE,
1569 CodeCreateEvent( 1570 CodeCreateEvent(
1570 Logger::LAZY_COMPILE_TAG, *code, *shared, *func_name)); 1571 Logger::LAZY_COMPILE_TAG, *code, *shared, *func_name));
1571 } 1572 }
1572 } 1573 }
1573 1574
1574 1575
1575 void Logger::LogCompiledFunctions() { 1576 void Logger::LogCompiledFunctions() {
1577 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask);
1576 HandleScope scope; 1578 HandleScope scope;
1577 const int compiled_funcs_count = EnumerateCompiledFunctions(NULL, NULL); 1579 const int compiled_funcs_count = EnumerateCompiledFunctions(NULL, NULL);
1578 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); 1580 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count);
1579 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); 1581 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count);
1580 EnumerateCompiledFunctions(sfis.start(), code_objects.start()); 1582 EnumerateCompiledFunctions(sfis.start(), code_objects.start());
1581 1583
1582 // During iteration, there can be heap allocation due to 1584 // During iteration, there can be heap allocation due to
1583 // GetScriptLineNumber call. 1585 // GetScriptLineNumber call.
1584 for (int i = 0; i < compiled_funcs_count; ++i) { 1586 for (int i = 0; i < compiled_funcs_count; ++i) {
1585 if (*code_objects[i] == Isolate::Current()->builtins()->builtin( 1587 if (*code_objects[i] == Isolate::Current()->builtins()->builtin(
1586 Builtins::kLazyCompile)) 1588 Builtins::kLazyCompile))
1587 continue; 1589 continue;
1588 LogExistingFunction(sfis[i], code_objects[i]); 1590 LogExistingFunction(sfis[i], code_objects[i]);
1589 } 1591 }
1590 } 1592 }
1591 1593
1592 1594
1593 void Logger::LogAccessorCallbacks() { 1595 void Logger::LogAccessorCallbacks() {
1596 HEAP->CollectAllGarbage(Heap::kMakeHeapIterableMask);
1597 HeapIterator iterator;
1594 AssertNoAllocation no_alloc; 1598 AssertNoAllocation no_alloc;
1595 HeapIterator iterator;
1596 i::Isolate* isolate = ISOLATE;
1597 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { 1599 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1598 if (!obj->IsAccessorInfo()) continue; 1600 if (!obj->IsAccessorInfo()) continue;
1599 AccessorInfo* ai = AccessorInfo::cast(obj); 1601 AccessorInfo* ai = AccessorInfo::cast(obj);
1600 if (!ai->name()->IsString()) continue; 1602 if (!ai->name()->IsString()) continue;
1601 String* name = String::cast(ai->name()); 1603 String* name = String::cast(ai->name());
1602 Address getter_entry = v8::ToCData<Address>(ai->getter()); 1604 Address getter_entry = v8::ToCData<Address>(ai->getter());
1603 if (getter_entry != 0) { 1605 if (getter_entry != 0) {
1604 PROFILE(isolate, GetterCallbackEvent(name, getter_entry)); 1606 PROFILE(ISOLATE, GetterCallbackEvent(name, getter_entry));
1605 } 1607 }
1606 Address setter_entry = v8::ToCData<Address>(ai->setter()); 1608 Address setter_entry = v8::ToCData<Address>(ai->setter());
1607 if (setter_entry != 0) { 1609 if (setter_entry != 0) {
1608 PROFILE(isolate, SetterCallbackEvent(name, setter_entry)); 1610 PROFILE(ISOLATE, SetterCallbackEvent(name, setter_entry));
1609 } 1611 }
1610 } 1612 }
1611 } 1613 }
1612 1614
1613 1615
1614 bool Logger::Setup() { 1616 bool Logger::Setup() {
1615 // Tests and EnsureInitialize() can call this twice in a row. It's harmless. 1617 // Tests and EnsureInitialize() can call this twice in a row. It's harmless.
1616 if (is_initialized_) return true; 1618 if (is_initialized_) return true;
1617 is_initialized_ = true; 1619 is_initialized_ = true;
1618 1620
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
1765 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { 1767 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) {
1766 ASSERT(sampler->IsActive()); 1768 ASSERT(sampler->IsActive());
1767 ScopedLock lock(mutex_); 1769 ScopedLock lock(mutex_);
1768 ASSERT(active_samplers_ != NULL); 1770 ASSERT(active_samplers_ != NULL);
1769 bool removed = active_samplers_->RemoveElement(sampler); 1771 bool removed = active_samplers_->RemoveElement(sampler);
1770 ASSERT(removed); 1772 ASSERT(removed);
1771 USE(removed); 1773 USE(removed);
1772 } 1774 }
1773 1775
1774 } } // namespace v8::internal 1776 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/log.h ('k') | src/macro-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698