Chromium Code Reviews| Index: src/code-stubs.cc |
| diff --git a/src/code-stubs.cc b/src/code-stubs.cc |
| index e262d1592aa1efc3bf3454c28a5b13029f64e8b1..52bd498a7bff4c60817e78123118be3ee34e7f50 100644 |
| --- a/src/code-stubs.cc |
| +++ b/src/code-stubs.cc |
| @@ -345,6 +345,35 @@ void StringAddStub::PrintBaseName(std::ostream& os) const { // NOLINT |
| os << "StringAddStub_" << flags() << "_" << pretenure_flag(); |
| } |
| +void StringAddStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
| + typedef compiler::Node Node; |
| + Node* left = assembler->Parameter(Descriptor::kLeft); |
| + Node* right = assembler->Parameter(Descriptor::kRight); |
| + Node* context = assembler->Parameter(Descriptor::kContext); |
| + |
| + if ((flags() & STRING_ADD_CHECK_LEFT) != 0) { |
| + DCHECK((flags() & STRING_ADD_CONVERT) != 0); |
| + left = assembler->ToString(context, |
| + assembler->JSReceiverToPrimitive(context, left)); |
|
Igor Sheludko
2016/10/13 15:41:33
Note: we could generate a better code here if we c
danno
2016/10/17 14:23:26
Yes, but it somewhat breaks the abstraction of hav
|
| + } |
| + if ((flags() & STRING_ADD_CHECK_RIGHT) != 0) { |
| + DCHECK((flags() & STRING_ADD_CONVERT) != 0); |
| + right = assembler->ToString( |
| + context, assembler->JSReceiverToPrimitive(context, right)); |
| + } |
| + |
| + if ((flags() & STRING_ADD_CHECK_BOTH) == 0) { |
| + CodeStubAssembler::AllocationFlag flags = |
| + (pretenure_flag() == TENURED) ? CodeStubAssembler::kPretenured |
| + : CodeStubAssembler::kNone; |
| + assembler->Return(assembler->StringAdd(context, left, right, flags)); |
| + } else { |
| + StringAddStub stub(isolate(), STRING_ADD_CHECK_NONE, pretenure_flag()); |
| + StringAddDescriptor descriptor(isolate()); |
| + assembler->TailCallStub(descriptor, assembler->HeapConstant(stub.GetCode()), |
|
Igor Sheludko
2016/10/13 15:41:33
I think
Callable callable = CodeFactory::StringA
danno
2016/10/17 14:23:26
Done.
|
| + context, left, right); |
| + } |
| +} |
| InlineCacheState CompareICStub::GetICState() const { |
| CompareICState::State state = Max(left(), right()); |
| @@ -2163,13 +2192,6 @@ void BinaryOpWithAllocationSiteStub::InitializeDescriptor( |
| FUNCTION_ADDR(Runtime_BinaryOpIC_MissWithAllocationSite)); |
| } |
| - |
| -void StringAddStub::InitializeDescriptor(CodeStubDescriptor* descriptor) { |
| - descriptor->Initialize(Runtime::FunctionForId(Runtime::kStringAdd)->entry); |
| - descriptor->SetMissHandler(Runtime::kStringAdd); |
| -} |
| - |
| - |
| void GetPropertyStub::GenerateAssembly(CodeStubAssembler* assembler) const { |
| typedef compiler::Node Node; |
| typedef CodeStubAssembler::Label Label; |