Commit 33c5e802 authored by peterwmwong's avatar peterwmwong Committed by Commit Bot

[CSA] Add types to CSA HasProperty

Bug: 
Change-Id: If86c51b428f254ffce68d295f9e8001cee27b9ce
Reviewed-on: https://chromium-review.googlesource.com/833236Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Commit-Queue: Peter Wong <peter.wm.wong@gmail.com>
Cr-Commit-Position: refs/heads/master@{#50219}
parent bce199bb
...@@ -580,10 +580,11 @@ class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler { ...@@ -580,10 +580,11 @@ class ArrayBuiltinCodeStubAssembler : public CodeStubAssembler {
if (missing_property_mode == MissingPropertyMode::kSkip) { if (missing_property_mode == MissingPropertyMode::kSkip) {
// b. Let kPresent be HasProperty(O, Pk). // b. Let kPresent be HasProperty(O, Pk).
// c. ReturnIfAbrupt(kPresent). // c. ReturnIfAbrupt(kPresent).
Node* k_present = HasProperty(o(), k(), context(), kHasProperty); TNode<Oddball> k_present =
HasProperty(o(), k(), context(), kHasProperty);
// d. If kPresent is true, then // d. If kPresent is true, then
GotoIf(WordNotEqual(k_present, TrueConstant()), &done_element); GotoIf(IsFalse(k_present), &done_element);
} }
// i. Let kValue be Get(O, Pk). // i. Let kValue be Get(O, Pk).
...@@ -1263,11 +1264,11 @@ class FastArraySliceCodeStubAssembler : public CodeStubAssembler { ...@@ -1263,11 +1264,11 @@ class FastArraySliceCodeStubAssembler : public CodeStubAssembler {
void CopyOneElement(Node* context, Node* o, Node* a, Node* p_k, Variable& n) { void CopyOneElement(Node* context, Node* o, Node* a, Node* p_k, Variable& n) {
// b. Let kPresent be HasProperty(O, Pk). // b. Let kPresent be HasProperty(O, Pk).
// c. ReturnIfAbrupt(kPresent). // c. ReturnIfAbrupt(kPresent).
Node* k_present = HasProperty(o, p_k, context, kHasProperty); TNode<Oddball> k_present = HasProperty(o, p_k, context, kHasProperty);
// d. If kPresent is true, then // d. If kPresent is true, then
Label done_element(this); Label done_element(this);
GotoIf(WordNotEqual(k_present, TrueConstant()), &done_element); GotoIf(IsFalse(k_present), &done_element);
// i. Let kValue be Get(O, Pk). // i. Let kValue be Get(O, Pk).
// ii. ReturnIfAbrupt(kValue). // ii. ReturnIfAbrupt(kValue).
......
...@@ -587,7 +587,7 @@ TF_BUILTIN(ForInFilter, CodeStubAssembler) { ...@@ -587,7 +587,7 @@ TF_BUILTIN(ForInFilter, CodeStubAssembler) {
CSA_ASSERT(this, IsString(key)); CSA_ASSERT(this, IsString(key));
Label if_true(this), if_false(this); Label if_true(this), if_false(this);
Node* result = HasProperty(object, key, context, kForInHasProperty); TNode<Oddball> result = HasProperty(object, key, context, kForInHasProperty);
Branch(IsTrue(result), &if_true, &if_false); Branch(IsTrue(result), &if_true, &if_false);
BIND(&if_true); BIND(&if_true);
......
...@@ -9491,8 +9491,10 @@ void CodeStubAssembler::BranchIfSameValue(Node* lhs, Node* rhs, Label* if_true, ...@@ -9491,8 +9491,10 @@ void CodeStubAssembler::BranchIfSameValue(Node* lhs, Node* rhs, Label* if_true,
} }
} }
Node* CodeStubAssembler::HasProperty(Node* object, Node* key, Node* context, TNode<Oddball> CodeStubAssembler::HasProperty(SloppyTNode<HeapObject> object,
HasPropertyLookupMode mode) { SloppyTNode<Name> key,
SloppyTNode<Context> context,
HasPropertyLookupMode mode) {
Label call_runtime(this, Label::kDeferred), return_true(this), Label call_runtime(this, Label::kDeferred), return_true(this),
return_false(this), end(this), if_proxy(this, Label::kDeferred); return_false(this), end(this), if_proxy(this, Label::kDeferred);
...@@ -9517,16 +9519,16 @@ Node* CodeStubAssembler::HasProperty(Node* object, Node* key, Node* context, ...@@ -9517,16 +9519,16 @@ Node* CodeStubAssembler::HasProperty(Node* object, Node* key, Node* context,
lookup_element_in_holder, &return_false, lookup_element_in_holder, &return_false,
&call_runtime, &if_proxy); &call_runtime, &if_proxy);
VARIABLE(result, MachineRepresentation::kTagged); TVARIABLE(Oddball, result);
BIND(&if_proxy); BIND(&if_proxy);
{ {
Node* name = ToName(context, key); TNode<Name> name = CAST(ToName(context, key));
switch (mode) { switch (mode) {
case kHasProperty: case kHasProperty:
GotoIf(IsPrivateSymbol(name), &return_false); GotoIf(IsPrivateSymbol(name), &return_false);
result.Bind( result = CAST(
CallBuiltin(Builtins::kProxyHasProperty, context, object, name)); CallBuiltin(Builtins::kProxyHasProperty, context, object, name));
Goto(&end); Goto(&end);
break; break;
...@@ -9538,13 +9540,13 @@ Node* CodeStubAssembler::HasProperty(Node* object, Node* key, Node* context, ...@@ -9538,13 +9540,13 @@ Node* CodeStubAssembler::HasProperty(Node* object, Node* key, Node* context,
BIND(&return_true); BIND(&return_true);
{ {
result.Bind(TrueConstant()); result = TrueConstant();
Goto(&end); Goto(&end);
} }
BIND(&return_false); BIND(&return_false);
{ {
result.Bind(FalseConstant()); result = FalseConstant();
Goto(&end); Goto(&end);
} }
...@@ -9560,13 +9562,14 @@ Node* CodeStubAssembler::HasProperty(Node* object, Node* key, Node* context, ...@@ -9560,13 +9562,14 @@ Node* CodeStubAssembler::HasProperty(Node* object, Node* key, Node* context,
break; break;
} }
result.Bind( result =
CallRuntime(fallback_runtime_function_id, context, object, key)); CAST(CallRuntime(fallback_runtime_function_id, context, object, key));
Goto(&end); Goto(&end);
} }
BIND(&end); BIND(&end);
return result.value(); CSA_ASSERT(this, IsBoolean(result));
return result;
} }
Node* CodeStubAssembler::ClassOf(Node* value) { Node* CodeStubAssembler::ClassOf(Node* value) {
......
...@@ -1796,8 +1796,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler { ...@@ -1796,8 +1796,10 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
enum HasPropertyLookupMode { kHasProperty, kForInHasProperty }; enum HasPropertyLookupMode { kHasProperty, kForInHasProperty };
Node* HasProperty(Node* object, Node* key, Node* context, TNode<Oddball> HasProperty(SloppyTNode<HeapObject> object,
HasPropertyLookupMode mode); SloppyTNode<Name> key,
SloppyTNode<Context> context,
HasPropertyLookupMode mode);
Node* ClassOf(Node* object); Node* ClassOf(Node* object);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment