Commit 4da9b8af authored by bmeurer's avatar bmeurer Committed by Commit bot

[csa] Remove context inputs from StrictEqual, SameValue and Typeof.

These operations don't need the context, so no need to pass the context
to them. Also avoids the loading of context in the interpreter bytecode
handlers for StrictEqual and Typeof.

BUG=v8:5268,v8:5269
R=yangguo@chromium.org

Review-Url: https://codereview.chromium.org/2744173002
Cr-Commit-Position: refs/heads/master@{#43733}
parent 55e3fb94
......@@ -407,9 +407,8 @@ TF_BUILTIN(ClassOf, CodeStubAssembler) {
// ES6 section 12.5.5 typeof operator
TF_BUILTIN(Typeof, CodeStubAssembler) {
Node* object = Parameter(TypeofDescriptor::kObject);
Node* context = Parameter(TypeofDescriptor::kContext);
Return(Typeof(object, context));
Return(Typeof(object));
}
} // namespace internal
......
......@@ -1593,9 +1593,8 @@ TF_BUILTIN(Equal, CodeStubAssembler) {
TF_BUILTIN(StrictEqual, CodeStubAssembler) {
Node* lhs = Parameter(0);
Node* rhs = Parameter(1);
Node* context = Parameter(2);
Return(StrictEqual(lhs, rhs, context));
Return(StrictEqual(lhs, rhs));
}
} // namespace internal
......
......@@ -681,7 +681,7 @@ void PromiseBuiltinsAssembler::InternalResolvePromise(Node* context,
Bind(&cycle_check);
// 6. If SameValue(resolution, promise) is true, then
GotoIf(SameValue(promise, result, context), &if_cycle);
GotoIf(SameValue(promise, result), &if_cycle);
// 7. If Type(resolution) is not Object, then
GotoIf(TaggedIsSmi(result), &fulfill);
......@@ -1427,7 +1427,7 @@ TF_BUILTIN(PromiseResolve, PromiseBuiltinsAssembler) {
CallStub(getproperty_callable, context, value, constructor_str);
// 3.b If SameValue(xConstructor, C) is true, return x.
GotoIfNot(SameValue(constructor, receiver, context), &if_valueisnotpromise);
GotoIfNot(SameValue(constructor, receiver), &if_valueisnotpromise);
Return(value);
}
......
......@@ -1723,7 +1723,7 @@ void RegExpBuiltinsAssembler::RegExpPrototypeSearchBodySlow(
// Ensure last index is 0.
{
Label next(this);
GotoIf(SameValue(previous_last_index, smi_zero, context), &next);
GotoIf(SameValue(previous_last_index, smi_zero), &next);
SlowStoreLastIndex(context, regexp, smi_zero);
Goto(&next);
......@@ -1738,7 +1738,7 @@ void RegExpBuiltinsAssembler::RegExpPrototypeSearchBodySlow(
Label next(this);
Node* const current_last_index = SlowLoadLastIndex(context, regexp);
GotoIf(SameValue(current_last_index, previous_last_index, context), &next);
GotoIf(SameValue(current_last_index, previous_last_index), &next);
SlowStoreLastIndex(context, regexp, previous_last_index);
Goto(&next);
......
......@@ -7250,7 +7250,7 @@ Node* CodeStubAssembler::Equal(Node* lhs, Node* rhs, Node* context) {
return result.value();
}
Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, Node* context) {
Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs) {
// Here's pseudo-code for the algorithm below in case of kDontNegateResult
// mode; for kNegateResult mode we properly negate the result.
//
......@@ -7400,7 +7400,7 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, Node* context) {
Bind(&if_rhsisstring);
{
Callable callable = CodeFactory::StringEqual(isolate());
result.Bind(CallStub(callable, context, lhs, rhs));
result.Bind(CallStub(callable, NoContextConstant(), lhs, rhs));
Goto(&end);
}
......@@ -7471,7 +7471,7 @@ Node* CodeStubAssembler::StrictEqual(Node* lhs, Node* rhs, Node* context) {
// ECMA#sec-samevalue
// This algorithm differs from the Strict Equality Comparison Algorithm in its
// treatment of signed zeroes and NaNs.
Node* CodeStubAssembler::SameValue(Node* lhs, Node* rhs, Node* context) {
Node* CodeStubAssembler::SameValue(Node* lhs, Node* rhs) {
Variable var_result(this, MachineRepresentation::kWord32);
Label strict_equal(this), out(this);
......@@ -7545,7 +7545,7 @@ Node* CodeStubAssembler::SameValue(Node* lhs, Node* rhs, Node* context) {
Bind(&strict_equal);
{
Node* const is_equal = StrictEqual(lhs, rhs, context);
Node* const is_equal = StrictEqual(lhs, rhs);
Node* const result = WordEqual(is_equal, TrueConstant());
var_result.Bind(result);
Goto(&out);
......@@ -7656,7 +7656,7 @@ Node* CodeStubAssembler::ClassOf(Node* value) {
return var_result.value();
}
Node* CodeStubAssembler::Typeof(Node* value, Node* context) {
Node* CodeStubAssembler::Typeof(Node* value) {
Variable result_var(this, MachineRepresentation::kTagged);
Label return_number(this, Label::kDeferred), if_oddball(this),
......
......@@ -1204,14 +1204,14 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Node* Equal(Node* lhs, Node* rhs, Node* context);
Node* StrictEqual(Node* lhs, Node* rhs, Node* context);
Node* StrictEqual(Node* lhs, Node* rhs);
// ECMA#sec-samevalue
// Similar to StrictEqual except that NaNs are treated as equal and minus zero
// differs from positive zero.
// Unlike Equal and StrictEqual, returns a value suitable for use in Branch
// instructions, e.g. Branch(SameValue(...), &label).
Node* SameValue(Node* lhs, Node* rhs, Node* context);
Node* SameValue(Node* lhs, Node* rhs);
Node* HasProperty(
Node* object, Node* key, Node* context,
......@@ -1219,7 +1219,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler : public compiler::CodeAssembler {
Node* ClassOf(Node* object);
Node* Typeof(Node* value, Node* context);
Node* Typeof(Node* value);
Node* GetSuperConstructor(Node* value, Node* context);
......
......@@ -862,7 +862,7 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore(
if (language_mode == STRICT) {
Node* message =
SmiConstant(Smi::FromInt(MessageTemplate::kStrictReadOnlyProperty));
Node* type = Typeof(p->receiver, p->context);
Node* type = Typeof(p->receiver);
TailCallRuntime(Runtime::kThrowTypeError, p->context, message, p->name,
type, p->receiver);
} else {
......
......@@ -1362,7 +1362,7 @@ void Interpreter::DoCompareOpWithFeedback(Token::Value compare_op,
result = assembler->Equal(lhs, rhs, context);
break;
case Token::EQ_STRICT:
result = assembler->StrictEqual(lhs, rhs, context);
result = assembler->StrictEqual(lhs, rhs);
break;
case Token::LT:
result = assembler->RelationalComparison(CodeStubAssembler::kLessThan,
......@@ -2155,8 +2155,7 @@ void Interpreter::DoLogicalNot(InterpreterAssembler* assembler) {
// object in the accumulator.
void Interpreter::DoTypeOf(InterpreterAssembler* assembler) {
Node* value = __ GetAccumulator();
Node* context = __ GetContext();
Node* result = assembler->Typeof(value, context);
Node* result = assembler->Typeof(value);
__ SetAccumulator(result);
__ Dispatch();
}
......
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