OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/builtins-utils.h" | 5 #include "src/builtins/builtins-utils.h" |
6 #include "src/builtins/builtins.h" | 6 #include "src/builtins/builtins.h" |
7 #include "src/code-stub-assembler.h" | 7 #include "src/code-stub-assembler.h" |
8 #include "src/interface-descriptors.h" | 8 #include "src/interface-descriptors.h" |
9 #include "src/macro-assembler.h" | 9 #include "src/macro-assembler.h" |
10 | 10 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 | 68 |
69 CodeStubAssembler::ParameterMode mode = assembler.OptimalParameterMode(); | 69 CodeStubAssembler::ParameterMode mode = assembler.OptimalParameterMode(); |
70 Node* length = assembler.UntagParameter( | 70 Node* length = assembler.UntagParameter( |
71 assembler.LoadFixedArrayBaseLength(source), mode); | 71 assembler.LoadFixedArrayBaseLength(source), mode); |
72 | 72 |
73 // Check if we can allocate in new space. | 73 // Check if we can allocate in new space. |
74 ElementsKind kind = FAST_ELEMENTS; | 74 ElementsKind kind = FAST_ELEMENTS; |
75 int max_elements = FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind); | 75 int max_elements = FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind); |
76 Label if_newspace(&assembler), if_oldspace(&assembler); | 76 Label if_newspace(&assembler), if_oldspace(&assembler); |
77 assembler.Branch( | 77 assembler.Branch( |
78 assembler.UintPtrLessThan( | 78 assembler.UintPtrOrSmiLessThan( |
79 length, assembler.IntPtrOrSmiConstant(max_elements, mode)), | 79 length, assembler.IntPtrOrSmiConstant(max_elements, mode), mode), |
80 &if_newspace, &if_oldspace); | 80 &if_newspace, &if_oldspace); |
81 | 81 |
82 assembler.Bind(&if_newspace); | 82 assembler.Bind(&if_newspace); |
83 { | 83 { |
84 Node* target = assembler.AllocateFixedArray(kind, length, mode); | 84 Node* target = assembler.AllocateFixedArray(kind, length, mode); |
85 assembler.CopyFixedArrayElements(kind, source, target, length, | 85 assembler.CopyFixedArrayElements(kind, source, target, length, |
86 SKIP_WRITE_BARRIER, mode); | 86 SKIP_WRITE_BARRIER, mode); |
87 assembler.StoreObjectField(object, JSObject::kElementsOffset, target); | 87 assembler.StoreObjectField(object, JSObject::kElementsOffset, target); |
88 assembler.Return(target); | 88 assembler.Return(target); |
89 } | 89 } |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 // Allocate the actual FixedArray for the elements. | 306 // Allocate the actual FixedArray for the elements. |
307 Generate_NewArgumentsElements(&assembler, frame, length); | 307 Generate_NewArgumentsElements(&assembler, frame, length); |
308 | 308 |
309 // No rest parameters, return an empty FixedArray. | 309 // No rest parameters, return an empty FixedArray. |
310 assembler.Bind(&if_empty); | 310 assembler.Bind(&if_empty); |
311 assembler.Return(assembler.EmptyFixedArrayConstant()); | 311 assembler.Return(assembler.EmptyFixedArrayConstant()); |
312 } | 312 } |
313 | 313 |
314 } // namespace internal | 314 } // namespace internal |
315 } // namespace v8 | 315 } // namespace v8 |
OLD | NEW |