Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(145)

Unified Diff: src/code-stubs.cc

Issue 2407813002: [stubs] Port StringAddStub to TF (Closed)
Patch Set: Make ASSERT cheaper Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index 98ed78c0af252f6df73549157e1eda10f00ed144..0cf44d1f96f2a45478e99c8917d47de6c21fd649 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -345,6 +345,38 @@ 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);
+ // TODO(danno): The ToString and JSReceiverToPrimitive below could be
+ // combined to avoid duplicate smi and instance type checks.
+ left = assembler->ToString(context,
+ assembler->JSReceiverToPrimitive(context, left));
+ }
+ if ((flags() & STRING_ADD_CHECK_RIGHT) != 0) {
+ DCHECK((flags() & STRING_ADD_CONVERT) != 0);
+ // TODO(danno): The ToString and JSReceiverToPrimitive below could be
+ // combined to avoid duplicate smi and instance type checks.
+ 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 {
+ Callable callable = CodeFactory::StringAdd(isolate(), STRING_ADD_CHECK_NONE,
+ pretenure_flag());
+ assembler->TailCallStub(callable, context, left, right);
+ }
+}
InlineCacheState CompareICStub::GetICState() const {
CompareICState::State state = Max(left(), right());
@@ -2167,13 +2199,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;
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698