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

Side by Side Diff: src/builtins.cc

Issue 6062006: Add more bailouts for Array.slice over arguments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 11 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 | test/mjsunit/array-slice.js » ('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 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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 Top::context()->global_context()->arguments_boilerplate()->map(); 629 Top::context()->global_context()->arguments_boilerplate()->map();
630 630
631 bool is_arguments_object_with_fast_elements = 631 bool is_arguments_object_with_fast_elements =
632 receiver->IsJSObject() 632 receiver->IsJSObject()
633 && JSObject::cast(receiver)->map() == arguments_map 633 && JSObject::cast(receiver)->map() == arguments_map
634 && JSObject::cast(receiver)->HasFastElements(); 634 && JSObject::cast(receiver)->HasFastElements();
635 if (!is_arguments_object_with_fast_elements) { 635 if (!is_arguments_object_with_fast_elements) {
636 return CallJsBuiltin("ArraySlice", args); 636 return CallJsBuiltin("ArraySlice", args);
637 } 637 }
638 elms = FixedArray::cast(JSObject::cast(receiver)->elements()); 638 elms = FixedArray::cast(JSObject::cast(receiver)->elements());
639 len = elms->length(); 639 Object* len_obj = JSObject::cast(receiver)
640 #ifdef DEBUG 640 ->InObjectPropertyAt(Heap::arguments_length_index);
641 // Arguments object by construction should have no holes, check it. 641 if (!len_obj->IsSmi()) {
642 if (FLAG_enable_slow_asserts) { 642 return CallJsBuiltin("ArraySlice", args);
643 for (int i = 0; i < len; i++) { 643 }
644 ASSERT(elms->get(i) != Heap::the_hole_value()); 644 len = Smi::cast(len_obj)->value();
645 if (len > elms->length()) {
646 return CallJsBuiltin("ArraySlice", args);
647 }
648 for (int i = 0; i < len; i++) {
649 if (elms->get(i) == Heap::the_hole_value()) {
650 return CallJsBuiltin("ArraySlice", args);
645 } 651 }
646 } 652 }
647 #endif
648 } 653 }
649 ASSERT(len >= 0); 654 ASSERT(len >= 0);
650 int n_arguments = args.length() - 1; 655 int n_arguments = args.length() - 1;
651 656
652 // Note carefully choosen defaults---if argument is missing, 657 // Note carefully choosen defaults---if argument is missing,
653 // it's undefined which gets converted to 0 for relative_start 658 // it's undefined which gets converted to 0 for relative_start
654 // and to len for relative_end. 659 // and to len for relative_end.
655 int relative_start = 0; 660 int relative_start = 0;
656 int relative_end = len; 661 int relative_end = len;
657 if (n_arguments > 0) { 662 if (n_arguments > 0) {
(...skipping 939 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 if (entry->contains(pc)) { 1602 if (entry->contains(pc)) {
1598 return names_[i]; 1603 return names_[i];
1599 } 1604 }
1600 } 1605 }
1601 } 1606 }
1602 return NULL; 1607 return NULL;
1603 } 1608 }
1604 1609
1605 1610
1606 } } // namespace v8::internal 1611 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/array-slice.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698