Commit ff0c7038 authored by balazs.kilvady's avatar balazs.kilvady Committed by Commit bot

MIPS: Introduce LanguageMode, drop StrictMode.

Port c7851da4

Original commit message:
This enables adding more language modes in the future.

For maximum flexibility, LanguageMode is a bitmask, so we're not restricted to
use a sequence of language modes which are progressively stricter, but we can
express the language mode as combination of features.

For now, LanguageMode can only be "sloppy" or "strict", and there are
STATIC_ASSERTS in places which need to change when more modes are added.

LanguageMode is a bit like the old LanguageMode when "extended" mode was still
around (see https://codereview.chromium.org/8417035 and
https://codereview.chromium.org/181543002 ) except that it's transmitted through
all the layers (there's no StrictModeFlag).

BUG=

Review URL: https://codereview.chromium.org/890413003

Cr-Commit-Position: refs/heads/master@{#26431}
parent 1f7e3b34
...@@ -1061,7 +1061,7 @@ void CodeGenerator::AssemblePrologue() { ...@@ -1061,7 +1061,7 @@ void CodeGenerator::AssemblePrologue() {
// global proxy when called as functions (without an explicit receiver // global proxy when called as functions (without an explicit receiver
// object). // object).
// TODO(mstarzinger/verwaest): Should this be moved back into the CallIC? // TODO(mstarzinger/verwaest): Should this be moved back into the CallIC?
if (info->strict_mode() == SLOPPY && !info->is_native()) { if (is_sloppy(info->language_mode()) && !info->is_native()) {
Label ok; Label ok;
// +2 for return address and saved frame pointer. // +2 for return address and saved frame pointer.
int receiver_slot = info->scope()->num_parameters() + 2; int receiver_slot = info->scope()->num_parameters() + 2;
......
...@@ -121,12 +121,12 @@ Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( ...@@ -121,12 +121,12 @@ Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic(
#define __ ACCESS_MASM(masm) #define __ ACCESS_MASM(masm)
void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm, void PropertyICCompiler::GenerateRuntimeSetProperty(
StrictMode strict_mode) { MacroAssembler* masm, LanguageMode language_mode) {
__ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
StoreDescriptor::ValueRegister()); StoreDescriptor::ValueRegister());
__ li(a0, Operand(Smi::FromInt(strict_mode))); __ li(a0, Operand(Smi::FromInt(language_mode)));
__ Push(a0); __ Push(a0);
// Do tail-call to runtime routine. // Do tail-call to runtime routine.
......
...@@ -724,7 +724,7 @@ static void KeyedStoreGenerateMegamorphicHelper( ...@@ -724,7 +724,7 @@ static void KeyedStoreGenerateMegamorphicHelper(
void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm, void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
StrictMode strict_mode) { LanguageMode language_mode) {
// ---------- S t a t e -------------- // ---------- S t a t e --------------
// -- a0 : value // -- a0 : value
// -- a1 : key // -- a1 : key
...@@ -775,7 +775,7 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm, ...@@ -775,7 +775,7 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
// a0: value. // a0: value.
// a1: key. // a1: key.
// a2: receiver. // a2: receiver.
PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode); PropertyICCompiler::GenerateRuntimeSetProperty(masm, language_mode);
// Never returns to here. // Never returns to here.
__ bind(&maybe_name_key); __ bind(&maybe_name_key);
......
...@@ -121,12 +121,12 @@ Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic( ...@@ -121,12 +121,12 @@ Handle<Code> PropertyICCompiler::CompileKeyedStorePolymorphic(
#define __ ACCESS_MASM(masm) #define __ ACCESS_MASM(masm)
void PropertyICCompiler::GenerateRuntimeSetProperty(MacroAssembler* masm, void PropertyICCompiler::GenerateRuntimeSetProperty(
StrictMode strict_mode) { MacroAssembler* masm, LanguageMode language_mode) {
__ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(), __ Push(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister(),
StoreDescriptor::ValueRegister()); StoreDescriptor::ValueRegister());
__ li(a0, Operand(Smi::FromInt(strict_mode))); __ li(a0, Operand(Smi::FromInt(language_mode)));
__ Push(a0); __ Push(a0);
// Do tail-call to runtime routine. // Do tail-call to runtime routine.
......
...@@ -726,7 +726,7 @@ static void KeyedStoreGenerateMegamorphicHelper( ...@@ -726,7 +726,7 @@ static void KeyedStoreGenerateMegamorphicHelper(
void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm, void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
StrictMode strict_mode) { LanguageMode language_mode) {
// ---------- S t a t e -------------- // ---------- S t a t e --------------
// -- a0 : value // -- a0 : value
// -- a1 : key // -- a1 : key
...@@ -777,7 +777,7 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm, ...@@ -777,7 +777,7 @@ void KeyedStoreIC::GenerateMegamorphic(MacroAssembler* masm,
// a0: value. // a0: value.
// a1: key. // a1: key.
// a2: receiver. // a2: receiver.
PropertyICCompiler::GenerateRuntimeSetProperty(masm, strict_mode); PropertyICCompiler::GenerateRuntimeSetProperty(masm, language_mode);
// Never returns to here. // Never returns to here.
__ bind(&maybe_name_key); __ bind(&maybe_name_key);
......
...@@ -134,7 +134,7 @@ void FullCodeGenerator::Generate() { ...@@ -134,7 +134,7 @@ void FullCodeGenerator::Generate() {
// Sloppy 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 // global proxy when called as functions (without an explicit receiver
// object). // object).
if (info->strict_mode() == SLOPPY && !info->is_native()) { if (is_sloppy(info->language_mode()) && !info->is_native()) {
Label ok; Label ok;
int receiver_offset = info->scope()->num_parameters() * kPointerSize; int receiver_offset = info->scope()->num_parameters() * kPointerSize;
__ lw(at, MemOperand(sp, receiver_offset)); __ lw(at, MemOperand(sp, receiver_offset));
...@@ -272,7 +272,7 @@ void FullCodeGenerator::Generate() { ...@@ -272,7 +272,7 @@ void FullCodeGenerator::Generate() {
// The stub will rewrite receiever and parameter count if the previous // The stub will rewrite receiever and parameter count if the previous
// stack frame was an arguments adapter frame. // stack frame was an arguments adapter frame.
ArgumentsAccessStub::Type type; ArgumentsAccessStub::Type type;
if (strict_mode() == STRICT) { if (is_strict(language_mode())) {
type = ArgumentsAccessStub::NEW_STRICT; type = ArgumentsAccessStub::NEW_STRICT;
} else if (function()->has_duplicate_parameters()) { } else if (function()->has_duplicate_parameters()) {
type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
...@@ -1287,7 +1287,7 @@ void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, ...@@ -1287,7 +1287,7 @@ void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info,
!pretenure && !pretenure &&
scope()->is_function_scope() && scope()->is_function_scope() &&
info->num_literals() == 0) { info->num_literals() == 0) {
FastNewClosureStub stub(isolate(), info->strict_mode(), info->kind()); FastNewClosureStub stub(isolate(), info->language_mode(), info->kind());
__ li(a2, Operand(info)); __ li(a2, Operand(info));
__ CallStub(&stub); __ CallStub(&stub);
} else { } else {
...@@ -2641,7 +2641,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) { ...@@ -2641,7 +2641,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
__ Pop(StoreDescriptor::ValueRegister(), __ Pop(StoreDescriptor::ValueRegister(),
StoreDescriptor::ReceiverRegister()); StoreDescriptor::ReceiverRegister());
Handle<Code> ic = Handle<Code> ic =
CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
CallIC(ic); CallIC(ic);
break; break;
} }
...@@ -2708,8 +2708,8 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) { ...@@ -2708,8 +2708,8 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) {
if (var->IsLookupSlot()) { if (var->IsLookupSlot()) {
// Assignment to var. // Assignment to var.
__ li(a1, Operand(var->name())); __ li(a1, Operand(var->name()));
__ li(a0, Operand(Smi::FromInt(strict_mode()))); __ li(a0, Operand(Smi::FromInt(language_mode())));
__ Push(v0, cp, a1, a0); // Value, context, name, strict mode. __ Push(v0, cp, a1, a0); // Value, context, name, language mode.
__ CallRuntime(Runtime::kStoreLookupSlot, 4); __ CallRuntime(Runtime::kStoreLookupSlot, 4);
} else { } else {
// Assignment to var or initializing assignment to let/const in harmony // Assignment to var or initializing assignment to let/const in harmony
...@@ -2724,7 +2724,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) { ...@@ -2724,7 +2724,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) {
} }
EmitStoreToStackLocalOrContextSlot(var, location); EmitStoreToStackLocalOrContextSlot(var, location);
} }
} else if (IsSignallingAssignmentToConst(var, op, strict_mode())) { } else if (IsSignallingAssignmentToConst(var, op, language_mode())) {
__ CallRuntime(Runtime::kThrowConstAssignError, 0); __ CallRuntime(Runtime::kThrowConstAssignError, 0);
} }
} }
...@@ -2759,8 +2759,8 @@ void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { ...@@ -2759,8 +2759,8 @@ void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) {
__ Push(key->value()); __ Push(key->value());
__ Push(v0); __ Push(v0);
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict __ CallRuntime((is_strict(language_mode()) ? Runtime::kStoreToSuper_Strict
: Runtime::kStoreToSuper_Sloppy), : Runtime::kStoreToSuper_Sloppy),
4); 4);
} }
...@@ -2772,9 +2772,10 @@ void FullCodeGenerator::EmitKeyedSuperPropertyStore(Property* prop) { ...@@ -2772,9 +2772,10 @@ void FullCodeGenerator::EmitKeyedSuperPropertyStore(Property* prop) {
DCHECK(prop != NULL); DCHECK(prop != NULL);
__ Push(v0); __ Push(v0);
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreKeyedToSuper_Strict __ CallRuntime(
: Runtime::kStoreKeyedToSuper_Sloppy), (is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
4); : Runtime::kStoreKeyedToSuper_Sloppy),
4);
} }
...@@ -2792,7 +2793,8 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { ...@@ -2792,7 +2793,8 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
__ Pop(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister()); __ Pop(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister());
DCHECK(StoreDescriptor::ValueRegister().is(a0)); DCHECK(StoreDescriptor::ValueRegister().is(a0));
Handle<Code> ic = CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); Handle<Code> ic =
CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
CallIC(ic, expr->AssignmentFeedbackId()); CallIC(ic, expr->AssignmentFeedbackId());
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
...@@ -3010,8 +3012,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { ...@@ -3010,8 +3012,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
int receiver_offset = 2 + info_->scope()->num_parameters(); int receiver_offset = 2 + info_->scope()->num_parameters();
__ lw(t1, MemOperand(fp, receiver_offset * kPointerSize)); __ lw(t1, MemOperand(fp, receiver_offset * kPointerSize));
// t0: the strict mode. // t0: the language mode.
__ li(t0, Operand(Smi::FromInt(strict_mode()))); __ li(t0, Operand(Smi::FromInt(language_mode())));
// a1: the start position of the scope the calls resides in. // a1: the start position of the scope the calls resides in.
__ li(a1, Operand(Smi::FromInt(scope()->start_position()))); __ li(a1, Operand(Smi::FromInt(scope()->start_position())));
...@@ -4575,7 +4577,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { ...@@ -4575,7 +4577,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
if (property != NULL) { if (property != NULL) {
VisitForStackValue(property->obj()); VisitForStackValue(property->obj());
VisitForStackValue(property->key()); VisitForStackValue(property->key());
__ li(a1, Operand(Smi::FromInt(strict_mode()))); __ li(a1, Operand(Smi::FromInt(language_mode())));
__ push(a1); __ push(a1);
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
context()->Plug(v0); context()->Plug(v0);
...@@ -4583,7 +4585,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { ...@@ -4583,7 +4585,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
Variable* var = proxy->var(); Variable* var = proxy->var();
// Delete of an unqualified identifier is disallowed in strict mode // Delete of an unqualified identifier is disallowed in strict mode
// but "delete this" is allowed. // but "delete this" is allowed.
DCHECK(strict_mode() == SLOPPY || var->is_this()); DCHECK(is_sloppy(language_mode()) || var->is_this());
if (var->IsUnallocated()) { if (var->IsUnallocated()) {
__ lw(a2, GlobalObjectOperand()); __ lw(a2, GlobalObjectOperand());
__ li(a1, Operand(var->name())); __ li(a1, Operand(var->name()));
...@@ -4906,7 +4908,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { ...@@ -4906,7 +4908,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
__ Pop(StoreDescriptor::ReceiverRegister(), __ Pop(StoreDescriptor::ReceiverRegister(),
StoreDescriptor::NameRegister()); StoreDescriptor::NameRegister());
Handle<Code> ic = Handle<Code> ic =
CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
CallIC(ic, expr->CountStoreFeedbackId()); CallIC(ic, expr->CountStoreFeedbackId());
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
if (expr->is_postfix()) { if (expr->is_postfix()) {
......
...@@ -142,8 +142,7 @@ bool LCodeGen::GeneratePrologue() { ...@@ -142,8 +142,7 @@ bool LCodeGen::GeneratePrologue() {
// Sloppy 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 // global proxy when called as functions (without an explicit receiver
// object). // object).
if (info_->this_has_uses() && if (info_->this_has_uses() && is_sloppy(info_->language_mode()) &&
info_->strict_mode() == SLOPPY &&
!info_->is_native()) { !info_->is_native()) {
Label ok; Label ok;
int receiver_offset = info_->scope()->num_parameters() * kPointerSize; int receiver_offset = info_->scope()->num_parameters() * kPointerSize;
...@@ -4254,7 +4253,7 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { ...@@ -4254,7 +4253,7 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
__ li(StoreDescriptor::NameRegister(), Operand(instr->name())); __ li(StoreDescriptor::NameRegister(), Operand(instr->name()));
Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode());
CallCode(ic, RelocInfo::CODE_TARGET, instr); CallCode(ic, RelocInfo::CODE_TARGET, instr);
} }
...@@ -4486,7 +4485,7 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { ...@@ -4486,7 +4485,7 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
Handle<Code> ic = Handle<Code> ic =
CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code(); CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr); CallCode(ic, RelocInfo::CODE_TARGET, instr);
} }
...@@ -5542,7 +5541,7 @@ void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { ...@@ -5542,7 +5541,7 @@ void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
// space for nested functions that don't need literals cloning. // space for nested functions that don't need literals cloning.
bool pretenure = instr->hydrogen()->pretenure(); bool pretenure = instr->hydrogen()->pretenure();
if (!pretenure && instr->hydrogen()->has_no_literals()) { if (!pretenure && instr->hydrogen()->has_no_literals()) {
FastNewClosureStub stub(isolate(), instr->hydrogen()->strict_mode(), FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(),
instr->hydrogen()->kind()); instr->hydrogen()->kind());
__ li(a2, Operand(instr->hydrogen()->shared_info())); __ li(a2, Operand(instr->hydrogen()->shared_info()));
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
......
...@@ -143,7 +143,7 @@ class LCodeGen: public LCodeGenBase { ...@@ -143,7 +143,7 @@ class LCodeGen: public LCodeGenBase {
#undef DECLARE_DO #undef DECLARE_DO
private: private:
StrictMode strict_mode() const { return info()->strict_mode(); } LanguageMode language_mode() const { return info()->language_mode(); }
Scope* scope() const { return scope_; } Scope* scope() const { return scope_; }
......
...@@ -2194,7 +2194,7 @@ class LStoreNamedGeneric FINAL : public LTemplateInstruction<0, 3, 0> { ...@@ -2194,7 +2194,7 @@ class LStoreNamedGeneric FINAL : public LTemplateInstruction<0, 3, 0> {
void PrintDataTo(StringStream* stream) OVERRIDE; void PrintDataTo(StringStream* stream) OVERRIDE;
Handle<Object> name() const { return hydrogen()->name(); } Handle<Object> name() const { return hydrogen()->name(); }
StrictMode strict_mode() { return hydrogen()->strict_mode(); } LanguageMode language_mode() { return hydrogen()->language_mode(); }
}; };
...@@ -2251,7 +2251,7 @@ class LStoreKeyedGeneric FINAL : public LTemplateInstruction<0, 4, 0> { ...@@ -2251,7 +2251,7 @@ class LStoreKeyedGeneric FINAL : public LTemplateInstruction<0, 4, 0> {
void PrintDataTo(StringStream* stream) OVERRIDE; void PrintDataTo(StringStream* stream) OVERRIDE;
StrictMode strict_mode() { return hydrogen()->strict_mode(); } LanguageMode language_mode() { return hydrogen()->language_mode(); }
}; };
......
...@@ -134,7 +134,7 @@ void FullCodeGenerator::Generate() { ...@@ -134,7 +134,7 @@ void FullCodeGenerator::Generate() {
// Sloppy 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 // global proxy when called as functions (without an explicit receiver
// object). // object).
if (info->strict_mode() == SLOPPY && !info->is_native()) { if (is_sloppy(info->language_mode()) && !info->is_native()) {
Label ok; Label ok;
int receiver_offset = info->scope()->num_parameters() * kPointerSize; int receiver_offset = info->scope()->num_parameters() * kPointerSize;
__ ld(at, MemOperand(sp, receiver_offset)); __ ld(at, MemOperand(sp, receiver_offset));
...@@ -268,7 +268,7 @@ void FullCodeGenerator::Generate() { ...@@ -268,7 +268,7 @@ void FullCodeGenerator::Generate() {
// The stub will rewrite receiever and parameter count if the previous // The stub will rewrite receiever and parameter count if the previous
// stack frame was an arguments adapter frame. // stack frame was an arguments adapter frame.
ArgumentsAccessStub::Type type; ArgumentsAccessStub::Type type;
if (strict_mode() == STRICT) { if (is_strict(language_mode())) {
type = ArgumentsAccessStub::NEW_STRICT; type = ArgumentsAccessStub::NEW_STRICT;
} else if (function()->has_duplicate_parameters()) { } else if (function()->has_duplicate_parameters()) {
type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
...@@ -1282,7 +1282,7 @@ void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, ...@@ -1282,7 +1282,7 @@ void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info,
!pretenure && !pretenure &&
scope()->is_function_scope() && scope()->is_function_scope() &&
info->num_literals() == 0) { info->num_literals() == 0) {
FastNewClosureStub stub(isolate(), info->strict_mode(), info->kind()); FastNewClosureStub stub(isolate(), info->language_mode(), info->kind());
__ li(a2, Operand(info)); __ li(a2, Operand(info));
__ CallStub(&stub); __ CallStub(&stub);
} else { } else {
...@@ -2638,7 +2638,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) { ...@@ -2638,7 +2638,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
__ Pop(StoreDescriptor::ValueRegister(), __ Pop(StoreDescriptor::ValueRegister(),
StoreDescriptor::ReceiverRegister()); StoreDescriptor::ReceiverRegister());
Handle<Code> ic = Handle<Code> ic =
CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
CallIC(ic); CallIC(ic);
break; break;
} }
...@@ -2704,8 +2704,8 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) { ...@@ -2704,8 +2704,8 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) {
if (var->IsLookupSlot()) { if (var->IsLookupSlot()) {
// Assignment to var. // Assignment to var.
__ li(a4, Operand(var->name())); __ li(a4, Operand(var->name()));
__ li(a3, Operand(Smi::FromInt(strict_mode()))); __ li(a3, Operand(Smi::FromInt(language_mode())));
// jssp[0] : mode. // jssp[0] : language mode.
// jssp[8] : name. // jssp[8] : name.
// jssp[16] : context. // jssp[16] : context.
// jssp[24] : value. // jssp[24] : value.
...@@ -2724,7 +2724,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) { ...@@ -2724,7 +2724,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op) {
} }
EmitStoreToStackLocalOrContextSlot(var, location); EmitStoreToStackLocalOrContextSlot(var, location);
} }
} else if (IsSignallingAssignmentToConst(var, op, strict_mode())) { } else if (IsSignallingAssignmentToConst(var, op, language_mode())) {
__ CallRuntime(Runtime::kThrowConstAssignError, 0); __ CallRuntime(Runtime::kThrowConstAssignError, 0);
} }
} }
...@@ -2759,8 +2759,8 @@ void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) { ...@@ -2759,8 +2759,8 @@ void FullCodeGenerator::EmitNamedSuperPropertyStore(Property* prop) {
__ Push(key->value()); __ Push(key->value());
__ Push(v0); __ Push(v0);
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreToSuper_Strict __ CallRuntime((is_strict(language_mode()) ? Runtime::kStoreToSuper_Strict
: Runtime::kStoreToSuper_Sloppy), : Runtime::kStoreToSuper_Sloppy),
4); 4);
} }
...@@ -2772,9 +2772,10 @@ void FullCodeGenerator::EmitKeyedSuperPropertyStore(Property* prop) { ...@@ -2772,9 +2772,10 @@ void FullCodeGenerator::EmitKeyedSuperPropertyStore(Property* prop) {
DCHECK(prop != NULL); DCHECK(prop != NULL);
__ Push(v0); __ Push(v0);
__ CallRuntime((strict_mode() == STRICT ? Runtime::kStoreKeyedToSuper_Strict __ CallRuntime(
: Runtime::kStoreKeyedToSuper_Sloppy), (is_strict(language_mode()) ? Runtime::kStoreKeyedToSuper_Strict
4); : Runtime::kStoreKeyedToSuper_Sloppy),
4);
} }
...@@ -2792,7 +2793,8 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) { ...@@ -2792,7 +2793,8 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
__ Pop(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister()); __ Pop(StoreDescriptor::ReceiverRegister(), StoreDescriptor::NameRegister());
DCHECK(StoreDescriptor::ValueRegister().is(a0)); DCHECK(StoreDescriptor::ValueRegister().is(a0));
Handle<Code> ic = CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); Handle<Code> ic =
CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
CallIC(ic, expr->AssignmentFeedbackId()); CallIC(ic, expr->AssignmentFeedbackId());
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
...@@ -3009,8 +3011,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { ...@@ -3009,8 +3011,8 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
int receiver_offset = 2 + info_->scope()->num_parameters(); int receiver_offset = 2 + info_->scope()->num_parameters();
__ ld(a5, MemOperand(fp, receiver_offset * kPointerSize)); __ ld(a5, MemOperand(fp, receiver_offset * kPointerSize));
// a4: the strict mode. // a4: the language mode.
__ li(a4, Operand(Smi::FromInt(strict_mode()))); __ li(a4, Operand(Smi::FromInt(language_mode())));
// a1: the start position of the scope the calls resides in. // a1: the start position of the scope the calls resides in.
__ li(a1, Operand(Smi::FromInt(scope()->start_position()))); __ li(a1, Operand(Smi::FromInt(scope()->start_position())));
...@@ -4575,7 +4577,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { ...@@ -4575,7 +4577,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
if (property != NULL) { if (property != NULL) {
VisitForStackValue(property->obj()); VisitForStackValue(property->obj());
VisitForStackValue(property->key()); VisitForStackValue(property->key());
__ li(a1, Operand(Smi::FromInt(strict_mode()))); __ li(a1, Operand(Smi::FromInt(language_mode())));
__ push(a1); __ push(a1);
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
context()->Plug(v0); context()->Plug(v0);
...@@ -4583,7 +4585,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) { ...@@ -4583,7 +4585,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
Variable* var = proxy->var(); Variable* var = proxy->var();
// Delete of an unqualified identifier is disallowed in strict mode // Delete of an unqualified identifier is disallowed in strict mode
// but "delete this" is allowed. // but "delete this" is allowed.
DCHECK(strict_mode() == SLOPPY || var->is_this()); DCHECK(is_sloppy(language_mode()) || var->is_this());
if (var->IsUnallocated()) { if (var->IsUnallocated()) {
__ ld(a2, GlobalObjectOperand()); __ ld(a2, GlobalObjectOperand());
__ li(a1, Operand(var->name())); __ li(a1, Operand(var->name()));
...@@ -4906,7 +4908,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) { ...@@ -4906,7 +4908,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
__ Pop(StoreDescriptor::ReceiverRegister(), __ Pop(StoreDescriptor::ReceiverRegister(),
StoreDescriptor::NameRegister()); StoreDescriptor::NameRegister());
Handle<Code> ic = Handle<Code> ic =
CodeFactory::KeyedStoreIC(isolate(), strict_mode()).code(); CodeFactory::KeyedStoreIC(isolate(), language_mode()).code();
CallIC(ic, expr->CountStoreFeedbackId()); CallIC(ic, expr->CountStoreFeedbackId());
PrepareForBailoutForId(expr->AssignmentId(), TOS_REG); PrepareForBailoutForId(expr->AssignmentId(), TOS_REG);
if (expr->is_postfix()) { if (expr->is_postfix()) {
......
...@@ -117,8 +117,7 @@ bool LCodeGen::GeneratePrologue() { ...@@ -117,8 +117,7 @@ bool LCodeGen::GeneratePrologue() {
// Sloppy 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 // global proxy when called as functions (without an explicit receiver
// object). // object).
if (info_->this_has_uses() && if (info_->this_has_uses() && is_sloppy(info_->language_mode()) &&
info_->strict_mode() == SLOPPY &&
!info_->is_native()) { !info_->is_native()) {
Label ok; Label ok;
int receiver_offset = info_->scope()->num_parameters() * kPointerSize; int receiver_offset = info_->scope()->num_parameters() * kPointerSize;
...@@ -4283,7 +4282,7 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { ...@@ -4283,7 +4282,7 @@ void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) {
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
__ li(StoreDescriptor::NameRegister(), Operand(instr->name())); __ li(StoreDescriptor::NameRegister(), Operand(instr->name()));
Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->strict_mode()); Handle<Code> ic = StoreIC::initialize_stub(isolate(), instr->language_mode());
CallCode(ic, RelocInfo::CODE_TARGET, instr); CallCode(ic, RelocInfo::CODE_TARGET, instr);
} }
...@@ -4548,7 +4547,7 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { ...@@ -4548,7 +4547,7 @@ void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) {
DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister()));
Handle<Code> ic = Handle<Code> ic =
CodeFactory::KeyedStoreIC(isolate(), instr->strict_mode()).code(); CodeFactory::KeyedStoreIC(isolate(), instr->language_mode()).code();
CallCode(ic, RelocInfo::CODE_TARGET, instr); CallCode(ic, RelocInfo::CODE_TARGET, instr);
} }
...@@ -5572,7 +5571,7 @@ void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) { ...@@ -5572,7 +5571,7 @@ void LCodeGen::DoFunctionLiteral(LFunctionLiteral* instr) {
// space for nested functions that don't need literals cloning. // space for nested functions that don't need literals cloning.
bool pretenure = instr->hydrogen()->pretenure(); bool pretenure = instr->hydrogen()->pretenure();
if (!pretenure && instr->hydrogen()->has_no_literals()) { if (!pretenure && instr->hydrogen()->has_no_literals()) {
FastNewClosureStub stub(isolate(), instr->hydrogen()->strict_mode(), FastNewClosureStub stub(isolate(), instr->hydrogen()->language_mode(),
instr->hydrogen()->kind()); instr->hydrogen()->kind());
__ li(a2, Operand(instr->hydrogen()->shared_info())); __ li(a2, Operand(instr->hydrogen()->shared_info()));
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
......
...@@ -144,7 +144,7 @@ class LCodeGen: public LCodeGenBase { ...@@ -144,7 +144,7 @@ class LCodeGen: public LCodeGenBase {
#undef DECLARE_DO #undef DECLARE_DO
private: private:
StrictMode strict_mode() const { return info()->strict_mode(); } LanguageMode language_mode() const { return info()->language_mode(); }
Scope* scope() const { return scope_; } Scope* scope() const { return scope_; }
......
...@@ -2177,7 +2177,7 @@ class LStoreNamedGeneric FINAL : public LTemplateInstruction<0, 3, 0> { ...@@ -2177,7 +2177,7 @@ class LStoreNamedGeneric FINAL : public LTemplateInstruction<0, 3, 0> {
void PrintDataTo(StringStream* stream) OVERRIDE; void PrintDataTo(StringStream* stream) OVERRIDE;
Handle<Object> name() const { return hydrogen()->name(); } Handle<Object> name() const { return hydrogen()->name(); }
StrictMode strict_mode() { return hydrogen()->strict_mode(); } LanguageMode language_mode() { return hydrogen()->language_mode(); }
}; };
...@@ -2234,7 +2234,7 @@ class LStoreKeyedGeneric FINAL : public LTemplateInstruction<0, 4, 0> { ...@@ -2234,7 +2234,7 @@ class LStoreKeyedGeneric FINAL : public LTemplateInstruction<0, 4, 0> {
void PrintDataTo(StringStream* stream) OVERRIDE; void PrintDataTo(StringStream* stream) OVERRIDE;
StrictMode strict_mode() { return hydrogen()->strict_mode(); } LanguageMode language_mode() { return hydrogen()->language_mode(); }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment