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; |