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 5207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5218 // JavaScript. | 5218 // JavaScript. |
5219 // In the case of a String object we just need to redirect the assignment to | 5219 // In the case of a String object we just need to redirect the assignment to |
5220 // the underlying string if the index is in range. Since the underlying | 5220 // the underlying string if the index is in range. Since the underlying |
5221 // string does nothing with the assignment then we can ignore such | 5221 // string does nothing with the assignment then we can ignore such |
5222 // assignments. | 5222 // assignments. |
5223 if (js_object->IsStringObjectWithCharacterAt(index)) { | 5223 if (js_object->IsStringObjectWithCharacterAt(index)) { |
5224 return value; | 5224 return value; |
5225 } | 5225 } |
5226 | 5226 |
5227 js_object->ValidateElements(); | 5227 js_object->ValidateElements(); |
5228 if (js_object->HasExternalArrayElements()) { | 5228 if (js_object->HasExternalArrayElements() || |
| 5229 js_object->HasFixedTypedArrayElements()) { |
5229 if (!value->IsNumber() && !value->IsUndefined()) { | 5230 if (!value->IsNumber() && !value->IsUndefined()) { |
5230 bool has_exception; | 5231 bool has_exception; |
5231 Handle<Object> number = | 5232 Handle<Object> number = |
5232 Execution::ToNumber(isolate, value, &has_exception); | 5233 Execution::ToNumber(isolate, value, &has_exception); |
5233 if (has_exception) return Handle<Object>(); // exception | 5234 if (has_exception) return Handle<Object>(); // exception |
5234 value = number; | 5235 value = number; |
5235 } | 5236 } |
5236 } | 5237 } |
5237 Handle<Object> result = JSObject::SetElement(js_object, index, value, attr, | 5238 Handle<Object> result = JSObject::SetElement(js_object, index, value, attr, |
5238 strict_mode, | 5239 strict_mode, |
(...skipping 4778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10017 case NON_STRICT_ARGUMENTS_ELEMENTS: | 10018 case NON_STRICT_ARGUMENTS_ELEMENTS: |
10018 case EXTERNAL_BYTE_ELEMENTS: | 10019 case EXTERNAL_BYTE_ELEMENTS: |
10019 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 10020 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
10020 case EXTERNAL_SHORT_ELEMENTS: | 10021 case EXTERNAL_SHORT_ELEMENTS: |
10021 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 10022 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
10022 case EXTERNAL_INT_ELEMENTS: | 10023 case EXTERNAL_INT_ELEMENTS: |
10023 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 10024 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
10024 case EXTERNAL_FLOAT_ELEMENTS: | 10025 case EXTERNAL_FLOAT_ELEMENTS: |
10025 case EXTERNAL_DOUBLE_ELEMENTS: | 10026 case EXTERNAL_DOUBLE_ELEMENTS: |
10026 case EXTERNAL_PIXEL_ELEMENTS: | 10027 case EXTERNAL_PIXEL_ELEMENTS: |
| 10028 case UINT8_ELEMENTS: |
| 10029 case INT8_ELEMENTS: |
| 10030 case UINT16_ELEMENTS: |
| 10031 case INT16_ELEMENTS: |
| 10032 case UINT32_ELEMENTS: |
| 10033 case INT32_ELEMENTS: |
| 10034 case FLOAT32_ELEMENTS: |
| 10035 case FLOAT64_ELEMENTS: |
| 10036 case UINT8_CLAMPED_ELEMENTS: |
10027 // External arrays are always dense. | 10037 // External arrays are always dense. |
10028 return length; | 10038 return length; |
10029 } | 10039 } |
10030 // As an estimate, we assume that the prototype doesn't contain any | 10040 // As an estimate, we assume that the prototype doesn't contain any |
10031 // inherited elements. | 10041 // inherited elements. |
10032 return element_count; | 10042 return element_count; |
10033 } | 10043 } |
10034 | 10044 |
10035 | 10045 |
10036 | 10046 |
(...skipping 4865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14902 // Handle last resort GC and make sure to allow future allocations | 14912 // Handle last resort GC and make sure to allow future allocations |
14903 // to grow the heap without causing GCs (if possible). | 14913 // to grow the heap without causing GCs (if possible). |
14904 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14914 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14905 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14915 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14906 "Runtime::PerformGC"); | 14916 "Runtime::PerformGC"); |
14907 } | 14917 } |
14908 } | 14918 } |
14909 | 14919 |
14910 | 14920 |
14911 } } // namespace v8::internal | 14921 } } // namespace v8::internal |
OLD | NEW |