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

Unified Diff: src/code-stubs.cc

Issue 2152693002: [stubs] Introduce NonPrimitiveToPrimitive builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments. Created 4 years, 5 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-factory.cc ('k') | src/compiler/code-assembler.h » ('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 d41a4a7b7edf84d67e5ea9598d7c5a90bb73fd18..6ee52877ca35a3633073576f46ef47f1fcec06a0 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -619,9 +619,9 @@ compiler::Node* AddStub::Generate(CodeStubAssembler* assembler,
assembler->Bind(&if_rhsisreceiver);
{
// Convert {rhs} to a primitive first passing no hint.
- // TODO(bmeurer): Hook up ToPrimitiveStub here, once it's there.
- var_rhs.Bind(
- assembler->CallRuntime(Runtime::kToPrimitive, context, rhs));
+ Callable callable =
+ CodeFactory::NonPrimitiveToPrimitive(assembler->isolate());
+ var_rhs.Bind(assembler->CallStub(callable, context, rhs));
assembler->Goto(&loop);
}
@@ -697,9 +697,9 @@ compiler::Node* AddStub::Generate(CodeStubAssembler* assembler,
assembler->Bind(&if_lhsisreceiver);
{
// Convert {lhs} to a primitive first passing no hint.
- // TODO(bmeurer): Hook up ToPrimitiveStub here, once it's there.
- var_lhs.Bind(
- assembler->CallRuntime(Runtime::kToPrimitive, context, lhs));
+ Callable callable =
+ CodeFactory::NonPrimitiveToPrimitive(assembler->isolate());
+ var_lhs.Bind(assembler->CallStub(callable, context, lhs));
assembler->Goto(&loop);
}
@@ -774,9 +774,9 @@ compiler::Node* AddStub::Generate(CodeStubAssembler* assembler,
assembler->Bind(&if_rhsisreceiver);
{
// Convert {rhs} to a primitive first passing no hint.
- // TODO(bmeurer): Hook up ToPrimitiveStub here too.
- var_rhs.Bind(assembler->CallRuntime(Runtime::kToPrimitive,
- context, rhs));
+ Callable callable = CodeFactory::NonPrimitiveToPrimitive(
+ assembler->isolate());
+ var_rhs.Bind(assembler->CallStub(callable, context, rhs));
assembler->Goto(&loop);
}
@@ -805,9 +805,9 @@ compiler::Node* AddStub::Generate(CodeStubAssembler* assembler,
assembler->Bind(&if_lhsisreceiver);
{
// Convert {lhs} to a primitive first passing no hint.
- // TODO(bmeurer): Hook up ToPrimitiveStub here, once it's there.
- var_lhs.Bind(assembler->CallRuntime(Runtime::kToPrimitive,
- context, lhs));
+ Callable callable =
+ CodeFactory::NonPrimitiveToPrimitive(assembler->isolate());
+ var_lhs.Bind(assembler->CallStub(callable, context, lhs));
assembler->Goto(&loop);
}
@@ -825,9 +825,9 @@ compiler::Node* AddStub::Generate(CodeStubAssembler* assembler,
assembler->Bind(&if_rhsisreceiver);
{
// Convert {rhs} to a primitive first passing no hint.
- // TODO(bmeurer): Hook up ToPrimitiveStub here too.
- var_rhs.Bind(assembler->CallRuntime(Runtime::kToPrimitive,
- context, rhs));
+ Callable callable = CodeFactory::NonPrimitiveToPrimitive(
+ assembler->isolate());
+ var_rhs.Bind(assembler->CallStub(callable, context, rhs));
assembler->Goto(&loop);
}
@@ -2211,9 +2211,9 @@ compiler::Node* GenerateAbstractRelationalComparison(
assembler->Bind(&if_rhsisreceiver);
{
// Convert {rhs} to a primitive first passing Number hint.
- // TODO(bmeurer): Hook up ToPrimitiveStub here, once it's there.
- var_rhs.Bind(assembler->CallRuntime(
- Runtime::kToPrimitive_Number, context, rhs));
+ Callable callable = CodeFactory::NonPrimitiveToPrimitive(
+ assembler->isolate(), ToPrimitiveHint::kNumber);
+ var_rhs.Bind(assembler->CallStub(callable, context, rhs));
assembler->Goto(&loop);
}
@@ -2245,9 +2245,9 @@ compiler::Node* GenerateAbstractRelationalComparison(
assembler->Bind(&if_lhsisreceiver);
{
// Convert {lhs} to a primitive first passing Number hint.
- // TODO(bmeurer): Hook up ToPrimitiveStub here, once it's there.
- var_lhs.Bind(assembler->CallRuntime(Runtime::kToPrimitive_Number,
- context, lhs));
+ Callable callable = CodeFactory::NonPrimitiveToPrimitive(
+ assembler->isolate(), ToPrimitiveHint::kNumber);
+ var_lhs.Bind(assembler->CallStub(callable, context, lhs));
assembler->Goto(&loop);
}
@@ -2571,9 +2571,9 @@ compiler::Node* GenerateEqual(CodeStubAssembler* assembler, ResultMode mode,
assembler->Bind(&if_rhsisreceiver);
{
// Convert {rhs} to a primitive first (passing no hint).
- // TODO(bmeurer): Hook up ToPrimitiveStub here once it exists.
- var_rhs.Bind(assembler->CallRuntime(Runtime::kToPrimitive,
- context, rhs));
+ Callable callable = CodeFactory::NonPrimitiveToPrimitive(
+ assembler->isolate());
+ var_rhs.Bind(assembler->CallStub(callable, context, rhs));
assembler->Goto(&loop);
}
@@ -2929,9 +2929,9 @@ compiler::Node* GenerateEqual(CodeStubAssembler* assembler, ResultMode mode,
{
// The {rhs} is some Primitive different from Null and
// Undefined, need to convert {lhs} to Primitive first.
- // TODO(bmeurer): Hook up ToPrimitiveStub here once it exists.
- var_lhs.Bind(assembler->CallRuntime(Runtime::kToPrimitive,
- context, lhs));
+ Callable callable =
+ CodeFactory::NonPrimitiveToPrimitive(assembler->isolate());
+ var_lhs.Bind(assembler->CallStub(callable, context, lhs));
assembler->Goto(&loop);
}
}
« no previous file with comments | « src/code-factory.cc ('k') | src/compiler/code-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698