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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 typedef CodeStubAssembler::Label Label; | 101 typedef CodeStubAssembler::Label Label; |
102 typedef compiler::Node Node; | 102 typedef compiler::Node Node; |
103 typedef GrowArrayElementsDescriptor Descriptor; | 103 typedef GrowArrayElementsDescriptor Descriptor; |
104 | 104 |
105 Node* object = assembler->Parameter(Descriptor::kObject); | 105 Node* object = assembler->Parameter(Descriptor::kObject); |
106 Node* key = assembler->Parameter(Descriptor::kKey); | 106 Node* key = assembler->Parameter(Descriptor::kKey); |
107 Node* context = assembler->Parameter(Descriptor::kContext); | 107 Node* context = assembler->Parameter(Descriptor::kContext); |
108 | 108 |
109 Label runtime(assembler, CodeStubAssembler::Label::kDeferred); | 109 Label runtime(assembler, CodeStubAssembler::Label::kDeferred); |
110 Node* elements = assembler->LoadElements(object); | 110 Node* elements = assembler->LoadElements(object); |
111 elements = assembler->CheckAndGrowElementsCapacity( | 111 elements = assembler->TryGrowElementsCapacity( |
112 context, elements, FAST_DOUBLE_ELEMENTS, key, &runtime); | 112 object, elements, FAST_DOUBLE_ELEMENTS, key, &runtime); |
113 assembler->StoreObjectField(object, JSObject::kElementsOffset, elements); | |
114 assembler->Return(elements); | 113 assembler->Return(elements); |
115 | 114 |
116 assembler->Bind(&runtime); | 115 assembler->Bind(&runtime); |
117 assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key); | 116 assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key); |
118 } | 117 } |
119 | 118 |
120 void Builtins::Generate_GrowFastSmiOrObjectElements( | 119 void Builtins::Generate_GrowFastSmiOrObjectElements( |
121 CodeStubAssembler* assembler) { | 120 CodeStubAssembler* assembler) { |
122 typedef CodeStubAssembler::Label Label; | 121 typedef CodeStubAssembler::Label Label; |
123 typedef compiler::Node Node; | 122 typedef compiler::Node Node; |
124 typedef GrowArrayElementsDescriptor Descriptor; | 123 typedef GrowArrayElementsDescriptor Descriptor; |
125 | 124 |
126 Node* object = assembler->Parameter(Descriptor::kObject); | 125 Node* object = assembler->Parameter(Descriptor::kObject); |
127 Node* key = assembler->Parameter(Descriptor::kKey); | 126 Node* key = assembler->Parameter(Descriptor::kKey); |
128 Node* context = assembler->Parameter(Descriptor::kContext); | 127 Node* context = assembler->Parameter(Descriptor::kContext); |
129 | 128 |
130 Label runtime(assembler, CodeStubAssembler::Label::kDeferred); | 129 Label runtime(assembler, CodeStubAssembler::Label::kDeferred); |
131 Node* elements = assembler->LoadElements(object); | 130 Node* elements = assembler->LoadElements(object); |
132 elements = assembler->CheckAndGrowElementsCapacity( | 131 elements = assembler->TryGrowElementsCapacity(object, elements, FAST_ELEMENTS, |
133 context, elements, FAST_ELEMENTS, key, &runtime); | 132 key, &runtime); |
134 assembler->StoreObjectField(object, JSObject::kElementsOffset, elements); | |
135 assembler->Return(elements); | 133 assembler->Return(elements); |
136 | 134 |
137 assembler->Bind(&runtime); | 135 assembler->Bind(&runtime); |
138 assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key); | 136 assembler->TailCallRuntime(Runtime::kGrowArrayElements, context, object, key); |
139 } | 137 } |
140 | 138 |
141 } // namespace internal | 139 } // namespace internal |
142 } // namespace v8 | 140 } // namespace v8 |
OLD | NEW |