OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 6951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6962 elements_array->HasFastSmiOnlyElements()); | 6962 elements_array->HasFastSmiOnlyElements()); |
6963 CONVERT_NUMBER_CHECKED(uint32_t, array_length, Uint32, args[1]); | 6963 CONVERT_NUMBER_CHECKED(uint32_t, array_length, Uint32, args[1]); |
6964 CONVERT_CHECKED(String, separator, args[2]); | 6964 CONVERT_CHECKED(String, separator, args[2]); |
6965 // elements_array is fast-mode JSarray of alternating positions | 6965 // elements_array is fast-mode JSarray of alternating positions |
6966 // (increasing order) and strings. | 6966 // (increasing order) and strings. |
6967 // array_length is length of original array (used to add separators); | 6967 // array_length is length of original array (used to add separators); |
6968 // separator is string to put between elements. Assumed to be non-empty. | 6968 // separator is string to put between elements. Assumed to be non-empty. |
6969 | 6969 |
6970 // Find total length of join result. | 6970 // Find total length of join result. |
6971 int string_length = 0; | 6971 int string_length = 0; |
6972 bool is_ascii = true; | 6972 bool is_ascii = separator->IsAsciiRepresentation(); |
6973 int max_string_length = SeqAsciiString::kMaxLength; | 6973 int max_string_length = SeqAsciiString::kMaxLength; |
6974 bool overflow = false; | 6974 bool overflow = false; |
6975 CONVERT_NUMBER_CHECKED(int, elements_length, | 6975 CONVERT_NUMBER_CHECKED(int, elements_length, |
6976 Int32, elements_array->length()); | 6976 Int32, elements_array->length()); |
6977 RUNTIME_ASSERT((elements_length & 1) == 0); // Even length. | 6977 RUNTIME_ASSERT((elements_length & 1) == 0); // Even length. |
6978 FixedArray* elements = FixedArray::cast(elements_array->elements()); | 6978 FixedArray* elements = FixedArray::cast(elements_array->elements()); |
6979 for (int i = 0; i < elements_length; i += 2) { | 6979 for (int i = 0; i < elements_length; i += 2) { |
6980 RUNTIME_ASSERT(elements->get(i)->IsNumber()); | 6980 RUNTIME_ASSERT(elements->get(i)->IsNumber()); |
6981 CONVERT_CHECKED(String, string, elements->get(i + 1)); | 6981 CONVERT_CHECKED(String, string, elements->get(i + 1)); |
6982 int length = string->length(); | 6982 int length = string->length(); |
(...skipping 6588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13571 } else { | 13571 } else { |
13572 // Handle last resort GC and make sure to allow future allocations | 13572 // Handle last resort GC and make sure to allow future allocations |
13573 // to grow the heap without causing GCs (if possible). | 13573 // to grow the heap without causing GCs (if possible). |
13574 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13574 isolate->counters()->gc_last_resort_from_js()->Increment(); |
13575 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); | 13575 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags); |
13576 } | 13576 } |
13577 } | 13577 } |
13578 | 13578 |
13579 | 13579 |
13580 } } // namespace v8::internal | 13580 } } // namespace v8::internal |
OLD | NEW |