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

Side by Side Diff: src/profile-generator.cc

Issue 2908009: Create a separate class to encapsulate ScopeInfo serialization.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 5 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/parser.cc ('k') | src/runtime.cc » ('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 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
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 Object* scope_info = context->closure()->shared()->scope_info(); 1558 SerializedScopeInfo* serialized_scope_info =
1559 ScopeInfo<ZoneListAllocationPolicy> zone_scope_info(scope_info); 1559 context->closure()->shared()->scope_info();
1560 ScopeInfo<ZoneListAllocationPolicy> zone_scope_info(serialized_scope_info);
1560 int locals_number = zone_scope_info.NumberOfLocals(); 1561 int locals_number = zone_scope_info.NumberOfLocals();
1561 for (int i = 0; i < locals_number; ++i) { 1562 for (int i = 0; i < locals_number; ++i) {
1562 String* local_name = *zone_scope_info.LocalName(i); 1563 String* local_name = *zone_scope_info.LocalName(i);
1563 int idx = ScopeInfo<>::ContextSlotIndex(scope_info, local_name, NULL); 1564 int idx = serialized_scope_info->ContextSlotIndex(local_name, NULL);
1564 if (idx >= 0 && idx < context->length()) { 1565 if (idx >= 0 && idx < context->length()) {
1565 snapshot_->SetClosureReference(entry, local_name, context->get(idx)); 1566 snapshot_->SetClosureReference(entry, local_name, context->get(idx));
1566 } 1567 }
1567 } 1568 }
1568 snapshot_->SetInternalReference(entry, "code", func->shared()); 1569 snapshot_->SetInternalReference(entry, "code", func->shared());
1569 } 1570 }
1570 } 1571 }
1571 1572
1572 1573
1573 void HeapSnapshotGenerator::ExtractPropertyReferences(JSObject* js_obj, 1574 void HeapSnapshotGenerator::ExtractPropertyReferences(JSObject* js_obj,
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1625 uint32_t index = static_cast<uint32_t>(k->Number()); 1626 uint32_t index = static_cast<uint32_t>(k->Number());
1626 snapshot_->SetElementReference(entry, index, dictionary->ValueAt(i)); 1627 snapshot_->SetElementReference(entry, index, dictionary->ValueAt(i));
1627 } 1628 }
1628 } 1629 }
1629 } 1630 }
1630 } 1631 }
1631 1632
1632 } } // namespace v8::internal 1633 } } // namespace v8::internal
1633 1634
1634 #endif // ENABLE_LOGGING_AND_PROFILING 1635 #endif // ENABLE_LOGGING_AND_PROFILING
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698