| 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 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2159   ASSERT(elms->map() != HEAP->fixed_cow_array_map()); | 2159   ASSERT(elms->map() != HEAP->fixed_cow_array_map()); | 
| 2160   // For now this trick is only applied to fixed arrays in new and paged space. | 2160   // For now this trick is only applied to fixed arrays in new and paged space. | 
| 2161   ASSERT(!HEAP->lo_space()->Contains(elms)); | 2161   ASSERT(!HEAP->lo_space()->Contains(elms)); | 
| 2162 | 2162 | 
| 2163   const int len = elms->length(); | 2163   const int len = elms->length(); | 
| 2164 | 2164 | 
| 2165   ASSERT(to_trim < len); | 2165   ASSERT(to_trim < len); | 
| 2166 | 2166 | 
| 2167   Address new_end = elms->address() + FixedArray::SizeFor(len - to_trim); | 2167   Address new_end = elms->address() + FixedArray::SizeFor(len - to_trim); | 
| 2168 | 2168 | 
| 2169   if (trim_mode == FROM_GC) { | 2169   if (trim_mode != FROM_GC || Heap::ShouldZapGarbage()) { | 
| 2170 #ifdef DEBUG | 2170       ZapEndOfFixedArray(new_end, to_trim); | 
| 2171     ZapEndOfFixedArray(new_end, to_trim); |  | 
| 2172 #endif |  | 
| 2173   } else { |  | 
| 2174     ZapEndOfFixedArray(new_end, to_trim); |  | 
| 2175   } | 2171   } | 
| 2176 | 2172 | 
| 2177   int size_delta = to_trim * kPointerSize; | 2173   int size_delta = to_trim * kPointerSize; | 
| 2178 | 2174 | 
| 2179   // Technically in new space this write might be omitted (except for | 2175   // Technically in new space this write might be omitted (except for | 
| 2180   // debug mode which iterates through the heap), but to play safer | 2176   // debug mode which iterates through the heap), but to play safer | 
| 2181   // we still do it. | 2177   // we still do it. | 
| 2182   heap->CreateFillerObjectAt(new_end, size_delta); | 2178   heap->CreateFillerObjectAt(new_end, size_delta); | 
| 2183 | 2179 | 
| 2184   elms->set_length(len - to_trim); | 2180   elms->set_length(len - to_trim); | 
| (...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3210 | 3206 | 
| 3211 | 3207 | 
| 3212 MaybeObject* NormalizedMapCache::Get(JSObject* obj, | 3208 MaybeObject* NormalizedMapCache::Get(JSObject* obj, | 
| 3213                                      PropertyNormalizationMode mode) { | 3209                                      PropertyNormalizationMode mode) { | 
| 3214   Isolate* isolate = obj->GetIsolate(); | 3210   Isolate* isolate = obj->GetIsolate(); | 
| 3215   Map* fast = obj->map(); | 3211   Map* fast = obj->map(); | 
| 3216   int index = fast->Hash() % kEntries; | 3212   int index = fast->Hash() % kEntries; | 
| 3217   Object* result = get(index); | 3213   Object* result = get(index); | 
| 3218   if (result->IsMap() && | 3214   if (result->IsMap() && | 
| 3219       Map::cast(result)->EquivalentToForNormalization(fast, mode)) { | 3215       Map::cast(result)->EquivalentToForNormalization(fast, mode)) { | 
| 3220 #ifdef DEBUG | 3216 #ifdef VERIFY_HEAP | 
| 3221     if (FLAG_verify_heap) { | 3217     if (FLAG_verify_heap) { | 
| 3222       Map::cast(result)->SharedMapVerify(); | 3218       Map::cast(result)->SharedMapVerify(); | 
| 3223     } | 3219     } | 
|  | 3220 #endif | 
|  | 3221 #ifdef DEBUG | 
| 3224     if (FLAG_enable_slow_asserts) { | 3222     if (FLAG_enable_slow_asserts) { | 
| 3225       // The cached map should match newly created normalized map bit-by-bit, | 3223       // The cached map should match newly created normalized map bit-by-bit, | 
| 3226       // except for the code cache, which can contain some ics which can be | 3224       // except for the code cache, which can contain some ics which can be | 
| 3227       // applied to the shared map. | 3225       // applied to the shared map. | 
| 3228       Object* fresh; | 3226       Object* fresh; | 
| 3229       MaybeObject* maybe_fresh = | 3227       MaybeObject* maybe_fresh = | 
| 3230           fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP); | 3228           fast->CopyNormalized(mode, SHARED_NORMALIZED_MAP); | 
| 3231       if (maybe_fresh->ToObject(&fresh)) { | 3229       if (maybe_fresh->ToObject(&fresh)) { | 
| 3232         ASSERT(memcmp(Map::cast(fresh)->address(), | 3230         ASSERT(memcmp(Map::cast(fresh)->address(), | 
| 3233                       Map::cast(result)->address(), | 3231                       Map::cast(result)->address(), | 
| (...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4929   if (!maybe_result->To(&result)) return maybe_result; | 4927   if (!maybe_result->To(&result)) return maybe_result; | 
| 4930 | 4928 | 
| 4931   if (mode != CLEAR_INOBJECT_PROPERTIES) { | 4929   if (mode != CLEAR_INOBJECT_PROPERTIES) { | 
| 4932     result->set_inobject_properties(inobject_properties()); | 4930     result->set_inobject_properties(inobject_properties()); | 
| 4933   } | 4931   } | 
| 4934 | 4932 | 
| 4935   result->set_code_cache(code_cache()); | 4933   result->set_code_cache(code_cache()); | 
| 4936   result->set_is_shared(sharing == SHARED_NORMALIZED_MAP); | 4934   result->set_is_shared(sharing == SHARED_NORMALIZED_MAP); | 
| 4937   result->set_dictionary_map(true); | 4935   result->set_dictionary_map(true); | 
| 4938 | 4936 | 
| 4939 #ifdef DEBUG | 4937 #ifdef VERIFY_HEAP | 
| 4940   if (FLAG_verify_heap && result->is_shared()) { | 4938   if (FLAG_verify_heap && result->is_shared()) { | 
| 4941     result->SharedMapVerify(); | 4939     result->SharedMapVerify(); | 
| 4942   } | 4940   } | 
| 4943 #endif | 4941 #endif | 
| 4944 | 4942 | 
| 4945   return result; | 4943   return result; | 
| 4946 } | 4944 } | 
| 4947 | 4945 | 
| 4948 | 4946 | 
| 4949 MaybeObject* Map::CopyDropDescriptors() { | 4947 MaybeObject* Map::CopyDropDescriptors() { | 
| (...skipping 4089 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 9039   int last = transitions - 1; | 9037   int last = transitions - 1; | 
| 9040 | 9038 | 
| 9041   cache->set(header + last * step + kProtoTransitionPrototypeOffset, prototype); | 9039   cache->set(header + last * step + kProtoTransitionPrototypeOffset, prototype); | 
| 9042   cache->set(header + last * step + kProtoTransitionMapOffset, map); | 9040   cache->set(header + last * step + kProtoTransitionMapOffset, map); | 
| 9043   SetNumberOfProtoTransitions(transitions); | 9041   SetNumberOfProtoTransitions(transitions); | 
| 9044 | 9042 | 
| 9045   return cache; | 9043   return cache; | 
| 9046 } | 9044 } | 
| 9047 | 9045 | 
| 9048 | 9046 | 
|  | 9047 void Map::ZapTransitions() { | 
|  | 9048   TransitionArray* transition_array = transitions(); | 
|  | 9049   MemsetPointer(transition_array->data_start(), | 
|  | 9050                 GetHeap()->the_hole_value(), | 
|  | 9051                 transition_array->length()); | 
|  | 9052 } | 
|  | 9053 | 
|  | 9054 | 
|  | 9055 void Map::ZapPrototypeTransitions() { | 
|  | 9056   FixedArray* proto_transitions = GetPrototypeTransitions(); | 
|  | 9057   MemsetPointer(proto_transitions->data_start(), | 
|  | 9058                 GetHeap()->the_hole_value(), | 
|  | 9059                 proto_transitions->length()); | 
|  | 9060 } | 
|  | 9061 | 
|  | 9062 | 
| 9049 MaybeObject* JSReceiver::SetPrototype(Object* value, | 9063 MaybeObject* JSReceiver::SetPrototype(Object* value, | 
| 9050                                       bool skip_hidden_prototypes) { | 9064                                       bool skip_hidden_prototypes) { | 
| 9051 #ifdef DEBUG | 9065 #ifdef DEBUG | 
| 9052   int size = Size(); | 9066   int size = Size(); | 
| 9053 #endif | 9067 #endif | 
| 9054 | 9068 | 
| 9055   Heap* heap = GetHeap(); | 9069   Heap* heap = GetHeap(); | 
| 9056   // Silently ignore the change if value is not a JSObject or null. | 9070   // Silently ignore the change if value is not a JSObject or null. | 
| 9057   // SpiderMonkey behaves this way. | 9071   // SpiderMonkey behaves this way. | 
| 9058   if (!value->IsJSReceiver() && !value->IsNull()) return value; | 9072   if (!value->IsJSReceiver() && !value->IsNull()) return value; | 
| (...skipping 4450 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 13509   set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 13523   set_year(Smi::FromInt(year), SKIP_WRITE_BARRIER); | 
| 13510   set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 13524   set_month(Smi::FromInt(month), SKIP_WRITE_BARRIER); | 
| 13511   set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 13525   set_day(Smi::FromInt(day), SKIP_WRITE_BARRIER); | 
| 13512   set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 13526   set_weekday(Smi::FromInt(weekday), SKIP_WRITE_BARRIER); | 
| 13513   set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 13527   set_hour(Smi::FromInt(hour), SKIP_WRITE_BARRIER); | 
| 13514   set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 13528   set_min(Smi::FromInt(min), SKIP_WRITE_BARRIER); | 
| 13515   set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 13529   set_sec(Smi::FromInt(sec), SKIP_WRITE_BARRIER); | 
| 13516 } | 13530 } | 
| 13517 | 13531 | 
| 13518 } }  // namespace v8::internal | 13532 } }  // namespace v8::internal | 
| OLD | NEW | 
|---|