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

Side by Side Diff: src/heap.cc

Issue 10831153: Improve load IC so it can call a native accessor even if the holder is (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years, 4 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
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 2406 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); 2417 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
2418 if (!maybe_obj->ToObject(&obj)) return false; 2418 if (!maybe_obj->ToObject(&obj)) return false;
2419 } 2419 }
2420 set_module_context_map(Map::cast(obj)); 2420 set_module_context_map(Map::cast(obj));
2421 2421
2422 { MaybeObject* maybe_obj = 2422 { MaybeObject* maybe_obj =
2423 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel); 2423 AllocateMap(FIXED_ARRAY_TYPE, kVariableSizeSentinel);
2424 if (!maybe_obj->ToObject(&obj)) return false; 2424 if (!maybe_obj->ToObject(&obj)) return false;
2425 } 2425 }
2426 Map* global_context_map = Map::cast(obj); 2426 Map* global_context_map = Map::cast(obj);
2427 global_context_map->set_dictionary_map(true);
2427 global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext); 2428 global_context_map->set_visitor_id(StaticVisitorBase::kVisitGlobalContext);
2428 set_global_context_map(global_context_map); 2429 set_global_context_map(global_context_map);
2429 2430
2430 { MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE, 2431 { MaybeObject* maybe_obj = AllocateMap(SHARED_FUNCTION_INFO_TYPE,
2431 SharedFunctionInfo::kAlignedSize); 2432 SharedFunctionInfo::kAlignedSize);
2432 if (!maybe_obj->ToObject(&obj)) return false; 2433 if (!maybe_obj->ToObject(&obj)) return false;
2433 } 2434 }
2434 set_shared_function_info_map(Map::cast(obj)); 2435 set_shared_function_info_map(Map::cast(obj));
2435 2436
2436 { MaybeObject* maybe_obj = AllocateMap(JS_MESSAGE_OBJECT_TYPE, 2437 { MaybeObject* maybe_obj = AllocateMap(JS_MESSAGE_OBJECT_TYPE,
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
4101 result->set_hash(undefined_value(), SKIP_WRITE_BARRIER); 4102 result->set_hash(undefined_value(), SKIP_WRITE_BARRIER);
4102 result->set_call_trap(call_trap); 4103 result->set_call_trap(call_trap);
4103 result->set_construct_trap(construct_trap); 4104 result->set_construct_trap(construct_trap);
4104 return result; 4105 return result;
4105 } 4106 }
4106 4107
4107 4108
4108 MaybeObject* Heap::AllocateGlobalObject(JSFunction* constructor) { 4109 MaybeObject* Heap::AllocateGlobalObject(JSFunction* constructor) {
4109 ASSERT(constructor->has_initial_map()); 4110 ASSERT(constructor->has_initial_map());
4110 Map* map = constructor->initial_map(); 4111 Map* map = constructor->initial_map();
4112 ASSERT(map->is_dictionary_map());
4111 4113
4112 // Make sure no field properties are described in the initial map. 4114 // Make sure no field properties are described in the initial map.
4113 // This guarantees us that normalizing the properties does not 4115 // This guarantees us that normalizing the properties does not
4114 // require us to change property values to JSGlobalPropertyCells. 4116 // require us to change property values to JSGlobalPropertyCells.
4115 ASSERT(map->NextFreePropertyIndex() == 0); 4117 ASSERT(map->NextFreePropertyIndex() == 0);
4116 4118
4117 // Make sure we don't have a ton of pre-allocated slots in the 4119 // Make sure we don't have a ton of pre-allocated slots in the
4118 // global objects. They will be unused once we normalize the object. 4120 // global objects. They will be unused once we normalize the object.
4119 ASSERT(map->unused_property_fields() == 0); 4121 ASSERT(map->unused_property_fields() == 0);
4120 ASSERT(map->inobject_properties() == 0); 4122 ASSERT(map->inobject_properties() == 0);
(...skipping 30 matching lines...) Expand all
4151 JSObject* global; 4153 JSObject* global;
4152 MaybeObject* maybe_global = Allocate(map, OLD_POINTER_SPACE); 4154 MaybeObject* maybe_global = Allocate(map, OLD_POINTER_SPACE);
4153 if (!maybe_global->To(&global)) return maybe_global; 4155 if (!maybe_global->To(&global)) return maybe_global;
4154 4156
4155 InitializeJSObjectFromMap(global, dictionary, map); 4157 InitializeJSObjectFromMap(global, dictionary, map);
4156 4158
4157 // Create a new map for the global object. 4159 // Create a new map for the global object.
4158 Map* new_map; 4160 Map* new_map;
4159 MaybeObject* maybe_map = map->CopyDropDescriptors(); 4161 MaybeObject* maybe_map = map->CopyDropDescriptors();
4160 if (!maybe_map->To(&new_map)) return maybe_map; 4162 if (!maybe_map->To(&new_map)) return maybe_map;
4163 new_map->set_dictionary_map(true);
4161 4164
4162 // Set up the global object as a normalized object. 4165 // Set up the global object as a normalized object.
4163 global->set_map(new_map); 4166 global->set_map(new_map);
4164 global->set_properties(dictionary); 4167 global->set_properties(dictionary);
4165 4168
4166 // Make sure result is a global object with properties in dictionary. 4169 // Make sure result is a global object with properties in dictionary.
4167 ASSERT(global->IsGlobalObject()); 4170 ASSERT(global->IsGlobalObject());
4168 ASSERT(!global->HasFastProperties()); 4171 ASSERT(!global->HasFastProperties());
4169 return global; 4172 return global;
4170 } 4173 }
(...skipping 3067 matching lines...) Expand 10 before | Expand all | Expand 10 after
7238 static_cast<int>(object_sizes_last_time_[index])); 7241 static_cast<int>(object_sizes_last_time_[index]));
7239 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) 7242 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT)
7240 #undef ADJUST_LAST_TIME_OBJECT_COUNT 7243 #undef ADJUST_LAST_TIME_OBJECT_COUNT
7241 7244
7242 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); 7245 memcpy(object_counts_last_time_, object_counts_, sizeof(object_counts_));
7243 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); 7246 memcpy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_));
7244 ClearObjectStats(); 7247 ClearObjectStats();
7245 } 7248 }
7246 7249
7247 } } // namespace v8::internal 7250 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698