| OLD | NEW |
| 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 4912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4923 ASSERT(length >= Context::MIN_CONTEXT_SLOTS); | 4923 ASSERT(length >= Context::MIN_CONTEXT_SLOTS); |
| 4924 Object* result; | 4924 Object* result; |
| 4925 { MaybeObject* maybe_result = AllocateFixedArray(length); | 4925 { MaybeObject* maybe_result = AllocateFixedArray(length); |
| 4926 if (!maybe_result->ToObject(&result)) return maybe_result; | 4926 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 4927 } | 4927 } |
| 4928 Context* context = reinterpret_cast<Context*>(result); | 4928 Context* context = reinterpret_cast<Context*>(result); |
| 4929 context->set_map_no_write_barrier(function_context_map()); | 4929 context->set_map_no_write_barrier(function_context_map()); |
| 4930 context->set_closure(function); | 4930 context->set_closure(function); |
| 4931 context->set_previous(function->context()); | 4931 context->set_previous(function->context()); |
| 4932 context->set_extension(Smi::FromInt(0)); | 4932 context->set_extension(Smi::FromInt(0)); |
| 4933 context->set_global(function->context()->global()); | 4933 context->set_global_object(function->context()->global_object()); |
| 4934 return context; | 4934 return context; |
| 4935 } | 4935 } |
| 4936 | 4936 |
| 4937 | 4937 |
| 4938 MaybeObject* Heap::AllocateCatchContext(JSFunction* function, | 4938 MaybeObject* Heap::AllocateCatchContext(JSFunction* function, |
| 4939 Context* previous, | 4939 Context* previous, |
| 4940 String* name, | 4940 String* name, |
| 4941 Object* thrown_object) { | 4941 Object* thrown_object) { |
| 4942 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == Context::THROWN_OBJECT_INDEX); | 4942 STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS == Context::THROWN_OBJECT_INDEX); |
| 4943 Object* result; | 4943 Object* result; |
| 4944 { MaybeObject* maybe_result = | 4944 { MaybeObject* maybe_result = |
| 4945 AllocateFixedArray(Context::MIN_CONTEXT_SLOTS + 1); | 4945 AllocateFixedArray(Context::MIN_CONTEXT_SLOTS + 1); |
| 4946 if (!maybe_result->ToObject(&result)) return maybe_result; | 4946 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 4947 } | 4947 } |
| 4948 Context* context = reinterpret_cast<Context*>(result); | 4948 Context* context = reinterpret_cast<Context*>(result); |
| 4949 context->set_map_no_write_barrier(catch_context_map()); | 4949 context->set_map_no_write_barrier(catch_context_map()); |
| 4950 context->set_closure(function); | 4950 context->set_closure(function); |
| 4951 context->set_previous(previous); | 4951 context->set_previous(previous); |
| 4952 context->set_extension(name); | 4952 context->set_extension(name); |
| 4953 context->set_global(previous->global()); | 4953 context->set_global_object(previous->global_object()); |
| 4954 context->set(Context::THROWN_OBJECT_INDEX, thrown_object); | 4954 context->set(Context::THROWN_OBJECT_INDEX, thrown_object); |
| 4955 return context; | 4955 return context; |
| 4956 } | 4956 } |
| 4957 | 4957 |
| 4958 | 4958 |
| 4959 MaybeObject* Heap::AllocateWithContext(JSFunction* function, | 4959 MaybeObject* Heap::AllocateWithContext(JSFunction* function, |
| 4960 Context* previous, | 4960 Context* previous, |
| 4961 JSObject* extension) { | 4961 JSObject* extension) { |
| 4962 Object* result; | 4962 Object* result; |
| 4963 { MaybeObject* maybe_result = AllocateFixedArray(Context::MIN_CONTEXT_SLOTS); | 4963 { MaybeObject* maybe_result = AllocateFixedArray(Context::MIN_CONTEXT_SLOTS); |
| 4964 if (!maybe_result->ToObject(&result)) return maybe_result; | 4964 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 4965 } | 4965 } |
| 4966 Context* context = reinterpret_cast<Context*>(result); | 4966 Context* context = reinterpret_cast<Context*>(result); |
| 4967 context->set_map_no_write_barrier(with_context_map()); | 4967 context->set_map_no_write_barrier(with_context_map()); |
| 4968 context->set_closure(function); | 4968 context->set_closure(function); |
| 4969 context->set_previous(previous); | 4969 context->set_previous(previous); |
| 4970 context->set_extension(extension); | 4970 context->set_extension(extension); |
| 4971 context->set_global(previous->global()); | 4971 context->set_global_object(previous->global_object()); |
| 4972 return context; | 4972 return context; |
| 4973 } | 4973 } |
| 4974 | 4974 |
| 4975 | 4975 |
| 4976 MaybeObject* Heap::AllocateBlockContext(JSFunction* function, | 4976 MaybeObject* Heap::AllocateBlockContext(JSFunction* function, |
| 4977 Context* previous, | 4977 Context* previous, |
| 4978 ScopeInfo* scope_info) { | 4978 ScopeInfo* scope_info) { |
| 4979 Object* result; | 4979 Object* result; |
| 4980 { MaybeObject* maybe_result = | 4980 { MaybeObject* maybe_result = |
| 4981 AllocateFixedArrayWithHoles(scope_info->ContextLength()); | 4981 AllocateFixedArrayWithHoles(scope_info->ContextLength()); |
| 4982 if (!maybe_result->ToObject(&result)) return maybe_result; | 4982 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 4983 } | 4983 } |
| 4984 Context* context = reinterpret_cast<Context*>(result); | 4984 Context* context = reinterpret_cast<Context*>(result); |
| 4985 context->set_map_no_write_barrier(block_context_map()); | 4985 context->set_map_no_write_barrier(block_context_map()); |
| 4986 context->set_closure(function); | 4986 context->set_closure(function); |
| 4987 context->set_previous(previous); | 4987 context->set_previous(previous); |
| 4988 context->set_extension(scope_info); | 4988 context->set_extension(scope_info); |
| 4989 context->set_global(previous->global()); | 4989 context->set_global_object(previous->global_object()); |
| 4990 return context; | 4990 return context; |
| 4991 } | 4991 } |
| 4992 | 4992 |
| 4993 | 4993 |
| 4994 MaybeObject* Heap::AllocateScopeInfo(int length) { | 4994 MaybeObject* Heap::AllocateScopeInfo(int length) { |
| 4995 FixedArray* scope_info; | 4995 FixedArray* scope_info; |
| 4996 MaybeObject* maybe_scope_info = AllocateFixedArray(length, TENURED); | 4996 MaybeObject* maybe_scope_info = AllocateFixedArray(length, TENURED); |
| 4997 if (!maybe_scope_info->To(&scope_info)) return maybe_scope_info; | 4997 if (!maybe_scope_info->To(&scope_info)) return maybe_scope_info; |
| 4998 scope_info->set_map_no_write_barrier(scope_info_map()); | 4998 scope_info->set_map_no_write_barrier(scope_info_map()); |
| 4999 return scope_info; | 4999 return scope_info; |
| (...skipping 2262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7262 static_cast<int>(object_sizes_last_time_[index])); | 7262 static_cast<int>(object_sizes_last_time_[index])); |
| 7263 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7263 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
| 7264 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7264 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
| 7265 | 7265 |
| 7266 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7266 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
| 7267 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7267 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
| 7268 ClearObjectStats(); | 7268 ClearObjectStats(); |
| 7269 } | 7269 } |
| 7270 | 7270 |
| 7271 } } // namespace v8::internal | 7271 } } // namespace v8::internal |
| OLD | NEW |