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

Side by Side Diff: src/builtins.cc

Issue 280243002: Avoid name clashes of builtins and runtime functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/bootstrapper.cc ('k') | src/collection.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 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 "v8.h" 5 #include "v8.h"
6 6
7 #include "api.h" 7 #include "api.h"
8 #include "arguments.h" 8 #include "arguments.h"
9 #include "bootstrapper.h" 9 #include "bootstrapper.h"
10 #include "builtins.h" 10 #include "builtins.h"
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 ElementsKind elements_kind = GetInitialFastElementsKind(); 988 ElementsKind elements_kind = GetInitialFastElementsKind();
989 bool has_double = false; 989 bool has_double = false;
990 { 990 {
991 DisallowHeapAllocation no_gc; 991 DisallowHeapAllocation no_gc;
992 Heap* heap = isolate->heap(); 992 Heap* heap = isolate->heap();
993 Context* native_context = isolate->context()->native_context(); 993 Context* native_context = isolate->context()->native_context();
994 JSObject* array_proto = 994 JSObject* array_proto =
995 JSObject::cast(native_context->array_function()->prototype()); 995 JSObject::cast(native_context->array_function()->prototype());
996 if (!ArrayPrototypeHasNoElements(heap, native_context, array_proto)) { 996 if (!ArrayPrototypeHasNoElements(heap, native_context, array_proto)) {
997 AllowHeapAllocation allow_allocation; 997 AllowHeapAllocation allow_allocation;
998 return CallJsBuiltin(isolate, "ArrayConcat", args); 998 return CallJsBuiltin(isolate, "ArrayConcatJS", args);
999 } 999 }
1000 1000
1001 // Iterate through all the arguments performing checks 1001 // Iterate through all the arguments performing checks
1002 // and calculating total length. 1002 // and calculating total length.
1003 bool is_holey = false; 1003 bool is_holey = false;
1004 for (int i = 0; i < n_arguments; i++) { 1004 for (int i = 0; i < n_arguments; i++) {
1005 Object* arg = args[i]; 1005 Object* arg = args[i];
1006 if (!arg->IsJSArray() || 1006 if (!arg->IsJSArray() ||
1007 !JSArray::cast(arg)->HasFastElements() || 1007 !JSArray::cast(arg)->HasFastElements() ||
1008 JSArray::cast(arg)->GetPrototype() != array_proto) { 1008 JSArray::cast(arg)->GetPrototype() != array_proto) {
1009 AllowHeapAllocation allow_allocation; 1009 AllowHeapAllocation allow_allocation;
1010 return CallJsBuiltin(isolate, "ArrayConcat", args); 1010 return CallJsBuiltin(isolate, "ArrayConcatJS", args);
1011 } 1011 }
1012 int len = Smi::cast(JSArray::cast(arg)->length())->value(); 1012 int len = Smi::cast(JSArray::cast(arg)->length())->value();
1013 1013
1014 // We shouldn't overflow when adding another len. 1014 // We shouldn't overflow when adding another len.
1015 const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2); 1015 const int kHalfOfMaxInt = 1 << (kBitsPerInt - 2);
1016 STATIC_ASSERT(FixedArray::kMaxLength < kHalfOfMaxInt); 1016 STATIC_ASSERT(FixedArray::kMaxLength < kHalfOfMaxInt);
1017 USE(kHalfOfMaxInt); 1017 USE(kHalfOfMaxInt);
1018 result_len += len; 1018 result_len += len;
1019 ASSERT(result_len >= 0); 1019 ASSERT(result_len >= 0);
1020 1020
1021 if (result_len > FixedDoubleArray::kMaxLength) { 1021 if (result_len > FixedDoubleArray::kMaxLength) {
1022 AllowHeapAllocation allow_allocation; 1022 AllowHeapAllocation allow_allocation;
1023 return CallJsBuiltin(isolate, "ArrayConcat", args); 1023 return CallJsBuiltin(isolate, "ArrayConcatJS", args);
1024 } 1024 }
1025 1025
1026 ElementsKind arg_kind = JSArray::cast(arg)->map()->elements_kind(); 1026 ElementsKind arg_kind = JSArray::cast(arg)->map()->elements_kind();
1027 has_double = has_double || IsFastDoubleElementsKind(arg_kind); 1027 has_double = has_double || IsFastDoubleElementsKind(arg_kind);
1028 is_holey = is_holey || IsFastHoleyElementsKind(arg_kind); 1028 is_holey = is_holey || IsFastHoleyElementsKind(arg_kind);
1029 if (IsMoreGeneralElementsKindTransition(elements_kind, arg_kind)) { 1029 if (IsMoreGeneralElementsKindTransition(elements_kind, arg_kind)) {
1030 elements_kind = arg_kind; 1030 elements_kind = arg_kind;
1031 } 1031 }
1032 } 1032 }
1033 if (is_holey) elements_kind = GetHoleyElementsKind(elements_kind); 1033 if (is_holey) elements_kind = GetHoleyElementsKind(elements_kind);
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 } 1710 }
1711 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1711 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1712 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1712 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1713 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 1713 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
1714 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1714 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1715 #undef DEFINE_BUILTIN_ACCESSOR_C 1715 #undef DEFINE_BUILTIN_ACCESSOR_C
1716 #undef DEFINE_BUILTIN_ACCESSOR_A 1716 #undef DEFINE_BUILTIN_ACCESSOR_A
1717 1717
1718 1718
1719 } } // namespace v8::internal 1719 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/collection.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698