OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 5200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5211 // JavaScript. | 5211 // JavaScript. |
5212 // In the case of a String object we just need to redirect the assignment to | 5212 // In the case of a String object we just need to redirect the assignment to |
5213 // the underlying string if the index is in range. Since the underlying | 5213 // the underlying string if the index is in range. Since the underlying |
5214 // string does nothing with the assignment then we can ignore such | 5214 // string does nothing with the assignment then we can ignore such |
5215 // assignments. | 5215 // assignments. |
5216 if (js_object->IsStringObjectWithCharacterAt(index)) { | 5216 if (js_object->IsStringObjectWithCharacterAt(index)) { |
5217 return value; | 5217 return value; |
5218 } | 5218 } |
5219 | 5219 |
5220 js_object->ValidateElements(); | 5220 js_object->ValidateElements(); |
5221 if (js_object->HasExternalArrayElements()) { | 5221 if (js_object->HasExternalArrayElements() || |
| 5222 js_object->HasFixedTypedArrayElements()) { |
5222 if (!value->IsNumber() && !value->IsUndefined()) { | 5223 if (!value->IsNumber() && !value->IsUndefined()) { |
5223 bool has_exception; | 5224 bool has_exception; |
5224 Handle<Object> number = | 5225 Handle<Object> number = |
5225 Execution::ToNumber(isolate, value, &has_exception); | 5226 Execution::ToNumber(isolate, value, &has_exception); |
5226 if (has_exception) return Handle<Object>(); // exception | 5227 if (has_exception) return Handle<Object>(); // exception |
5227 value = number; | 5228 value = number; |
5228 } | 5229 } |
5229 } | 5230 } |
5230 Handle<Object> result = JSObject::SetElement(js_object, index, value, attr, | 5231 Handle<Object> result = JSObject::SetElement(js_object, index, value, attr, |
5231 strict_mode, | 5232 strict_mode, |
(...skipping 4772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10004 case NON_STRICT_ARGUMENTS_ELEMENTS: | 10005 case NON_STRICT_ARGUMENTS_ELEMENTS: |
10005 case EXTERNAL_BYTE_ELEMENTS: | 10006 case EXTERNAL_BYTE_ELEMENTS: |
10006 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 10007 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
10007 case EXTERNAL_SHORT_ELEMENTS: | 10008 case EXTERNAL_SHORT_ELEMENTS: |
10008 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 10009 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
10009 case EXTERNAL_INT_ELEMENTS: | 10010 case EXTERNAL_INT_ELEMENTS: |
10010 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 10011 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
10011 case EXTERNAL_FLOAT_ELEMENTS: | 10012 case EXTERNAL_FLOAT_ELEMENTS: |
10012 case EXTERNAL_DOUBLE_ELEMENTS: | 10013 case EXTERNAL_DOUBLE_ELEMENTS: |
10013 case EXTERNAL_PIXEL_ELEMENTS: | 10014 case EXTERNAL_PIXEL_ELEMENTS: |
| 10015 case UINT8_ELEMENTS: |
| 10016 case INT8_ELEMENTS: |
| 10017 case UINT16_ELEMENTS: |
| 10018 case INT16_ELEMENTS: |
| 10019 case UINT32_ELEMENTS: |
| 10020 case INT32_ELEMENTS: |
| 10021 case FLOAT32_ELEMENTS: |
| 10022 case FLOAT64_ELEMENTS: |
| 10023 case UINT8_CLAMPED_ELEMENTS: |
10014 // External arrays are always dense. | 10024 // External arrays are always dense. |
10015 return length; | 10025 return length; |
10016 } | 10026 } |
10017 // As an estimate, we assume that the prototype doesn't contain any | 10027 // As an estimate, we assume that the prototype doesn't contain any |
10018 // inherited elements. | 10028 // inherited elements. |
10019 return element_count; | 10029 return element_count; |
10020 } | 10030 } |
10021 | 10031 |
10022 | 10032 |
10023 | 10033 |
(...skipping 4859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14883 // Handle last resort GC and make sure to allow future allocations | 14893 // Handle last resort GC and make sure to allow future allocations |
14884 // to grow the heap without causing GCs (if possible). | 14894 // to grow the heap without causing GCs (if possible). |
14885 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14895 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14886 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14896 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14887 "Runtime::PerformGC"); | 14897 "Runtime::PerformGC"); |
14888 } | 14898 } |
14889 } | 14899 } |
14890 | 14900 |
14891 | 14901 |
14892 } } // namespace v8::internal | 14902 } } // namespace v8::internal |
OLD | NEW |