Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/runtime.cc

Issue 8503016: Merge r9917 into 3.5 branch. This fixes issue 103259. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.5
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/array.js ('k') | src/version.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 6643 matching lines...) Expand 10 before | Expand all | Expand 10 after
6654 RUNTIME_ASSERT(elements_array->HasFastElements()); 6654 RUNTIME_ASSERT(elements_array->HasFastElements());
6655 CONVERT_NUMBER_CHECKED(uint32_t, array_length, Uint32, args[1]); 6655 CONVERT_NUMBER_CHECKED(uint32_t, array_length, Uint32, args[1]);
6656 CONVERT_CHECKED(String, separator, args[2]); 6656 CONVERT_CHECKED(String, separator, args[2]);
6657 // elements_array is fast-mode JSarray of alternating positions 6657 // elements_array is fast-mode JSarray of alternating positions
6658 // (increasing order) and strings. 6658 // (increasing order) and strings.
6659 // array_length is length of original array (used to add separators); 6659 // array_length is length of original array (used to add separators);
6660 // separator is string to put between elements. Assumed to be non-empty. 6660 // separator is string to put between elements. Assumed to be non-empty.
6661 6661
6662 // Find total length of join result. 6662 // Find total length of join result.
6663 int string_length = 0; 6663 int string_length = 0;
6664 bool is_ascii = true; 6664 bool is_ascii = separator->IsAsciiRepresentation();
6665 int max_string_length = SeqAsciiString::kMaxLength; 6665 int max_string_length = SeqAsciiString::kMaxLength;
6666 bool overflow = false; 6666 bool overflow = false;
6667 CONVERT_NUMBER_CHECKED(int, elements_length, 6667 CONVERT_NUMBER_CHECKED(int, elements_length,
6668 Int32, elements_array->length()); 6668 Int32, elements_array->length());
6669 RUNTIME_ASSERT((elements_length & 1) == 0); // Even length. 6669 RUNTIME_ASSERT((elements_length & 1) == 0); // Even length.
6670 FixedArray* elements = FixedArray::cast(elements_array->elements()); 6670 FixedArray* elements = FixedArray::cast(elements_array->elements());
6671 for (int i = 0; i < elements_length; i += 2) { 6671 for (int i = 0; i < elements_length; i += 2) {
6672 RUNTIME_ASSERT(elements->get(i)->IsNumber()); 6672 RUNTIME_ASSERT(elements->get(i)->IsNumber());
6673 CONVERT_CHECKED(String, string, elements->get(i + 1)); 6673 CONVERT_CHECKED(String, string, elements->get(i + 1));
6674 int length = string->length(); 6674 int length = string->length();
(...skipping 6323 matching lines...) Expand 10 before | Expand all | Expand 10 after
12998 } else { 12998 } else {
12999 // Handle last resort GC and make sure to allow future allocations 12999 // Handle last resort GC and make sure to allow future allocations
13000 // to grow the heap without causing GCs (if possible). 13000 // to grow the heap without causing GCs (if possible).
13001 isolate->counters()->gc_last_resort_from_js()->Increment(); 13001 isolate->counters()->gc_last_resort_from_js()->Increment();
13002 isolate->heap()->CollectAllGarbage(false); 13002 isolate->heap()->CollectAllGarbage(false);
13003 } 13003 }
13004 } 13004 }
13005 13005
13006 13006
13007 } } // namespace v8::internal 13007 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/array.js ('k') | src/version.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698