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 #include "src/code-stub-assembler.h" | 4 #include "src/code-stub-assembler.h" |
5 #include "src/code-factory.h" | 5 #include "src/code-factory.h" |
6 #include "src/frames-inl.h" | 6 #include "src/frames-inl.h" |
7 #include "src/frames.h" | 7 #include "src/frames.h" |
8 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1484 var_elements.Bind(LoadElements(array)); | 1484 var_elements.Bind(LoadElements(array)); |
1485 Node* capacity = | 1485 Node* capacity = |
1486 TaggedToParameter(LoadFixedArrayBaseLength(var_elements.value()), mode); | 1486 TaggedToParameter(LoadFixedArrayBaseLength(var_elements.value()), mode); |
1487 | 1487 |
1488 // Resize the capacity of the fixed array if it doesn't fit. | 1488 // Resize the capacity of the fixed array if it doesn't fit. |
1489 Label fits(this, &var_elements); | 1489 Label fits(this, &var_elements); |
1490 Node* first = arg_index.value(); | 1490 Node* first = arg_index.value(); |
1491 Node* growth = IntPtrSub(args.GetLength(), first); | 1491 Node* growth = IntPtrSub(args.GetLength(), first); |
1492 Node* new_length = | 1492 Node* new_length = |
1493 IntPtrOrSmiAdd(WordToParameter(growth, mode), var_length.value(), mode); | 1493 IntPtrOrSmiAdd(WordToParameter(growth, mode), var_length.value(), mode); |
1494 GotoUnless(IntPtrOrSmiGreaterThanOrEqual(new_length, capacity, mode), &fits); | 1494 GotoUnless(IntPtrOrSmiGreaterThan(new_length, capacity, mode), &fits); |
1495 Node* new_capacity = CalculateNewElementsCapacity( | 1495 Node* new_capacity = CalculateNewElementsCapacity( |
1496 IntPtrOrSmiAdd(new_length, IntPtrOrSmiConstant(1, mode), mode), mode); | 1496 IntPtrOrSmiAdd(new_length, IntPtrOrSmiConstant(1, mode), mode), mode); |
1497 var_elements.Bind(GrowElementsCapacity(array, var_elements.value(), kind, | 1497 var_elements.Bind(GrowElementsCapacity(array, var_elements.value(), kind, |
1498 kind, capacity, new_capacity, mode, | 1498 kind, capacity, new_capacity, mode, |
1499 &pre_bailout)); | 1499 &pre_bailout)); |
1500 Goto(&fits); | 1500 Goto(&fits); |
1501 Bind(&fits); | 1501 Bind(&fits); |
1502 Node* elements = var_elements.value(); | 1502 Node* elements = var_elements.value(); |
1503 | 1503 |
1504 // Push each argument onto the end of the array now that there is enough | 1504 // Push each argument onto the end of the array now that there is enough |
(...skipping 6699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8204 } | 8204 } |
8205 | 8205 |
8206 Node* CodeStubArguments::GetReceiver() const { | 8206 Node* CodeStubArguments::GetReceiver() const { |
8207 return assembler_->Load(MachineType::AnyTagged(), arguments_, | 8207 return assembler_->Load(MachineType::AnyTagged(), arguments_, |
8208 assembler_->IntPtrConstant(kPointerSize)); | 8208 assembler_->IntPtrConstant(kPointerSize)); |
8209 } | 8209 } |
8210 | 8210 |
8211 Node* CodeStubArguments::AtIndex(Node* index, | 8211 Node* CodeStubArguments::AtIndex(Node* index, |
8212 CodeStubAssembler::ParameterMode mode) const { | 8212 CodeStubAssembler::ParameterMode mode) const { |
8213 typedef compiler::Node Node; | 8213 typedef compiler::Node Node; |
| 8214 CSA_ASSERT(assembler_, assembler_->UintPtrLessThan( |
| 8215 mode == CodeStubAssembler::INTPTR_PARAMETERS |
| 8216 ? index |
| 8217 : assembler_->SmiUntag(index), |
| 8218 GetLength())); |
8214 Node* negated_index = | 8219 Node* negated_index = |
8215 assembler_->IntPtrSub(assembler_->IntPtrOrSmiConstant(0, mode), index); | 8220 assembler_->IntPtrSub(assembler_->IntPtrOrSmiConstant(0, mode), index); |
8216 Node* offset = | 8221 Node* offset = |
8217 assembler_->ElementOffsetFromIndex(negated_index, FAST_ELEMENTS, mode, 0); | 8222 assembler_->ElementOffsetFromIndex(negated_index, FAST_ELEMENTS, mode, 0); |
8218 return assembler_->Load(MachineType::AnyTagged(), arguments_, offset); | 8223 return assembler_->Load(MachineType::AnyTagged(), arguments_, offset); |
8219 } | 8224 } |
8220 | 8225 |
8221 Node* CodeStubArguments::AtIndex(int index) const { | 8226 Node* CodeStubArguments::AtIndex(int index) const { |
8222 return AtIndex(assembler_->IntPtrConstant(index)); | 8227 return AtIndex(assembler_->IntPtrConstant(index)); |
8223 } | 8228 } |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8362 Heap::kUndefinedValueRootIndex); | 8367 Heap::kUndefinedValueRootIndex); |
8363 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset, | 8368 StoreObjectFieldRoot(result, PromiseReactionJobInfo::kDebugNameOffset, |
8364 Heap::kUndefinedValueRootIndex); | 8369 Heap::kUndefinedValueRootIndex); |
8365 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, | 8370 StoreObjectFieldNoWriteBarrier(result, PromiseReactionJobInfo::kContextOffset, |
8366 context); | 8371 context); |
8367 return result; | 8372 return result; |
8368 } | 8373 } |
8369 | 8374 |
8370 } // namespace internal | 8375 } // namespace internal |
8371 } // namespace v8 | 8376 } // namespace v8 |
OLD | NEW |