| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1548 } | 1548 } |
| 1549 | 1549 |
| 1550 | 1550 |
| 1551 void HeapSnapshotGenerator::ExtractClosureReferences(JSObject* js_obj, | 1551 void HeapSnapshotGenerator::ExtractClosureReferences(JSObject* js_obj, |
| 1552 HeapEntry* entry) { | 1552 HeapEntry* entry) { |
| 1553 if (js_obj->IsJSFunction()) { | 1553 if (js_obj->IsJSFunction()) { |
| 1554 HandleScope hs; | 1554 HandleScope hs; |
| 1555 JSFunction* func = JSFunction::cast(js_obj); | 1555 JSFunction* func = JSFunction::cast(js_obj); |
| 1556 Context* context = func->context(); | 1556 Context* context = func->context(); |
| 1557 ZoneScope zscope(DELETE_ON_EXIT); | 1557 ZoneScope zscope(DELETE_ON_EXIT); |
| 1558 ScopeInfo<ZoneListAllocationPolicy> scope_info( | 1558 Object* scope_info = context->closure()->shared()->scope_info(); |
| 1559 context->closure()->shared()->code()); | 1559 ScopeInfo<ZoneListAllocationPolicy> zone_scope_info(scope_info); |
| 1560 int locals_number = scope_info.NumberOfLocals(); | 1560 int locals_number = zone_scope_info.NumberOfLocals(); |
| 1561 for (int i = 0; i < locals_number; ++i) { | 1561 for (int i = 0; i < locals_number; ++i) { |
| 1562 String* local_name = *scope_info.LocalName(i); | 1562 String* local_name = *zone_scope_info.LocalName(i); |
| 1563 int idx = ScopeInfo<>::ContextSlotIndex( | 1563 int idx = ScopeInfo<>::ContextSlotIndex(scope_info, local_name, NULL); |
| 1564 context->closure()->shared()->code(), local_name, NULL); | |
| 1565 if (idx >= 0 && idx < context->length()) { | 1564 if (idx >= 0 && idx < context->length()) { |
| 1566 snapshot_->SetClosureReference(entry, local_name, context->get(idx)); | 1565 snapshot_->SetClosureReference(entry, local_name, context->get(idx)); |
| 1567 } | 1566 } |
| 1568 } | 1567 } |
| 1569 snapshot_->SetInternalReference(entry, "code", func->shared()); | 1568 snapshot_->SetInternalReference(entry, "code", func->shared()); |
| 1570 } | 1569 } |
| 1571 } | 1570 } |
| 1572 | 1571 |
| 1573 | 1572 |
| 1574 void HeapSnapshotGenerator::ExtractPropertyReferences(JSObject* js_obj, | 1573 void HeapSnapshotGenerator::ExtractPropertyReferences(JSObject* js_obj, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 uint32_t index = static_cast<uint32_t>(k->Number()); | 1625 uint32_t index = static_cast<uint32_t>(k->Number()); |
| 1627 snapshot_->SetElementReference(entry, index, dictionary->ValueAt(i)); | 1626 snapshot_->SetElementReference(entry, index, dictionary->ValueAt(i)); |
| 1628 } | 1627 } |
| 1629 } | 1628 } |
| 1630 } | 1629 } |
| 1631 } | 1630 } |
| 1632 | 1631 |
| 1633 } } // namespace v8::internal | 1632 } } // namespace v8::internal |
| 1634 | 1633 |
| 1635 #endif // ENABLE_LOGGING_AND_PROFILING | 1634 #endif // ENABLE_LOGGING_AND_PROFILING |
| OLD | NEW |