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

Side by Side Diff: src/log.cc

Issue 7650010: Avoid some crashes when running without snapshots. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/gc
Patch Set: Address review comments Created 9 years, 4 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/liveedit.cc ('k') | src/objects.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 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 HeapIterator iterator;
1360 AssertNoAllocation no_alloc; 1360 AssertNoAllocation no_alloc;
1361 int compiled_funcs_count = 0; 1361 int compiled_funcs_count = 0;
1362 1362
1363 // Iterate the heap to find shared function info objects and record 1363 // Iterate the heap to find shared function info objects and record
1364 // the unoptimized code for them. 1364 // the unoptimized code for them.
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) {
1375 code_objects[compiled_funcs_count] = Handle<Code>(sfi->code()); 1375 code_objects[compiled_funcs_count] = Handle<Code>(sfi->code());
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 HeapIterator iterator; 1522 HeapIterator iterator;
1523 AssertNoAllocation no_alloc; 1523 AssertNoAllocation no_alloc;
1524 for (HeapObject* obj = iterator.Next(); obj != NULL; obj = iterator.Next()) { 1524 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1525 if (obj->IsCode()) LogCodeObject(obj); 1525 if (obj->IsCode()) LogCodeObject(obj);
1526 } 1526 }
1527 } 1527 }
1528 1528
1529 1529
1530 void Logger::LogCompiledFunctions() { 1530 void Logger::LogCompiledFunctions() {
1531 HandleScope scope; 1531 HandleScope scope;
1532 const int compiled_funcs_count = EnumerateCompiledFunctions(NULL, NULL); 1532 const int compiled_funcs_count = EnumerateCompiledFunctions(NULL, NULL);
1533 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count); 1533 ScopedVector< Handle<SharedFunctionInfo> > sfis(compiled_funcs_count);
1534 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count); 1534 ScopedVector< Handle<Code> > code_objects(compiled_funcs_count);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 Logger::LAZY_COMPILE_TAG, *code_objects[i], 1582 Logger::LAZY_COMPILE_TAG, *code_objects[i],
1583 *shared, *func_name)); 1583 *shared, *func_name));
1584 } 1584 }
1585 } 1585 }
1586 } 1586 }
1587 1587
1588 1588
1589 void Logger::LogAccessorCallbacks() { 1589 void Logger::LogAccessorCallbacks() {
1590 HeapIterator iterator; 1590 HeapIterator iterator;
1591 AssertNoAllocation no_alloc; 1591 AssertNoAllocation no_alloc;
1592 for (HeapObject* obj = iterator.Next(); obj != NULL; obj = iterator.Next()) { 1592 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) {
1593 if (!obj->IsAccessorInfo()) continue; 1593 if (!obj->IsAccessorInfo()) continue;
1594 AccessorInfo* ai = AccessorInfo::cast(obj); 1594 AccessorInfo* ai = AccessorInfo::cast(obj);
1595 if (!ai->name()->IsString()) continue; 1595 if (!ai->name()->IsString()) continue;
1596 String* name = String::cast(ai->name()); 1596 String* name = String::cast(ai->name());
1597 Address getter_entry = v8::ToCData<Address>(ai->getter()); 1597 Address getter_entry = v8::ToCData<Address>(ai->getter());
1598 if (getter_entry != 0) { 1598 if (getter_entry != 0) {
1599 PROFILE(ISOLATE, GetterCallbackEvent(name, getter_entry)); 1599 PROFILE(ISOLATE, GetterCallbackEvent(name, getter_entry));
1600 } 1600 }
1601 Address setter_entry = v8::ToCData<Address>(ai->setter()); 1601 Address setter_entry = v8::ToCData<Address>(ai->setter());
1602 if (setter_entry != 0) { 1602 if (setter_entry != 0) {
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) { 1760 void SamplerRegistry::RemoveActiveSampler(Sampler* sampler) {
1761 ASSERT(sampler->IsActive()); 1761 ASSERT(sampler->IsActive());
1762 ScopedLock lock(mutex_); 1762 ScopedLock lock(mutex_);
1763 ASSERT(active_samplers_ != NULL); 1763 ASSERT(active_samplers_ != NULL);
1764 bool removed = active_samplers_->RemoveElement(sampler); 1764 bool removed = active_samplers_->RemoveElement(sampler);
1765 ASSERT(removed); 1765 ASSERT(removed);
1766 USE(removed); 1766 USE(removed);
1767 } 1767 }
1768 1768
1769 } } // namespace v8::internal 1769 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/liveedit.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698