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()) { | |
5223 if (!value->IsNumber() && !value->IsUndefined()) { | 5222 if (!value->IsNumber() && !value->IsUndefined()) { |
5224 bool has_exception; | 5223 bool has_exception; |
5225 Handle<Object> number = | 5224 Handle<Object> number = |
5226 Execution::ToNumber(isolate, value, &has_exception); | 5225 Execution::ToNumber(isolate, value, &has_exception); |
5227 if (has_exception) return Handle<Object>(); // exception | 5226 if (has_exception) return Handle<Object>(); // exception |
5228 value = number; | 5227 value = number; |
5229 } | 5228 } |
5230 } | 5229 } |
5231 Handle<Object> result = JSObject::SetElement(js_object, index, value, attr, | 5230 Handle<Object> result = JSObject::SetElement(js_object, index, value, attr, |
5232 strict_mode, | 5231 strict_mode, |
(...skipping 4768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10001 case NON_STRICT_ARGUMENTS_ELEMENTS: | 10000 case NON_STRICT_ARGUMENTS_ELEMENTS: |
10002 case EXTERNAL_BYTE_ELEMENTS: | 10001 case EXTERNAL_BYTE_ELEMENTS: |
10003 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: | 10002 case EXTERNAL_UNSIGNED_BYTE_ELEMENTS: |
10004 case EXTERNAL_SHORT_ELEMENTS: | 10003 case EXTERNAL_SHORT_ELEMENTS: |
10005 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: | 10004 case EXTERNAL_UNSIGNED_SHORT_ELEMENTS: |
10006 case EXTERNAL_INT_ELEMENTS: | 10005 case EXTERNAL_INT_ELEMENTS: |
10007 case EXTERNAL_UNSIGNED_INT_ELEMENTS: | 10006 case EXTERNAL_UNSIGNED_INT_ELEMENTS: |
10008 case EXTERNAL_FLOAT_ELEMENTS: | 10007 case EXTERNAL_FLOAT_ELEMENTS: |
10009 case EXTERNAL_DOUBLE_ELEMENTS: | 10008 case EXTERNAL_DOUBLE_ELEMENTS: |
10010 case EXTERNAL_PIXEL_ELEMENTS: | 10009 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: | |
10020 // External arrays are always dense. | 10010 // External arrays are always dense. |
10021 return length; | 10011 return length; |
10022 } | 10012 } |
10023 // As an estimate, we assume that the prototype doesn't contain any | 10013 // As an estimate, we assume that the prototype doesn't contain any |
10024 // inherited elements. | 10014 // inherited elements. |
10025 return element_count; | 10015 return element_count; |
10026 } | 10016 } |
10027 | 10017 |
10028 | 10018 |
10029 | 10019 |
(...skipping 4868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14898 // Handle last resort GC and make sure to allow future allocations | 14888 // Handle last resort GC and make sure to allow future allocations |
14899 // to grow the heap without causing GCs (if possible). | 14889 // to grow the heap without causing GCs (if possible). |
14900 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14890 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14901 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14891 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14902 "Runtime::PerformGC"); | 14892 "Runtime::PerformGC"); |
14903 } | 14893 } |
14904 } | 14894 } |
14905 | 14895 |
14906 | 14896 |
14907 } } // namespace v8::internal | 14897 } } // namespace v8::internal |
OLD | NEW |