Mode clean-up pt 1: rename classic/non-strict mode to sloppy mode
R=mstarzinger@chromium.org BUG= Review URL: https://codereview.chromium.org/177683002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19799 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
6e1507331e
commit
3f702d4bf9
@ -1042,7 +1042,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
|
||||
(1 << SharedFunctionInfo::kNative),
|
||||
&shift_arguments);
|
||||
|
||||
// Compute the receiver in non-strict mode.
|
||||
// Compute the receiver in sloppy mode.
|
||||
Register receiver = x2;
|
||||
__ Sub(scratch1, argc, 1);
|
||||
__ Peek(receiver, Operand(scratch1, LSL, kXRegSizeInBytesLog2));
|
||||
@ -1244,7 +1244,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
|
||||
// Do not transform the receiver for native functions.
|
||||
__ Tbnz(x10, SharedFunctionInfo::kNative, &push_receiver);
|
||||
|
||||
// Compute the receiver in non-strict mode.
|
||||
// Compute the receiver in sloppy mode.
|
||||
__ JumpIfSmi(receiver, &convert_receiver_to_object);
|
||||
__ JumpIfRoot(receiver, Heap::kNullValueRootIndex, &use_global_receiver);
|
||||
__ JumpIfRoot(receiver, Heap::kUndefinedValueRootIndex,
|
||||
|
@ -2303,7 +2303,7 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void ArgumentsAccessStub::GenerateNewNonStrictSlow(MacroAssembler* masm) {
|
||||
void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) {
|
||||
// Stack layout on entry.
|
||||
// jssp[0]: number of parameters (tagged)
|
||||
// jssp[8]: address of receiver argument
|
||||
@ -2333,7 +2333,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictSlow(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
|
||||
void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) {
|
||||
// Stack layout on entry.
|
||||
// jssp[0]: number of parameters (tagged)
|
||||
// jssp[8]: address of receiver argument
|
||||
@ -2498,7 +2498,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
|
||||
__ CmovX(backing_store, elements, eq);
|
||||
__ B(eq, &skip_parameter_map);
|
||||
|
||||
__ LoadRoot(x10, Heap::kNonStrictArgumentsElementsMapRootIndex);
|
||||
__ LoadRoot(x10, Heap::kSloppyArgumentsElementsMapRootIndex);
|
||||
__ Str(x10, FieldMemOperand(elements, FixedArray::kMapOffset));
|
||||
__ Add(x10, mapped_params, 2);
|
||||
__ SmiTag(x10);
|
||||
@ -3405,7 +3405,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
|
||||
__ Tbnz(w4, SharedFunctionInfo::kNative, &cont);
|
||||
}
|
||||
|
||||
// Compute the receiver in non-strict mode.
|
||||
// Compute the receiver in sloppy mode.
|
||||
__ Peek(x3, argc_ * kPointerSize);
|
||||
|
||||
if (NeedsChecks()) {
|
||||
|
@ -143,10 +143,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() * kXRegSizeInBytes;
|
||||
__ Peek(x10, receiver_offset);
|
||||
@ -249,12 +249,12 @@ void FullCodeGenerator::Generate() {
|
||||
// The stub will rewrite receiver 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);
|
||||
@ -1350,7 +1350,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.
|
||||
__ Ldr(temp, ContextMemOperand(current, Context::EXTENSION_INDEX));
|
||||
__ Cbnz(temp, slow);
|
||||
@ -1362,7 +1362,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();
|
||||
}
|
||||
|
||||
@ -1400,7 +1400,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.
|
||||
__ Ldr(temp, ContextMemOperand(context, Context::EXTENSION_INDEX));
|
||||
__ Cbnz(temp, slow);
|
||||
@ -2136,7 +2136,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
||||
VisitForAccumulatorValue(prop->key());
|
||||
__ Mov(x1, x0);
|
||||
__ Pop(x2, x0);
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
Handle<Code> ic = is_sloppy_mode()
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
CallIC(ic);
|
||||
@ -2266,7 +2266,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
||||
// TODO(all): Could we pass this in registers rather than on the stack?
|
||||
__ Pop(x1, x2); // Key and object holding the property.
|
||||
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
Handle<Code> ic = is_sloppy_mode()
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
CallIC(ic, expr->AssignmentFeedbackId());
|
||||
@ -2320,7 +2320,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 {
|
||||
@ -3878,8 +3878,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;
|
||||
__ Mov(x10, Operand(Smi::FromInt(strict_mode_flag)));
|
||||
__ Push(x10);
|
||||
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
|
||||
@ -3888,11 +3888,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()) {
|
||||
__ Ldr(x12, GlobalObjectMemOperand());
|
||||
__ Mov(x11, Operand(var->name()));
|
||||
__ Mov(x10, Operand(Smi::FromInt(kNonStrictMode)));
|
||||
__ Mov(x10, Operand(Smi::FromInt(kSloppyMode)));
|
||||
__ Push(x12, x11, x10);
|
||||
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
|
||||
context()->Plug(x0);
|
||||
@ -4149,7 +4149,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
case KEYED_PROPERTY: {
|
||||
__ Pop(x1); // Key.
|
||||
__ Pop(x2); // Receiver.
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
Handle<Code> ic = is_sloppy_mode()
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
CallIC(ic, expr->CountStoreFeedbackId());
|
||||
|
@ -369,7 +369,7 @@ static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm,
|
||||
__ Tbnz(key, kXSignBit, slow_case);
|
||||
|
||||
// Load the elements object and check its map.
|
||||
Handle<Map> arguments_map(heap->non_strict_arguments_elements_map());
|
||||
Handle<Map> arguments_map(heap->sloppy_arguments_elements_map());
|
||||
__ Ldr(map, FieldMemOperand(object, JSObject::kElementsOffset));
|
||||
__ CheckMap(map, scratch1, arguments_map, slow_case, DONT_DO_SMI_CHECK);
|
||||
|
||||
@ -502,7 +502,7 @@ void LoadIC::GenerateRuntimeGetProperty(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
|
||||
void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) {
|
||||
// ---------- S t a t e --------------
|
||||
// -- lr : return address
|
||||
// -- x0 : key
|
||||
@ -534,8 +534,8 @@ void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) {
|
||||
ASM_LOCATION("KeyedStoreIC::GenerateNonStrictArguments");
|
||||
void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) {
|
||||
ASM_LOCATION("KeyedStoreIC::GenerateSloppyArguments");
|
||||
// ---------- S t a t e --------------
|
||||
// -- lr : return address
|
||||
// -- x0 : value
|
||||
|
@ -668,11 +668,11 @@ bool LCodeGen::GeneratePrologue() {
|
||||
|
||||
// TODO(all): Add support for stop_t FLAG in DEBUG mode.
|
||||
|
||||
// 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() &&
|
||||
info_->is_classic_mode() &&
|
||||
info_->is_sloppy_mode() &&
|
||||
!info_->is_native()) {
|
||||
Label ok;
|
||||
int receiver_offset = info_->scope()->num_parameters() * kXRegSizeInBytes;
|
||||
@ -3469,7 +3469,7 @@ void LCodeGen::DoLoadKeyedExternal(LLoadKeyedExternal* instr) {
|
||||
case FAST_ELEMENTS:
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
@ -5067,7 +5067,7 @@ void LCodeGen::DoStoreKeyedExternal(LStoreKeyedExternal* instr) {
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
@ -888,10 +888,10 @@ MaybeObject* Accessors::FunctionGetCaller(Isolate* isolate,
|
||||
if (caller->shared()->bound()) {
|
||||
return isolate->heap()->null_value();
|
||||
}
|
||||
// Censor if the caller is not a classic mode function.
|
||||
// Censor if the caller is not a sloppy mode function.
|
||||
// Change from ES5, which used to throw, see:
|
||||
// https://bugs.ecmascript.org/show_bug.cgi?id=310
|
||||
if (!caller->shared()->is_classic_mode()) {
|
||||
if (!caller->shared()->is_sloppy_mode()) {
|
||||
return isolate->heap()->null_value();
|
||||
}
|
||||
|
||||
|
@ -2988,7 +2988,7 @@ bool v8::Object::Set(v8::Handle<Value> key, v8::Handle<Value> value,
|
||||
key_obj,
|
||||
value_obj,
|
||||
static_cast<PropertyAttributes>(attribs),
|
||||
i::kNonStrictMode);
|
||||
i::kSloppyMode);
|
||||
has_pending_exception = obj.is_null();
|
||||
EXCEPTION_BAILOUT_CHECK(isolate, false);
|
||||
return true;
|
||||
@ -3008,7 +3008,7 @@ bool v8::Object::Set(uint32_t index, v8::Handle<Value> value) {
|
||||
index,
|
||||
value_obj,
|
||||
NONE,
|
||||
i::kNonStrictMode);
|
||||
i::kSloppyMode);
|
||||
has_pending_exception = obj.is_null();
|
||||
EXCEPTION_BAILOUT_CHECK(isolate, false);
|
||||
return true;
|
||||
|
@ -1038,7 +1038,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
|
||||
__ tst(r3, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
|
||||
__ b(ne, &shift_arguments);
|
||||
|
||||
// Compute the receiver in non-strict mode.
|
||||
// Compute the receiver in sloppy mode.
|
||||
__ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2));
|
||||
__ ldr(r2, MemOperand(r2, -kPointerSize));
|
||||
// r0: actual number of arguments
|
||||
@ -1246,7 +1246,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
|
||||
__ tst(r2, Operand(1 << (SharedFunctionInfo::kNative + kSmiTagSize)));
|
||||
__ b(ne, &push_receiver);
|
||||
|
||||
// Compute the receiver in non-strict mode.
|
||||
// Compute the receiver in sloppy mode.
|
||||
__ JumpIfSmi(r0, &call_to_object);
|
||||
__ LoadRoot(r1, Heap::kNullValueRootIndex);
|
||||
__ cmp(r0, r1);
|
||||
|
@ -2258,7 +2258,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
|
||||
@ -2282,7 +2282,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
|
||||
@ -2396,7 +2396,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
|
||||
__ mov(r3, r4, LeaveCC, eq);
|
||||
__ b(eq, &skip_parameter_map);
|
||||
|
||||
__ LoadRoot(r6, Heap::kNonStrictArgumentsElementsMapRootIndex);
|
||||
__ LoadRoot(r6, Heap::kSloppyArgumentsElementsMapRootIndex);
|
||||
__ str(r6, FieldMemOperand(r4, FixedArray::kMapOffset));
|
||||
__ add(r6, r1, Operand(Smi::FromInt(2)));
|
||||
__ str(r6, FieldMemOperand(r4, FixedArray::kLengthOffset));
|
||||
@ -3134,7 +3134,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
|
||||
__ b(ne, &cont);
|
||||
}
|
||||
|
||||
// Compute the receiver in non-strict mode.
|
||||
// Compute the receiver in sloppy mode.
|
||||
__ ldr(r3, MemOperand(sp, argc_ * kPointerSize));
|
||||
|
||||
if (NeedsChecks()) {
|
||||
|
@ -145,10 +145,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;
|
||||
__ ldr(r2, MemOperand(sp, receiver_offset));
|
||||
@ -262,12 +262,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);
|
||||
@ -1355,7 +1355,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.
|
||||
__ ldr(temp, ContextOperand(current, Context::EXTENSION_INDEX));
|
||||
__ tst(temp, temp);
|
||||
@ -1368,7 +1368,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();
|
||||
}
|
||||
|
||||
@ -1411,7 +1411,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.
|
||||
__ ldr(temp, ContextOperand(context, Context::EXTENSION_INDEX));
|
||||
__ tst(temp, temp);
|
||||
@ -2438,7 +2438,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
||||
VisitForAccumulatorValue(prop->key());
|
||||
__ mov(r1, r0);
|
||||
__ Pop(r0, r2); // r0 = restored value.
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
Handle<Code> ic = is_sloppy_mode()
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
CallIC(ic);
|
||||
@ -2564,7 +2564,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
||||
SetSourcePosition(expr->position());
|
||||
__ Pop(r2, r1); // r1 = key.
|
||||
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
Handle<Code> ic = is_sloppy_mode()
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
CallIC(ic, expr->AssignmentFeedbackId());
|
||||
@ -2617,7 +2617,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 {
|
||||
@ -4172,8 +4172,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;
|
||||
__ mov(r1, Operand(Smi::FromInt(strict_mode_flag)));
|
||||
__ push(r1);
|
||||
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
|
||||
@ -4182,11 +4182,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()) {
|
||||
__ ldr(r2, GlobalObjectOperand());
|
||||
__ mov(r1, Operand(var->name()));
|
||||
__ mov(r0, Operand(Smi::FromInt(kNonStrictMode)));
|
||||
__ mov(r0, Operand(Smi::FromInt(kSloppyMode)));
|
||||
__ Push(r2, r1, r0);
|
||||
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
|
||||
context()->Plug(r0);
|
||||
@ -4440,7 +4440,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
}
|
||||
case KEYED_PROPERTY: {
|
||||
__ Pop(r2, r1); // r1 = key. r2 = receiver.
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
Handle<Code> ic = is_sloppy_mode()
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
CallIC(ic, expr->CountStoreFeedbackId());
|
||||
|
@ -427,7 +427,7 @@ static MemOperand GenerateMappedArgumentsLookup(MacroAssembler* masm,
|
||||
__ b(ne, slow_case);
|
||||
|
||||
// Load the elements into scratch1 and check its map.
|
||||
Handle<Map> arguments_map(heap->non_strict_arguments_elements_map());
|
||||
Handle<Map> arguments_map(heap->sloppy_arguments_elements_map());
|
||||
__ ldr(scratch1, FieldMemOperand(object, JSObject::kElementsOffset));
|
||||
__ CheckMap(scratch1, scratch2, arguments_map, slow_case, DONT_DO_SMI_CHECK);
|
||||
|
||||
@ -489,7 +489,7 @@ static MemOperand GenerateUnmappedArgumentsLookup(MacroAssembler* masm,
|
||||
}
|
||||
|
||||
|
||||
void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
|
||||
void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) {
|
||||
// ---------- S t a t e --------------
|
||||
// -- lr : return address
|
||||
// -- r0 : key
|
||||
@ -515,7 +515,7 @@ void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) {
|
||||
void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) {
|
||||
// ---------- S t a t e --------------
|
||||
// -- r0 : value
|
||||
// -- r1 : key
|
||||
|
@ -147,11 +147,11 @@ 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() &&
|
||||
info_->is_classic_mode() &&
|
||||
info_->is_sloppy_mode() &&
|
||||
!info_->is_native()) {
|
||||
Label ok;
|
||||
int receiver_offset = info_->scope()->num_parameters() * kPointerSize;
|
||||
@ -3162,7 +3162,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
||||
case FAST_ELEMENTS:
|
||||
case FAST_SMI_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
@ -4206,7 +4206,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ class LCodeGen: public LCodeGenBase {
|
||||
|
||||
private:
|
||||
StrictModeFlag strict_mode_flag() const {
|
||||
return info()->is_classic_mode() ? kNonStrictMode : kStrictMode;
|
||||
return info()->is_sloppy_mode() ? kSloppyMode : kStrictMode;
|
||||
}
|
||||
|
||||
Scope* scope() const { return scope_; }
|
||||
|
10
src/array.js
10
src/array.js
@ -1153,7 +1153,7 @@ function ArrayFilter(f, receiver) {
|
||||
}
|
||||
if (IS_NULL_OR_UNDEFINED(receiver)) {
|
||||
receiver = %GetDefaultReceiver(f) || receiver;
|
||||
} else if (!IS_SPEC_OBJECT(receiver) && %IsClassicModeFunction(f)) {
|
||||
} else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) {
|
||||
receiver = ToObject(receiver);
|
||||
}
|
||||
|
||||
@ -1201,7 +1201,7 @@ function ArrayForEach(f, receiver) {
|
||||
}
|
||||
if (IS_NULL_OR_UNDEFINED(receiver)) {
|
||||
receiver = %GetDefaultReceiver(f) || receiver;
|
||||
} else if (!IS_SPEC_OBJECT(receiver) && %IsClassicModeFunction(f)) {
|
||||
} else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) {
|
||||
receiver = ToObject(receiver);
|
||||
}
|
||||
|
||||
@ -1242,7 +1242,7 @@ function ArraySome(f, receiver) {
|
||||
}
|
||||
if (IS_NULL_OR_UNDEFINED(receiver)) {
|
||||
receiver = %GetDefaultReceiver(f) || receiver;
|
||||
} else if (!IS_SPEC_OBJECT(receiver) && %IsClassicModeFunction(f)) {
|
||||
} else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) {
|
||||
receiver = ToObject(receiver);
|
||||
}
|
||||
|
||||
@ -1282,7 +1282,7 @@ function ArrayEvery(f, receiver) {
|
||||
}
|
||||
if (IS_NULL_OR_UNDEFINED(receiver)) {
|
||||
receiver = %GetDefaultReceiver(f) || receiver;
|
||||
} else if (!IS_SPEC_OBJECT(receiver) && %IsClassicModeFunction(f)) {
|
||||
} else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) {
|
||||
receiver = ToObject(receiver);
|
||||
}
|
||||
|
||||
@ -1321,7 +1321,7 @@ function ArrayMap(f, receiver) {
|
||||
}
|
||||
if (IS_NULL_OR_UNDEFINED(receiver)) {
|
||||
receiver = %GetDefaultReceiver(f) || receiver;
|
||||
} else if (!IS_SPEC_OBJECT(receiver) && %IsClassicModeFunction(f)) {
|
||||
} else if (!IS_SPEC_OBJECT(receiver) && %IsSloppyModeFunction(f)) {
|
||||
receiver = ToObject(receiver);
|
||||
}
|
||||
|
||||
|
@ -379,9 +379,9 @@ void ArrayLiteral::BuildConstantElements(Isolate* isolate) {
|
||||
} else if (boilerplate_value->IsUninitialized()) {
|
||||
is_simple = false;
|
||||
JSObject::SetOwnElement(
|
||||
array, i, handle(Smi::FromInt(0), isolate), kNonStrictMode);
|
||||
array, i, handle(Smi::FromInt(0), isolate), kSloppyMode);
|
||||
} else {
|
||||
JSObject::SetOwnElement(array, i, boilerplate_value, kNonStrictMode);
|
||||
JSObject::SetOwnElement(array, i, boilerplate_value, kSloppyMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2315,7 +2315,7 @@ class FunctionLiteral V8_FINAL : public Expression {
|
||||
int SourceSize() const { return end_position() - start_position(); }
|
||||
bool is_expression() const { return IsExpression::decode(bitfield_); }
|
||||
bool is_anonymous() const { return IsAnonymous::decode(bitfield_); }
|
||||
bool is_classic_mode() const { return language_mode() == CLASSIC_MODE; }
|
||||
bool is_sloppy_mode() const { return language_mode() == SLOPPY_MODE; }
|
||||
LanguageMode language_mode() const;
|
||||
|
||||
int materialized_literal_count() { return materialized_literal_count_; }
|
||||
|
@ -519,7 +519,7 @@ Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) {
|
||||
Handle<String> empty_string =
|
||||
factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("Empty"));
|
||||
Handle<JSFunction> empty_function =
|
||||
factory->NewFunctionWithoutPrototype(empty_string, CLASSIC_MODE);
|
||||
factory->NewFunctionWithoutPrototype(empty_string, SLOPPY_MODE);
|
||||
|
||||
// --- E m p t y ---
|
||||
Handle<Code> code =
|
||||
@ -604,7 +604,7 @@ Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
|
||||
Handle<String> name = factory()->InternalizeOneByteString(
|
||||
STATIC_ASCII_VECTOR("ThrowTypeError"));
|
||||
throw_type_error_function =
|
||||
factory()->NewFunctionWithoutPrototype(name, CLASSIC_MODE);
|
||||
factory()->NewFunctionWithoutPrototype(name, SLOPPY_MODE);
|
||||
Handle<Code> code(isolate()->builtins()->builtin(
|
||||
Builtins::kStrictModePoisonPill));
|
||||
throw_type_error_function->set_map(
|
||||
@ -1173,7 +1173,7 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
||||
{ // --- aliased_arguments_boilerplate_
|
||||
// Set up a well-formed parameter map to make assertions happy.
|
||||
Handle<FixedArray> elements = factory->NewFixedArray(2);
|
||||
elements->set_map(heap->non_strict_arguments_elements_map());
|
||||
elements->set_map(heap->sloppy_arguments_elements_map());
|
||||
Handle<FixedArray> array;
|
||||
array = factory->NewFixedArray(0);
|
||||
elements->set(0, *array);
|
||||
@ -1186,9 +1186,9 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
||||
Handle<JSObject> result = factory->NewJSObjectFromMap(new_map);
|
||||
// Set elements kind after allocating the object because
|
||||
// NewJSObjectFromMap assumes a fast elements map.
|
||||
new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS);
|
||||
new_map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS);
|
||||
result->set_elements(*elements);
|
||||
ASSERT(result->HasNonStrictArgumentsElements());
|
||||
ASSERT(result->HasSloppyArgumentsElements());
|
||||
native_context()->set_aliased_arguments_boilerplate(*result);
|
||||
}
|
||||
|
||||
@ -1240,7 +1240,7 @@ void Genesis::InitializeGlobal(Handle<GlobalObject> inner_global,
|
||||
map->set_pre_allocated_property_fields(1);
|
||||
map->set_inobject_properties(1);
|
||||
|
||||
// Copy constructor from the non-strict arguments boilerplate.
|
||||
// Copy constructor from the sloppy arguments boilerplate.
|
||||
map->set_constructor(
|
||||
native_context()->arguments_boilerplate()->map()->constructor());
|
||||
|
||||
|
@ -1174,7 +1174,7 @@ MUST_USE_RESULT static MaybeObject* HandleApiCallHelper(
|
||||
}
|
||||
|
||||
SharedFunctionInfo* shared = function->shared();
|
||||
if (shared->is_classic_mode() && !shared->native()) {
|
||||
if (shared->is_sloppy_mode() && !shared->native()) {
|
||||
Object* recv = args[0];
|
||||
ASSERT(!recv->IsNull());
|
||||
if (recv->IsUndefined()) {
|
||||
@ -1364,8 +1364,8 @@ static void Generate_KeyedLoadIC_IndexedInterceptor(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
static void Generate_KeyedLoadIC_NonStrictArguments(MacroAssembler* masm) {
|
||||
KeyedLoadIC::GenerateNonStrictArguments(masm);
|
||||
static void Generate_KeyedLoadIC_SloppyArguments(MacroAssembler* masm) {
|
||||
KeyedLoadIC::GenerateSloppyArguments(masm);
|
||||
}
|
||||
|
||||
|
||||
@ -1390,7 +1390,7 @@ static void Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) {
|
||||
|
||||
|
||||
static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) {
|
||||
KeyedStoreIC::GenerateGeneric(masm, kNonStrictMode);
|
||||
KeyedStoreIC::GenerateGeneric(masm, kSloppyMode);
|
||||
}
|
||||
|
||||
|
||||
@ -1429,8 +1429,8 @@ static void Generate_KeyedStoreIC_PreMonomorphic_Strict(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
static void Generate_KeyedStoreIC_NonStrictArguments(MacroAssembler* masm) {
|
||||
KeyedStoreIC::GenerateNonStrictArguments(masm);
|
||||
static void Generate_KeyedStoreIC_SloppyArguments(MacroAssembler* masm) {
|
||||
KeyedStoreIC::GenerateSloppyArguments(masm);
|
||||
}
|
||||
|
||||
|
||||
|
@ -137,7 +137,7 @@ enum BuiltinExtraArguments {
|
||||
kNoExtraICState) \
|
||||
V(KeyedLoadIC_IndexedInterceptor, KEYED_LOAD_IC, MONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedLoadIC_NonStrictArguments, KEYED_LOAD_IC, MONOMORPHIC, \
|
||||
V(KeyedLoadIC_SloppyArguments, KEYED_LOAD_IC, MONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
V(StoreIC_Setter_ForDeopt, STORE_IC, MONOMORPHIC, \
|
||||
@ -156,8 +156,8 @@ enum BuiltinExtraArguments {
|
||||
StoreIC::kStrictModeState) \
|
||||
V(KeyedStoreIC_Generic_Strict, KEYED_STORE_IC, GENERIC, \
|
||||
StoreIC::kStrictModeState) \
|
||||
V(KeyedStoreIC_NonStrictArguments, KEYED_STORE_IC, MONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
V(KeyedStoreIC_SloppyArguments, KEYED_STORE_IC, MONOMORPHIC, \
|
||||
kNoExtraICState) \
|
||||
\
|
||||
/* Uses KeyedLoadIC_Initialize; must be after in list. */ \
|
||||
V(FunctionCall, BUILTIN, UNINITIALIZED, \
|
||||
|
@ -561,7 +561,7 @@ void KeyedStoreElementStub::Generate(MacroAssembler* masm) {
|
||||
case DICTIONARY_ELEMENTS:
|
||||
KeyedStoreStubCompiler::GenerateStoreDictionaryElement(masm);
|
||||
break;
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
@ -572,8 +572,8 @@ void ArgumentsAccessStub::PrintName(StringStream* stream) {
|
||||
stream->Add("ArgumentsAccessStub_");
|
||||
switch (type_) {
|
||||
case READ_ELEMENT: stream->Add("ReadElement"); break;
|
||||
case NEW_NON_STRICT_FAST: stream->Add("NewNonStrictFast"); break;
|
||||
case NEW_NON_STRICT_SLOW: stream->Add("NewNonStrictSlow"); break;
|
||||
case NEW_SLOPPY_FAST: stream->Add("NewSloppyFast"); break;
|
||||
case NEW_SLOPPY_SLOW: stream->Add("NewSloppySlow"); break;
|
||||
case NEW_STRICT: stream->Add("NewStrict"); break;
|
||||
}
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ class FastNewClosureStub : public HydrogenCodeStub {
|
||||
|
||||
Major MajorKey() { return FastNewClosure; }
|
||||
int NotMissMinorKey() {
|
||||
return StrictModeBits::encode(language_mode_ != CLASSIC_MODE) |
|
||||
return StrictModeBits::encode(language_mode_ != SLOPPY_MODE) |
|
||||
IsGeneratorBits::encode(is_generator_);
|
||||
}
|
||||
|
||||
@ -1535,8 +1535,8 @@ class ArgumentsAccessStub: public PlatformCodeStub {
|
||||
public:
|
||||
enum Type {
|
||||
READ_ELEMENT,
|
||||
NEW_NON_STRICT_FAST,
|
||||
NEW_NON_STRICT_SLOW,
|
||||
NEW_SLOPPY_FAST,
|
||||
NEW_SLOPPY_SLOW,
|
||||
NEW_STRICT
|
||||
};
|
||||
|
||||
@ -1551,8 +1551,8 @@ class ArgumentsAccessStub: public PlatformCodeStub {
|
||||
void Generate(MacroAssembler* masm);
|
||||
void GenerateReadElement(MacroAssembler* masm);
|
||||
void GenerateNewStrict(MacroAssembler* masm);
|
||||
void GenerateNewNonStrictFast(MacroAssembler* masm);
|
||||
void GenerateNewNonStrictSlow(MacroAssembler* masm);
|
||||
void GenerateNewSloppyFast(MacroAssembler* masm);
|
||||
void GenerateNewSloppySlow(MacroAssembler* masm);
|
||||
|
||||
virtual void PrintName(StringStream* stream);
|
||||
};
|
||||
|
@ -222,11 +222,11 @@ void ArgumentsAccessStub::Generate(MacroAssembler* masm) {
|
||||
case READ_ELEMENT:
|
||||
GenerateReadElement(masm);
|
||||
break;
|
||||
case NEW_NON_STRICT_FAST:
|
||||
GenerateNewNonStrictFast(masm);
|
||||
case NEW_SLOPPY_FAST:
|
||||
GenerateNewSloppyFast(masm);
|
||||
break;
|
||||
case NEW_NON_STRICT_SLOW:
|
||||
GenerateNewNonStrictSlow(masm);
|
||||
case NEW_SLOPPY_SLOW:
|
||||
GenerateNewSloppySlow(masm);
|
||||
break;
|
||||
case NEW_STRICT:
|
||||
GenerateNewStrict(masm);
|
||||
|
@ -136,10 +136,9 @@ class CompilationCacheScript : public CompilationSubCache {
|
||||
// entries:
|
||||
// 1. The source string.
|
||||
// 2. The shared function info of the calling function.
|
||||
// 3. Whether the source should be compiled as strict code or as non-strict
|
||||
// code.
|
||||
// 3. Whether the source should be compiled as strict code or as sloppy code.
|
||||
// Note: Currently there are clients of CompileEval that always compile
|
||||
// non-strict code even if the calling function is a strict mode function.
|
||||
// sloppy code even if the calling function is a strict mode function.
|
||||
// More specifically these are the CompileString, DebugEvaluate and
|
||||
// DebugEvaluateGlobal runtime functions.
|
||||
// 4. The start position of the calling scope.
|
||||
|
@ -56,7 +56,7 @@ namespace internal {
|
||||
|
||||
CompilationInfo::CompilationInfo(Handle<Script> script,
|
||||
Zone* zone)
|
||||
: flags_(LanguageModeField::encode(CLASSIC_MODE)),
|
||||
: flags_(LanguageModeField::encode(SLOPPY_MODE)),
|
||||
script_(script),
|
||||
osr_ast_id_(BailoutId::None()),
|
||||
parameter_count_(0),
|
||||
@ -68,7 +68,7 @@ CompilationInfo::CompilationInfo(Handle<Script> script,
|
||||
|
||||
CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info,
|
||||
Zone* zone)
|
||||
: flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)),
|
||||
: flags_(LanguageModeField::encode(SLOPPY_MODE) | IsLazy::encode(true)),
|
||||
shared_info_(shared_info),
|
||||
script_(Handle<Script>(Script::cast(shared_info->script()))),
|
||||
osr_ast_id_(BailoutId::None()),
|
||||
@ -81,7 +81,7 @@ CompilationInfo::CompilationInfo(Handle<SharedFunctionInfo> shared_info,
|
||||
|
||||
CompilationInfo::CompilationInfo(Handle<JSFunction> closure,
|
||||
Zone* zone)
|
||||
: flags_(LanguageModeField::encode(CLASSIC_MODE) | IsLazy::encode(true)),
|
||||
: flags_(LanguageModeField::encode(SLOPPY_MODE) | IsLazy::encode(true)),
|
||||
closure_(closure),
|
||||
shared_info_(Handle<SharedFunctionInfo>(closure->shared())),
|
||||
script_(Handle<Script>(Script::cast(shared_info_->script()))),
|
||||
@ -97,7 +97,7 @@ CompilationInfo::CompilationInfo(Handle<JSFunction> closure,
|
||||
CompilationInfo::CompilationInfo(HydrogenCodeStub* stub,
|
||||
Isolate* isolate,
|
||||
Zone* zone)
|
||||
: flags_(LanguageModeField::encode(CLASSIC_MODE) |
|
||||
: flags_(LanguageModeField::encode(SLOPPY_MODE) |
|
||||
IsLazy::encode(true)),
|
||||
osr_ast_id_(BailoutId::None()),
|
||||
parameter_count_(0),
|
||||
@ -137,7 +137,7 @@ void CompilationInfo::Initialize(Isolate* isolate,
|
||||
MarkAsNative();
|
||||
}
|
||||
if (!shared_info_.is_null()) {
|
||||
ASSERT(language_mode() == CLASSIC_MODE);
|
||||
ASSERT(language_mode() == SLOPPY_MODE);
|
||||
SetLanguageMode(shared_info_->language_mode());
|
||||
}
|
||||
set_bailout_reason(kUnknown);
|
||||
@ -237,7 +237,7 @@ void CompilationInfo::DisableOptimization() {
|
||||
FLAG_optimize_closures &&
|
||||
closure_.is_null() &&
|
||||
!scope_->HasTrivialOuterContext() &&
|
||||
!scope_->outer_scope_calls_non_strict_eval() &&
|
||||
!scope_->outer_scope_calls_sloppy_eval() &&
|
||||
!scope_->inside_with();
|
||||
SetMode(is_optimizable_closure ? BASE : NONOPT);
|
||||
}
|
||||
@ -926,7 +926,7 @@ Handle<JSFunction> Compiler::GetFunctionFromEval(Handle<String> source,
|
||||
// If caller is strict mode, the result must be in strict mode or
|
||||
// extended mode as well, but not the other way around. Consider:
|
||||
// eval("'use strict'; ...");
|
||||
ASSERT(language_mode != STRICT_MODE || !shared_info->is_classic_mode());
|
||||
ASSERT(language_mode != STRICT_MODE || !shared_info->is_sloppy_mode());
|
||||
// If caller is in extended mode, the result must also be in
|
||||
// extended mode.
|
||||
ASSERT(language_mode != EXTENDED_MODE ||
|
||||
|
@ -66,7 +66,7 @@ class CompilationInfo {
|
||||
bool is_lazy() const { return IsLazy::decode(flags_); }
|
||||
bool is_eval() const { return IsEval::decode(flags_); }
|
||||
bool is_global() const { return IsGlobal::decode(flags_); }
|
||||
bool is_classic_mode() const { return language_mode() == CLASSIC_MODE; }
|
||||
bool is_sloppy_mode() const { return language_mode() == SLOPPY_MODE; }
|
||||
bool is_extended_mode() const { return language_mode() == EXTENDED_MODE; }
|
||||
LanguageMode language_mode() const {
|
||||
return LanguageModeField::decode(flags_);
|
||||
@ -110,7 +110,7 @@ class CompilationInfo {
|
||||
return this_has_uses_;
|
||||
}
|
||||
void SetLanguageMode(LanguageMode language_mode) {
|
||||
ASSERT(this->language_mode() == CLASSIC_MODE ||
|
||||
ASSERT(this->language_mode() == SLOPPY_MODE ||
|
||||
this->language_mode() == language_mode ||
|
||||
language_mode == EXTENDED_MODE);
|
||||
flags_ = LanguageModeField::update(flags_, language_mode);
|
||||
|
@ -495,10 +495,10 @@ class Context: public FixedArray {
|
||||
|
||||
static int FunctionMapIndex(LanguageMode language_mode, bool is_generator) {
|
||||
return is_generator
|
||||
? (language_mode == CLASSIC_MODE
|
||||
? (language_mode == SLOPPY_MODE
|
||||
? GENERATOR_FUNCTION_MAP_INDEX
|
||||
: STRICT_MODE_GENERATOR_FUNCTION_MAP_INDEX)
|
||||
: (language_mode == CLASSIC_MODE
|
||||
: (language_mode == SLOPPY_MODE
|
||||
? FUNCTION_MAP_INDEX
|
||||
: STRICT_MODE_FUNCTION_MAP_INDEX);
|
||||
}
|
||||
|
@ -852,7 +852,7 @@ bool Debug::Load() {
|
||||
key,
|
||||
Handle<Object>(global->builtins(), isolate_),
|
||||
NONE,
|
||||
kNonStrictMode),
|
||||
kSloppyMode),
|
||||
false);
|
||||
|
||||
// Compile the JavaScript for the debugger in the debugger context.
|
||||
|
@ -66,7 +66,7 @@ int ElementsKindToShiftSize(ElementsKind elements_kind) {
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
return kPointerSizeLog2;
|
||||
}
|
||||
UNREACHABLE();
|
||||
|
@ -51,7 +51,7 @@ enum ElementsKind {
|
||||
|
||||
// The "slow" kind.
|
||||
DICTIONARY_ELEMENTS,
|
||||
NON_STRICT_ARGUMENTS_ELEMENTS,
|
||||
SLOPPY_ARGUMENTS_ELEMENTS,
|
||||
// The "fast" kind for external arrays
|
||||
EXTERNAL_INT8_ELEMENTS,
|
||||
EXTERNAL_UINT8_ELEMENTS,
|
||||
|
@ -68,7 +68,7 @@
|
||||
// - FixedFloat64ElementsAccessor
|
||||
// - FixedUint8ClampedElementsAccessor
|
||||
// - DictionaryElementsAccessor
|
||||
// - NonStrictArgumentsElementsAccessor
|
||||
// - SloppyArgumentsElementsAccessor
|
||||
|
||||
|
||||
namespace v8 {
|
||||
@ -95,7 +95,7 @@ static const int kPackedSizeNotKnown = -1;
|
||||
FixedDoubleArray) \
|
||||
V(DictionaryElementsAccessor, DICTIONARY_ELEMENTS, \
|
||||
SeededNumberDictionary) \
|
||||
V(NonStrictArgumentsElementsAccessor, NON_STRICT_ARGUMENTS_ELEMENTS, \
|
||||
V(SloppyArgumentsElementsAccessor, SLOPPY_ARGUMENTS_ELEMENTS, \
|
||||
FixedArray) \
|
||||
V(ExternalInt8ElementsAccessor, EXTERNAL_INT8_ELEMENTS, \
|
||||
ExternalInt8Array) \
|
||||
@ -920,7 +920,7 @@ class FastElementsAccessor
|
||||
KindTraits>(name) {}
|
||||
protected:
|
||||
friend class ElementsAccessorBase<FastElementsAccessorSubclass, KindTraits>;
|
||||
friend class NonStrictArgumentsElementsAccessor;
|
||||
friend class SloppyArgumentsElementsAccessor;
|
||||
|
||||
typedef typename KindTraits::BackingStore BackingStore;
|
||||
|
||||
@ -998,9 +998,9 @@ class FastElementsAccessor
|
||||
}
|
||||
typename KindTraits::BackingStore* backing_store =
|
||||
KindTraits::BackingStore::cast(elements);
|
||||
bool is_non_strict_arguments_elements_map =
|
||||
backing_store->map() == heap->non_strict_arguments_elements_map();
|
||||
if (is_non_strict_arguments_elements_map) {
|
||||
bool is_sloppy_arguments_elements_map =
|
||||
backing_store->map() == heap->sloppy_arguments_elements_map();
|
||||
if (is_sloppy_arguments_elements_map) {
|
||||
backing_store = KindTraits::BackingStore::cast(
|
||||
FixedArray::cast(backing_store)->get(1));
|
||||
}
|
||||
@ -1009,7 +1009,7 @@ class FastElementsAccessor
|
||||
? Smi::cast(JSArray::cast(obj)->length())->value()
|
||||
: backing_store->length());
|
||||
if (key < length) {
|
||||
if (!is_non_strict_arguments_elements_map) {
|
||||
if (!is_sloppy_arguments_elements_map) {
|
||||
ElementsKind kind = KindTraits::Kind;
|
||||
if (IsFastPackedElementsKind(kind)) {
|
||||
MaybeObject* transitioned =
|
||||
@ -1152,9 +1152,9 @@ class FastSmiOrObjectElementsAccessor
|
||||
CopyDictionaryToObjectElements(
|
||||
from, from_start, to, to_kind, to_start, copy_size);
|
||||
return to->GetHeap()->undefined_value();
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS: {
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS: {
|
||||
// TODO(verwaest): This is a temporary hack to support extending
|
||||
// NON_STRICT_ARGUMENTS_ELEMENTS in SetFastElementsCapacityAndLength.
|
||||
// SLOPPY_ARGUMENTS_ELEMENTS in SetFastElementsCapacityAndLength.
|
||||
// This case should be UNREACHABLE().
|
||||
FixedArray* parameter_map = FixedArray::cast(from);
|
||||
FixedArrayBase* arguments = FixedArrayBase::cast(parameter_map->get(1));
|
||||
@ -1282,7 +1282,7 @@ class FastDoubleElementsAccessor
|
||||
CopyDictionaryToDoubleElements(
|
||||
from, from_start, to, to_start, copy_size);
|
||||
break;
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNREACHABLE();
|
||||
|
||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||
@ -1492,7 +1492,7 @@ class DictionaryElementsAccessor
|
||||
Heap* heap = isolate->heap();
|
||||
FixedArray* backing_store = FixedArray::cast(obj->elements());
|
||||
bool is_arguments =
|
||||
(obj->GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS);
|
||||
(obj->GetElementsKind() == SLOPPY_ARGUMENTS_ELEMENTS);
|
||||
if (is_arguments) {
|
||||
backing_store = FixedArray::cast(backing_store->get(1));
|
||||
}
|
||||
@ -1632,18 +1632,18 @@ class DictionaryElementsAccessor
|
||||
};
|
||||
|
||||
|
||||
class NonStrictArgumentsElementsAccessor : public ElementsAccessorBase<
|
||||
NonStrictArgumentsElementsAccessor,
|
||||
ElementsKindTraits<NON_STRICT_ARGUMENTS_ELEMENTS> > {
|
||||
class SloppyArgumentsElementsAccessor : public ElementsAccessorBase<
|
||||
SloppyArgumentsElementsAccessor,
|
||||
ElementsKindTraits<SLOPPY_ARGUMENTS_ELEMENTS> > {
|
||||
public:
|
||||
explicit NonStrictArgumentsElementsAccessor(const char* name)
|
||||
explicit SloppyArgumentsElementsAccessor(const char* name)
|
||||
: ElementsAccessorBase<
|
||||
NonStrictArgumentsElementsAccessor,
|
||||
ElementsKindTraits<NON_STRICT_ARGUMENTS_ELEMENTS> >(name) {}
|
||||
SloppyArgumentsElementsAccessor,
|
||||
ElementsKindTraits<SLOPPY_ARGUMENTS_ELEMENTS> >(name) {}
|
||||
protected:
|
||||
friend class ElementsAccessorBase<
|
||||
NonStrictArgumentsElementsAccessor,
|
||||
ElementsKindTraits<NON_STRICT_ARGUMENTS_ELEMENTS> >;
|
||||
SloppyArgumentsElementsAccessor,
|
||||
ElementsKindTraits<SLOPPY_ARGUMENTS_ELEMENTS> >;
|
||||
|
||||
MUST_USE_RESULT static MaybeObject* GetImpl(Object* receiver,
|
||||
JSObject* obj,
|
||||
|
@ -175,7 +175,7 @@ class ElementsAccessor {
|
||||
static void TearDown();
|
||||
|
||||
protected:
|
||||
friend class NonStrictArgumentsElementsAccessor;
|
||||
friend class SloppyArgumentsElementsAccessor;
|
||||
|
||||
virtual uint32_t GetCapacity(FixedArrayBase* backing_store) = 0;
|
||||
|
||||
|
@ -163,9 +163,9 @@ Handle<Object> Execution::Call(Isolate* isolate,
|
||||
}
|
||||
Handle<JSFunction> func = Handle<JSFunction>::cast(callable);
|
||||
|
||||
// In non-strict mode, convert receiver.
|
||||
// In sloppy mode, convert receiver.
|
||||
if (convert_receiver && !receiver->IsJSReceiver() &&
|
||||
!func->shared()->native() && func->shared()->is_classic_mode()) {
|
||||
!func->shared()->native() && func->shared()->is_sloppy_mode()) {
|
||||
if (receiver->IsUndefined() || receiver->IsNull()) {
|
||||
Object* global = func->context()->global_object()->global_receiver();
|
||||
// Under some circumstances, 'global' can be the JSBuiltinsObject
|
||||
|
@ -1251,7 +1251,7 @@ Handle<JSFunction> Factory::NewFunctionWithPrototype(Handle<String> name,
|
||||
Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name,
|
||||
Handle<Code> code) {
|
||||
Handle<JSFunction> function = NewFunctionWithoutPrototype(name,
|
||||
CLASSIC_MODE);
|
||||
SLOPPY_MODE);
|
||||
function->shared()->set_code(*code);
|
||||
function->set_code(*code);
|
||||
ASSERT(!function->has_initial_map());
|
||||
@ -1646,7 +1646,7 @@ Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper(
|
||||
Handle<String> name,
|
||||
LanguageMode language_mode) {
|
||||
Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name);
|
||||
Handle<Map> map = (language_mode == CLASSIC_MODE)
|
||||
Handle<Map> map = (language_mode == SLOPPY_MODE)
|
||||
? isolate()->function_without_prototype_map()
|
||||
: isolate()->strict_mode_function_without_prototype_map();
|
||||
CALL_HEAP_FUNCTION(isolate(),
|
||||
|
@ -602,9 +602,9 @@ class FullCodeGenerator: public AstVisitor {
|
||||
Handle<Script> script() { return info_->script(); }
|
||||
bool is_eval() { return info_->is_eval(); }
|
||||
bool is_native() { return info_->is_native(); }
|
||||
bool is_classic_mode() { return language_mode() == CLASSIC_MODE; }
|
||||
bool is_sloppy_mode() { return language_mode() == SLOPPY_MODE; }
|
||||
StrictModeFlag strict_mode() {
|
||||
return is_classic_mode() ? kNonStrictMode : kStrictMode;
|
||||
return is_sloppy_mode() ? kSloppyMode : kStrictMode;
|
||||
}
|
||||
LanguageMode language_mode() { return function()->language_mode(); }
|
||||
FunctionLiteral* function() { return info_->function(); }
|
||||
|
@ -409,18 +409,15 @@ template <typename T, class P = FreeStoreAllocationPolicy> class List;
|
||||
|
||||
// The different language modes that V8 implements. ES5 defines two language
|
||||
// modes: an unrestricted mode respectively a strict mode which are indicated by
|
||||
// CLASSIC_MODE respectively STRICT_MODE in the enum. The harmony spec drafts
|
||||
// SLOPPY_MODE respectively STRICT_MODE in the enum. The harmony spec drafts
|
||||
// for the next ES standard specify a new third mode which is called 'extended
|
||||
// mode'. The extended mode is only available if the harmony flag is set. It is
|
||||
// based on the 'strict mode' and adds new functionality to it. This means that
|
||||
// most of the semantics of these two modes coincide.
|
||||
//
|
||||
// In the current draft the term 'base code' is used to refer to code that is
|
||||
// neither in strict nor extended mode. However, the more distinguishing term
|
||||
// 'classic mode' is used in V8 instead to avoid mix-ups.
|
||||
// TODO(rossberg): remove extended mode.
|
||||
|
||||
enum LanguageMode {
|
||||
CLASSIC_MODE,
|
||||
SLOPPY_MODE,
|
||||
STRICT_MODE,
|
||||
EXTENDED_MODE
|
||||
};
|
||||
@ -432,7 +429,7 @@ enum LanguageMode {
|
||||
// there is no semantic difference between the strict and the extended mode in
|
||||
// the backend, so both modes are represented by the kStrictMode value.
|
||||
enum StrictModeFlag {
|
||||
kNonStrictMode,
|
||||
kSloppyMode,
|
||||
kStrictMode
|
||||
};
|
||||
|
||||
|
@ -51,7 +51,7 @@ function ArrayFind(predicate /* thisArg */) { // length == 1
|
||||
|
||||
if (IS_NULL_OR_UNDEFINED(thisArg)) {
|
||||
thisArg = %GetDefaultReceiver(predicate) || thisArg;
|
||||
} else if (!IS_SPEC_OBJECT(thisArg) && %IsClassicModeFunction(predicate)) {
|
||||
} else if (!IS_SPEC_OBJECT(thisArg) && %IsSloppyModeFunction(predicate)) {
|
||||
thisArg = ToObject(thisArg);
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ function ArrayFindIndex(predicate /* thisArg */) { // length == 1
|
||||
|
||||
if (IS_NULL_OR_UNDEFINED(thisArg)) {
|
||||
thisArg = %GetDefaultReceiver(predicate) || thisArg;
|
||||
} else if (!IS_SPEC_OBJECT(thisArg) && %IsClassicModeFunction(predicate)) {
|
||||
} else if (!IS_SPEC_OBJECT(thisArg) && %IsSloppyModeFunction(predicate)) {
|
||||
thisArg = ToObject(thisArg);
|
||||
}
|
||||
|
||||
|
@ -2866,7 +2866,7 @@ bool Heap::CreateInitialMaps() {
|
||||
TYPED_ARRAYS(ALLOCATE_FIXED_TYPED_ARRAY_MAP)
|
||||
#undef ALLOCATE_FIXED_TYPED_ARRAY_MAP
|
||||
|
||||
ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, non_strict_arguments_elements)
|
||||
ALLOCATE_VARSIZE_MAP(FIXED_ARRAY_TYPE, sloppy_arguments_elements)
|
||||
|
||||
ALLOCATE_VARSIZE_MAP(CODE_TYPE, code)
|
||||
|
||||
@ -4277,7 +4277,7 @@ MaybeObject* Heap::AllocateArgumentsObject(Object* callee, int length) {
|
||||
JSObject* boilerplate;
|
||||
int arguments_object_size;
|
||||
bool strict_mode_callee = callee->IsJSFunction() &&
|
||||
!JSFunction::cast(callee)->shared()->is_classic_mode();
|
||||
!JSFunction::cast(callee)->shared()->is_sloppy_mode();
|
||||
if (strict_mode_callee) {
|
||||
boilerplate =
|
||||
isolate()->context()->native_context()->
|
||||
@ -4312,7 +4312,7 @@ MaybeObject* Heap::AllocateArgumentsObject(Object* callee, int length) {
|
||||
JSObject::cast(result)->InObjectPropertyAtPut(kArgumentsLengthIndex,
|
||||
Smi::FromInt(length),
|
||||
SKIP_WRITE_BARRIER);
|
||||
// Set the callee property for non-strict mode arguments object only.
|
||||
// Set the callee property for sloppy mode arguments object only.
|
||||
if (!strict_mode_callee) {
|
||||
JSObject::cast(result)->InObjectPropertyAtPut(kArgumentsCalleeIndex,
|
||||
callee);
|
||||
|
@ -164,7 +164,7 @@ namespace internal {
|
||||
V(Map, fixed_float32_array_map, FixedFloat32ArrayMap) \
|
||||
V(Map, fixed_float64_array_map, FixedFloat64ArrayMap) \
|
||||
V(Map, fixed_uint8_clamped_array_map, FixedUint8ClampedArrayMap) \
|
||||
V(Map, non_strict_arguments_elements_map, NonStrictArgumentsElementsMap) \
|
||||
V(Map, sloppy_arguments_elements_map, SloppyArgumentsElementsMap) \
|
||||
V(Map, function_context_map, FunctionContextMap) \
|
||||
V(Map, catch_context_map, CatchContextMap) \
|
||||
V(Map, with_context_map, WithContextMap) \
|
||||
@ -250,7 +250,7 @@ namespace internal {
|
||||
V(empty_constant_pool_array) \
|
||||
V(arguments_marker) \
|
||||
V(symbol_map) \
|
||||
V(non_strict_arguments_elements_map) \
|
||||
V(sloppy_arguments_elements_map) \
|
||||
V(function_context_map) \
|
||||
V(catch_context_map) \
|
||||
V(with_context_map) \
|
||||
@ -1086,7 +1086,7 @@ class Heap {
|
||||
JSObject::kHeaderSize + 1 * kPointerSize;
|
||||
// Indicies for direct access into argument objects.
|
||||
static const int kArgumentsLengthIndex = 0;
|
||||
// callee is only valid in non-strict mode.
|
||||
// callee is only valid in sloppy mode.
|
||||
static const int kArgumentsCalleeIndex = 1;
|
||||
|
||||
// Allocates an arguments object - optionally with an elements array.
|
||||
|
@ -1282,7 +1282,7 @@ HValue* HGraphBuilder::BuildWrapReceiver(HValue* object, HValue* function) {
|
||||
Handle<JSFunction> f = Handle<JSFunction>::cast(
|
||||
HConstant::cast(function)->handle(isolate()));
|
||||
SharedFunctionInfo* shared = f->shared();
|
||||
if (!shared->is_classic_mode() || shared->native()) return object;
|
||||
if (!shared->is_sloppy_mode() || shared->native()) return object;
|
||||
}
|
||||
return Add<HWrapReceiver>(object, function);
|
||||
}
|
||||
@ -5584,7 +5584,7 @@ bool HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessAsMonomorphic(
|
||||
|
||||
static bool NeedsWrappingFor(Type* type, Handle<JSFunction> target) {
|
||||
return type->Is(Type::NumberOrString()) &&
|
||||
target->shared()->is_classic_mode() &&
|
||||
target->shared()->is_sloppy_mode() &&
|
||||
!target->shared()->native();
|
||||
}
|
||||
|
||||
@ -7937,7 +7937,7 @@ bool HOptimizedGraphBuilder::TryCallApply(Call* expr) {
|
||||
HValue* HOptimizedGraphBuilder::ImplicitReceiverFor(HValue* function,
|
||||
Handle<JSFunction> target) {
|
||||
SharedFunctionInfo* shared = target->shared();
|
||||
if (shared->is_classic_mode() && !shared->native()) {
|
||||
if (shared->is_sloppy_mode() && !shared->native()) {
|
||||
// Cannot embed a direct reference to the global proxy
|
||||
// as is it dropped on deserialization.
|
||||
CHECK(!Serializer::enabled());
|
||||
|
@ -2110,8 +2110,8 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
|
||||
function_state()->ClearInlinedTestContext();
|
||||
}
|
||||
StrictModeFlag function_strict_mode_flag() {
|
||||
return function_state()->compilation_info()->is_classic_mode()
|
||||
? kNonStrictMode : kStrictMode;
|
||||
return function_state()->compilation_info()->is_sloppy_mode()
|
||||
? kSloppyMode : kStrictMode;
|
||||
}
|
||||
|
||||
// Generators for inline runtime functions.
|
||||
|
80
src/i18n.cc
80
src/i18n.cc
@ -163,7 +163,7 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
reinterpret_cast<const uint16_t*>(pattern.getBuffer()),
|
||||
pattern.length())),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
|
||||
// Set time zone and calendar.
|
||||
const icu::Calendar* calendar = date_format->getCalendar();
|
||||
@ -173,7 +173,7 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("calendar")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector(calendar_name)),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
|
||||
const icu::TimeZone& tz = calendar->getTimeZone();
|
||||
icu::UnicodeString time_zone;
|
||||
@ -188,7 +188,7 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("timeZone")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("UTC")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
} else {
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
@ -199,7 +199,7 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
canonical_time_zone.getBuffer()),
|
||||
canonical_time_zone.length())),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,14 +216,14 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("numberingSystem")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector(ns)),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
} else {
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("numberingSystem")),
|
||||
isolate->factory()->undefined_value(),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
delete numbering_system;
|
||||
|
||||
@ -238,7 +238,7 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector(result)),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
} else {
|
||||
// This would never happen, since we got the locale from ICU.
|
||||
JSObject::SetProperty(
|
||||
@ -246,7 +246,7 @@ void SetResolvedDateSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("und")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
reinterpret_cast<const uint16_t*>(pattern.getBuffer()),
|
||||
pattern.length())),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
|
||||
// Set resolved currency code in options.currency if not empty.
|
||||
icu::UnicodeString currency(number_format->getCurrency());
|
||||
@ -402,7 +402,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
reinterpret_cast<const uint16_t*>(currency.getBuffer()),
|
||||
currency.length())),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
|
||||
// Ugly hack. ICU doesn't expose numbering system in any way, so we have
|
||||
@ -418,14 +418,14 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("numberingSystem")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector(ns)),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
} else {
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("numberingSystem")),
|
||||
isolate->factory()->undefined_value(),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
delete numbering_system;
|
||||
|
||||
@ -434,7 +434,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("useGrouping")),
|
||||
isolate->factory()->ToBoolean(number_format->isGroupingUsed()),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
@ -443,7 +443,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
isolate->factory()->NewNumberFromInt(
|
||||
number_format->getMinimumIntegerDigits()),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
@ -452,7 +452,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
isolate->factory()->NewNumberFromInt(
|
||||
number_format->getMinimumFractionDigits()),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
@ -461,7 +461,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
isolate->factory()->NewNumberFromInt(
|
||||
number_format->getMaximumFractionDigits()),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
|
||||
Handle<String> key = isolate->factory()->NewStringFromAscii(
|
||||
CStrVector("minimumSignificantDigits"));
|
||||
@ -473,7 +473,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
isolate->factory()->NewNumberFromInt(
|
||||
number_format->getMinimumSignificantDigits()),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
|
||||
key = isolate->factory()->NewStringFromAscii(
|
||||
@ -486,7 +486,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
isolate->factory()->NewNumberFromInt(
|
||||
number_format->getMaximumSignificantDigits()),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
|
||||
// Set the locale
|
||||
@ -500,7 +500,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector(result)),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
} else {
|
||||
// This would never happen, since we got the locale from ICU.
|
||||
JSObject::SetProperty(
|
||||
@ -508,7 +508,7 @@ void SetResolvedNumberSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("und")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -589,7 +589,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->ToBoolean(
|
||||
collator->getAttribute(UCOL_NUMERIC_COLLATION, status) == UCOL_ON),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
|
||||
switch (collator->getAttribute(UCOL_CASE_FIRST, status)) {
|
||||
case UCOL_LOWER_FIRST:
|
||||
@ -598,7 +598,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("caseFirst")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("lower")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
break;
|
||||
case UCOL_UPPER_FIRST:
|
||||
JSObject::SetProperty(
|
||||
@ -606,7 +606,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("caseFirst")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("upper")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
break;
|
||||
default:
|
||||
JSObject::SetProperty(
|
||||
@ -614,7 +614,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("caseFirst")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("false")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
|
||||
switch (collator->getAttribute(UCOL_STRENGTH, status)) {
|
||||
@ -624,7 +624,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("strength")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("primary")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
|
||||
// case level: true + s1 -> case, s1 -> base.
|
||||
if (UCOL_ON == collator->getAttribute(UCOL_CASE_LEVEL, status)) {
|
||||
@ -633,14 +633,14 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("sensitivity")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("case")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
} else {
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("sensitivity")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("base")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -650,13 +650,13 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("strength")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("secondary")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("sensitivity")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("accent")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
break;
|
||||
case UCOL_TERTIARY:
|
||||
JSObject::SetProperty(
|
||||
@ -664,13 +664,13 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("strength")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("tertiary")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("sensitivity")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("variant")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
break;
|
||||
case UCOL_QUATERNARY:
|
||||
// We shouldn't get quaternary and identical from ICU, but if we do
|
||||
@ -680,13 +680,13 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("strength")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("quaternary")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("sensitivity")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("variant")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
break;
|
||||
default:
|
||||
JSObject::SetProperty(
|
||||
@ -694,13 +694,13 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("strength")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("identical")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
JSObject::SetProperty(
|
||||
resolved,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("sensitivity")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("variant")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
|
||||
JSObject::SetProperty(
|
||||
@ -709,7 +709,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->ToBoolean(collator->getAttribute(
|
||||
UCOL_ALTERNATE_HANDLING, status) == UCOL_SHIFTED),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
|
||||
// Set the locale
|
||||
char result[ULOC_FULLNAME_CAPACITY];
|
||||
@ -722,7 +722,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector(result)),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
} else {
|
||||
// This would never happen, since we got the locale from ICU.
|
||||
JSObject::SetProperty(
|
||||
@ -730,7 +730,7 @@ void SetResolvedCollatorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("und")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -785,7 +785,7 @@ void SetResolvedBreakIteratorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector(result)),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
} else {
|
||||
// This would never happen, since we got the locale from ICU.
|
||||
JSObject::SetProperty(
|
||||
@ -793,7 +793,7 @@ void SetResolvedBreakIteratorSettings(Isolate* isolate,
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("locale")),
|
||||
isolate->factory()->NewStringFromAscii(CStrVector("und")),
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -737,7 +737,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
|
||||
1 << SharedFunctionInfo::kNativeBitWithinByte);
|
||||
__ j(not_equal, &shift_arguments);
|
||||
|
||||
// Compute the receiver in non-strict mode.
|
||||
// Compute the receiver in sloppy mode.
|
||||
__ mov(ebx, Operand(esp, eax, times_4, 0)); // First argument.
|
||||
|
||||
// Call ToObject on the receiver if it is not an object, or use the
|
||||
@ -923,7 +923,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
|
||||
1 << SharedFunctionInfo::kNativeBitWithinByte);
|
||||
__ j(not_equal, &push_receiver);
|
||||
|
||||
// Compute the receiver in non-strict mode.
|
||||
// Compute the receiver in sloppy mode.
|
||||
// Call ToObject on the receiver if it is not an object, or use the
|
||||
// global object if it is null or undefined.
|
||||
__ JumpIfSmi(ebx, &call_to_object);
|
||||
|
@ -1190,7 +1190,7 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void ArgumentsAccessStub::GenerateNewNonStrictSlow(MacroAssembler* masm) {
|
||||
void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) {
|
||||
// esp[0] : return address
|
||||
// esp[4] : number of parameters
|
||||
// esp[8] : receiver displacement
|
||||
@ -1215,7 +1215,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictSlow(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
|
||||
void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) {
|
||||
Isolate* isolate = masm->isolate();
|
||||
|
||||
// esp[0] : return address
|
||||
@ -1349,7 +1349,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
|
||||
__ j(zero, &skip_parameter_map);
|
||||
|
||||
__ mov(FieldOperand(edi, FixedArray::kMapOffset),
|
||||
Immediate(isolate->factory()->non_strict_arguments_elements_map()));
|
||||
Immediate(isolate->factory()->sloppy_arguments_elements_map()));
|
||||
__ lea(eax, Operand(ebx, reinterpret_cast<intptr_t>(Smi::FromInt(2))));
|
||||
__ mov(FieldOperand(edi, FixedArray::kLengthOffset), eax);
|
||||
__ mov(FieldOperand(edi, FixedArray::kHeaderSize + 0 * kPointerSize), esi);
|
||||
|
@ -133,10 +133,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;
|
||||
// +1 for return address.
|
||||
int receiver_offset = (info->scope()->num_parameters() + 1) * kPointerSize;
|
||||
@ -243,12 +243,12 @@ void FullCodeGenerator::Generate() {
|
||||
// The stub will rewrite receiver 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);
|
||||
@ -1290,7 +1290,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.
|
||||
__ cmp(ContextOperand(context, Context::EXTENSION_INDEX),
|
||||
Immediate(0));
|
||||
@ -1304,7 +1304,7 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
|
||||
// If no outer scope calls eval, we do not need to check more
|
||||
// context extensions. If we have reached an eval scope, we check
|
||||
// all extensions from this point.
|
||||
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();
|
||||
}
|
||||
|
||||
@ -1349,7 +1349,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.
|
||||
__ cmp(ContextOperand(context, Context::EXTENSION_INDEX),
|
||||
Immediate(0));
|
||||
@ -2388,7 +2388,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
||||
__ mov(ecx, eax);
|
||||
__ pop(edx); // Receiver.
|
||||
__ pop(eax); // Restore value.
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
Handle<Code> ic = is_sloppy_mode()
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
CallIC(ic);
|
||||
@ -2514,7 +2514,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
||||
__ pop(edx);
|
||||
// Record source code position before IC call.
|
||||
SetSourcePosition(expr->position());
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
Handle<Code> ic = is_sloppy_mode()
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
CallIC(ic, expr->AssignmentFeedbackId());
|
||||
@ -2568,7 +2568,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(Immediate(isolate()->factory()->undefined_value()));
|
||||
flags = NO_CALL_FUNCTION_FLAGS;
|
||||
} else {
|
||||
@ -4167,8 +4167,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;
|
||||
__ push(Immediate(Smi::FromInt(strict_mode_flag)));
|
||||
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
|
||||
context()->Plug(eax);
|
||||
@ -4176,11 +4176,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()) {
|
||||
__ push(GlobalObjectOperand());
|
||||
__ push(Immediate(var->name()));
|
||||
__ push(Immediate(Smi::FromInt(kNonStrictMode)));
|
||||
__ push(Immediate(Smi::FromInt(kSloppyMode)));
|
||||
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
|
||||
context()->Plug(eax);
|
||||
} else if (var->IsStackAllocated() || var->IsContextSlot()) {
|
||||
@ -4447,7 +4447,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
case KEYED_PROPERTY: {
|
||||
__ pop(ecx);
|
||||
__ pop(edx);
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
Handle<Code> ic = is_sloppy_mode()
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
CallIC(ic, expr->CountStoreFeedbackId());
|
||||
|
@ -351,7 +351,7 @@ static Operand GenerateMappedArgumentsLookup(MacroAssembler* masm,
|
||||
__ j(not_zero, slow_case);
|
||||
|
||||
// Load the elements into scratch1 and check its map.
|
||||
Handle<Map> arguments_map(heap->non_strict_arguments_elements_map());
|
||||
Handle<Map> arguments_map(heap->sloppy_arguments_elements_map());
|
||||
__ mov(scratch1, FieldOperand(object, JSObject::kElementsOffset));
|
||||
__ CheckMap(scratch1, arguments_map, slow_case, DONT_DO_SMI_CHECK);
|
||||
|
||||
@ -657,7 +657,7 @@ void KeyedLoadIC::GenerateIndexedInterceptor(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
|
||||
void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- ecx : key
|
||||
// -- edx : receiver
|
||||
@ -682,7 +682,7 @@ void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) {
|
||||
void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- eax : value
|
||||
// -- ecx : key
|
||||
|
@ -175,11 +175,11 @@ bool LCodeGen::GeneratePrologue() {
|
||||
}
|
||||
#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_->this_has_uses() &&
|
||||
info_->is_classic_mode() &&
|
||||
info_->is_sloppy_mode() &&
|
||||
!info_->is_native()) {
|
||||
Label ok;
|
||||
// +1 for return address.
|
||||
@ -3418,7 +3418,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
@ -4531,7 +4531,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ class LCodeGen: public LCodeGenBase {
|
||||
|
||||
private:
|
||||
StrictModeFlag strict_mode_flag() const {
|
||||
return info()->is_classic_mode() ? kNonStrictMode : kStrictMode;
|
||||
return info()->is_sloppy_mode() ? kSloppyMode : kStrictMode;
|
||||
}
|
||||
|
||||
Scope* scope() const { return scope_; }
|
||||
|
20
src/ic.cc
20
src/ic.cc
@ -943,8 +943,8 @@ Handle<Code> LoadIC::CompileHandler(LookupResult* lookup,
|
||||
Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
|
||||
if (!object->IsJSObject() &&
|
||||
!function->IsBuiltin() &&
|
||||
function->shared()->is_classic_mode()) {
|
||||
// Calling non-strict non-builtins with a value as the receiver
|
||||
function->shared()->is_sloppy_mode()) {
|
||||
// Calling sloppy non-builtins with a value as the receiver
|
||||
// requires boxing.
|
||||
break;
|
||||
}
|
||||
@ -1078,12 +1078,12 @@ MaybeObject* KeyedLoadIC::Load(Handle<Object> object, Handle<Object> key) {
|
||||
} else if (object->IsJSObject()) {
|
||||
Handle<JSObject> receiver = Handle<JSObject>::cast(object);
|
||||
if (receiver->elements()->map() ==
|
||||
isolate()->heap()->non_strict_arguments_elements_map()) {
|
||||
stub = non_strict_arguments_stub();
|
||||
isolate()->heap()->sloppy_arguments_elements_map()) {
|
||||
stub = sloppy_arguments_stub();
|
||||
} else if (receiver->HasIndexedInterceptor()) {
|
||||
stub = indexed_interceptor_stub();
|
||||
} else if (!key->ToSmi()->IsFailure() &&
|
||||
(!target().is_identical_to(non_strict_arguments_stub()))) {
|
||||
(!target().is_identical_to(sloppy_arguments_stub()))) {
|
||||
stub = LoadElementStub(receiver);
|
||||
}
|
||||
}
|
||||
@ -1316,7 +1316,7 @@ Handle<Code> StoreIC::CompileHandler(LookupResult* lookup,
|
||||
|
||||
Handle<JSObject> holder(lookup->holder());
|
||||
// Handlers do not use strict mode.
|
||||
StoreStubCompiler compiler(isolate(), kNonStrictMode, kind());
|
||||
StoreStubCompiler compiler(isolate(), kSloppyMode, kind());
|
||||
switch (lookup->type()) {
|
||||
case FIELD:
|
||||
return compiler.CompileStoreField(receiver, lookup, name);
|
||||
@ -1687,12 +1687,12 @@ MaybeObject* KeyedStoreIC::Store(Handle<Object> object,
|
||||
Handle<JSObject> receiver = Handle<JSObject>::cast(object);
|
||||
bool key_is_smi_like = key->IsSmi() || !key->ToSmi()->IsFailure();
|
||||
if (receiver->elements()->map() ==
|
||||
isolate()->heap()->non_strict_arguments_elements_map()) {
|
||||
if (strict_mode() == kNonStrictMode) {
|
||||
stub = non_strict_arguments_stub();
|
||||
isolate()->heap()->sloppy_arguments_elements_map()) {
|
||||
if (strict_mode() == kSloppyMode) {
|
||||
stub = sloppy_arguments_stub();
|
||||
}
|
||||
} else if (key_is_smi_like &&
|
||||
!(target().is_identical_to(non_strict_arguments_stub()))) {
|
||||
!(target().is_identical_to(sloppy_arguments_stub()))) {
|
||||
// We should go generic if receiver isn't a dictionary, but our
|
||||
// prototype chain does have dictionary elements. This ensures that
|
||||
// other non-dictionary receivers in the polymorphic case benefit
|
||||
|
12
src/ic.h
12
src/ic.h
@ -399,7 +399,7 @@ class KeyedLoadIC: public LoadIC {
|
||||
static void GenerateGeneric(MacroAssembler* masm);
|
||||
static void GenerateString(MacroAssembler* masm);
|
||||
static void GenerateIndexedInterceptor(MacroAssembler* masm);
|
||||
static void GenerateNonStrictArguments(MacroAssembler* masm);
|
||||
static void GenerateSloppyArguments(MacroAssembler* masm);
|
||||
|
||||
// Bit mask to be tested against bit field for the cases when
|
||||
// generic stub should go into slow case.
|
||||
@ -436,8 +436,8 @@ class KeyedLoadIC: public LoadIC {
|
||||
Handle<Code> indexed_interceptor_stub() {
|
||||
return isolate()->builtins()->KeyedLoadIC_IndexedInterceptor();
|
||||
}
|
||||
Handle<Code> non_strict_arguments_stub() {
|
||||
return isolate()->builtins()->KeyedLoadIC_NonStrictArguments();
|
||||
Handle<Code> sloppy_arguments_stub() {
|
||||
return isolate()->builtins()->KeyedLoadIC_SloppyArguments();
|
||||
}
|
||||
Handle<Code> string_stub() {
|
||||
return isolate()->builtins()->KeyedLoadIC_String();
|
||||
@ -589,7 +589,7 @@ class KeyedStoreIC: public StoreIC {
|
||||
static void GenerateRuntimeSetProperty(MacroAssembler* masm,
|
||||
StrictModeFlag strict_mode);
|
||||
static void GenerateGeneric(MacroAssembler* masm, StrictModeFlag strict_mode);
|
||||
static void GenerateNonStrictArguments(MacroAssembler* masm);
|
||||
static void GenerateSloppyArguments(MacroAssembler* masm);
|
||||
|
||||
protected:
|
||||
virtual Code::Kind kind() const { return Code::KEYED_STORE_IC; }
|
||||
@ -637,8 +637,8 @@ class KeyedStoreIC: public StoreIC {
|
||||
}
|
||||
}
|
||||
|
||||
Handle<Code> non_strict_arguments_stub() {
|
||||
return isolate()->builtins()->KeyedStoreIC_NonStrictArguments();
|
||||
Handle<Code> sloppy_arguments_stub() {
|
||||
return isolate()->builtins()->KeyedStoreIC_SloppyArguments();
|
||||
}
|
||||
|
||||
static void Clear(Isolate* isolate, Address address, Code* target);
|
||||
|
@ -453,10 +453,10 @@ Handle<JSArray> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object,
|
||||
// If the caller parameter is a function we skip frames until we're
|
||||
// under it before starting to collect.
|
||||
bool seen_caller = !caller->IsJSFunction();
|
||||
// First element is reserved to store the number of non-strict frames.
|
||||
// First element is reserved to store the number of sloppy frames.
|
||||
int cursor = 1;
|
||||
int frames_seen = 0;
|
||||
int non_strict_frames = 0;
|
||||
int sloppy_frames = 0;
|
||||
bool encountered_strict_function = false;
|
||||
for (StackFrameIterator iter(this);
|
||||
!iter.done() && frames_seen < limit;
|
||||
@ -487,13 +487,13 @@ Handle<JSArray> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object,
|
||||
Handle<Smi> offset(Smi::FromInt(frames[i].offset()), this);
|
||||
// The stack trace API should not expose receivers and function
|
||||
// objects on frames deeper than the top-most one with a strict
|
||||
// mode function. The number of non-strict frames is stored as
|
||||
// mode function. The number of sloppy frames is stored as
|
||||
// first element in the result array.
|
||||
if (!encountered_strict_function) {
|
||||
if (!fun->shared()->is_classic_mode()) {
|
||||
if (!fun->shared()->is_sloppy_mode()) {
|
||||
encountered_strict_function = true;
|
||||
} else {
|
||||
non_strict_frames++;
|
||||
sloppy_frames++;
|
||||
}
|
||||
}
|
||||
elements->set(cursor++, *recv);
|
||||
@ -503,7 +503,7 @@ Handle<JSArray> Isolate::CaptureSimpleStackTrace(Handle<JSObject> error_object,
|
||||
}
|
||||
}
|
||||
}
|
||||
elements->set(0, Smi::FromInt(non_strict_frames));
|
||||
elements->set(0, Smi::FromInt(sloppy_frames));
|
||||
Handle<JSArray> result = factory()->NewJSArrayWithElements(elements);
|
||||
result->set_length(Smi::FromInt(cursor));
|
||||
return result;
|
||||
|
@ -361,7 +361,7 @@ Handle<Object> JsonParser<seq_ascii>::ParseJsonObject() {
|
||||
Handle<Object> value = ParseJsonValue();
|
||||
if (value.is_null()) return ReportUnexpectedCharacter();
|
||||
|
||||
JSObject::SetOwnElement(json_object, index, value, kNonStrictMode);
|
||||
JSObject::SetOwnElement(json_object, index, value, kSloppyMode);
|
||||
continue;
|
||||
}
|
||||
// Not an index, fallback to the slow path.
|
||||
|
@ -49,14 +49,14 @@ namespace internal {
|
||||
#ifdef ENABLE_DEBUGGER_SUPPORT
|
||||
|
||||
|
||||
void SetElementNonStrict(Handle<JSObject> object,
|
||||
uint32_t index,
|
||||
Handle<Object> value) {
|
||||
void SetElementSloppy(Handle<JSObject> object,
|
||||
uint32_t index,
|
||||
Handle<Object> value) {
|
||||
// Ignore return value from SetElement. It can only be a failure if there
|
||||
// are element setters causing exceptions and the debugger context has none
|
||||
// of these.
|
||||
Handle<Object> no_failure =
|
||||
JSObject::SetElement(object, index, value, NONE, kNonStrictMode);
|
||||
JSObject::SetElement(object, index, value, NONE, kSloppyMode);
|
||||
ASSERT(!no_failure.is_null());
|
||||
USE(no_failure);
|
||||
}
|
||||
@ -359,17 +359,17 @@ class CompareOutputArrayWriter {
|
||||
|
||||
void WriteChunk(int char_pos1, int char_pos2, int char_len1, int char_len2) {
|
||||
Isolate* isolate = array_->GetIsolate();
|
||||
SetElementNonStrict(array_,
|
||||
current_size_,
|
||||
Handle<Object>(Smi::FromInt(char_pos1), isolate));
|
||||
SetElementNonStrict(array_,
|
||||
current_size_ + 1,
|
||||
Handle<Object>(Smi::FromInt(char_pos1 + char_len1),
|
||||
isolate));
|
||||
SetElementNonStrict(array_,
|
||||
current_size_ + 2,
|
||||
Handle<Object>(Smi::FromInt(char_pos2 + char_len2),
|
||||
isolate));
|
||||
SetElementSloppy(array_,
|
||||
current_size_,
|
||||
Handle<Object>(Smi::FromInt(char_pos1), isolate));
|
||||
SetElementSloppy(array_,
|
||||
current_size_ + 1,
|
||||
Handle<Object>(Smi::FromInt(char_pos1 + char_len1),
|
||||
isolate));
|
||||
SetElementSloppy(array_,
|
||||
current_size_ + 2,
|
||||
Handle<Object>(Smi::FromInt(char_pos2 + char_len2),
|
||||
isolate));
|
||||
current_size_ += 3;
|
||||
}
|
||||
|
||||
@ -662,12 +662,12 @@ class JSArrayBasedStruct {
|
||||
|
||||
protected:
|
||||
void SetField(int field_position, Handle<Object> value) {
|
||||
SetElementNonStrict(array_, field_position, value);
|
||||
SetElementSloppy(array_, field_position, value);
|
||||
}
|
||||
void SetSmiValueField(int field_position, int value) {
|
||||
SetElementNonStrict(array_,
|
||||
field_position,
|
||||
Handle<Smi>(Smi::FromInt(value), isolate()));
|
||||
SetElementSloppy(array_,
|
||||
field_position,
|
||||
Handle<Smi>(Smi::FromInt(value), isolate()));
|
||||
}
|
||||
Object* GetField(int field_position) {
|
||||
return array_->GetElementNoExceptionThrown(isolate(), field_position);
|
||||
@ -818,7 +818,7 @@ class FunctionInfoListener {
|
||||
fun->materialized_literal_count(),
|
||||
current_parent_index_);
|
||||
current_parent_index_ = len_;
|
||||
SetElementNonStrict(result_, len_, info.GetJSArray());
|
||||
SetElementSloppy(result_, len_, info.GetJSArray());
|
||||
len_++;
|
||||
}
|
||||
|
||||
@ -885,20 +885,20 @@ class FunctionInfoListener {
|
||||
context_list.Sort(&Variable::CompareIndex);
|
||||
|
||||
for (int i = 0; i < context_list.length(); i++) {
|
||||
SetElementNonStrict(scope_info_list,
|
||||
scope_info_length,
|
||||
context_list[i]->name());
|
||||
SetElementSloppy(scope_info_list,
|
||||
scope_info_length,
|
||||
context_list[i]->name());
|
||||
scope_info_length++;
|
||||
SetElementNonStrict(
|
||||
SetElementSloppy(
|
||||
scope_info_list,
|
||||
scope_info_length,
|
||||
Handle<Smi>(Smi::FromInt(context_list[i]->index()), isolate()));
|
||||
scope_info_length++;
|
||||
}
|
||||
SetElementNonStrict(scope_info_list,
|
||||
scope_info_length,
|
||||
Handle<Object>(isolate()->heap()->null_value(),
|
||||
isolate()));
|
||||
SetElementSloppy(scope_info_list,
|
||||
scope_info_length,
|
||||
Handle<Object>(isolate()->heap()->null_value(),
|
||||
isolate()));
|
||||
scope_info_length++;
|
||||
|
||||
current_scope = current_scope->outer_scope();
|
||||
@ -959,11 +959,11 @@ JSArray* LiveEdit::GatherCompileInfo(Handle<Script> script,
|
||||
Handle<Smi> end_pos(Smi::FromInt(message_location.end_pos()), isolate);
|
||||
Handle<JSValue> script_obj = GetScriptWrapper(message_location.script());
|
||||
JSReceiver::SetProperty(
|
||||
rethrow_exception, start_pos_key, start_pos, NONE, kNonStrictMode);
|
||||
rethrow_exception, start_pos_key, start_pos, NONE, kSloppyMode);
|
||||
JSReceiver::SetProperty(
|
||||
rethrow_exception, end_pos_key, end_pos, NONE, kNonStrictMode);
|
||||
rethrow_exception, end_pos_key, end_pos, NONE, kSloppyMode);
|
||||
JSReceiver::SetProperty(
|
||||
rethrow_exception, script_obj_key, script_obj, NONE, kNonStrictMode);
|
||||
rethrow_exception, script_obj_key, script_obj, NONE, kSloppyMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -992,7 +992,7 @@ void LiveEdit::WrapSharedFunctionInfos(Handle<JSArray> array) {
|
||||
Handle<String> name_handle(String::cast(info->name()));
|
||||
info_wrapper.SetProperties(name_handle, info->start_position(),
|
||||
info->end_position(), info);
|
||||
SetElementNonStrict(array, i, info_wrapper.GetJSArray());
|
||||
SetElementSloppy(array, i, info_wrapper.GetJSArray());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1639,8 +1639,7 @@ static bool CheckActivation(Handle<JSArray> shared_info_array,
|
||||
UnwrapSharedFunctionInfoFromJSValue(jsvalue);
|
||||
|
||||
if (function->shared() == *shared || IsInlined(*function, *shared)) {
|
||||
SetElementNonStrict(result, i, Handle<Smi>(Smi::FromInt(status),
|
||||
isolate));
|
||||
SetElementSloppy(result, i, Handle<Smi>(Smi::FromInt(status), isolate));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -1954,7 +1953,7 @@ static const char* DropActivationsInActiveThread(
|
||||
Smi::FromInt(LiveEdit::FUNCTION_BLOCKED_ON_ACTIVE_STACK)) {
|
||||
Handle<Object> replaced(
|
||||
Smi::FromInt(LiveEdit::FUNCTION_REPLACED_ON_ACTIVE_STACK), isolate);
|
||||
SetElementNonStrict(result, i, replaced);
|
||||
SetElementSloppy(result, i, replaced);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@ -1995,7 +1994,7 @@ Handle<JSArray> LiveEdit::CheckAndDropActivations(
|
||||
|
||||
// Fill the default values.
|
||||
for (int i = 0; i < len; i++) {
|
||||
SetElementNonStrict(
|
||||
SetElementSloppy(
|
||||
result,
|
||||
i,
|
||||
Handle<Smi>(Smi::FromInt(FUNCTION_AVAILABLE_FOR_PATCH), isolate));
|
||||
@ -2018,7 +2017,7 @@ Handle<JSArray> LiveEdit::CheckAndDropActivations(
|
||||
// Add error message as an array extra element.
|
||||
Vector<const char> vector_message(error_message, StrLength(error_message));
|
||||
Handle<String> str = isolate->factory()->NewStringFromAscii(vector_message);
|
||||
SetElementNonStrict(result, len, str);
|
||||
SetElementSloppy(result, len, str);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
@ -1074,15 +1074,15 @@ function FormatErrorString(error) {
|
||||
|
||||
function GetStackFrames(raw_stack) {
|
||||
var frames = new InternalArray();
|
||||
var non_strict_frames = raw_stack[0];
|
||||
var sloppy_frames = raw_stack[0];
|
||||
for (var i = 1; i < raw_stack.length; i += 4) {
|
||||
var recv = raw_stack[i];
|
||||
var fun = raw_stack[i + 1];
|
||||
var code = raw_stack[i + 2];
|
||||
var pc = raw_stack[i + 3];
|
||||
var pos = %FunctionGetPositionForOffset(code, pc);
|
||||
non_strict_frames--;
|
||||
frames.push(new CallSite(recv, fun, pos, (non_strict_frames < 0)));
|
||||
sloppy_frames--;
|
||||
frames.push(new CallSite(recv, fun, pos, (sloppy_frames < 0)));
|
||||
}
|
||||
return frames;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ bool LCodeGen::GeneratePrologue() {
|
||||
// global proxy when called as functions (without an explicit receiver
|
||||
// object).
|
||||
if (info_->this_has_uses() &&
|
||||
info_->is_classic_mode() &&
|
||||
info_->is_sloppy_mode() &&
|
||||
!info_->is_native()) {
|
||||
Label ok;
|
||||
int receiver_offset = info_->scope()->num_parameters() * kPointerSize;
|
||||
@ -3028,7 +3028,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
@ -4136,7 +4136,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
||||
case FAST_HOLEY_ELEMENTS:
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ class LCodeGen: public LCodeGenBase {
|
||||
|
||||
private:
|
||||
StrictModeFlag strict_mode_flag() const {
|
||||
return info()->is_classic_mode() ? kNonStrictMode : kStrictMode;
|
||||
return info()->is_sloppy_mode() ? kSloppyMode : kStrictMode;
|
||||
}
|
||||
|
||||
Scope* scope() const { return scope_; }
|
||||
|
@ -275,7 +275,7 @@ void JSObject::JSObjectVerify() {
|
||||
VerifyHeapPointer(properties());
|
||||
VerifyHeapPointer(elements());
|
||||
|
||||
if (GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS) {
|
||||
if (GetElementsKind() == SLOPPY_ARGUMENTS_ELEMENTS) {
|
||||
CHECK(this->elements()->IsFixedArray());
|
||||
CHECK_GE(this->elements()->length(), 2);
|
||||
}
|
||||
@ -1060,7 +1060,7 @@ void JSObject::IncrementSpillStatistics(SpillInformation* info) {
|
||||
dict->Capacity() - dict->NumberOfElements();
|
||||
break;
|
||||
}
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1739,7 +1739,7 @@ MaybeObject* JSObject::ResetElements() {
|
||||
SeededNumberDictionary* dictionary;
|
||||
MaybeObject* maybe = SeededNumberDictionary::Allocate(GetHeap(), 0);
|
||||
if (!maybe->To(&dictionary)) return maybe;
|
||||
if (map() == GetHeap()->non_strict_arguments_elements_map()) {
|
||||
if (map() == GetHeap()->sloppy_arguments_elements_map()) {
|
||||
FixedArray::cast(elements())->set(1, dictionary);
|
||||
} else {
|
||||
set_elements(dictionary);
|
||||
@ -5153,27 +5153,27 @@ LanguageMode SharedFunctionInfo::language_mode() {
|
||||
return EXTENDED_MODE;
|
||||
}
|
||||
return BooleanBit::get(hints, kStrictModeFunction)
|
||||
? STRICT_MODE : CLASSIC_MODE;
|
||||
? STRICT_MODE : SLOPPY_MODE;
|
||||
}
|
||||
|
||||
|
||||
void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) {
|
||||
// We only allow language mode transitions that go set the same language mode
|
||||
// again or go up in the chain:
|
||||
// CLASSIC_MODE -> STRICT_MODE -> EXTENDED_MODE.
|
||||
ASSERT(this->language_mode() == CLASSIC_MODE ||
|
||||
// SLOPPY_MODE -> STRICT_MODE -> EXTENDED_MODE.
|
||||
ASSERT(this->language_mode() == SLOPPY_MODE ||
|
||||
this->language_mode() == language_mode ||
|
||||
language_mode == EXTENDED_MODE);
|
||||
int hints = compiler_hints();
|
||||
hints = BooleanBit::set(
|
||||
hints, kStrictModeFunction, language_mode != CLASSIC_MODE);
|
||||
hints, kStrictModeFunction, language_mode != SLOPPY_MODE);
|
||||
hints = BooleanBit::set(
|
||||
hints, kExtendedModeFunction, language_mode == EXTENDED_MODE);
|
||||
set_compiler_hints(hints);
|
||||
}
|
||||
|
||||
|
||||
bool SharedFunctionInfo::is_classic_mode() {
|
||||
bool SharedFunctionInfo::is_sloppy_mode() {
|
||||
return !BooleanBit::get(compiler_hints(), kStrictModeFunction);
|
||||
}
|
||||
|
||||
@ -5925,7 +5925,7 @@ ElementsKind JSObject::GetElementsKind() {
|
||||
fixed_array->IsFixedArray() &&
|
||||
fixed_array->IsDictionary()) ||
|
||||
(kind > DICTIONARY_ELEMENTS));
|
||||
ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) ||
|
||||
ASSERT((kind != SLOPPY_ARGUMENTS_ELEMENTS) ||
|
||||
(elements()->IsFixedArray() && elements()->length() >= 2));
|
||||
}
|
||||
#endif
|
||||
@ -5973,8 +5973,8 @@ bool JSObject::HasDictionaryElements() {
|
||||
}
|
||||
|
||||
|
||||
bool JSObject::HasNonStrictArgumentsElements() {
|
||||
return GetElementsKind() == NON_STRICT_ARGUMENTS_ELEMENTS;
|
||||
bool JSObject::HasSloppyArgumentsElements() {
|
||||
return GetElementsKind() == SLOPPY_ARGUMENTS_ELEMENTS;
|
||||
}
|
||||
|
||||
|
||||
|
@ -378,7 +378,7 @@ void JSObject::PrintElements(FILE* out) {
|
||||
case DICTIONARY_ELEMENTS:
|
||||
elements()->Print(out);
|
||||
break;
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS: {
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS: {
|
||||
FixedArray* p = FixedArray::cast(elements());
|
||||
PrintF(out, " parameter map:");
|
||||
for (int i = 2; i < p->length(); i++) {
|
||||
|
@ -2163,7 +2163,7 @@ Handle<Object> JSObject::AddProperty(Handle<JSObject> object,
|
||||
|
||||
if (extensibility_check == PERFORM_EXTENSIBILITY_CHECK &&
|
||||
!object->map()->is_extensible()) {
|
||||
if (strict_mode == kNonStrictMode) {
|
||||
if (strict_mode == kSloppyMode) {
|
||||
return value;
|
||||
} else {
|
||||
Handle<Object> args[1] = { name };
|
||||
@ -2953,7 +2953,7 @@ Handle<Object> JSObject::SetPropertyWithCallback(Handle<JSObject> object,
|
||||
return SetPropertyWithDefinedSetter(
|
||||
object, Handle<JSReceiver>::cast(setter), value);
|
||||
} else {
|
||||
if (strict_mode == kNonStrictMode) {
|
||||
if (strict_mode == kSloppyMode) {
|
||||
return value;
|
||||
}
|
||||
Handle<Object> args[2] = { name, holder };
|
||||
@ -3090,7 +3090,7 @@ Handle<Object> JSObject::SetPropertyViaPrototypes(Handle<JSObject> object,
|
||||
|
||||
// If we get here with *done true, we have encountered a read-only property.
|
||||
if (*done) {
|
||||
if (strict_mode == kNonStrictMode) return value;
|
||||
if (strict_mode == kSloppyMode) return value;
|
||||
Handle<Object> args[] = { name, object };
|
||||
Handle<Object> error = isolate->factory()->NewTypeError(
|
||||
"strict_read_only_property", HandleVector(args, ARRAY_SIZE(args)));
|
||||
@ -3646,7 +3646,7 @@ Handle<Object> JSProxy::SetPropertyViaPrototypesWithHandler(
|
||||
ASSERT(writable->IsTrue() || writable->IsFalse());
|
||||
*done = writable->IsFalse();
|
||||
if (!*done) return isolate->factory()->the_hole_value();
|
||||
if (strict_mode == kNonStrictMode) return value;
|
||||
if (strict_mode == kSloppyMode) return value;
|
||||
Handle<Object> args[] = { name, receiver };
|
||||
Handle<Object> error = isolate->factory()->NewTypeError(
|
||||
"strict_read_only_property", HandleVector(args, ARRAY_SIZE(args)));
|
||||
@ -3665,7 +3665,7 @@ Handle<Object> JSProxy::SetPropertyViaPrototypesWithHandler(
|
||||
receiver, Handle<JSReceiver>::cast(setter), value);
|
||||
}
|
||||
|
||||
if (strict_mode == kNonStrictMode) return value;
|
||||
if (strict_mode == kSloppyMode) return value;
|
||||
Handle<Object> args2[] = { name, proxy };
|
||||
Handle<Object> error = isolate->factory()->NewTypeError(
|
||||
"no_setter_in_callback", HandleVector(args2, ARRAY_SIZE(args2)));
|
||||
@ -3915,7 +3915,7 @@ Handle<Object> JSObject::SetPropertyUsingTransition(
|
||||
// of the map. If we get a fast copy of the map, all field representations
|
||||
// will be tagged since the transition is omitted.
|
||||
return JSObject::AddProperty(
|
||||
object, name, value, attributes, kNonStrictMode,
|
||||
object, name, value, attributes, kSloppyMode,
|
||||
JSReceiver::CERTAINLY_NOT_STORE_FROM_KEYED,
|
||||
JSReceiver::OMIT_EXTENSIBILITY_CHECK,
|
||||
JSObject::FORCE_TAGGED, FORCE_FIELD, OMIT_TRANSITION);
|
||||
@ -4181,7 +4181,7 @@ Handle<Object> JSObject::SetLocalPropertyIgnoreAttributes(
|
||||
if (object->IsAccessCheckNeeded()) {
|
||||
if (!isolate->MayNamedAccessWrapper(object, name, v8::ACCESS_SET)) {
|
||||
return SetPropertyWithFailedAccessCheck(object, &lookup, name, value,
|
||||
false, kNonStrictMode);
|
||||
false, kSloppyMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4204,7 +4204,7 @@ Handle<Object> JSObject::SetLocalPropertyIgnoreAttributes(
|
||||
TransitionFlag flag = lookup.IsFound()
|
||||
? OMIT_TRANSITION : INSERT_TRANSITION;
|
||||
// Neither properties nor transitions found.
|
||||
return AddProperty(object, name, value, attributes, kNonStrictMode,
|
||||
return AddProperty(object, name, value, attributes, kSloppyMode,
|
||||
MAY_BE_STORE_FROM_KEYED, extensibility_check, value_type, mode, flag);
|
||||
}
|
||||
|
||||
@ -4733,7 +4733,7 @@ MaybeObject* JSObject::NormalizeElements() {
|
||||
FixedArrayBase* array = FixedArrayBase::cast(elements());
|
||||
Map* old_map = array->map();
|
||||
bool is_arguments =
|
||||
(old_map == old_map->GetHeap()->non_strict_arguments_elements_map());
|
||||
(old_map == old_map->GetHeap()->sloppy_arguments_elements_map());
|
||||
if (is_arguments) {
|
||||
array = FixedArrayBase::cast(FixedArray::cast(array)->get(1));
|
||||
}
|
||||
@ -5385,7 +5385,7 @@ bool JSObject::ReferencesObject(Object* obj) {
|
||||
if (ReferencesObjectFromElements(elements, kind, obj)) return true;
|
||||
break;
|
||||
}
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS: {
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS: {
|
||||
FixedArray* parameter_map = FixedArray::cast(elements());
|
||||
// Check the mapped parameters.
|
||||
int length = parameter_map->length();
|
||||
@ -5529,8 +5529,8 @@ static void FreezeDictionary(Dictionary* dictionary) {
|
||||
|
||||
|
||||
Handle<Object> JSObject::Freeze(Handle<JSObject> object) {
|
||||
// Freezing non-strict arguments should be handled elsewhere.
|
||||
ASSERT(!object->HasNonStrictArgumentsElements());
|
||||
// Freezing sloppy arguments should be handled elsewhere.
|
||||
ASSERT(!object->HasSloppyArgumentsElements());
|
||||
ASSERT(!object->map()->is_observed());
|
||||
|
||||
if (object->map()->is_frozen()) return object;
|
||||
@ -5797,7 +5797,7 @@ Handle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
|
||||
if (copying) {
|
||||
// Creating object copy for literals. No strict mode needed.
|
||||
CHECK_NOT_EMPTY_HANDLE(isolate, JSObject::SetProperty(
|
||||
copy, key_string, result, NONE, kNonStrictMode));
|
||||
copy, key_string, result, NONE, kSloppyMode));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -5856,7 +5856,7 @@ Handle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNIMPLEMENTED();
|
||||
break;
|
||||
|
||||
@ -6117,7 +6117,7 @@ void JSObject::DefineElementAccessor(Handle<JSObject> object,
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS: {
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS: {
|
||||
// Ascertain whether we have read-only properties or an existing
|
||||
// getter/setter pair in an arguments elements dictionary backing
|
||||
// store.
|
||||
@ -6269,7 +6269,7 @@ void JSObject::SetElementCallback(Handle<JSObject> object,
|
||||
dictionary->set_requires_slow_elements();
|
||||
|
||||
// Update the dictionary backing store on the object.
|
||||
if (object->elements()->map() == heap->non_strict_arguments_elements_map()) {
|
||||
if (object->elements()->map() == heap->sloppy_arguments_elements_map()) {
|
||||
// Also delete any parameter alias.
|
||||
//
|
||||
// TODO(kmillikin): when deleting the last parameter alias we could
|
||||
@ -6570,7 +6570,7 @@ Handle<Object> JSObject::SetAccessor(Handle<JSObject> object,
|
||||
|
||||
case DICTIONARY_ELEMENTS:
|
||||
break;
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNIMPLEMENTED();
|
||||
break;
|
||||
}
|
||||
@ -9806,13 +9806,13 @@ void JSFunction::SetPrototype(Handle<JSFunction> function,
|
||||
|
||||
void JSFunction::RemovePrototype() {
|
||||
Context* native_context = context()->native_context();
|
||||
Map* no_prototype_map = shared()->is_classic_mode()
|
||||
Map* no_prototype_map = shared()->is_sloppy_mode()
|
||||
? native_context->function_without_prototype_map()
|
||||
: native_context->strict_mode_function_without_prototype_map();
|
||||
|
||||
if (map() == no_prototype_map) return;
|
||||
|
||||
ASSERT(map() == (shared()->is_classic_mode()
|
||||
ASSERT(map() == (shared()->is_sloppy_mode()
|
||||
? native_context->function_map()
|
||||
: native_context->strict_mode_function_map()));
|
||||
|
||||
@ -11242,7 +11242,7 @@ MaybeObject* JSObject::SetFastElementsCapacityAndLength(
|
||||
accessor->CopyElements(this, new_elements, elements_kind);
|
||||
if (maybe_obj->IsFailure()) return maybe_obj;
|
||||
|
||||
if (elements_kind != NON_STRICT_ARGUMENTS_ELEMENTS) {
|
||||
if (elements_kind != SLOPPY_ARGUMENTS_ELEMENTS) {
|
||||
Map* new_map = map();
|
||||
if (new_elements_kind != elements_kind) {
|
||||
MaybeObject* maybe =
|
||||
@ -11314,7 +11314,7 @@ MaybeObject* JSObject::SetFastDoubleElementsCapacityAndLength(
|
||||
accessor->CopyElements(this, elems, elements_kind);
|
||||
if (maybe_obj->IsFailure()) return maybe_obj;
|
||||
}
|
||||
if (elements_kind != NON_STRICT_ARGUMENTS_ELEMENTS) {
|
||||
if (elements_kind != SLOPPY_ARGUMENTS_ELEMENTS) {
|
||||
ValidateElements();
|
||||
set_map_and_elements(new_map, elems);
|
||||
} else {
|
||||
@ -11485,12 +11485,12 @@ MaybeObject* JSArray::SetElementsLength(Object* len) {
|
||||
if (delete_count > 0) {
|
||||
for (int i = indices.length() - 1; i >= 0; i--) {
|
||||
JSObject::SetElement(deleted, indices[i] - index, old_values[i], NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
|
||||
SetProperty(deleted, isolate->factory()->length_string(),
|
||||
isolate->factory()->NewNumberFromUint(delete_count),
|
||||
NONE, kNonStrictMode);
|
||||
NONE, kSloppyMode);
|
||||
}
|
||||
|
||||
EnqueueSpliceRecord(self, index, deleted, add_count);
|
||||
@ -12056,7 +12056,7 @@ Handle<Object> JSObject::SetElementWithCallback(Handle<JSObject> object,
|
||||
return SetPropertyWithDefinedSetter(
|
||||
object, Handle<JSReceiver>::cast(setter), value);
|
||||
} else {
|
||||
if (strict_mode == kNonStrictMode) {
|
||||
if (strict_mode == kSloppyMode) {
|
||||
return value;
|
||||
}
|
||||
Handle<Object> key(isolate->factory()->NewNumberFromUint(index));
|
||||
@ -12080,7 +12080,7 @@ bool JSObject::HasFastArgumentsElements() {
|
||||
Heap* heap = GetHeap();
|
||||
if (!elements()->IsFixedArray()) return false;
|
||||
FixedArray* elements = FixedArray::cast(this->elements());
|
||||
if (elements->map() != heap->non_strict_arguments_elements_map()) {
|
||||
if (elements->map() != heap->sloppy_arguments_elements_map()) {
|
||||
return false;
|
||||
}
|
||||
FixedArray* arguments = FixedArray::cast(elements->get(1));
|
||||
@ -12092,7 +12092,7 @@ bool JSObject::HasDictionaryArgumentsElements() {
|
||||
Heap* heap = GetHeap();
|
||||
if (!elements()->IsFixedArray()) return false;
|
||||
FixedArray* elements = FixedArray::cast(this->elements());
|
||||
if (elements->map() != heap->non_strict_arguments_elements_map()) {
|
||||
if (elements->map() != heap->sloppy_arguments_elements_map()) {
|
||||
return false;
|
||||
}
|
||||
FixedArray* arguments = FixedArray::cast(elements->get(1));
|
||||
@ -12124,7 +12124,7 @@ Handle<Object> JSObject::SetFastElement(Handle<JSObject> object,
|
||||
|
||||
Handle<FixedArray> backing_store(FixedArray::cast(object->elements()));
|
||||
if (backing_store->map() ==
|
||||
isolate->heap()->non_strict_arguments_elements_map()) {
|
||||
isolate->heap()->sloppy_arguments_elements_map()) {
|
||||
backing_store = handle(FixedArray::cast(backing_store->get(1)));
|
||||
} else {
|
||||
backing_store = EnsureWritableFastElements(object);
|
||||
@ -12245,7 +12245,7 @@ Handle<Object> JSObject::SetDictionaryElement(Handle<JSObject> object,
|
||||
// Insert element in the dictionary.
|
||||
Handle<FixedArray> elements(FixedArray::cast(object->elements()));
|
||||
bool is_arguments =
|
||||
(elements->map() == isolate->heap()->non_strict_arguments_elements_map());
|
||||
(elements->map() == isolate->heap()->sloppy_arguments_elements_map());
|
||||
Handle<SeededNumberDictionary> dictionary(is_arguments
|
||||
? SeededNumberDictionary::cast(elements->get(1))
|
||||
: SeededNumberDictionary::cast(*elements));
|
||||
@ -12267,7 +12267,7 @@ Handle<Object> JSObject::SetDictionaryElement(Handle<JSObject> object,
|
||||
attributes, NORMAL, details.dictionary_index());
|
||||
dictionary->DetailsAtPut(entry, details);
|
||||
} else if (details.IsReadOnly() && !element->IsTheHole()) {
|
||||
if (strict_mode == kNonStrictMode) {
|
||||
if (strict_mode == kSloppyMode) {
|
||||
return isolate->factory()->undefined_value();
|
||||
} else {
|
||||
Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
|
||||
@ -12305,7 +12305,7 @@ Handle<Object> JSObject::SetDictionaryElement(Handle<JSObject> object,
|
||||
// When we set the is_extensible flag to false we always force the
|
||||
// element into dictionary mode (and force them to stay there).
|
||||
if (!object->map()->is_extensible()) {
|
||||
if (strict_mode == kNonStrictMode) {
|
||||
if (strict_mode == kSloppyMode) {
|
||||
return isolate->factory()->undefined_value();
|
||||
} else {
|
||||
Handle<Object> number = isolate->factory()->NewNumberFromUint(index);
|
||||
@ -12680,7 +12680,7 @@ Handle<Object> JSObject::SetElementWithoutInterceptor(
|
||||
return SetDictionaryElement(object, index, value, attributes, strict_mode,
|
||||
check_prototype,
|
||||
set_mode);
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS: {
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS: {
|
||||
Handle<FixedArray> parameter_map(FixedArray::cast(object->elements()));
|
||||
uint32_t length = parameter_map->length();
|
||||
Handle<Object> probe = index < length - 2 ?
|
||||
@ -13039,7 +13039,7 @@ void JSObject::GetElementsCapacityAndUsage(int* capacity, int* used) {
|
||||
FixedArrayBase* backing_store_base = FixedArrayBase::cast(elements());
|
||||
FixedArray* backing_store = NULL;
|
||||
switch (GetElementsKind()) {
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
backing_store_base =
|
||||
FixedArray::cast(FixedArray::cast(backing_store_base)->get(1));
|
||||
backing_store = FixedArray::cast(backing_store_base);
|
||||
@ -13155,7 +13155,7 @@ bool JSObject::ShouldConvertToFastElements() {
|
||||
|
||||
FixedArray* elements = FixedArray::cast(this->elements());
|
||||
SeededNumberDictionary* dictionary = NULL;
|
||||
if (elements->map() == GetHeap()->non_strict_arguments_elements_map()) {
|
||||
if (elements->map() == GetHeap()->sloppy_arguments_elements_map()) {
|
||||
dictionary = SeededNumberDictionary::cast(elements->get(1));
|
||||
} else {
|
||||
dictionary = SeededNumberDictionary::cast(elements);
|
||||
@ -13635,7 +13635,7 @@ int JSObject::GetLocalElementKeys(FixedArray* storage,
|
||||
counter += element_dictionary()->NumberOfElementsFilterAttributes(filter);
|
||||
break;
|
||||
}
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS: {
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS: {
|
||||
FixedArray* parameter_map = FixedArray::cast(elements());
|
||||
int mapped_length = parameter_map->length() - 2;
|
||||
FixedArray* arguments = FixedArray::cast(parameter_map->get(1));
|
||||
@ -13746,7 +13746,7 @@ class StringSharedKey : public HashTableKey {
|
||||
SharedFunctionInfo* shared = SharedFunctionInfo::cast(other_array->get(0));
|
||||
if (shared != shared_) return false;
|
||||
int language_unchecked = Smi::cast(other_array->get(2))->value();
|
||||
ASSERT(language_unchecked == CLASSIC_MODE ||
|
||||
ASSERT(language_unchecked == SLOPPY_MODE ||
|
||||
language_unchecked == STRICT_MODE ||
|
||||
language_unchecked == EXTENDED_MODE);
|
||||
LanguageMode language_mode = static_cast<LanguageMode>(language_unchecked);
|
||||
@ -13787,7 +13787,7 @@ class StringSharedKey : public HashTableKey {
|
||||
SharedFunctionInfo* shared = SharedFunctionInfo::cast(other_array->get(0));
|
||||
String* source = String::cast(other_array->get(1));
|
||||
int language_unchecked = Smi::cast(other_array->get(2))->value();
|
||||
ASSERT(language_unchecked == CLASSIC_MODE ||
|
||||
ASSERT(language_unchecked == SLOPPY_MODE ||
|
||||
language_unchecked == STRICT_MODE ||
|
||||
language_unchecked == EXTENDED_MODE);
|
||||
LanguageMode language_mode = static_cast<LanguageMode>(language_unchecked);
|
||||
@ -15012,7 +15012,7 @@ MaybeObject* StringTable::LookupKey(HashTableKey* key, Object** s) {
|
||||
static LanguageMode CurrentGlobalLanguageMode() {
|
||||
return FLAG_use_strict
|
||||
? (FLAG_harmony_scoping ? EXTENDED_MODE : STRICT_MODE)
|
||||
: CLASSIC_MODE;
|
||||
: SLOPPY_MODE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -2155,14 +2155,14 @@ class JSObject: public JSReceiver {
|
||||
// In the fast mode elements is a FixedArray and so each element can
|
||||
// be quickly accessed. This fact is used in the generated code. The
|
||||
// elements array can have one of three maps in this mode:
|
||||
// fixed_array_map, non_strict_arguments_elements_map or
|
||||
// fixed_array_map, sloppy_arguments_elements_map or
|
||||
// fixed_cow_array_map (for copy-on-write arrays). In the latter case
|
||||
// the elements array may be shared by a few objects and so before
|
||||
// writing to any element the array must be copied. Use
|
||||
// EnsureWritableFastElements in this case.
|
||||
//
|
||||
// In the slow mode the elements is either a NumberDictionary, an
|
||||
// ExternalArray, or a FixedArray parameter map for a (non-strict)
|
||||
// ExternalArray, or a FixedArray parameter map for a (sloppy)
|
||||
// arguments object.
|
||||
DECL_ACCESSORS(elements, FixedArrayBase)
|
||||
inline void initialize_elements();
|
||||
@ -2184,7 +2184,7 @@ class JSObject: public JSReceiver {
|
||||
// Returns true if an object has elements of FAST_HOLEY_*_ELEMENTS
|
||||
// ElementsKind.
|
||||
inline bool HasFastHoleyElements();
|
||||
inline bool HasNonStrictArgumentsElements();
|
||||
inline bool HasSloppyArgumentsElements();
|
||||
inline bool HasDictionaryElements();
|
||||
|
||||
inline bool HasExternalUint8ClampedElements();
|
||||
@ -4342,9 +4342,9 @@ class ScopeInfo : public FixedArray {
|
||||
// Return the language mode of this scope.
|
||||
LanguageMode language_mode();
|
||||
|
||||
// Does this scope make a non-strict eval call?
|
||||
bool CallsNonStrictEval() {
|
||||
return CallsEval() && (language_mode() == CLASSIC_MODE);
|
||||
// Does this scope make a sloppy eval call?
|
||||
bool CallsSloppyEval() {
|
||||
return CallsEval() && (language_mode() == SLOPPY_MODE);
|
||||
}
|
||||
|
||||
// Return the total number of locals allocated on the stack and in the
|
||||
@ -5932,8 +5932,8 @@ class Map: public HeapObject {
|
||||
return IsFastElementsKind(elements_kind());
|
||||
}
|
||||
|
||||
inline bool has_non_strict_arguments_elements() {
|
||||
return elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS;
|
||||
inline bool has_sloppy_arguments_elements() {
|
||||
return elements_kind() == SLOPPY_ARGUMENTS_ELEMENTS;
|
||||
}
|
||||
|
||||
inline bool has_external_array_elements() {
|
||||
@ -5950,7 +5950,7 @@ class Map: public HeapObject {
|
||||
|
||||
inline bool has_slow_elements_kind() {
|
||||
return elements_kind() == DICTIONARY_ELEMENTS
|
||||
|| elements_kind() == NON_STRICT_ARGUMENTS_ELEMENTS;
|
||||
|| elements_kind() == SLOPPY_ARGUMENTS_ELEMENTS;
|
||||
}
|
||||
|
||||
static bool IsValidElementsTransition(ElementsKind from_kind,
|
||||
@ -6941,14 +6941,14 @@ class SharedFunctionInfo: public HeapObject {
|
||||
// Indicates the language mode of the function's code as defined by the
|
||||
// current harmony drafts for the next ES language standard. Possible
|
||||
// values are:
|
||||
// 1. CLASSIC_MODE - Unrestricted syntax and semantics, same as in ES5.
|
||||
// 1. SLOPPY_MODE - Unrestricted syntax and semantics, same as in ES5.
|
||||
// 2. STRICT_MODE - Restricted syntax and semantics, same as in ES5.
|
||||
// 3. EXTENDED_MODE - Only available under the harmony flag, not part of ES5.
|
||||
inline LanguageMode language_mode();
|
||||
inline void set_language_mode(LanguageMode language_mode);
|
||||
|
||||
// Indicates whether the language mode of this function is CLASSIC_MODE.
|
||||
inline bool is_classic_mode();
|
||||
// Indicates whether the language mode of this function is SLOPPY_MODE.
|
||||
inline bool is_sloppy_mode();
|
||||
|
||||
// Indicates whether the language mode of this function is EXTENDED_MODE.
|
||||
inline bool is_extended_mode();
|
||||
@ -8454,8 +8454,8 @@ class AllocationMemento: public Struct {
|
||||
};
|
||||
|
||||
|
||||
// Representation of a slow alias as part of a non-strict arguments objects.
|
||||
// For fast aliases (if HasNonStrictArgumentsElements()):
|
||||
// Representation of a slow alias as part of a sloppy arguments objects.
|
||||
// For fast aliases (if HasSloppyArgumentsElements()):
|
||||
// - the parameter map contains an index into the context
|
||||
// - all attributes of the element have default values
|
||||
// For slow aliases (if HasDictionaryArgumentsElements()):
|
||||
|
@ -682,7 +682,7 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
|
||||
}
|
||||
original_scope_ = scope;
|
||||
if (info->is_eval()) {
|
||||
if (!scope->is_global_scope() || info->language_mode() != CLASSIC_MODE) {
|
||||
if (!scope->is_global_scope() || info->language_mode() != SLOPPY_MODE) {
|
||||
scope = NewScope(scope, EVAL_SCOPE);
|
||||
}
|
||||
} else if (info->is_global()) {
|
||||
@ -708,7 +708,7 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
|
||||
bool ok = true;
|
||||
int beg_pos = scanner()->location().beg_pos;
|
||||
ParseSourceElements(body, Token::EOS, info->is_eval(), true, &ok);
|
||||
if (ok && !scope_->is_classic_mode()) {
|
||||
if (ok && !scope_->is_sloppy_mode()) {
|
||||
CheckOctalLiteral(beg_pos, scanner()->location().end_pos, &ok);
|
||||
}
|
||||
|
||||
@ -817,7 +817,7 @@ FunctionLiteral* Parser::ParseLazy(Utf16CharacterStream* source) {
|
||||
}
|
||||
original_scope_ = scope;
|
||||
FunctionState function_state(&function_state_, &scope_, scope, zone());
|
||||
ASSERT(scope->language_mode() != STRICT_MODE || !info()->is_classic_mode());
|
||||
ASSERT(scope->language_mode() != STRICT_MODE || !info()->is_sloppy_mode());
|
||||
ASSERT(scope->language_mode() != EXTENDED_MODE ||
|
||||
info()->is_extended_mode());
|
||||
ASSERT(info()->language_mode() == shared_info->language_mode());
|
||||
@ -897,7 +897,7 @@ void* Parser::ParseSourceElements(ZoneList<Statement*>* processor,
|
||||
Handle<String> directive = Handle<String>::cast(literal->value());
|
||||
|
||||
// Check "use strict" directive (ES5 14.1).
|
||||
if (scope_->is_classic_mode() &&
|
||||
if (scope_->is_sloppy_mode() &&
|
||||
directive->Equals(isolate()->heap()->use_strict_string()) &&
|
||||
token_loc.end_pos - token_loc.beg_pos ==
|
||||
isolate()->heap()->use_strict_string()->length() + 2) {
|
||||
@ -1443,7 +1443,7 @@ Statement* Parser::ParseStatement(ZoneStringList* labels, bool* ok) {
|
||||
// In Harmony mode, this case also handles the extension:
|
||||
// Statement:
|
||||
// GeneratorDeclaration
|
||||
if (!scope_->is_classic_mode()) {
|
||||
if (!scope_->is_sloppy_mode()) {
|
||||
ReportMessageAt(scanner()->peek_location(), "strict_function");
|
||||
*ok = false;
|
||||
return NULL;
|
||||
@ -1567,8 +1567,8 @@ void Parser::Declare(Declaration* declaration, bool resolve, bool* ok) {
|
||||
declaration_scope, name, mode, true, kind,
|
||||
kNeedsInitialization, proxy->interface());
|
||||
} else if (declaration_scope->is_eval_scope() &&
|
||||
declaration_scope->is_classic_mode()) {
|
||||
// For variable declarations in a non-strict eval scope the proxy is bound
|
||||
declaration_scope->is_sloppy_mode()) {
|
||||
// For variable declarations in a sloppy eval scope the proxy is bound
|
||||
// to a lookup variable to force a dynamic declaration using the
|
||||
// DeclareContextSlot runtime function.
|
||||
Variable::Kind kind = Variable::NORMAL;
|
||||
@ -1826,12 +1826,12 @@ Block* Parser::ParseVariableDeclarations(
|
||||
// * It is a Syntax Error if the code that matches this production is not
|
||||
// contained in extended code.
|
||||
//
|
||||
// However disallowing const in classic mode will break compatibility with
|
||||
// However disallowing const in sloppy mode will break compatibility with
|
||||
// existing pages. Therefore we keep allowing const with the old
|
||||
// non-harmony semantics in classic mode.
|
||||
// non-harmony semantics in sloppy mode.
|
||||
Consume(Token::CONST);
|
||||
switch (scope_->language_mode()) {
|
||||
case CLASSIC_MODE:
|
||||
case SLOPPY_MODE:
|
||||
mode = CONST;
|
||||
init_op = Token::INIT_CONST;
|
||||
break;
|
||||
@ -2333,7 +2333,7 @@ Statement* Parser::ParseWithStatement(ZoneStringList* labels, bool* ok) {
|
||||
Expect(Token::WITH, CHECK_OK);
|
||||
int pos = position();
|
||||
|
||||
if (!scope_->is_classic_mode()) {
|
||||
if (!scope_->is_sloppy_mode()) {
|
||||
ReportMessage("strict_mode_with", Vector<const char*>::empty());
|
||||
*ok = false;
|
||||
return NULL;
|
||||
@ -2907,7 +2907,7 @@ Expression* Parser::ParseAssignmentExpression(bool accept_IN, bool* ok) {
|
||||
expression = NewThrowReferenceError(message);
|
||||
}
|
||||
|
||||
if (!scope_->is_classic_mode()) {
|
||||
if (!scope_->is_sloppy_mode()) {
|
||||
// Assignment to eval or arguments is disallowed in strict mode.
|
||||
CheckStrictModeLValue(expression, CHECK_OK);
|
||||
}
|
||||
@ -3131,7 +3131,7 @@ Expression* Parser::ParseUnaryExpression(bool* ok) {
|
||||
}
|
||||
|
||||
// "delete identifier" is a syntax error in strict mode.
|
||||
if (op == Token::DELETE && !scope_->is_classic_mode()) {
|
||||
if (op == Token::DELETE && !scope_->is_sloppy_mode()) {
|
||||
VariableProxy* operand = expression->AsVariableProxy();
|
||||
if (operand != NULL && !operand->is_this()) {
|
||||
ReportMessage("strict_delete", Vector<const char*>::empty());
|
||||
@ -3179,7 +3179,7 @@ Expression* Parser::ParseUnaryExpression(bool* ok) {
|
||||
expression = NewThrowReferenceError(message);
|
||||
}
|
||||
|
||||
if (!scope_->is_classic_mode()) {
|
||||
if (!scope_->is_sloppy_mode()) {
|
||||
// Prefix expression operand in strict mode may not be eval or arguments.
|
||||
CheckStrictModeLValue(expression, CHECK_OK);
|
||||
}
|
||||
@ -3213,7 +3213,7 @@ Expression* Parser::ParsePostfixExpression(bool* ok) {
|
||||
expression = NewThrowReferenceError(message);
|
||||
}
|
||||
|
||||
if (!scope_->is_classic_mode()) {
|
||||
if (!scope_->is_sloppy_mode()) {
|
||||
// Postfix expression operand in strict mode may not be eval or arguments.
|
||||
CheckStrictModeLValue(expression, CHECK_OK);
|
||||
}
|
||||
@ -4098,7 +4098,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
|
||||
|
||||
// Validate strict mode. We can do this only after parsing the function,
|
||||
// since the function can declare itself strict.
|
||||
if (!scope_->is_classic_mode()) {
|
||||
if (!scope_->is_sloppy_mode()) {
|
||||
if (IsEvalOrArguments(function_name)) {
|
||||
ReportMessageAt(function_name_location, "strict_eval_arguments");
|
||||
*ok = false;
|
||||
@ -4261,7 +4261,7 @@ void Parser::MarkAsLValue(Expression* expression) {
|
||||
// in strict mode.
|
||||
void Parser::CheckStrictModeLValue(Expression* expression,
|
||||
bool* ok) {
|
||||
ASSERT(!scope_->is_classic_mode());
|
||||
ASSERT(!scope_->is_sloppy_mode());
|
||||
VariableProxy* lhs = expression != NULL
|
||||
? expression->AsVariableProxy()
|
||||
: NULL;
|
||||
|
@ -68,7 +68,7 @@ class FunctionEntry BASE_EMBEDDED {
|
||||
int literal_count() { return backing_[kLiteralCountIndex]; }
|
||||
int property_count() { return backing_[kPropertyCountIndex]; }
|
||||
LanguageMode language_mode() {
|
||||
ASSERT(backing_[kLanguageModeIndex] == CLASSIC_MODE ||
|
||||
ASSERT(backing_[kLanguageModeIndex] == SLOPPY_MODE ||
|
||||
backing_[kLanguageModeIndex] == STRICT_MODE ||
|
||||
backing_[kLanguageModeIndex] == EXTENDED_MODE);
|
||||
return static_cast<LanguageMode>(backing_[kLanguageModeIndex]);
|
||||
|
@ -157,7 +157,7 @@ PreParser::PreParseResult PreParser::PreParseLazyFunction(
|
||||
ReportUnexpectedToken(scanner()->current_token());
|
||||
} else {
|
||||
ASSERT_EQ(Token::RBRACE, scanner()->peek());
|
||||
if (!scope_->is_classic_mode()) {
|
||||
if (!scope_->is_sloppy_mode()) {
|
||||
int end_pos = scanner()->location().end_pos;
|
||||
CheckOctalLiteral(start_position, end_pos, &ok);
|
||||
}
|
||||
@ -319,7 +319,7 @@ PreParser::Statement PreParser::ParseStatement(bool* ok) {
|
||||
Scanner::Location start_location = scanner()->peek_location();
|
||||
Statement statement = ParseFunctionDeclaration(CHECK_OK);
|
||||
Scanner::Location end_location = scanner()->location();
|
||||
if (!scope_->is_classic_mode()) {
|
||||
if (!scope_->is_sloppy_mode()) {
|
||||
PreParserTraits::ReportMessageAt(start_location.beg_pos,
|
||||
end_location.end_pos,
|
||||
"strict_function",
|
||||
@ -432,12 +432,12 @@ PreParser::Statement PreParser::ParseVariableDeclarations(
|
||||
// * It is a Syntax Error if the code that matches this production is not
|
||||
// contained in extended code.
|
||||
//
|
||||
// However disallowing const in classic mode will break compatibility with
|
||||
// However disallowing const in sloppy mode will break compatibility with
|
||||
// existing pages. Therefore we keep allowing const with the old
|
||||
// non-harmony semantics in classic mode.
|
||||
// non-harmony semantics in sloppy mode.
|
||||
Consume(Token::CONST);
|
||||
switch (scope_->language_mode()) {
|
||||
case CLASSIC_MODE:
|
||||
case SLOPPY_MODE:
|
||||
break;
|
||||
case STRICT_MODE: {
|
||||
Scanner::Location location = scanner()->peek_location();
|
||||
@ -515,7 +515,7 @@ PreParser::Statement PreParser::ParseExpressionOrLabelledStatement(bool* ok) {
|
||||
// Expression is a single identifier, and not, e.g., a parenthesized
|
||||
// identifier.
|
||||
ASSERT(!expr.AsIdentifier().IsFutureReserved());
|
||||
ASSERT(scope_->is_classic_mode() ||
|
||||
ASSERT(scope_->is_sloppy_mode() ||
|
||||
(!expr.AsIdentifier().IsFutureStrictReserved() &&
|
||||
!expr.AsIdentifier().IsYield()));
|
||||
Consume(Token::COLON);
|
||||
@ -613,7 +613,7 @@ PreParser::Statement PreParser::ParseWithStatement(bool* ok) {
|
||||
// WithStatement ::
|
||||
// 'with' '(' Expression ')' Statement
|
||||
Expect(Token::WITH, CHECK_OK);
|
||||
if (!scope_->is_classic_mode()) {
|
||||
if (!scope_->is_sloppy_mode()) {
|
||||
ReportMessageAt(scanner()->location(), "strict_mode_with");
|
||||
*ok = false;
|
||||
return Statement::Default();
|
||||
@ -852,7 +852,7 @@ PreParser::Expression PreParser::ParseAssignmentExpression(bool accept_IN,
|
||||
return expression;
|
||||
}
|
||||
|
||||
if (!scope_->is_classic_mode() &&
|
||||
if (!scope_->is_sloppy_mode() &&
|
||||
expression.IsIdentifier() &&
|
||||
expression.AsIdentifier().IsEvalOrArguments()) {
|
||||
Scanner::Location after = scanner()->location();
|
||||
@ -946,7 +946,7 @@ PreParser::Expression PreParser::ParseUnaryExpression(bool* ok) {
|
||||
op = Next();
|
||||
Scanner::Location before = scanner()->peek_location();
|
||||
Expression expression = ParseUnaryExpression(CHECK_OK);
|
||||
if (!scope_->is_classic_mode() &&
|
||||
if (!scope_->is_sloppy_mode() &&
|
||||
expression.IsIdentifier() &&
|
||||
expression.AsIdentifier().IsEvalOrArguments()) {
|
||||
Scanner::Location after = scanner()->location();
|
||||
@ -969,7 +969,7 @@ PreParser::Expression PreParser::ParsePostfixExpression(bool* ok) {
|
||||
Expression expression = ParseLeftHandSideExpression(CHECK_OK);
|
||||
if (!scanner()->HasAnyLineTerminatorBeforeNext() &&
|
||||
Token::IsCountOp(peek())) {
|
||||
if (!scope_->is_classic_mode() &&
|
||||
if (!scope_->is_sloppy_mode() &&
|
||||
expression.IsIdentifier() &&
|
||||
expression.AsIdentifier().IsEvalOrArguments()) {
|
||||
Scanner::Location after = scanner()->location();
|
||||
@ -1313,7 +1313,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
|
||||
|
||||
// Validate strict mode. We can do this only after parsing the function,
|
||||
// since the function can declare itself strict.
|
||||
if (!scope_->is_classic_mode()) {
|
||||
if (!scope_->is_sloppy_mode()) {
|
||||
if (function_name.IsEvalOrArguments()) {
|
||||
ReportMessageAt(function_name_location, "strict_eval_arguments");
|
||||
*ok = false;
|
||||
|
@ -297,7 +297,7 @@ class ParserBase : public Traits {
|
||||
return function_state_->factory();
|
||||
}
|
||||
|
||||
bool is_classic_mode() const { return scope_->is_classic_mode(); }
|
||||
bool is_sloppy_mode() const { return scope_->is_sloppy_mode(); }
|
||||
|
||||
bool is_generator() const { return function_state_->is_generator(); }
|
||||
|
||||
@ -568,13 +568,13 @@ class PreParserScope {
|
||||
language_mode_ = outer_scope->language_mode();
|
||||
} else {
|
||||
scope_inside_with_ = is_with_scope();
|
||||
language_mode_ = CLASSIC_MODE;
|
||||
language_mode_ = SLOPPY_MODE;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_with_scope() const { return scope_type_ == WITH_SCOPE; }
|
||||
bool is_classic_mode() const {
|
||||
return language_mode() == CLASSIC_MODE;
|
||||
bool is_sloppy_mode() const {
|
||||
return language_mode() == SLOPPY_MODE;
|
||||
}
|
||||
bool is_extended_mode() {
|
||||
return language_mode() == EXTENDED_MODE;
|
||||
@ -763,7 +763,7 @@ class PreParser : public ParserBase<PreParserTraits> {
|
||||
if (stack_overflow()) return kPreParseStackOverflow;
|
||||
if (!ok) {
|
||||
ReportUnexpectedToken(scanner()->current_token());
|
||||
} else if (!scope_->is_classic_mode()) {
|
||||
} else if (!scope_->is_sloppy_mode()) {
|
||||
CheckOctalLiteral(start_position, scanner()->location().end_pos, &ok);
|
||||
}
|
||||
return kPreParseSuccess;
|
||||
@ -976,7 +976,7 @@ void ParserBase<Traits>::ReportUnexpectedToken(Token::Value token) {
|
||||
case Token::YIELD:
|
||||
case Token::FUTURE_STRICT_RESERVED_WORD:
|
||||
return ReportMessageAt(source_location,
|
||||
is_classic_mode() ? "unexpected_token_identifier"
|
||||
is_sloppy_mode() ? "unexpected_token_identifier"
|
||||
: "unexpected_strict_reserved");
|
||||
default:
|
||||
const char* name = Token::String(token);
|
||||
@ -995,12 +995,12 @@ typename Traits::Type::Identifier ParserBase<Traits>::ParseIdentifier(
|
||||
if (next == Token::IDENTIFIER) {
|
||||
typename Traits::Type::Identifier name = this->GetSymbol(scanner());
|
||||
if (allow_eval_or_arguments == kDontAllowEvalOrArguments &&
|
||||
!is_classic_mode() && this->IsEvalOrArguments(name)) {
|
||||
!is_sloppy_mode() && this->IsEvalOrArguments(name)) {
|
||||
ReportMessageAt(scanner()->location(), "strict_eval_arguments");
|
||||
*ok = false;
|
||||
}
|
||||
return name;
|
||||
} else if (is_classic_mode() && (next == Token::FUTURE_STRICT_RESERVED_WORD ||
|
||||
} else if (is_sloppy_mode() && (next == Token::FUTURE_STRICT_RESERVED_WORD ||
|
||||
(next == Token::YIELD && !is_generator()))) {
|
||||
return this->GetSymbol(scanner());
|
||||
} else {
|
||||
@ -1260,7 +1260,7 @@ void ParserBase<Traits>::ObjectLiteralChecker::CheckProperty(
|
||||
if (HasConflict(old_type, type)) {
|
||||
if (IsDataDataConflict(old_type, type)) {
|
||||
// Both are data properties.
|
||||
if (language_mode_ == CLASSIC_MODE) return;
|
||||
if (language_mode_ == SLOPPY_MODE) return;
|
||||
parser()->ReportMessageAt(scanner()->location(),
|
||||
"strict_duplicate_property");
|
||||
} else if (IsDataAccessorConflict(old_type, type)) {
|
||||
|
@ -158,7 +158,7 @@ namespace internal {
|
||||
#define CONVERT_STRICT_MODE_ARG_CHECKED(name, index) \
|
||||
RUNTIME_ASSERT(args[index]->IsSmi()); \
|
||||
RUNTIME_ASSERT(args.smi_at(index) == kStrictMode || \
|
||||
args.smi_at(index) == kNonStrictMode); \
|
||||
args.smi_at(index) == kSloppyMode); \
|
||||
StrictModeFlag name = \
|
||||
static_cast<StrictModeFlag>(args.smi_at(index));
|
||||
|
||||
@ -167,7 +167,7 @@ namespace internal {
|
||||
// and store it in a LanguageMode variable with the given name.
|
||||
#define CONVERT_LANGUAGE_MODE_ARG(name, index) \
|
||||
ASSERT(args[index]->IsSmi()); \
|
||||
ASSERT(args.smi_at(index) == CLASSIC_MODE || \
|
||||
ASSERT(args.smi_at(index) == SLOPPY_MODE || \
|
||||
args.smi_at(index) == STRICT_MODE || \
|
||||
args.smi_at(index) == EXTENDED_MODE); \
|
||||
LanguageMode name = \
|
||||
@ -298,7 +298,7 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
|
||||
if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) {
|
||||
// Array index as string (uint32).
|
||||
result = JSObject::SetOwnElement(
|
||||
boilerplate, element_index, value, kNonStrictMode);
|
||||
boilerplate, element_index, value, kSloppyMode);
|
||||
} else {
|
||||
Handle<String> name(String::cast(*key));
|
||||
ASSERT(!name->AsArrayIndex(&element_index));
|
||||
@ -309,7 +309,7 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
|
||||
} else if (key->ToArrayIndex(&element_index)) {
|
||||
// Array index (uint32).
|
||||
result = JSObject::SetOwnElement(
|
||||
boilerplate, element_index, value, kNonStrictMode);
|
||||
boilerplate, element_index, value, kSloppyMode);
|
||||
} else {
|
||||
// Non-uint32 number.
|
||||
ASSERT(key->IsNumber());
|
||||
@ -2121,7 +2121,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) {
|
||||
RETURN_IF_EMPTY_HANDLE(isolate,
|
||||
JSObject::SetProperty(
|
||||
global, name, value, static_cast<PropertyAttributes>(attr),
|
||||
language_mode == CLASSIC_MODE ? kNonStrictMode : kStrictMode));
|
||||
language_mode == SLOPPY_MODE ? kSloppyMode : kStrictMode));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2178,7 +2178,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareContextSlot) {
|
||||
RETURN_IF_EMPTY_HANDLE(
|
||||
isolate,
|
||||
JSReceiver::SetProperty(object, name, initial_value, mode,
|
||||
kNonStrictMode));
|
||||
kSloppyMode));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2224,7 +2224,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareContextSlot) {
|
||||
JSObject::SetLocalPropertyIgnoreAttributes(object, name, value, mode));
|
||||
} else {
|
||||
RETURN_IF_EMPTY_HANDLE(isolate,
|
||||
JSReceiver::SetProperty(object, name, value, mode, kNonStrictMode));
|
||||
JSReceiver::SetProperty(object, name, value, mode, kSloppyMode));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2246,8 +2246,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
|
||||
RUNTIME_ASSERT(args[1]->IsSmi());
|
||||
CONVERT_LANGUAGE_MODE_ARG(language_mode, 1);
|
||||
StrictModeFlag strict_mode_flag = (language_mode == CLASSIC_MODE)
|
||||
? kNonStrictMode : kStrictMode;
|
||||
StrictModeFlag strict_mode_flag = (language_mode == SLOPPY_MODE)
|
||||
? kSloppyMode : kStrictMode;
|
||||
|
||||
// According to ECMA-262, section 12.2, page 62, the property must
|
||||
// not be deletable.
|
||||
@ -2335,11 +2335,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
|
||||
// BUG 1213575: Handle the case where we have to set a read-only
|
||||
// property through an interceptor and only do it if it's
|
||||
// uninitialized, e.g. the hole. Nirk...
|
||||
// Passing non-strict mode because the property is writable.
|
||||
// Passing sloppy mode because the property is writable.
|
||||
RETURN_IF_EMPTY_HANDLE(
|
||||
isolate,
|
||||
JSReceiver::SetProperty(global, name, value, attributes,
|
||||
kNonStrictMode));
|
||||
JSReceiver::SetProperty(global, name, value, attributes, kSloppyMode));
|
||||
return *value;
|
||||
}
|
||||
|
||||
@ -2409,7 +2408,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstContextSlot) {
|
||||
// Strict mode not needed (const disallowed in strict mode).
|
||||
RETURN_IF_EMPTY_HANDLE(
|
||||
isolate,
|
||||
JSReceiver::SetProperty(global, name, value, NONE, kNonStrictMode));
|
||||
JSReceiver::SetProperty(global, name, value, NONE, kSloppyMode));
|
||||
return *value;
|
||||
}
|
||||
|
||||
@ -2461,7 +2460,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstContextSlot) {
|
||||
RETURN_IF_EMPTY_HANDLE(
|
||||
isolate,
|
||||
JSReceiver::SetProperty(object, name, value, attributes,
|
||||
kNonStrictMode));
|
||||
kSloppyMode));
|
||||
}
|
||||
}
|
||||
|
||||
@ -2643,7 +2642,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SpecialArrayFunctions) {
|
||||
}
|
||||
|
||||
|
||||
RUNTIME_FUNCTION(MaybeObject*, Runtime_IsClassicModeFunction) {
|
||||
RUNTIME_FUNCTION(MaybeObject*, Runtime_IsSloppyModeFunction) {
|
||||
SealHandleScope shs(isolate);
|
||||
ASSERT(args.length() == 1);
|
||||
CONVERT_ARG_CHECKED(JSReceiver, callable, 0);
|
||||
@ -2657,7 +2656,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsClassicModeFunction) {
|
||||
}
|
||||
JSFunction* function = JSFunction::cast(callable);
|
||||
SharedFunctionInfo* shared = function->shared();
|
||||
return isolate->heap()->ToBoolean(shared->is_classic_mode());
|
||||
return isolate->heap()->ToBoolean(shared->is_sloppy_mode());
|
||||
}
|
||||
|
||||
|
||||
@ -2677,7 +2676,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultReceiver) {
|
||||
JSFunction* function = JSFunction::cast(callable);
|
||||
|
||||
SharedFunctionInfo* shared = function->shared();
|
||||
if (shared->native() || !shared->is_classic_mode()) {
|
||||
if (shared->native() || !shared->is_sloppy_mode()) {
|
||||
return isolate->heap()->undefined_value();
|
||||
}
|
||||
// Returns undefined for strict or native functions, or
|
||||
@ -5273,7 +5272,7 @@ Handle<Object> Runtime::ForceSetObjectProperty(Isolate* isolate,
|
||||
return value;
|
||||
}
|
||||
|
||||
return JSObject::SetElement(js_object, index, value, attr, kNonStrictMode,
|
||||
return JSObject::SetElement(js_object, index, value, attr, kSloppyMode,
|
||||
false,
|
||||
DEFINE_PROPERTY);
|
||||
}
|
||||
@ -5281,7 +5280,7 @@ Handle<Object> Runtime::ForceSetObjectProperty(Isolate* isolate,
|
||||
if (key->IsName()) {
|
||||
Handle<Name> name = Handle<Name>::cast(key);
|
||||
if (name->AsArrayIndex(&index)) {
|
||||
return JSObject::SetElement(js_object, index, value, attr, kNonStrictMode,
|
||||
return JSObject::SetElement(js_object, index, value, attr, kSloppyMode,
|
||||
false,
|
||||
DEFINE_PROPERTY);
|
||||
} else {
|
||||
@ -5299,7 +5298,7 @@ Handle<Object> Runtime::ForceSetObjectProperty(Isolate* isolate,
|
||||
Handle<String> name = Handle<String>::cast(converted);
|
||||
|
||||
if (name->AsArrayIndex(&index)) {
|
||||
return JSObject::SetElement(js_object, index, value, attr, kNonStrictMode,
|
||||
return JSObject::SetElement(js_object, index, value, attr, kSloppyMode,
|
||||
false,
|
||||
DEFINE_PROPERTY);
|
||||
} else {
|
||||
@ -5377,7 +5376,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetProperty) {
|
||||
PropertyAttributes attributes =
|
||||
static_cast<PropertyAttributes>(unchecked_attributes);
|
||||
|
||||
StrictModeFlag strict_mode = kNonStrictMode;
|
||||
StrictModeFlag strict_mode = kSloppyMode;
|
||||
if (args.length() == 5) {
|
||||
CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode_flag, 4);
|
||||
strict_mode = strict_mode_flag;
|
||||
@ -6002,7 +6001,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetArgumentsProperty) {
|
||||
if (key->Equals(isolate->heap()->length_string())) return Smi::FromInt(n);
|
||||
if (key->Equals(isolate->heap()->callee_string())) {
|
||||
JSFunction* function = frame->function();
|
||||
if (!function->shared()->is_classic_mode()) {
|
||||
if (!function->shared()->is_sloppy_mode()) {
|
||||
return isolate->Throw(*isolate->factory()->NewTypeError(
|
||||
"strict_arguments_callee", HandleVector<Object>(NULL, 0)));
|
||||
}
|
||||
@ -7914,11 +7913,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewArgumentsFast) {
|
||||
Handle<FixedArray> parameter_map =
|
||||
isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED);
|
||||
parameter_map->set_map(
|
||||
isolate->heap()->non_strict_arguments_elements_map());
|
||||
isolate->heap()->sloppy_arguments_elements_map());
|
||||
|
||||
Handle<Map> old_map(result->map());
|
||||
Handle<Map> new_map = isolate->factory()->CopyMap(old_map);
|
||||
new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS);
|
||||
new_map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS);
|
||||
|
||||
result->set_map(*new_map);
|
||||
result->set_elements(*parameter_map);
|
||||
@ -9288,8 +9287,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreContextSlot) {
|
||||
CONVERT_ARG_HANDLE_CHECKED(Context, context, 1);
|
||||
CONVERT_ARG_HANDLE_CHECKED(String, name, 2);
|
||||
CONVERT_LANGUAGE_MODE_ARG(language_mode, 3);
|
||||
StrictModeFlag strict_mode = (language_mode == CLASSIC_MODE)
|
||||
? kNonStrictMode : kStrictMode;
|
||||
StrictModeFlag strict_mode = (language_mode == SLOPPY_MODE)
|
||||
? kSloppyMode : kStrictMode;
|
||||
|
||||
int index;
|
||||
PropertyAttributes attributes;
|
||||
@ -9345,7 +9344,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreContextSlot) {
|
||||
"not_defined", HandleVector(&name, 1));
|
||||
return isolate->Throw(*error);
|
||||
}
|
||||
// In non-strict mode, the property is added to the global object.
|
||||
// In sloppy mode, the property is added to the global object.
|
||||
attributes = NONE;
|
||||
object = Handle<JSReceiver>(isolate->context()->global_object());
|
||||
}
|
||||
@ -9717,7 +9716,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileString) {
|
||||
ParseRestriction restriction = function_literal_only
|
||||
? ONLY_SINGLE_FUNCTION_LITERAL : NO_PARSE_RESTRICTION;
|
||||
Handle<JSFunction> fun = Compiler::GetFunctionFromEval(
|
||||
source, context, CLASSIC_MODE, restriction, RelocInfo::kNoPosition);
|
||||
source, context, SLOPPY_MODE, restriction, RelocInfo::kNoPosition);
|
||||
RETURN_IF_EMPTY_HANDLE(isolate, fun);
|
||||
return *fun;
|
||||
}
|
||||
@ -9839,7 +9838,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) {
|
||||
// Strict not needed. Used for cycle detection in Array join implementation.
|
||||
RETURN_IF_EMPTY_HANDLE(isolate, JSObject::SetFastElement(array, length,
|
||||
element,
|
||||
kNonStrictMode,
|
||||
kSloppyMode,
|
||||
true));
|
||||
return isolate->heap()->true_value();
|
||||
}
|
||||
@ -10024,7 +10023,7 @@ static uint32_t EstimateElementCount(Handle<JSArray> array) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
|
||||
case EXTERNAL_##TYPE##_ELEMENTS: \
|
||||
case TYPE##_ELEMENTS: \
|
||||
@ -11311,7 +11310,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) {
|
||||
// THE FRAME ITERATOR TO WRAP THE RECEIVER.
|
||||
Handle<Object> receiver(it.frame()->receiver(), isolate);
|
||||
if (!receiver->IsJSObject() &&
|
||||
shared->is_classic_mode() &&
|
||||
shared->is_sloppy_mode() &&
|
||||
!function->IsBuiltin()) {
|
||||
// If the receiver is not a JSObject and the function is not a
|
||||
// builtin or strict-mode we have hit an optimization where a
|
||||
@ -11364,7 +11363,7 @@ static Handle<JSObject> MaterializeStackLocalsWithFrameInspector(
|
||||
RETURN_IF_EMPTY_HANDLE_VALUE(
|
||||
isolate,
|
||||
Runtime::SetObjectProperty(
|
||||
isolate, target, name, value, NONE, kNonStrictMode),
|
||||
isolate, target, name, value, NONE, kSloppyMode),
|
||||
Handle<JSObject>());
|
||||
}
|
||||
|
||||
@ -11377,7 +11376,7 @@ static Handle<JSObject> MaterializeStackLocalsWithFrameInspector(
|
||||
RETURN_IF_EMPTY_HANDLE_VALUE(
|
||||
isolate,
|
||||
Runtime::SetObjectProperty(
|
||||
isolate, target, name, value, NONE, kNonStrictMode),
|
||||
isolate, target, name, value, NONE, kSloppyMode),
|
||||
Handle<JSObject>());
|
||||
}
|
||||
|
||||
@ -11460,7 +11459,7 @@ static Handle<JSObject> MaterializeLocalContext(Isolate* isolate,
|
||||
key,
|
||||
GetProperty(isolate, ext, key),
|
||||
NONE,
|
||||
kNonStrictMode),
|
||||
kSloppyMode),
|
||||
Handle<JSObject>());
|
||||
}
|
||||
}
|
||||
@ -11562,7 +11561,7 @@ static bool SetLocalVariableValue(Isolate* isolate,
|
||||
// property value.
|
||||
Runtime::SetObjectProperty(isolate, ext, variable_name, new_value,
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -11611,7 +11610,7 @@ static Handle<JSObject> MaterializeClosure(Isolate* isolate,
|
||||
Runtime::SetObjectProperty(isolate, closure_scope, key,
|
||||
GetProperty(isolate, ext, key),
|
||||
NONE,
|
||||
kNonStrictMode),
|
||||
kSloppyMode),
|
||||
Handle<JSObject>());
|
||||
}
|
||||
}
|
||||
@ -11644,7 +11643,7 @@ static bool SetClosureVariableValue(Isolate* isolate,
|
||||
// We don't expect this to do anything except replacing property value.
|
||||
Runtime::SetObjectProperty(isolate, ext, variable_name, new_value,
|
||||
NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -11667,7 +11666,7 @@ static Handle<JSObject> MaterializeCatchScope(Isolate* isolate,
|
||||
isolate,
|
||||
Runtime::SetObjectProperty(isolate, catch_scope, name, thrown_object,
|
||||
NONE,
|
||||
kNonStrictMode),
|
||||
kSloppyMode),
|
||||
Handle<JSObject>());
|
||||
return catch_scope;
|
||||
}
|
||||
@ -12180,7 +12179,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetStepInPositions) {
|
||||
Smi* position_value = Smi::FromInt(break_location_iterator.position());
|
||||
JSObject::SetElement(array, len,
|
||||
Handle<Object>(position_value, isolate),
|
||||
NONE, kNonStrictMode);
|
||||
NONE, kSloppyMode);
|
||||
len++;
|
||||
}
|
||||
}
|
||||
@ -12735,7 +12734,7 @@ static Handle<JSObject> MaterializeArgumentsObject(
|
||||
isolate->factory()->arguments_string(),
|
||||
arguments,
|
||||
::NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
return target;
|
||||
}
|
||||
|
||||
@ -12755,7 +12754,7 @@ static MaybeObject* DebugEvaluate(Isolate* isolate,
|
||||
Handle<JSFunction> eval_fun =
|
||||
Compiler::GetFunctionFromEval(source,
|
||||
context,
|
||||
CLASSIC_MODE,
|
||||
SLOPPY_MODE,
|
||||
NO_PARSE_RESTRICTION,
|
||||
RelocInfo::kNoPosition);
|
||||
RETURN_IF_EMPTY_HANDLE(isolate, eval_fun);
|
||||
@ -14601,7 +14600,7 @@ ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiOrObjectElements)
|
||||
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastDoubleElements)
|
||||
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastHoleyElements)
|
||||
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(DictionaryElements)
|
||||
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(NonStrictArgumentsElements)
|
||||
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(SloppyArgumentsElements)
|
||||
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalArrayElements)
|
||||
// Properties test sitting with elements tests - not fooling anyone.
|
||||
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastProperties)
|
||||
|
@ -64,7 +64,7 @@ namespace internal {
|
||||
F(ToFastProperties, 1, 1) \
|
||||
F(FinishArrayPrototypeSetup, 1, 1) \
|
||||
F(SpecialArrayFunctions, 1, 1) \
|
||||
F(IsClassicModeFunction, 1, 1) \
|
||||
F(IsSloppyModeFunction, 1, 1) \
|
||||
F(GetDefaultReceiver, 1, 1) \
|
||||
\
|
||||
F(GetPrototype, 1, 1) \
|
||||
@ -456,7 +456,7 @@ namespace internal {
|
||||
F(HasFastDoubleElements, 1, 1) \
|
||||
F(HasFastHoleyElements, 1, 1) \
|
||||
F(HasDictionaryElements, 1, 1) \
|
||||
F(HasNonStrictArgumentsElements, 1, 1) \
|
||||
F(HasSloppyArgumentsElements, 1, 1) \
|
||||
F(HasExternalUint8ClampedElements, 1, 1) \
|
||||
F(HasExternalArrayElements, 1, 1) \
|
||||
F(HasExternalInt8Elements, 1, 1) \
|
||||
|
@ -165,7 +165,7 @@ bool ScopeInfo::CallsEval() {
|
||||
|
||||
|
||||
LanguageMode ScopeInfo::language_mode() {
|
||||
return length() > 0 ? LanguageModeField::decode(Flags()) : CLASSIC_MODE;
|
||||
return length() > 0 ? LanguageModeField::decode(Flags()) : SLOPPY_MODE;
|
||||
}
|
||||
|
||||
|
||||
@ -378,7 +378,7 @@ bool ScopeInfo::CopyContextLocalsToScopeObject(Handle<ScopeInfo> scope_info,
|
||||
Handle<String>(String::cast(scope_info->get(i))),
|
||||
Handle<Object>(context->get(context_index), isolate),
|
||||
::NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
RETURN_IF_EMPTY_HANDLE_VALUE(isolate, result, false);
|
||||
}
|
||||
return true;
|
||||
|
@ -191,8 +191,8 @@ void Scope::SetDefaults(ScopeType scope_type,
|
||||
scope_calls_eval_ = false;
|
||||
// Inherit the strict mode from the parent scope.
|
||||
language_mode_ = (outer_scope != NULL)
|
||||
? outer_scope->language_mode_ : CLASSIC_MODE;
|
||||
outer_scope_calls_non_strict_eval_ = false;
|
||||
? outer_scope->language_mode_ : SLOPPY_MODE;
|
||||
outer_scope_calls_sloppy_eval_ = false;
|
||||
inner_scope_calls_eval_ = false;
|
||||
force_eager_compilation_ = false;
|
||||
force_context_allocation_ = (outer_scope != NULL && !is_function_scope())
|
||||
@ -643,13 +643,13 @@ void Scope::CollectStackAndContextLocals(ZoneList<Variable*>* stack_locals,
|
||||
bool Scope::AllocateVariables(CompilationInfo* info,
|
||||
AstNodeFactory<AstNullVisitor>* factory) {
|
||||
// 1) Propagate scope information.
|
||||
bool outer_scope_calls_non_strict_eval = false;
|
||||
bool outer_scope_calls_sloppy_eval = false;
|
||||
if (outer_scope_ != NULL) {
|
||||
outer_scope_calls_non_strict_eval =
|
||||
outer_scope_->outer_scope_calls_non_strict_eval() |
|
||||
outer_scope_->calls_non_strict_eval();
|
||||
outer_scope_calls_sloppy_eval =
|
||||
outer_scope_->outer_scope_calls_sloppy_eval() |
|
||||
outer_scope_->calls_sloppy_eval();
|
||||
}
|
||||
PropagateScopeInfo(outer_scope_calls_non_strict_eval);
|
||||
PropagateScopeInfo(outer_scope_calls_sloppy_eval);
|
||||
|
||||
// 2) Allocate module instances.
|
||||
if (FLAG_harmony_modules && (is_global_scope() || is_module_scope())) {
|
||||
@ -882,7 +882,7 @@ void Scope::Print(int n) {
|
||||
Indent(n1, "// scope has trivial outer context\n");
|
||||
}
|
||||
switch (language_mode()) {
|
||||
case CLASSIC_MODE:
|
||||
case SLOPPY_MODE:
|
||||
break;
|
||||
case STRICT_MODE:
|
||||
Indent(n1, "// strict mode scope\n");
|
||||
@ -894,8 +894,8 @@ void Scope::Print(int n) {
|
||||
if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n");
|
||||
if (scope_contains_with_) Indent(n1, "// scope contains 'with'\n");
|
||||
if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n");
|
||||
if (outer_scope_calls_non_strict_eval_) {
|
||||
Indent(n1, "// outer scope calls 'eval' in non-strict context\n");
|
||||
if (outer_scope_calls_sloppy_eval_) {
|
||||
Indent(n1, "// outer scope calls 'eval' in sloppy context\n");
|
||||
}
|
||||
if (inner_scope_calls_eval_) Indent(n1, "// inner scope calls 'eval'\n");
|
||||
if (num_stack_slots_ > 0) { Indent(n1, "// ");
|
||||
@ -1017,9 +1017,9 @@ Variable* Scope::LookupRecursive(Handle<String> name,
|
||||
// object).
|
||||
*binding_kind = DYNAMIC_LOOKUP;
|
||||
return NULL;
|
||||
} else if (calls_non_strict_eval()) {
|
||||
} else if (calls_sloppy_eval()) {
|
||||
// A variable binding may have been found in an outer scope, but the current
|
||||
// scope makes a non-strict 'eval' call, so the found variable may not be
|
||||
// scope makes a sloppy 'eval' call, so the found variable may not be
|
||||
// the correct one (the 'eval' may introduce a binding with the same name).
|
||||
// In that case, change the lookup result to reflect this situation.
|
||||
if (*binding_kind == BOUND) {
|
||||
@ -1071,8 +1071,7 @@ bool Scope::ResolveVariable(CompilationInfo* info,
|
||||
break;
|
||||
|
||||
case UNBOUND_EVAL_SHADOWED:
|
||||
// No binding has been found. But some scope makes a
|
||||
// non-strict 'eval' call.
|
||||
// No binding has been found. But some scope makes a sloppy 'eval' call.
|
||||
var = NonLocal(proxy->name(), DYNAMIC_GLOBAL);
|
||||
break;
|
||||
|
||||
@ -1157,16 +1156,16 @@ bool Scope::ResolveVariablesRecursively(
|
||||
}
|
||||
|
||||
|
||||
bool Scope::PropagateScopeInfo(bool outer_scope_calls_non_strict_eval ) {
|
||||
if (outer_scope_calls_non_strict_eval) {
|
||||
outer_scope_calls_non_strict_eval_ = true;
|
||||
bool Scope::PropagateScopeInfo(bool outer_scope_calls_sloppy_eval ) {
|
||||
if (outer_scope_calls_sloppy_eval) {
|
||||
outer_scope_calls_sloppy_eval_ = true;
|
||||
}
|
||||
|
||||
bool calls_non_strict_eval =
|
||||
this->calls_non_strict_eval() || outer_scope_calls_non_strict_eval_;
|
||||
bool calls_sloppy_eval =
|
||||
this->calls_sloppy_eval() || outer_scope_calls_sloppy_eval_;
|
||||
for (int i = 0; i < inner_scopes_.length(); i++) {
|
||||
Scope* inner_scope = inner_scopes_[i];
|
||||
if (inner_scope->PropagateScopeInfo(calls_non_strict_eval)) {
|
||||
if (inner_scope->PropagateScopeInfo(calls_sloppy_eval)) {
|
||||
inner_scope_calls_eval_ = true;
|
||||
}
|
||||
if (inner_scope->force_eager_compilation_) {
|
||||
@ -1246,7 +1245,7 @@ void Scope::AllocateParameterLocals() {
|
||||
Variable* arguments = LocalLookup(isolate_->factory()->arguments_string());
|
||||
ASSERT(arguments != NULL); // functions have 'arguments' declared implicitly
|
||||
|
||||
bool uses_nonstrict_arguments = false;
|
||||
bool uses_sloppy_arguments = false;
|
||||
|
||||
if (MustAllocate(arguments) && !HasArgumentsParameter()) {
|
||||
// 'arguments' is used. Unless there is also a parameter called
|
||||
@ -1265,7 +1264,7 @@ void Scope::AllocateParameterLocals() {
|
||||
// In strict mode 'arguments' does not alias formal parameters.
|
||||
// Therefore in strict mode we allocate parameters as if 'arguments'
|
||||
// were not used.
|
||||
uses_nonstrict_arguments = is_classic_mode();
|
||||
uses_sloppy_arguments = is_sloppy_mode();
|
||||
}
|
||||
|
||||
// The same parameter may occur multiple times in the parameters_ list.
|
||||
@ -1275,7 +1274,7 @@ void Scope::AllocateParameterLocals() {
|
||||
for (int i = params_.length() - 1; i >= 0; --i) {
|
||||
Variable* var = params_[i];
|
||||
ASSERT(var->scope() == this);
|
||||
if (uses_nonstrict_arguments) {
|
||||
if (uses_sloppy_arguments) {
|
||||
// Force context allocation of the parameter.
|
||||
var->ForceContextAllocation();
|
||||
}
|
||||
|
26
src/scopes.h
26
src/scopes.h
@ -293,23 +293,21 @@ class Scope: public ZoneObject {
|
||||
return is_eval_scope() || is_function_scope() ||
|
||||
is_module_scope() || is_global_scope();
|
||||
}
|
||||
bool is_classic_mode() const {
|
||||
return language_mode() == CLASSIC_MODE;
|
||||
bool is_sloppy_mode() const {
|
||||
return language_mode() == SLOPPY_MODE;
|
||||
}
|
||||
bool is_extended_mode() const {
|
||||
return language_mode() == EXTENDED_MODE;
|
||||
}
|
||||
bool is_strict_or_extended_eval_scope() const {
|
||||
return is_eval_scope() && !is_classic_mode();
|
||||
return is_eval_scope() && !is_sloppy_mode();
|
||||
}
|
||||
|
||||
// Information about which scopes calls eval.
|
||||
bool calls_eval() const { return scope_calls_eval_; }
|
||||
bool calls_non_strict_eval() {
|
||||
return scope_calls_eval_ && is_classic_mode();
|
||||
}
|
||||
bool outer_scope_calls_non_strict_eval() const {
|
||||
return outer_scope_calls_non_strict_eval_;
|
||||
bool calls_sloppy_eval() { return scope_calls_eval_ && is_sloppy_mode(); }
|
||||
bool outer_scope_calls_sloppy_eval() const {
|
||||
return outer_scope_calls_sloppy_eval_;
|
||||
}
|
||||
|
||||
// Is this scope inside a with statement.
|
||||
@ -500,7 +498,7 @@ class Scope: public ZoneObject {
|
||||
int end_position_;
|
||||
|
||||
// Computed via PropagateScopeInfo.
|
||||
bool outer_scope_calls_non_strict_eval_;
|
||||
bool outer_scope_calls_sloppy_eval_;
|
||||
bool inner_scope_calls_eval_;
|
||||
bool force_eager_compilation_;
|
||||
bool force_context_allocation_;
|
||||
@ -538,13 +536,13 @@ class Scope: public ZoneObject {
|
||||
// The variable reference could be statically resolved to a variable binding
|
||||
// which is returned. There is no 'with' statement between the reference and
|
||||
// the binding and no scope between the reference scope (inclusive) and
|
||||
// binding scope (exclusive) makes a non-strict 'eval' call.
|
||||
// binding scope (exclusive) makes a sloppy 'eval' call.
|
||||
BOUND,
|
||||
|
||||
// The variable reference could be statically resolved to a variable binding
|
||||
// which is returned. There is no 'with' statement between the reference and
|
||||
// the binding, but some scope between the reference scope (inclusive) and
|
||||
// binding scope (exclusive) makes a non-strict 'eval' call, that might
|
||||
// binding scope (exclusive) makes a sloppy 'eval' call, that might
|
||||
// possibly introduce variable bindings shadowing the found one. Thus the
|
||||
// found variable binding is just a guess.
|
||||
BOUND_EVAL_SHADOWED,
|
||||
@ -553,13 +551,13 @@ class Scope: public ZoneObject {
|
||||
// and thus should be considered referencing a global variable. NULL is
|
||||
// returned. The variable reference is not inside any 'with' statement and
|
||||
// no scope between the reference scope (inclusive) and global scope
|
||||
// (exclusive) makes a non-strict 'eval' call.
|
||||
// (exclusive) makes a sloppy 'eval' call.
|
||||
UNBOUND,
|
||||
|
||||
// The variable reference could not be statically resolved to any binding
|
||||
// NULL is returned. The variable reference is not inside any 'with'
|
||||
// statement, but some scope between the reference scope (inclusive) and
|
||||
// global scope (exclusive) makes a non-strict 'eval' call, that might
|
||||
// global scope (exclusive) makes a sloppy 'eval' call, that might
|
||||
// possibly introduce a variable binding. Thus the reference should be
|
||||
// considered referencing a global variable unless it is shadowed by an
|
||||
// 'eval' introduced binding.
|
||||
@ -591,7 +589,7 @@ class Scope: public ZoneObject {
|
||||
AstNodeFactory<AstNullVisitor>* factory);
|
||||
|
||||
// Scope analysis.
|
||||
bool PropagateScopeInfo(bool outer_scope_calls_non_strict_eval);
|
||||
bool PropagateScopeInfo(bool outer_scope_calls_sloppy_eval);
|
||||
bool HasTrivialContext() const;
|
||||
|
||||
// Predicates.
|
||||
|
@ -1282,7 +1282,7 @@ function ObjectFreeze(obj) {
|
||||
throw MakeTypeError("called_on_non_object", ["Object.freeze"]);
|
||||
}
|
||||
var isProxy = %IsJSProxy(obj);
|
||||
if (isProxy || %HasNonStrictArgumentsElements(obj) || %IsObserved(obj)) {
|
||||
if (isProxy || %HasSloppyArgumentsElements(obj) || %IsObserved(obj)) {
|
||||
if (isProxy) {
|
||||
ProxyFix(obj);
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ class Variable: public ZoneObject {
|
||||
|
||||
// If this field is set, this variable references the stored locally bound
|
||||
// variable, but it might be shadowed by variable bindings introduced by
|
||||
// non-strict 'eval' calls between the reference scope (inclusive) and the
|
||||
// sloppy 'eval' calls between the reference scope (inclusive) and the
|
||||
// binding scope (exclusive).
|
||||
Variable* local_if_not_shadowed_;
|
||||
|
||||
|
@ -799,7 +799,7 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
|
||||
Immediate(1 << SharedFunctionInfo::kNativeBitWithinByte));
|
||||
__ j(not_zero, &shift_arguments);
|
||||
|
||||
// Compute the receiver in non-strict mode.
|
||||
// Compute the receiver in sloppy mode.
|
||||
__ movp(rbx, args.GetArgumentOperand(1));
|
||||
__ JumpIfSmi(rbx, &convert_to_object, Label::kNear);
|
||||
|
||||
@ -990,7 +990,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
|
||||
Immediate(1 << SharedFunctionInfo::kNativeBitWithinByte));
|
||||
__ j(not_equal, &push_receiver);
|
||||
|
||||
// Compute the receiver in non-strict mode.
|
||||
// Compute the receiver in sloppy mode.
|
||||
__ JumpIfSmi(rbx, &call_to_object, Label::kNear);
|
||||
__ CompareRoot(rbx, Heap::kNullValueRootIndex);
|
||||
__ j(equal, &use_global_receiver);
|
||||
|
@ -1062,7 +1062,7 @@ void ArgumentsAccessStub::GenerateReadElement(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
|
||||
void ArgumentsAccessStub::GenerateNewSloppyFast(MacroAssembler* masm) {
|
||||
// Stack layout:
|
||||
// rsp[0] : return address
|
||||
// rsp[8] : number of parameters (tagged)
|
||||
@ -1187,7 +1187,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
|
||||
__ testq(rbx, rbx);
|
||||
__ j(zero, &skip_parameter_map);
|
||||
|
||||
__ LoadRoot(kScratchRegister, Heap::kNonStrictArgumentsElementsMapRootIndex);
|
||||
__ LoadRoot(kScratchRegister, Heap::kSloppyArgumentsElementsMapRootIndex);
|
||||
// rbx contains the untagged argument count. Add 2 and tag to write.
|
||||
__ movp(FieldOperand(rdi, FixedArray::kMapOffset), kScratchRegister);
|
||||
__ Integer64PlusConstantToSmi(r9, rbx, 2);
|
||||
@ -1280,7 +1280,7 @@ void ArgumentsAccessStub::GenerateNewNonStrictFast(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void ArgumentsAccessStub::GenerateNewNonStrictSlow(MacroAssembler* masm) {
|
||||
void ArgumentsAccessStub::GenerateNewSloppySlow(MacroAssembler* masm) {
|
||||
// rsp[0] : return address
|
||||
// rsp[8] : number of parameters
|
||||
// rsp[16] : receiver displacement
|
||||
|
@ -133,10 +133,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;
|
||||
// +1 for return address.
|
||||
StackArgumentsAccessor args(rsp, info->scope()->num_parameters());
|
||||
@ -242,12 +242,12 @@ void FullCodeGenerator::Generate() {
|
||||
// The stub will rewrite receiver 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);
|
||||
@ -1315,7 +1315,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.
|
||||
__ cmpq(ContextOperand(context, Context::EXTENSION_INDEX),
|
||||
Immediate(0));
|
||||
@ -1329,7 +1329,7 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(Variable* var,
|
||||
// If no outer scope calls eval, we do not need to check more
|
||||
// context extensions. If we have reached an eval scope, we check
|
||||
// all extensions from this point.
|
||||
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();
|
||||
}
|
||||
|
||||
@ -1374,7 +1374,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.
|
||||
__ cmpq(ContextOperand(context, Context::EXTENSION_INDEX),
|
||||
Immediate(0));
|
||||
@ -2381,7 +2381,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
||||
__ movp(rcx, rax);
|
||||
__ pop(rdx);
|
||||
__ pop(rax); // Restore value.
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
Handle<Code> ic = is_sloppy_mode()
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
CallIC(ic);
|
||||
@ -2502,7 +2502,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
||||
__ pop(rdx);
|
||||
// Record source code position before IC call.
|
||||
SetSourcePosition(expr->position());
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
Handle<Code> ic = is_sloppy_mode()
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
CallIC(ic, expr->AssignmentFeedbackId());
|
||||
@ -2552,7 +2552,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 {
|
||||
@ -4166,8 +4166,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;
|
||||
__ Push(Smi::FromInt(strict_mode_flag));
|
||||
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
|
||||
context()->Plug(rax);
|
||||
@ -4175,11 +4175,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()) {
|
||||
__ push(GlobalObjectOperand());
|
||||
__ Push(var->name());
|
||||
__ Push(Smi::FromInt(kNonStrictMode));
|
||||
__ Push(Smi::FromInt(kSloppyMode));
|
||||
__ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
|
||||
context()->Plug(rax);
|
||||
} else if (var->IsStackAllocated() || var->IsContextSlot()) {
|
||||
@ -4441,7 +4441,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
||||
case KEYED_PROPERTY: {
|
||||
__ pop(rcx);
|
||||
__ pop(rdx);
|
||||
Handle<Code> ic = is_classic_mode()
|
||||
Handle<Code> ic = is_sloppy_mode()
|
||||
? isolate()->builtins()->KeyedStoreIC_Initialize()
|
||||
: isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
||||
CallIC(ic, expr->CountStoreFeedbackId());
|
||||
|
@ -852,7 +852,7 @@ static Operand GenerateMappedArgumentsLookup(MacroAssembler* masm,
|
||||
|
||||
// Load the elements into scratch1 and check its map. If not, jump
|
||||
// to the unmapped lookup with the parameter map in scratch1.
|
||||
Handle<Map> arguments_map(heap->non_strict_arguments_elements_map());
|
||||
Handle<Map> arguments_map(heap->sloppy_arguments_elements_map());
|
||||
__ movp(scratch1, FieldOperand(object, JSObject::kElementsOffset));
|
||||
__ CheckMap(scratch1, arguments_map, slow_case, DONT_DO_SMI_CHECK);
|
||||
|
||||
@ -909,7 +909,7 @@ static Operand GenerateUnmappedArgumentsLookup(MacroAssembler* masm,
|
||||
}
|
||||
|
||||
|
||||
void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
|
||||
void KeyedLoadIC::GenerateSloppyArguments(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- rax : key
|
||||
// -- rdx : receiver
|
||||
@ -934,7 +934,7 @@ void KeyedLoadIC::GenerateNonStrictArguments(MacroAssembler* masm) {
|
||||
}
|
||||
|
||||
|
||||
void KeyedStoreIC::GenerateNonStrictArguments(MacroAssembler* masm) {
|
||||
void KeyedStoreIC::GenerateSloppyArguments(MacroAssembler* masm) {
|
||||
// ----------- S t a t e -------------
|
||||
// -- rax : value
|
||||
// -- rcx : key
|
||||
|
@ -154,10 +154,10 @@ bool LCodeGen::GeneratePrologue() {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Classic mode functions need to replace the receiver with the global proxy
|
||||
// Sloppy mode functions need to replace the receiver with the global proxy
|
||||
// when called as functions (without an explicit receiver object).
|
||||
if (info_->this_has_uses() &&
|
||||
info_->is_classic_mode() &&
|
||||
info_->is_sloppy_mode() &&
|
||||
!info_->is_native()) {
|
||||
Label ok;
|
||||
StackArgumentsAccessor args(rsp, scope()->num_parameters());
|
||||
@ -2988,7 +2988,7 @@ void LCodeGen::DoLoadKeyedExternalArray(LLoadKeyed* instr) {
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
@ -4185,7 +4185,7 @@ void LCodeGen::DoStoreKeyedExternalArray(LStoreKeyed* instr) {
|
||||
case FAST_HOLEY_SMI_ELEMENTS:
|
||||
case FAST_HOLEY_DOUBLE_ELEMENTS:
|
||||
case DICTIONARY_ELEMENTS:
|
||||
case NON_STRICT_ARGUMENTS_ELEMENTS:
|
||||
case SLOPPY_ARGUMENTS_ELEMENTS:
|
||||
UNREACHABLE();
|
||||
break;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ class LCodeGen: public LCodeGenBase {
|
||||
|
||||
private:
|
||||
StrictModeFlag strict_mode_flag() const {
|
||||
return info()->is_classic_mode() ? kNonStrictMode : kStrictMode;
|
||||
return info()->is_sloppy_mode() ? kSloppyMode : kStrictMode;
|
||||
}
|
||||
|
||||
LPlatformChunk* chunk() const { return chunk_; }
|
||||
|
@ -5940,7 +5940,7 @@ THREADED_TEST(IndexedInterceptorUnboxedDoubleWithIndexedAccessor) {
|
||||
}
|
||||
|
||||
|
||||
void NonStrictArgsIndexedPropertyEnumerator(
|
||||
void SloppyArgsIndexedPropertyEnumerator(
|
||||
const v8::PropertyCallbackInfo<v8::Array>& info) {
|
||||
// Force the list of returned keys to be stored in a Arguments object.
|
||||
Local<Script> indexed_property_names_script = v8_compile(
|
||||
@ -5959,7 +5959,7 @@ void NonStrictArgsIndexedPropertyEnumerator(
|
||||
}
|
||||
|
||||
|
||||
static void NonStrictIndexedPropertyGetter(
|
||||
static void SloppyIndexedPropertyGetter(
|
||||
uint32_t index,
|
||||
const v8::PropertyCallbackInfo<v8::Value>& info) {
|
||||
ApiTestFuzzer::Fuzz();
|
||||
@ -5971,15 +5971,15 @@ static void NonStrictIndexedPropertyGetter(
|
||||
|
||||
// Make sure that the the interceptor code in the runtime properly handles
|
||||
// merging property name lists for non-string arguments arrays.
|
||||
THREADED_TEST(IndexedInterceptorNonStrictArgsWithIndexedAccessor) {
|
||||
THREADED_TEST(IndexedInterceptorSloppyArgsWithIndexedAccessor) {
|
||||
v8::Isolate* isolate = CcTest::isolate();
|
||||
v8::HandleScope scope(isolate);
|
||||
Local<ObjectTemplate> templ = ObjectTemplate::New(isolate);
|
||||
templ->SetIndexedPropertyHandler(NonStrictIndexedPropertyGetter,
|
||||
templ->SetIndexedPropertyHandler(SloppyIndexedPropertyGetter,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
NonStrictArgsIndexedPropertyEnumerator);
|
||||
SloppyArgsIndexedPropertyEnumerator);
|
||||
LocalContext context;
|
||||
context->Global()->Set(v8_str("obj"), templ->NewInstance());
|
||||
Local<Script> create_args_script = v8_compile(
|
||||
@ -15654,19 +15654,19 @@ THREADED_TEST(PixelArray) {
|
||||
reinterpret_cast<i::Isolate*>(context->GetIsolate()));
|
||||
i::Handle<i::Object> no_failure;
|
||||
no_failure =
|
||||
i::JSObject::SetElement(jsobj, 1, value, NONE, i::kNonStrictMode);
|
||||
i::JSObject::SetElement(jsobj, 1, value, NONE, i::kSloppyMode);
|
||||
ASSERT(!no_failure.is_null());
|
||||
i::USE(no_failure);
|
||||
CheckElementValue(isolate, 2, jsobj, 1);
|
||||
*value.location() = i::Smi::FromInt(256);
|
||||
no_failure =
|
||||
i::JSObject::SetElement(jsobj, 1, value, NONE, i::kNonStrictMode);
|
||||
i::JSObject::SetElement(jsobj, 1, value, NONE, i::kSloppyMode);
|
||||
ASSERT(!no_failure.is_null());
|
||||
i::USE(no_failure);
|
||||
CheckElementValue(isolate, 255, jsobj, 1);
|
||||
*value.location() = i::Smi::FromInt(-1);
|
||||
no_failure =
|
||||
i::JSObject::SetElement(jsobj, 1, value, NONE, i::kNonStrictMode);
|
||||
i::JSObject::SetElement(jsobj, 1, value, NONE, i::kSloppyMode);
|
||||
ASSERT(!no_failure.is_null());
|
||||
i::USE(no_failure);
|
||||
CheckElementValue(isolate, 0, jsobj, 1);
|
||||
|
@ -51,7 +51,7 @@ static void SetGlobalProperty(const char* name, Object* value) {
|
||||
isolate->factory()->InternalizeUtf8String(name);
|
||||
Handle<JSObject> global(isolate->context()->global_object());
|
||||
Runtime::SetObjectProperty(isolate, global, internalized_name, object, NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,7 +114,7 @@ class DebugLocalContext {
|
||||
v8::internal::Runtime::SetObjectProperty(isolate, global, debug_string,
|
||||
Handle<Object>(debug->debug_context()->global_proxy(), isolate),
|
||||
DONT_ENUM,
|
||||
::v8::internal::kNonStrictMode);
|
||||
::v8::internal::kSloppyMode);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -275,11 +275,11 @@ TEST(GarbageCollection) {
|
||||
Handle<Map> initial_map =
|
||||
factory->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
|
||||
function->set_initial_map(*initial_map);
|
||||
JSReceiver::SetProperty(global, name, function, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(global, name, function, NONE, kSloppyMode);
|
||||
// Allocate an object. Unrooted after leaving the scope.
|
||||
Handle<JSObject> obj = factory->NewJSObject(function);
|
||||
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, prop_namex, twenty_four, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kSloppyMode);
|
||||
JSReceiver::SetProperty(obj, prop_namex, twenty_four, NONE, kSloppyMode);
|
||||
|
||||
CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
|
||||
CHECK_EQ(Smi::FromInt(24), obj->GetProperty(*prop_namex));
|
||||
@ -299,8 +299,8 @@ TEST(GarbageCollection) {
|
||||
HandleScope inner_scope(isolate);
|
||||
// Allocate another object, make it reachable from global.
|
||||
Handle<JSObject> obj = factory->NewJSObject(function);
|
||||
JSReceiver::SetProperty(global, obj_name, obj, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(global, obj_name, obj, NONE, kSloppyMode);
|
||||
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kSloppyMode);
|
||||
}
|
||||
|
||||
// After gc, it should survive.
|
||||
@ -635,11 +635,11 @@ TEST(FunctionAllocation) {
|
||||
|
||||
Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
|
||||
Handle<JSObject> obj = factory->NewJSObject(function);
|
||||
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kSloppyMode);
|
||||
CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
|
||||
// Check that we can add properties to function objects.
|
||||
JSReceiver::SetProperty(function, prop_name, twenty_four, NONE,
|
||||
kNonStrictMode);
|
||||
kSloppyMode);
|
||||
CHECK_EQ(Smi::FromInt(24), function->GetProperty(*prop_name));
|
||||
}
|
||||
|
||||
@ -666,7 +666,7 @@ TEST(ObjectProperties) {
|
||||
CHECK(!JSReceiver::HasLocalProperty(obj, first));
|
||||
|
||||
// add first
|
||||
JSReceiver::SetProperty(obj, first, one, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, first, one, NONE, kSloppyMode);
|
||||
CHECK(JSReceiver::HasLocalProperty(obj, first));
|
||||
|
||||
// delete first
|
||||
@ -674,8 +674,8 @@ TEST(ObjectProperties) {
|
||||
CHECK(!JSReceiver::HasLocalProperty(obj, first));
|
||||
|
||||
// add first and then second
|
||||
JSReceiver::SetProperty(obj, first, one, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, second, two, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, first, one, NONE, kSloppyMode);
|
||||
JSReceiver::SetProperty(obj, second, two, NONE, kSloppyMode);
|
||||
CHECK(JSReceiver::HasLocalProperty(obj, first));
|
||||
CHECK(JSReceiver::HasLocalProperty(obj, second));
|
||||
|
||||
@ -687,8 +687,8 @@ TEST(ObjectProperties) {
|
||||
CHECK(!JSReceiver::HasLocalProperty(obj, second));
|
||||
|
||||
// add first and then second
|
||||
JSReceiver::SetProperty(obj, first, one, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, second, two, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, first, one, NONE, kSloppyMode);
|
||||
JSReceiver::SetProperty(obj, second, two, NONE, kSloppyMode);
|
||||
CHECK(JSReceiver::HasLocalProperty(obj, first));
|
||||
CHECK(JSReceiver::HasLocalProperty(obj, second));
|
||||
|
||||
@ -702,14 +702,14 @@ TEST(ObjectProperties) {
|
||||
// check string and internalized string match
|
||||
const char* string1 = "fisk";
|
||||
Handle<String> s1 = factory->NewStringFromAscii(CStrVector(string1));
|
||||
JSReceiver::SetProperty(obj, s1, one, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, s1, one, NONE, kSloppyMode);
|
||||
Handle<String> s1_string = factory->InternalizeUtf8String(string1);
|
||||
CHECK(JSReceiver::HasLocalProperty(obj, s1_string));
|
||||
|
||||
// check internalized string and string match
|
||||
const char* string2 = "fugl";
|
||||
Handle<String> s2_string = factory->InternalizeUtf8String(string2);
|
||||
JSReceiver::SetProperty(obj, s2_string, one, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, s2_string, one, NONE, kSloppyMode);
|
||||
Handle<String> s2 = factory->NewStringFromAscii(CStrVector(string2));
|
||||
CHECK(JSReceiver::HasLocalProperty(obj, s2));
|
||||
}
|
||||
@ -733,7 +733,7 @@ TEST(JSObjectMaps) {
|
||||
|
||||
// Set a propery
|
||||
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
|
||||
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, prop_name, twenty_three, NONE, kSloppyMode);
|
||||
CHECK_EQ(Smi::FromInt(23), obj->GetProperty(*prop_name));
|
||||
|
||||
// Check the map has changed
|
||||
@ -766,7 +766,7 @@ TEST(JSArray) {
|
||||
CHECK(array->HasFastSmiOrObjectElements());
|
||||
|
||||
// array[length] = name.
|
||||
JSReceiver::SetElement(array, 0, name, NONE, kNonStrictMode);
|
||||
JSReceiver::SetElement(array, 0, name, NONE, kSloppyMode);
|
||||
CHECK_EQ(Smi::FromInt(1), array->length());
|
||||
CHECK_EQ(array->GetElement(isolate, 0), *name);
|
||||
|
||||
@ -781,7 +781,7 @@ TEST(JSArray) {
|
||||
CHECK(array->HasDictionaryElements()); // Must be in slow mode.
|
||||
|
||||
// array[length] = name.
|
||||
JSReceiver::SetElement(array, int_length, name, NONE, kNonStrictMode);
|
||||
JSReceiver::SetElement(array, int_length, name, NONE, kSloppyMode);
|
||||
uint32_t new_int_length = 0;
|
||||
CHECK(array->length()->ToArrayIndex(&new_int_length));
|
||||
CHECK_EQ(static_cast<double>(int_length), new_int_length - 1);
|
||||
@ -808,11 +808,11 @@ TEST(JSObjectCopy) {
|
||||
Handle<Smi> one(Smi::FromInt(1), isolate);
|
||||
Handle<Smi> two(Smi::FromInt(2), isolate);
|
||||
|
||||
JSReceiver::SetProperty(obj, first, one, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, second, two, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(obj, first, one, NONE, kSloppyMode);
|
||||
JSReceiver::SetProperty(obj, second, two, NONE, kSloppyMode);
|
||||
|
||||
JSReceiver::SetElement(obj, 0, first, NONE, kNonStrictMode);
|
||||
JSReceiver::SetElement(obj, 1, second, NONE, kNonStrictMode);
|
||||
JSReceiver::SetElement(obj, 0, first, NONE, kSloppyMode);
|
||||
JSReceiver::SetElement(obj, 1, second, NONE, kSloppyMode);
|
||||
|
||||
// Make the clone.
|
||||
Handle<JSObject> clone = JSObject::Copy(obj);
|
||||
@ -825,11 +825,11 @@ TEST(JSObjectCopy) {
|
||||
CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*second));
|
||||
|
||||
// Flip the values.
|
||||
JSReceiver::SetProperty(clone, first, two, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(clone, second, one, NONE, kNonStrictMode);
|
||||
JSReceiver::SetProperty(clone, first, two, NONE, kSloppyMode);
|
||||
JSReceiver::SetProperty(clone, second, one, NONE, kSloppyMode);
|
||||
|
||||
JSReceiver::SetElement(clone, 0, second, NONE, kNonStrictMode);
|
||||
JSReceiver::SetElement(clone, 1, first, NONE, kNonStrictMode);
|
||||
JSReceiver::SetElement(clone, 0, second, NONE, kSloppyMode);
|
||||
JSReceiver::SetElement(clone, 1, first, NONE, kSloppyMode);
|
||||
|
||||
CHECK_EQ(obj->GetElement(isolate, 1), clone->GetElement(isolate, 0));
|
||||
CHECK_EQ(obj->GetElement(isolate, 0), clone->GetElement(isolate, 1));
|
||||
|
@ -170,7 +170,7 @@ TEST(MarkCompactCollector) {
|
||||
JSObject::kHeaderSize)->ToObjectChecked());
|
||||
function->set_initial_map(initial_map);
|
||||
JSReceiver::SetProperty(
|
||||
global, handle(func_name), handle(function), NONE, kNonStrictMode);
|
||||
global, handle(func_name), handle(function), NONE, kSloppyMode);
|
||||
|
||||
JSObject* obj = JSObject::cast(
|
||||
heap->AllocateJSObject(function)->ToObjectChecked());
|
||||
@ -188,12 +188,12 @@ TEST(MarkCompactCollector) {
|
||||
String* obj_name =
|
||||
String::cast(heap->InternalizeUtf8String("theObject")->ToObjectChecked());
|
||||
JSReceiver::SetProperty(
|
||||
global, handle(obj_name), handle(obj), NONE, kNonStrictMode);
|
||||
global, handle(obj_name), handle(obj), NONE, kSloppyMode);
|
||||
String* prop_name =
|
||||
String::cast(heap->InternalizeUtf8String("theSlot")->ToObjectChecked());
|
||||
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
|
||||
JSReceiver::SetProperty(
|
||||
handle(obj), handle(prop_name), twenty_three, NONE, kNonStrictMode);
|
||||
handle(obj), handle(prop_name), twenty_three, NONE, kSloppyMode);
|
||||
|
||||
heap->CollectGarbage(OLD_POINTER_SPACE, "trigger 5");
|
||||
|
||||
|
@ -924,28 +924,28 @@ TEST(ScopePositions) {
|
||||
};
|
||||
|
||||
const SourceData source_data[] = {
|
||||
{ " with ({}) ", "{ block; }", " more;", i::WITH_SCOPE, i::CLASSIC_MODE },
|
||||
{ " with ({}) ", "{ block; }", "; more;", i::WITH_SCOPE, i::CLASSIC_MODE },
|
||||
{ " with ({}) ", "{ block; }", " more;", i::WITH_SCOPE, i::SLOPPY_MODE },
|
||||
{ " with ({}) ", "{ block; }", "; more;", i::WITH_SCOPE, i::SLOPPY_MODE },
|
||||
{ " with ({}) ", "{\n"
|
||||
" block;\n"
|
||||
" }", "\n"
|
||||
" more;", i::WITH_SCOPE, i::CLASSIC_MODE },
|
||||
{ " with ({}) ", "statement;", " more;", i::WITH_SCOPE, i::CLASSIC_MODE },
|
||||
" more;", i::WITH_SCOPE, i::SLOPPY_MODE },
|
||||
{ " with ({}) ", "statement;", " more;", i::WITH_SCOPE, i::SLOPPY_MODE },
|
||||
{ " with ({}) ", "statement", "\n"
|
||||
" more;", i::WITH_SCOPE, i::CLASSIC_MODE },
|
||||
" more;", i::WITH_SCOPE, i::SLOPPY_MODE },
|
||||
{ " with ({})\n"
|
||||
" ", "statement;", "\n"
|
||||
" more;", i::WITH_SCOPE, i::CLASSIC_MODE },
|
||||
" more;", i::WITH_SCOPE, i::SLOPPY_MODE },
|
||||
{ " try {} catch ", "(e) { block; }", " more;",
|
||||
i::CATCH_SCOPE, i::CLASSIC_MODE },
|
||||
i::CATCH_SCOPE, i::SLOPPY_MODE },
|
||||
{ " try {} catch ", "(e) { block; }", "; more;",
|
||||
i::CATCH_SCOPE, i::CLASSIC_MODE },
|
||||
i::CATCH_SCOPE, i::SLOPPY_MODE },
|
||||
{ " try {} catch ", "(e) {\n"
|
||||
" block;\n"
|
||||
" }", "\n"
|
||||
" more;", i::CATCH_SCOPE, i::CLASSIC_MODE },
|
||||
" more;", i::CATCH_SCOPE, i::SLOPPY_MODE },
|
||||
{ " try {} catch ", "(e) { block; }", " finally { block; } more;",
|
||||
i::CATCH_SCOPE, i::CLASSIC_MODE },
|
||||
i::CATCH_SCOPE, i::SLOPPY_MODE },
|
||||
{ " start;\n"
|
||||
" ", "{ let block; }", " more;", i::BLOCK_SCOPE, i::EXTENDED_MODE },
|
||||
{ " start;\n"
|
||||
@ -957,14 +957,14 @@ TEST(ScopePositions) {
|
||||
" more;", i::BLOCK_SCOPE, i::EXTENDED_MODE },
|
||||
{ " start;\n"
|
||||
" function fun", "(a,b) { infunction; }", " more;",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
{ " start;\n"
|
||||
" function fun", "(a,b) {\n"
|
||||
" infunction;\n"
|
||||
" }", "\n"
|
||||
" more;", i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
" more;", i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
{ " (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
{ " for ", "(let x = 1 ; x < 10; ++ x) { block; }", " more;",
|
||||
i::BLOCK_SCOPE, i::EXTENDED_MODE },
|
||||
{ " for ", "(let x = 1 ; x < 10; ++ x) { block; }", "; more;",
|
||||
@ -1000,87 +1000,87 @@ TEST(ScopePositions) {
|
||||
// 6 byte encoding.
|
||||
{ " 'foo\355\240\201\355\260\211';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// 4 byte encoding.
|
||||
{ " 'foo\360\220\220\212';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// 3 byte encoding of \u0fff.
|
||||
{ " 'foo\340\277\277';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Broken 6 byte encoding with missing last byte.
|
||||
{ " 'foo\355\240\201\355\211';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Broken 3 byte encoding of \u0fff with missing last byte.
|
||||
{ " 'foo\340\277';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Broken 3 byte encoding of \u0fff with missing 2 last bytes.
|
||||
{ " 'foo\340';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Broken 3 byte encoding of \u00ff should be a 2 byte encoding.
|
||||
{ " 'foo\340\203\277';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Broken 3 byte encoding of \u007f should be a 2 byte encoding.
|
||||
{ " 'foo\340\201\277';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Unpaired lead surrogate.
|
||||
{ " 'foo\355\240\201';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Unpaired lead surrogate where following code point is a 3 byte sequence.
|
||||
{ " 'foo\355\240\201\340\277\277';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Unpaired lead surrogate where following code point is a 4 byte encoding
|
||||
// of a trail surrogate.
|
||||
{ " 'foo\355\240\201\360\215\260\211';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Unpaired trail surrogate.
|
||||
{ " 'foo\355\260\211';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// 2 byte encoding of \u00ff.
|
||||
{ " 'foo\303\277';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Broken 2 byte encoding of \u00ff with missing last byte.
|
||||
{ " 'foo\303';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Broken 2 byte encoding of \u007f should be a 1 byte encoding.
|
||||
{ " 'foo\301\277';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Illegal 5 byte encoding.
|
||||
{ " 'foo\370\277\277\277\277';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Illegal 6 byte encoding.
|
||||
{ " 'foo\374\277\277\277\277\277';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Illegal 0xfe byte
|
||||
{ " 'foo\376\277\277\277\277\277\277';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
// Illegal 0xff byte
|
||||
{ " 'foo\377\277\277\277\277\277\277\277';\n"
|
||||
" (function fun", "(a,b) { infunction; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
{ " 'foo';\n"
|
||||
" (function fun", "(a,b) { 'bar\355\240\201\355\260\213'; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
{ " 'foo';\n"
|
||||
" (function fun", "(a,b) { 'bar\360\220\220\214'; }", ")();",
|
||||
i::FUNCTION_SCOPE, i::CLASSIC_MODE },
|
||||
{ NULL, NULL, NULL, i::EVAL_SCOPE, i::CLASSIC_MODE }
|
||||
i::FUNCTION_SCOPE, i::SLOPPY_MODE },
|
||||
{ NULL, NULL, NULL, i::EVAL_SCOPE, i::SLOPPY_MODE }
|
||||
};
|
||||
|
||||
i::Isolate* isolate = CcTest::i_isolate();
|
||||
@ -1152,7 +1152,7 @@ i::Handle<i::String> FormatMessage(i::ScriptDataImpl* data) {
|
||||
i::JSArray::SetElement(
|
||||
args_array, i, v8::Utils::OpenHandle(*v8::String::NewFromUtf8(
|
||||
CcTest::isolate(), args[i])),
|
||||
NONE, i::kNonStrictMode);
|
||||
NONE, i::kSloppyMode);
|
||||
}
|
||||
i::Handle<i::JSObject> builtins(isolate->js_builtins_object());
|
||||
i::Handle<i::Object> format_fun =
|
||||
@ -1537,7 +1537,7 @@ TEST(ErrorsEvalAndArguments) {
|
||||
}
|
||||
|
||||
|
||||
TEST(NoErrorsEvalAndArgumentsClassic) {
|
||||
TEST(NoErrorsEvalAndArgumentsSloppy) {
|
||||
// Tests that both preparsing and parsing accept "eval" and "arguments" as
|
||||
// identifiers when needed.
|
||||
const char* context_data[][2] = {
|
||||
@ -1682,8 +1682,8 @@ TEST(ErrorsReservedWords) {
|
||||
}
|
||||
|
||||
|
||||
TEST(NoErrorsYieldClassic) {
|
||||
// In classic mode, it's okay to use "yield" as identifier, *except* inside a
|
||||
TEST(NoErrorsYieldSloppy) {
|
||||
// In sloppy mode, it's okay to use "yield" as identifier, *except* inside a
|
||||
// generator (see next test).
|
||||
const char* context_data[][2] = {
|
||||
{ "", "" },
|
||||
@ -1709,7 +1709,7 @@ TEST(NoErrorsYieldClassic) {
|
||||
}
|
||||
|
||||
|
||||
TEST(ErrorsYieldClassicGenerator) {
|
||||
TEST(ErrorsYieldSloppyGenerator) {
|
||||
const char* context_data[][2] = {
|
||||
{ "function * is_gen() {", "}" },
|
||||
{ NULL, NULL }
|
||||
@ -1825,7 +1825,7 @@ TEST(NoErrorsNameOfStrictFunction) {
|
||||
|
||||
|
||||
|
||||
TEST(ErrorsIllegalWordsAsLabelsClassic) {
|
||||
TEST(ErrorsIllegalWordsAsLabelsSloppy) {
|
||||
// Using future reserved words as labels is always an error.
|
||||
const char* context_data[][2] = {
|
||||
{ "", ""},
|
||||
|
@ -109,9 +109,9 @@ TestLocalDoesNotThrow("switch (true) { case true: var x; }");
|
||||
TestLocalDoesNotThrow("switch (true) { default: var x; }");
|
||||
|
||||
// Test function declarations in source element and
|
||||
// non-strict statement positions.
|
||||
// sloppy statement positions.
|
||||
function f() {
|
||||
// Non-strict source element positions.
|
||||
// Sloppy source element positions.
|
||||
function g0() {
|
||||
"use strict";
|
||||
// Strict source element positions.
|
||||
|
@ -68,7 +68,7 @@ function* yield() { (yield 3) + (yield 4); }
|
||||
assertThrows("function* yield() { \"use strict\"; (yield 3) + (yield 4); }",
|
||||
SyntaxError);
|
||||
|
||||
// In classic mode, yield is a normal identifier, outside of generators.
|
||||
// In sloppy mode, yield is a normal identifier, outside of generators.
|
||||
function yield(yield) { yield: yield (yield + yield (0)); }
|
||||
|
||||
// Yield is always valid as a key in an object literal.
|
||||
@ -76,7 +76,7 @@ function yield(yield) { yield: yield (yield + yield (0)); }
|
||||
function* g() { yield ({ yield: 1 }) }
|
||||
function* g() { yield ({ get yield() { return 1; }}) }
|
||||
|
||||
// Checks that yield is a valid label in classic mode, but not valid in a strict
|
||||
// Checks that yield is a valid label in sloppy mode, but not valid in a strict
|
||||
// mode or in generators.
|
||||
function f() { yield: 1 }
|
||||
assertThrows("function f() { \"use strict\"; yield: 1 }", SyntaxError)
|
||||
|
@ -72,7 +72,7 @@ function createHandler(obj) {
|
||||
hasOwn: function(name) { return ({}).hasOwnProperty.call(obj, name); },
|
||||
get: function(receiver, name) { return obj[name]; },
|
||||
set: function(receiver, name, val) {
|
||||
obj[name] = val; // bad behavior when set fails in non-strict mode
|
||||
obj[name] = val; // bad behavior when set fails in sloppy mode
|
||||
return true;
|
||||
},
|
||||
enumerate: function() {
|
||||
|
@ -707,7 +707,7 @@ function TestCalls() {
|
||||
function(f, x, y, o) { if (typeof o == "object") return (1, o)["f"](x, y) },
|
||||
]
|
||||
var receivers = [o, global_object, undefined, null, 2, "bla", true]
|
||||
var expectedNonStricts = [o, global_object, global_object, global_object]
|
||||
var expectedSloppies = [o, global_object, global_object, global_object]
|
||||
|
||||
for (var t = 0; t < traps.length; ++t) {
|
||||
for (var i = 0; i < creates.length; ++i) {
|
||||
@ -719,7 +719,7 @@ function TestCalls() {
|
||||
var receiver = receivers[n]
|
||||
var func = binds[j](creates[i](traps[t]), bound, 31, 11)
|
||||
var expected = j > 0 ? bound : receiver
|
||||
var expectedNonStrict = expectedNonStricts[j > 0 ? m : n]
|
||||
var expectedSloppy = expectedSloppies[j > 0 ? m : n]
|
||||
o.f = func
|
||||
global_object.f = func
|
||||
var x = calls[k](func, 11, 31, receiver)
|
||||
@ -729,10 +729,10 @@ function TestCalls() {
|
||||
assertSame(x.strict ? undefined : global_object, x.receiver)
|
||||
else if (x.strict)
|
||||
assertSame(expected, x.receiver)
|
||||
else if (expectedNonStrict === undefined)
|
||||
else if (expectedSloppy === undefined)
|
||||
assertSame(expected, x.receiver.valueOf())
|
||||
else
|
||||
assertSame(expectedNonStrict, x.receiver)
|
||||
assertSame(expectedSloppy, x.receiver)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ function strict_mode() {
|
||||
};
|
||||
strict_mode();
|
||||
|
||||
function classic_mode() {
|
||||
function sloppy_mode() {
|
||||
CheckStringReceiver.call("foo");
|
||||
CheckNumberReceiver.call(42);
|
||||
CheckUndefinedReceiver.call(undefined);
|
||||
@ -100,4 +100,4 @@ function classic_mode() {
|
||||
[4].some(CheckCoersion, 42);
|
||||
[5].map(CheckCoersion, 42);
|
||||
};
|
||||
classic_mode();
|
||||
sloppy_mode();
|
||||
|
@ -66,7 +66,7 @@ Error.prepareStackTrace = function(error, frames) {
|
||||
try {
|
||||
assertEquals(5, frames.length);
|
||||
for (var i = 0; i < 2; i++) {
|
||||
// The first two frames are still classic mode.
|
||||
// The first two frames are still sloppy mode.
|
||||
assertEquals(o[i], frames[i].getFunction());
|
||||
assertEquals(o, frames[i].getThis());
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
// When calling user-defined accessors on strings, booleans or
|
||||
// numbers, we should create a wrapper object in classic-mode.
|
||||
// numbers, we should create a wrapper object in sloppy mode.
|
||||
|
||||
// Flags: --allow-natives-syntax
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user