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

Side by Side Diff: src/builtins.cc

Issue 1151853003: [strong] create strong array literals Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix a test Created 5 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 | « src/arm64/full-codegen-arm64.cc ('k') | src/compiler/ast-graph-builder.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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/arguments.h" 9 #include "src/arguments.h"
10 #include "src/base/once.h" 10 #include "src/base/once.h"
(...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 if (is_holey) elements_kind = GetHoleyElementsKind(elements_kind); 986 if (is_holey) elements_kind = GetHoleyElementsKind(elements_kind);
987 } 987 }
988 988
989 // If a double array is concatted into a fast elements array, the fast 989 // If a double array is concatted into a fast elements array, the fast
990 // elements array needs to be initialized to contain proper holes, since 990 // elements array needs to be initialized to contain proper holes, since
991 // boxing doubles may cause incremental marking. 991 // boxing doubles may cause incremental marking.
992 ArrayStorageAllocationMode mode = 992 ArrayStorageAllocationMode mode =
993 has_double && IsFastObjectElementsKind(elements_kind) 993 has_double && IsFastObjectElementsKind(elements_kind)
994 ? INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE : DONT_INITIALIZE_ARRAY_ELEMENTS; 994 ? INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE : DONT_INITIALIZE_ARRAY_ELEMENTS;
995 Handle<JSArray> result_array = 995 Handle<JSArray> result_array =
996 isolate->factory()->NewJSArray(elements_kind, 996 isolate->factory()->NewJSArray(elements_kind, result_len, result_len,
997 result_len, 997 WEAK, mode);
998 result_len,
999 mode);
1000 if (result_len == 0) return *result_array; 998 if (result_len == 0) return *result_array;
1001 999
1002 int j = 0; 1000 int j = 0;
1003 Handle<FixedArrayBase> storage(result_array->elements(), isolate); 1001 Handle<FixedArrayBase> storage(result_array->elements(), isolate);
1004 ElementsAccessor* accessor = ElementsAccessor::ForKind(elements_kind); 1002 ElementsAccessor* accessor = ElementsAccessor::ForKind(elements_kind);
1005 for (int i = 0; i < n_arguments; i++) { 1003 for (int i = 0; i < n_arguments; i++) {
1006 // It is crucial to keep |array| in a raw pointer form to avoid performance 1004 // It is crucial to keep |array| in a raw pointer form to avoid performance
1007 // degradation. 1005 // degradation.
1008 JSArray* array = JSArray::cast(args[i]); 1006 JSArray* array = JSArray::cast(args[i]);
1009 int len = Smi::cast(array->length())->value(); 1007 int len = Smi::cast(array->length())->value();
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 } 1663 }
1666 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) 1664 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C)
1667 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) 1665 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A)
1668 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) 1666 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H)
1669 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) 1667 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A)
1670 #undef DEFINE_BUILTIN_ACCESSOR_C 1668 #undef DEFINE_BUILTIN_ACCESSOR_C
1671 #undef DEFINE_BUILTIN_ACCESSOR_A 1669 #undef DEFINE_BUILTIN_ACCESSOR_A
1672 1670
1673 1671
1674 } } // namespace v8::internal 1672 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm64/full-codegen-arm64.cc ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698