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 4071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4082 | 4082 |
4083 MaybeObject* Heap::AllocateInitialMap(JSFunction* fun) { | 4083 MaybeObject* Heap::AllocateInitialMap(JSFunction* fun) { |
4084 ASSERT(!fun->has_initial_map()); | 4084 ASSERT(!fun->has_initial_map()); |
4085 | 4085 |
4086 // First create a new map with the size and number of in-object properties | 4086 // First create a new map with the size and number of in-object properties |
4087 // suggested by the function. | 4087 // suggested by the function. |
4088 InstanceType instance_type; | 4088 InstanceType instance_type; |
4089 int instance_size; | 4089 int instance_size; |
4090 int in_object_properties; | 4090 int in_object_properties; |
4091 if (fun->shared()->is_generator()) { | 4091 if (fun->shared()->is_generator()) { |
4092 // TODO(wingo): Replace with JS_GENERATOR_OBJECT_TYPE. | 4092 instance_type = JS_GENERATOR_OBJECT_TYPE; |
4093 instance_type = JS_OBJECT_TYPE; | 4093 instance_size = JSGeneratorObject::kSize; |
4094 instance_size = JSObject::kHeaderSize; | |
4095 in_object_properties = 0; | 4094 in_object_properties = 0; |
4096 } else { | 4095 } else { |
4097 instance_type = JS_OBJECT_TYPE; | 4096 instance_type = JS_OBJECT_TYPE; |
4098 instance_size = fun->shared()->CalculateInstanceSize(); | 4097 instance_size = fun->shared()->CalculateInstanceSize(); |
4099 in_object_properties = fun->shared()->CalculateInObjectProperties(); | 4098 in_object_properties = fun->shared()->CalculateInObjectProperties(); |
4100 } | 4099 } |
4101 Map* map; | 4100 Map* map; |
4102 MaybeObject* maybe_map = AllocateMap(instance_type, instance_size); | 4101 MaybeObject* maybe_map = AllocateMap(instance_type, instance_size); |
4103 if (!maybe_map->To(&map)) return maybe_map; | 4102 if (!maybe_map->To(&map)) return maybe_map; |
4104 | 4103 |
(...skipping 3728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7833 static_cast<int>(object_sizes_last_time_[index])); | 7832 static_cast<int>(object_sizes_last_time_[index])); |
7834 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7833 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7835 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7834 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7836 | 7835 |
7837 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7836 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7838 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7837 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7839 ClearObjectStats(); | 7838 ClearObjectStats(); |
7840 } | 7839 } |
7841 | 7840 |
7842 } } // namespace v8::internal | 7841 } } // namespace v8::internal |
OLD | NEW |