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

Unified Diff: src/code-stubs.cc

Issue 2151773002: Avoid jumping to the runtime for ForInFilter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: remove double label 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-stubs.h ('k') | src/compiler/js-typed-lowering.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 2bc3de9e8c6a5876ddfed46002824b16091c2ca3..eca0b91ed4beea7a214ff07a9625e910095578be 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -4298,11 +4298,11 @@ void TypeofStub::GenerateAheadOfTime(Isolate* isolate) {
stub.GetCode();
}
-// static
-compiler::Node* HasPropertyStub::Generate(CodeStubAssembler* assembler,
- compiler::Node* key,
- compiler::Node* object,
- compiler::Node* context) {
+namespace {
+
+compiler::Node* GenerateHasProperty(
+ CodeStubAssembler* assembler, compiler::Node* object, compiler::Node* key,
+ compiler::Node* context, Runtime::FunctionId fallback_runtime_function_id) {
typedef compiler::Node Node;
typedef CodeStubAssembler::Label Label;
typedef CodeStubAssembler::Variable Variable;
@@ -4347,8 +4347,8 @@ compiler::Node* HasPropertyStub::Generate(CodeStubAssembler* assembler,
assembler->Bind(&call_runtime);
{
- result.Bind(
- assembler->CallRuntime(Runtime::kHasProperty, context, key, object));
+ result.Bind(assembler->CallRuntime(fallback_runtime_function_id, context,
+ object, key));
assembler->Goto(&end);
}
@@ -4356,6 +4356,56 @@ compiler::Node* HasPropertyStub::Generate(CodeStubAssembler* assembler,
return result.value();
}
+} // namespace
+
+// static
+compiler::Node* HasPropertyStub::Generate(CodeStubAssembler* assembler,
+ compiler::Node* key,
+ compiler::Node* object,
+ compiler::Node* context) {
+ return GenerateHasProperty(assembler, object, key, context,
+ Runtime::kHasProperty);
+}
+
+// static
+compiler::Node* ForInFilterStub::Generate(CodeStubAssembler* assembler,
+ compiler::Node* key,
+ compiler::Node* object,
+ compiler::Node* context) {
+ typedef compiler::Node Node;
+ typedef CodeStubAssembler::Label Label;
+ typedef CodeStubAssembler::Variable Variable;
+
+ Label return_undefined(assembler, Label::kDeferred),
+ return_to_name(assembler), end(assembler);
+
+ Variable var_result(assembler, MachineRepresentation::kTagged);
+
+ Node* has_property = GenerateHasProperty(assembler, object, key, context,
+ Runtime::kForInHasProperty);
+
+ assembler->Branch(
+ assembler->WordEqual(has_property, assembler->BooleanConstant(true)),
+ &return_to_name, &return_undefined);
+
+ assembler->Bind(&return_to_name);
+ {
+ // TODO(cbruni): inline ToName here.
+ Callable callable = CodeFactory::ToName(assembler->isolate());
+ var_result.Bind(assembler->CallStub(callable, context, key));
+ assembler->Goto(&end);
+ }
+
+ assembler->Bind(&return_undefined);
+ {
+ var_result.Bind(assembler->UndefinedConstant());
+ assembler->Goto(&end);
+ }
+
+ assembler->Bind(&end);
+ return var_result.value();
+}
+
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/compiler/js-typed-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698