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:
neis 2015-11-30 03:56:11 -08:00 committed by Commit bot
parent d3ba9afee2
commit 9334308a12
23 changed files with 35 additions and 36 deletions

View File

@ -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
// or the implicit receiver should be selected as a result of the call.
Node* check = jsgraph_->graph()->NewNode(
jsgraph_->javascript()->CallRuntime(Runtime::kInlineIsSpecObject, 1),
jsgraph_->javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1),
node, context, node, start);
Node* select = jsgraph_->graph()->NewNode(
jsgraph_->common()->Select(kMachAnyTagged), check, node, create);

View File

@ -59,9 +59,8 @@ Reduction JSIntrinsicLowering::Reduce(Node* node) {
return ReduceIsInstanceType(node, JS_FUNCTION_TYPE);
case Runtime::kInlineIsRegExp:
return ReduceIsInstanceType(node, JS_REGEXP_TYPE);
case Runtime::kInlineIsSpecObject:
// TODO(bmeurer): Rename %_IsSpecObject to %_IsReceiver.
return ReduceIsSpecObject(node);
case Runtime::kInlineIsJSReceiver:
return ReduceIsJSReceiver(node);
case Runtime::kInlineIsSmi:
return ReduceIsSmi(node);
case Runtime::kInlineJSValueGetValue:
@ -247,7 +246,7 @@ Reduction JSIntrinsicLowering::ReduceIsInstanceType(
}
Reduction JSIntrinsicLowering::ReduceIsSpecObject(Node* node) {
Reduction JSIntrinsicLowering::ReduceIsJSReceiver(Node* node) {
// if (%_IsSmi(value)) {
// return false;
// } else {

View File

@ -46,7 +46,7 @@ class JSIntrinsicLowering final : public AdvancedReducer {
Reduction ReduceIncrementStatsCounter(Node* node);
Reduction ReduceIsMinusZero(Node* node);
Reduction ReduceIsInstanceType(Node* node, InstanceType instance_type);
Reduction ReduceIsSpecObject(Node* node);
Reduction ReduceIsJSReceiver(Node* node);
Reduction ReduceIsSmi(Node* node);
Reduction ReduceJSValueGetValue(Node* node);
Reduction ReduceMapGetInstanceType(Node* node);

View File

@ -12137,7 +12137,7 @@ void HOptimizedGraphBuilder::GenerateIsSmi(CallRuntime* call) {
}
void HOptimizedGraphBuilder::GenerateIsSpecObject(CallRuntime* call) {
void HOptimizedGraphBuilder::GenerateIsJSReceiver(CallRuntime* call) {
DCHECK(call->arguments()->length() == 1);
CHECK_ALIVE(VisitForValue(call->arguments()->at(0)));
HValue* value = Pop();

View File

@ -2222,7 +2222,7 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
F(ToLength) \
F(ToNumber) \
F(IsFunction) \
F(IsSpecObject) \
F(IsJSReceiver) \
F(MathPow) \
F(IsMinusZero) \
F(HasCachedArrayIndex) \

View File

@ -3094,7 +3094,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
}
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 1);

View File

@ -2803,7 +2803,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
}
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 1);

View File

@ -492,7 +492,7 @@ class FullCodeGenerator: public AstVisitor {
F(TwoByteSeqStringSetChar) \
F(ObjectEquals) \
F(IsFunction) \
F(IsSpecObject) \
F(IsJSReceiver) \
F(IsSimdValue) \
F(MathPow) \
F(IsMinusZero) \

View File

@ -2978,7 +2978,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
}
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 1);

View File

@ -3085,7 +3085,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
}
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 1);

View File

@ -3089,7 +3089,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
}
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 1);

View File

@ -3089,7 +3089,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
}
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 1);

View File

@ -2962,7 +2962,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
}
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 1);

View File

