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

Side by Side Diff: src/heap.cc

Issue 10872084: Allocate block-scoped global bindings to global context. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 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/compiler.cc ('k') | src/isolate.h » ('j') | src/objects.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 4902 matching lines...) Expand 10 before | Expand all | Expand 10 after
4913 MaybeObject* Heap::AllocateGlobalContext(JSFunction* function, 4913 MaybeObject* Heap::AllocateGlobalContext(JSFunction* function,
4914 ScopeInfo* scope_info) { 4914 ScopeInfo* scope_info) {
4915 Object* result; 4915 Object* result;
4916 { MaybeObject* maybe_result = 4916 { MaybeObject* maybe_result =
4917 AllocateFixedArray(scope_info->ContextLength(), TENURED); 4917 AllocateFixedArray(scope_info->ContextLength(), TENURED);
4918 if (!maybe_result->ToObject(&result)) return maybe_result; 4918 if (!maybe_result->ToObject(&result)) return maybe_result;
4919 } 4919 }
4920 Context* context = reinterpret_cast<Context*>(result); 4920 Context* context = reinterpret_cast<Context*>(result);
4921 context->set_map_no_write_barrier(global_context_map()); 4921 context->set_map_no_write_barrier(global_context_map());
4922 context->set_closure(function); 4922 context->set_closure(function);
4923 context->set_previous(function->context());
4923 context->set_extension(scope_info); 4924 context->set_extension(scope_info);
4925 context->set_global_object(function->context()->global_object());
4924 ASSERT(context->IsGlobalContext()); 4926 ASSERT(context->IsGlobalContext());
4925 ASSERT(result->IsContext()); 4927 ASSERT(result->IsContext());
4926 return context; 4928 return context;
4927 } 4929 }
4928 4930
4929 4931
4930 MaybeObject* Heap::AllocateModuleContext(ScopeInfo* scope_info) { 4932 MaybeObject* Heap::AllocateModuleContext(ScopeInfo* scope_info) {
4931 Object* result; 4933 Object* result;
4932 { MaybeObject* maybe_result = 4934 { MaybeObject* maybe_result =
4933 AllocateFixedArray(scope_info->ContextLength(), TENURED); 4935 AllocateFixedArray(scope_info->ContextLength(), TENURED);
(...skipping 2350 matching lines...) Expand 10 before | Expand all | Expand 10 after
7284 static_cast<int>(object_sizes_last_time_[index])); 7286 static_cast<int>(object_sizes_last_time_[index]));
7285 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7287 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7286 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7288 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7287 7289
7288 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7290 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7289 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7291 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7290 ClearObjectStats(); 7292 ClearObjectStats();
7291 } 7293 }
7292 7294
7293 } } // namespace v8::internal 7295 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/compiler.cc ('k') | src/isolate.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698