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

Side by Side Diff: src/builtins.cc

Issue 6347037: Follow up to r6540: remove early return from C++ builtin as well. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 10 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 | Annotate | Revision Log
« 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 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
727 return CallJsBuiltin("ArraySplice", args); 727 return CallJsBuiltin("ArraySplice", args);
728 } 728 }
729 FixedArray* elms = FixedArray::cast(elms_obj); 729 FixedArray* elms = FixedArray::cast(elms_obj);
730 JSArray* array = JSArray::cast(receiver); 730 JSArray* array = JSArray::cast(receiver);
731 ASSERT(array->HasFastElements()); 731 ASSERT(array->HasFastElements());
732 732
733 int len = Smi::cast(array->length())->value(); 733 int len = Smi::cast(array->length())->value();
734 734
735 int n_arguments = args.length() - 1; 735 int n_arguments = args.length() - 1;
736 736
737 // Return empty array when no arguments are supplied.
738 if (n_arguments == 0) {
739 return AllocateEmptyJSArray();
740 }
741
742 int relative_start = 0; 737 int relative_start = 0;
743 Object* arg1 = args[1]; 738 if (n_arguments > 0) {
744 if (arg1->IsSmi()) { 739 Object* arg1 = args[1];
745 relative_start = Smi::cast(arg1)->value(); 740 if (arg1->IsSmi()) {
746 } else if (!arg1->IsUndefined()) { 741 relative_start = Smi::cast(arg1)->value();
747 return CallJsBuiltin("ArraySplice", args); 742 } else if (!arg1->IsUndefined()) {
743 return CallJsBuiltin("ArraySplice", args);
744 }
748 } 745 }
749 int actual_start = (relative_start < 0) ? Max(len + relative_start, 0) 746 int actual_start = (relative_start < 0) ? Max(len + relative_start, 0)
750 : Min(relative_start, len); 747 : Min(relative_start, len);
751 748
752 // SpiderMonkey, TraceMonkey and JSC treat the case where no delete count is 749 // SpiderMonkey, TraceMonkey and JSC treat the case where no delete count is
753 // given as a request to delete all the elements from the start. 750 // given as a request to delete all the elements from the start.
754 // And it differs from the case of undefined delete count. 751 // And it differs from the case of undefined delete count.
755 // This does not follow ECMA-262, but we do the same for 752 // This does not follow ECMA-262, but we do the same for
756 // compatibility. 753 // compatibility.
757 int actual_delete_count; 754 int actual_delete_count;
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 if (entry->contains(pc)) { 1540 if (entry->contains(pc)) {
1544 return names_[i]; 1541 return names_[i];
1545 } 1542 }
1546 } 1543 }
1547 } 1544 }
1548 return NULL; 1545 return NULL;
1549 } 1546 }
1550 1547
1551 1548
1552 } } // namespace v8::internal 1549 } } // 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