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

Side by Side Diff: src/builtins.cc

Issue 971001: Use FixedArray::kMaxLength instead of incorrect FixedArray::kMaxSize. (Closed)
Patch Set: Created 10 years, 9 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 return CallJsBuiltin("ArrayConcat", args); 745 return CallJsBuiltin("ArrayConcat", args);
746 } 746 }
747 747
748 JSArray* receiver_array = JSArray::cast(receiver_obj); 748 JSArray* receiver_array = JSArray::cast(receiver_obj);
749 ASSERT(receiver_array->HasFastElements()); 749 ASSERT(receiver_array->HasFastElements());
750 JSArray* arg_array = JSArray::cast(arg_obj); 750 JSArray* arg_array = JSArray::cast(arg_obj);
751 ASSERT(arg_array->HasFastElements()); 751 ASSERT(arg_array->HasFastElements());
752 752
753 int receiver_len = Smi::cast(receiver_array->length())->value(); 753 int receiver_len = Smi::cast(receiver_array->length())->value();
754 int arg_len = Smi::cast(arg_array->length())->value(); 754 int arg_len = Smi::cast(arg_array->length())->value();
755 // FixedArrays lengths are limited by FixedArray::kMaxLength thus
756 // we should fit into a smi.
755 ASSERT(receiver_len <= (Smi::kMaxValue - arg_len)); 757 ASSERT(receiver_len <= (Smi::kMaxValue - arg_len));
756 758
757 int result_len = receiver_len + arg_len; 759 int result_len = receiver_len + arg_len;
758 if (result_len > FixedArray::kMaxSize) { 760 if (result_len > FixedArray::kMaxLength) {
759 return CallJsBuiltin("ArrayConcat", args); 761 return CallJsBuiltin("ArrayConcat", args);
760 } 762 }
761 if (result_len == 0) { 763 if (result_len == 0) {
762 return AllocateEmptyJSArray(); 764 return AllocateEmptyJSArray();
763 } 765 }
764 766
765 // Allocate result. 767 // Allocate result.
766 Object* result = AllocateJSArray(); 768 Object* result = AllocateJSArray();
767 if (result->IsFailure()) return result; 769 if (result->IsFailure()) return result;
768 JSArray* result_array = JSArray::cast(result); 770 JSArray* result_array = JSArray::cast(result);
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 if (entry->contains(pc)) { 1429 if (entry->contains(pc)) {
1428 return names_[i]; 1430 return names_[i];
1429 } 1431 }
1430 } 1432 }
1431 } 1433 }
1432 return NULL; 1434 return NULL;
1433 } 1435 }
1434 1436
1435 1437
1436 } } // namespace v8::internal 1438 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698