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

Side by Side Diff: src/builtins.cc

Issue 1979473003: Version 5.1.281.35 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.1
Patch Set: Created 4 years, 7 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 | « include/v8-version.h ('k') | src/isolate.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/builtins.h" 5 #include "src/builtins.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/api-arguments.h" 8 #include "src/api-arguments.h"
9 #include "src/api-natives.h" 9 #include "src/api-natives.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
655 int relative_start = 0; 655 int relative_start = 0;
656 int relative_end = 0; 656 int relative_end = 0;
657 657
658 if (receiver->IsJSArray()) { 658 if (receiver->IsJSArray()) {
659 DisallowHeapAllocation no_gc; 659 DisallowHeapAllocation no_gc;
660 JSArray* array = JSArray::cast(*receiver); 660 JSArray* array = JSArray::cast(*receiver);
661 if (!array->HasFastElements() || 661 if (!array->HasFastElements() ||
662 !IsJSArrayFastElementMovingAllowed(isolate, array) || 662 !IsJSArrayFastElementMovingAllowed(isolate, array) ||
663 !isolate->IsArraySpeciesLookupChainIntact() || 663 !isolate->IsArraySpeciesLookupChainIntact() ||
664 // If this is a subclass of Array, then call out to JS 664 // If this is a subclass of Array, then call out to JS
665 !array->map()->new_target_is_base()) { 665 !array->HasArrayPrototype(isolate)) {
666 AllowHeapAllocation allow_allocation; 666 AllowHeapAllocation allow_allocation;
667 return CallJsIntrinsic(isolate, isolate->array_slice(), args); 667 return CallJsIntrinsic(isolate, isolate->array_slice(), args);
668 } 668 }
669 len = Smi::cast(array->length())->value(); 669 len = Smi::cast(array->length())->value();
670 } else if (receiver->IsJSObject() && 670 } else if (receiver->IsJSObject() &&
671 GetSloppyArgumentsLength(isolate, Handle<JSObject>::cast(receiver), 671 GetSloppyArgumentsLength(isolate, Handle<JSObject>::cast(receiver),
672 &len)) { 672 &len)) {
673 DCHECK_EQ(FAST_ELEMENTS, JSObject::cast(*receiver)->GetElementsKind()); 673 DCHECK_EQ(FAST_ELEMENTS, JSObject::cast(*receiver)->GetElementsKind());
674 // Array.prototype.slice(arguments, ...) is quite a common idiom 674 // Array.prototype.slice(arguments, ...) is quite a common idiom
675 // (notably more than 50% of invocations in Web apps). 675 // (notably more than 50% of invocations in Web apps).
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
715 ElementsAccessor* accessor = object->GetElementsAccessor(); 715 ElementsAccessor* accessor = object->GetElementsAccessor();
716 return *accessor->Slice(object, actual_start, actual_end); 716 return *accessor->Slice(object, actual_start, actual_end);
717 } 717 }
718 718
719 719
720 BUILTIN(ArraySplice) { 720 BUILTIN(ArraySplice) {
721 HandleScope scope(isolate); 721 HandleScope scope(isolate);
722 Handle<Object> receiver = args.receiver(); 722 Handle<Object> receiver = args.receiver();
723 if (!EnsureJSArrayWithWritableFastElements(isolate, receiver, &args, 3) || 723 if (!EnsureJSArrayWithWritableFastElements(isolate, receiver, &args, 3) ||
724 // If this is a subclass of Array, then call out to JS. 724 // If this is a subclass of Array, then call out to JS.
725 !JSArray::cast(*receiver)->map()->new_target_is_base() || 725 !Handle<JSArray>::cast(receiver)->HasArrayPrototype(isolate) ||
726 // If anything with @@species has been messed with, call out to JS. 726 // If anything with @@species has been messed with, call out to JS.
727 !isolate->IsArraySpeciesLookupChainIntact()) { 727 !isolate->IsArraySpeciesLookupChainIntact()) {
728 return CallJsIntrinsic(isolate, isolate->array_splice(), args); 728 return CallJsIntrinsic(isolate, isolate->array_splice(), args);
729 } 729 }
730 Handle<JSArray> array = Handle<JSArray>::cast(receiver); 730 Handle<JSArray> array = Handle<JSArray>::cast(receiver);
731 DCHECK(!array->map()->is_observed()); 731 DCHECK(!array->map()->is_observed());
732 732
733 int argument_count = args.length() - 1; 733 int argument_count = args.length() - 1;
734 int relative_start = 0; 734 int relative_start = 0;
735 if (argument_count > 0) { 735 if (argument_count > 0) {
(...skipping 4122 matching lines...) Expand 10 before | Expand all | Expand 10 after
4858 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T) 4858 BUILTIN_LIST_T(DEFINE_BUILTIN_ACCESSOR_T)
4859 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 4859 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
4860 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 4860 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
4861 #undef DEFINE_BUILTIN_ACCESSOR_C 4861 #undef DEFINE_BUILTIN_ACCESSOR_C
4862 #undef DEFINE_BUILTIN_ACCESSOR_A 4862 #undef DEFINE_BUILTIN_ACCESSOR_A
4863 #undef DEFINE_BUILTIN_ACCESSOR_T 4863 #undef DEFINE_BUILTIN_ACCESSOR_T
4864 #undef DEFINE_BUILTIN_ACCESSOR_H 4864 #undef DEFINE_BUILTIN_ACCESSOR_H
4865 4865
4866 } // namespace internal 4866 } // namespace internal
4867 } // namespace v8 4867 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8-version.h ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698