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