OLD | NEW |
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 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
631 if (IsSmi()) { | 631 if (IsSmi()) { |
632 Heap* heap = Isolate::Current()->heap(); | 632 Heap* heap = Isolate::Current()->heap(); |
633 Context* context = heap->isolate()->context()->global_context(); | 633 Context* context = heap->isolate()->context()->global_context(); |
634 return context->number_function()->instance_prototype(); | 634 return context->number_function()->instance_prototype(); |
635 } | 635 } |
636 | 636 |
637 HeapObject* heap_object = HeapObject::cast(this); | 637 HeapObject* heap_object = HeapObject::cast(this); |
638 | 638 |
639 // The object is either a number, a string, a boolean, | 639 // The object is either a number, a string, a boolean, |
640 // a real JS object, or a Harmony proxy. | 640 // a real JS object, or a Harmony proxy. |
641 if (heap_object->IsJSObject() || heap_object->IsJSProxy()) { | 641 if (heap_object->IsJSReceiver()) { |
642 return heap_object->map()->prototype(); | 642 return heap_object->map()->prototype(); |
643 } | 643 } |
644 Heap* heap = heap_object->GetHeap(); | 644 Heap* heap = heap_object->GetHeap(); |
645 Context* context = heap->isolate()->context()->global_context(); | 645 Context* context = heap->isolate()->context()->global_context(); |
646 | 646 |
647 if (heap_object->IsHeapNumber()) { | 647 if (heap_object->IsHeapNumber()) { |
648 return context->number_function()->instance_prototype(); | 648 return context->number_function()->instance_prototype(); |
649 } | 649 } |
650 if (heap_object->IsString()) { | 650 if (heap_object->IsString()) { |
651 return context->string_function()->instance_prototype(); | 651 return context->string_function()->instance_prototype(); |
(...skipping 1282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1934 cache->Update(descriptors, name, number); | 1934 cache->Update(descriptors, name, number); |
1935 } | 1935 } |
1936 if (number != DescriptorArray::kNotFound) { | 1936 if (number != DescriptorArray::kNotFound) { |
1937 result->DescriptorResult(holder, descriptors->GetDetails(number), number); | 1937 result->DescriptorResult(holder, descriptors->GetDetails(number), number); |
1938 } else { | 1938 } else { |
1939 result->NotFound(); | 1939 result->NotFound(); |
1940 } | 1940 } |
1941 } | 1941 } |
1942 | 1942 |
1943 | 1943 |
| 1944 static JSObject::ElementsKind GetElementsKindFromExternalArrayType( |
| 1945 ExternalArrayType array_type) { |
| 1946 switch (array_type) { |
| 1947 case kExternalByteArray: |
| 1948 return JSObject::EXTERNAL_BYTE_ELEMENTS; |
| 1949 break; |
| 1950 case kExternalUnsignedByteArray: |
| 1951 return JSObject::EXTERNAL_UNSIGNED_BYTE_ELEMENTS; |
| 1952 break; |
| 1953 case kExternalShortArray: |
| 1954 return JSObject::EXTERNAL_SHORT_ELEMENTS; |
| 1955 break; |
| 1956 case kExternalUnsignedShortArray: |
| 1957 return JSObject::EXTERNAL_UNSIGNED_SHORT_ELEMENTS; |
| 1958 break; |
| 1959 case kExternalIntArray: |
| 1960 return JSObject::EXTERNAL_INT_ELEMENTS; |
| 1961 break; |
| 1962 case kExternalUnsignedIntArray: |
| 1963 return JSObject::EXTERNAL_UNSIGNED_INT_ELEMENTS; |
| 1964 break; |
| 1965 case kExternalFloatArray: |
| 1966 return JSObject::EXTERNAL_FLOAT_ELEMENTS; |
| 1967 break; |
| 1968 case kExternalDoubleArray: |
| 1969 return JSObject::EXTERNAL_DOUBLE_ELEMENTS; |
| 1970 break; |
| 1971 case kExternalPixelArray: |
| 1972 return JSObject::EXTERNAL_PIXEL_ELEMENTS; |
| 1973 break; |
| 1974 } |
| 1975 UNREACHABLE(); |
| 1976 return JSObject::DICTIONARY_ELEMENTS; |
| 1977 } |
| 1978 |
| 1979 |
1944 MaybeObject* Map::GetExternalArrayElementsMap(ExternalArrayType array_type, | 1980 MaybeObject* Map::GetExternalArrayElementsMap(ExternalArrayType array_type, |
1945 bool safe_to_add_transition) { | 1981 bool safe_to_add_transition) { |
1946 Heap* current_heap = heap(); | 1982 Heap* current_heap = heap(); |
1947 DescriptorArray* descriptors = instance_descriptors(); | 1983 DescriptorArray* descriptors = instance_descriptors(); |
1948 String* external_array_sentinel_name = current_heap->empty_symbol(); | 1984 String* external_array_sentinel_name = current_heap->empty_symbol(); |
1949 | 1985 |
1950 if (safe_to_add_transition) { | 1986 if (safe_to_add_transition) { |
1951 // It's only safe to manipulate the descriptor array if it would be | 1987 // It's only safe to manipulate the descriptor array if it would be |
1952 // safe to add a transition. | 1988 // safe to add a transition. |
1953 | 1989 |
(...skipping 22 matching lines...) Expand all Loading... |
1976 } | 2012 } |
1977 } | 2013 } |
1978 | 2014 |
1979 // No transition to an existing external array map. Make a new one. | 2015 // No transition to an existing external array map. Make a new one. |
1980 Object* obj; | 2016 Object* obj; |
1981 { MaybeObject* maybe_map = CopyDropTransitions(); | 2017 { MaybeObject* maybe_map = CopyDropTransitions(); |
1982 if (!maybe_map->ToObject(&obj)) return maybe_map; | 2018 if (!maybe_map->ToObject(&obj)) return maybe_map; |
1983 } | 2019 } |
1984 Map* new_map = Map::cast(obj); | 2020 Map* new_map = Map::cast(obj); |
1985 | 2021 |
1986 new_map->set_has_fast_elements(false); | 2022 new_map->set_elements_kind(GetElementsKindFromExternalArrayType(array_type)); |
1987 new_map->set_has_external_array_elements(true); | |
1988 GetIsolate()->counters()->map_to_external_array_elements()->Increment(); | 2023 GetIsolate()->counters()->map_to_external_array_elements()->Increment(); |
1989 | 2024 |
1990 // Only remember the map transition if the object's map is NOT equal to the | 2025 // Only remember the map transition if the object's map is NOT equal to the |
1991 // global object_function's map and there is not an already existing | 2026 // global object_function's map and there is not an already existing |
1992 // non-matching external array transition. | 2027 // non-matching external array transition. |
1993 bool allow_map_transition = | 2028 bool allow_map_transition = |
1994 safe_to_add_transition && | 2029 safe_to_add_transition && |
1995 (GetIsolate()->context()->global_context()->object_function()->map() != | 2030 (GetIsolate()->context()->global_context()->object_function()->map() != |
1996 map()); | 2031 map()); |
1997 if (allow_map_transition) { | 2032 if (allow_map_transition) { |
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3338 return JSObject::cast(proto)->LocalLookup(name, result); | 3373 return JSObject::cast(proto)->LocalLookup(name, result); |
3339 } | 3374 } |
3340 | 3375 |
3341 // Do not use inline caching if the object is a non-global object | 3376 // Do not use inline caching if the object is a non-global object |
3342 // that requires access checks. | 3377 // that requires access checks. |
3343 if (!IsJSGlobalProxy() && IsAccessCheckNeeded()) { | 3378 if (!IsJSGlobalProxy() && IsAccessCheckNeeded()) { |
3344 result->DisallowCaching(); | 3379 result->DisallowCaching(); |
3345 } | 3380 } |
3346 | 3381 |
3347 // Check __proto__ before interceptor. | 3382 // Check __proto__ before interceptor. |
3348 if (name->Equals(heap->Proto_symbol()) && | 3383 if (name->Equals(heap->Proto_symbol()) && !IsJSContextExtensionObject()) { |
3349 !IsJSContextExtensionObject()) { | |
3350 result->ConstantResult(this); | 3384 result->ConstantResult(this); |
3351 return; | 3385 return; |
3352 } | 3386 } |
3353 | 3387 |
3354 // Check for lookup interceptor except when bootstrapping. | 3388 // Check for lookup interceptor except when bootstrapping. |
3355 if (HasNamedInterceptor() && !heap->isolate()->bootstrapper()->IsActive()) { | 3389 if (HasNamedInterceptor() && !heap->isolate()->bootstrapper()->IsActive()) { |
3356 result->InterceptorResult(this); | 3390 result->InterceptorResult(this); |
3357 return; | 3391 return; |
3358 } | 3392 } |
3359 | 3393 |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3887 | 3921 |
3888 void Map::RemoveFromCodeCache(String* name, Code* code, int index) { | 3922 void Map::RemoveFromCodeCache(String* name, Code* code, int index) { |
3889 // No GC is supposed to happen between a call to IndexInCodeCache and | 3923 // No GC is supposed to happen between a call to IndexInCodeCache and |
3890 // RemoveFromCodeCache so the code cache must be there. | 3924 // RemoveFromCodeCache so the code cache must be there. |
3891 ASSERT(!code_cache()->IsFixedArray()); | 3925 ASSERT(!code_cache()->IsFixedArray()); |
3892 CodeCache::cast(code_cache())->RemoveByIndex(name, code, index); | 3926 CodeCache::cast(code_cache())->RemoveByIndex(name, code, index); |
3893 } | 3927 } |
3894 | 3928 |
3895 | 3929 |
3896 void Map::TraverseTransitionTree(TraverseCallback callback, void* data) { | 3930 void Map::TraverseTransitionTree(TraverseCallback callback, void* data) { |
| 3931 // Traverse the transition tree without using a stack. We do this by |
| 3932 // reversing the pointers in the maps and descriptor arrays. |
3897 Map* current = this; | 3933 Map* current = this; |
3898 Map* meta_map = heap()->meta_map(); | 3934 Map* meta_map = heap()->meta_map(); |
| 3935 Object** map_or_index_field = NULL; |
3899 while (current != meta_map) { | 3936 while (current != meta_map) { |
3900 DescriptorArray* d = reinterpret_cast<DescriptorArray*>( | 3937 DescriptorArray* d = reinterpret_cast<DescriptorArray*>( |
3901 *RawField(current, Map::kInstanceDescriptorsOrBitField3Offset)); | 3938 *RawField(current, Map::kInstanceDescriptorsOrBitField3Offset)); |
3902 if (d->IsEmpty()) { | 3939 if (!d->IsEmpty()) { |
3903 Map* prev = current->map(); | 3940 FixedArray* contents = reinterpret_cast<FixedArray*>( |
3904 current->set_map(meta_map); | 3941 d->get(DescriptorArray::kContentArrayIndex)); |
3905 callback(current, data); | 3942 map_or_index_field = RawField(contents, HeapObject::kMapOffset); |
3906 current = prev; | 3943 Object* map_or_index = *map_or_index_field; |
3907 continue; | 3944 bool map_done = true; // Controls a nested continue statement. |
| 3945 for (int i = map_or_index->IsSmi() ? Smi::cast(map_or_index)->value() : 0; |
| 3946 i < contents->length(); |
| 3947 i += 2) { |
| 3948 PropertyDetails details(Smi::cast(contents->get(i + 1))); |
| 3949 if (details.IsTransition()) { |
| 3950 // Found a map in the transition array. We record our progress in |
| 3951 // the transition array by recording the current map in the map field |
| 3952 // of the next map and recording the index in the transition array in |
| 3953 // the map field of the array. |
| 3954 Map* next = Map::cast(contents->get(i)); |
| 3955 next->set_map(current); |
| 3956 *map_or_index_field = Smi::FromInt(i + 2); |
| 3957 current = next; |
| 3958 map_done = false; |
| 3959 break; |
| 3960 } |
| 3961 } |
| 3962 if (!map_done) continue; |
| 3963 } |
| 3964 // That was the regular transitions, now for the prototype transitions. |
| 3965 FixedArray* prototype_transitions = |
| 3966 current->unchecked_prototype_transitions(); |
| 3967 Object** proto_map_or_index_field = |
| 3968 RawField(prototype_transitions, HeapObject::kMapOffset); |
| 3969 Object* map_or_index = *proto_map_or_index_field; |
| 3970 const int start = kProtoTransitionHeaderSize + kProtoTransitionMapOffset; |
| 3971 int i = map_or_index->IsSmi() ? Smi::cast(map_or_index)->value() : start; |
| 3972 if (i < prototype_transitions->length()) { |
| 3973 // Found a map in the prototype transition array. Record progress in |
| 3974 // an analogous way to the regular transitions array above. |
| 3975 Object* perhaps_map = prototype_transitions->get(i); |
| 3976 if (perhaps_map->IsMap()) { |
| 3977 Map* next = Map::cast(perhaps_map); |
| 3978 next->set_map(current); |
| 3979 *proto_map_or_index_field = |
| 3980 Smi::FromInt(i + kProtoTransitionElementsPerEntry); |
| 3981 current = next; |
| 3982 continue; |
| 3983 } |
| 3984 } |
| 3985 *proto_map_or_index_field = heap()->fixed_array_map(); |
| 3986 if (map_or_index_field != NULL) { |
| 3987 *map_or_index_field = heap()->fixed_array_map(); |
3908 } | 3988 } |
3909 | 3989 |
3910 FixedArray* contents = reinterpret_cast<FixedArray*>( | 3990 // The callback expects a map to have a real map as its map, so we save |
3911 d->get(DescriptorArray::kContentArrayIndex)); | 3991 // the map field, which is being used to track the traversal and put the |
3912 Object** map_or_index_field = RawField(contents, HeapObject::kMapOffset); | 3992 // correct map (the meta_map) in place while we do the callback. |
3913 Object* map_or_index = *map_or_index_field; | |
3914 bool map_done = true; | |
3915 for (int i = map_or_index->IsSmi() ? Smi::cast(map_or_index)->value() : 0; | |
3916 i < contents->length(); | |
3917 i += 2) { | |
3918 PropertyDetails details(Smi::cast(contents->get(i + 1))); | |
3919 if (details.IsTransition()) { | |
3920 Map* next = reinterpret_cast<Map*>(contents->get(i)); | |
3921 next->set_map(current); | |
3922 *map_or_index_field = Smi::FromInt(i + 2); | |
3923 current = next; | |
3924 map_done = false; | |
3925 break; | |
3926 } | |
3927 } | |
3928 if (!map_done) continue; | |
3929 *map_or_index_field = heap()->fixed_array_map(); | |
3930 Map* prev = current->map(); | 3993 Map* prev = current->map(); |
3931 current->set_map(meta_map); | 3994 current->set_map(meta_map); |
3932 callback(current, data); | 3995 callback(current, data); |
3933 current = prev; | 3996 current = prev; |
3934 } | 3997 } |
3935 } | 3998 } |
3936 | 3999 |
3937 | 4000 |
3938 MaybeObject* CodeCache::Update(String* name, Code* code) { | 4001 MaybeObject* CodeCache::Update(String* name, Code* code) { |
3939 // The number of monomorphic stubs for normal load/store/call IC's can grow to | 4002 // The number of monomorphic stubs for normal load/store/call IC's can grow to |
(...skipping 2417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6357 Builtins* builtins = heap->isolate()->builtins(); | 6420 Builtins* builtins = heap->isolate()->builtins(); |
6358 ASSERT_EQ(builtins->builtin(Builtins::kJSConstructStubCountdown), | 6421 ASSERT_EQ(builtins->builtin(Builtins::kJSConstructStubCountdown), |
6359 construct_stub()); | 6422 construct_stub()); |
6360 set_construct_stub(builtins->builtin(Builtins::kJSConstructStubGeneric)); | 6423 set_construct_stub(builtins->builtin(Builtins::kJSConstructStubGeneric)); |
6361 | 6424 |
6362 int slack = map->unused_property_fields(); | 6425 int slack = map->unused_property_fields(); |
6363 map->TraverseTransitionTree(&GetMinInobjectSlack, &slack); | 6426 map->TraverseTransitionTree(&GetMinInobjectSlack, &slack); |
6364 if (slack != 0) { | 6427 if (slack != 0) { |
6365 // Resize the initial map and all maps in its transition tree. | 6428 // Resize the initial map and all maps in its transition tree. |
6366 map->TraverseTransitionTree(&ShrinkInstanceSize, &slack); | 6429 map->TraverseTransitionTree(&ShrinkInstanceSize, &slack); |
| 6430 |
6367 // Give the correct expected_nof_properties to initial maps created later. | 6431 // Give the correct expected_nof_properties to initial maps created later. |
6368 ASSERT(expected_nof_properties() >= slack); | 6432 ASSERT(expected_nof_properties() >= slack); |
6369 set_expected_nof_properties(expected_nof_properties() - slack); | 6433 set_expected_nof_properties(expected_nof_properties() - slack); |
6370 } | 6434 } |
6371 } | 6435 } |
6372 | 6436 |
6373 | 6437 |
6374 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) { | 6438 void ObjectVisitor::VisitCodeTarget(RelocInfo* rinfo) { |
6375 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); | 6439 ASSERT(RelocInfo::IsCodeTarget(rinfo->rmode())); |
6376 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); | 6440 Object* target = Code::GetCodeFromTargetAddress(rinfo->target_address()); |
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7076 } | 7140 } |
7077 FixedArray::cast(obj)->set(0, len); | 7141 FixedArray::cast(obj)->set(0, len); |
7078 if (IsJSArray()) JSArray::cast(this)->set_length(Smi::FromInt(1)); | 7142 if (IsJSArray()) JSArray::cast(this)->set_length(Smi::FromInt(1)); |
7079 set_elements(FixedArray::cast(obj)); | 7143 set_elements(FixedArray::cast(obj)); |
7080 return this; | 7144 return this; |
7081 } | 7145 } |
7082 | 7146 |
7083 | 7147 |
7084 Object* Map::GetPrototypeTransition(Object* prototype) { | 7148 Object* Map::GetPrototypeTransition(Object* prototype) { |
7085 FixedArray* cache = prototype_transitions(); | 7149 FixedArray* cache = prototype_transitions(); |
7086 int capacity = cache->length(); | 7150 int number_of_transitions = NumberOfProtoTransitions(); |
7087 if (capacity == 0) return NULL; | 7151 const int proto_offset = |
7088 int finger = Smi::cast(cache->get(0))->value(); | 7152 kProtoTransitionHeaderSize + kProtoTransitionPrototypeOffset; |
7089 for (int i = 1; i < finger; i += 2) { | 7153 const int map_offset = kProtoTransitionHeaderSize + kProtoTransitionMapOffset; |
7090 if (cache->get(i) == prototype) return cache->get(i + 1); | 7154 const int step = kProtoTransitionElementsPerEntry; |
| 7155 for (int i = 0; i < number_of_transitions; i++) { |
| 7156 if (cache->get(proto_offset + i * step) == prototype) { |
| 7157 Object* map = cache->get(map_offset + i * step); |
| 7158 ASSERT(map->IsMap()); |
| 7159 return map; |
| 7160 } |
7091 } | 7161 } |
7092 return NULL; | 7162 return NULL; |
7093 } | 7163 } |
7094 | 7164 |
7095 | 7165 |
7096 MaybeObject* Map::PutPrototypeTransition(Object* prototype, Map* map) { | 7166 MaybeObject* Map::PutPrototypeTransition(Object* prototype, Map* map) { |
| 7167 ASSERT(map->IsMap()); |
| 7168 ASSERT(HeapObject::cast(prototype)->map()->IsMap()); |
7097 // Don't cache prototype transition if this map is shared. | 7169 // Don't cache prototype transition if this map is shared. |
7098 if (is_shared() || !FLAG_cache_prototype_transitions) return this; | 7170 if (is_shared() || !FLAG_cache_prototype_transitions) return this; |
7099 | 7171 |
7100 FixedArray* cache = prototype_transitions(); | 7172 FixedArray* cache = prototype_transitions(); |
7101 | 7173 |
7102 int capacity = cache->length(); | 7174 const int step = kProtoTransitionElementsPerEntry; |
| 7175 const int header = kProtoTransitionHeaderSize; |
7103 | 7176 |
7104 int finger = (capacity == 0) ? 1 : Smi::cast(cache->get(0))->value(); | 7177 int capacity = (cache->length() - header) / step; |
7105 | 7178 |
7106 if (finger >= capacity) { | 7179 int transitions = NumberOfProtoTransitions() + 1; |
| 7180 |
| 7181 if (transitions > capacity) { |
7107 if (capacity > kMaxCachedPrototypeTransitions) return this; | 7182 if (capacity > kMaxCachedPrototypeTransitions) return this; |
7108 | 7183 |
7109 FixedArray* new_cache; | 7184 FixedArray* new_cache; |
7110 { MaybeObject* maybe_cache = heap()->AllocateFixedArray(finger * 2 + 1); | 7185 // Grow array by factor 2 over and above what we need. |
| 7186 { MaybeObject* maybe_cache = |
| 7187 heap()->AllocateFixedArray(transitions * 2 * step + header); |
7111 if (!maybe_cache->To<FixedArray>(&new_cache)) return maybe_cache; | 7188 if (!maybe_cache->To<FixedArray>(&new_cache)) return maybe_cache; |
7112 } | 7189 } |
7113 | 7190 |
7114 for (int i = 1; i < capacity; i++) new_cache->set(i, cache->get(i)); | 7191 for (int i = 0; i < capacity * step; i++) { |
| 7192 new_cache->set(i + header, cache->get(i + header)); |
| 7193 } |
7115 cache = new_cache; | 7194 cache = new_cache; |
7116 set_prototype_transitions(cache); | 7195 set_prototype_transitions(cache); |
7117 } | 7196 } |
7118 | 7197 |
7119 cache->set(finger, prototype); | 7198 int last = transitions - 1; |
7120 cache->set(finger + 1, map); | 7199 |
7121 cache->set(0, Smi::FromInt(finger + 2)); | 7200 cache->set(header + last * step + kProtoTransitionPrototypeOffset, prototype); |
| 7201 cache->set(header + last * step + kProtoTransitionMapOffset, map); |
| 7202 SetNumberOfProtoTransitions(transitions); |
7122 | 7203 |
7123 return cache; | 7204 return cache; |
7124 } | 7205 } |
7125 | 7206 |
7126 | 7207 |
7127 MaybeObject* JSReceiver::SetPrototype(Object* value, | 7208 MaybeObject* JSReceiver::SetPrototype(Object* value, |
7128 bool skip_hidden_prototypes) { | 7209 bool skip_hidden_prototypes) { |
| 7210 #ifdef DEBUG |
| 7211 int size = Size(); |
| 7212 #endif |
| 7213 |
7129 Heap* heap = GetHeap(); | 7214 Heap* heap = GetHeap(); |
7130 // Silently ignore the change if value is not a JSObject or null. | 7215 // Silently ignore the change if value is not a JSObject or null. |
7131 // SpiderMonkey behaves this way. | 7216 // SpiderMonkey behaves this way. |
7132 if (!value->IsJSReceiver() && !value->IsNull()) return value; | 7217 if (!value->IsJSReceiver() && !value->IsNull()) return value; |
7133 | 7218 |
7134 // From 8.6.2 Object Internal Methods | 7219 // From 8.6.2 Object Internal Methods |
7135 // ... | 7220 // ... |
7136 // In addition, if [[Extensible]] is false the value of the [[Class]] and | 7221 // In addition, if [[Extensible]] is false the value of the [[Class]] and |
7137 // [[Prototype]] internal properties of the object may not be modified. | 7222 // [[Prototype]] internal properties of the object may not be modified. |
7138 // ... | 7223 // ... |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7189 map->PutPrototypeTransition(value, Map::cast(new_map)); | 7274 map->PutPrototypeTransition(value, Map::cast(new_map)); |
7190 if (maybe_new_cache->IsFailure()) return maybe_new_cache; | 7275 if (maybe_new_cache->IsFailure()) return maybe_new_cache; |
7191 } | 7276 } |
7192 | 7277 |
7193 Map::cast(new_map)->set_prototype(value); | 7278 Map::cast(new_map)->set_prototype(value); |
7194 } | 7279 } |
7195 ASSERT(Map::cast(new_map)->prototype() == value); | 7280 ASSERT(Map::cast(new_map)->prototype() == value); |
7196 real_receiver->set_map(Map::cast(new_map)); | 7281 real_receiver->set_map(Map::cast(new_map)); |
7197 | 7282 |
7198 heap->ClearInstanceofCache(); | 7283 heap->ClearInstanceofCache(); |
7199 | 7284 ASSERT(size == Size()); |
7200 return value; | 7285 return value; |
7201 } | 7286 } |
7202 | 7287 |
7203 | 7288 |
7204 bool JSObject::HasElementPostInterceptor(JSReceiver* receiver, uint32_t index) { | 7289 bool JSObject::HasElementPostInterceptor(JSReceiver* receiver, uint32_t index) { |
7205 switch (GetElementsKind()) { | 7290 switch (GetElementsKind()) { |
7206 case FAST_ELEMENTS: { | 7291 case FAST_ELEMENTS: { |
7207 uint32_t length = IsJSArray() ? | 7292 uint32_t length = IsJSArray() ? |
7208 static_cast<uint32_t> | 7293 static_cast<uint32_t> |
7209 (Smi::cast(JSArray::cast(this)->length())->value()) : | 7294 (Smi::cast(JSArray::cast(this)->length())->value()) : |
(...skipping 3500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10710 if (break_point_objects()->IsUndefined()) return 0; | 10795 if (break_point_objects()->IsUndefined()) return 0; |
10711 // Single beak point. | 10796 // Single beak point. |
10712 if (!break_point_objects()->IsFixedArray()) return 1; | 10797 if (!break_point_objects()->IsFixedArray()) return 1; |
10713 // Multiple break points. | 10798 // Multiple break points. |
10714 return FixedArray::cast(break_point_objects())->length(); | 10799 return FixedArray::cast(break_point_objects())->length(); |
10715 } | 10800 } |
10716 #endif | 10801 #endif |
10717 | 10802 |
10718 | 10803 |
10719 } } // namespace v8::internal | 10804 } } // namespace v8::internal |
OLD | NEW |