| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 switch (map()->instance_type()) { | 976 switch (map()->instance_type()) { |
| 977 case MAP_TYPE: | 977 case MAP_TYPE: |
| 978 accumulator->Add("<Map>"); | 978 accumulator->Add("<Map>"); |
| 979 break; | 979 break; |
| 980 case FIXED_ARRAY_TYPE: | 980 case FIXED_ARRAY_TYPE: |
| 981 accumulator->Add("<FixedArray[%u]>", FixedArray::cast(this)->length()); | 981 accumulator->Add("<FixedArray[%u]>", FixedArray::cast(this)->length()); |
| 982 break; | 982 break; |
| 983 case BYTE_ARRAY_TYPE: | 983 case BYTE_ARRAY_TYPE: |
| 984 accumulator->Add("<ByteArray[%u]>", ByteArray::cast(this)->length()); | 984 accumulator->Add("<ByteArray[%u]>", ByteArray::cast(this)->length()); |
| 985 break; | 985 break; |
| 986 case PIXEL_ARRAY_TYPE: | 986 case EXTERNAL_PIXEL_ARRAY_TYPE: |
| 987 accumulator->Add("<PixelArray[%u]>", PixelArray::cast(this)->length()); | 987 accumulator->Add("<ExternalPixelArray[%u]>", |
| 988 ExternalPixelArray::cast(this)->length()); |
| 988 break; | 989 break; |
| 989 case EXTERNAL_BYTE_ARRAY_TYPE: | 990 case EXTERNAL_BYTE_ARRAY_TYPE: |
| 990 accumulator->Add("<ExternalByteArray[%u]>", | 991 accumulator->Add("<ExternalByteArray[%u]>", |
| 991 ExternalByteArray::cast(this)->length()); | 992 ExternalByteArray::cast(this)->length()); |
| 992 break; | 993 break; |
| 993 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | 994 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: |
| 994 accumulator->Add("<ExternalUnsignedByteArray[%u]>", | 995 accumulator->Add("<ExternalUnsignedByteArray[%u]>", |
| 995 ExternalUnsignedByteArray::cast(this)->length()); | 996 ExternalUnsignedByteArray::cast(this)->length()); |
| 996 break; | 997 break; |
| 997 case EXTERNAL_SHORT_ARRAY_TYPE: | 998 case EXTERNAL_SHORT_ARRAY_TYPE: |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1128 break; | 1129 break; |
| 1129 case CODE_TYPE: | 1130 case CODE_TYPE: |
| 1130 reinterpret_cast<Code*>(this)->CodeIterateBody(v); | 1131 reinterpret_cast<Code*>(this)->CodeIterateBody(v); |
| 1131 break; | 1132 break; |
| 1132 case JS_GLOBAL_PROPERTY_CELL_TYPE: | 1133 case JS_GLOBAL_PROPERTY_CELL_TYPE: |
| 1133 JSGlobalPropertyCell::BodyDescriptor::IterateBody(this, v); | 1134 JSGlobalPropertyCell::BodyDescriptor::IterateBody(this, v); |
| 1134 break; | 1135 break; |
| 1135 case HEAP_NUMBER_TYPE: | 1136 case HEAP_NUMBER_TYPE: |
| 1136 case FILLER_TYPE: | 1137 case FILLER_TYPE: |
| 1137 case BYTE_ARRAY_TYPE: | 1138 case BYTE_ARRAY_TYPE: |
| 1138 case PIXEL_ARRAY_TYPE: | 1139 case EXTERNAL_PIXEL_ARRAY_TYPE: |
| 1139 case EXTERNAL_BYTE_ARRAY_TYPE: | 1140 case EXTERNAL_BYTE_ARRAY_TYPE: |
| 1140 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: | 1141 case EXTERNAL_UNSIGNED_BYTE_ARRAY_TYPE: |
| 1141 case EXTERNAL_SHORT_ARRAY_TYPE: | 1142 case EXTERNAL_SHORT_ARRAY_TYPE: |
| 1142 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: | 1143 case EXTERNAL_UNSIGNED_SHORT_ARRAY_TYPE: |
| 1143 case EXTERNAL_INT_ARRAY_TYPE: | 1144 case EXTERNAL_INT_ARRAY_TYPE: |
| 1144 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: | 1145 case EXTERNAL_UNSIGNED_INT_ARRAY_TYPE: |
| 1145 case EXTERNAL_FLOAT_ARRAY_TYPE: | 1146 case EXTERNAL_FLOAT_ARRAY_TYPE: |
| 1146 break; | 1147 break; |
| 1147 case SHARED_FUNCTION_INFO_TYPE: | 1148 case SHARED_FUNCTION_INFO_TYPE: |
| 1148 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); | 1149 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v); |
| (...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2478 | 2479 |
| 2479 MaybeObject* JSObject::TransformToFastProperties(int unused_property_fields) { | 2480 MaybeObject* JSObject::TransformToFastProperties(int unused_property_fields) { |
| 2480 if (HasFastProperties()) return this; | 2481 if (HasFastProperties()) return this; |
| 2481 ASSERT(!IsGlobalObject()); | 2482 ASSERT(!IsGlobalObject()); |
| 2482 return property_dictionary()-> | 2483 return property_dictionary()-> |
| 2483 TransformPropertiesToFastFor(this, unused_property_fields); | 2484 TransformPropertiesToFastFor(this, unused_property_fields); |
| 2484 } | 2485 } |
| 2485 | 2486 |
| 2486 | 2487 |
| 2487 MaybeObject* JSObject::NormalizeElements() { | 2488 MaybeObject* JSObject::NormalizeElements() { |
| 2488 ASSERT(!HasPixelElements() && !HasExternalArrayElements()); | 2489 ASSERT(!HasExternalArrayElements()); |
| 2489 if (HasDictionaryElements()) return this; | 2490 if (HasDictionaryElements()) return this; |
| 2490 ASSERT(map()->has_fast_elements()); | 2491 ASSERT(map()->has_fast_elements()); |
| 2491 | 2492 |
| 2492 Object* obj; | 2493 Object* obj; |
| 2493 { MaybeObject* maybe_obj = map()->GetSlowElementsMap(); | 2494 { MaybeObject* maybe_obj = map()->GetSlowElementsMap(); |
| 2494 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 2495 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 2495 } | 2496 } |
| 2496 Map* new_map = Map::cast(obj); | 2497 Map* new_map = Map::cast(obj); |
| 2497 | 2498 |
| 2498 // Get number of entries. | 2499 // Get number of entries. |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2583 } | 2584 } |
| 2584 MaybeObject* raw_result = | 2585 MaybeObject* raw_result = |
| 2585 this_handle->DeletePropertyPostInterceptor(*name_handle, NORMAL_DELETION); | 2586 this_handle->DeletePropertyPostInterceptor(*name_handle, NORMAL_DELETION); |
| 2586 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 2587 RETURN_IF_SCHEDULED_EXCEPTION(isolate); |
| 2587 return raw_result; | 2588 return raw_result; |
| 2588 } | 2589 } |
| 2589 | 2590 |
| 2590 | 2591 |
| 2591 MaybeObject* JSObject::DeleteElementPostInterceptor(uint32_t index, | 2592 MaybeObject* JSObject::DeleteElementPostInterceptor(uint32_t index, |
| 2592 DeleteMode mode) { | 2593 DeleteMode mode) { |
| 2593 ASSERT(!HasPixelElements() && !HasExternalArrayElements()); | |
| 2594 Heap* heap = GetHeap(); | 2594 Heap* heap = GetHeap(); |
| 2595 ASSERT(!HasExternalArrayElements()); |
| 2595 switch (GetElementsKind()) { | 2596 switch (GetElementsKind()) { |
| 2596 case FAST_ELEMENTS: { | 2597 case FAST_ELEMENTS: { |
| 2597 Object* obj; | 2598 Object* obj; |
| 2598 { MaybeObject* maybe_obj = EnsureWritableFastElements(); | 2599 { MaybeObject* maybe_obj = EnsureWritableFastElements(); |
| 2599 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 2600 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 2600 } | 2601 } |
| 2601 uint32_t length = IsJSArray() ? | 2602 uint32_t length = IsJSArray() ? |
| 2602 static_cast<uint32_t>(Smi::cast(JSArray::cast(this)->length())->value()) : | 2603 static_cast<uint32_t>(Smi::cast(JSArray::cast(this)->length())->value()) : |
| 2603 static_cast<uint32_t>(FixedArray::cast(elements())->length()); | 2604 static_cast<uint32_t>(FixedArray::cast(elements())->length()); |
| 2604 if (index < length) { | 2605 if (index < length) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2686 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 2687 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 2687 } | 2688 } |
| 2688 uint32_t length = IsJSArray() ? | 2689 uint32_t length = IsJSArray() ? |
| 2689 static_cast<uint32_t>(Smi::cast(JSArray::cast(this)->length())->value()) : | 2690 static_cast<uint32_t>(Smi::cast(JSArray::cast(this)->length())->value()) : |
| 2690 static_cast<uint32_t>(FixedArray::cast(elements())->length()); | 2691 static_cast<uint32_t>(FixedArray::cast(elements())->length()); |
| 2691 if (index < length) { | 2692 if (index < length) { |
| 2692 FixedArray::cast(elements())->set_the_hole(index); | 2693 FixedArray::cast(elements())->set_the_hole(index); |
| 2693 } | 2694 } |
| 2694 break; | 2695 break; |
| 2695 } | 2696 } |
| 2696 case PIXEL_ELEMENTS: | 2697 case EXTERNAL_PIXEL_ELEMENTS: |
| 2697 case EXTERNAL_BYTE_ELEMENTS: | 2698 case EXTERNAL_BYTE_ELEMENTS: |
| 2698 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 2699 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 2699 case EXTERNAL_SHORT_ELEMENTS: | 2700 case EXTERNAL_SHORT_ELEMENTS: |
| 2700 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 2701 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 2701 case EXTERNAL_INT_ELEMENTS: | 2702 case EXTERNAL_INT_ELEMENTS: |
| 2702 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 2703 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 2703 case EXTERNAL_FLOAT_ELEMENTS: | 2704 case EXTERNAL_FLOAT_ELEMENTS: |
| 2704 // Pixel and external array elements cannot be deleted. Just | 2705 // Pixel and external array elements cannot be deleted. Just |
| 2705 // silently ignore here. | 2706 // silently ignore here. |
| 2706 break; | 2707 break; |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2804 } | 2805 } |
| 2805 | 2806 |
| 2806 // Check if the object is among the named properties. | 2807 // Check if the object is among the named properties. |
| 2807 Object* key = SlowReverseLookup(obj); | 2808 Object* key = SlowReverseLookup(obj); |
| 2808 if (!key->IsUndefined()) { | 2809 if (!key->IsUndefined()) { |
| 2809 return true; | 2810 return true; |
| 2810 } | 2811 } |
| 2811 | 2812 |
| 2812 // Check if the object is among the indexed properties. | 2813 // Check if the object is among the indexed properties. |
| 2813 switch (GetElementsKind()) { | 2814 switch (GetElementsKind()) { |
| 2814 case PIXEL_ELEMENTS: | 2815 case EXTERNAL_PIXEL_ELEMENTS: |
| 2815 case EXTERNAL_BYTE_ELEMENTS: | 2816 case EXTERNAL_BYTE_ELEMENTS: |
| 2816 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 2817 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 2817 case EXTERNAL_SHORT_ELEMENTS: | 2818 case EXTERNAL_SHORT_ELEMENTS: |
| 2818 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 2819 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 2819 case EXTERNAL_INT_ELEMENTS: | 2820 case EXTERNAL_INT_ELEMENTS: |
| 2820 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 2821 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 2821 case EXTERNAL_FLOAT_ELEMENTS: | 2822 case EXTERNAL_FLOAT_ELEMENTS: |
| 2822 // Raw pixels and external arrays do not reference other | 2823 // Raw pixels and external arrays do not reference other |
| 2823 // objects. | 2824 // objects. |
| 2824 break; | 2825 break; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3075 return heap->undefined_value(); | 3076 return heap->undefined_value(); |
| 3076 } | 3077 } |
| 3077 | 3078 |
| 3078 uint32_t index = 0; | 3079 uint32_t index = 0; |
| 3079 bool is_element = name->AsArrayIndex(&index); | 3080 bool is_element = name->AsArrayIndex(&index); |
| 3080 | 3081 |
| 3081 if (is_element) { | 3082 if (is_element) { |
| 3082 switch (GetElementsKind()) { | 3083 switch (GetElementsKind()) { |
| 3083 case FAST_ELEMENTS: | 3084 case FAST_ELEMENTS: |
| 3084 break; | 3085 break; |
| 3085 case PIXEL_ELEMENTS: | 3086 case EXTERNAL_PIXEL_ELEMENTS: |
| 3086 case EXTERNAL_BYTE_ELEMENTS: | 3087 case EXTERNAL_BYTE_ELEMENTS: |
| 3087 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 3088 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 3088 case EXTERNAL_SHORT_ELEMENTS: | 3089 case EXTERNAL_SHORT_ELEMENTS: |
| 3089 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 3090 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 3090 case EXTERNAL_INT_ELEMENTS: | 3091 case EXTERNAL_INT_ELEMENTS: |
| 3091 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3092 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 3092 case EXTERNAL_FLOAT_ELEMENTS: | 3093 case EXTERNAL_FLOAT_ELEMENTS: |
| 3093 // Ignore getters and setters on pixel and external array | 3094 // Ignore getters and setters on pixel and external array |
| 3094 // elements. | 3095 // elements. |
| 3095 return heap->undefined_value(); | 3096 return heap->undefined_value(); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3301 uint32_t index = 0; | 3302 uint32_t index = 0; |
| 3302 bool is_element = name->AsArrayIndex(&index); | 3303 bool is_element = name->AsArrayIndex(&index); |
| 3303 | 3304 |
| 3304 if (is_element) { | 3305 if (is_element) { |
| 3305 if (IsJSArray()) return isolate->heap()->undefined_value(); | 3306 if (IsJSArray()) return isolate->heap()->undefined_value(); |
| 3306 | 3307 |
| 3307 // Accessors overwrite previous callbacks (cf. with getters/setters). | 3308 // Accessors overwrite previous callbacks (cf. with getters/setters). |
| 3308 switch (GetElementsKind()) { | 3309 switch (GetElementsKind()) { |
| 3309 case FAST_ELEMENTS: | 3310 case FAST_ELEMENTS: |
| 3310 break; | 3311 break; |
| 3311 case PIXEL_ELEMENTS: | 3312 case EXTERNAL_PIXEL_ELEMENTS: |
| 3312 case EXTERNAL_BYTE_ELEMENTS: | 3313 case EXTERNAL_BYTE_ELEMENTS: |
| 3313 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 3314 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 3314 case EXTERNAL_SHORT_ELEMENTS: | 3315 case EXTERNAL_SHORT_ELEMENTS: |
| 3315 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 3316 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 3316 case EXTERNAL_INT_ELEMENTS: | 3317 case EXTERNAL_INT_ELEMENTS: |
| 3317 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 3318 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 3318 case EXTERNAL_FLOAT_ELEMENTS: | 3319 case EXTERNAL_FLOAT_ELEMENTS: |
| 3319 // Ignore getters and setters on pixel and external array | 3320 // Ignore getters and setters on pixel and external array |
| 3320 // elements. | 3321 // elements. |
| 3321 return isolate->heap()->undefined_value(); | 3322 return isolate->heap()->undefined_value(); |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3891 key->IsString() && String::cast(element)->Equals(String::cast(key))) { | 3892 key->IsString() && String::cast(element)->Equals(String::cast(key))) { |
| 3892 return true; | 3893 return true; |
| 3893 } | 3894 } |
| 3894 } | 3895 } |
| 3895 return false; | 3896 return false; |
| 3896 } | 3897 } |
| 3897 | 3898 |
| 3898 | 3899 |
| 3899 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) { | 3900 MaybeObject* FixedArray::AddKeysFromJSArray(JSArray* array) { |
| 3900 Heap* heap = GetHeap(); | 3901 Heap* heap = GetHeap(); |
| 3901 ASSERT(!array->HasPixelElements() && !array->HasExternalArrayElements()); | 3902 ASSERT(!array->HasExternalArrayElements()); |
| 3902 switch (array->GetElementsKind()) { | 3903 switch (array->GetElementsKind()) { |
| 3903 case JSObject::FAST_ELEMENTS: | 3904 case JSObject::FAST_ELEMENTS: |
| 3904 return UnionOfKeys(FixedArray::cast(array->elements())); | 3905 return UnionOfKeys(FixedArray::cast(array->elements())); |
| 3905 case JSObject::DICTIONARY_ELEMENTS: { | 3906 case JSObject::DICTIONARY_ELEMENTS: { |
| 3906 NumberDictionary* dict = array->element_dictionary(); | 3907 NumberDictionary* dict = array->element_dictionary(); |
| 3907 int size = dict->NumberOfElements(); | 3908 int size = dict->NumberOfElements(); |
| 3908 | 3909 |
| 3909 // Allocate a temporary fixed array. | 3910 // Allocate a temporary fixed array. |
| 3910 Object* object; | 3911 Object* object; |
| 3911 { MaybeObject* maybe_object = heap->AllocateFixedArray(size); | 3912 { MaybeObject* maybe_object = heap->AllocateFixedArray(size); |
| (...skipping 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6359 | 6360 |
| 6360 // Identify kind of code. | 6361 // Identify kind of code. |
| 6361 const char* Code::Kind2String(Kind kind) { | 6362 const char* Code::Kind2String(Kind kind) { |
| 6362 switch (kind) { | 6363 switch (kind) { |
| 6363 case FUNCTION: return "FUNCTION"; | 6364 case FUNCTION: return "FUNCTION"; |
| 6364 case OPTIMIZED_FUNCTION: return "OPTIMIZED_FUNCTION"; | 6365 case OPTIMIZED_FUNCTION: return "OPTIMIZED_FUNCTION"; |
| 6365 case STUB: return "STUB"; | 6366 case STUB: return "STUB"; |
| 6366 case BUILTIN: return "BUILTIN"; | 6367 case BUILTIN: return "BUILTIN"; |
| 6367 case LOAD_IC: return "LOAD_IC"; | 6368 case LOAD_IC: return "LOAD_IC"; |
| 6368 case KEYED_LOAD_IC: return "KEYED_LOAD_IC"; | 6369 case KEYED_LOAD_IC: return "KEYED_LOAD_IC"; |
| 6370 case KEYED_EXTERNAL_ARRAY_LOAD_IC: return "KEYED_EXTERNAL_ARRAY_LOAD_IC"; |
| 6369 case STORE_IC: return "STORE_IC"; | 6371 case STORE_IC: return "STORE_IC"; |
| 6370 case KEYED_STORE_IC: return "KEYED_STORE_IC"; | 6372 case KEYED_STORE_IC: return "KEYED_STORE_IC"; |
| 6373 case KEYED_EXTERNAL_ARRAY_STORE_IC: return "KEYED_EXTERNAL_ARRAY_STORE_IC"; |
| 6371 case CALL_IC: return "CALL_IC"; | 6374 case CALL_IC: return "CALL_IC"; |
| 6372 case KEYED_CALL_IC: return "KEYED_CALL_IC"; | 6375 case KEYED_CALL_IC: return "KEYED_CALL_IC"; |
| 6373 case BINARY_OP_IC: return "BINARY_OP_IC"; | 6376 case BINARY_OP_IC: return "BINARY_OP_IC"; |
| 6374 case TYPE_RECORDING_BINARY_OP_IC: return "TYPE_RECORDING_BINARY_OP_IC"; | 6377 case TYPE_RECORDING_BINARY_OP_IC: return "TYPE_RECORDING_BINARY_OP_IC"; |
| 6375 case COMPARE_IC: return "COMPARE_IC"; | 6378 case COMPARE_IC: return "COMPARE_IC"; |
| 6376 } | 6379 } |
| 6377 UNREACHABLE(); | 6380 UNREACHABLE(); |
| 6378 return NULL; | 6381 return NULL; |
| 6379 } | 6382 } |
| 6380 | 6383 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6511 for (RelocIterator it(this); !it.done(); it.next()) it.rinfo()->Print(out); | 6514 for (RelocIterator it(this); !it.done(); it.next()) it.rinfo()->Print(out); |
| 6512 PrintF(out, "\n"); | 6515 PrintF(out, "\n"); |
| 6513 } | 6516 } |
| 6514 #endif // ENABLE_DISASSEMBLER | 6517 #endif // ENABLE_DISASSEMBLER |
| 6515 | 6518 |
| 6516 | 6519 |
| 6517 MaybeObject* JSObject::SetFastElementsCapacityAndLength(int capacity, | 6520 MaybeObject* JSObject::SetFastElementsCapacityAndLength(int capacity, |
| 6518 int length) { | 6521 int length) { |
| 6519 Heap* heap = GetHeap(); | 6522 Heap* heap = GetHeap(); |
| 6520 // We should never end in here with a pixel or external array. | 6523 // We should never end in here with a pixel or external array. |
| 6521 ASSERT(!HasPixelElements() && !HasExternalArrayElements()); | 6524 ASSERT(!HasExternalArrayElements()); |
| 6522 | 6525 |
| 6523 Object* obj; | 6526 Object* obj; |
| 6524 { MaybeObject* maybe_obj = heap->AllocateFixedArrayWithHoles(capacity); | 6527 { MaybeObject* maybe_obj = heap->AllocateFixedArrayWithHoles(capacity); |
| 6525 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 6528 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 6526 } | 6529 } |
| 6527 FixedArray* elems = FixedArray::cast(obj); | 6530 FixedArray* elems = FixedArray::cast(obj); |
| 6528 | 6531 |
| 6529 { MaybeObject* maybe_obj = map()->GetFastElementsMap(); | 6532 { MaybeObject* maybe_obj = map()->GetFastElementsMap(); |
| 6530 if (!maybe_obj->ToObject(&obj)) return maybe_obj; | 6533 if (!maybe_obj->ToObject(&obj)) return maybe_obj; |
| 6531 } | 6534 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6565 if (IsJSArray()) { | 6568 if (IsJSArray()) { |
| 6566 JSArray::cast(this)->set_length(Smi::FromInt(length)); | 6569 JSArray::cast(this)->set_length(Smi::FromInt(length)); |
| 6567 } | 6570 } |
| 6568 | 6571 |
| 6569 return this; | 6572 return this; |
| 6570 } | 6573 } |
| 6571 | 6574 |
| 6572 | 6575 |
| 6573 MaybeObject* JSObject::SetSlowElements(Object* len) { | 6576 MaybeObject* JSObject::SetSlowElements(Object* len) { |
| 6574 // We should never end in here with a pixel or external array. | 6577 // We should never end in here with a pixel or external array. |
| 6575 ASSERT(!HasPixelElements() && !HasExternalArrayElements()); | 6578 ASSERT(!HasExternalArrayElements()); |
| 6576 | 6579 |
| 6577 uint32_t new_length = static_cast<uint32_t>(len->Number()); | 6580 uint32_t new_length = static_cast<uint32_t>(len->Number()); |
| 6578 | 6581 |
| 6579 switch (GetElementsKind()) { | 6582 switch (GetElementsKind()) { |
| 6580 case FAST_ELEMENTS: { | 6583 case FAST_ELEMENTS: { |
| 6581 // Make sure we never try to shrink dense arrays into sparse arrays. | 6584 // Make sure we never try to shrink dense arrays into sparse arrays. |
| 6582 ASSERT(static_cast<uint32_t>(FixedArray::cast(elements())->length()) <= | 6585 ASSERT(static_cast<uint32_t>(FixedArray::cast(elements())->length()) <= |
| 6583 new_length); | 6586 new_length); |
| 6584 Object* obj; | 6587 Object* obj; |
| 6585 { MaybeObject* maybe_obj = NormalizeElements(); | 6588 { MaybeObject* maybe_obj = NormalizeElements(); |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6791 uint32_t length = IsJSArray() ? | 6794 uint32_t length = IsJSArray() ? |
| 6792 static_cast<uint32_t> | 6795 static_cast<uint32_t> |
| 6793 (Smi::cast(JSArray::cast(this)->length())->value()) : | 6796 (Smi::cast(JSArray::cast(this)->length())->value()) : |
| 6794 static_cast<uint32_t>(FixedArray::cast(elements())->length()); | 6797 static_cast<uint32_t>(FixedArray::cast(elements())->length()); |
| 6795 if ((index < length) && | 6798 if ((index < length) && |
| 6796 !FixedArray::cast(elements())->get(index)->IsTheHole()) { | 6799 !FixedArray::cast(elements())->get(index)->IsTheHole()) { |
| 6797 return true; | 6800 return true; |
| 6798 } | 6801 } |
| 6799 break; | 6802 break; |
| 6800 } | 6803 } |
| 6801 case PIXEL_ELEMENTS: { | 6804 case EXTERNAL_PIXEL_ELEMENTS: { |
| 6802 PixelArray* pixels = PixelArray::cast(elements()); | 6805 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); |
| 6803 if (index < static_cast<uint32_t>(pixels->length())) { | 6806 if (index < static_cast<uint32_t>(pixels->length())) { |
| 6804 return true; | 6807 return true; |
| 6805 } | 6808 } |
| 6806 break; | 6809 break; |
| 6807 } | 6810 } |
| 6808 case EXTERNAL_BYTE_ELEMENTS: | 6811 case EXTERNAL_BYTE_ELEMENTS: |
| 6809 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 6812 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 6810 case EXTERNAL_SHORT_ELEMENTS: | 6813 case EXTERNAL_SHORT_ELEMENTS: |
| 6811 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 6814 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 6812 case EXTERNAL_INT_ELEMENTS: | 6815 case EXTERNAL_INT_ELEMENTS: |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6913 uint32_t length = IsJSArray() ? | 6916 uint32_t length = IsJSArray() ? |
| 6914 static_cast<uint32_t> | 6917 static_cast<uint32_t> |
| 6915 (Smi::cast(JSArray::cast(this)->length())->value()) : | 6918 (Smi::cast(JSArray::cast(this)->length())->value()) : |
| 6916 static_cast<uint32_t>(FixedArray::cast(elements())->length()); | 6919 static_cast<uint32_t>(FixedArray::cast(elements())->length()); |
| 6917 if ((index < length) && | 6920 if ((index < length) && |
| 6918 !FixedArray::cast(elements())->get(index)->IsTheHole()) { | 6921 !FixedArray::cast(elements())->get(index)->IsTheHole()) { |
| 6919 return FAST_ELEMENT; | 6922 return FAST_ELEMENT; |
| 6920 } | 6923 } |
| 6921 break; | 6924 break; |
| 6922 } | 6925 } |
| 6923 case PIXEL_ELEMENTS: { | 6926 case EXTERNAL_PIXEL_ELEMENTS: { |
| 6924 PixelArray* pixels = PixelArray::cast(elements()); | 6927 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); |
| 6925 if (index < static_cast<uint32_t>(pixels->length())) return FAST_ELEMENT; | 6928 if (index < static_cast<uint32_t>(pixels->length())) return FAST_ELEMENT; |
| 6926 break; | 6929 break; |
| 6927 } | 6930 } |
| 6928 case EXTERNAL_BYTE_ELEMENTS: | 6931 case EXTERNAL_BYTE_ELEMENTS: |
| 6929 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 6932 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 6930 case EXTERNAL_SHORT_ELEMENTS: | 6933 case EXTERNAL_SHORT_ELEMENTS: |
| 6931 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 6934 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 6932 case EXTERNAL_INT_ELEMENTS: | 6935 case EXTERNAL_INT_ELEMENTS: |
| 6933 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 6936 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 6934 case EXTERNAL_FLOAT_ELEMENTS: { | 6937 case EXTERNAL_FLOAT_ELEMENTS: { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6970 switch (GetElementsKind()) { | 6973 switch (GetElementsKind()) { |
| 6971 case FAST_ELEMENTS: { | 6974 case FAST_ELEMENTS: { |
| 6972 uint32_t length = IsJSArray() ? | 6975 uint32_t length = IsJSArray() ? |
| 6973 static_cast<uint32_t> | 6976 static_cast<uint32_t> |
| 6974 (Smi::cast(JSArray::cast(this)->length())->value()) : | 6977 (Smi::cast(JSArray::cast(this)->length())->value()) : |
| 6975 static_cast<uint32_t>(FixedArray::cast(elements())->length()); | 6978 static_cast<uint32_t>(FixedArray::cast(elements())->length()); |
| 6976 if ((index < length) && | 6979 if ((index < length) && |
| 6977 !FixedArray::cast(elements())->get(index)->IsTheHole()) return true; | 6980 !FixedArray::cast(elements())->get(index)->IsTheHole()) return true; |
| 6978 break; | 6981 break; |
| 6979 } | 6982 } |
| 6980 case PIXEL_ELEMENTS: { | 6983 case EXTERNAL_PIXEL_ELEMENTS: { |
| 6981 PixelArray* pixels = PixelArray::cast(elements()); | 6984 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); |
| 6982 if (index < static_cast<uint32_t>(pixels->length())) { | 6985 if (index < static_cast<uint32_t>(pixels->length())) { |
| 6983 return true; | 6986 return true; |
| 6984 } | 6987 } |
| 6985 break; | 6988 break; |
| 6986 } | 6989 } |
| 6987 case EXTERNAL_BYTE_ELEMENTS: | 6990 case EXTERNAL_BYTE_ELEMENTS: |
| 6988 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 6991 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 6989 case EXTERNAL_SHORT_ELEMENTS: | 6992 case EXTERNAL_SHORT_ELEMENTS: |
| 6990 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 6993 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 6991 case EXTERNAL_INT_ELEMENTS: | 6994 case EXTERNAL_INT_ELEMENTS: |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7267 | 7270 |
| 7268 MaybeObject* JSObject::SetElementWithoutInterceptor(uint32_t index, | 7271 MaybeObject* JSObject::SetElementWithoutInterceptor(uint32_t index, |
| 7269 Object* value, | 7272 Object* value, |
| 7270 StrictModeFlag strict_mode, | 7273 StrictModeFlag strict_mode, |
| 7271 bool check_prototype) { | 7274 bool check_prototype) { |
| 7272 Isolate* isolate = GetIsolate(); | 7275 Isolate* isolate = GetIsolate(); |
| 7273 switch (GetElementsKind()) { | 7276 switch (GetElementsKind()) { |
| 7274 case FAST_ELEMENTS: | 7277 case FAST_ELEMENTS: |
| 7275 // Fast case. | 7278 // Fast case. |
| 7276 return SetFastElement(index, value, strict_mode, check_prototype); | 7279 return SetFastElement(index, value, strict_mode, check_prototype); |
| 7277 case PIXEL_ELEMENTS: { | 7280 case EXTERNAL_PIXEL_ELEMENTS: { |
| 7278 PixelArray* pixels = PixelArray::cast(elements()); | 7281 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); |
| 7279 return pixels->SetValue(index, value); | 7282 return pixels->SetValue(index, value); |
| 7280 } | 7283 } |
| 7281 case EXTERNAL_BYTE_ELEMENTS: { | 7284 case EXTERNAL_BYTE_ELEMENTS: { |
| 7282 ExternalByteArray* array = ExternalByteArray::cast(elements()); | 7285 ExternalByteArray* array = ExternalByteArray::cast(elements()); |
| 7283 return array->SetValue(index, value); | 7286 return array->SetValue(index, value); |
| 7284 } | 7287 } |
| 7285 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: { | 7288 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: { |
| 7286 ExternalUnsignedByteArray* array = | 7289 ExternalUnsignedByteArray* array = |
| 7287 ExternalUnsignedByteArray::cast(elements()); | 7290 ExternalUnsignedByteArray::cast(elements()); |
| 7288 return array->SetValue(index, value); | 7291 return array->SetValue(index, value); |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7433 // JSArray::length cannot change. | 7436 // JSArray::length cannot change. |
| 7434 switch (GetElementsKind()) { | 7437 switch (GetElementsKind()) { |
| 7435 case FAST_ELEMENTS: { | 7438 case FAST_ELEMENTS: { |
| 7436 FixedArray* elms = FixedArray::cast(elements()); | 7439 FixedArray* elms = FixedArray::cast(elements()); |
| 7437 if (index < static_cast<uint32_t>(elms->length())) { | 7440 if (index < static_cast<uint32_t>(elms->length())) { |
| 7438 Object* value = elms->get(index); | 7441 Object* value = elms->get(index); |
| 7439 if (!value->IsTheHole()) return value; | 7442 if (!value->IsTheHole()) return value; |
| 7440 } | 7443 } |
| 7441 break; | 7444 break; |
| 7442 } | 7445 } |
| 7443 case PIXEL_ELEMENTS: | 7446 case EXTERNAL_PIXEL_ELEMENTS: |
| 7444 case EXTERNAL_BYTE_ELEMENTS: | 7447 case EXTERNAL_BYTE_ELEMENTS: |
| 7445 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 7448 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 7446 case EXTERNAL_SHORT_ELEMENTS: | 7449 case EXTERNAL_SHORT_ELEMENTS: |
| 7447 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 7450 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 7448 case EXTERNAL_INT_ELEMENTS: | 7451 case EXTERNAL_INT_ELEMENTS: |
| 7449 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 7452 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 7450 case EXTERNAL_FLOAT_ELEMENTS: { | 7453 case EXTERNAL_FLOAT_ELEMENTS: { |
| 7451 MaybeObject* maybe_value = GetExternalElement(index); | 7454 MaybeObject* maybe_value = GetExternalElement(index); |
| 7452 Object* value; | 7455 Object* value; |
| 7453 if (!maybe_value->ToObject(&value)) return maybe_value; | 7456 if (!maybe_value->ToObject(&value)) return maybe_value; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7534 // JSArray::length cannot change. | 7537 // JSArray::length cannot change. |
| 7535 switch (GetElementsKind()) { | 7538 switch (GetElementsKind()) { |
| 7536 case FAST_ELEMENTS: { | 7539 case FAST_ELEMENTS: { |
| 7537 FixedArray* elms = FixedArray::cast(elements()); | 7540 FixedArray* elms = FixedArray::cast(elements()); |
| 7538 if (index < static_cast<uint32_t>(elms->length())) { | 7541 if (index < static_cast<uint32_t>(elms->length())) { |
| 7539 Object* value = elms->get(index); | 7542 Object* value = elms->get(index); |
| 7540 if (!value->IsTheHole()) return value; | 7543 if (!value->IsTheHole()) return value; |
| 7541 } | 7544 } |
| 7542 break; | 7545 break; |
| 7543 } | 7546 } |
| 7544 case PIXEL_ELEMENTS: | 7547 case EXTERNAL_PIXEL_ELEMENTS: |
| 7545 case EXTERNAL_BYTE_ELEMENTS: | 7548 case EXTERNAL_BYTE_ELEMENTS: |
| 7546 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 7549 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 7547 case EXTERNAL_SHORT_ELEMENTS: | 7550 case EXTERNAL_SHORT_ELEMENTS: |
| 7548 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 7551 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 7549 case EXTERNAL_INT_ELEMENTS: | 7552 case EXTERNAL_INT_ELEMENTS: |
| 7550 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 7553 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 7551 case EXTERNAL_FLOAT_ELEMENTS: { | 7554 case EXTERNAL_FLOAT_ELEMENTS: { |
| 7552 MaybeObject* maybe_value = GetExternalElement(index); | 7555 MaybeObject* maybe_value = GetExternalElement(index); |
| 7553 Object* value; | 7556 Object* value; |
| 7554 if (!maybe_value->ToObject(&value)) return maybe_value; | 7557 if (!maybe_value->ToObject(&value)) return maybe_value; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 7576 Object* pt = GetPrototype(); | 7579 Object* pt = GetPrototype(); |
| 7577 if (pt == heap->null_value()) return heap->undefined_value(); | 7580 if (pt == heap->null_value()) return heap->undefined_value(); |
| 7578 return pt->GetElementWithReceiver(receiver, index); | 7581 return pt->GetElementWithReceiver(receiver, index); |
| 7579 } | 7582 } |
| 7580 | 7583 |
| 7581 | 7584 |
| 7582 MaybeObject* JSObject::GetExternalElement(uint32_t index) { | 7585 MaybeObject* JSObject::GetExternalElement(uint32_t index) { |
| 7583 // Get element works for both JSObject and JSArray since | 7586 // Get element works for both JSObject and JSArray since |
| 7584 // JSArray::length cannot change. | 7587 // JSArray::length cannot change. |
| 7585 switch (GetElementsKind()) { | 7588 switch (GetElementsKind()) { |
| 7586 case PIXEL_ELEMENTS: { | 7589 case EXTERNAL_PIXEL_ELEMENTS: { |
| 7587 PixelArray* pixels = PixelArray::cast(elements()); | 7590 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); |
| 7588 if (index < static_cast<uint32_t>(pixels->length())) { | 7591 if (index < static_cast<uint32_t>(pixels->length())) { |
| 7589 uint8_t value = pixels->get(index); | 7592 uint8_t value = pixels->get(index); |
| 7590 return Smi::FromInt(value); | 7593 return Smi::FromInt(value); |
| 7591 } | 7594 } |
| 7592 break; | 7595 break; |
| 7593 } | 7596 } |
| 7594 case EXTERNAL_BYTE_ELEMENTS: { | 7597 case EXTERNAL_BYTE_ELEMENTS: { |
| 7595 ExternalByteArray* array = ExternalByteArray::cast(elements()); | 7598 ExternalByteArray* array = ExternalByteArray::cast(elements()); |
| 7596 if (index < static_cast<uint32_t>(array->length())) { | 7599 if (index < static_cast<uint32_t>(array->length())) { |
| 7597 int8_t value = array->get(index); | 7600 int8_t value = array->get(index); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7665 | 7668 |
| 7666 switch (GetElementsKind()) { | 7669 switch (GetElementsKind()) { |
| 7667 case FAST_ELEMENTS: { | 7670 case FAST_ELEMENTS: { |
| 7668 FixedArray* elms = FixedArray::cast(elements()); | 7671 FixedArray* elms = FixedArray::cast(elements()); |
| 7669 capacity = elms->length(); | 7672 capacity = elms->length(); |
| 7670 for (int i = 0; i < capacity; i++) { | 7673 for (int i = 0; i < capacity; i++) { |
| 7671 if (!elms->get(i)->IsTheHole()) number_of_elements++; | 7674 if (!elms->get(i)->IsTheHole()) number_of_elements++; |
| 7672 } | 7675 } |
| 7673 break; | 7676 break; |
| 7674 } | 7677 } |
| 7675 case PIXEL_ELEMENTS: | 7678 case EXTERNAL_PIXEL_ELEMENTS: |
| 7676 case EXTERNAL_BYTE_ELEMENTS: | 7679 case EXTERNAL_BYTE_ELEMENTS: |
| 7677 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 7680 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 7678 case EXTERNAL_SHORT_ELEMENTS: | 7681 case EXTERNAL_SHORT_ELEMENTS: |
| 7679 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 7682 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 7680 case EXTERNAL_INT_ELEMENTS: | 7683 case EXTERNAL_INT_ELEMENTS: |
| 7681 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 7684 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 7682 case EXTERNAL_FLOAT_ELEMENTS: { | 7685 case EXTERNAL_FLOAT_ELEMENTS: { |
| 7683 return true; | 7686 return true; |
| 7684 } | 7687 } |
| 7685 case DICTIONARY_ELEMENTS: { | 7688 case DICTIONARY_ELEMENTS: { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7898 | 7901 |
| 7899 switch (GetElementsKind()) { | 7902 switch (GetElementsKind()) { |
| 7900 case FAST_ELEMENTS: { | 7903 case FAST_ELEMENTS: { |
| 7901 uint32_t length = IsJSArray() ? | 7904 uint32_t length = IsJSArray() ? |
| 7902 static_cast<uint32_t>( | 7905 static_cast<uint32_t>( |
| 7903 Smi::cast(JSArray::cast(this)->length())->value()) : | 7906 Smi::cast(JSArray::cast(this)->length())->value()) : |
| 7904 static_cast<uint32_t>(FixedArray::cast(elements())->length()); | 7907 static_cast<uint32_t>(FixedArray::cast(elements())->length()); |
| 7905 return (index < length) && | 7908 return (index < length) && |
| 7906 !FixedArray::cast(elements())->get(index)->IsTheHole(); | 7909 !FixedArray::cast(elements())->get(index)->IsTheHole(); |
| 7907 } | 7910 } |
| 7908 case PIXEL_ELEMENTS: { | 7911 case EXTERNAL_PIXEL_ELEMENTS: { |
| 7909 PixelArray* pixels = PixelArray::cast(elements()); | 7912 ExternalPixelArray* pixels = ExternalPixelArray::cast(elements()); |
| 7910 return index < static_cast<uint32_t>(pixels->length()); | 7913 return index < static_cast<uint32_t>(pixels->length()); |
| 7911 } | 7914 } |
| 7912 case EXTERNAL_BYTE_ELEMENTS: | 7915 case EXTERNAL_BYTE_ELEMENTS: |
| 7913 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 7916 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 7914 case EXTERNAL_SHORT_ELEMENTS: | 7917 case EXTERNAL_SHORT_ELEMENTS: |
| 7915 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 7918 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 7916 case EXTERNAL_INT_ELEMENTS: | 7919 case EXTERNAL_INT_ELEMENTS: |
| 7917 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 7920 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 7918 case EXTERNAL_FLOAT_ELEMENTS: { | 7921 case EXTERNAL_FLOAT_ELEMENTS: { |
| 7919 ExternalArray* array = ExternalArray::cast(elements()); | 7922 ExternalArray* array = ExternalArray::cast(elements()); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8131 if (!FixedArray::cast(elements())->get(i)->IsTheHole()) { | 8134 if (!FixedArray::cast(elements())->get(i)->IsTheHole()) { |
| 8132 if (storage != NULL) { | 8135 if (storage != NULL) { |
| 8133 storage->set(counter, Smi::FromInt(i)); | 8136 storage->set(counter, Smi::FromInt(i)); |
| 8134 } | 8137 } |
| 8135 counter++; | 8138 counter++; |
| 8136 } | 8139 } |
| 8137 } | 8140 } |
| 8138 ASSERT(!storage || storage->length() >= counter); | 8141 ASSERT(!storage || storage->length() >= counter); |
| 8139 break; | 8142 break; |
| 8140 } | 8143 } |
| 8141 case PIXEL_ELEMENTS: { | 8144 case EXTERNAL_PIXEL_ELEMENTS: { |
| 8142 int length = PixelArray::cast(elements())->length(); | 8145 int length = ExternalPixelArray::cast(elements())->length(); |
| 8143 while (counter < length) { | 8146 while (counter < length) { |
| 8144 if (storage != NULL) { | 8147 if (storage != NULL) { |
| 8145 storage->set(counter, Smi::FromInt(counter)); | 8148 storage->set(counter, Smi::FromInt(counter)); |
| 8146 } | 8149 } |
| 8147 counter++; | 8150 counter++; |
| 8148 } | 8151 } |
| 8149 ASSERT(!storage || storage->length() >= counter); | 8152 ASSERT(!storage || storage->length() >= counter); |
| 8150 break; | 8153 break; |
| 8151 } | 8154 } |
| 8152 case EXTERNAL_BYTE_ELEMENTS: | 8155 case EXTERNAL_BYTE_ELEMENTS: |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8817 return result_double; | 8820 return result_double; |
| 8818 } | 8821 } |
| 8819 | 8822 |
| 8820 | 8823 |
| 8821 // Collects all defined (non-hole) and non-undefined (array) elements at | 8824 // Collects all defined (non-hole) and non-undefined (array) elements at |
| 8822 // the start of the elements array. | 8825 // the start of the elements array. |
| 8823 // If the object is in dictionary mode, it is converted to fast elements | 8826 // If the object is in dictionary mode, it is converted to fast elements |
| 8824 // mode. | 8827 // mode. |
| 8825 MaybeObject* JSObject::PrepareElementsForSort(uint32_t limit) { | 8828 MaybeObject* JSObject::PrepareElementsForSort(uint32_t limit) { |
| 8826 Heap* heap = GetHeap(); | 8829 Heap* heap = GetHeap(); |
| 8827 ASSERT(!HasPixelElements() && !HasExternalArrayElements()); | 8830 ASSERT(!HasExternalArrayElements()); |
| 8828 | 8831 |
| 8829 if (HasDictionaryElements()) { | 8832 if (HasDictionaryElements()) { |
| 8830 // Convert to fast elements containing only the existing properties. | 8833 // Convert to fast elements containing only the existing properties. |
| 8831 // Ordering is irrelevant, since we are going to sort anyway. | 8834 // Ordering is irrelevant, since we are going to sort anyway. |
| 8832 NumberDictionary* dict = element_dictionary(); | 8835 NumberDictionary* dict = element_dictionary(); |
| 8833 if (IsJSArray() || dict->requires_slow_elements() || | 8836 if (IsJSArray() || dict->requires_slow_elements() || |
| 8834 dict->max_number_key() >= limit) { | 8837 dict->max_number_key() >= limit) { |
| 8835 return PrepareSlowElementsForSort(limit); | 8838 return PrepareSlowElementsForSort(limit); |
| 8836 } | 8839 } |
| 8837 // Convert to fast elements. | 8840 // Convert to fast elements. |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8929 | 8932 |
| 8930 if (result <= static_cast<uint32_t>(Smi::kMaxValue)) { | 8933 if (result <= static_cast<uint32_t>(Smi::kMaxValue)) { |
| 8931 return Smi::FromInt(static_cast<int>(result)); | 8934 return Smi::FromInt(static_cast<int>(result)); |
| 8932 } | 8935 } |
| 8933 ASSERT_NE(NULL, result_double); | 8936 ASSERT_NE(NULL, result_double); |
| 8934 result_double->set_value(static_cast<double>(result)); | 8937 result_double->set_value(static_cast<double>(result)); |
| 8935 return result_double; | 8938 return result_double; |
| 8936 } | 8939 } |
| 8937 | 8940 |
| 8938 | 8941 |
| 8939 Object* PixelArray::SetValue(uint32_t index, Object* value) { | 8942 Object* ExternalPixelArray::SetValue(uint32_t index, Object* value) { |
| 8940 uint8_t clamped_value = 0; | 8943 uint8_t clamped_value = 0; |
| 8941 if (index < static_cast<uint32_t>(length())) { | 8944 if (index < static_cast<uint32_t>(length())) { |
| 8942 if (value->IsSmi()) { | 8945 if (value->IsSmi()) { |
| 8943 int int_value = Smi::cast(value)->value(); | 8946 int int_value = Smi::cast(value)->value(); |
| 8944 if (int_value < 0) { | 8947 if (int_value < 0) { |
| 8945 clamped_value = 0; | 8948 clamped_value = 0; |
| 8946 } else if (int_value > 255) { | 8949 } else if (int_value > 255) { |
| 8947 clamped_value = 255; | 8950 clamped_value = 255; |
| 8948 } else { | 8951 } else { |
| 8949 clamped_value = static_cast<uint8_t>(int_value); | 8952 clamped_value = static_cast<uint8_t>(int_value); |
| (...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10158 if (break_point_objects()->IsUndefined()) return 0; | 10161 if (break_point_objects()->IsUndefined()) return 0; |
| 10159 // Single beak point. | 10162 // Single beak point. |
| 10160 if (!break_point_objects()->IsFixedArray()) return 1; | 10163 if (!break_point_objects()->IsFixedArray()) return 1; |
| 10161 // Multiple break points. | 10164 // Multiple break points. |
| 10162 return FixedArray::cast(break_point_objects())->length(); | 10165 return FixedArray::cast(break_point_objects())->length(); |
| 10163 } | 10166 } |
| 10164 #endif | 10167 #endif |
| 10165 | 10168 |
| 10166 | 10169 |
| 10167 } } // namespace v8::internal | 10170 } } // namespace v8::internal |
| OLD | NEW |