From dd8544495109804c632bfbcefc3c5c701e0a8c43 Mon Sep 17 00:00:00 2001 From: conradw Date: Mon, 8 Jun 2015 05:17:58 -0700 Subject: [PATCH] [strong] Refactor ObjectStrength into a replacement for strong boolean args Boolean "is_strong" parameters have begun to proliferate across areas where strong mode semantics are different. This CL repurposes the existing ObjectStrength enum as a replacement for them. BUG=v8:3956 LOG=N Review URL: https://codereview.chromium.org/1144183004 Cr-Commit-Position: refs/heads/master@{#28839} --- src/arm/code-stubs-arm.cc | 15 +-- src/arm/full-codegen-arm.cc | 18 ++-- src/arm/lithium-arm.h | 4 +- src/arm/lithium-codegen-arm.cc | 9 +- src/arm64/code-stubs-arm64.cc | 14 +-- src/arm64/full-codegen-arm64.cc | 19 ++-- src/arm64/lithium-arm64.h | 4 +- src/arm64/lithium-codegen-arm64.cc | 9 +- src/builtins.cc | 2 +- src/code-factory.cc | 9 +- src/code-factory.h | 4 +- src/code-stubs-hydrogen.cc | 42 ++++---- src/code-stubs.cc | 3 +- src/code-stubs.h | 19 ++-- src/compiler/js-generic-lowering.cc | 18 ++-- src/factory.cc | 9 +- src/factory.h | 26 +++-- src/globals.h | 33 +++++-- src/hydrogen-instructions.cc | 81 +++++++--------- src/hydrogen-instructions.h | 140 ++++++++++++--------------- src/hydrogen.cc | 76 +++++++-------- src/hydrogen.h | 12 +-- src/ia32/code-stubs-ia32.cc | 9 +- src/ia32/full-codegen-ia32.cc | 19 ++-- src/ia32/lithium-codegen-ia32.cc | 9 +- src/ia32/lithium-ia32.h | 4 +- src/ic/ic-state.cc | 23 +++-- src/ic/ic-state.h | 10 +- src/ic/ic.cc | 18 ++-- src/ic/ic.h | 6 +- src/isolate.cc | 8 +- src/isolate.h | 2 +- src/json-parser.h | 2 +- src/mips/code-stubs-mips.cc | 15 +-- src/mips/full-codegen-mips.cc | 18 ++-- src/mips/lithium-codegen-mips.cc | 9 +- src/mips/lithium-mips.h | 4 +- src/mips64/code-stubs-mips64.cc | 15 +-- src/mips64/full-codegen-mips64.cc | 18 ++-- src/mips64/lithium-codegen-mips64.cc | 9 +- src/mips64/lithium-mips64.h | 4 +- src/ppc/code-stubs-ppc.cc | 15 +-- src/ppc/full-codegen-ppc.cc | 18 ++-- src/ppc/lithium-codegen-ppc.cc | 9 +- src/ppc/lithium-ppc.h | 4 +- src/x64/code-stubs-x64.cc | 9 +- src/x64/full-codegen-x64.cc | 18 ++-- src/x64/lithium-codegen-x64.cc | 9 +- src/x64/lithium-x64.h | 4 +- src/x87/code-stubs-x87.cc | 9 +- src/x87/full-codegen-x87.cc | 19 ++-- src/x87/lithium-codegen-x87.cc | 9 +- test/cctest/test-heap.cc | 6 +- test/cctest/test-unboxed-doubles.cc | 12 +-- 54 files changed, 450 insertions(+), 459 deletions(-) diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc index ecd2082cd0..03e6862b5d 100644 --- a/src/arm/code-stubs-arm.cc +++ b/src/arm/code-stubs-arm.cc @@ -94,7 +94,7 @@ void InternalArrayNArgumentsConstructorStub::InitializeDescriptor( static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, - Condition cond, bool strong); + Condition cond, Strength strength); static void EmitSmiNonsmiComparison(MacroAssembler* masm, Register lhs, Register rhs, @@ -238,7 +238,7 @@ void DoubleToIStub::Generate(MacroAssembler* masm) { // Equality is almost reflexive (everything but NaN), so this is a test // for "identity and not NaN". static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, - Condition cond, bool strong) { + Condition cond, Strength strength) { Label not_identical; Label heap_number, return_equal; __ cmp(r0, r1); @@ -255,7 +255,7 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, // Call runtime on identical symbols since we need to throw a TypeError. __ cmp(r4, Operand(SYMBOL_TYPE)); __ b(eq, slow); - if (strong) { + if (is_strong(strength)) { // Call the runtime on anything that is converted in the semantics, since // we need to throw a TypeError. Smis have already been ruled out. __ cmp(r4, Operand(HEAP_NUMBER_TYPE)); @@ -273,7 +273,7 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, // Call runtime on identical symbols since we need to throw a TypeError. __ cmp(r4, Operand(SYMBOL_TYPE)); __ b(eq, slow); - if (strong) { + if (is_strong(strength)) { // Call the runtime on anything that is converted in the semantics, // since we need to throw a TypeError. Smis and heap numbers have // already been ruled out. @@ -577,7 +577,7 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { // Handle the case where the objects are identical. Either returns the answer // or goes to slow. Only falls through if the objects were not identical. - EmitIdenticalObjectComparison(masm, &slow, cc, strong()); + EmitIdenticalObjectComparison(masm, &slow, cc, strength()); // If either is a Smi (we know that not both are), then they can only // be strictly equal if the other is a HeapNumber. @@ -679,7 +679,8 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { if (cc == eq) { native = strict() ? Builtins::STRICT_EQUALS : Builtins::EQUALS; } else { - native = strong() ? Builtins::COMPARE_STRONG : Builtins::COMPARE; + native = + is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; int ncr; // NaN compare result if (cc == lt || cc == le) { ncr = GREATER; @@ -3582,7 +3583,7 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) { __ bind(&unordered); __ bind(&generic_stub); - CompareICStub stub(isolate(), op(), strong(), CompareICState::GENERIC, + CompareICStub stub(isolate(), op(), strength(), CompareICState::GENERIC, CompareICState::GENERIC, CompareICState::GENERIC); __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc index 8f93c0cceb..95f3c8c061 100644 --- a/src/arm/full-codegen-arm.cc +++ b/src/arm/full-codegen-arm.cc @@ -1080,7 +1080,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { // Record position before stub call for type feedback. SetSourcePosition(clause->position()); Handle ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, - language_mode()).code(); + strength(language_mode())).code(); CallIC(ic, clause->CompareId()); patch_site.EmitPatchInfo(); @@ -2480,8 +2480,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, patch_site.EmitJumpIfSmi(scratch1, &smi_case); __ bind(&stub_call); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); __ jmp(&done); @@ -2634,8 +2634,8 @@ void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { __ pop(r1); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); @@ -5044,8 +5044,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { // Record position before stub call. SetSourcePosition(expr->position()); - Handle code = CodeFactory::BinaryOpIC( - isolate(), Token::ADD, language_mode()).code(); + Handle code = CodeFactory::BinaryOpIC(isolate(), Token::ADD, + strength(language_mode())).code(); CallIC(code, expr->CountBinOpFeedbackId()); patch_site.EmitPatchInfo(); __ bind(&done); @@ -5311,8 +5311,8 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { // Record position and call the compare IC. SetSourcePosition(expr->position()); - Handle ic = - CodeFactory::CompareIC(isolate(), op, language_mode()).code(); + Handle ic = CodeFactory::CompareIC( + isolate(), op, strength(language_mode())).code(); CallIC(ic, expr->CompareOperationFeedbackId()); patch_site.EmitPatchInfo(); PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); diff --git a/src/arm/lithium-arm.h b/src/arm/lithium-arm.h index 1891d5c222..b92f5b6d21 100644 --- a/src/arm/lithium-arm.h +++ b/src/arm/lithium-arm.h @@ -1176,7 +1176,7 @@ class LCmpT final : public LTemplateInstruction<1, 3, 0> { DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") DECLARE_HYDROGEN_ACCESSOR(CompareGeneric) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } Token::Value op() const { return hydrogen()->token(); } }; @@ -1549,7 +1549,7 @@ class LArithmeticT final : public LTemplateInstruction<1, 3, 0> { DECLARE_HYDROGEN_ACCESSOR(BinaryOperation) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } private: Token::Value op_; diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc index 1cc0b0d1a2..957af0baa5 100644 --- a/src/arm/lithium-codegen-arm.cc +++ b/src/arm/lithium-codegen-arm.cc @@ -2159,8 +2159,8 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) { DCHECK(ToRegister(instr->right()).is(r0)); DCHECK(ToRegister(instr->result()).is(r0)); - Handle code = CodeFactory::BinaryOpIC( - isolate(), instr->op(), instr->language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), instr->op(), instr->strength()).code(); // Block literal pool emission to ensure nop indicating no inlined smi code // is in the correct position. Assembler::BlockConstPoolScope block_const_pool(masm()); @@ -2596,7 +2596,8 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { DCHECK(ToRegister(instr->context()).is(cp)); Token::Value op = instr->op(); - Handle ic = CodeFactory::CompareIC(isolate(), op, SLOPPY).code(); + Handle ic = + CodeFactory::CompareIC(isolate(), op, Strength::WEAK).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); // This instruction also signals no smi code inlined. __ cmp(r0, Operand::Zero()); @@ -2914,7 +2915,7 @@ void LCodeGen::DoCmpT(LCmpT* instr) { Token::Value op = instr->op(); Handle ic = - CodeFactory::CompareIC(isolate(), op, instr->language_mode()).code(); + CodeFactory::CompareIC(isolate(), op, instr->strength()).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); // This instruction also signals no smi code inlined. __ cmp(r0, Operand::Zero()); diff --git a/src/arm64/code-stubs-arm64.cc b/src/arm64/code-stubs-arm64.cc index 5e0778ebad..bd701502ef 100644 --- a/src/arm64/code-stubs-arm64.cc +++ b/src/arm64/code-stubs-arm64.cc @@ -207,7 +207,7 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Register left, Register right, Register scratch, FPRegister double_scratch, Label* slow, Condition cond, - bool strong) { + Strength strength) { DCHECK(!AreAliased(left, right, scratch)); Label not_identical, return_equal, heap_number; Register result = x0; @@ -227,7 +227,7 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Register left, // Call runtime on identical symbols since we need to throw a TypeError. __ Cmp(right_type, SYMBOL_TYPE); __ B(eq, slow); - if (strong) { + if (is_strong(strength)) { // Call the runtime on anything that is converted in the semantics, since // we need to throw a TypeError. Smis have already been ruled out. __ Cmp(right_type, Operand(HEAP_NUMBER_TYPE)); @@ -246,7 +246,7 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Register left, // Call runtime on identical symbols since we need to throw a TypeError. __ Cmp(right_type, SYMBOL_TYPE); __ B(eq, slow); - if (strong) { + if (is_strong(strength)) { // Call the runtime on anything that is converted in the semantics, // since we need to throw a TypeError. Smis and heap numbers have // already been ruled out. @@ -529,7 +529,8 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { // Handle the case where the objects are identical. Either returns the answer // or goes to slow. Only falls through if the objects were not identical. - EmitIdenticalObjectComparison(masm, lhs, rhs, x10, d0, &slow, cond, strong()); + EmitIdenticalObjectComparison(masm, lhs, rhs, x10, d0, &slow, cond, + strength()); // If either is a smi (we know that at least one is not a smi), then they can // only be strictly equal if the other is a HeapNumber. @@ -648,7 +649,8 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { if (cond == eq) { native = strict() ? Builtins::STRICT_EQUALS : Builtins::EQUALS; } else { - native = strong() ? Builtins::COMPARE_STRONG : Builtins::COMPARE; + native = + is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; int ncr; // NaN compare result if ((cond == lt) || (cond == le)) { ncr = GREATER; @@ -3502,7 +3504,7 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) { __ Ret(); __ Bind(&unordered); - CompareICStub stub(isolate(), op(), strong(), CompareICState::GENERIC, + CompareICStub stub(isolate(), op(), strength(), CompareICState::GENERIC, CompareICState::GENERIC, CompareICState::GENERIC); __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); diff --git a/src/arm64/full-codegen-arm64.cc b/src/arm64/full-codegen-arm64.cc index 02b932d50f..cdc615ea5a 100644 --- a/src/arm64/full-codegen-arm64.cc +++ b/src/arm64/full-codegen-arm64.cc @@ -1074,7 +1074,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { // Record position before stub call for type feedback. SetSourcePosition(clause->position()); Handle ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, - language_mode()).code(); + strength(language_mode())).code(); CallIC(ic, clause->CompareId()); patch_site.EmitPatchInfo(); @@ -2148,8 +2148,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, __ Bind(&stub_call); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); { Assembler::BlockPoolsScope scope(masm_); CallIC(code, expr->BinaryOperationFeedbackId()); @@ -2231,8 +2231,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { __ Pop(x1); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); JumpPatchSite patch_site(masm_); // Unbound, signals no inlined smi code. { Assembler::BlockPoolsScope scope(masm_); @@ -4722,8 +4722,9 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { { Assembler::BlockPoolsScope scope(masm_); - Handle code = CodeFactory::BinaryOpIC( - isolate(), Token::ADD, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), Token::ADD, + strength(language_mode())).code(); CallIC(code, expr->CountBinOpFeedbackId()); patch_site.EmitPatchInfo(); } @@ -4998,8 +4999,8 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { // Record position and call the compare IC. SetSourcePosition(expr->position()); - Handle ic = - CodeFactory::CompareIC(isolate(), op, language_mode()).code(); + Handle ic = CodeFactory::CompareIC( + isolate(), op, strength(language_mode())).code(); CallIC(ic, expr->CompareOperationFeedbackId()); patch_site.EmitPatchInfo(); PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); diff --git a/src/arm64/lithium-arm64.h b/src/arm64/lithium-arm64.h index 5457f9ceed..57611362fd 100644 --- a/src/arm64/lithium-arm64.h +++ b/src/arm64/lithium-arm64.h @@ -719,7 +719,7 @@ class LArithmeticT final : public LTemplateInstruction<1, 3, 0> { DECLARE_HYDROGEN_ACCESSOR(BinaryOperation) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } private: Token::Value op_; @@ -1161,7 +1161,7 @@ class LCmpT final : public LTemplateInstruction<1, 3, 0> { DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") DECLARE_HYDROGEN_ACCESSOR(CompareGeneric) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } Token::Value op() const { return hydrogen()->token(); } }; diff --git a/src/arm64/lithium-codegen-arm64.cc b/src/arm64/lithium-codegen-arm64.cc index 461da112cd..b49a6c22dc 100644 --- a/src/arm64/lithium-codegen-arm64.cc +++ b/src/arm64/lithium-codegen-arm64.cc @@ -1769,8 +1769,8 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) { DCHECK(ToRegister(instr->right()).is(x0)); DCHECK(ToRegister(instr->result()).is(x0)); - Handle code = CodeFactory::BinaryOpIC( - isolate(), instr->op(), instr->language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), instr->op(), instr->strength()).code(); CallCode(code, RelocInfo::CODE_TARGET, instr); } @@ -2529,7 +2529,7 @@ void LCodeGen::DoCmpT(LCmpT* instr) { DCHECK(ToRegister(instr->left()).Is(x1)); DCHECK(ToRegister(instr->right()).Is(x0)); Handle ic = - CodeFactory::CompareIC(isolate(), op, instr->language_mode()).code(); + CodeFactory::CompareIC(isolate(), op, instr->strength()).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); // Signal that we don't inline smi code before this stub. InlineSmiCheckInfo::EmitNotInlined(masm()); @@ -5593,7 +5593,8 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { DCHECK(ToRegister(instr->context()).is(cp)); Token::Value op = instr->op(); - Handle ic = CodeFactory::CompareIC(isolate(), op, SLOPPY).code(); + Handle ic = + CodeFactory::CompareIC(isolate(), op, Strength::WEAK).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); InlineSmiCheckInfo::EmitNotInlined(masm()); diff --git a/src/builtins.cc b/src/builtins.cc index 7ac60da66a..506492f46e 100644 --- a/src/builtins.cc +++ b/src/builtins.cc @@ -989,7 +989,7 @@ BUILTIN(ArrayConcat) { has_double && IsFastObjectElementsKind(elements_kind) ? INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE : DONT_INITIALIZE_ARRAY_ELEMENTS; Handle result_array = isolate->factory()->NewJSArray( - elements_kind, result_len, result_len, WEAK, mode); + elements_kind, result_len, result_len, Strength::WEAK, mode); if (result_len == 0) return *result_array; int j = 0; diff --git a/src/code-factory.cc b/src/code-factory.cc index 92cd4ac77e..fc7ea4aa36 100644 --- a/src/code-factory.cc +++ b/src/code-factory.cc @@ -95,17 +95,16 @@ Callable CodeFactory::KeyedStoreICInOptimizedCode( // static Callable CodeFactory::CompareIC(Isolate* isolate, Token::Value op, - LanguageMode language_mode) { - Handle code = - CompareIC::GetUninitialized(isolate, op, is_strong(language_mode)); + Strength strength) { + Handle code = CompareIC::GetUninitialized(isolate, op, strength); return Callable(code, CompareDescriptor(isolate)); } // static Callable CodeFactory::BinaryOpIC(Isolate* isolate, Token::Value op, - LanguageMode language_mode) { - BinaryOpICStub stub(isolate, op, language_mode); + Strength strength) { + BinaryOpICStub stub(isolate, op, strength); return Callable(stub.GetCode(), stub.GetCallInterfaceDescriptor()); } diff --git a/src/code-factory.h b/src/code-factory.h index 156c1f820f..e26fc092fa 100644 --- a/src/code-factory.h +++ b/src/code-factory.h @@ -49,10 +49,10 @@ class CodeFactory final { InlineCacheState initialization_state); static Callable CompareIC(Isolate* isolate, Token::Value op, - LanguageMode language_mode); + Strength strength); static Callable BinaryOpIC(Isolate* isolate, Token::Value op, - LanguageMode language_mode); + Strength strength); // Code stubs. Add methods here as needed to reduce dependency on // code-stubs.h. diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc index cc65922d5e..45303bd146 100644 --- a/src/code-stubs-hydrogen.cc +++ b/src/code-stubs-hydrogen.cc @@ -1361,19 +1361,16 @@ HValue* CodeStubGraphBuilder::BuildCodeInitializedStub() { if_leftisstring.If(left); if_leftisstring.Then(); { - Push(BuildBinaryOperation( - state.op(), left, right, - Type::String(zone()), right_type, - result_type, state.fixed_right_arg(), - allocation_mode, state.language_mode())); + Push(BuildBinaryOperation(state.op(), left, right, Type::String(zone()), + right_type, result_type, + state.fixed_right_arg(), allocation_mode, + state.strength())); } if_leftisstring.Else(); { Push(BuildBinaryOperation( - state.op(), left, right, - left_type, right_type, result_type, - state.fixed_right_arg(), allocation_mode, - state.language_mode())); + state.op(), left, right, left_type, right_type, result_type, + state.fixed_right_arg(), allocation_mode, state.strength())); } if_leftisstring.End(); result = Pop(); @@ -1382,28 +1379,24 @@ HValue* CodeStubGraphBuilder::BuildCodeInitializedStub() { if_rightisstring.If(right); if_rightisstring.Then(); { - Push(BuildBinaryOperation( - state.op(), left, right, - left_type, Type::String(zone()), - result_type, state.fixed_right_arg(), - allocation_mode, state.language_mode())); + Push(BuildBinaryOperation(state.op(), left, right, left_type, + Type::String(zone()), result_type, + state.fixed_right_arg(), allocation_mode, + state.strength())); } if_rightisstring.Else(); { Push(BuildBinaryOperation( - state.op(), left, right, - left_type, right_type, result_type, - state.fixed_right_arg(), allocation_mode, - state.language_mode())); + state.op(), left, right, left_type, right_type, result_type, + state.fixed_right_arg(), allocation_mode, state.strength())); } if_rightisstring.End(); result = Pop(); } } else { result = BuildBinaryOperation( - state.op(), left, right, - left_type, right_type, result_type, - state.fixed_right_arg(), allocation_mode, state.language_mode()); + state.op(), left, right, left_type, right_type, result_type, + state.fixed_right_arg(), allocation_mode, state.strength()); } // If we encounter a generic argument, the number conversion is @@ -1435,10 +1428,9 @@ HValue* CodeStubGraphBuilder::BuildCodeStub() { Type* result_type = state.GetResultType(zone()); HAllocationMode allocation_mode(allocation_site); - return BuildBinaryOperation(state.op(), left, right, - left_type, right_type, result_type, - state.fixed_right_arg(), allocation_mode, - state.language_mode()); + return BuildBinaryOperation(state.op(), left, right, left_type, right_type, + result_type, state.fixed_right_arg(), + allocation_mode, state.strength()); } diff --git a/src/code-stubs.cc b/src/code-stubs.cc index 5fb6f26290..c007199691 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -269,8 +269,7 @@ MaybeHandle CodeStub::GetCode(Isolate* isolate, uint32_t key) { void BinaryOpICStub::GenerateAheadOfTime(Isolate* isolate) { // Generate the uninitialized versions of the stub. for (int op = Token::BIT_OR; op <= Token::MOD; ++op) { - BinaryOpICStub stub(isolate, static_cast(op), - LanguageMode::SLOPPY); + BinaryOpICStub stub(isolate, static_cast(op), Strength::WEAK); stub.GetCode(); } diff --git a/src/code-stubs.h b/src/code-stubs.h index 77a2f8bba3..515f2e578e 100644 --- a/src/code-stubs.h +++ b/src/code-stubs.h @@ -1421,9 +1421,9 @@ class CallApiGetterStub : public PlatformCodeStub { class BinaryOpICStub : public HydrogenCodeStub { public: - BinaryOpICStub(Isolate* isolate, Token::Value op, LanguageMode language_mode) + BinaryOpICStub(Isolate* isolate, Token::Value op, Strength strength) : HydrogenCodeStub(isolate, UNINITIALIZED) { - BinaryOpICState state(isolate, op, language_mode); + BinaryOpICState state(isolate, op, strength); set_sub_minor_key(state.GetExtraICState()); } @@ -1505,8 +1505,8 @@ class BinaryOpICWithAllocationSiteStub final : public PlatformCodeStub { class BinaryOpWithAllocationSiteStub final : public BinaryOpICStub { public: BinaryOpWithAllocationSiteStub(Isolate* isolate, Token::Value op, - LanguageMode language_mode) - : BinaryOpICStub(isolate, op, language_mode) {} + Strength strength) + : BinaryOpICStub(isolate, op, strength) {} BinaryOpWithAllocationSiteStub(Isolate* isolate, const BinaryOpICState& state) : BinaryOpICStub(isolate, state) {} @@ -1557,12 +1557,13 @@ class StringAddStub final : public HydrogenCodeStub { class CompareICStub : public PlatformCodeStub { public: - CompareICStub(Isolate* isolate, Token::Value op, bool strong, + CompareICStub(Isolate* isolate, Token::Value op, Strength strength, CompareICState::State left, CompareICState::State right, CompareICState::State state) : PlatformCodeStub(isolate) { DCHECK(Token::IsCompareOp(op)); - minor_key_ = OpBits::encode(op - Token::EQ) | StrongBits::encode(strong) | + minor_key_ = OpBits::encode(op - Token::EQ) | + StrengthBits::encode(is_strong(strength)) | LeftStateBits::encode(left) | RightStateBits::encode(right) | StateBits::encode(state); } @@ -1575,7 +1576,9 @@ class CompareICStub : public PlatformCodeStub { return static_cast(Token::EQ + OpBits::decode(minor_key_)); } - bool strong() const { return StrongBits::decode(minor_key_); } + Strength strength() const { + return StrengthBits::decode(minor_key_) ? Strength::STRONG : Strength::WEAK; + } CompareICState::State left() const { return LeftStateBits::decode(minor_key_); @@ -1608,7 +1611,7 @@ class CompareICStub : public PlatformCodeStub { } class OpBits : public BitField {}; - class StrongBits : public BitField {}; + class StrengthBits : public BitField {}; class LeftStateBits : public BitField {}; class RightStateBits : public BitField {}; class StateBits : public BitField {}; diff --git a/src/compiler/js-generic-lowering.cc b/src/compiler/js-generic-lowering.cc index 3fc0496450..9eaef252e6 100644 --- a/src/compiler/js-generic-lowering.cc +++ b/src/compiler/js-generic-lowering.cc @@ -65,13 +65,13 @@ Reduction JSGenericLowering::Reduce(Node* node) { } -#define REPLACE_BINARY_OP_IC_CALL(op, token) \ - void JSGenericLowering::Lower##op(Node* node) { \ - CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ - ReplaceWithStubCall( \ - node, CodeFactory::BinaryOpIC(isolate(), token, \ - OpParameter(node)), \ - CallDescriptor::kPatchableCallSiteWithNop | flags); \ +#define REPLACE_BINARY_OP_IC_CALL(op, token) \ + void JSGenericLowering::Lower##op(Node* node) { \ + CallDescriptor::Flags flags = AdjustFrameStatesForCall(node); \ + ReplaceWithStubCall(node, CodeFactory::BinaryOpIC( \ + isolate(), token, \ + strength(OpParameter(node))), \ + CallDescriptor::kPatchableCallSiteWithNop | flags); \ } REPLACE_BINARY_OP_IC_CALL(JSBitwiseOr, Token::BIT_OR) REPLACE_BINARY_OP_IC_CALL(JSBitwiseXor, Token::BIT_XOR) @@ -131,8 +131,8 @@ static CallDescriptor::Flags FlagsForNode(Node* node) { void JSGenericLowering::ReplaceWithCompareIC(Node* node, Token::Value token) { - Callable callable = - CodeFactory::CompareIC(isolate(), token, OpParameter(node)); + Callable callable = CodeFactory::CompareIC( + isolate(), token, strength(OpParameter(node))); // Create a new call node asking a CompareIC for help. NodeVector inputs(zone()); diff --git a/src/factory.cc b/src/factory.cc index 4aca885456..a16e6fba05 100644 --- a/src/factory.cc +++ b/src/factory.cc @@ -1609,11 +1609,11 @@ Handle Factory::NewJSObjectFromMap( Handle Factory::NewJSArray(ElementsKind elements_kind, - ObjectStrength strength, + Strength strength, PretenureFlag pretenure) { Map* map = isolate()->get_initial_js_array_map(elements_kind, strength); if (map == nullptr) { - DCHECK(strength == WEAK); + DCHECK(strength == Strength::WEAK); Context* native_context = isolate()->context()->native_context(); JSFunction* array_function = native_context->array_function(); map = array_function->initial_map(); @@ -1623,7 +1623,7 @@ Handle Factory::NewJSArray(ElementsKind elements_kind, Handle Factory::NewJSArray(ElementsKind elements_kind, int length, - int capacity, ObjectStrength strength, + int capacity, Strength strength, ArrayStorageAllocationMode mode, PretenureFlag pretenure) { Handle array = NewJSArray(elements_kind, strength, pretenure); @@ -1634,8 +1634,7 @@ Handle Factory::NewJSArray(ElementsKind elements_kind, int length, Handle Factory::NewJSArrayWithElements(Handle elements, ElementsKind elements_kind, - int length, - ObjectStrength strength, + int length, Strength strength, PretenureFlag pretenure) { DCHECK(length <= elements->length()); Handle array = NewJSArray(elements_kind, strength, pretenure); diff --git a/src/factory.h b/src/factory.h index 8b6fadab6f..cd00487c7a 100644 --- a/src/factory.h +++ b/src/factory.h @@ -390,23 +390,21 @@ class Factory final { // JS arrays are pretenured when allocated by the parser. // Create a JSArray with no elements. - Handle NewJSArray( - ElementsKind elements_kind, - ObjectStrength strength = WEAK, - PretenureFlag pretenure = NOT_TENURED); + Handle NewJSArray(ElementsKind elements_kind, + Strength strength = Strength::WEAK, + PretenureFlag pretenure = NOT_TENURED); // Create a JSArray with a specified length and elements initialized // according to the specified mode. Handle NewJSArray( ElementsKind elements_kind, int length, int capacity, - ObjectStrength strength = WEAK, + Strength strength = Strength::WEAK, ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, PretenureFlag pretenure = NOT_TENURED); Handle NewJSArray( - int capacity, - ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, - ObjectStrength strength = WEAK, + int capacity, ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, + Strength strength = Strength::WEAK, PretenureFlag pretenure = NOT_TENURED) { if (capacity != 0) { elements_kind = GetHoleyElementsKind(elements_kind); @@ -416,17 +414,15 @@ class Factory final { } // Create a JSArray with the given elements. - Handle NewJSArrayWithElements( - Handle elements, - ElementsKind elements_kind, - int length, - ObjectStrength strength = WEAK, - PretenureFlag pretenure = NOT_TENURED); + Handle NewJSArrayWithElements(Handle elements, + ElementsKind elements_kind, int length, + Strength strength = Strength::WEAK, + PretenureFlag pretenure = NOT_TENURED); Handle NewJSArrayWithElements( Handle elements, ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, - ObjectStrength strength = WEAK, + Strength strength = Strength::WEAK, PretenureFlag pretenure = NOT_TENURED) { return NewJSArrayWithElements(elements, elements_kind, elements->length(), strength, pretenure); diff --git a/src/globals.h b/src/globals.h index f01c10044e..cde58c9d58 100644 --- a/src/globals.h +++ b/src/globals.h @@ -233,11 +233,6 @@ template class List; // ----------------------------------------------------------------------------- // Declarations for use in both the preparser and the rest of V8. -enum ObjectStrength { - WEAK, - FIRM // strong object -}; - // The Strict Mode (ECMA-262 5th edition, 4.2.2). enum LanguageMode { @@ -297,8 +292,32 @@ inline LanguageMode construct_language_mode(bool strict_bit, bool strong_bit) { } -inline ObjectStrength strength(LanguageMode language_mode) { - return is_strong(language_mode) ? FIRM : WEAK; +// Strong mode behaviour must sometimes be signalled by a two valued enum where +// caching is involved, to prevent sloppy and strict mode from being incorrectly +// differentiated. +enum class Strength : bool { + WEAK, // sloppy, strict behaviour + STRONG // strong behaviour +}; + + +inline bool is_strong(Strength strength) { + return strength == Strength::STRONG; +} + + +inline std::ostream& operator<<(std::ostream& os, const Strength& strength) { + return os << (is_strong(strength) ? "strong" : "weak"); +} + + +inline Strength strength(LanguageMode language_mode) { + return is_strong(language_mode) ? Strength::STRONG : Strength::WEAK; +} + + +inline size_t hash_value(Strength strength) { + return static_cast(strength); } diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index 00855a8933..c0a1443b0f 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -3971,22 +3971,21 @@ bool HStoreKeyed::NeedsCanonicalization() { #define H_CONSTANT_DOUBLE(val) \ HConstant::New(isolate, zone, context, static_cast(val)) -#define DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HInstr, op) \ - HInstruction* HInstr::New(Isolate* isolate, Zone* zone, HValue* context, \ - HValue* left, HValue* right, \ - LanguageMode language_mode) { \ - if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { \ - HConstant* c_left = HConstant::cast(left); \ - HConstant* c_right = HConstant::cast(right); \ - if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { \ - double double_res = c_left->DoubleValue() op c_right->DoubleValue(); \ - if (IsInt32Double(double_res)) { \ - return H_CONSTANT_INT(double_res); \ - } \ - return H_CONSTANT_DOUBLE(double_res); \ - } \ - } \ - return new (zone) HInstr(context, left, right, language_mode); \ +#define DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HInstr, op) \ + HInstruction* HInstr::New(Isolate* isolate, Zone* zone, HValue* context, \ + HValue* left, HValue* right, Strength strength) { \ + if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { \ + HConstant* c_left = HConstant::cast(left); \ + HConstant* c_right = HConstant::cast(right); \ + if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { \ + double double_res = c_left->DoubleValue() op c_right->DoubleValue(); \ + if (IsInt32Double(double_res)) { \ + return H_CONSTANT_INT(double_res); \ + } \ + return H_CONSTANT_DOUBLE(double_res); \ + } \ + } \ + return new (zone) HInstr(context, left, right, strength); \ } @@ -3998,8 +3997,7 @@ DEFINE_NEW_H_SIMPLE_ARITHMETIC_INSTR(HSub, -) HInstruction* HStringAdd::New(Isolate* isolate, Zone* zone, HValue* context, - HValue* left, HValue* right, - LanguageMode language_mode, + HValue* left, HValue* right, Strength strength, PretenureFlag pretenure_flag, StringAddFlags flags, Handle allocation_site) { @@ -4017,9 +4015,8 @@ HInstruction* HStringAdd::New(Isolate* isolate, Zone* zone, HValue* context, } } } - return new(zone) HStringAdd( - context, left, right, language_mode, pretenure_flag, flags, - allocation_site); + return new (zone) HStringAdd(context, left, right, strength, pretenure_flag, + flags, allocation_site); } @@ -4217,8 +4214,7 @@ HInstruction* HMathMinMax::New(Isolate* isolate, Zone* zone, HValue* context, HInstruction* HMod::New(Isolate* isolate, Zone* zone, HValue* context, - HValue* left, HValue* right, - LanguageMode language_mode) { + HValue* left, HValue* right, Strength strength) { if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { HConstant* c_left = HConstant::cast(left); HConstant* c_right = HConstant::cast(right); @@ -4237,13 +4233,12 @@ HInstruction* HMod::New(Isolate* isolate, Zone* zone, HValue* context, } } } - return new(zone) HMod(context, left, right, language_mode); + return new (zone) HMod(context, left, right, strength); } HInstruction* HDiv::New(Isolate* isolate, Zone* zone, HValue* context, - HValue* left, HValue* right, - LanguageMode language_mode) { + HValue* left, HValue* right, Strength strength) { // If left and right are constant values, try to return a constant value. if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { HConstant* c_left = HConstant::cast(left); @@ -4262,13 +4257,13 @@ HInstruction* HDiv::New(Isolate* isolate, Zone* zone, HValue* context, } } } - return new(zone) HDiv(context, left, right, language_mode); + return new (zone) HDiv(context, left, right, strength); } HInstruction* HBitwise::New(Isolate* isolate, Zone* zone, HValue* context, Token::Value op, HValue* left, HValue* right, - LanguageMode language_mode) { + Strength strength) { if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { HConstant* c_left = HConstant::cast(left); HConstant* c_right = HConstant::cast(right); @@ -4293,22 +4288,21 @@ HInstruction* HBitwise::New(Isolate* isolate, Zone* zone, HValue* context, return H_CONSTANT_INT(result); } } - return new(zone) HBitwise(context, op, left, right, language_mode); + return new (zone) HBitwise(context, op, left, right, strength); } -#define DEFINE_NEW_H_BITWISE_INSTR(HInstr, result) \ - HInstruction* HInstr::New(Isolate* isolate, Zone* zone, HValue* context, \ - HValue* left, HValue* right, \ - LanguageMode language_mode) { \ - if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { \ - HConstant* c_left = HConstant::cast(left); \ - HConstant* c_right = HConstant::cast(right); \ - if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { \ - return H_CONSTANT_INT(result); \ - } \ - } \ - return new (zone) HInstr(context, left, right, language_mode); \ +#define DEFINE_NEW_H_BITWISE_INSTR(HInstr, result) \ + HInstruction* HInstr::New(Isolate* isolate, Zone* zone, HValue* context, \ + HValue* left, HValue* right, Strength strength) { \ + if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { \ + HConstant* c_left = HConstant::cast(left); \ + HConstant* c_right = HConstant::cast(right); \ + if ((c_left->HasNumberValue() && c_right->HasNumberValue())) { \ + return H_CONSTANT_INT(result); \ + } \ + } \ + return new (zone) HInstr(context, left, right, strength); \ } @@ -4321,8 +4315,7 @@ c_left->NumberValueAsInteger32() << (c_right->NumberValueAsInteger32() & 0x1f)) HInstruction* HShr::New(Isolate* isolate, Zone* zone, HValue* context, - HValue* left, HValue* right, - LanguageMode language_mode) { + HValue* left, HValue* right, Strength strength) { if (FLAG_fold_constants && left->IsConstant() && right->IsConstant()) { HConstant* c_left = HConstant::cast(left); HConstant* c_right = HConstant::cast(right); @@ -4335,7 +4328,7 @@ HInstruction* HShr::New(Isolate* isolate, Zone* zone, HValue* context, return H_CONSTANT_INT(static_cast(left_val) >> right_val); } } - return new(zone) HShr(context, left, right, language_mode); + return new (zone) HShr(context, left, right, strength); } diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 7e6181ecad..9d48a22333 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -3780,8 +3780,9 @@ class HConstant final : public HTemplateInstruction<0> { class HBinaryOperation : public HTemplateInstruction<3> { public: HBinaryOperation(HValue* context, HValue* left, HValue* right, - LanguageMode language_mode, HType type = HType::Tagged()) - : HTemplateInstruction<3>(type), language_mode_(language_mode), + Strength strength, HType type = HType::Tagged()) + : HTemplateInstruction<3>(type), + strength_(strength), observed_output_representation_(Representation::None()) { DCHECK(left != NULL && right != NULL); SetOperandAt(0, context); @@ -3794,7 +3795,7 @@ class HBinaryOperation : public HTemplateInstruction<3> { HValue* context() const { return OperandAt(0); } HValue* left() const { return OperandAt(1); } HValue* right() const { return OperandAt(2); } - LanguageMode language_mode() const { return language_mode_; } + Strength strength() const { return strength_; } // True if switching left and right operands likely generates better code. bool AreOperandsBetterSwitched() { @@ -3870,15 +3871,13 @@ class HBinaryOperation : public HTemplateInstruction<3> { return base::bits::IsPowerOfTwo32(static_cast(value)); } - LanguageMode language_mode() { - return language_mode_; - } + Strength strength() { return strength_; } DECLARE_ABSTRACT_INSTRUCTION(BinaryOperation) private: bool IgnoreObservedOutputRepresentation(Representation current_rep); - LanguageMode language_mode_; + Strength strength_; Representation observed_input_representation_[2]; Representation observed_output_representation_; @@ -4148,9 +4147,8 @@ class HBoundsCheckBaseIndexInformation final : public HTemplateInstruction<2> { class HBitwiseBinaryOperation : public HBinaryOperation { public: HBitwiseBinaryOperation(HValue* context, HValue* left, HValue* right, - LanguageMode language_mode, - HType type = HType::TaggedNumber()) - : HBinaryOperation(context, left, right, language_mode, type) { + Strength strength, HType type = HType::TaggedNumber()) + : HBinaryOperation(context, left, right, strength, type) { SetFlag(kFlexibleRepresentation); SetFlag(kTruncatingToInt32); SetFlag(kAllowUndefinedAsNaN); @@ -4209,7 +4207,7 @@ class HMathFloorOfDiv final : public HBinaryOperation { private: HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) - : HBinaryOperation(context, left, right, SLOPPY) { + : HBinaryOperation(context, left, right, Strength::WEAK) { set_representation(Representation::Integer32()); SetFlag(kUseGVN); SetFlag(kCanOverflow); @@ -4229,8 +4227,8 @@ class HMathFloorOfDiv final : public HBinaryOperation { class HArithmeticBinaryOperation : public HBinaryOperation { public: HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right, - LanguageMode language_mode) - : HBinaryOperation(context, left, right, language_mode, + Strength strength) + : HBinaryOperation(context, left, right, strength, HType::TaggedNumber()) { SetAllSideEffects(); SetFlag(kFlexibleRepresentation); @@ -4259,10 +4257,9 @@ class HArithmeticBinaryOperation : public HBinaryOperation { class HCompareGeneric final : public HBinaryOperation { public: static HCompareGeneric* New(Isolate* isolate, Zone* zone, HValue* context, - HValue* left, HValue* right, Token::Value token, - LanguageMode language_mode = SLOPPY) { - return new(zone) HCompareGeneric(context, left, right, token, - language_mode); + HValue* left, HValue* right, Token::Value token, + Strength strength = Strength::WEAK) { + return new (zone) HCompareGeneric(context, left, right, token, strength); } Representation RequiredInputRepresentation(int index) override { @@ -4277,12 +4274,9 @@ class HCompareGeneric final : public HBinaryOperation { DECLARE_CONCRETE_INSTRUCTION(CompareGeneric) private: - HCompareGeneric(HValue* context, - HValue* left, - HValue* right, - Token::Value token, - LanguageMode language_mode) - : HBinaryOperation(context, left, right, language_mode, HType::Boolean()), + HCompareGeneric(HValue* context, HValue* left, HValue* right, + Token::Value token, Strength strength) + : HBinaryOperation(context, left, right, strength, HType::Boolean()), token_(token) { DCHECK(Token::IsCompareOp(token)); set_representation(Representation::Tagged()); @@ -4741,7 +4735,8 @@ class HInstanceOf final : public HBinaryOperation { private: HInstanceOf(HValue* context, HValue* left, HValue* right) - : HBinaryOperation(context, left, right, SLOPPY, HType::Boolean()) { + : HBinaryOperation(context, left, right, Strength::WEAK, + HType::Boolean()) { set_representation(Representation::Tagged()); SetAllSideEffects(); } @@ -4820,7 +4815,7 @@ class HAdd final : public HArithmeticBinaryOperation { public: static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, HValue* left, HValue* right, - LanguageMode language_mode = SLOPPY); + Strength strength = Strength::WEAK); // Add is only commutative if two integer values are added and not if two // tagged values are added (because it might be a String concatenation). @@ -4871,8 +4866,8 @@ class HAdd final : public HArithmeticBinaryOperation { Range* InferRange(Zone* zone) override; private: - HAdd(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) - : HArithmeticBinaryOperation(context, left, right, language_mode) { + HAdd(HValue* context, HValue* left, HValue* right, Strength strength) + : HArithmeticBinaryOperation(context, left, right, strength) { SetFlag(kCanOverflow); } }; @@ -4882,7 +4877,7 @@ class HSub final : public HArithmeticBinaryOperation { public: static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, HValue* left, HValue* right, - LanguageMode language_mode = SLOPPY); + Strength strength = Strength::WEAK); HValue* Canonicalize() override; @@ -4903,8 +4898,8 @@ class HSub final : public HArithmeticBinaryOperation { Range* InferRange(Zone* zone) override; private: - HSub(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) - : HArithmeticBinaryOperation(context, left, right, language_mode) { + HSub(HValue* context, HValue* left, HValue* right, Strength strength) + : HArithmeticBinaryOperation(context, left, right, strength) { SetFlag(kCanOverflow); } }; @@ -4914,13 +4909,13 @@ class HMul final : public HArithmeticBinaryOperation { public: static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, HValue* left, HValue* right, - LanguageMode language_mode = SLOPPY); + Strength strength = Strength::WEAK); static HInstruction* NewImul(Isolate* isolate, Zone* zone, HValue* context, HValue* left, HValue* right, - LanguageMode language_mode = SLOPPY) { - HInstruction* instr = HMul::New(isolate, zone, context, left, right, - language_mode); + Strength strength = Strength::WEAK) { + HInstruction* instr = + HMul::New(isolate, zone, context, left, right, strength); if (!instr->IsMul()) return instr; HMul* mul = HMul::cast(instr); // TODO(mstarzinger): Prevent bailout on minus zero for imul. @@ -4950,8 +4945,8 @@ class HMul final : public HArithmeticBinaryOperation { Range* InferRange(Zone* zone) override; private: - HMul(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) - : HArithmeticBinaryOperation(context, left, right, language_mode) { + HMul(HValue* context, HValue* left, HValue* right, Strength strength) + : HArithmeticBinaryOperation(context, left, right, strength) { SetFlag(kCanOverflow); } }; @@ -4961,7 +4956,7 @@ class HMod final : public HArithmeticBinaryOperation { public: static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, HValue* left, HValue* right, - LanguageMode language_mode = SLOPPY); + Strength strength = Strength::WEAK); HValue* Canonicalize() override; @@ -4980,12 +4975,8 @@ class HMod final : public HArithmeticBinaryOperation { Range* InferRange(Zone* zone) override; private: - HMod(HValue* context, - HValue* left, - HValue* right, - LanguageMode language_mode) : HArithmeticBinaryOperation(context, left, - right, - language_mode) { + HMod(HValue* context, HValue* left, HValue* right, Strength strength) + : HArithmeticBinaryOperation(context, left, right, strength) { SetFlag(kCanBeDivByZero); SetFlag(kCanOverflow); SetFlag(kLeftCanBeNegative); @@ -4997,7 +4988,7 @@ class HDiv final : public HArithmeticBinaryOperation { public: static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, HValue* left, HValue* right, - LanguageMode language_mode = SLOPPY); + Strength strength = Strength::WEAK); HValue* Canonicalize() override; @@ -5016,8 +5007,8 @@ class HDiv final : public HArithmeticBinaryOperation { Range* InferRange(Zone* zone) override; private: - HDiv(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) - : HArithmeticBinaryOperation(context, left, right, language_mode) { + HDiv(HValue* context, HValue* left, HValue* right, Strength strength) + : HArithmeticBinaryOperation(context, left, right, strength) { SetFlag(kCanBeDivByZero); SetFlag(kCanOverflow); } @@ -5063,8 +5054,8 @@ class HMathMinMax final : public HArithmeticBinaryOperation { private: HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) - : HArithmeticBinaryOperation(context, left, right, SLOPPY), - operation_(op) { } + : HArithmeticBinaryOperation(context, left, right, Strength::WEAK), + operation_(op) {} Operation operation_; }; @@ -5074,7 +5065,7 @@ class HBitwise final : public HBitwiseBinaryOperation { public: static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, Token::Value op, HValue* left, HValue* right, - LanguageMode language_mode = SLOPPY); + Strength strength = Strength::WEAK); Token::Value op() const { return op_; } @@ -5094,13 +5085,9 @@ class HBitwise final : public HBitwiseBinaryOperation { Range* InferRange(Zone* zone) override; private: - HBitwise(HValue* context, - Token::Value op, - HValue* left, - HValue* right, - LanguageMode language_mode) - : HBitwiseBinaryOperation(context, left, right, language_mode), - op_(op) { + HBitwise(HValue* context, Token::Value op, HValue* left, HValue* right, + Strength strength) + : HBitwiseBinaryOperation(context, left, right, strength), op_(op) { DCHECK(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); // BIT_AND with a smi-range positive value will always unset the // entire sign-extension of the smi-sign. @@ -5135,7 +5122,7 @@ class HShl final : public HBitwiseBinaryOperation { public: static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, HValue* left, HValue* right, - LanguageMode language_mode = SLOPPY); + Strength strength = Strength::WEAK); Range* InferRange(Zone* zone) override; @@ -5156,8 +5143,8 @@ class HShl final : public HBitwiseBinaryOperation { bool DataEquals(HValue* other) override { return true; } private: - HShl(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) - : HBitwiseBinaryOperation(context, left, right, language_mode) { } + HShl(HValue* context, HValue* left, HValue* right, Strength strength) + : HBitwiseBinaryOperation(context, left, right, strength) {} }; @@ -5165,7 +5152,7 @@ class HShr final : public HBitwiseBinaryOperation { public: static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, HValue* left, HValue* right, - LanguageMode language_mode = SLOPPY); + Strength strength = Strength::WEAK); bool TryDecompose(DecompositionResult* decomposition) override { if (right()->IsInteger32Constant()) { @@ -5194,8 +5181,8 @@ class HShr final : public HBitwiseBinaryOperation { bool DataEquals(HValue* other) override { return true; } private: - HShr(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) - : HBitwiseBinaryOperation(context, left, right, language_mode) { } + HShr(HValue* context, HValue* left, HValue* right, Strength strength) + : HBitwiseBinaryOperation(context, left, right, strength) {} }; @@ -5203,7 +5190,7 @@ class HSar final : public HBitwiseBinaryOperation { public: static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, HValue* left, HValue* right, - LanguageMode language_mode = SLOPPY); + Strength strength = Strength::WEAK); bool TryDecompose(DecompositionResult* decomposition) override { if (right()->IsInteger32Constant()) { @@ -5232,8 +5219,8 @@ class HSar final : public HBitwiseBinaryOperation { bool DataEquals(HValue* other) override { return true; } private: - HSar(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) - : HBitwiseBinaryOperation(context, left, right, language_mode) { } + HSar(HValue* context, HValue* left, HValue* right, Strength strength) + : HBitwiseBinaryOperation(context, left, right, strength) {} }; @@ -5241,8 +5228,8 @@ class HRor final : public HBitwiseBinaryOperation { public: static HInstruction* New(Isolate* isolate, Zone* zone, HValue* context, HValue* left, HValue* right, - LanguageMode language_mode = SLOPPY) { - return new(zone) HRor(context, left, right, language_mode); + Strength strength = Strength::WEAK) { + return new (zone) HRor(context, left, right, strength); } virtual void UpdateRepresentation(Representation new_rep, @@ -5258,8 +5245,8 @@ class HRor final : public HBitwiseBinaryOperation { bool DataEquals(HValue* other) override { return true; } private: - HRor(HValue* context, HValue* left, HValue* right, LanguageMode language_mode) - : HBitwiseBinaryOperation(context, left, right, language_mode) { + HRor(HValue* context, HValue* left, HValue* right, Strength strength) + : HBitwiseBinaryOperation(context, left, right, strength) { ChangeRepresentation(Representation::Integer32()); } }; @@ -7234,7 +7221,7 @@ class HStringAdd final : public HBinaryOperation { public: static HInstruction* New( Isolate* isolate, Zone* zone, HValue* context, HValue* left, - HValue* right, LanguageMode language_mode = SLOPPY, + HValue* right, Strength strength = Strength::WEAK, PretenureFlag pretenure_flag = NOT_TENURED, StringAddFlags flags = STRING_ADD_CHECK_BOTH, Handle allocation_site = Handle::null()); @@ -7257,15 +7244,12 @@ class HStringAdd final : public HBinaryOperation { } private: - HStringAdd(HValue* context, - HValue* left, - HValue* right, - LanguageMode language_mode, - PretenureFlag pretenure_flag, - StringAddFlags flags, + HStringAdd(HValue* context, HValue* left, HValue* right, Strength strength, + PretenureFlag pretenure_flag, StringAddFlags flags, Handle allocation_site) - : HBinaryOperation(context, left, right, language_mode, HType::String()), - flags_(flags), pretenure_flag_(pretenure_flag) { + : HBinaryOperation(context, left, right, strength, HType::String()), + flags_(flags), + pretenure_flag_(pretenure_flag) { set_representation(Representation::Tagged()); SetFlag(kUseGVN); SetDependsOnFlag(kMaps); diff --git a/src/hydrogen.cc b/src/hydrogen.cc index 9bbafb2249..810a8b9221 100644 --- a/src/hydrogen.cc +++ b/src/hydrogen.cc @@ -10312,8 +10312,8 @@ HInstruction* HOptimizedGraphBuilder::BuildIncrement( HConstant* delta = (expr->op() == Token::INC) ? graph()->GetConstant1() : graph()->GetConstantMinus1(); - HInstruction* instr = AddUncasted(Top(), delta, - function_language_mode()); + HInstruction* instr = + AddUncasted(Top(), delta, strength(function_language_mode())); if (instr->IsAdd()) { HAdd* add = HAdd::cast(instr); add->set_observed_input_representation(1, rep); @@ -10607,7 +10607,7 @@ HValue* HOptimizedGraphBuilder::BuildBinaryOperation( HValue* result = HGraphBuilder::BuildBinaryOperation( expr->op(), left, right, left_type, right_type, result_type, - fixed_right_arg, allocation_mode, function_language_mode()); + fixed_right_arg, allocation_mode, strength(function_language_mode())); // Add a simulate after instructions with observable side effects, and // after phis, which are the result of BuildBinaryOperation when we // inlined some complex subgraph. @@ -10624,16 +10624,12 @@ HValue* HOptimizedGraphBuilder::BuildBinaryOperation( } -HValue* HGraphBuilder::BuildBinaryOperation( - Token::Value op, - HValue* left, - HValue* right, - Type* left_type, - Type* right_type, - Type* result_type, - Maybe fixed_right_arg, - HAllocationMode allocation_mode, - LanguageMode language_mode) { +HValue* HGraphBuilder::BuildBinaryOperation(Token::Value op, HValue* left, + HValue* right, Type* left_type, + Type* right_type, Type* result_type, + Maybe fixed_right_arg, + HAllocationMode allocation_mode, + Strength strength) { bool maybe_string_add = false; if (op == Token::ADD) { // If we are adding constant string with something for which we don't have @@ -10695,27 +10691,27 @@ HValue* HGraphBuilder::BuildBinaryOperation( } // Convert left argument as necessary. - if (left_type->Is(Type::Number()) && !is_strong(language_mode)) { + if (left_type->Is(Type::Number()) && !is_strong(strength)) { DCHECK(right_type->Is(Type::String())); left = BuildNumberToString(left, left_type); } else if (!left_type->Is(Type::String())) { DCHECK(right_type->Is(Type::String())); - HValue* function = AddLoadJSBuiltin(is_strong(language_mode) ? - Builtins::STRING_ADD_RIGHT_STRONG : - Builtins::STRING_ADD_RIGHT); + HValue* function = AddLoadJSBuiltin( + is_strong(strength) ? Builtins::STRING_ADD_RIGHT_STRONG + : Builtins::STRING_ADD_RIGHT); Add(left, right); return AddUncasted(function, 2); } // Convert right argument as necessary. - if (right_type->Is(Type::Number()) && !is_strong(language_mode)) { + if (right_type->Is(Type::Number()) && !is_strong(strength)) { DCHECK(left_type->Is(Type::String())); right = BuildNumberToString(right, right_type); } else if (!right_type->Is(Type::String())) { DCHECK(left_type->Is(Type::String())); - HValue* function = AddLoadJSBuiltin(is_strong(language_mode) ? - Builtins::STRING_ADD_LEFT_STRONG : - Builtins::STRING_ADD_LEFT); + HValue* function = AddLoadJSBuiltin(is_strong(strength) + ? Builtins::STRING_ADD_LEFT_STRONG + : Builtins::STRING_ADD_LEFT); Add(left, right); return AddUncasted(function, 2); } @@ -10733,7 +10729,7 @@ HValue* HGraphBuilder::BuildBinaryOperation( if (!right_string.is_null() && right_string->length() == 0) return left; if (!left_string.is_null() && !right_string.is_null()) { return AddUncasted( - left, right, language_mode, allocation_mode.GetPretenureMode(), + left, right, strength, allocation_mode.GetPretenureMode(), STRING_ADD_CHECK_NONE, allocation_mode.feedback_site()); } @@ -10762,7 +10758,7 @@ HValue* HGraphBuilder::BuildBinaryOperation( // Fallback to using the string add stub. return AddUncasted( - left, right, language_mode, allocation_mode.GetPretenureMode(), + left, right, strength, allocation_mode.GetPretenureMode(), STRING_ADD_CHECK_NONE, allocation_mode.feedback_site()); } @@ -10781,20 +10777,20 @@ HValue* HGraphBuilder::BuildBinaryOperation( // inline several instructions (including the two pushes) for every tagged // operation in optimized code, which is more expensive, than a stub call. if (graph()->info()->IsStub() && is_non_primitive) { - HValue* function = AddLoadJSBuiltin( - BinaryOpIC::TokenToJSBuiltin(op, language_mode)); + HValue* function = + AddLoadJSBuiltin(BinaryOpIC::TokenToJSBuiltin(op, strength)); Add(left, right); instr = AddUncasted(function, 2); } else { switch (op) { case Token::ADD: - instr = AddUncasted(left, right, language_mode); + instr = AddUncasted(left, right, strength); break; case Token::SUB: - instr = AddUncasted(left, right, language_mode); + instr = AddUncasted(left, right, strength); break; case Token::MUL: - instr = AddUncasted(left, right, language_mode); + instr = AddUncasted(left, right, strength); break; case Token::MOD: { if (fixed_right_arg.IsJust() && @@ -10807,38 +10803,38 @@ HValue* HGraphBuilder::BuildBinaryOperation( if_same.ElseDeopt(Deoptimizer::kUnexpectedRHSOfBinaryOperation); right = fixed_right; } - instr = AddUncasted(left, right, language_mode); + instr = AddUncasted(left, right, strength); break; } case Token::DIV: - instr = AddUncasted(left, right, language_mode); + instr = AddUncasted(left, right, strength); break; case Token::BIT_XOR: case Token::BIT_AND: - instr = AddUncasted(op, left, right, language_mode); + instr = AddUncasted(op, left, right, strength); break; case Token::BIT_OR: { HValue* operand, *shift_amount; if (left_type->Is(Type::Signed32()) && right_type->Is(Type::Signed32()) && MatchRotateRight(left, right, &operand, &shift_amount)) { - instr = AddUncasted(operand, shift_amount, language_mode); + instr = AddUncasted(operand, shift_amount, strength); } else { - instr = AddUncasted(op, left, right, language_mode); + instr = AddUncasted(op, left, right, strength); } break; } case Token::SAR: - instr = AddUncasted(left, right, language_mode); + instr = AddUncasted(left, right, strength); break; case Token::SHR: - instr = AddUncasted(left, right, language_mode); + instr = AddUncasted(left, right, strength); if (instr->IsShr() && CanBeZero(right)) { graph()->RecordUint32Instruction(instr); } break; case Token::SHL: - instr = AddUncasted(left, right, language_mode); + instr = AddUncasted(left, right, strength); break; default: UNREACHABLE(); @@ -11226,8 +11222,8 @@ HControlInstruction* HOptimizedGraphBuilder::BuildCompareInstruction( return result; } else { if (combined_rep.IsTagged() || combined_rep.IsNone()) { - HCompareGeneric* result = - Add(left, right, op, function_language_mode()); + HCompareGeneric* result = Add( + left, right, op, strength(function_language_mode())); result->set_observed_input_representation(1, left_rep); result->set_observed_input_representation(2, right_rep); if (result->HasObservableSideEffects()) { @@ -12087,8 +12083,8 @@ void HOptimizedGraphBuilder::GenerateStringAdd(CallRuntime* call) { CHECK_ALIVE(VisitForValue(call->arguments()->at(1))); HValue* right = Pop(); HValue* left = Pop(); - HInstruction* result = NewUncasted(left, right, - function_language_mode()); + HInstruction* result = + NewUncasted(left, right, strength(function_language_mode())); return ast_context()->ReturnInstruction(result, call->id()); } diff --git a/src/hydrogen.h b/src/hydrogen.h index 125ec58c69..22c3bfa5c0 100644 --- a/src/hydrogen.h +++ b/src/hydrogen.h @@ -1429,15 +1429,11 @@ class HGraphBuilder { HValue** operand, HValue** shift_amount); - HValue* BuildBinaryOperation(Token::Value op, - HValue* left, - HValue* right, - Type* left_type, - Type* right_type, - Type* result_type, - Maybe fixed_right_arg, + HValue* BuildBinaryOperation(Token::Value op, HValue* left, HValue* right, + Type* left_type, Type* right_type, + Type* result_type, Maybe fixed_right_arg, HAllocationMode allocation_mode, - LanguageMode language_mode); + Strength strength); HLoadNamedField* AddLoadFixedArrayLength(HValue *object, HValue *dependency = NULL); diff --git a/src/ia32/code-stubs-ia32.cc b/src/ia32/code-stubs-ia32.cc index 11655713b3..7435ccd8aa 100644 --- a/src/ia32/code-stubs-ia32.cc +++ b/src/ia32/code-stubs-ia32.cc @@ -1696,7 +1696,7 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { // Check for undefined. undefined OP undefined is false even though // undefined == undefined. __ cmp(edx, isolate()->factory()->undefined_value()); - if (strong()) { + if (is_strong(strength())) { // In strong mode, this comparison must throw, so call the runtime. __ j(equal, &runtime_call, Label::kFar); } else { @@ -1722,7 +1722,7 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { // Call runtime on identical symbols since we need to throw a TypeError. __ cmpb(ecx, static_cast(SYMBOL_TYPE)); __ j(equal, &runtime_call, Label::kFar); - if (strong()) { + if (is_strong(strength())) { // We have already tested for smis and heap numbers, so if both // arguments are not strings we must proceed to the slow case. __ test(ecx, Immediate(kIsNotStringMask)); @@ -1914,7 +1914,8 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { if (cc == equal) { builtin = strict() ? Builtins::STRICT_EQUALS : Builtins::EQUALS; } else { - builtin = strong() ? Builtins::COMPARE_STRONG : Builtins::COMPARE; + builtin = + is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; __ push(Immediate(Smi::FromInt(NegativeComparisonResult(cc)))); } @@ -3645,7 +3646,7 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) { __ bind(&unordered); __ bind(&generic_stub); - CompareICStub stub(isolate(), op(), strong(), CompareICState::GENERIC, + CompareICStub stub(isolate(), op(), strength(), CompareICState::GENERIC, CompareICState::GENERIC, CompareICState::GENERIC); __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET); diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc index 280546ba36..6a1d820781 100644 --- a/src/ia32/full-codegen-ia32.cc +++ b/src/ia32/full-codegen-ia32.cc @@ -1016,7 +1016,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { // Record position before stub call for type feedback. SetSourcePosition(clause->position()); Handle ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, - language_mode()).code(); + strength(language_mode())).code(); CallIC(ic, clause->CompareId()); patch_site.EmitPatchInfo(); @@ -2386,8 +2386,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, __ bind(&stub_call); __ mov(eax, ecx); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); __ jmp(&done, Label::kNear); @@ -2540,8 +2540,8 @@ void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { __ pop(edx); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); @@ -4968,9 +4968,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { __ bind(&stub_call); __ mov(edx, eax); __ mov(eax, Immediate(Smi::FromInt(1))); - Handle code = - CodeFactory::BinaryOpIC( - isolate(), expr->binary_op(), language_mode()).code(); + Handle code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), + strength(language_mode())).code(); CallIC(code, expr->CountBinOpFeedbackId()); patch_site.EmitPatchInfo(); __ bind(&done); @@ -5237,8 +5236,8 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { // Record position and call the compare IC. SetSourcePosition(expr->position()); - Handle ic = - CodeFactory::CompareIC(isolate(), op, language_mode()).code(); + Handle ic = CodeFactory::CompareIC( + isolate(), op, strength(language_mode())).code(); CallIC(ic, expr->CompareOperationFeedbackId()); patch_site.EmitPatchInfo(); diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc index fea9e6da08..b4804d0ffd 100644 --- a/src/ia32/lithium-codegen-ia32.cc +++ b/src/ia32/lithium-codegen-ia32.cc @@ -2064,8 +2064,8 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) { DCHECK(ToRegister(instr->right()).is(eax)); DCHECK(ToRegister(instr->result()).is(eax)); - Handle code = CodeFactory::BinaryOpIC( - isolate(), instr->op(), instr->language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), instr->op(), instr->strength()).code(); CallCode(code, RelocInfo::CODE_TARGET, instr); } @@ -2491,7 +2491,8 @@ static Condition ComputeCompareCondition(Token::Value op) { void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { Token::Value op = instr->op(); - Handle ic = CodeFactory::CompareIC(isolate(), op, SLOPPY).code(); + Handle ic = + CodeFactory::CompareIC(isolate(), op, Strength::WEAK).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); Condition condition = ComputeCompareCondition(op); @@ -2763,7 +2764,7 @@ void LCodeGen::DoCmpT(LCmpT* instr) { Token::Value op = instr->op(); Handle ic = - CodeFactory::CompareIC(isolate(), op, instr->language_mode()).code(); + CodeFactory::CompareIC(isolate(), op, instr->strength()).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); Condition condition = ComputeCompareCondition(op); diff --git a/src/ia32/lithium-ia32.h b/src/ia32/lithium-ia32.h index 886c9ff20f..0beff75b82 100644 --- a/src/ia32/lithium-ia32.h +++ b/src/ia32/lithium-ia32.h @@ -1170,7 +1170,7 @@ class LCmpT final : public LTemplateInstruction<1, 3, 0> { DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") DECLARE_HYDROGEN_ACCESSOR(CompareGeneric) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } LOperand* context() { return inputs_[0]; } Token::Value op() const { return hydrogen()->token(); } @@ -1541,7 +1541,7 @@ class LArithmeticT final : public LTemplateInstruction<1, 3, 0> { DECLARE_HYDROGEN_ACCESSOR(BinaryOperation) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } private: Token::Value op_; diff --git a/src/ic/ic-state.cc b/src/ic/ic-state.cc index e944c390d3..2de29ad516 100644 --- a/src/ic/ic-state.cc +++ b/src/ic/ic-state.cc @@ -52,7 +52,7 @@ BinaryOpICState::BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state) isolate_(isolate) { op_ = static_cast(FIRST_TOKEN + OpField::decode(extra_ic_state)); - strong_ = StrongField::decode(extra_ic_state); + strong_ = StrengthField::decode(extra_ic_state); left_kind_ = LeftKindField::decode(extra_ic_state); right_kind_ = fixed_right_arg_.IsJust() ? (Smi::IsValid(fixed_right_arg_.FromJust()) ? SMI : INT32) @@ -66,8 +66,7 @@ BinaryOpICState::BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state) ExtraICState BinaryOpICState::GetExtraICState() const { ExtraICState extra_ic_state = OpField::encode(op_ - FIRST_TOKEN) | LeftKindField::encode(left_kind_) | - ResultKindField::encode(result_kind_) | - StrongField::encode(strong_) | + ResultKindField::encode(result_kind_) | StrengthField::encode(strong_) | HasFixedRightArgField::encode(fixed_right_arg_.IsJust()); if (fixed_right_arg_.IsJust()) { extra_ic_state = FixedRightArgValueField::update( @@ -86,14 +85,14 @@ void BinaryOpICState::GenerateAheadOfTime( // expensive at runtime. When solved we should be able to add most binops to // the snapshot instead of hand-picking them. // Generated list of commonly used stubs -#define GENERATE(op, left_kind, right_kind, result_kind) \ - do { \ - BinaryOpICState state(isolate, op, LanguageMode::SLOPPY); \ - state.left_kind_ = left_kind; \ - state.fixed_right_arg_ = Nothing(); \ - state.right_kind_ = right_kind; \ - state.result_kind_ = result_kind; \ - Generate(isolate, state); \ +#define GENERATE(op, left_kind, right_kind, result_kind) \ + do { \ + BinaryOpICState state(isolate, op, Strength::WEAK); \ + state.left_kind_ = left_kind; \ + state.fixed_right_arg_ = Nothing(); \ + state.right_kind_ = right_kind; \ + state.result_kind_ = result_kind; \ + Generate(isolate, state); \ } while (false) GENERATE(Token::ADD, INT32, INT32, INT32); GENERATE(Token::ADD, INT32, INT32, NUMBER); @@ -190,7 +189,7 @@ void BinaryOpICState::GenerateAheadOfTime( #undef GENERATE #define GENERATE(op, left_kind, fixed_right_arg_value, result_kind) \ do { \ - BinaryOpICState state(isolate, op, LanguageMode::SLOPPY); \ + BinaryOpICState state(isolate, op, Strength::WEAK); \ state.left_kind_ = left_kind; \ state.fixed_right_arg_ = Just(fixed_right_arg_value); \ state.right_kind_ = SMI; \ diff --git a/src/ic/ic-state.h b/src/ic/ic-state.h index f191c96f1e..dbc504bf6d 100644 --- a/src/ic/ic-state.h +++ b/src/ic/ic-state.h @@ -56,9 +56,9 @@ std::ostream& operator<<(std::ostream& os, const CallICState& s); class BinaryOpICState final BASE_EMBEDDED { public: BinaryOpICState(Isolate* isolate, ExtraICState extra_ic_state); - BinaryOpICState(Isolate* isolate, Token::Value op, LanguageMode language_mode) + BinaryOpICState(Isolate* isolate, Token::Value op, Strength strength) : op_(op), - strong_(is_strong(language_mode)), + strong_(is_strong(strength)), left_kind_(NONE), right_kind_(NONE), result_kind_(NONE), @@ -105,8 +105,8 @@ class BinaryOpICState final BASE_EMBEDDED { return Max(left_kind_, right_kind_) == GENERIC; } - LanguageMode language_mode() const { - return strong_ ? LanguageMode::STRONG : LanguageMode::SLOPPY; + Strength strength() const { + return strong_ ? Strength::STRONG : Strength::WEAK; } // Returns true if the IC should enable the inline smi code (i.e. if either @@ -147,7 +147,7 @@ class BinaryOpICState final BASE_EMBEDDED { class OpField : public BitField {}; class ResultKindField : public BitField {}; class LeftKindField : public BitField {}; - class StrongField : public BitField {}; + class StrengthField : public BitField {}; // When fixed right arg is set, we don't need to store the right kind. // Thus the two fields can overlap. class HasFixedRightArgField : public BitField {}; diff --git a/src/ic/ic.cc b/src/ic/ic.cc index f938336ba1..e8be95ba34 100644 --- a/src/ic/ic.cc +++ b/src/ic/ic.cc @@ -564,7 +564,7 @@ void CompareIC::Clear(Isolate* isolate, Address address, Code* target, // Only clear CompareICs that can retain objects. if (stub.state() != CompareICState::KNOWN_OBJECT) return; SetTargetAtAddress(address, - GetRawUninitialized(isolate, stub.op(), stub.strong()), + GetRawUninitialized(isolate, stub.op(), stub.strength()), constant_pool); PatchInlinedSmiCode(address, DISABLE_INLINED_SMI_CHECK); } @@ -2431,7 +2431,7 @@ MaybeHandle BinaryOpIC::Transition( // Compute the actual result using the builtin for the binary operation. Object* builtin = isolate()->js_builtins_object()->javascript_builtin( - TokenToJSBuiltin(state.op(), state.language_mode())); + TokenToJSBuiltin(state.op(), state.strength())); Handle function = handle(JSFunction::cast(builtin), isolate()); Handle result; ASSIGN_RETURN_ON_EXCEPTION( @@ -2532,8 +2532,8 @@ RUNTIME_FUNCTION(BinaryOpIC_MissWithAllocationSite) { Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op, - bool strong) { - CompareICStub stub(isolate, op, strong, CompareICState::UNINITIALIZED, + Strength strength) { + CompareICStub stub(isolate, op, strength, CompareICState::UNINITIALIZED, CompareICState::UNINITIALIZED, CompareICState::UNINITIALIZED); Code* code = NULL; @@ -2543,8 +2543,8 @@ Code* CompareIC::GetRawUninitialized(Isolate* isolate, Token::Value op, Handle CompareIC::GetUninitialized(Isolate* isolate, Token::Value op, - bool strong) { - CompareICStub stub(isolate, op, strong, CompareICState::UNINITIALIZED, + Strength strength) { + CompareICStub stub(isolate, op, strength, CompareICState::UNINITIALIZED, CompareICState::UNINITIALIZED, CompareICState::UNINITIALIZED); return stub.GetCode(); @@ -2561,7 +2561,7 @@ Code* CompareIC::UpdateCaches(Handle x, Handle y) { CompareICState::State state = CompareICState::TargetState( old_stub.state(), old_stub.left(), old_stub.right(), op_, HasInlinedSmiCode(address()), x, y); - CompareICStub stub(isolate(), op_, old_stub.strong(), new_left, new_right, + CompareICStub stub(isolate(), op_, old_stub.strength(), new_left, new_right, state); if (state == CompareICState::KNOWN_OBJECT) { stub.set_known_map( @@ -2671,8 +2671,8 @@ RUNTIME_FUNCTION(Unreachable) { Builtins::JavaScript BinaryOpIC::TokenToJSBuiltin(Token::Value op, - LanguageMode language_mode) { - if (is_strong(language_mode)) { + Strength strength) { + if (is_strong(strength)) { switch (op) { default: UNREACHABLE(); case Token::ADD: return Builtins::ADD_STRONG; diff --git a/src/ic/ic.h b/src/ic/ic.h index e8613436f9..c346306370 100644 --- a/src/ic/ic.h +++ b/src/ic/ic.h @@ -652,7 +652,7 @@ class BinaryOpIC : public IC { explicit BinaryOpIC(Isolate* isolate) : IC(EXTRA_CALL_FRAME, isolate) {} static Builtins::JavaScript TokenToJSBuiltin(Token::Value op, - LanguageMode language_mode); + Strength strength); MaybeHandle Transition(Handle allocation_site, Handle left, @@ -673,7 +673,7 @@ class CompareIC : public IC { // Factory method for getting an uninitialized compare stub. static Handle GetUninitialized(Isolate* isolate, Token::Value op, - bool strong); + Strength strength); private: static bool HasInlinedSmiCode(Address address); @@ -682,7 +682,7 @@ class CompareIC : public IC { Condition GetCondition() const { return ComputeCondition(op_); } static Code* GetRawUninitialized(Isolate* isolate, Token::Value op, - bool strong); + Strength strength); static void Clear(Isolate* isolate, Address address, Code* target, Address constant_pool); diff --git a/src/isolate.cc b/src/isolate.cc index 966b73b3ea..ee6778e1f2 100644 --- a/src/isolate.cc +++ b/src/isolate.cc @@ -2370,11 +2370,11 @@ CodeTracer* Isolate::GetCodeTracer() { } -Map* Isolate::get_initial_js_array_map(ElementsKind kind, - ObjectStrength strength) { +Map* Isolate::get_initial_js_array_map(ElementsKind kind, Strength strength) { Context* native_context = context()->native_context(); - Object* maybe_map_array = strength ? native_context->js_array_strong_maps() - : native_context->js_array_maps(); + Object* maybe_map_array = is_strong(strength) + ? native_context->js_array_strong_maps() + : native_context->js_array_maps(); if (!maybe_map_array->IsUndefined()) { Object* maybe_transitioned_map = FixedArray::cast(maybe_map_array)->get(kind); diff --git a/src/isolate.h b/src/isolate.h index 4b242a3d5f..fb20f9f353 100644 --- a/src/isolate.h +++ b/src/isolate.h @@ -991,7 +991,7 @@ class Isolate { } Map* get_initial_js_array_map(ElementsKind kind, - ObjectStrength strength = WEAK); + Strength strength = Strength::WEAK); static const int kArrayProtectorValid = 1; static const int kArrayProtectorInvalid = 0; diff --git a/src/json-parser.h b/src/json-parser.h index 76882dd540..cecac9bfdb 100644 --- a/src/json-parser.h +++ b/src/json-parser.h @@ -525,7 +525,7 @@ Handle JsonParser::ParseJsonArray() { fast_elements->set(i, *elements[i]); } Handle json_array = factory()->NewJSArrayWithElements( - fast_elements, FAST_ELEMENTS, WEAK, pretenure_); + fast_elements, FAST_ELEMENTS, Strength::WEAK, pretenure_); return scope.CloseAndEscape(json_array); } diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc index 5f87ae7ec7..1b84534d62 100644 --- a/src/mips/code-stubs-mips.cc +++ b/src/mips/code-stubs-mips.cc @@ -94,7 +94,7 @@ void InternalArrayNArgumentsConstructorStub::InitializeDescriptor( static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, - Condition cc, bool strong); + Condition cc, Strength strength); static void EmitSmiNonsmiComparison(MacroAssembler* masm, Register lhs, Register rhs, @@ -276,7 +276,7 @@ void DoubleToIStub::Generate(MacroAssembler* masm) { // Equality is almost reflexive (everything but NaN), so this is a test // for "identity and not NaN". static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, - Condition cc, bool strong) { + Condition cc, Strength strength) { Label not_identical; Label heap_number, return_equal; Register exp_mask_reg = t5; @@ -295,7 +295,7 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, __ Branch(slow, greater, t4, Operand(FIRST_SPEC_OBJECT_TYPE)); // Call runtime on identical symbols since we need to throw a TypeError. __ Branch(slow, eq, t4, Operand(SYMBOL_TYPE)); - if (strong) { + if (is_strong(strength)) { // Call the runtime on anything that is converted in the semantics, since // we need to throw a TypeError. Smis have already been ruled out. __ Branch(&return_equal, eq, t4, Operand(HEAP_NUMBER_TYPE)); @@ -309,7 +309,7 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, __ Branch(slow, greater, t4, Operand(FIRST_SPEC_OBJECT_TYPE)); // Call runtime on identical symbols since we need to throw a TypeError. __ Branch(slow, eq, t4, Operand(SYMBOL_TYPE)); - if (strong) { + if (is_strong(strength)) { // Call the runtime on anything that is converted in the semantics, // since we need to throw a TypeError. Smis and heap numbers have // already been ruled out. @@ -600,7 +600,7 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { // Handle the case where the objects are identical. Either returns the answer // or goes to slow. Only falls through if the objects were not identical. - EmitIdenticalObjectComparison(masm, &slow, cc, strong()); + EmitIdenticalObjectComparison(masm, &slow, cc, strength()); // If either is a Smi (we know that not both are), then they can only // be strictly equal if the other is a HeapNumber. @@ -728,7 +728,8 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { if (cc == eq) { native = strict() ? Builtins::STRICT_EQUALS : Builtins::EQUALS; } else { - native = strong() ? Builtins::COMPARE_STRONG : Builtins::COMPARE; + native = + is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; int ncr; // NaN compare result. if (cc == lt || cc == le) { ncr = GREATER; @@ -3757,7 +3758,7 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) { __ bind(&unordered); __ bind(&generic_stub); - CompareICStub stub(isolate(), op(), strong(), CompareICState::GENERIC, + CompareICStub stub(isolate(), op(), strength(), CompareICState::GENERIC, CompareICState::GENERIC, CompareICState::GENERIC); __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc index c5471b4d0f..a3f04194a3 100644 --- a/src/mips/full-codegen-mips.cc +++ b/src/mips/full-codegen-mips.cc @@ -1073,7 +1073,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { // Record position before stub call for type feedback. SetSourcePosition(clause->position()); Handle ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, - language_mode()).code(); + strength(language_mode())).code(); CallIC(ic, clause->CompareId()); patch_site.EmitPatchInfo(); @@ -2458,8 +2458,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, patch_site.EmitJumpIfSmi(scratch1, &smi_case); __ bind(&stub_call); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); __ jmp(&done); @@ -2611,8 +2611,8 @@ void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { __ mov(a0, result_register()); __ pop(a1); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); @@ -5052,8 +5052,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { // Record position before stub call. SetSourcePosition(expr->position()); - Handle code = CodeFactory::BinaryOpIC( - isolate(), Token::ADD, language_mode()).code(); + Handle code = CodeFactory::BinaryOpIC(isolate(), Token::ADD, + strength(language_mode())).code(); CallIC(code, expr->CountBinOpFeedbackId()); patch_site.EmitPatchInfo(); __ bind(&done); @@ -5316,8 +5316,8 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { } // Record position and call the compare IC. SetSourcePosition(expr->position()); - Handle ic = - CodeFactory::CompareIC(isolate(), op, language_mode()).code(); + Handle ic = CodeFactory::CompareIC( + isolate(), op, strength(language_mode())).code(); CallIC(ic, expr->CompareOperationFeedbackId()); patch_site.EmitPatchInfo(); PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 0f23b2f00b..7b18584fc4 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -2047,8 +2047,8 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) { DCHECK(ToRegister(instr->right()).is(a0)); DCHECK(ToRegister(instr->result()).is(v0)); - Handle code = CodeFactory::BinaryOpIC( - isolate(), instr->op(), instr->language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), instr->op(), instr->strength()).code(); CallCode(code, RelocInfo::CODE_TARGET, instr); // Other arch use a nop here, to signal that there is no inlined // patchable code. Mips does not need the nop, since our marker @@ -2530,7 +2530,8 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { DCHECK(ToRegister(instr->context()).is(cp)); Token::Value op = instr->op(); - Handle ic = CodeFactory::CompareIC(isolate(), op, SLOPPY).code(); + Handle ic = + CodeFactory::CompareIC(isolate(), op, Strength::WEAK).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); Condition condition = ComputeCompareCondition(op); @@ -2833,7 +2834,7 @@ void LCodeGen::DoCmpT(LCmpT* instr) { Token::Value op = instr->op(); Handle ic = - CodeFactory::CompareIC(isolate(), op, instr->language_mode()).code(); + CodeFactory::CompareIC(isolate(), op, instr->strength()).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); // On MIPS there is no need for a "no inlined smi code" marker (nop). diff --git a/src/mips/lithium-mips.h b/src/mips/lithium-mips.h index 92e3426df5..809e6e0410 100644 --- a/src/mips/lithium-mips.h +++ b/src/mips/lithium-mips.h @@ -1154,7 +1154,7 @@ class LCmpT final : public LTemplateInstruction<1, 3, 0> { DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") DECLARE_HYDROGEN_ACCESSOR(CompareGeneric) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } Token::Value op() const { return hydrogen()->token(); } }; @@ -1512,7 +1512,7 @@ class LArithmeticT final : public LTemplateInstruction<1, 3, 0> { DECLARE_HYDROGEN_ACCESSOR(BinaryOperation) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } private: Token::Value op_; diff --git a/src/mips64/code-stubs-mips64.cc b/src/mips64/code-stubs-mips64.cc index d6a02fdcd7..8c539b40f8 100644 --- a/src/mips64/code-stubs-mips64.cc +++ b/src/mips64/code-stubs-mips64.cc @@ -93,7 +93,7 @@ void InternalArrayNArgumentsConstructorStub::InitializeDescriptor( static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, - Condition cc, bool strong); + Condition cc, Strength strength); static void EmitSmiNonsmiComparison(MacroAssembler* masm, Register lhs, Register rhs, @@ -272,7 +272,7 @@ void DoubleToIStub::Generate(MacroAssembler* masm) { // Equality is almost reflexive (everything but NaN), so this is a test // for "identity and not NaN". static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, - Condition cc, bool strong) { + Condition cc, Strength strength) { Label not_identical; Label heap_number, return_equal; Register exp_mask_reg = t1; @@ -291,7 +291,7 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, __ Branch(slow, greater, t0, Operand(FIRST_SPEC_OBJECT_TYPE)); // Call runtime on identical symbols since we need to throw a TypeError. __ Branch(slow, eq, t0, Operand(SYMBOL_TYPE)); - if (strong) { + if (is_strong(strength)) { // Call the runtime on anything that is converted in the semantics, since // we need to throw a TypeError. Smis have already been ruled out. __ Branch(&return_equal, eq, t0, Operand(HEAP_NUMBER_TYPE)); @@ -305,7 +305,7 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, __ Branch(slow, greater, t0, Operand(FIRST_SPEC_OBJECT_TYPE)); // Call runtime on identical symbols since we need to throw a TypeError. __ Branch(slow, eq, t0, Operand(SYMBOL_TYPE)); - if (strong) { + if (is_strong(strength)) { // Call the runtime on anything that is converted in the semantics, // since we need to throw a TypeError. Smis and heap numbers have // already been ruled out. @@ -595,7 +595,7 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { // Handle the case where the objects are identical. Either returns the answer // or goes to slow. Only falls through if the objects were not identical. - EmitIdenticalObjectComparison(masm, &slow, cc, strong()); + EmitIdenticalObjectComparison(masm, &slow, cc, strength()); // If either is a Smi (we know that not both are), then they can only // be strictly equal if the other is a HeapNumber. @@ -723,7 +723,8 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { if (cc == eq) { native = strict() ? Builtins::STRICT_EQUALS : Builtins::EQUALS; } else { - native = strong() ? Builtins::COMPARE_STRONG : Builtins::COMPARE; + native = + is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; int ncr; // NaN compare result. if (cc == lt || cc == le) { ncr = GREATER; @@ -3800,7 +3801,7 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) { __ bind(&unordered); __ bind(&generic_stub); - CompareICStub stub(isolate(), op(), strong(), CompareICState::GENERIC, + CompareICStub stub(isolate(), op(), strength(), CompareICState::GENERIC, CompareICState::GENERIC, CompareICState::GENERIC); __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); diff --git a/src/mips64/full-codegen-mips64.cc b/src/mips64/full-codegen-mips64.cc index 50b4034225..02f25c5094 100644 --- a/src/mips64/full-codegen-mips64.cc +++ b/src/mips64/full-codegen-mips64.cc @@ -1070,7 +1070,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { // Record position before stub call for type feedback. SetSourcePosition(clause->position()); Handle ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, - language_mode()).code(); + strength(language_mode())).code(); CallIC(ic, clause->CompareId()); patch_site.EmitPatchInfo(); @@ -2458,8 +2458,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, patch_site.EmitJumpIfSmi(scratch1, &smi_case); __ bind(&stub_call); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); __ jmp(&done); @@ -2610,8 +2610,8 @@ void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { __ mov(a0, result_register()); __ pop(a1); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); @@ -5055,8 +5055,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { // Record position before stub call. SetSourcePosition(expr->position()); - Handle code = CodeFactory::BinaryOpIC( - isolate(), Token::ADD, language_mode()).code(); + Handle code = CodeFactory::BinaryOpIC(isolate(), Token::ADD, + strength(language_mode())).code(); CallIC(code, expr->CountBinOpFeedbackId()); patch_site.EmitPatchInfo(); __ bind(&done); @@ -5319,8 +5319,8 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { } // Record position and call the compare IC. SetSourcePosition(expr->position()); - Handle ic = - CodeFactory::CompareIC(isolate(), op, language_mode()).code(); + Handle ic = CodeFactory::CompareIC( + isolate(), op, strength(language_mode())).code(); CallIC(ic, expr->CompareOperationFeedbackId()); patch_site.EmitPatchInfo(); PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); diff --git a/src/mips64/lithium-codegen-mips64.cc b/src/mips64/lithium-codegen-mips64.cc index c8297a29eb..7ee8b64a4d 100644 --- a/src/mips64/lithium-codegen-mips64.cc +++ b/src/mips64/lithium-codegen-mips64.cc @@ -2043,8 +2043,8 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) { DCHECK(ToRegister(instr->right()).is(a0)); DCHECK(ToRegister(instr->result()).is(v0)); - Handle code = CodeFactory::BinaryOpIC( - isolate(), instr->op(), instr->language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), instr->op(), instr->strength()).code(); CallCode(code, RelocInfo::CODE_TARGET, instr); // Other arch use a nop here, to signal that there is no inlined // patchable code. Mips does not need the nop, since our marker @@ -2529,7 +2529,8 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { DCHECK(ToRegister(instr->context()).is(cp)); Token::Value op = instr->op(); - Handle ic = CodeFactory::CompareIC(isolate(), op, SLOPPY).code(); + Handle ic = + CodeFactory::CompareIC(isolate(), op, Strength::WEAK).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); Condition condition = ComputeCompareCondition(op); @@ -2832,7 +2833,7 @@ void LCodeGen::DoCmpT(LCmpT* instr) { Token::Value op = instr->op(); Handle ic = - CodeFactory::CompareIC(isolate(), op, instr->language_mode()).code(); + CodeFactory::CompareIC(isolate(), op, instr->strength()).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); // On MIPS there is no need for a "no inlined smi code" marker (nop). diff --git a/src/mips64/lithium-mips64.h b/src/mips64/lithium-mips64.h index d73837ea02..fa1c2d2b43 100644 --- a/src/mips64/lithium-mips64.h +++ b/src/mips64/lithium-mips64.h @@ -1153,7 +1153,7 @@ class LCmpT final : public LTemplateInstruction<1, 3, 0> { DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") DECLARE_HYDROGEN_ACCESSOR(CompareGeneric) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } Token::Value op() const { return hydrogen()->token(); } }; @@ -1510,7 +1510,7 @@ class LArithmeticT final : public LTemplateInstruction<1, 3, 0> { DECLARE_HYDROGEN_ACCESSOR(BinaryOperation) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } private: Token::Value op_; diff --git a/src/ppc/code-stubs-ppc.cc b/src/ppc/code-stubs-ppc.cc index 6e686e3346..9cc2bed73e 100644 --- a/src/ppc/code-stubs-ppc.cc +++ b/src/ppc/code-stubs-ppc.cc @@ -94,7 +94,7 @@ void InternalArrayNArgumentsConstructorStub::InitializeDescriptor( static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, - Condition cond, bool strong); + Condition cond, Strength strength); static void EmitSmiNonsmiComparison(MacroAssembler* masm, Register lhs, Register rhs, Label* lhs_not_nan, Label* slow, bool strict); @@ -249,7 +249,7 @@ void DoubleToIStub::Generate(MacroAssembler* masm) { // Equality is almost reflexive (everything but NaN), so this is a test // for "identity and not NaN". static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, - Condition cond, bool strong) { + Condition cond, Strength strength) { Label not_identical; Label heap_number, return_equal; __ cmp(r3, r4); @@ -266,7 +266,7 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, // Call runtime on identical symbols since we need to throw a TypeError. __ cmpi(r7, Operand(SYMBOL_TYPE)); __ beq(slow); - if (strong) { + if (is_strong(strength)) { // Call the runtime on anything that is converted in the semantics, since // we need to throw a TypeError. Smis have already been ruled out. __ cmpi(r7, Operand(HEAP_NUMBER_TYPE)); @@ -284,7 +284,7 @@ static void EmitIdenticalObjectComparison(MacroAssembler* masm, Label* slow, // Call runtime on identical symbols since we need to throw a TypeError. __ cmpi(r7, Operand(SYMBOL_TYPE)); __ beq(slow); - if (strong) { + if (is_strong(strength)) { // Call the runtime on anything that is converted in the semantics, // since we need to throw a TypeError. Smis and heap numbers have // already been ruled out. @@ -594,7 +594,7 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { // Handle the case where the objects are identical. Either returns the answer // or goes to slow. Only falls through if the objects were not identical. - EmitIdenticalObjectComparison(masm, &slow, cc, strong()); + EmitIdenticalObjectComparison(masm, &slow, cc, strength()); // If either is a Smi (we know that not both are), then they can only // be strictly equal if the other is a HeapNumber. @@ -705,7 +705,8 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { if (cc == eq) { native = strict() ? Builtins::STRICT_EQUALS : Builtins::EQUALS; } else { - native = strong() ? Builtins::COMPARE_STRONG : Builtins::COMPARE; + native = + is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; int ncr; // NaN compare result if (cc == lt || cc == le) { ncr = GREATER; @@ -3805,7 +3806,7 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) { __ bind(&unordered); __ bind(&generic_stub); - CompareICStub stub(isolate(), op(), strong(), CompareICState::GENERIC, + CompareICStub stub(isolate(), op(), strength(), CompareICState::GENERIC, CompareICState::GENERIC, CompareICState::GENERIC); __ Jump(stub.GetCode(), RelocInfo::CODE_TARGET); diff --git a/src/ppc/full-codegen-ppc.cc b/src/ppc/full-codegen-ppc.cc index 5b418d316a..f6931f9e4d 100644 --- a/src/ppc/full-codegen-ppc.cc +++ b/src/ppc/full-codegen-ppc.cc @@ -1042,7 +1042,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { // Record position before stub call for type feedback. SetSourcePosition(clause->position()); Handle ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, - language_mode()).code(); + strength(language_mode())).code(); CallIC(ic, clause->CompareId()); patch_site.EmitPatchInfo(); @@ -2446,8 +2446,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, patch_site.EmitJumpIfSmi(scratch1, &smi_case); __ bind(&stub_call); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); __ b(&done); @@ -2623,8 +2623,8 @@ void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { __ pop(r4); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); @@ -5053,8 +5053,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { // Record position before stub call. SetSourcePosition(expr->position()); - Handle code = CodeFactory::BinaryOpIC( - isolate(), Token::ADD, language_mode()).code(); + Handle code = CodeFactory::BinaryOpIC(isolate(), Token::ADD, + strength(language_mode())).code(); CallIC(code, expr->CountBinOpFeedbackId()); patch_site.EmitPatchInfo(); __ bind(&done); @@ -5323,8 +5323,8 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { // Record position and call the compare IC. SetSourcePosition(expr->position()); - Handle ic = - CodeFactory::CompareIC(isolate(), op, language_mode()).code(); + Handle ic = CodeFactory::CompareIC( + isolate(), op, strength(language_mode())).code(); CallIC(ic, expr->CompareOperationFeedbackId()); patch_site.EmitPatchInfo(); PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); diff --git a/src/ppc/lithium-codegen-ppc.cc b/src/ppc/lithium-codegen-ppc.cc index 18c9782e6e..6c740793bf 100644 --- a/src/ppc/lithium-codegen-ppc.cc +++ b/src/ppc/lithium-codegen-ppc.cc @@ -2188,8 +2188,8 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) { DCHECK(ToRegister(instr->right()).is(r3)); DCHECK(ToRegister(instr->result()).is(r3)); - Handle code = CodeFactory::BinaryOpIC( - isolate(), instr->op(), instr->language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), instr->op(), instr->strength()).code(); CallCode(code, RelocInfo::CODE_TARGET, instr); } @@ -2665,7 +2665,8 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { DCHECK(ToRegister(instr->context()).is(cp)); Token::Value op = instr->op(); - Handle ic = CodeFactory::CompareIC(isolate(), op, SLOPPY).code(); + Handle ic = + CodeFactory::CompareIC(isolate(), op, Strength::WEAK).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); // This instruction also signals no smi code inlined __ cmpi(r3, Operand::Zero()); @@ -2973,7 +2974,7 @@ void LCodeGen::DoCmpT(LCmpT* instr) { Token::Value op = instr->op(); Handle ic = - CodeFactory::CompareIC(isolate(), op, instr->language_mode()).code(); + CodeFactory::CompareIC(isolate(), op, instr->strength()).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); // This instruction also signals no smi code inlined __ cmpi(r3, Operand::Zero()); diff --git a/src/ppc/lithium-ppc.h b/src/ppc/lithium-ppc.h index 0b94645527..2959bffea8 100644 --- a/src/ppc/lithium-ppc.h +++ b/src/ppc/lithium-ppc.h @@ -1131,7 +1131,7 @@ class LCmpT final : public LTemplateInstruction<1, 3, 0> { DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") DECLARE_HYDROGEN_ACCESSOR(CompareGeneric) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } Token::Value op() const { return hydrogen()->token(); } }; @@ -1495,7 +1495,7 @@ class LArithmeticT final : public LTemplateInstruction<1, 3, 0> { DECLARE_HYDROGEN_ACCESSOR(BinaryOperation) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } private: Token::Value op_; diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc index f24ae4d725..48a2a885ed 100644 --- a/src/x64/code-stubs-x64.cc +++ b/src/x64/code-stubs-x64.cc @@ -1566,7 +1566,7 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { // Check for undefined. undefined OP undefined is false even though // undefined == undefined. __ CompareRoot(rdx, Heap::kUndefinedValueRootIndex); - if (strong()) { + if (is_strong(strength())) { // In strong mode, this comparison must throw, so call the runtime. __ j(equal, &runtime_call, Label::kFar); } else { @@ -1594,7 +1594,7 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { // Call runtime on identical symbols since we need to throw a TypeError. __ cmpb(rcx, Immediate(static_cast(SYMBOL_TYPE))); __ j(equal, &runtime_call, Label::kFar); - if (strong()) { + if (is_strong(strength())) { // We have already tested for smis and heap numbers, so if both // arguments are not strings we must proceed to the slow case. __ testb(rcx, Immediate(kIsNotStringMask)); @@ -1785,7 +1785,8 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { if (cc == equal) { builtin = strict() ? Builtins::STRICT_EQUALS : Builtins::EQUALS; } else { - builtin = strong() ? Builtins::COMPARE_STRONG : Builtins::COMPARE; + builtin = + is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; __ Push(Smi::FromInt(NegativeComparisonResult(cc))); } @@ -3610,7 +3611,7 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) { __ bind(&unordered); __ bind(&generic_stub); - CompareICStub stub(isolate(), op(), strong(), CompareICState::GENERIC, + CompareICStub stub(isolate(), op(), strength(), CompareICState::GENERIC, CompareICState::GENERIC, CompareICState::GENERIC); __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET); diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc index 66632716e4..5ed18854dc 100644 --- a/src/x64/full-codegen-x64.cc +++ b/src/x64/full-codegen-x64.cc @@ -1039,7 +1039,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { // Record position before stub call for type feedback. SetSourcePosition(clause->position()); Handle ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, - language_mode()).code(); + strength(language_mode())).code(); CallIC(ic, clause->CompareId()); patch_site.EmitPatchInfo(); @@ -2416,8 +2416,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, __ bind(&stub_call); __ movp(rax, rcx); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); __ jmp(&done, Label::kNear); @@ -2538,8 +2538,8 @@ void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { __ Pop(rdx); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); @@ -4990,8 +4990,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { __ bind(&stub_call); __ movp(rdx, rax); __ Move(rax, Smi::FromInt(1)); - Handle code = CodeFactory::BinaryOpIC( - isolate(), expr->binary_op(), language_mode()).code(); + Handle code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), + strength(language_mode())).code(); CallIC(code, expr->CountBinOpFeedbackId()); patch_site.EmitPatchInfo(); __ bind(&done); @@ -5257,8 +5257,8 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { // Record position and call the compare IC. SetSourcePosition(expr->position()); - Handle ic = - CodeFactory::CompareIC(isolate(), op, language_mode()).code(); + Handle ic = CodeFactory::CompareIC( + isolate(), op, strength(language_mode())).code(); CallIC(ic, expr->CompareOperationFeedbackId()); patch_site.EmitPatchInfo(); diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc index 48ad79378e..8308edd969 100644 --- a/src/x64/lithium-codegen-x64.cc +++ b/src/x64/lithium-codegen-x64.cc @@ -2099,8 +2099,8 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) { DCHECK(ToRegister(instr->right()).is(rax)); DCHECK(ToRegister(instr->result()).is(rax)); - Handle code = CodeFactory::BinaryOpIC( - isolate(), instr->op(), instr->language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), instr->op(), instr->strength()).code(); CallCode(code, RelocInfo::CODE_TARGET, instr); } @@ -2543,7 +2543,8 @@ void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { DCHECK(ToRegister(instr->context()).is(rsi)); Token::Value op = instr->op(); - Handle ic = CodeFactory::CompareIC(isolate(), op, SLOPPY).code(); + Handle ic = + CodeFactory::CompareIC(isolate(), op, Strength::WEAK).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); Condition condition = TokenToCondition(op, false); @@ -2828,7 +2829,7 @@ void LCodeGen::DoCmpT(LCmpT* instr) { Token::Value op = instr->op(); Handle ic = - CodeFactory::CompareIC(isolate(), op, instr->language_mode()).code(); + CodeFactory::CompareIC(isolate(), op, instr->strength()).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); Condition condition = TokenToCondition(op, false); diff --git a/src/x64/lithium-x64.h b/src/x64/lithium-x64.h index f996e32e78..925eef01f0 100644 --- a/src/x64/lithium-x64.h +++ b/src/x64/lithium-x64.h @@ -1152,7 +1152,7 @@ class LCmpT final : public LTemplateInstruction<1, 3, 0> { DECLARE_CONCRETE_INSTRUCTION(CmpT, "cmp-t") DECLARE_HYDROGEN_ACCESSOR(CompareGeneric) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } Token::Value op() const { return hydrogen()->token(); } }; @@ -1519,7 +1519,7 @@ class LArithmeticT final : public LTemplateInstruction<1, 3, 0> { DECLARE_HYDROGEN_ACCESSOR(BinaryOperation) - LanguageMode language_mode() { return hydrogen()->language_mode(); } + Strength strength() { return hydrogen()->strength(); } private: Token::Value op_; diff --git a/src/x87/code-stubs-x87.cc b/src/x87/code-stubs-x87.cc index 2303779636..cab0000f2c 100644 --- a/src/x87/code-stubs-x87.cc +++ b/src/x87/code-stubs-x87.cc @@ -1371,7 +1371,7 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { // Check for undefined. undefined OP undefined is false even though // undefined == undefined. __ cmp(edx, isolate()->factory()->undefined_value()); - if (strong()) { + if (is_strong(strength())) { // In strong mode, this comparison must throw, so call the runtime. __ j(equal, &runtime_call, Label::kFar); } else { @@ -1397,7 +1397,7 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { // Call runtime on identical symbols since we need to throw a TypeError. __ cmpb(ecx, static_cast(SYMBOL_TYPE)); __ j(equal, &runtime_call, Label::kFar); - if (strong()) { + if (is_strong(strength())) { // We have already tested for smis and heap numbers, so if both // arguments are not strings we must proceed to the slow case. __ test(ecx, Immediate(kIsNotStringMask)); @@ -1601,7 +1601,8 @@ void CompareICStub::GenerateGeneric(MacroAssembler* masm) { if (cc == equal) { builtin = strict() ? Builtins::STRICT_EQUALS : Builtins::EQUALS; } else { - builtin = strong() ? Builtins::COMPARE_STRONG : Builtins::COMPARE; + builtin = + is_strong(strength()) ? Builtins::COMPARE_STRONG : Builtins::COMPARE; __ push(Immediate(Smi::FromInt(NegativeComparisonResult(cc)))); } @@ -3307,7 +3308,7 @@ void CompareICStub::GenerateNumbers(MacroAssembler* masm) { __ bind(&unordered); __ bind(&generic_stub); - CompareICStub stub(isolate(), op(), strong(), CompareICState::GENERIC, + CompareICStub stub(isolate(), op(), strength(), CompareICState::GENERIC, CompareICState::GENERIC, CompareICState::GENERIC); __ jmp(stub.GetCode(), RelocInfo::CODE_TARGET); diff --git a/src/x87/full-codegen-x87.cc b/src/x87/full-codegen-x87.cc index 526bfe5ae7..4d66a874fa 100644 --- a/src/x87/full-codegen-x87.cc +++ b/src/x87/full-codegen-x87.cc @@ -991,7 +991,7 @@ void FullCodeGenerator::VisitSwitchStatement(SwitchStatement* stmt) { // Record position before stub call for type feedback. SetSourcePosition(clause->position()); Handle ic = CodeFactory::CompareIC(isolate(), Token::EQ_STRICT, - language_mode()).code(); + strength(language_mode())).code(); CallIC(ic, clause->CompareId()); patch_site.EmitPatchInfo(); @@ -2357,8 +2357,8 @@ void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, __ bind(&stub_call); __ mov(eax, ecx); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); __ jmp(&done, Label::kNear); @@ -2502,8 +2502,8 @@ void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { void FullCodeGenerator::EmitBinaryOp(BinaryOperation* expr, Token::Value op) { __ pop(edx); - Handle code = CodeFactory::BinaryOpIC( - isolate(), op, language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), op, strength(language_mode())).code(); JumpPatchSite patch_site(masm_); // unbound, signals no inlined smi code. CallIC(code, expr->BinaryOperationFeedbackId()); patch_site.EmitPatchInfo(); @@ -4907,9 +4907,8 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { __ bind(&stub_call); __ mov(edx, eax); __ mov(eax, Immediate(Smi::FromInt(1))); - Handle code = - CodeFactory::BinaryOpIC( - isolate(), expr->binary_op(), language_mode()).code(); + Handle code = CodeFactory::BinaryOpIC(isolate(), expr->binary_op(), + strength(language_mode())).code(); CallIC(code, expr->CountBinOpFeedbackId()); patch_site.EmitPatchInfo(); __ bind(&done); @@ -5176,8 +5175,8 @@ void FullCodeGenerator::VisitCompareOperation(CompareOperation* expr) { // Record position and call the compare IC. SetSourcePosition(expr->position()); - Handle ic = - CodeFactory::CompareIC(isolate(), op, language_mode()).code(); + Handle ic = CodeFactory::CompareIC( + isolate(), op, strength(language_mode())).code(); CallIC(ic, expr->CompareOperationFeedbackId()); patch_site.EmitPatchInfo(); diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc index d10af1ff36..58925cd1cf 100644 --- a/src/x87/lithium-codegen-x87.cc +++ b/src/x87/lithium-codegen-x87.cc @@ -2340,8 +2340,8 @@ void LCodeGen::DoArithmeticT(LArithmeticT* instr) { DCHECK(ToRegister(instr->right()).is(eax)); DCHECK(ToRegister(instr->result()).is(eax)); - Handle code = CodeFactory::BinaryOpIC( - isolate(), instr->op(), instr->language_mode()).code(); + Handle code = + CodeFactory::BinaryOpIC(isolate(), instr->op(), instr->strength()).code(); CallCode(code, RelocInfo::CODE_TARGET, instr); } @@ -2773,7 +2773,8 @@ static Condition ComputeCompareCondition(Token::Value op) { void LCodeGen::DoStringCompareAndBranch(LStringCompareAndBranch* instr) { Token::Value op = instr->op(); - Handle ic = CodeFactory::CompareIC(isolate(), op, SLOPPY).code(); + Handle ic = + CodeFactory::CompareIC(isolate(), op, Strength::WEAK).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); Condition condition = ComputeCompareCondition(op); @@ -3046,7 +3047,7 @@ void LCodeGen::DoCmpT(LCmpT* instr) { Token::Value op = instr->op(); Handle ic = - CodeFactory::CompareIC(isolate(), op, instr->language_mode()).code(); + CodeFactory::CompareIC(isolate(), op, instr->strength()).code(); CallCode(ic, RelocInfo::CODE_TARGET, instr); Condition condition = ComputeCompareCondition(op); diff --git a/test/cctest/test-heap.cc b/test/cctest/test-heap.cc index f0dc643fc6..d520c092da 100644 --- a/test/cctest/test-heap.cc +++ b/test/cctest/test-heap.cc @@ -952,7 +952,7 @@ TEST(Iteration) { // Allocate a JS array to OLD_SPACE and NEW_SPACE objs[next_objs_index++] = factory->NewJSArray(10); objs[next_objs_index++] = - factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, WEAK, TENURED); + factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, Strength::WEAK, TENURED); // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE objs[next_objs_index++] = factory->NewStringFromStaticChars("abcdefghij"); @@ -2530,8 +2530,8 @@ TEST(PrototypeTransitionClearing) { { AlwaysAllocateScope always_allocate(isolate); SimulateFullSpace(space); - prototype = - factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, WEAK, TENURED); + prototype = factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, + Strength::WEAK, TENURED); } // Add a prototype on an evacuation candidate and verify that transition diff --git a/test/cctest/test-unboxed-doubles.cc b/test/cctest/test-unboxed-doubles.cc index d3ba5c847e..4746e47322 100644 --- a/test/cctest/test-unboxed-doubles.cc +++ b/test/cctest/test-unboxed-doubles.cc @@ -1035,7 +1035,7 @@ TEST(DoScavenge) { CcTest::heap()->CollectGarbage(i::NEW_SPACE); // Create temp object in the new space. - Handle temp = factory->NewJSArray(FAST_ELEMENTS, WEAK, NOT_TENURED); + Handle temp = factory->NewJSArray(FAST_ELEMENTS); CHECK(isolate->heap()->new_space()->Contains(*temp)); // Construct a double value that looks like a pointer to the new space object @@ -1088,8 +1088,8 @@ TEST(DoScavengeWithIncrementalWriteBarrier) { AlwaysAllocateScope always_allocate(isolate); // Make sure |obj_value| is placed on an old-space evacuation candidate. SimulateFullSpace(old_space); - obj_value = - factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, WEAK, TENURED); + obj_value = factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, + Strength::WEAK, TENURED); ec_page = Page::FromAddress(obj_value->address()); } @@ -1374,7 +1374,7 @@ TEST(StoreBufferScanOnScavenge) { CHECK(isolate->heap()->old_space()->Contains(*obj)); // Create temp object in the new space. - Handle temp = factory->NewJSArray(FAST_ELEMENTS, WEAK, NOT_TENURED); + Handle temp = factory->NewJSArray(FAST_ELEMENTS); CHECK(isolate->heap()->new_space()->Contains(*temp)); // Construct a double value that looks like a pointer to the new space object @@ -1573,8 +1573,8 @@ static void TestIncrementalWriteBarrier(Handle map, Handle new_map, // Make sure |obj_value| is placed on an old-space evacuation candidate. SimulateFullSpace(old_space); - obj_value = - factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, WEAK, TENURED); + obj_value = factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, + Strength::WEAK, TENURED); ec_page = Page::FromAddress(obj_value->address()); CHECK_NE(ec_page, Page::FromAddress(obj->address())); }