Index: src/builtins/builtins-object-gen.cc |
diff --git a/src/builtins/builtins-object-gen.cc b/src/builtins/builtins-object-gen.cc |
index be83f5d1efa264544387e817a666a0bf3214e869..9a5c94068a41c5c455d984c3f572bffccc8d28d5 100644 |
--- a/src/builtins/builtins-object-gen.cc |
+++ b/src/builtins/builtins-object-gen.cc |
@@ -68,19 +68,48 @@ TF_BUILTIN(ObjectHasOwnProperty, ObjectBuiltinsAssembler) { |
VARIABLE(var_index, MachineType::PointerRepresentation()); |
VARIABLE(var_unique, MachineRepresentation::kTagged); |
- Label keyisindex(this), if_iskeyunique(this); |
- TryToName(key, &keyisindex, &var_index, &if_iskeyunique, &var_unique, |
- &call_runtime); |
+ Label if_index(this), if_unique_name(this), if_notunique_name(this); |
+ TryToName(key, &if_index, &var_index, &if_unique_name, &var_unique, |
+ &call_runtime, &if_notunique_name); |
- BIND(&if_iskeyunique); |
+ BIND(&if_unique_name); |
TryHasOwnProperty(object, map, instance_type, var_unique.value(), |
&return_true, &return_false, &call_runtime); |
- BIND(&keyisindex); |
- // Handle negative keys in the runtime. |
- GotoIf(IntPtrLessThan(var_index.value(), IntPtrConstant(0)), &call_runtime); |
- TryLookupElement(object, map, instance_type, var_index.value(), |
- &return_true, &return_false, &return_false, &call_runtime); |
+ BIND(&if_index); |
+ { |
+ // Handle negative keys in the runtime. |
+ GotoIf(IntPtrLessThan(var_index.value(), IntPtrConstant(0)), |
+ &call_runtime); |
+ TryLookupElement(object, map, instance_type, var_index.value(), |
+ &return_true, &return_false, &return_false, |
+ &call_runtime); |
+ } |
+ |
+ BIND(&if_notunique_name); |
+ { |
+ Node* function = ExternalConstant( |
+ ExternalReference::try_internalize_string_function(isolate())); |
+ Node* result = CallCFunction1(MachineType::AnyTagged(), |
+ MachineType::AnyTagged(), function, key); |
+ // If internalization failed, then the string did not exist in the string |
+ // table yet, which implies that no existing object has a property with |
+ // that name. |
+ Label internalized(this); |
+ GotoIf(TaggedIsNotSmi(result), &internalized); |
+ Node* int_result = SmiUntag(result); |
+ GotoIf(WordEqual(int_result, IntPtrConstant(ResultSentinel::kNotFound)), |
+ &return_false); |
+ GotoIf( |
+ WordEqual(int_result, IntPtrConstant(ResultSentinel::kUnsupported)), |
+ &call_runtime); |
+ var_index.Bind(int_result); |
+ Goto(&if_index); |
+ |
+ BIND(&internalized); |
+ var_unique.Bind(result); |
+ Goto(&if_unique_name); |
+ } |
} |
BIND(&return_true); |
Return(BooleanConstant(true)); |