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 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1038 ExternalIntArray::cast(this)->length()); | 1038 ExternalIntArray::cast(this)->length()); |
1039 break; | 1039 break; |
1040 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | 1040 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
1041 accumulator->Add("<ExternalUnsignedIntArray[%u]>", | 1041 accumulator->Add("<ExternalUnsignedIntArray[%u]>", |
1042 ExternalUnsignedIntArray::cast(this)->length()); | 1042 ExternalUnsignedIntArray::cast(this)->length()); |
1043 break; | 1043 break; |
1044 case EXTERNAL_FLOAT_ARRAY_TYPE: | 1044 case EXTERNAL_FLOAT_ARRAY_TYPE: |
1045 accumulator->Add("<ExternalFloatArray[%u]>", | 1045 accumulator->Add("<ExternalFloatArray[%u]>", |
1046 ExternalFloatArray::cast(this)->length()); | 1046 ExternalFloatArray::cast(this)->length()); |
1047 break; | 1047 break; |
1048 case EXTERNAL_DOUBLE_ARRAY_TYPE: | |
1049 accumulator->Add("<ExternalDoubleArray[%u]>", | |
1050 ExternalDoubleArray::cast(this)->length()); | |
1051 break; | |
1048 case SHARED_FUNCTION_INFO_TYPE: | 1052 case SHARED_FUNCTION_INFO_TYPE: |
1049 accumulator->Add("<SharedFunctionInfo>"); | 1053 accumulator->Add("<SharedFunctionInfo>"); |
1050 break; | 1054 break; |
1051 case JS_MESSAGE_OBJECT_TYPE: | 1055 case JS_MESSAGE_OBJECT_TYPE: |
1052 accumulator->Add("<JSMessageObject>"); | 1056 accumulator->Add("<JSMessageObject>"); |
1053 break; | 1057 break; |
1054 #define MAKE_STRUCT_CASE(NAME, Name, name) \ | 1058 #define MAKE_STRUCT_CASE(NAME, Name, name) \ |
1055 case NAME##_TYPE: \ | 1059 case NAME##_TYPE: \ |
1056 accumulator->Put('<'); \ | 1060 accumulator->Put('<'); \ |
1057 accumulator->Add(#Name); \ | 1061 accumulator->Add(#Name); \ |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1167 case FILLER_TYPE: | 1171 case FILLER_TYPE: |
1168 case BYTE_ARRAY_TYPE: | 1172 case BYTE_ARRAY_TYPE: |
1169 case EXTERNAL_PIXEL_ARRAY_TYPE: | 1173 case EXTERNAL_PIXEL_ARRAY_TYPE: |
1170 case EXTERNAL_BYTE_ARRAY_TYPE: | 1174 case EXTERNAL_BYTE_ARRAY_TYPE: |
1171 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | 1175 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: |
1172 case EXTERNAL_SHORT_ARRAY_TYPE: | 1176 case EXTERNAL_SHORT_ARRAY_TYPE: |
1173 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | 1177 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
1174 case EXTERNAL_INT_ARRAY_TYPE: | 1178 case EXTERNAL_INT_ARRAY_TYPE: |
1175 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | 1179 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
1176 case EXTERNAL_FLOAT_ARRAY_TYPE: | 1180 case EXTERNAL_FLOAT_ARRAY_TYPE: |
1181 case EXTERNAL_DOUBLE_ARRAY_TYPE: | |
1177 break; | 1182 break; |
1178 case SHARED_FUNCTION_INFO_TYPE: | 1183 case SHARED_FUNCTION_INFO_TYPE: |
1179 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); | 1184 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); |
1180 break; | 1185 break; |
1181 | 1186 |
1182 #define MAKE_STRUCT_CASE(NAME, Name, name) \ | 1187 #define MAKE_STRUCT_CASE(NAME, Name, name) \ |
1183 case NAME##_TYPE: | 1188 case NAME##_TYPE: |
1184 STRUCT_LIST(MAKE_STRUCT_CASE) | 1189 STRUCT_LIST(MAKE_STRUCT_CASE) |
1185 #undef MAKE_STRUCT_CASE | 1190 #undef MAKE_STRUCT_CASE |
1186 StructBodyDescriptor::IterateBody(this, object_size, v); | 1191 StructBodyDescriptor::IterateBody(this, object_size, v); |
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2841 break; | 2846 break; |
2842 } | 2847 } |
2843 case EXTERNAL_PIXEL_ELEMENTS: | 2848 case EXTERNAL_PIXEL_ELEMENTS: |
2844 case EXTERNAL_BYTE_ELEMENTS: | 2849 case EXTERNAL_BYTE_ELEMENTS: |
2845 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 2850 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
2846 case EXTERNAL_SHORT_ELEMENTS: | 2851 case EXTERNAL_SHORT_ELEMENTS: |
2847 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 2852 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
2848 case EXTERNAL_INT_ELEMENTS: | 2853 case EXTERNAL_INT_ELEMENTS: |
2849 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 2854 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
2850 case EXTERNAL_FLOAT_ELEMENTS: | 2855 case EXTERNAL_FLOAT_ELEMENTS: |
2856 case EXTERNAL_DOUBLE_ELEMENTS: | |
2851 // Pixel and external array elements cannot be deleted. Just | 2857 // Pixel and external array elements cannot be deleted. Just |
2852 // silently ignore here. | 2858 // silently ignore here. |
2853 break; | 2859 break; |
2854 case DICTIONARY_ELEMENTS: { | 2860 case DICTIONARY_ELEMENTS: { |
2855 NumberDictionary* dictionary = element_dictionary(); | 2861 NumberDictionary* dictionary = element_dictionary(); |
2856 int entry = dictionary->FindEntry(index); | 2862 int entry = dictionary->FindEntry(index); |
2857 if (entry != NumberDictionary::kNotFound) { | 2863 if (entry != NumberDictionary::kNotFound) { |
2858 Object* result = dictionary->DeleteProperty(entry, mode); | 2864 Object* result = dictionary->DeleteProperty(entry, mode); |
2859 if (mode == STRICT_DELETION && result == | 2865 if (mode == STRICT_DELETION && result == |
2860 isolate->heap()->false_value()) { | 2866 isolate->heap()->false_value()) { |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2960 // Check if the object is among the indexed properties. | 2966 // Check if the object is among the indexed properties. |
2961 switch (GetElementsKind()) { | 2967 switch (GetElementsKind()) { |
2962 case EXTERNAL_PIXEL_ELEMENTS: | 2968 case EXTERNAL_PIXEL_ELEMENTS: |
2963 case EXTERNAL_BYTE_ELEMENTS: | 2969 case EXTERNAL_BYTE_ELEMENTS: |
2964 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 2970 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
2965 case EXTERNAL_SHORT_ELEMENTS: | 2971 case EXTERNAL_SHORT_ELEMENTS: |
2966 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 2972 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
2967 case EXTERNAL_INT_ELEMENTS: | 2973 case EXTERNAL_INT_ELEMENTS: |
2968 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 2974 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
2969 case EXTERNAL_FLOAT_ELEMENTS: | 2975 case EXTERNAL_FLOAT_ELEMENTS: |
2976 case EXTERNAL_DOUBLE_ELEMENTS: | |
2970 // Raw pixels and external arrays do not reference other | 2977 // Raw pixels and external arrays do not reference other |
2971 // objects. | 2978 // objects. |
2972 break; | 2979 break; |
2973 case FAST_ELEMENTS: { | 2980 case FAST_ELEMENTS: { |
2974 int length = IsJSArray() ? | 2981 int length = IsJSArray() ? |
2975 Smi::cast(JSArray::cast(this)->length())->value() : | 2982 Smi::cast(JSArray::cast(this)->length())->value() : |
2976 FixedArray::cast(elements())->length(); | 2983 FixedArray::cast(elements())->length(); |
2977 for (int i = 0; i < length; i++) { | 2984 for (int i = 0; i < length; i++) { |
2978 Object* element = FixedArray::cast(elements())->get(i); | 2985 Object* element = FixedArray::cast(elements())->get(i); |
2979 if (!element->IsTheHole() && element == obj) { | 2986 if (!element->IsTheHole() && element == obj) { |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3231 case FAST_ELEMENTS: | 3238 case FAST_ELEMENTS: |
3232 break; | 3239 break; |
3233 case EXTERNAL_PIXEL_ELEMENTS: | 3240 case EXTERNAL_PIXEL_ELEMENTS: |
3234 case EXTERNAL_BYTE_ELEMENTS: | 3241 case EXTERNAL_BYTE_ELEMENTS: |
3235 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 3242 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
3236 case EXTERNAL_SHORT_ELEMENTS: | 3243 case EXTERNAL_SHORT_ELEMENTS: |
3237 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 3244 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
3238 case EXTERNAL_INT_ELEMENTS: | 3245 case EXTERNAL_INT_ELEMENTS: |
3239 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3246 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
3240 case EXTERNAL_FLOAT_ELEMENTS: | 3247 case EXTERNAL_FLOAT_ELEMENTS: |
3248 case EXTERNAL_DOUBLE_ELEMENTS: | |
3241 // Ignore getters and setters on pixel and external array | 3249 // Ignore getters and setters on pixel and external array |
3242 // elements. | 3250 // elements. |
3243 return heap->undefined_value(); | 3251 return heap->undefined_value(); |
3244 case DICTIONARY_ELEMENTS: { | 3252 case DICTIONARY_ELEMENTS: { |
3245 // Lookup the index. | 3253 // Lookup the index. |
3246 NumberDictionary* dictionary = element_dictionary(); | 3254 NumberDictionary* dictionary = element_dictionary(); |
3247 int entry = dictionary->FindEntry(index); | 3255 int entry = dictionary->FindEntry(index); |
3248 if (entry != NumberDictionary::kNotFound) { | 3256 if (entry != NumberDictionary::kNotFound) { |
3249 Object* result = dictionary->ValueAt(entry); | 3257 Object* result = dictionary->ValueAt(entry); |
3250 PropertyDetails details = dictionary->DetailsAt(entry); | 3258 PropertyDetails details = dictionary->DetailsAt(entry); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3457 case FAST_ELEMENTS: | 3465 case FAST_ELEMENTS: |
3458 break; | 3466 break; |
3459 case EXTERNAL_PIXEL_ELEMENTS: | 3467 case EXTERNAL_PIXEL_ELEMENTS: |
3460 case EXTERNAL_BYTE_ELEMENTS: | 3468 case EXTERNAL_BYTE_ELEMENTS: |
3461 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 3469 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
3462 case EXTERNAL_SHORT_ELEMENTS: | 3470 case EXTERNAL_SHORT_ELEMENTS: |
3463 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 3471 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
3464 case EXTERNAL_INT_ELEMENTS: | 3472 case EXTERNAL_INT_ELEMENTS: |
3465 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3473 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
3466 case EXTERNAL_FLOAT_ELEMENTS: | 3474 case EXTERNAL_FLOAT_ELEMENTS: |
3475 case EXTERNAL_DOUBLE_ELEMENTS: | |
3467 // Ignore getters and setters on pixel and external array | 3476 // Ignore getters and setters on pixel and external array |
3468 // elements. | 3477 // elements. |
3469 return isolate->heap()->undefined_value(); | 3478 return isolate->heap()->undefined_value(); |
3470 case DICTIONARY_ELEMENTS: | 3479 case DICTIONARY_ELEMENTS: |
3471 break; | 3480 break; |
3472 default: | 3481 default: |
3473 UNREACHABLE(); | 3482 UNREACHABLE(); |
3474 break; | 3483 break; |
3475 } | 3484 } |
3476 | 3485 |
(...skipping 3479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6956 return true; | 6965 return true; |
6957 } | 6966 } |
6958 break; | 6967 break; |
6959 } | 6968 } |
6960 case EXTERNAL_BYTE_ELEMENTS: | 6969 case EXTERNAL_BYTE_ELEMENTS: |
6961 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 6970 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
6962 case EXTERNAL_SHORT_ELEMENTS: | 6971 case EXTERNAL_SHORT_ELEMENTS: |
6963 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 6972 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
6964 case EXTERNAL_INT_ELEMENTS: | 6973 case EXTERNAL_INT_ELEMENTS: |
6965 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 6974 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
6966 case EXTERNAL_FLOAT_ELEMENTS: { | 6975 case EXTERNAL_FLOAT_ELEMENTS: |
6976 case EXTERNAL_DOUBLE_ELEMENTS: { | |
6967 ExternalArray* array = ExternalArray::cast(elements()); | 6977 ExternalArray* array = ExternalArray::cast(elements()); |
6968 if (index < static_cast<uint32_t>(array->length())) { | 6978 if (index < static_cast<uint32_t>(array->length())) { |
6969 return true; | 6979 return true; |
6970 } | 6980 } |
6971 break; | 6981 break; |
6972 } | 6982 } |
6973 case DICTIONARY_ELEMENTS: { | 6983 case DICTIONARY_ELEMENTS: { |
6974 if (element_dictionary()->FindEntry(index) | 6984 if (element_dictionary()->FindEntry(index) |
6975 != NumberDictionary::kNotFound) { | 6985 != NumberDictionary::kNotFound) { |
6976 return true; | 6986 return true; |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7078 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); | 7088 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); |
7079 if (index < static_cast<uint32_t>(pixels->length())) return FAST_ELEMENT; | 7089 if (index < static_cast<uint32_t>(pixels->length())) return FAST_ELEMENT; |
7080 break; | 7090 break; |
7081 } | 7091 } |
7082 case EXTERNAL_BYTE_ELEMENTS: | 7092 case EXTERNAL_BYTE_ELEMENTS: |
7083 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 7093 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
7084 case EXTERNAL_SHORT_ELEMENTS: | 7094 case EXTERNAL_SHORT_ELEMENTS: |
7085 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 7095 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
7086 case EXTERNAL_INT_ELEMENTS: | 7096 case EXTERNAL_INT_ELEMENTS: |
7087 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 7097 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
7088 case EXTERNAL_FLOAT_ELEMENTS: { | 7098 case EXTERNAL_FLOAT_ELEMENTS: |
7099 case EXTERNAL_DOUBLE_ELEMENTS: { | |
7089 ExternalArray* array = ExternalArray::cast(elements()); | 7100 ExternalArray* array = ExternalArray::cast(elements()); |
7090 if (index < static_cast<uint32_t>(array->length())) return FAST_ELEMENT; | 7101 if (index < static_cast<uint32_t>(array->length())) return FAST_ELEMENT; |
7091 break; | 7102 break; |
7092 } | 7103 } |
7093 case DICTIONARY_ELEMENTS: { | 7104 case DICTIONARY_ELEMENTS: { |
7094 if (element_dictionary()->FindEntry(index) != | 7105 if (element_dictionary()->FindEntry(index) != |
7095 NumberDictionary::kNotFound) { | 7106 NumberDictionary::kNotFound) { |
7096 return DICTIONARY_ELEMENT; | 7107 return DICTIONARY_ELEMENT; |
7097 } | 7108 } |
7098 break; | 7109 break; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7137 return true; | 7148 return true; |
7138 } | 7149 } |
7139 break; | 7150 break; |
7140 } | 7151 } |
7141 case EXTERNAL_BYTE_ELEMENTS: | 7152 case EXTERNAL_BYTE_ELEMENTS: |
7142 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 7153 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
7143 case EXTERNAL_SHORT_ELEMENTS: | 7154 case EXTERNAL_SHORT_ELEMENTS: |
7144 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 7155 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
7145 case EXTERNAL_INT_ELEMENTS: | 7156 case EXTERNAL_INT_ELEMENTS: |
7146 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 7157 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
7147 case EXTERNAL_FLOAT_ELEMENTS: { | 7158 case EXTERNAL_FLOAT_ELEMENTS: |
7159 case EXTERNAL_DOUBLE_ELEMENTS: { | |
7148 ExternalArray* array = ExternalArray::cast(elements()); | 7160 ExternalArray* array = ExternalArray::cast(elements()); |
7149 if (index < static_cast<uint32_t>(array->length())) { | 7161 if (index < static_cast<uint32_t>(array->length())) { |
7150 return true; | 7162 return true; |
7151 } | 7163 } |
7152 break; | 7164 break; |
7153 } | 7165 } |
7154 case DICTIONARY_ELEMENTS: { | 7166 case DICTIONARY_ELEMENTS: { |
7155 if (element_dictionary()->FindEntry(index) | 7167 if (element_dictionary()->FindEntry(index) |
7156 != NumberDictionary::kNotFound) { | 7168 != NumberDictionary::kNotFound) { |
7157 return true; | 7169 return true; |
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7458 } | 7470 } |
7459 case EXTERNAL_UNSIGNED_INT_ELEMENTS: { | 7471 case EXTERNAL_UNSIGNED_INT_ELEMENTS: { |
7460 ExternalUnsignedIntArray* array = | 7472 ExternalUnsignedIntArray* array = |
7461 ExternalUnsignedIntArray::cast(elements()); | 7473 ExternalUnsignedIntArray::cast(elements()); |
7462 return array->SetValue(index, value); | 7474 return array->SetValue(index, value); |
7463 } | 7475 } |
7464 case EXTERNAL_FLOAT_ELEMENTS: { | 7476 case EXTERNAL_FLOAT_ELEMENTS: { |
7465 ExternalFloatArray* array = ExternalFloatArray::cast(elements()); | 7477 ExternalFloatArray* array = ExternalFloatArray::cast(elements()); |
7466 return array->SetValue(index, value); | 7478 return array->SetValue(index, value); |
7467 } | 7479 } |
7480 case EXTERNAL_DOUBLE_ELEMENTS: { | |
7481 ExternalDoubleArray* array = ExternalDoubleArray::cast(elements()); | |
7482 return array->SetValue(index, value); | |
7483 } | |
7468 case DICTIONARY_ELEMENTS: { | 7484 case DICTIONARY_ELEMENTS: { |
7469 // Insert element in the dictionary. | 7485 // Insert element in the dictionary. |
7470 FixedArray* elms = FixedArray::cast(elements()); | 7486 FixedArray* elms = FixedArray::cast(elements()); |
7471 NumberDictionary* dictionary = NumberDictionary::cast(elms); | 7487 NumberDictionary* dictionary = NumberDictionary::cast(elms); |
7472 | 7488 |
7473 int entry = dictionary->FindEntry(index); | 7489 int entry = dictionary->FindEntry(index); |
7474 if (entry != NumberDictionary::kNotFound) { | 7490 if (entry != NumberDictionary::kNotFound) { |
7475 Object* element = dictionary->ValueAt(entry); | 7491 Object* element = dictionary->ValueAt(entry); |
7476 PropertyDetails details = dictionary->DetailsAt(entry); | 7492 PropertyDetails details = dictionary->DetailsAt(entry); |
7477 if (details.type() == CALLBACKS) { | 7493 if (details.type() == CALLBACKS) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7599 } | 7615 } |
7600 break; | 7616 break; |
7601 } | 7617 } |
7602 case EXTERNAL_PIXEL_ELEMENTS: | 7618 case EXTERNAL_PIXEL_ELEMENTS: |
7603 case EXTERNAL_BYTE_ELEMENTS: | 7619 case EXTERNAL_BYTE_ELEMENTS: |
7604 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 7620 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
7605 case EXTERNAL_SHORT_ELEMENTS: | 7621 case EXTERNAL_SHORT_ELEMENTS: |
7606 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 7622 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
7607 case EXTERNAL_INT_ELEMENTS: | 7623 case EXTERNAL_INT_ELEMENTS: |
7608 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 7624 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
7609 case EXTERNAL_FLOAT_ELEMENTS: { | 7625 case EXTERNAL_FLOAT_ELEMENTS: |
7626 case EXTERNAL_DOUBLE_ELEMENTS: { | |
7610 MaybeObject* maybe_value = GetExternalElement(index); | 7627 MaybeObject* maybe_value = GetExternalElement(index); |
7611 Object* value; | 7628 Object* value; |
7612 if (!maybe_value->ToObject(&value)) return maybe_value; | 7629 if (!maybe_value->ToObject(&value)) return maybe_value; |
7613 if (!value->IsUndefined()) return value; | 7630 if (!value->IsUndefined()) return value; |
7614 break; | 7631 break; |
7615 } | 7632 } |
7616 case DICTIONARY_ELEMENTS: { | 7633 case DICTIONARY_ELEMENTS: { |
7617 NumberDictionary* dictionary = element_dictionary(); | 7634 NumberDictionary* dictionary = element_dictionary(); |
7618 int entry = dictionary->FindEntry(index); | 7635 int entry = dictionary->FindEntry(index); |
7619 if (entry != NumberDictionary::kNotFound) { | 7636 if (entry != NumberDictionary::kNotFound) { |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7701 } | 7718 } |
7702 break; | 7719 break; |
7703 } | 7720 } |
7704 case EXTERNAL_PIXEL_ELEMENTS: | 7721 case EXTERNAL_PIXEL_ELEMENTS: |
7705 case EXTERNAL_BYTE_ELEMENTS: | 7722 case EXTERNAL_BYTE_ELEMENTS: |
7706 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 7723 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
7707 case EXTERNAL_SHORT_ELEMENTS: | 7724 case EXTERNAL_SHORT_ELEMENTS: |
7708 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 7725 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
7709 case EXTERNAL_INT_ELEMENTS: | 7726 case EXTERNAL_INT_ELEMENTS: |
7710 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 7727 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
7711 case EXTERNAL_FLOAT_ELEMENTS: { | 7728 case EXTERNAL_FLOAT_ELEMENTS: |
7729 case EXTERNAL_DOUBLE_ELEMENTS: { | |
7712 MaybeObject* maybe_value = GetExternalElement(index); | 7730 MaybeObject* maybe_value = GetExternalElement(index); |
7713 Object* value; | 7731 Object* value; |
7714 if (!maybe_value->ToObject(&value)) return maybe_value; | 7732 if (!maybe_value->ToObject(&value)) return maybe_value; |
7715 if (!value->IsUndefined()) return value; | 7733 if (!value->IsUndefined()) return value; |
7716 break; | 7734 break; |
7717 } | 7735 } |
7718 case DICTIONARY_ELEMENTS: { | 7736 case DICTIONARY_ELEMENTS: { |
7719 NumberDictionary* dictionary = element_dictionary(); | 7737 NumberDictionary* dictionary = element_dictionary(); |
7720 int entry = dictionary->FindEntry(index); | 7738 int entry = dictionary->FindEntry(index); |
7721 if (entry != NumberDictionary::kNotFound) { | 7739 if (entry != NumberDictionary::kNotFound) { |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7804 break; | 7822 break; |
7805 } | 7823 } |
7806 case EXTERNAL_FLOAT_ELEMENTS: { | 7824 case EXTERNAL_FLOAT_ELEMENTS: { |
7807 ExternalFloatArray* array = ExternalFloatArray::cast(elements()); | 7825 ExternalFloatArray* array = ExternalFloatArray::cast(elements()); |
7808 if (index < static_cast<uint32_t>(array->length())) { | 7826 if (index < static_cast<uint32_t>(array->length())) { |
7809 float value = array->get(index); | 7827 float value = array->get(index); |
7810 return GetHeap()->AllocateHeapNumber(value); | 7828 return GetHeap()->AllocateHeapNumber(value); |
7811 } | 7829 } |
7812 break; | 7830 break; |
7813 } | 7831 } |
7832 case EXTERNAL_DOUBLE_ELEMENTS: { | |
7833 ExternalDoubleArray* array = ExternalDoubleArray::cast(elements()); | |
7834 if (index < static_cast<uint32_t>(array->length())) { | |
7835 double value = array->get(index); | |
7836 return GetHeap()->AllocateHeapNumber(value); | |
7837 } | |
7838 break; | |
7839 } | |
7814 case FAST_ELEMENTS: | 7840 case FAST_ELEMENTS: |
7815 case DICTIONARY_ELEMENTS: | 7841 case DICTIONARY_ELEMENTS: |
7816 UNREACHABLE(); | 7842 UNREACHABLE(); |
7817 break; | 7843 break; |
7818 } | 7844 } |
7819 return GetHeap()->undefined_value(); | 7845 return GetHeap()->undefined_value(); |
7820 } | 7846 } |
7821 | 7847 |
7822 | 7848 |
7823 bool JSObject::HasDenseElements() { | 7849 bool JSObject::HasDenseElements() { |
7824 int capacity = 0; | 7850 int capacity = 0; |
7825 int number_of_elements = 0; | 7851 int number_of_elements = 0; |
7826 | 7852 |
7827 switch (GetElementsKind()) { | 7853 switch (GetElementsKind()) { |
7828 case FAST_ELEMENTS: { | 7854 case FAST_ELEMENTS: { |
7829 FixedArray* elms = FixedArray::cast(elements()); | 7855 FixedArray* elms = FixedArray::cast(elements()); |
7830 capacity = elms->length(); | 7856 capacity = elms->length(); |
7831 for (int i = 0; i < capacity; i++) { | 7857 for (int i = 0; i < capacity; i++) { |
7832 if (!elms->get(i)->IsTheHole()) number_of_elements++; | 7858 if (!elms->get(i)->IsTheHole()) number_of_elements++; |
7833 } | 7859 } |
7834 break; | 7860 break; |
7835 } | 7861 } |
7836 case EXTERNAL_PIXEL_ELEMENTS: | 7862 case EXTERNAL_PIXEL_ELEMENTS: |
7837 case EXTERNAL_BYTE_ELEMENTS: | 7863 case EXTERNAL_BYTE_ELEMENTS: |
7838 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 7864 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
7839 case EXTERNAL_SHORT_ELEMENTS: | 7865 case EXTERNAL_SHORT_ELEMENTS: |
7840 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 7866 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
7841 case EXTERNAL_INT_ELEMENTS: | 7867 case EXTERNAL_INT_ELEMENTS: |
7842 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 7868 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
7843 case EXTERNAL_FLOAT_ELEMENTS: { | 7869 case EXTERNAL_FLOAT_ELEMENTS: |
7870 case EXTERNAL_DOUBLE_ELEMENTS: { | |
7844 return true; | 7871 return true; |
7845 } | 7872 } |
7846 case DICTIONARY_ELEMENTS: { | 7873 case DICTIONARY_ELEMENTS: { |
7847 NumberDictionary* dictionary = NumberDictionary::cast(elements()); | 7874 NumberDictionary* dictionary = NumberDictionary::cast(elements()); |
7848 capacity = dictionary->Capacity(); | 7875 capacity = dictionary->Capacity(); |
7849 number_of_elements = dictionary->NumberOfElements(); | 7876 number_of_elements = dictionary->NumberOfElements(); |
7850 break; | 7877 break; |
7851 } | 7878 } |
7852 default: | 7879 default: |
7853 UNREACHABLE(); | 7880 UNREACHABLE(); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8070 case EXTERNAL_PIXEL_ELEMENTS: { | 8097 case EXTERNAL_PIXEL_ELEMENTS: { |
8071 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); | 8098 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); |
8072 return index < static_cast<uint32_t>(pixels->length()); | 8099 return index < static_cast<uint32_t>(pixels->length()); |
8073 } | 8100 } |
8074 case EXTERNAL_BYTE_ELEMENTS: | 8101 case EXTERNAL_BYTE_ELEMENTS: |
8075 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 8102 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
8076 case EXTERNAL_SHORT_ELEMENTS: | 8103 case EXTERNAL_SHORT_ELEMENTS: |
8077 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 8104 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
8078 case EXTERNAL_INT_ELEMENTS: | 8105 case EXTERNAL_INT_ELEMENTS: |
8079 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 8106 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
8080 case EXTERNAL_FLOAT_ELEMENTS: { | 8107 case EXTERNAL_FLOAT_ELEMENTS: |
8108 case EXTERNAL_DOUBLE_ELEMENTS: { | |
8081 ExternalArray* array = ExternalArray::cast(elements()); | 8109 ExternalArray* array = ExternalArray::cast(elements()); |
8082 return index < static_cast<uint32_t>(array->length()); | 8110 return index < static_cast<uint32_t>(array->length()); |
8083 } | 8111 } |
8084 case DICTIONARY_ELEMENTS: { | 8112 case DICTIONARY_ELEMENTS: { |
8085 return element_dictionary()->FindEntry(index) | 8113 return element_dictionary()->FindEntry(index) |
8086 != NumberDictionary::kNotFound; | 8114 != NumberDictionary::kNotFound; |
8087 } | 8115 } |
8088 default: | 8116 default: |
8089 UNREACHABLE(); | 8117 UNREACHABLE(); |
8090 break; | 8118 break; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8311 } | 8339 } |
8312 ASSERT(!storage || storage->length() >= counter); | 8340 ASSERT(!storage || storage->length() >= counter); |
8313 break; | 8341 break; |
8314 } | 8342 } |
8315 case EXTERNAL_BYTE_ELEMENTS: | 8343 case EXTERNAL_BYTE_ELEMENTS: |
8316 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 8344 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
8317 case EXTERNAL_SHORT_ELEMENTS: | 8345 case EXTERNAL_SHORT_ELEMENTS: |
8318 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 8346 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
8319 case EXTERNAL_INT_ELEMENTS: | 8347 case EXTERNAL_INT_ELEMENTS: |
8320 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 8348 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
8321 case EXTERNAL_FLOAT_ELEMENTS: { | 8349 case EXTERNAL_FLOAT_ELEMENTS: |
8350 case EXTERNAL_DOUBLE_ELEMENTS: { | |
8322 int length = ExternalArray::cast(elements())->length(); | 8351 int length = ExternalArray::cast(elements())->length(); |
8323 while (counter < length) { | 8352 while (counter < length) { |
8324 if (storage != NULL) { | 8353 if (storage != NULL) { |
8325 storage->set(counter, Smi::FromInt(counter)); | 8354 storage->set(counter, Smi::FromInt(counter)); |
8326 } | 8355 } |
8327 counter++; | 8356 counter++; |
8328 } | 8357 } |
8329 ASSERT(!storage || storage->length() >= counter); | 8358 ASSERT(!storage || storage->length() >= counter); |
8330 break; | 8359 break; |
8331 } | 8360 } |
(...skipping 894 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
9226 // Clamp undefined to zero (default). All other types have been | 9255 // Clamp undefined to zero (default). All other types have been |
9227 // converted to a number type further up in the call chain. | 9256 // converted to a number type further up in the call chain. |
9228 ASSERT(value->IsUndefined()); | 9257 ASSERT(value->IsUndefined()); |
9229 } | 9258 } |
9230 set(index, cast_value); | 9259 set(index, cast_value); |
9231 } | 9260 } |
9232 return heap->AllocateHeapNumber(cast_value); | 9261 return heap->AllocateHeapNumber(cast_value); |
9233 } | 9262 } |
9234 | 9263 |
9235 | 9264 |
9265 MaybeObject* ExternalDoubleArray::SetValue(uint32_t index, Object* value) { | |
9266 double cast_value = 0; | |
danno
2011/04/18 16:36:28
probably don't want to call this cast_value since
Jakob Kummerow
2011/04/20 15:01:13
Done.
| |
9267 Heap* heap = GetHeap(); | |
9268 if (index < static_cast<uint32_t>(length())) { | |
9269 if (value->IsSmi()) { | |
9270 int int_value = Smi::cast(value)->value(); | |
9271 cast_value = static_cast<double>(int_value); | |
9272 } else if (value->IsHeapNumber()) { | |
9273 cast_value = HeapNumber::cast(value)->value(); | |
9274 } else { | |
9275 // Clamp undefined to zero (default). All other types have been | |
9276 // converted to a number type further up in the call chain. | |
9277 ASSERT(value->IsUndefined()); | |
9278 } | |
9279 set(index, cast_value); | |
9280 } | |
9281 return heap->AllocateHeapNumber(cast_value); | |
9282 } | |
9283 | |
9284 | |
9236 JSGlobalPropertyCell* GlobalObject::GetPropertyCell(LookupResult* result) { | 9285 JSGlobalPropertyCell* GlobalObject::GetPropertyCell(LookupResult* result) { |
9237 ASSERT(!HasFastProperties()); | 9286 ASSERT(!HasFastProperties()); |
9238 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry()); | 9287 Object* value = property_dictionary()->ValueAt(result->GetDictionaryEntry()); |
9239 return JSGlobalPropertyCell::cast(value); | 9288 return JSGlobalPropertyCell::cast(value); |
9240 } | 9289 } |
9241 | 9290 |
9242 | 9291 |
9243 MaybeObject* GlobalObject::EnsurePropertyCell(String* name) { | 9292 MaybeObject* GlobalObject::EnsurePropertyCell(String* name) { |
9244 ASSERT(!HasFastProperties()); | 9293 ASSERT(!HasFastProperties()); |
9245 int entry = property_dictionary()->FindEntry(name); | 9294 int entry = property_dictionary()->FindEntry(name); |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
10317 if (break_point_objects()->IsUndefined()) return 0; | 10366 if (break_point_objects()->IsUndefined()) return 0; |
10318 // Single beak point. | 10367 // Single beak point. |
10319 if (!break_point_objects()->IsFixedArray()) return 1; | 10368 if (!break_point_objects()->IsFixedArray()) return 1; |
10320 // Multiple break points. | 10369 // Multiple break points. |
10321 return FixedArray::cast(break_point_objects())->length(); | 10370 return FixedArray::cast(break_point_objects())->length(); |
10322 } | 10371 } |
10323 #endif | 10372 #endif |
10324 | 10373 |
10325 | 10374 |
10326 } } // namespace v8::internal | 10375 } } // namespace v8::internal |
OLD | NEW |