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 8688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8699 DCHECK_EQ(argc_mode_, mode); | 8699 DCHECK_EQ(argc_mode_, mode); |
8700 CSA_ASSERT(assembler_, | 8700 CSA_ASSERT(assembler_, |
8701 assembler_->UintPtrOrSmiLessThan(index, GetLength(), mode)); | 8701 assembler_->UintPtrOrSmiLessThan(index, GetLength(), mode)); |
8702 return assembler_->Load(MachineType::AnyTagged(), AtIndexPtr(index, mode)); | 8702 return assembler_->Load(MachineType::AnyTagged(), AtIndexPtr(index, mode)); |
8703 } | 8703 } |
8704 | 8704 |
8705 Node* CodeStubArguments::AtIndex(int index) const { | 8705 Node* CodeStubArguments::AtIndex(int index) const { |
8706 return AtIndex(assembler_->IntPtrConstant(index)); | 8706 return AtIndex(assembler_->IntPtrConstant(index)); |
8707 } | 8707 } |
8708 | 8708 |
| 8709 Node* CodeStubArguments::GetOptionalArgumentValue(int index, |
| 8710 Node* default_value) { |
| 8711 typedef CodeStubAssembler::Variable Variable; |
| 8712 Variable result(assembler_, MachineRepresentation::kTagged); |
| 8713 CodeStubAssembler::Label argument_missing(assembler_), |
| 8714 argument_done(assembler_, &result); |
| 8715 |
| 8716 assembler_->GotoIf(assembler_->UintPtrOrSmiGreaterThanOrEqual( |
| 8717 assembler_->IntPtrOrSmiConstant(index, argc_mode_), |
| 8718 argc_, argc_mode_), |
| 8719 &argument_missing); |
| 8720 result.Bind(AtIndex(index)); |
| 8721 assembler_->Goto(&argument_done); |
| 8722 |
| 8723 assembler_->BIND(&argument_missing); |
| 8724 result.Bind(default_value); |
| 8725 assembler_->Goto(&argument_done); |
| 8726 |
| 8727 assembler_->BIND(&argument_done); |
| 8728 return result.value(); |
| 8729 } |
| 8730 |
8709 void CodeStubArguments::ForEach( | 8731 void CodeStubArguments::ForEach( |
8710 const CodeStubAssembler::VariableList& vars, | 8732 const CodeStubAssembler::VariableList& vars, |
8711 const CodeStubArguments::ForEachBodyFunction& body, Node* first, Node* last, | 8733 const CodeStubArguments::ForEachBodyFunction& body, Node* first, Node* last, |
8712 CodeStubAssembler::ParameterMode mode) { | 8734 CodeStubAssembler::ParameterMode mode) { |
8713 assembler_->Comment("CodeStubArguments::ForEach"); | 8735 assembler_->Comment("CodeStubArguments::ForEach"); |
8714 if (first == nullptr) { | 8736 if (first == nullptr) { |
8715 first = assembler_->IntPtrOrSmiConstant(0, mode); | 8737 first = assembler_->IntPtrOrSmiConstant(0, mode); |
8716 } | 8738 } |
8717 if (last == nullptr) { | 8739 if (last == nullptr) { |
8718 DCHECK_EQ(mode, argc_mode_); | 8740 DCHECK_EQ(mode, argc_mode_); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8859 formatted.c_str(), TENURED); | 8881 formatted.c_str(), TENURED); |
8860 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), | 8882 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), |
8861 HeapConstant(string)); | 8883 HeapConstant(string)); |
8862 } | 8884 } |
8863 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); | 8885 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); |
8864 #endif | 8886 #endif |
8865 } | 8887 } |
8866 | 8888 |
8867 } // namespace internal | 8889 } // namespace internal |
8868 } // namespace v8 | 8890 } // namespace v8 |
OLD | NEW |