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.h" | 5 #include "src/builtins/builtins.h" |
6 #include "src/builtins/builtins-utils.h" | 6 #include "src/builtins/builtins-utils.h" |
7 #include "src/interface-descriptors.h" | 7 #include "src/interface-descriptors.h" |
8 #include "src/macro-assembler.h" | 8 #include "src/macro-assembler.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 CodeStubAssembler* assembler) { | 57 CodeStubAssembler* assembler) { |
58 typedef CodeStubAssembler::Label Label; | 58 typedef CodeStubAssembler::Label Label; |
59 typedef compiler::Node Node; | 59 typedef compiler::Node Node; |
60 typedef CopyFastSmiOrObjectElementsDescriptor Descriptor; | 60 typedef CopyFastSmiOrObjectElementsDescriptor Descriptor; |
61 | 61 |
62 Node* object = assembler->Parameter(Descriptor::kObject); | 62 Node* object = assembler->Parameter(Descriptor::kObject); |
63 | 63 |
64 // Load the {object}s elements. | 64 // Load the {object}s elements. |
65 Node* source = assembler->LoadObjectField(object, JSObject::kElementsOffset); | 65 Node* source = assembler->LoadObjectField(object, JSObject::kElementsOffset); |
66 | 66 |
67 CodeStubAssembler::ParameterMode mode = | 67 CodeStubAssembler::ParameterMode mode = assembler->OptimalParameterMode(); |
68 assembler->Is64() ? CodeStubAssembler::INTEGER_PARAMETERS | 68 Node* length = assembler->UntagParameter( |
69 : CodeStubAssembler::SMI_PARAMETERS; | 69 assembler->LoadFixedArrayBaseLength(source), mode); |
70 Node* length = (mode == CodeStubAssembler::INTEGER_PARAMETERS) | |
71 ? assembler->LoadAndUntagFixedArrayBaseLength(source) | |
72 : assembler->LoadFixedArrayBaseLength(source); | |
73 | 70 |
74 // Check if we can allocate in new space. | 71 // Check if we can allocate in new space. |
75 ElementsKind kind = FAST_ELEMENTS; | 72 ElementsKind kind = FAST_ELEMENTS; |
76 int max_elements = FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind); | 73 int max_elements = FixedArrayBase::GetMaxLengthForNewSpaceAllocation(kind); |
77 Label if_newspace(assembler), if_oldspace(assembler); | 74 Label if_newspace(assembler), if_oldspace(assembler); |
78 assembler->Branch( | 75 assembler->Branch( |
79 assembler->UintPtrLessThan( | 76 assembler->UintPtrLessThan( |
80 length, assembler->IntPtrOrSmiConstant(max_elements, mode)), | 77 length, assembler->IntPtrOrSmiConstant(max_elements, mode)), |
81 &if_newspace, &if_oldspace); | 78 &if_newspace, &if_oldspace); |
82 | 79 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 context, elements, FAST_ELEMENTS, key, &runtime); | 133 context, elements, FAST_ELEMENTS, key, &runtime); |
137 assembler->StoreObjectField(object, JSObject::kElementsOffset, elements); | 134 assembler->StoreObjectField(object, JSObject::kElementsOffset, elements); |
138 assembler->Return(elements); | 135 assembler->Return(elements); |
139 | 136 |
140 assembler->Bind(&runtime); | 137 assembler->Bind(&runtime); |
141 assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key); | 138 assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key); |
142 } | 139 } |
143 | 140 |
144 } // namespace internal | 141 } // namespace internal |
145 } // namespace v8 | 142 } // namespace v8 |
OLD | NEW |