Rename %_IsSpecObject to %_IsJSReceiver.
This depends on issue 1476403004. R=bmeurer@chromium.org BUG= Review URL: https://codereview.chromium.org/1479293002 Cr-Commit-Position: refs/heads/master@{#32401}
This commit is contained in:
parent
d3ba9afee2
commit
9334308a12
@ -452,7 +452,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle<JSFunction> function) {
|
|||||||
// Insert a check of the return value to determine whether the return value
|
// Insert a check of the return value to determine whether the return value
|
||||||
// or the implicit receiver should be selected as a result of the call.
|
// or the implicit receiver should be selected as a result of the call.
|
||||||
Node* check = jsgraph_->graph()->NewNode(
|
Node* check = jsgraph_->graph()->NewNode(
|
||||||
jsgraph_->javascript()->CallRuntime(Runtime::kInlineIsSpecObject, 1),
|
jsgraph_->javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1),
|
||||||
node, context, node, start);
|
node, context, node, start);
|
||||||
Node* select = jsgraph_->graph()->NewNode(
|
Node* select = jsgraph_->graph()->NewNode(
|
||||||
jsgraph_->common()->Select(kMachAnyTagged), check, node, create);
|
jsgraph_->common()->Select(kMachAnyTagged), check, node, create);
|
||||||
|
@ -59,9 +59,8 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
|
|||||||
return ReduceIsInstanceType(node, JS_FUNCTION_TYPE);
|
return ReduceIsInstanceType(node, JS_FUNCTION_TYPE);
|
||||||
case Runtime::kInlineIsRegExp:
|
case Runtime::kInlineIsRegExp:
|
||||||
return ReduceIsInstanceType(node, JS_REGEXP_TYPE);
|
return ReduceIsInstanceType(node, JS_REGEXP_TYPE);
|
||||||
case Runtime::kInlineIsSpecObject:
|
case Runtime::kInlineIsJSReceiver:
|
||||||
// TODO(bmeurer): Rename %_IsSpecObject to %_IsReceiver.
|
return ReduceIsJSReceiver(node);
|
||||||
return ReduceIsSpecObject(node);
|
|
||||||
case Runtime::kInlineIsSmi:
|
case Runtime::kInlineIsSmi:
|
||||||
return ReduceIsSmi(node);
|
return ReduceIsSmi(node);
|
||||||
case Runtime::kInlineJSValueGetValue:
|
case Runtime::kInlineJSValueGetValue:
|
||||||
@ -247,7 +246,7 @@ Reduction JSIntrinsicLowering::ReduceIsInstanceType(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Reduction JSIntrinsicLowering::ReduceIsSpecObject(Node* node) {
|
Reduction JSIntrinsicLowering::ReduceIsJSReceiver(Node* node) {
|
||||||
// if (%_IsSmi(value)) {
|
// if (%_IsSmi(value)) {
|
||||||
// return false;
|
// return false;
|
||||||
// } else {
|
// } else {
|
||||||
|
@ -46,7 +46,7 @@ class JSIntrinsicLowering final : public AdvancedReducer {
|
|||||||
Reduction ReduceIncrementStatsCounter(Node* node);
|
Reduction ReduceIncrementStatsCounter(Node* node);
|
||||||
Reduction ReduceIsMinusZero(Node* node);
|
Reduction ReduceIsMinusZero(Node* node);
|
||||||
Reduction ReduceIsInstanceType(Node* node, InstanceType instance_type);
|
Reduction ReduceIsInstanceType(Node* node, InstanceType instance_type);
|
||||||
Reduction ReduceIsSpecObject(Node* node);
|
Reduction ReduceIsJSReceiver(Node* node);
|
||||||
Reduction ReduceIsSmi(Node* node);
|
Reduction ReduceIsSmi(Node* node);
|
||||||
Reduction ReduceJSValueGetValue(Node* node);
|
Reduction ReduceJSValueGetValue(Node* node);
|
||||||
Reduction ReduceMapGetInstanceType(Node* node);
|
Reduction ReduceMapGetInstanceType(Node* node);
|
||||||
|
@ -12137,7 +12137,7 @@ void HOptimizedGraphBuilder::GenerateIsSmi(CallRuntime* call) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void HOptimizedGraphBuilder::GenerateIsSpecObject(CallRuntime* call) {
|
void HOptimizedGraphBuilder::GenerateIsJSReceiver(CallRuntime* call) {
|
||||||
DCHECK(call->arguments()->length() == 1);
|
DCHECK(call->arguments()->length() == 1);
|
||||||
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
|
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
|
||||||
HValue* value = Pop();
|
HValue* value = Pop();
|
||||||
|
@ -2222,7 +2222,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
|
|||||||
F(ToLength) \
|
F(ToLength) \
|
||||||
F(ToNumber) \
|
F(ToNumber) \
|
||||||
F(IsFunction) \
|
F(IsFunction) \
|
||||||
F(IsSpecObject) \
|
F(IsJSReceiver) \
|
||||||
F(MathPow) \
|
F(MathPow) \
|
||||||
F(IsMinusZero) \
|
F(IsMinusZero) \
|
||||||
F(HasCachedArrayIndex) \
|
F(HasCachedArrayIndex) \
|
||||||
|
@ -3094,7 +3094,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
|
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
|
||||||
ZoneList<Expression*>* args = expr->arguments();
|
ZoneList<Expression*>* args = expr->arguments();
|
||||||
DCHECK(args->length() == 1);
|
DCHECK(args->length() == 1);
|
||||||
|
|
||||||
|
@ -2803,7 +2803,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
|
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
|
||||||
ZoneList<Expression*>* args = expr->arguments();
|
ZoneList<Expression*>* args = expr->arguments();
|
||||||
DCHECK(args->length() == 1);
|
DCHECK(args->length() == 1);
|
||||||
|
|
||||||
|
@ -492,7 +492,7 @@ class FullCodeGenerator: public AstVisitor {
|
|||||||
F(TwoByteSeqStringSetChar) \
|
F(TwoByteSeqStringSetChar) \
|
||||||
F(ObjectEquals) \
|
F(ObjectEquals) \
|
||||||
F(IsFunction) \
|
F(IsFunction) \
|
||||||
F(IsSpecObject) \
|
F(IsJSReceiver) \
|
||||||
F(IsSimdValue) \
|
F(IsSimdValue) \
|
||||||
F(MathPow) \
|
F(MathPow) \
|
||||||
F(IsMinusZero) \
|
F(IsMinusZero) \
|
||||||
|
@ -2978,7 +2978,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
|
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
|
||||||
ZoneList<Expression*>* args = expr->arguments();
|
ZoneList<Expression*>* args = expr->arguments();
|
||||||
DCHECK(args->length() == 1);
|
DCHECK(args->length() == 1);
|
||||||
|
|
||||||
|
@ -3085,7 +3085,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
|
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
|
||||||
ZoneList<Expression*>* args = expr->arguments();
|
ZoneList<Expression*>* args = expr->arguments();
|
||||||
DCHECK(args->length() == 1);
|
DCHECK(args->length() == 1);
|
||||||
|
|
||||||
|
@ -3089,7 +3089,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
|
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
|
||||||
ZoneList<Expression*>* args = expr->arguments();
|
ZoneList<Expression*>* args = expr->arguments();
|
||||||
DCHECK(args->length() == 1);
|
DCHECK(args->length() == 1);
|
||||||
|
|
||||||
|
@ -3089,7 +3089,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
|
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
|
||||||
ZoneList<Expression*>* args = expr->arguments();
|
ZoneList<Expression*>* args = expr->arguments();
|
||||||
DCHECK(args->length() == 1);
|
DCHECK(args->length() == 1);
|
||||||
|
|
||||||
|
@ -2962,7 +2962,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
|
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
|
||||||
ZoneList<Expression*>* args = expr->arguments();
|
ZoneList<Expression*>* args = expr->arguments();
|
||||||
DCHECK(args->length() == 1);
|
DCHECK(args->length() == 1);
|
||||||
|
|
||||||
|
@ -2970,7 +2970,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
|
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
|
||||||
ZoneList<Expression*>* args = expr->arguments();
|
ZoneList<Expression*>* args = expr->arguments();
|
||||||
DCHECK(args->length() == 1);
|
DCHECK(args->length() == 1);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ macro IS_STRONG(arg) = (%IsStrong(arg));
|
|||||||
# This is the same as being either a function or an object in V8 terminology
|
# This is the same as being either a function or an object in V8 terminology
|
||||||
# (including proxies).
|
# (including proxies).
|
||||||
# In addition, an undetectable object is also included by this.
|
# In addition, an undetectable object is also included by this.
|
||||||
macro IS_SPEC_OBJECT(arg) = (%_IsSpecObject(arg));
|
macro IS_SPEC_OBJECT(arg) = (%_IsJSReceiver(arg));
|
||||||
|
|
||||||
# Macro for ECMAScript 5 queries of the type:
|
# Macro for ECMAScript 5 queries of the type:
|
||||||
# "IsCallable(O)"
|
# "IsCallable(O)"
|
||||||
|
@ -2854,7 +2854,7 @@ Statement* Parser::ParseReturnStatement(bool* ok) {
|
|||||||
// Is rewritten as:
|
// Is rewritten as:
|
||||||
//
|
//
|
||||||
// return (temp = expr) === undefined ? this :
|
// return (temp = expr) === undefined ? this :
|
||||||
// %_IsSpecObject(temp) ? temp : throw new TypeError(...);
|
// %_IsJSReceiver(temp) ? temp : throw new TypeError(...);
|
||||||
Variable* temp = scope_->NewTemporary(
|
Variable* temp = scope_->NewTemporary(
|
||||||
ast_value_factory()->empty_string());
|
ast_value_factory()->empty_string());
|
||||||
Assignment* assign = factory()->NewAssignment(
|
Assignment* assign = factory()->NewAssignment(
|
||||||
@ -2864,14 +2864,14 @@ Statement* Parser::ParseReturnStatement(bool* ok) {
|
|||||||
NewThrowTypeError(MessageTemplate::kDerivedConstructorReturn,
|
NewThrowTypeError(MessageTemplate::kDerivedConstructorReturn,
|
||||||
ast_value_factory()->empty_string(), pos);
|
ast_value_factory()->empty_string(), pos);
|
||||||
|
|
||||||
// %_IsSpecObject(temp)
|
// %_IsJSReceiver(temp)
|
||||||
ZoneList<Expression*>* is_spec_object_args =
|
ZoneList<Expression*>* is_spec_object_args =
|
||||||
new (zone()) ZoneList<Expression*>(1, zone());
|
new (zone()) ZoneList<Expression*>(1, zone());
|
||||||
is_spec_object_args->Add(factory()->NewVariableProxy(temp), zone());
|
is_spec_object_args->Add(factory()->NewVariableProxy(temp), zone());
|
||||||
Expression* is_spec_object_call = factory()->NewCallRuntime(
|
Expression* is_spec_object_call = factory()->NewCallRuntime(
|
||||||
Runtime::kInlineIsSpecObject, is_spec_object_args, pos);
|
Runtime::kInlineIsJSReceiver, is_spec_object_args, pos);
|
||||||
|
|
||||||
// %_IsSpecObject(temp) ? temp : throw_expression
|
// %_IsJSReceiver(temp) ? temp : throw_expression
|
||||||
Expression* is_object_conditional = factory()->NewConditional(
|
Expression* is_object_conditional = factory()->NewConditional(
|
||||||
is_spec_object_call, factory()->NewVariableProxy(temp),
|
is_spec_object_call, factory()->NewVariableProxy(temp),
|
||||||
throw_expression, pos);
|
throw_expression, pos);
|
||||||
@ -3281,7 +3281,7 @@ WhileStatement* Parser::ParseWhileStatement(
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// !%_IsSpecObject(result = iterator.next()) &&
|
// !%_IsJSReceiver(result = iterator.next()) &&
|
||||||
// %ThrowIteratorResultNotAnObject(result)
|
// %ThrowIteratorResultNotAnObject(result)
|
||||||
Expression* Parser::BuildIteratorNextResult(Expression* iterator,
|
Expression* Parser::BuildIteratorNextResult(Expression* iterator,
|
||||||
Variable* result, int pos) {
|
Variable* result, int pos) {
|
||||||
@ -3297,12 +3297,12 @@ Expression* Parser::BuildIteratorNextResult(Expression* iterator,
|
|||||||
Expression* left =
|
Expression* left =
|
||||||
factory()->NewAssignment(Token::ASSIGN, result_proxy, next_call, pos);
|
factory()->NewAssignment(Token::ASSIGN, result_proxy, next_call, pos);
|
||||||
|
|
||||||
// %_IsSpecObject(...)
|
// %_IsJSReceiver(...)
|
||||||
ZoneList<Expression*>* is_spec_object_args =
|
ZoneList<Expression*>* is_spec_object_args =
|
||||||
new (zone()) ZoneList<Expression*>(1, zone());
|
new (zone()) ZoneList<Expression*>(1, zone());
|
||||||
is_spec_object_args->Add(left, zone());
|
is_spec_object_args->Add(left, zone());
|
||||||
Expression* is_spec_object_call = factory()->NewCallRuntime(
|
Expression* is_spec_object_call = factory()->NewCallRuntime(
|
||||||
Runtime::kInlineIsSpecObject, is_spec_object_args, pos);
|
Runtime::kInlineIsJSReceiver, is_spec_object_args, pos);
|
||||||
|
|
||||||
// %ThrowIteratorResultNotAnObject(result)
|
// %ThrowIteratorResultNotAnObject(result)
|
||||||
Expression* result_proxy_again = factory()->NewVariableProxy(result);
|
Expression* result_proxy_again = factory()->NewVariableProxy(result);
|
||||||
@ -3341,7 +3341,7 @@ void Parser::InitializeForEachStatement(ForEachStatement* stmt,
|
|||||||
Token::ASSIGN, factory()->NewVariableProxy(iterator),
|
Token::ASSIGN, factory()->NewVariableProxy(iterator),
|
||||||
GetIterator(subject, factory()), subject->position());
|
GetIterator(subject, factory()), subject->position());
|
||||||
|
|
||||||
// !%_IsSpecObject(result = iterator.next()) &&
|
// !%_IsJSReceiver(result = iterator.next()) &&
|
||||||
// %ThrowIteratorResultNotAnObject(result)
|
// %ThrowIteratorResultNotAnObject(result)
|
||||||
{
|
{
|
||||||
// result = iterator.next()
|
// result = iterator.next()
|
||||||
|
@ -1102,7 +1102,7 @@ class Parser : public ParserBase<ParserTraits> {
|
|||||||
TryStatement* ParseTryStatement(bool* ok);
|
TryStatement* ParseTryStatement(bool* ok);
|
||||||
DebuggerStatement* ParseDebuggerStatement(bool* ok);
|
DebuggerStatement* ParseDebuggerStatement(bool* ok);
|
||||||
|
|
||||||
// !%_IsSpecObject(result = iterator.next()) &&
|
// !%_IsJSReceiver(result = iterator.next()) &&
|
||||||
// %ThrowIteratorResultNotAnObject(result)
|
// %ThrowIteratorResultNotAnObject(result)
|
||||||
Expression* BuildIteratorNextResult(Expression* iterator, Variable* result,
|
Expression* BuildIteratorNextResult(Expression* iterator, Variable* result,
|
||||||
int pos);
|
int pos);
|
||||||
|
@ -1259,7 +1259,7 @@ RUNTIME_FUNCTION(Runtime_ObjectEquals) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
RUNTIME_FUNCTION(Runtime_IsSpecObject) {
|
RUNTIME_FUNCTION(Runtime_IsJSReceiver) {
|
||||||
SealHandleScope shs(isolate);
|
SealHandleScope shs(isolate);
|
||||||
DCHECK(args.length() == 1);
|
DCHECK(args.length() == 1);
|
||||||
CONVERT_ARG_CHECKED(Object, obj, 0);
|
CONVERT_ARG_CHECKED(Object, obj, 0);
|
||||||
|
@ -481,7 +481,7 @@ namespace internal {
|
|||||||
F(HeapObjectGetMap, 1, 1) \
|
F(HeapObjectGetMap, 1, 1) \
|
||||||
F(MapGetInstanceType, 1, 1) \
|
F(MapGetInstanceType, 1, 1) \
|
||||||
F(ObjectEquals, 2, 1) \
|
F(ObjectEquals, 2, 1) \
|
||||||
F(IsSpecObject, 1, 1) \
|
F(IsJSReceiver, 1, 1) \
|
||||||
F(IsStrong, 1, 1) \
|
F(IsStrong, 1, 1) \
|
||||||
F(ClassOf, 1, 1) \
|
F(ClassOf, 1, 1) \
|
||||||
F(DefineGetterPropertyUnchecked, 4, 1) \
|
F(DefineGetterPropertyUnchecked, 4, 1) \
|
||||||
|
@ -145,7 +145,7 @@ TEST(RuntimeCallCPP2) {
|
|||||||
|
|
||||||
TEST(RuntimeCallInline) {
|
TEST(RuntimeCallInline) {
|
||||||
FLAG_allow_natives_syntax = true;
|
FLAG_allow_natives_syntax = true;
|
||||||
FunctionTester T("(function(a) { return %_IsSpecObject(a); })");
|
FunctionTester T("(function(a) { return %_IsJSReceiver(a); })");
|
||||||
|
|
||||||
T.CheckCall(T.false_value(), T.Val(23), T.undefined());
|
T.CheckCall(T.false_value(), T.Val(23), T.undefined());
|
||||||
T.CheckCall(T.false_value(), T.Val(4.2), T.undefined());
|
T.CheckCall(T.false_value(), T.Val(4.2), T.undefined());
|
||||||
|
@ -27,8 +27,8 @@ function test() {
|
|||||||
assertTrue(%_IsFunction(function() {}));
|
assertTrue(%_IsFunction(function() {}));
|
||||||
assertFalse(%_IsFunction(null));
|
assertFalse(%_IsFunction(null));
|
||||||
|
|
||||||
assertTrue(%_IsSpecObject(new Date()));
|
assertTrue(%_IsJSReceiver(new Date()));
|
||||||
assertFalse(%_IsSpecObject(1));
|
assertFalse(%_IsJSReceiver(1));
|
||||||
|
|
||||||
assertTrue(%_IsMinusZero(-0.0));
|
assertTrue(%_IsMinusZero(-0.0));
|
||||||
assertFalse(%_IsMinusZero(1));
|
assertFalse(%_IsMinusZero(1));
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
// HHasInstance.
|
// HHasInstance.
|
||||||
function f(value) {
|
function f(value) {
|
||||||
if (%_IsSpecObject(value)) {
|
if (%_IsJSReceiver(value)) {
|
||||||
if ((%_IsArray(value))) assertTrue(false);
|
if ((%_IsArray(value))) assertTrue(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,16 +284,16 @@ TEST_F(JSIntrinsicLoweringTest, InlineIsRegExp) {
|
|||||||
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// %_IsSpecObject
|
// %_IsJSReceiver
|
||||||
|
|
||||||
|
|
||||||
TEST_F(JSIntrinsicLoweringTest, InlineIsSpecObject) {
|
TEST_F(JSIntrinsicLoweringTest, InlineIsJSReceiver) {
|
||||||
Node* const input = Parameter(0);
|
Node* const input = Parameter(0);
|
||||||
Node* const context = Parameter(1);
|
Node* const context = Parameter(1);
|
||||||
Node* const effect = graph()->start();
|
Node* const effect = graph()->start();
|
||||||
Node* const control = graph()->start();
|
Node* const control = graph()->start();
|
||||||
Reduction const r = Reduce(graph()->NewNode(
|
Reduction const r = Reduce(graph()->NewNode(
|
||||||
javascript()->CallRuntime(Runtime::kInlineIsSpecObject, 1), input,
|
javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), input,
|
||||||
context, effect, control));
|
context, effect, control));
|
||||||
ASSERT_TRUE(r.Changed());
|
ASSERT_TRUE(r.Changed());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user