@ -2970,7 +2970,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
}
void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) {
void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) {
ZoneList<Expression*>* args = expr->arguments();
DCHECK(args->length() == 1);

View File

@ -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
# (including proxies).
# 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:
# "IsCallable(O)"

View File

@ -2854,7 +2854,7 @@ Statement* Parser::ParseReturnStatement(bool* ok) {
// Is rewritten as:
//
// return (temp = expr) === undefined ? this :
// %_IsSpecObject(temp) ? temp : throw new TypeError(...);
// %_IsJSReceiver(temp) ? temp : throw new TypeError(...);
Variable* temp = scope_->NewTemporary(
ast_value_factory()->empty_string());
Assignment* assign = factory()->NewAssignment(
@ -2864,14 +2864,14 @@ Statement* Parser::ParseReturnStatement(bool* ok) {
NewThrowTypeError(MessageTemplate::kDerivedConstructorReturn,
ast_value_factory()->empty_string(), pos);
// %_IsSpecObject(temp)
// %_IsJSReceiver(temp)
ZoneList<Expression*>* is_spec_object_args =
new (zone()) ZoneList<Expression*>(1, zone());
is_spec_object_args->Add(factory()->NewVariableProxy(temp), zone());
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(
is_spec_object_call, factory()->NewVariableProxy(temp),
throw_expression, pos);
@ -3281,7 +3281,7 @@ WhileStatement* Parser::ParseWhileStatement(
}
// !%_IsSpecObject(result = iterator.next()) &&
// !%_IsJSReceiver(result = iterator.next()) &&
// %ThrowIteratorResultNotAnObject(result)
Expression* Parser::BuildIteratorNextResult(Expression* iterator,
Variable* result, int pos) {
@ -3297,12 +3297,12 @@ Expression* Parser::BuildIteratorNextResult(Expression* iterator,
Expression* left =
factory()->NewAssignment(Token::ASSIGN, result_proxy, next_call, pos);
// %_IsSpecObject(...)
// %_IsJSReceiver(...)
ZoneList<Expression*>* is_spec_object_args =
new (zone()) ZoneList<Expression*>(1, zone());
is_spec_object_args->Add(left, zone());
Expression* is_spec_object_call = factory()->NewCallRuntime(
Runtime::kInlineIsSpecObject, is_spec_object_args, pos);
Runtime::kInlineIsJSReceiver, is_spec_object_args, pos);
// %ThrowIteratorResultNotAnObject(result)
Expression* result_proxy_again = factory()->NewVariableProxy(result);
@ -3341,7 +3341,7 @@ void Parser::InitializeForEachStatement(ForEachStatement* stmt,
Token::ASSIGN, factory()->NewVariableProxy(iterator),
GetIterator(subject, factory()), subject->position());
// !%_IsSpecObject(result = iterator.next()) &&
// !%_IsJSReceiver(result = iterator.next()) &&
// %ThrowIteratorResultNotAnObject(result)
{
// result = iterator.next()

View File

@ -1102,7 +1102,7 @@ class Parser : public ParserBase<ParserTraits> {
TryStatement* ParseTryStatement(bool* ok);
DebuggerStatement* ParseDebuggerStatement(bool* ok);
// !%_IsSpecObject(result = iterator.next()) &&
// !%_IsJSReceiver(result = iterator.next()) &&
// %ThrowIteratorResultNotAnObject(result)
Expression* BuildIteratorNextResult(Expression* iterator, Variable* result,
int pos);

View File

@ -1259,7 +1259,7 @@ RUNTIME_FUNCTION(Runtime_ObjectEquals) {
}
RUNTIME_FUNCTION(Runtime_IsSpecObject) {
RUNTIME_FUNCTION(Runtime_IsJSReceiver) {
SealHandleScope shs(isolate);
DCHECK(args.length() == 1);
CONVERT_ARG_CHECKED(Object, obj, 0);

View File

@ -481,7 +481,7 @@ namespace internal {
F(HeapObjectGetMap, 1, 1) \
F(MapGetInstanceType, 1, 1) \
F(ObjectEquals, 2, 1) \
F(IsSpecObject, 1, 1) \
F(IsJSReceiver, 1, 1) \
F(IsStrong, 1, 1) \
F(ClassOf, 1, 1) \
F(DefineGetterPropertyUnchecked, 4, 1) \

View File

@ -145,7 +145,7 @@ TEST(RuntimeCallCPP2) {
TEST(RuntimeCallInline) {
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(4.2), T.undefined());

View File

@ -27,8 +27,8 @@ function test() {
assertTrue(%_IsFunction(function() {}));
assertFalse(%_IsFunction(null));
assertTrue(%_IsSpecObject(new Date()));
assertFalse(%_IsSpecObject(1));
assertTrue(%_IsJSReceiver(new Date()));
assertFalse(%_IsJSReceiver(1));
assertTrue(%_IsMinusZero(-0.0));
assertFalse(%_IsMinusZero(1));

View File

@ -33,7 +33,7 @@
// HHasInstance.
function f(value) {
if (%_IsSpecObject(value)) {
if (%_IsJSReceiver(value)) {
if ((%_IsArray(value))) assertTrue(false);
}
}

View File

@ -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 context = Parameter(1);
Node* const effect = graph()->start();
Node* const control = graph()->start();
Reduction const r = Reduce(graph()->NewNode(
javascript()->CallRuntime(Runtime::kInlineIsSpecObject, 1), input,
javascript()->CallRuntime(Runtime::kInlineIsJSReceiver, 1), input,
context, effect, control));
ASSERT_TRUE(r.Changed());