Chromium Code Reviews| 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 10 matching lines...) Expand all Loading... | |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #include "api.h" | 30 #include "api.h" |
| 31 #include "assembler.h" | |
|
Mads Ager (chromium)
2011/07/12 12:03:26
objects.cc needs the assembler? Is this for some c
danno
2011/07/13 08:59:52
Done.
| |
| 31 #include "arguments.h" | 32 #include "arguments.h" |
| 32 #include "bootstrapper.h" | 33 #include "bootstrapper.h" |
| 33 #include "codegen.h" | 34 #include "codegen.h" |
| 34 #include "debug.h" | 35 #include "debug.h" |
| 35 #include "deoptimizer.h" | 36 #include "deoptimizer.h" |
| 36 #include "execution.h" | 37 #include "execution.h" |
| 37 #include "full-codegen.h" | 38 #include "full-codegen.h" |
| 38 #include "hydrogen.h" | 39 #include "hydrogen.h" |
| 39 #include "objects-inl.h" | 40 #include "objects-inl.h" |
| 40 #include "objects-visiting.h" | 41 #include "objects-visiting.h" |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 51 #endif | 52 #endif |
| 52 | 53 |
| 53 namespace v8 { | 54 namespace v8 { |
| 54 namespace internal { | 55 namespace internal { |
| 55 | 56 |
| 56 // Getters and setters are stored in a fixed array property. These are | 57 // Getters and setters are stored in a fixed array property. These are |
| 57 // constants for their indices. | 58 // constants for their indices. |
| 58 const int kGetterIndex = 0; | 59 const int kGetterIndex = 0; |
| 59 const int kSetterIndex = 1; | 60 const int kSetterIndex = 1; |
| 60 | 61 |
| 61 uint64_t FixedDoubleArray::kHoleNanInt64 = -1; | |
| 62 uint64_t FixedDoubleArray::kCanonicalNonHoleNanLower32 = 0x7FF00000; | |
| 63 uint64_t FixedDoubleArray::kCanonicalNonHoleNanInt64 = | |
| 64 kCanonicalNonHoleNanLower32 << 32; | |
| 65 | |
| 66 MUST_USE_RESULT static MaybeObject* CreateJSValue(JSFunction* constructor, | 62 MUST_USE_RESULT static MaybeObject* CreateJSValue(JSFunction* constructor, |
| 67 Object* value) { | 63 Object* value) { |
| 68 Object* result; | 64 Object* result; |
| 69 { MaybeObject* maybe_result = | 65 { MaybeObject* maybe_result = |
| 70 constructor->GetHeap()->AllocateJSObject(constructor); | 66 constructor->GetHeap()->AllocateJSObject(constructor); |
| 71 if (!maybe_result->ToObject(&result)) return maybe_result; | 67 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 72 } | 68 } |
| 73 JSValue::cast(result)->set_value(value); | 69 JSValue::cast(result)->set_value(value); |
| 74 return result; | 70 return result; |
| 75 } | 71 } |
| (...skipping 2732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2808 ASSERT(!IsGlobalObject()); | 2804 ASSERT(!IsGlobalObject()); |
| 2809 return property_dictionary()-> | 2805 return property_dictionary()-> |
| 2810 TransformPropertiesToFastFor(this, unused_property_fields); | 2806 TransformPropertiesToFastFor(this, unused_property_fields); |
| 2811 } | 2807 } |
| 2812 | 2808 |
| 2813 | 2809 |
| 2814 MaybeObject* JSObject::NormalizeElements() { | 2810 MaybeObject* JSObject::NormalizeElements() { |
| 2815 ASSERT(!HasExternalArrayElements()); | 2811 ASSERT(!HasExternalArrayElements()); |
| 2816 | 2812 |
| 2817 // Find the backing store. | 2813 // Find the backing store. |
| 2818 FixedArray* array = FixedArray::cast(elements()); | 2814 FixedArrayBase* array = FixedArrayBase::cast(elements()); |
| 2819 Map* old_map = array->map(); | 2815 Map* old_map = array->map(); |
| 2820 bool is_arguments = | 2816 bool is_arguments = |
| 2821 (old_map == old_map->heap()->non_strict_arguments_elements_map()); | 2817 (old_map == old_map->heap()->non_strict_arguments_elements_map()); |
| 2822 if (is_arguments) { | 2818 if (is_arguments) { |
| 2823 array = FixedArray::cast(array->get(1)); | 2819 array = FixedArrayBase::cast(FixedArray::cast(array)->get(1)); |
| 2824 } | 2820 } |
| 2825 if (array->IsDictionary()) return array; | 2821 if (array->IsDictionary()) return array; |
| 2826 | 2822 |
| 2827 ASSERT(HasFastElements() || HasFastArgumentsElements()); | 2823 ASSERT(HasFastElements() || |
| 2824 HasFastDoubleElements() || | |
| 2825 HasFastArgumentsElements()); | |
| 2828 // Compute the effective length and allocate a new backing store. | 2826 // Compute the effective length and allocate a new backing store. |
| 2829 int length = IsJSArray() | 2827 int length = IsJSArray() |
| 2830 ? Smi::cast(JSArray::cast(this)->length())->value() | 2828 ? Smi::cast(JSArray::cast(this)->length())->value() |
| 2831 : array->length(); | 2829 : array->length(); |
| 2832 NumberDictionary* dictionary = NULL; | 2830 NumberDictionary* dictionary = NULL; |
| 2833 { Object* object; | 2831 { Object* object; |
| 2834 MaybeObject* maybe = NumberDictionary::Allocate(length); | 2832 MaybeObject* maybe = NumberDictionary::Allocate(length); |
| 2835 if (!maybe->ToObject(&object)) return maybe; | 2833 if (!maybe->ToObject(&object)) return maybe; |
| 2836 dictionary = NumberDictionary::cast(object); | 2834 dictionary = NumberDictionary::cast(object); |
| 2837 } | 2835 } |
| 2838 | 2836 |
| 2839 // Copy the elements to the new backing store. | 2837 // Copy the elements to the new backing store. |
| 2840 bool has_double_elements = old_map->has_fast_double_elements(); | 2838 bool has_double_elements = array->IsFixedDoubleArray(); |
| 2841 for (int i = 0; i < length; i++) { | 2839 for (int i = 0; i < length; i++) { |
| 2842 Object* value = NULL; | 2840 Object* value = NULL; |
| 2843 if (has_double_elements) { | 2841 if (has_double_elements) { |
| 2844 FixedDoubleArray* double_array = FixedDoubleArray::cast(array); | 2842 FixedDoubleArray* double_array = FixedDoubleArray::cast(array); |
| 2845 if (double_array->is_the_hole(i)) { | 2843 if (double_array->is_the_hole(i)) { |
| 2846 value = GetIsolate()->heap()->the_hole_value(); | 2844 value = GetIsolate()->heap()->the_hole_value(); |
| 2847 } else { | 2845 } else { |
| 2848 // Objects must be allocated in the old object space, since the | 2846 // Objects must be allocated in the old object space, since the |
| 2849 // overall number of HeapNumbers needed for the conversion might | 2847 // overall number of HeapNumbers needed for the conversion might |
| 2850 // exceed the capacity of new space, and we would fail repeatedly | 2848 // exceed the capacity of new space, and we would fail repeatedly |
| 2851 // trying to convert the FixedDoubleArray. | 2849 // trying to convert the FixedDoubleArray. |
| 2852 MaybeObject* maybe_value_object = | 2850 MaybeObject* maybe_value_object = |
| 2853 GetHeap()->AllocateHeapNumber(double_array->get(i), TENURED); | 2851 GetHeap()->AllocateHeapNumber(double_array->get(i), TENURED); |
| 2854 if (!maybe_value_object->ToObject(&value)) return maybe_value_object; | 2852 if (!maybe_value_object->ToObject(&value)) return maybe_value_object; |
| 2855 } | 2853 } |
| 2856 } else { | 2854 } else { |
| 2857 ASSERT(old_map->has_fast_elements()); | 2855 ASSERT(old_map->has_fast_elements()); |
| 2858 value = array->get(i); | 2856 value = FixedArray::cast(array)->get(i); |
| 2859 } | 2857 } |
| 2860 PropertyDetails details = PropertyDetails(NONE, NORMAL); | 2858 PropertyDetails details = PropertyDetails(NONE, NORMAL); |
| 2861 if (!value->IsTheHole()) { | 2859 if (!value->IsTheHole()) { |
| 2862 Object* result; | 2860 Object* result; |
| 2863 MaybeObject* maybe_result = | 2861 MaybeObject* maybe_result = |
| 2864 dictionary->AddNumberEntry(i, value, details); | 2862 dictionary->AddNumberEntry(i, value, details); |
| 2865 if (!maybe_result->ToObject(&result)) return maybe_result; | 2863 if (!maybe_result->ToObject(&result)) return maybe_result; |
| 2866 dictionary = NumberDictionary::cast(result); | 2864 dictionary = NumberDictionary::cast(result); |
| 2867 } | 2865 } |
| 2868 } | 2866 } |
| (...skipping 4444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7313 | 7311 |
| 7314 // Find the new map to use for this object if there is a map change. | 7312 // Find the new map to use for this object if there is a map change. |
| 7315 Map* new_map = NULL; | 7313 Map* new_map = NULL; |
| 7316 if (elements()->map() != heap->non_strict_arguments_elements_map()) { | 7314 if (elements()->map() != heap->non_strict_arguments_elements_map()) { |
| 7317 Object* object; | 7315 Object* object; |
| 7318 MaybeObject* maybe = map()->GetFastElementsMap(); | 7316 MaybeObject* maybe = map()->GetFastElementsMap(); |
| 7319 if (!maybe->ToObject(&object)) return maybe; | 7317 if (!maybe->ToObject(&object)) return maybe; |
| 7320 new_map = Map::cast(object); | 7318 new_map = Map::cast(object); |
| 7321 } | 7319 } |
| 7322 | 7320 |
| 7323 AssertNoAllocation no_gc; | |
| 7324 WriteBarrierMode mode = new_elements->GetWriteBarrierMode(no_gc); | |
| 7325 switch (GetElementsKind()) { | 7321 switch (GetElementsKind()) { |
| 7326 case FAST_ELEMENTS: | 7322 case FAST_ELEMENTS: { |
| 7323 AssertNoAllocation no_gc; | |
| 7324 WriteBarrierMode mode = new_elements->GetWriteBarrierMode(no_gc); | |
| 7327 CopyFastElementsToFast(FixedArray::cast(elements()), new_elements, mode); | 7325 CopyFastElementsToFast(FixedArray::cast(elements()), new_elements, mode); |
| 7328 set_map(new_map); | 7326 set_map(new_map); |
| 7329 set_elements(new_elements); | 7327 set_elements(new_elements); |
| 7330 break; | 7328 break; |
| 7331 case DICTIONARY_ELEMENTS: | 7329 } |
| 7330 case DICTIONARY_ELEMENTS: { | |
| 7331 AssertNoAllocation no_gc; | |
| 7332 WriteBarrierMode mode = new_elements->GetWriteBarrierMode(no_gc); | |
| 7332 CopySlowElementsToFast(NumberDictionary::cast(elements()), | 7333 CopySlowElementsToFast(NumberDictionary::cast(elements()), |
| 7333 new_elements, | 7334 new_elements, |
| 7334 mode); | 7335 mode); |
| 7335 set_map(new_map); | 7336 set_map(new_map); |
| 7336 set_elements(new_elements); | 7337 set_elements(new_elements); |
| 7337 break; | 7338 break; |
| 7339 } | |
| 7338 case NON_STRICT_ARGUMENTS_ELEMENTS: { | 7340 case NON_STRICT_ARGUMENTS_ELEMENTS: { |
| 7341 AssertNoAllocation no_gc; | |
| 7342 WriteBarrierMode mode = new_elements->GetWriteBarrierMode(no_gc); | |
| 7339 // The object's map and the parameter map are unchanged, the unaliased | 7343 // The object's map and the parameter map are unchanged, the unaliased |
| 7340 // arguments are copied to the new backing store. | 7344 // arguments are copied to the new backing store. |
| 7341 FixedArray* parameter_map = FixedArray::cast(elements()); | 7345 FixedArray* parameter_map = FixedArray::cast(elements()); |
| 7342 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); | 7346 FixedArray* arguments = FixedArray::cast(parameter_map->get(1)); |
| 7343 if (arguments->IsDictionary()) { | 7347 if (arguments->IsDictionary()) { |
| 7344 CopySlowElementsToFast(NumberDictionary::cast(arguments), | 7348 CopySlowElementsToFast(NumberDictionary::cast(arguments), |
| 7345 new_elements, | 7349 new_elements, |
| 7346 mode); | 7350 mode); |
| 7347 } else { | 7351 } else { |
| 7348 CopyFastElementsToFast(arguments, new_elements, mode); | 7352 CopyFastElementsToFast(arguments, new_elements, mode); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 7364 MaybeObject* maybe_value_object = | 7368 MaybeObject* maybe_value_object = |
| 7365 GetHeap()->AllocateHeapNumber(old_elements->get(i), TENURED); | 7369 GetHeap()->AllocateHeapNumber(old_elements->get(i), TENURED); |
| 7366 if (!maybe_value_object->ToObject(&obj)) return maybe_value_object; | 7370 if (!maybe_value_object->ToObject(&obj)) return maybe_value_object; |
| 7367 // Force write barrier. It's not worth trying to exploit | 7371 // Force write barrier. It's not worth trying to exploit |
| 7368 // elems->GetWriteBarrierMode(), since it requires an | 7372 // elems->GetWriteBarrierMode(), since it requires an |
| 7369 // AssertNoAllocation stack object that would have to be positioned | 7373 // AssertNoAllocation stack object that would have to be positioned |
| 7370 // after the HeapNumber allocation anyway. | 7374 // after the HeapNumber allocation anyway. |
| 7371 new_elements->set(i, obj, UPDATE_WRITE_BARRIER); | 7375 new_elements->set(i, obj, UPDATE_WRITE_BARRIER); |
| 7372 } | 7376 } |
| 7373 } | 7377 } |
| 7378 set_map(new_map); | |
| 7379 set_elements(new_elements); | |
| 7374 break; | 7380 break; |
| 7375 } | 7381 } |
| 7376 case EXTERNAL_BYTE_ELEMENTS: | 7382 case EXTERNAL_BYTE_ELEMENTS: |
| 7377 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 7383 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 7378 case EXTERNAL_SHORT_ELEMENTS: | 7384 case EXTERNAL_SHORT_ELEMENTS: |
| 7379 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 7385 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 7380 case EXTERNAL_INT_ELEMENTS: | 7386 case EXTERNAL_INT_ELEMENTS: |
| 7381 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 7387 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 7382 case EXTERNAL_FLOAT_ELEMENTS: | 7388 case EXTERNAL_FLOAT_ELEMENTS: |
| 7383 case EXTERNAL_DOUBLE_ELEMENTS: | 7389 case EXTERNAL_DOUBLE_ELEMENTS: |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7426 } | 7432 } |
| 7427 case DICTIONARY_ELEMENTS: { | 7433 case DICTIONARY_ELEMENTS: { |
| 7428 elems->Initialize(NumberDictionary::cast(elements())); | 7434 elems->Initialize(NumberDictionary::cast(elements())); |
| 7429 break; | 7435 break; |
| 7430 } | 7436 } |
| 7431 default: | 7437 default: |
| 7432 UNREACHABLE(); | 7438 UNREACHABLE(); |
| 7433 break; | 7439 break; |
| 7434 } | 7440 } |
| 7435 | 7441 |
| 7442 ASSERT(new_map->has_fast_double_elements()); | |
| 7436 set_map(new_map); | 7443 set_map(new_map); |
| 7444 ASSERT(elems->IsFixedDoubleArray()); | |
| 7437 set_elements(elems); | 7445 set_elements(elems); |
| 7438 | 7446 |
| 7439 if (IsJSArray()) { | 7447 if (IsJSArray()) { |
| 7440 JSArray::cast(this)->set_length(Smi::FromInt(length)); | 7448 JSArray::cast(this)->set_length(Smi::FromInt(length)); |
| 7441 } | 7449 } |
| 7442 | 7450 |
| 7443 return this; | 7451 return this; |
| 7444 } | 7452 } |
| 7445 | 7453 |
| 7446 | 7454 |
| (...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8403 } | 8411 } |
| 8404 | 8412 |
| 8405 // Attempt to put this object back in fast case. | 8413 // Attempt to put this object back in fast case. |
| 8406 if (ShouldConvertToFastElements()) { | 8414 if (ShouldConvertToFastElements()) { |
| 8407 uint32_t new_length = 0; | 8415 uint32_t new_length = 0; |
| 8408 if (IsJSArray()) { | 8416 if (IsJSArray()) { |
| 8409 CHECK(JSArray::cast(this)->length()->ToArrayIndex(&new_length)); | 8417 CHECK(JSArray::cast(this)->length()->ToArrayIndex(&new_length)); |
| 8410 } else { | 8418 } else { |
| 8411 new_length = dictionary->max_number_key() + 1; | 8419 new_length = dictionary->max_number_key() + 1; |
| 8412 } | 8420 } |
| 8413 MaybeObject* result = | 8421 MaybeObject* result = ShouldConvertToFastDoubleElements() |
| 8414 SetFastElementsCapacityAndLength(new_length, new_length); | 8422 ? SetFastDoubleElementsCapacityAndLength(new_length, new_length) |
| 8423 : SetFastElementsCapacityAndLength(new_length, new_length); | |
| 8415 if (result->IsFailure()) return result; | 8424 if (result->IsFailure()) return result; |
| 8416 #ifdef DEBUG | 8425 #ifdef DEBUG |
| 8417 if (FLAG_trace_normalization) { | 8426 if (FLAG_trace_normalization) { |
| 8418 PrintF("Object elements are fast case again:\n"); | 8427 PrintF("Object elements are fast case again:\n"); |
| 8419 Print(); | 8428 Print(); |
| 8420 } | 8429 } |
| 8421 #endif | 8430 #endif |
| 8422 } | 8431 } |
| 8423 return value; | 8432 return value; |
| 8424 } | 8433 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8491 SetFastDoubleElementsCapacityAndLength(new_capacity, | 8500 SetFastDoubleElementsCapacityAndLength(new_capacity, |
| 8492 index + 1); | 8501 index + 1); |
| 8493 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 8502 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 8494 } | 8503 } |
| 8495 FixedDoubleArray::cast(elements())->set(index, double_value); | 8504 FixedDoubleArray::cast(elements())->set(index, double_value); |
| 8496 return value; | 8505 return value; |
| 8497 } | 8506 } |
| 8498 } | 8507 } |
| 8499 | 8508 |
| 8500 // Otherwise default to slow case. | 8509 // Otherwise default to slow case. |
| 8510 ASSERT(HasFastDoubleElements()); | |
| 8511 ASSERT(map()->has_fast_double_elements()); | |
| 8512 ASSERT(elements()->IsFixedDoubleArray()); | |
| 8501 Object* obj; | 8513 Object* obj; |
| 8502 { MaybeObject* maybe_obj = NormalizeElements(); | 8514 { MaybeObject* maybe_obj = NormalizeElements(); |
| 8503 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 8515 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 8504 } | 8516 } |
| 8505 ASSERT(HasDictionaryElements()); | 8517 ASSERT(HasDictionaryElements()); |
| 8506 return SetElement(index, value, strict_mode, check_prototype); | 8518 return SetElement(index, value, strict_mode, check_prototype); |
| 8507 } | 8519 } |
| 8508 | 8520 |
| 8509 | 8521 |
| 8510 MaybeObject* JSObject::SetElement(uint32_t index, | 8522 MaybeObject* JSObject::SetElement(uint32_t index, |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 8944 break; | 8956 break; |
| 8945 } | 8957 } |
| 8946 return GetHeap()->undefined_value(); | 8958 return GetHeap()->undefined_value(); |
| 8947 } | 8959 } |
| 8948 | 8960 |
| 8949 | 8961 |
| 8950 bool JSObject::HasDenseElements() { | 8962 bool JSObject::HasDenseElements() { |
| 8951 int capacity = 0; | 8963 int capacity = 0; |
| 8952 int number_of_elements = 0; | 8964 int number_of_elements = 0; |
| 8953 | 8965 |
| 8954 FixedArray* backing_store = FixedArray::cast(elements()); | 8966 FixedArrayBase* backing_store_base = FixedArrayBase::cast(elements()); |
| 8967 FixedArray* backing_store = NULL; | |
| 8955 switch (GetElementsKind()) { | 8968 switch (GetElementsKind()) { |
| 8956 case NON_STRICT_ARGUMENTS_ELEMENTS: | 8969 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 8957 backing_store = FixedArray::cast(backing_store->get(1)); | 8970 backing_store_base = |
| 8971 FixedArray::cast(FixedArray::cast(backing_store_base)->get(1)); | |
| 8972 backing_store = FixedArray::cast(backing_store_base); | |
| 8958 if (backing_store->IsDictionary()) { | 8973 if (backing_store->IsDictionary()) { |
| 8959 NumberDictionary* dictionary = NumberDictionary::cast(backing_store); | 8974 NumberDictionary* dictionary = NumberDictionary::cast(backing_store); |
| 8960 capacity = dictionary->Capacity(); | 8975 capacity = dictionary->Capacity(); |
| 8961 number_of_elements = dictionary->NumberOfElements(); | 8976 number_of_elements = dictionary->NumberOfElements(); |
| 8962 break; | 8977 break; |
| 8963 } | 8978 } |
| 8964 // Fall through. | 8979 // Fall through. |
| 8965 case FAST_ELEMENTS: | 8980 case FAST_ELEMENTS: |
| 8981 backing_store = FixedArray::cast(backing_store_base); | |
| 8966 capacity = backing_store->length(); | 8982 capacity = backing_store->length(); |
| 8967 for (int i = 0; i < capacity; ++i) { | 8983 for (int i = 0; i < capacity; ++i) { |
| 8968 if (!backing_store->get(i)->IsTheHole()) ++number_of_elements; | 8984 if (!backing_store->get(i)->IsTheHole()) ++number_of_elements; |
| 8969 } | 8985 } |
| 8970 break; | 8986 break; |
| 8971 case DICTIONARY_ELEMENTS: { | 8987 case DICTIONARY_ELEMENTS: { |
| 8972 NumberDictionary* dictionary = NumberDictionary::cast(backing_store); | 8988 NumberDictionary* dictionary = |
| 8989 NumberDictionary::cast(FixedArray::cast(elements())); | |
| 8973 capacity = dictionary->Capacity(); | 8990 capacity = dictionary->Capacity(); |
| 8974 number_of_elements = dictionary->NumberOfElements(); | 8991 number_of_elements = dictionary->NumberOfElements(); |
| 8975 break; | 8992 break; |
| 8976 } | 8993 } |
| 8977 case FAST_DOUBLE_ELEMENTS: { | 8994 case FAST_DOUBLE_ELEMENTS: { |
| 8978 FixedDoubleArray* elms = FixedDoubleArray::cast(elements()); | 8995 FixedDoubleArray* elms = FixedDoubleArray::cast(elements()); |
| 8979 capacity = elms->length(); | 8996 capacity = elms->length(); |
| 8980 for (int i = 0; i < capacity; i++) { | 8997 for (int i = 0; i < capacity; i++) { |
| 8981 if (!elms->is_the_hole(i)) number_of_elements++; | 8998 if (!elms->is_the_hole(i)) number_of_elements++; |
| 8982 } | 8999 } |
| (...skipping 2709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11692 if (break_point_objects()->IsUndefined()) return 0; | 11709 if (break_point_objects()->IsUndefined()) return 0; |
| 11693 // Single beak point. | 11710 // Single beak point. |
| 11694 if (!break_point_objects()->IsFixedArray()) return 1; | 11711 if (!break_point_objects()->IsFixedArray()) return 1; |
| 11695 // Multiple break points. | 11712 // Multiple break points. |
| 11696 return FixedArray::cast(break_point_objects())->length(); | 11713 return FixedArray::cast(break_point_objects())->length(); |
| 11697 } | 11714 } |
| 11698 #endif | 11715 #endif |
| 11699 | 11716 |
| 11700 | 11717 |
| 11701 } } // namespace v8::internal | 11718 } } // namespace v8::internal |
| OLD | NEW |