| 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 4768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10000 case NON_STRICT_ARGUMENTS_ELEMENTS: | 10001 case NON_STRICT_ARGUMENTS_ELEMENTS: |
| 10001 case EXTERNAL_BYTE_ELEMENTS: | 10002 case EXTERNAL_BYTE_ELEMENTS: |
| 10002 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 10003 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
| 10003 case EXTERNAL_SHORT_ELEMENTS: | 10004 case EXTERNAL_SHORT_ELEMENTS: |
| 10004 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 10005 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
| 10005 case EXTERNAL_INT_ELEMENTS: | 10006 case EXTERNAL_INT_ELEMENTS: |
| 10006 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 10007 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
| 10007 case EXTERNAL_FLOAT_ELEMENTS: | 10008 case EXTERNAL_FLOAT_ELEMENTS: |
| 10008 case EXTERNAL_DOUBLE_ELEMENTS: | 10009 case EXTERNAL_DOUBLE_ELEMENTS: |
| 10009 case EXTERNAL_PIXEL_ELEMENTS: | 10010 case EXTERNAL_PIXEL_ELEMENTS: |
| 10011 case UINT8_ELEMENTS: |
| 10012 case INT8_ELEMENTS: |
| 10013 case UINT16_ELEMENTS: |
| 10014 case INT16_ELEMENTS: |
| 10015 case UINT32_ELEMENTS: |
| 10016 case INT32_ELEMENTS: |
| 10017 case FLOAT32_ELEMENTS: |
| 10018 case FLOAT64_ELEMENTS: |
| 10019 case UINT8_CLAMPED_ELEMENTS: |
| 10010 // External arrays are always dense. | 10020 // External arrays are always dense. |
| 10011 return length; | 10021 return length; |
| 10012 } | 10022 } |
| 10013 // As an estimate, we assume that the prototype doesn't contain any | 10023 // As an estimate, we assume that the prototype doesn't contain any |
| 10014 // inherited elements. | 10024 // inherited elements. |
| 10015 return element_count; | 10025 return element_count; |
| 10016 } | 10026 } |
| 10017 | 10027 |
| 10018 | 10028 |
| 10019 | 10029 |
| (...skipping 4868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14888 // Handle last resort GC and make sure to allow future allocations | 14898 // Handle last resort GC and make sure to allow future allocations |
| 14889 // to grow the heap without causing GCs (if possible). | 14899 // to grow the heap without causing GCs (if possible). |
| 14890 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14900 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14891 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14901 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14892 "Runtime::PerformGC"); | 14902 "Runtime::PerformGC"); |
| 14893 } | 14903 } |
| 14894 } | 14904 } |
| 14895 | 14905 |
| 14896 | 14906 |
| 14897 } } // namespace v8::internal | 14907 } } // namespace v8::internal |
| OLD | NEW |