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

Side by Side Diff: src/objects.cc

Issue 8356041: Handlify KeyedIC::ComputeStub. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebase and address comments. Created 9 years, 2 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/objects.h ('k') | src/stub-cache.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2172 matching lines...) Expand 10 before | Expand all | Expand 10 after
2183 2183
2184 // If |map| is contained in |maps_list|, returns |map|; otherwise returns NULL. 2184 // If |map| is contained in |maps_list|, returns |map|; otherwise returns NULL.
2185 static bool ContainsMap(MapList* maps_list, Map* map) { 2185 static bool ContainsMap(MapList* maps_list, Map* map) {
2186 for (int i = 0; i < maps_list->length(); ++i) { 2186 for (int i = 0; i < maps_list->length(); ++i) {
2187 if (maps_list->at(i) == map) return true; 2187 if (maps_list->at(i) == map) return true;
2188 } 2188 }
2189 return false; 2189 return false;
2190 } 2190 }
2191 2191
2192 2192
2193 Handle<Map> Map::FindTransitionedMap(MapHandleList* candidates) {
2194 MapList raw_candidates(candidates->length());
2195 Map* result = FindTransitionedMap(UnwrapHandleList(&raw_candidates,
2196 candidates));
2197 return (result == NULL) ? Handle<Map>::null() : Handle<Map>(result);
2198 }
2199
2200
2193 Map* Map::FindTransitionedMap(MapList* candidates) { 2201 Map* Map::FindTransitionedMap(MapList* candidates) {
2194 ElementsKind elms_kind = elements_kind(); 2202 ElementsKind elms_kind = elements_kind();
2195 if (elms_kind == FAST_DOUBLE_ELEMENTS) { 2203 if (elms_kind == FAST_DOUBLE_ELEMENTS) {
2196 bool dummy = true; 2204 bool dummy = true;
2197 Map* fast_map = LookupElementsTransitionMap(FAST_ELEMENTS, &dummy); 2205 Map* fast_map = LookupElementsTransitionMap(FAST_ELEMENTS, &dummy);
2198 if (fast_map == NULL) return NULL; 2206 if (fast_map == NULL) return NULL;
2199 if (ContainsMap(candidates, fast_map)) return fast_map; 2207 if (ContainsMap(candidates, fast_map)) return fast_map;
2200 return NULL; 2208 return NULL;
2201 } 2209 }
2202 if (elms_kind == FAST_SMI_ONLY_ELEMENTS) { 2210 if (elms_kind == FAST_SMI_ONLY_ELEMENTS) {
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2390 MaybeObject* maybe_new_descriptors = 2398 MaybeObject* maybe_new_descriptors =
2391 instance_descriptors()->CopyInsert(&desc, KEEP_TRANSITIONS); 2399 instance_descriptors()->CopyInsert(&desc, KEEP_TRANSITIONS);
2392 if (!maybe_new_descriptors->ToObject(&new_descriptors)) { 2400 if (!maybe_new_descriptors->ToObject(&new_descriptors)) {
2393 return maybe_new_descriptors; 2401 return maybe_new_descriptors;
2394 } 2402 }
2395 set_instance_descriptors(DescriptorArray::cast(new_descriptors)); 2403 set_instance_descriptors(DescriptorArray::cast(new_descriptors));
2396 return this; 2404 return this;
2397 } 2405 }
2398 2406
2399 2407
2408 Handle<Map> JSObject::GetElementsTransitionMap(Handle<JSObject> object,
2409 ElementsKind to_kind) {
2410 Isolate* isolate = object->GetIsolate();
2411 CALL_HEAP_FUNCTION(isolate,
2412 object->GetElementsTransitionMap(to_kind),
2413 Map);
2414 }
2415
2416
2400 MaybeObject* JSObject::GetElementsTransitionMap(ElementsKind to_kind) { 2417 MaybeObject* JSObject::GetElementsTransitionMap(ElementsKind to_kind) {
2401 Map* current_map = map(); 2418 Map* current_map = map();
2402 ElementsKind from_kind = current_map->elements_kind(); 2419 ElementsKind from_kind = current_map->elements_kind();
2403 2420
2404 if (from_kind == to_kind) return current_map; 2421 if (from_kind == to_kind) return current_map;
2405 2422
2406 // Only objects with FastProperties can have DescriptorArrays and can track 2423 // Only objects with FastProperties can have DescriptorArrays and can track
2407 // element-related maps. Also don't add descriptors to maps that are shared. 2424 // element-related maps. Also don't add descriptors to maps that are shared.
2408 bool safe_to_add_transition = HasFastProperties() && 2425 bool safe_to_add_transition = HasFastProperties() &&
2409 !current_map->IsUndefined() && 2426 !current_map->IsUndefined() &&
(...skipping 2707 matching lines...) Expand 10 before | Expand all | Expand 10 after
5117 5134
5118 void CodeCacheHashTable::RemoveByIndex(int index) { 5135 void CodeCacheHashTable::RemoveByIndex(int index) {
5119 ASSERT(index >= 0); 5136 ASSERT(index >= 0);
5120 Heap* heap = GetHeap(); 5137 Heap* heap = GetHeap();
5121 set(EntryToIndex(index), heap->null_value()); 5138 set(EntryToIndex(index), heap->null_value());
5122 set(EntryToIndex(index) + 1, heap->null_value()); 5139 set(EntryToIndex(index) + 1, heap->null_value());
5123 ElementRemoved(); 5140 ElementRemoved();
5124 } 5141 }
5125 5142
5126 5143
5144 void PolymorphicCodeCache::Update(Handle<PolymorphicCodeCache> cache,
5145 MapHandleList* maps,
5146 Code::Flags flags,
5147 Handle<Code> code) {
5148 Isolate* isolate = cache->GetIsolate();
5149 List<Map*> raw_maps(maps->length());
5150 CALL_HEAP_FUNCTION_VOID(
5151 isolate,
5152 (raw_maps.Clear(),
Kevin Millikin (Chromium) 2011/10/21 10:13:48 That's a bit annoying, but unavoidable. I suppose
5153 cache->Update(UnwrapHandleList(&raw_maps, maps), flags, *code)));
5154 }
5155
5156
5127 MaybeObject* PolymorphicCodeCache::Update(MapList* maps, 5157 MaybeObject* PolymorphicCodeCache::Update(MapList* maps,
5128 Code::Flags flags, 5158 Code::Flags flags,
5129 Code* code) { 5159 Code* code) {
5130 // Initialize cache if necessary. 5160 // Initialize cache if necessary.
5131 if (cache()->IsUndefined()) { 5161 if (cache()->IsUndefined()) {
5132 Object* result; 5162 Object* result;
5133 { MaybeObject* maybe_result = 5163 { MaybeObject* maybe_result =
5134 PolymorphicCodeCacheHashTable::Allocate( 5164 PolymorphicCodeCacheHashTable::Allocate(
5135 PolymorphicCodeCacheHashTable::kInitialSize); 5165 PolymorphicCodeCacheHashTable::kInitialSize);
5136 if (!maybe_result->ToObject(&result)) return maybe_result; 5166 if (!maybe_result->ToObject(&result)) return maybe_result;
5137 } 5167 }
5138 set_cache(result); 5168 set_cache(result);
5139 } else { 5169 } else {
5140 // This entry shouldn't be contained in the cache yet. 5170 // This entry shouldn't be contained in the cache yet.
5141 ASSERT(PolymorphicCodeCacheHashTable::cast(cache()) 5171 ASSERT(PolymorphicCodeCacheHashTable::cast(cache())
5142 ->Lookup(maps, flags)->IsUndefined()); 5172 ->Lookup(maps, flags)->IsUndefined());
5143 } 5173 }
5144 PolymorphicCodeCacheHashTable* hash_table = 5174 PolymorphicCodeCacheHashTable* hash_table =
5145 PolymorphicCodeCacheHashTable::cast(cache()); 5175 PolymorphicCodeCacheHashTable::cast(cache());
5146 Object* new_cache; 5176 Object* new_cache;
5147 { MaybeObject* maybe_new_cache = hash_table->Put(maps, flags, code); 5177 { MaybeObject* maybe_new_cache = hash_table->Put(maps, flags, code);
5148 if (!maybe_new_cache->ToObject(&new_cache)) return maybe_new_cache; 5178 if (!maybe_new_cache->ToObject(&new_cache)) return maybe_new_cache;
5149 } 5179 }
5150 set_cache(new_cache); 5180 set_cache(new_cache);
5151 return this; 5181 return this;
5152 } 5182 }
5153 5183
5154 5184
5185 Handle<Object> PolymorphicCodeCache::Lookup(MapHandleList* maps,
5186 Code::Flags flags) {
5187 List<Map*> raw_maps(maps->length());
5188 return Handle<Object>(Lookup(UnwrapHandleList(&raw_maps, maps), flags));
5189 }
5190
5191
5155 Object* PolymorphicCodeCache::Lookup(MapList* maps, Code::Flags flags) { 5192 Object* PolymorphicCodeCache::Lookup(MapList* maps, Code::Flags flags) {
5156 if (!cache()->IsUndefined()) { 5193 if (!cache()->IsUndefined()) {
5157 PolymorphicCodeCacheHashTable* hash_table = 5194 PolymorphicCodeCacheHashTable* hash_table =
5158 PolymorphicCodeCacheHashTable::cast(cache()); 5195 PolymorphicCodeCacheHashTable::cast(cache());
5159 return hash_table->Lookup(maps, flags); 5196 return hash_table->Lookup(maps, flags);
5160 } else { 5197 } else {
5161 return GetHeap()->undefined_value(); 5198 return GetHeap()->undefined_value();
5162 } 5199 }
5163 } 5200 }
5164 5201
(...skipping 7417 matching lines...) Expand 10 before | Expand all | Expand 10 after
12582 if (break_point_objects()->IsUndefined()) return 0; 12619 if (break_point_objects()->IsUndefined()) return 0;
12583 // Single break point. 12620 // Single break point.
12584 if (!break_point_objects()->IsFixedArray()) return 1; 12621 if (!break_point_objects()->IsFixedArray()) return 1;
12585 // Multiple break points. 12622 // Multiple break points.
12586 return FixedArray::cast(break_point_objects())->length(); 12623 return FixedArray::cast(break_point_objects())->length();
12587 } 12624 }
12588 #endif // ENABLE_DEBUGGER_SUPPORT 12625 #endif // ENABLE_DEBUGGER_SUPPORT
12589 12626
12590 12627
12591 } } // namespace v8::internal 12628 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/stub-cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698