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

Unified Diff: src/code-stubs.cc

Issue 1998593002: [Interpreter] Inline ToBooleanStub and do some cleanup on unary ops. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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/interpreter/interpreter.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 414af170a279c6d282353b3ef5182263c0da0df0..b313dabe37394e2ae2c995fff498cd3d3d4718fe 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -3638,13 +3638,17 @@ void ToLengthStub::GenerateAssembly(CodeStubAssembler* assembler) const {
}
}
-void ToBooleanStub::GenerateAssembly(CodeStubAssembler* assembler) const {
+// static
+compiler::Node* ToBooleanStub::Generate(CodeStubAssembler* assembler,
+ compiler::Node* value,
+ compiler::Node* context) {
typedef compiler::Node Node;
typedef CodeStubAssembler::Label Label;
+ typedef CodeStubAssembler::Variable Variable;
- Node* value = assembler->Parameter(0);
+ Variable result(assembler, MachineRepresentation::kTagged);
Label if_valueissmi(assembler), if_valueisnotsmi(assembler),
- return_true(assembler), return_false(assembler);
+ return_true(assembler), return_false(assembler), end(assembler);
// Check if {value} is a Smi or a HeapObject.
assembler->Branch(assembler->WordIsSmi(value), &if_valueissmi,
@@ -3722,7 +3726,8 @@ void ToBooleanStub::GenerateAssembly(CodeStubAssembler* assembler) const {
// The {value} is an Oddball, and every Oddball knows its boolean value.
Node* value_toboolean =
assembler->LoadObjectField(value, Oddball::kToBooleanOffset);
- assembler->Return(value_toboolean);
+ result.Bind(value_toboolean);
+ assembler->Goto(&end);
}
assembler->Bind(&if_valueisother);
@@ -3740,11 +3745,21 @@ void ToBooleanStub::GenerateAssembly(CodeStubAssembler* assembler) const {
&return_true, &return_false);
}
}
+
assembler->Bind(&return_false);
- assembler->Return(assembler->BooleanConstant(false));
+ {
+ result.Bind(assembler->BooleanConstant(false));
+ assembler->Goto(&end);
+ }
assembler->Bind(&return_true);
- assembler->Return(assembler->BooleanConstant(true));
+ {
+ result.Bind(assembler->BooleanConstant(true));
+ assembler->Goto(&end);
+ }
+
+ assembler->Bind(&end);
+ return result.value();
}
void ToIntegerStub::GenerateAssembly(CodeStubAssembler* assembler) const {
« no previous file with comments | « src/code-stubs.h ('k') | src/interpreter/interpreter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698