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

Side by Side Diff: src/profiler/heap-snapshot-generator.cc

Issue 1406113007: Merge GlobalObject with JSGlobalObject. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « src/ppc/macro-assembler-ppc.cc ('k') | src/runtime/runtime-object.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/profiler/heap-snapshot-generator.h" 5 #include "src/profiler/heap-snapshot-generator.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/debug/debug.h" 9 #include "src/debug/debug.h"
10 #include "src/profiler/allocation-tracker.h" 10 #include "src/profiler/allocation-tracker.h"
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 SetInternalReference(js_fun, entry, 1155 SetInternalReference(js_fun, entry,
1156 "context", js_fun->context(), 1156 "context", js_fun->context(),
1157 JSFunction::kContextOffset); 1157 JSFunction::kContextOffset);
1158 SetWeakReference(js_fun, entry, 1158 SetWeakReference(js_fun, entry,
1159 "next_function_link", js_fun->next_function_link(), 1159 "next_function_link", js_fun->next_function_link(),
1160 JSFunction::kNextFunctionLinkOffset); 1160 JSFunction::kNextFunctionLinkOffset);
1161 STATIC_ASSERT(JSFunction::kNextFunctionLinkOffset 1161 STATIC_ASSERT(JSFunction::kNextFunctionLinkOffset
1162 == JSFunction::kNonWeakFieldsEndOffset); 1162 == JSFunction::kNonWeakFieldsEndOffset);
1163 STATIC_ASSERT(JSFunction::kNextFunctionLinkOffset + kPointerSize 1163 STATIC_ASSERT(JSFunction::kNextFunctionLinkOffset + kPointerSize
1164 == JSFunction::kSize); 1164 == JSFunction::kSize);
1165 } else if (obj->IsGlobalObject()) { 1165 } else if (obj->IsJSGlobalObject()) {
1166 GlobalObject* global_obj = GlobalObject::cast(obj); 1166 JSGlobalObject* global_obj = JSGlobalObject::cast(obj);
1167 SetInternalReference(global_obj, entry, 1167 SetInternalReference(global_obj, entry, "native_context",
1168 "native_context", global_obj->native_context(), 1168 global_obj->native_context(),
1169 GlobalObject::kNativeContextOffset); 1169 JSGlobalObject::kNativeContextOffset);
1170 SetInternalReference(global_obj, entry, 1170 SetInternalReference(global_obj, entry, "global_proxy",
1171 "global_proxy", global_obj->global_proxy(), 1171 global_obj->global_proxy(),
1172 GlobalObject::kGlobalProxyOffset); 1172 JSGlobalObject::kGlobalProxyOffset);
1173 STATIC_ASSERT(GlobalObject::kHeaderSize - JSObject::kHeaderSize == 1173 STATIC_ASSERT(JSGlobalObject::kSize - JSObject::kHeaderSize ==
1174 2 * kPointerSize); 1174 2 * kPointerSize);
1175 } else if (obj->IsJSArrayBufferView()) { 1175 } else if (obj->IsJSArrayBufferView()) {
1176 JSArrayBufferView* view = JSArrayBufferView::cast(obj); 1176 JSArrayBufferView* view = JSArrayBufferView::cast(obj);
1177 SetInternalReference(view, entry, "buffer", view->buffer(), 1177 SetInternalReference(view, entry, "buffer", view->buffer(),
1178 JSArrayBufferView::kBufferOffset); 1178 JSArrayBufferView::kBufferOffset);
1179 } 1179 }
1180 TagObject(js_obj->properties(), "(object properties)"); 1180 TagObject(js_obj->properties(), "(object properties)");
1181 SetInternalReference(obj, entry, 1181 SetInternalReference(obj, entry,
1182 "properties", js_obj->properties(), 1182 "properties", js_obj->properties(),
1183 JSObject::kPropertiesOffset); 1183 JSObject::kPropertiesOffset);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 Context::index == Context::MAP_CACHE_INDEX) { \ 1253 Context::index == Context::MAP_CACHE_INDEX) { \
1254 SetInternalReference(context, entry, #name, context->get(Context::index), \ 1254 SetInternalReference(context, entry, #name, context->get(Context::index), \
1255 FixedArray::OffsetOfElementAt(Context::index)); \ 1255 FixedArray::OffsetOfElementAt(Context::index)); \
1256 } else { \ 1256 } else { \
1257 SetWeakReference(context, entry, #name, context->get(Context::index), \ 1257 SetWeakReference(context, entry, #name, context->get(Context::index), \
1258 FixedArray::OffsetOfElementAt(Context::index)); \ 1258 FixedArray::OffsetOfElementAt(Context::index)); \
1259 } 1259 }
1260 EXTRACT_CONTEXT_FIELD(CLOSURE_INDEX, JSFunction, closure); 1260 EXTRACT_CONTEXT_FIELD(CLOSURE_INDEX, JSFunction, closure);
1261 EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous); 1261 EXTRACT_CONTEXT_FIELD(PREVIOUS_INDEX, Context, previous);
1262 EXTRACT_CONTEXT_FIELD(EXTENSION_INDEX, Object, extension); 1262 EXTRACT_CONTEXT_FIELD(EXTENSION_INDEX, Object, extension);
1263 EXTRACT_CONTEXT_FIELD(GLOBAL_OBJECT_INDEX, GlobalObject, global); 1263 EXTRACT_CONTEXT_FIELD(GLOBAL_OBJECT_INDEX, JSGlobalObject, global);
1264 if (context->IsNativeContext()) { 1264 if (context->IsNativeContext()) {
1265 TagObject(context->normalized_map_cache(), "(context norm. map cache)"); 1265 TagObject(context->normalized_map_cache(), "(context norm. map cache)");
1266 TagObject(context->runtime_context(), "(runtime context)"); 1266 TagObject(context->runtime_context(), "(runtime context)");
1267 TagObject(context->embedder_data(), "(context data)"); 1267 TagObject(context->embedder_data(), "(context data)");
1268 NATIVE_CONTEXT_FIELDS(EXTRACT_CONTEXT_FIELD) 1268 NATIVE_CONTEXT_FIELDS(EXTRACT_CONTEXT_FIELD)
1269 EXTRACT_CONTEXT_FIELD(OPTIMIZED_FUNCTIONS_LIST, unused, 1269 EXTRACT_CONTEXT_FIELD(OPTIMIZED_FUNCTIONS_LIST, unused,
1270 optimized_functions_list); 1270 optimized_functions_list);
1271 EXTRACT_CONTEXT_FIELD(OPTIMIZED_CODE_LIST, unused, optimized_code_list); 1271 EXTRACT_CONTEXT_FIELD(OPTIMIZED_CODE_LIST, unused, optimized_code_list);
1272 EXTRACT_CONTEXT_FIELD(DEOPTIMIZED_CODE_LIST, unused, deoptimized_code_list); 1272 EXTRACT_CONTEXT_FIELD(DEOPTIMIZED_CODE_LIST, unused, deoptimized_code_list);
1273 EXTRACT_CONTEXT_FIELD(NEXT_CONTEXT_LINK, unused, next_context_link); 1273 EXTRACT_CONTEXT_FIELD(NEXT_CONTEXT_LINK, unused, next_context_link);
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 } 1633 }
1634 break; 1634 break;
1635 } 1635 }
1636 case kDescriptor: 1636 case kDescriptor:
1637 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, 1637 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry,
1638 descs->GetKey(i), 1638 descs->GetKey(i),
1639 descs->GetValue(i)); 1639 descs->GetValue(i));
1640 break; 1640 break;
1641 } 1641 }
1642 } 1642 }
1643 } else if (js_obj->IsGlobalObject()) { 1643 } else if (js_obj->IsJSGlobalObject()) {
1644 // We assume that global objects can only have slow properties. 1644 // We assume that global objects can only have slow properties.
1645 GlobalDictionary* dictionary = js_obj->global_dictionary(); 1645 GlobalDictionary* dictionary = js_obj->global_dictionary();
1646 int length = dictionary->Capacity(); 1646 int length = dictionary->Capacity();
1647 for (int i = 0; i < length; ++i) { 1647 for (int i = 0; i < length; ++i) {
1648 Object* k = dictionary->KeyAt(i); 1648 Object* k = dictionary->KeyAt(i);
1649 if (dictionary->IsKey(k)) { 1649 if (dictionary->IsKey(k)) {
1650 DCHECK(dictionary->ValueAt(i)->IsPropertyCell()); 1650 DCHECK(dictionary->ValueAt(i)->IsPropertyCell());
1651 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(i)); 1651 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(i));
1652 Object* value = cell->value(); 1652 Object* value = cell->value();
1653 if (k == heap_->hidden_string()) { 1653 if (k == heap_->hidden_string()) {
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2122 filler_->SetIndexedAutoIndexReference( 2122 filler_->SetIndexedAutoIndexReference(
2123 HeapGraphEdge::kElement, 2123 HeapGraphEdge::kElement,
2124 snapshot_->gc_subroot(tag)->index(), 2124 snapshot_->gc_subroot(tag)->index(),
2125 child_entry); 2125 child_entry);
2126 } 2126 }
2127 } 2127 }
2128 2128
2129 // Add a shortcut to JS global object reference at snapshot root. 2129 // Add a shortcut to JS global object reference at snapshot root.
2130 if (child_obj->IsNativeContext()) { 2130 if (child_obj->IsNativeContext()) {
2131 Context* context = Context::cast(child_obj); 2131 Context* context = Context::cast(child_obj);
2132 GlobalObject* global = context->global_object(); 2132 JSGlobalObject* global = context->global_object();
2133 if (global->IsJSGlobalObject()) { 2133 if (global->IsJSGlobalObject()) {
2134 bool is_debug_object = false; 2134 bool is_debug_object = false;
2135 is_debug_object = heap_->isolate()->debug()->IsDebugGlobal(global); 2135 is_debug_object = heap_->isolate()->debug()->IsDebugGlobal(global);
2136 if (!is_debug_object && !user_roots_.Contains(global)) { 2136 if (!is_debug_object && !user_roots_.Contains(global)) {
2137 user_roots_.Insert(global); 2137 user_roots_.Insert(global);
2138 SetUserGlobalReference(global); 2138 SetUserGlobalReference(global);
2139 } 2139 }
2140 } 2140 }
2141 } 2141 }
2142 } 2142 }
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
3169 for (int i = 1; i < sorted_strings.length(); ++i) { 3169 for (int i = 1; i < sorted_strings.length(); ++i) {
3170 writer_->AddCharacter(','); 3170 writer_->AddCharacter(',');
3171 SerializeString(sorted_strings[i]); 3171 SerializeString(sorted_strings[i]);
3172 if (writer_->aborted()) return; 3172 if (writer_->aborted()) return;
3173 } 3173 }
3174 } 3174 }
3175 3175
3176 3176
3177 } // namespace internal 3177 } // namespace internal
3178 } // namespace v8 3178 } // namespace v8
OLDNEW
« no previous file with comments | « src/ppc/macro-assembler-ppc.cc ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698