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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 typedef compiler::Node Node; | 60 typedef compiler::Node Node; |
61 typedef CopyFastSmiOrObjectElementsDescriptor Descriptor; | 61 typedef CopyFastSmiOrObjectElementsDescriptor Descriptor; |
62 CodeStubAssembler assembler(state); | 62 CodeStubAssembler assembler(state); |
63 | 63 |
64 Node* object = assembler.Parameter(Descriptor::kObject); | 64 Node* object = assembler.Parameter(Descriptor::kObject); |
65 | 65 |
66 // Load the {object}s elements. | 66 // Load the {object}s elements. |
67 Node* source = assembler.LoadObjectField(object, JSObject::kElementsOffset); | 67 Node* source = assembler.LoadObjectField(object, JSObject::kElementsOffset); |
68 | 68 |
69 CodeStubAssembler::ParameterMode mode = assembler.OptimalParameterMode(); | 69 CodeStubAssembler::ParameterMode mode = assembler.OptimalParameterMode(); |
70 Node* length = assembler.UntagParameter( | 70 Node* length = assembler.TaggedToParameter( |
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.UintPtrOrSmiLessThan( | 78 assembler.UintPtrOrSmiLessThan( |
79 length, assembler.IntPtrOrSmiConstant(max_elements, mode), mode), | 79 length, assembler.IntPtrOrSmiConstant(max_elements, mode), mode), |
80 &if_newspace, &if_oldspace); | 80 &if_newspace, &if_oldspace); |
(...skipping 225 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 |