From 9334308a12acb383942e26428aedcc74f6be04a1 Mon Sep 17 00:00:00 2001 From: neis Date: Mon, 30 Nov 2015 03:56:11 -0800 Subject: [PATCH] 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} --- src/compiler/js-inlining.cc | 2 +- src/compiler/js-intrinsic-lowering.cc | 7 +++---- src/compiler/js-intrinsic-lowering.h | 2 +- src/crankshaft/hydrogen.cc | 2 +- src/crankshaft/hydrogen.h | 2 +- src/full-codegen/arm/full-codegen-arm.cc | 2 +- src/full-codegen/arm64/full-codegen-arm64.cc | 2 +- src/full-codegen/full-codegen.h | 2 +- src/full-codegen/ia32/full-codegen-ia32.cc | 2 +- src/full-codegen/mips/full-codegen-mips.cc | 2 +- src/full-codegen/mips64/full-codegen-mips64.cc | 2 +- src/full-codegen/ppc/full-codegen-ppc.cc | 2 +- src/full-codegen/x64/full-codegen-x64.cc | 2 +- src/full-codegen/x87/full-codegen-x87.cc | 2 +- src/js/macros.py | 2 +- src/parsing/parser.cc | 16 ++++++++-------- src/parsing/parser.h | 2 +- src/runtime/runtime-object.cc | 2 +- src/runtime/runtime.h | 2 +- test/cctest/compiler/test-run-jscalls.cc | 2 +- .../constant-fold-control-instructions.js | 4 ++-- test/mjsunit/regress/regress-995.js | 2 +- .../compiler/js-intrinsic-lowering-unittest.cc | 6 +++--- 23 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/compiler/js-inlining.cc b/src/compiler/js-inlining.cc index d6f01c19ca..74ac82799a 100644 --- a/src/compiler/js-inlining.cc +++ b/src/compiler/js-inlining.cc @@ -452,7 +452,7 @@ Reduction JSInliner::ReduceJSCall(Node* node, Handle 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); diff --git a/src/compiler/js-intrinsic-lowering.cc b/src/compiler/js-intrinsic-lowering.cc index 8620429334..d969ca78c5 100644 --- a/src/compiler/js-intrinsic-lowering.cc +++ b/src/compiler/js-intrinsic-lowering.cc @@ -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 { diff --git a/src/compiler/js-intrinsic-lowering.h b/src/compiler/js-intrinsic-lowering.h index b0bd007698..188e213406 100644 --- a/src/compiler/js-intrinsic-lowering.h +++ b/src/compiler/js-intrinsic-lowering.h @@ -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); diff --git a/src/crankshaft/hydrogen.cc b/src/crankshaft/hydrogen.cc index ad41d982ba..249611e143 100644 --- a/src/crankshaft/hydrogen.cc +++ b/src/crankshaft/hydrogen.cc @@ -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(); diff --git a/src/crankshaft/hydrogen.h b/src/crankshaft/hydrogen.h index c3b5afc4bc..425eff369f 100644 --- a/src/crankshaft/hydrogen.h +++ b/src/crankshaft/hydrogen.h @@ -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) \ diff --git a/src/full-codegen/arm/full-codegen-arm.cc b/src/full-codegen/arm/full-codegen-arm.cc index 701e7fb031..0a3e11ce92 100644 --- a/src/full-codegen/arm/full-codegen-arm.cc +++ b/src/full-codegen/arm/full-codegen-arm.cc @@ -3094,7 +3094,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { } -void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { +void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) { ZoneList* args = expr->arguments(); DCHECK(args->length() == 1); diff --git a/src/full-codegen/arm64/full-codegen-arm64.cc b/src/full-codegen/arm64/full-codegen-arm64.cc index ea5b14fb5b..02fa9b9081 100644 --- a/src/full-codegen/arm64/full-codegen-arm64.cc +++ b/src/full-codegen/arm64/full-codegen-arm64.cc @@ -2803,7 +2803,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { } -void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { +void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) { ZoneList* args = expr->arguments(); DCHECK(args->length() == 1); diff --git a/src/full-codegen/full-codegen.h b/src/full-codegen/full-codegen.h index 22f3710a11..4607aff56f 100644 --- a/src/full-codegen/full-codegen.h +++ b/src/full-codegen/full-codegen.h @@ -492,7 +492,7 @@ class FullCodeGenerator: public AstVisitor { F(TwoByteSeqStringSetChar) \ F(ObjectEquals) \ F(IsFunction) \ - F(IsSpecObject) \ + F(IsJSReceiver) \ F(IsSimdValue) \ F(MathPow) \ F(IsMinusZero) \ diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc b/src/full-codegen/ia32/full-codegen-ia32.cc index 6b9051dd2d..a68b61fd71 100644 --- a/src/full-codegen/ia32/full-codegen-ia32.cc +++ b/src/full-codegen/ia32/full-codegen-ia32.cc @@ -2978,7 +2978,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { } -void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { +void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) { ZoneList* args = expr->arguments(); DCHECK(args->length() == 1); diff --git a/src/full-codegen/mips/full-codegen-mips.cc b/src/full-codegen/mips/full-codegen-mips.cc index 1046d9bf03..7a98e32bbd 100644 --- a/src/full-codegen/mips/full-codegen-mips.cc +++ b/src/full-codegen/mips/full-codegen-mips.cc @@ -3085,7 +3085,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { } -void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { +void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) { ZoneList* args = expr->arguments(); DCHECK(args->length() == 1); diff --git a/src/full-codegen/mips64/full-codegen-mips64.cc b/src/full-codegen/mips64/full-codegen-mips64.cc index 9b430b8f65..5a85192bb8 100644 --- a/src/full-codegen/mips64/full-codegen-mips64.cc +++ b/src/full-codegen/mips64/full-codegen-mips64.cc @@ -3089,7 +3089,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { } -void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { +void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) { ZoneList* args = expr->arguments(); DCHECK(args->length() == 1); diff --git a/src/full-codegen/ppc/full-codegen-ppc.cc b/src/full-codegen/ppc/full-codegen-ppc.cc index c95507334a..2017faac86 100644 --- a/src/full-codegen/ppc/full-codegen-ppc.cc +++ b/src/full-codegen/ppc/full-codegen-ppc.cc @@ -3089,7 +3089,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { } -void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { +void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) { ZoneList* args = expr->arguments(); DCHECK(args->length() == 1); diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc index 432734e4f7..b2414a9283 100644 --- a/src/full-codegen/x64/full-codegen-x64.cc +++ b/src/full-codegen/x64/full-codegen-x64.cc @@ -2962,7 +2962,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { } -void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { +void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) { ZoneList* args = expr->arguments(); DCHECK(args->length() == 1); diff --git a/src/full-codegen/x87/full-codegen-x87.cc b/src/full-codegen/x87/full-codegen-x87.cc index 8a203b6835..e25b266410 100644 --- a/src/full-codegen/x87/full-codegen-x87.cc +++ b/src/full-codegen/x87/full-codegen-x87.cc @@ -2970,7 +2970,7 @@ void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { } -void FullCodeGenerator::EmitIsSpecObject(CallRuntime* expr) { +void FullCodeGenerator::EmitIsJSReceiver(CallRuntime* expr) { ZoneList* args = expr->arguments(); DCHECK(args->length() == 1); diff --git a/src/js/macros.py b/src/js/macros.py index 101ae338a9..1928411bfd 100644 --- a/src/js/macros.py +++ b/src/js/macros.py @@ -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)" diff --git a/src/parsing/parser.cc b/src/parsing/parser.cc index c4f481083c..968c78e205 100644 --- a/src/parsing/parser.cc +++ b/src/parsing/parser.cc @@ -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* is_spec_object_args = new (zone()) ZoneList(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* is_spec_object_args = new (zone()) ZoneList(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() diff --git a/src/parsing/parser.h b/src/parsing/parser.h index b27f551271..1ff58572f3 100644 --- a/src/parsing/parser.h +++ b/src/parsing/parser.h @@ -1102,7 +1102,7 @@ class Parser : public ParserBase { 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); diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc index 067ab86f16..26a55ac75b 100644 --- a/src/runtime/runtime-object.cc +++ b/src/runtime/runtime-object.cc @@ -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); diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h index 774f49bf3c..ed1705d47d 100644 --- a/src/runtime/runtime.h +++ b/src/runtime/runtime.h @@ -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) \ diff --git a/test/cctest/compiler/test-run-jscalls.cc b/test/cctest/compiler/test-run-jscalls.cc index 2688c622e1..fa074479c7 100644 --- a/test/cctest/compiler/test-run-jscalls.cc +++ b/test/cctest/compiler/test-run-jscalls.cc @@ -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()); diff --git a/test/mjsunit/constant-fold-control-instructions.js b/test/mjsunit/constant-fold-control-instructions.js index a6f5540cfd..eb4994591d 100644 --- a/test/mjsunit/constant-fold-control-instructions.js +++ b/test/mjsunit/constant-fold-control-instructions.js @@ -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)); diff --git a/test/mjsunit/regress/regress-995.js b/test/mjsunit/regress/regress-995.js index 6f3dac1330..3f99179104 100644 --- a/test/mjsunit/regress/regress-995.js +++ b/test/mjsunit/regress/regress-995.js @@ -33,7 +33,7 @@ // HHasInstance. function f(value) { - if (%_IsSpecObject(value)) { + if (%_IsJSReceiver(value)) { if ((%_IsArray(value))) assertTrue(false); } } diff --git a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc index c3f3b22d56..0c2568f566 100644 --- a/test/unittests/compiler/js-intrinsic-lowering-unittest.cc +++ b/test/unittests/compiler/js-intrinsic-lowering-unittest.cc @@ -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());