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 8481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8492 DCHECK_EQ(argc_mode_, mode); | 8492 DCHECK_EQ(argc_mode_, mode); |
8493 CSA_ASSERT(assembler_, | 8493 CSA_ASSERT(assembler_, |
8494 assembler_->UintPtrOrSmiLessThan(index, GetLength(), mode)); | 8494 assembler_->UintPtrOrSmiLessThan(index, GetLength(), mode)); |
8495 return assembler_->Load(MachineType::AnyTagged(), AtIndexPtr(index, mode)); | 8495 return assembler_->Load(MachineType::AnyTagged(), AtIndexPtr(index, mode)); |
8496 } | 8496 } |
8497 | 8497 |
8498 Node* CodeStubArguments::AtIndex(int index) const { | 8498 Node* CodeStubArguments::AtIndex(int index) const { |
8499 return AtIndex(assembler_->IntPtrConstant(index)); | 8499 return AtIndex(assembler_->IntPtrConstant(index)); |
8500 } | 8500 } |
8501 | 8501 |
8502 Node* CodeStubArguments::GetOptionalArgumentValue(int index, | |
8503 Node* default_value) { | |
8504 typedef CodeStubAssembler::Variable Variable; | |
8505 Variable result(assembler_, MachineRepresentation::kTagged); | |
8506 CodeStubAssembler::Label argument_missing(assembler_), | |
8507 argument_done(assembler_, &result); | |
8508 | |
8509 assembler_->GotoIf(assembler_->IntPtrOrSmiGreaterThanOrEqual( | |
Igor Sheludko
2017/04/27 10:38:05
s/IntPtr/UintPtr/ to be in sync with AtIndex.
danno
2017/04/28 06:58:10
Done.
| |
8510 assembler_->IntPtrOrSmiConstant(index, argc_mode_), | |
8511 argc_, argc_mode_), | |
8512 &argument_missing); | |
8513 result.Bind(AtIndex(index)); | |
8514 assembler_->Goto(&argument_done); | |
8515 | |
8516 assembler_->BIND(&argument_missing); | |
8517 result.Bind(default_value); | |
8518 assembler_->Goto(&argument_done); | |
8519 | |
8520 assembler_->BIND(&argument_done); | |
8521 return result.value(); | |
8522 } | |
8523 | |
8502 void CodeStubArguments::ForEach( | 8524 void CodeStubArguments::ForEach( |
8503 const CodeStubAssembler::VariableList& vars, | 8525 const CodeStubAssembler::VariableList& vars, |
8504 const CodeStubArguments::ForEachBodyFunction& body, Node* first, Node* last, | 8526 const CodeStubArguments::ForEachBodyFunction& body, Node* first, Node* last, |
8505 CodeStubAssembler::ParameterMode mode) { | 8527 CodeStubAssembler::ParameterMode mode) { |
8506 assembler_->Comment("CodeStubArguments::ForEach"); | 8528 assembler_->Comment("CodeStubArguments::ForEach"); |
8507 if (first == nullptr) { | 8529 if (first == nullptr) { |
8508 first = assembler_->IntPtrOrSmiConstant(0, mode); | 8530 first = assembler_->IntPtrOrSmiConstant(0, mode); |
8509 } | 8531 } |
8510 if (last == nullptr) { | 8532 if (last == nullptr) { |
8511 DCHECK_EQ(mode, argc_mode_); | 8533 DCHECK_EQ(mode, argc_mode_); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
8652 formatted.c_str(), TENURED); | 8674 formatted.c_str(), TENURED); |
8653 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), | 8675 CallRuntime(Runtime::kGlobalPrint, NoContextConstant(), |
8654 HeapConstant(string)); | 8676 HeapConstant(string)); |
8655 } | 8677 } |
8656 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); | 8678 CallRuntime(Runtime::kDebugPrint, NoContextConstant(), tagged_value); |
8657 #endif | 8679 #endif |
8658 } | 8680 } |
8659 | 8681 |
8660 } // namespace internal | 8682 } // namespace internal |
8661 } // namespace v8 | 8683 } // namespace v8 |
OLD | NEW |