From ab2493e428421a3dca881b13e836cea93b57461d Mon Sep 17 00:00:00 2001 From: "plind44@gmail.com" Date: Tue, 11 Mar 2014 20:28:28 +0000 Subject: [PATCH] MIPS: Mode clean-up pt 1: rename classic/non-strict mode to sloppy mode. Port r19799 (8fb4c93) BUG= R=plind44@gmail.com Review URL: https://codereview.chromium.org/194613005 Patch from Balazs Kilvady . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19824 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/mips/builtins-mips.cc | 4 ++-- src/mips/code-stubs-mips.cc | 8 ++++---- src/mips/full-codegen-mips.cc | 32 ++++++++++++++++---------------- src/mips/ic-mips.cc | 9 ++++++--- src/mips/lithium-codegen-mips.cc | 2 +- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/mips/builtins-mips.cc b/src/mips/builtins-mips.cc index 9f18f4e..b0a70a2 100644 --- a/src/mips/builtins-mips.cc +++ b/src/mips/builtins-mips.cc @@ -1066,7 +1066,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) { __ And(t3, a3, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize))); __ Branch(&shift_arguments, ne, t3, Operand(zero_reg)); - // Compute the receiver in non-strict mode. + // Compute the receiver in sloppy mode. // Load first argument in a2. a2 = -kPointerSize(sp + n_args << 2). __ sll(at, a0, kPointerSizeLog2); __ addu(a2, sp, at); @@ -1269,7 +1269,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) { __ And(t3, a2, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize))); __ Branch(&push_receiver, ne, t3, Operand(zero_reg)); - // Compute the receiver in non-strict mode. + // Compute the receiver in sloppy mode. __ JumpIfSmi(a0, &call_to_object); __ LoadRoot(a1, Heap::kNullValueRootIndex); __ Branch(&use_global_receiver, eq, a0, Operand(a1)); diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc index 8941519..15f3b25 100644 --- a/src/mips/code-stubs-mips.cc +++ b/src/mips/code-stubs-mips.cc @@ -2365,7 +2365,7 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) { } -void ArgumentsAccessStub::GenerateNewNonStrictSlow(MacroAssembler* masm) { +void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) { // sp[0] : number of parameters // sp[4] : receiver displacement // sp[8] : function @@ -2391,7 +2391,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictSlow(MacroAssembler* masm) { } -void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) { +void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) { // Stack layout: // sp[0] : number of parameters (tagged) // sp[4] : address of receiver argument @@ -2523,7 +2523,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) { __ Branch(&skip_parameter_map, eq, a1, Operand(Smi::FromInt(0))); - __ LoadRoot(t2, Heap::kNonStrictArgumentsElementsMapRootIndex); + __ LoadRoot(t2, Heap::kSloppyArgumentsElementsMapRootIndex); __ sw(t2, FieldMemOperand(t0, FixedArray::kMapOffset)); __ Addu(t2, a1, Operand(Smi::FromInt(2))); __ sw(t2, FieldMemOperand(t0, FixedArray::kLengthOffset)); @@ -3285,7 +3285,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) { __ Branch(&cont, ne, at, Operand(zero_reg)); } - // Compute the receiver in non-strict mode. + // Compute the receiver in sloppy mode. __ lw(a3, MemOperand(sp, argc_ * kPointerSize)); if (NeedsChecks()) { diff --git a/src/mips/full-codegen-mips.cc b/src/mips/full-codegen-mips.cc index 9eec0a3..496d6a7 100644 --- a/src/mips/full-codegen-mips.cc +++ b/src/mips/full-codegen-mips.cc @@ -153,10 +153,10 @@ void FullCodeGenerator::Generate() { } #endif - // Classic mode functions and builtins need to replace the receiver with the + // Sloppy mode functions and builtins need to replace the receiver with the // global proxy when called as functions (without an explicit receiver // object). - if (info->is_classic_mode() && !info->is_native()) { + if (info->is_sloppy_mode() && !info->is_native()) { Label ok; int receiver_offset = info->scope()->num_parameters() * kPointerSize; __ lw(at, MemOperand(sp, receiver_offset)); @@ -271,12 +271,12 @@ void FullCodeGenerator::Generate() { // The stub will rewrite receiever and parameter count if the previous // stack frame was an arguments adapter frame. ArgumentsAccessStub::Type type; - if (!is_classic_mode()) { + if (!is_sloppy_mode()) { type = ArgumentsAccessStub::NEW_STRICT; } else if (function()->has_duplicate_parameters()) { - type = ArgumentsAccessStub::NEW_NON_STRICT_SLOW; + type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; } else { - type = ArgumentsAccessStub::NEW_NON_STRICT_FAST; + type = ArgumentsAccessStub::NEW_SLOPPY_FAST; } ArgumentsAccessStub stub(type); __ CallStub(&stub); @@ -1366,7 +1366,7 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, Scope* s = scope(); while (s != NULL) { if (s->num_heap_slots() > 0) { - if (s->calls_non_strict_eval()) { + if (s->calls_sloppy_eval()) { // Check that extension is NULL. __ lw(temp, ContextOperand(current, Context::EXTENSION_INDEX)); __ Branch(slow, ne, temp, Operand(zero_reg)); @@ -1378,7 +1378,7 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var, } // If no outer scope calls eval, we do not need to check more // context extensions. - if (!s->outer_scope_calls_non_strict_eval() || s->is_eval_scope()) break; + if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break; s = s->outer_scope(); } @@ -1419,7 +1419,7 @@ MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) { if (s->num_heap_slots() > 0) { - if (s->calls_non_strict_eval()) { + if (s->calls_sloppy_eval()) { // Check that extension is NULL. __ lw(temp, ContextOperand(context, Context::EXTENSION_INDEX)); __ Branch(slow, ne, temp, Operand(zero_reg)); @@ -2459,7 +2459,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) { VisitForAccumulatorValue(prop->key()); __ mov(a1, result_register()); __ Pop(a0, a2); // a0 = restored value. - Handle ic = is_classic_mode() + Handle ic = is_sloppy_mode() ? isolate()->builtins()->KeyedStoreIC_Initialize() : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); CallIC(ic); @@ -2591,7 +2591,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { __ mov(a0, result_register()); __ Pop(a2, a1); // a1 = key. - Handle ic = is_classic_mode() + Handle ic = is_sloppy_mode() ? isolate()->builtins()->KeyedStoreIC_Initialize() : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); CallIC(ic, expr->AssignmentFeedbackId()); @@ -2641,7 +2641,7 @@ void FullCodeGenerator::EmitCallWithIC(Call* expr) { PrepareForBailout(callee, NO_REGISTERS); } // Push undefined as receiver. This is patched in the method prologue if it - // is a classic mode method. + // is a sloppy mode method. __ Push(isolate()->factory()->undefined_value()); flags = NO_CALL_FUNCTION_FLAGS; } else { @@ -4227,8 +4227,8 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { if (property != NULL) { VisitForStackValue(property->obj()); VisitForStackValue(property->key()); - StrictModeFlag strict_mode_flag = (language_mode() == CLASSIC_MODE) - ? kNonStrictMode : kStrictMode; + StrictModeFlag strict_mode_flag = (language_mode() == SLOPPY_MODE) + ? kSloppyMode : kStrictMode; __ li(a1, Operand(Smi::FromInt(strict_mode_flag))); __ push(a1); __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); @@ -4237,11 +4237,11 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { Variable* var = proxy->var(); // Delete of an unqualified identifier is disallowed in strict mode // but "delete this" is allowed. - ASSERT(language_mode() == CLASSIC_MODE || var->is_this()); + ASSERT(language_mode() == SLOPPY_MODE || var->is_this()); if (var->IsUnallocated()) { __ lw(a2, GlobalObjectOperand()); __ li(a1, Operand(var->name())); - __ li(a0, Operand(Smi::FromInt(kNonStrictMode))); + __ li(a0, Operand(Smi::FromInt(kSloppyMode))); __ Push(a2, a1, a0); __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); context()->Plug(v0); @@ -4500,7 +4500,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { case KEYED_PROPERTY: { __ mov(a0, result_register()); // Value. __ Pop(a2, a1); // a1 = key, a2 = receiver. - Handle ic = is_classic_mode() + Handle ic = is_sloppy_mode() ? isolate()->builtins()->KeyedStoreIC_Initialize() : isolate()->builtins()->KeyedStoreIC_Initialize_Strict(); CallIC(ic, expr->CountStoreFeedbackId()); diff --git a/src/mips/ic-mips.cc b/src/mips/ic-mips.cc index 4088ea4..23e5506 100644 --- a/src/mips/ic-mips.cc +++ b/src/mips/ic-mips.cc @@ -417,6 +417,8 @@ static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm, Register scratch3, Label* unmapped_case, Label* slow_case) { + Heap* heap = masm->isolate()->heap(); + // Check that the receiver is a JSObject. Because of the map check // later, we do not need to check for interceptors or whether it // requires access checks. @@ -430,10 +432,11 @@ static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm, __ Branch(slow_case, ne, scratch1, Operand(zero_reg)); // Load the elements into scratch1 and check its map. + Handle arguments_map(heap->sloppy_arguments_elements_map()); __ lw(scratch1, FieldMemOperand(object, JSObject::kElementsOffset)); __ CheckMap(scratch1, scratch2, - Heap::kNonStrictArgumentsElementsMapRootIndex, + arguments_map, slow_case, DONT_DO_SMI_CHECK); // Check if element is in the range of mapped arguments. If not, jump @@ -496,7 +499,7 @@ static MemOperand GenerateUnmappedArgumentsLookup(MacroAssembler* masm, } -void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) { +void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) { // ---------- S t a t e -------------- // -- lr : return address // -- a0 : key @@ -521,7 +524,7 @@ void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) { } -void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) { +void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) { // ---------- S t a t e -------------- // -- a0 : value // -- a1 : key diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc index 435321a..426e9f7 100644 --- a/src/mips/lithium-codegen-mips.cc +++ b/src/mips/lithium-codegen-mips.cc @@ -146,7 +146,7 @@ bool LCodeGen::GeneratePrologue() { // fp: Caller's frame pointer. // lr: Caller's pc. - // Classic mode functions and builtins need to replace the receiver with the + // Sloppy mode functions and builtins need to replace the receiver with the // global proxy when called as functions (without an explicit receiver // object). if (info_->this_has_uses() && -- 2.7.4