| Index: src/ia32/codegen-ia32.cc
|
| ===================================================================
|
| --- src/ia32/codegen-ia32.cc (revision 7031)
|
| +++ src/ia32/codegen-ia32.cc (working copy)
|
| @@ -3531,7 +3531,8 @@
|
| frame_->EmitPush(esi); // The context is the first argument.
|
| frame_->EmitPush(Immediate(pairs));
|
| frame_->EmitPush(Immediate(Smi::FromInt(is_eval() ? 1 : 0)));
|
| - Result ignored = frame_->CallRuntime(Runtime::kDeclareGlobals, 3);
|
| + frame_->EmitPush(Immediate(Smi::FromInt(strict_mode_flag())));
|
| + Result ignored = frame_->CallRuntime(Runtime::kDeclareGlobals, 4);
|
| // Return value is ignored.
|
| }
|
|
|
| @@ -5264,7 +5265,8 @@
|
| // by initialization.
|
| value = frame_->CallRuntime(Runtime::kInitializeConstContextSlot, 3);
|
| } else {
|
| - value = frame_->CallRuntime(Runtime::kStoreContextSlot, 3);
|
| + frame_->Push(Smi::FromInt(strict_mode_flag()));
|
| + value = frame_->CallRuntime(Runtime::kStoreContextSlot, 4);
|
| }
|
| // Storing a variable must keep the (new) value on the expression
|
| // stack. This is necessary for compiling chained assignment
|
| @@ -5365,10 +5367,20 @@
|
|
|
| void CodeGenerator::VisitLiteral(Literal* node) {
|
| Comment cmnt(masm_, "[ Literal");
|
| - if (in_safe_int32_mode()) {
|
| - frame_->PushUntaggedElement(node->handle());
|
| + if (frame_->ConstantPoolOverflowed()) {
|
| + Result temp = allocator_->Allocate();
|
| + ASSERT(temp.is_valid());
|
| + if (in_safe_int32_mode()) {
|
| + temp.set_untagged_int32(true);
|
| + }
|
| + __ Set(temp.reg(), Immediate(node->handle()));
|
| + frame_->Push(&temp);
|
| } else {
|
| - frame_->Push(node->handle());
|
| + if (in_safe_int32_mode()) {
|
| + frame_->PushUntaggedElement(node->handle());
|
| + } else {
|
| + frame_->Push(node->handle());
|
| + }
|
| }
|
| }
|
|
|
| @@ -5593,7 +5605,8 @@
|
| Load(property->value());
|
| if (property->emit_store()) {
|
| Result ignored =
|
| - frame_->CallStoreIC(Handle<String>::cast(key), false);
|
| + frame_->CallStoreIC(Handle<String>::cast(key), false,
|
| + strict_mode_flag());
|
| // A test eax instruction following the store IC call would
|
| // indicate the presence of an inlined version of the
|
| // store. Add a nop to indicate that there is no such
|
| @@ -5612,8 +5625,9 @@
|
| Load(property->key());
|
| Load(property->value());
|
| if (property->emit_store()) {
|
| + frame_->Push(Smi::FromInt(NONE)); // PropertyAttributes
|
| // Ignore the result.
|
| - Result ignored = frame_->CallRuntime(Runtime::kSetProperty, 3);
|
| + Result ignored = frame_->CallRuntime(Runtime::kSetProperty, 4);
|
| } else {
|
| frame_->Drop(3);
|
| }
|
| @@ -8229,21 +8243,25 @@
|
| if (property != NULL) {
|
| Load(property->obj());
|
| Load(property->key());
|
| - Result answer = frame_->InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, 2);
|
| + frame_->Push(Smi::FromInt(strict_mode_flag()));
|
| + Result answer = frame_->InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION, 3);
|
| frame_->Push(&answer);
|
| return;
|
| }
|
|
|
| Variable* variable = node->expression()->AsVariableProxy()->AsVariable();
|
| if (variable != NULL) {
|
| + // Delete of an unqualified identifier is disallowed in strict mode
|
| + // but "delete this" is.
|
| + ASSERT(strict_mode_flag() == kNonStrictMode || variable->is_this());
|
| Slot* slot = variable->AsSlot();
|
| if (variable->is_global()) {
|
| LoadGlobal();
|
| frame_->Push(variable->name());
|
| + frame_->Push(Smi::FromInt(kNonStrictMode));
|
| Result answer = frame_->InvokeBuiltin(Builtins::DELETE,
|
| - CALL_FUNCTION, 2);
|
| + CALL_FUNCTION, 3);
|
| frame_->Push(&answer);
|
| - return;
|
|
|
| } else if (slot != NULL && slot->type() == Slot::LOOKUP) {
|
| // Call the runtime to delete from the context holding the named
|
| @@ -8254,13 +8272,11 @@
|
| frame_->EmitPush(Immediate(variable->name()));
|
| Result answer = frame_->CallRuntime(Runtime::kDeleteContextSlot, 2);
|
| frame_->Push(&answer);
|
| - return;
|
| + } else {
|
| + // Default: Result of deleting non-global, not dynamically
|
| + // introduced variables is false.
|
| + frame_->Push(FACTORY->false_value());
|
| }
|
| -
|
| - // Default: Result of deleting non-global, not dynamically
|
| - // introduced variables is false.
|
| - frame_->Push(FACTORY->false_value());
|
| -
|
| } else {
|
| // Default: Result of deleting expressions is true.
|
| Load(node->expression()); // may have side-effects
|
| @@ -8302,6 +8318,7 @@
|
| switch (op) {
|
| case Token::SUB: {
|
| __ neg(value.reg());
|
| + frame_->Push(&value);
|
| if (node->no_negative_zero()) {
|
| // -MIN_INT is MIN_INT with the overflow flag set.
|
| unsafe_bailout_->Branch(overflow);
|
| @@ -8314,17 +8331,18 @@
|
| }
|
| case Token::BIT_NOT: {
|
| __ not_(value.reg());
|
| + frame_->Push(&value);
|
| break;
|
| }
|
| case Token::ADD: {
|
| // Unary plus has no effect on int32 values.
|
| + frame_->Push(&value);
|
| break;
|
| }
|
| default:
|
| UNREACHABLE();
|
| break;
|
| }
|
| - frame_->Push(&value);
|
| } else {
|
| Load(node->expression());
|
| bool can_overwrite = node->expression()->ResultOverwriteAllowed();
|
| @@ -9462,11 +9480,13 @@
|
| DeferredReferenceSetKeyedValue(Register value,
|
| Register key,
|
| Register receiver,
|
| - Register scratch)
|
| + Register scratch,
|
| + StrictModeFlag strict_mode)
|
| : value_(value),
|
| key_(key),
|
| receiver_(receiver),
|
| - scratch_(scratch) {
|
| + scratch_(scratch),
|
| + strict_mode_(strict_mode) {
|
| set_comment("[ DeferredReferenceSetKeyedValue");
|
| }
|
|
|
| @@ -9480,6 +9500,7 @@
|
| Register receiver_;
|
| Register scratch_;
|
| Label patch_site_;
|
| + StrictModeFlag strict_mode_;
|
| };
|
|
|
|
|
| @@ -9539,7 +9560,8 @@
|
|
|
| // Call the IC stub.
|
| Handle<Code> ic(Isolate::Current()->builtins()->builtin(
|
| - Builtins::KeyedStoreIC_Initialize));
|
| + (strict_mode_ == kStrictMode) ? Builtins::KeyedStoreIC_Initialize_Strict
|
| + : Builtins::KeyedStoreIC_Initialize));
|
| __ call(ic, RelocInfo::CODE_TARGET);
|
| // The delta from the start of the map-compare instruction to the
|
| // test instruction. We use masm_-> directly here instead of the
|
| @@ -9681,7 +9703,7 @@
|
|
|
| Result result;
|
| if (is_contextual || scope()->is_global_scope() || loop_nesting() == 0) {
|
| - result = frame()->CallStoreIC(name, is_contextual);
|
| + result = frame()->CallStoreIC(name, is_contextual, strict_mode_flag());
|
| // A test eax instruction following the call signals that the inobject
|
| // property case was inlined. Ensure that there is not a test eax
|
| // instruction here.
|
| @@ -9765,7 +9787,7 @@
|
| slow.Bind(&value, &receiver);
|
| frame()->Push(&receiver);
|
| frame()->Push(&value);
|
| - result = frame()->CallStoreIC(name, is_contextual);
|
| + result = frame()->CallStoreIC(name, is_contextual, strict_mode_flag());
|
| // Encode the offset to the map check instruction and the offset
|
| // to the write barrier store address computation in a test eax
|
| // instruction.
|
| @@ -9903,7 +9925,8 @@
|
| new DeferredReferenceSetKeyedValue(result.reg(),
|
| key.reg(),
|
| receiver.reg(),
|
| - tmp.reg());
|
| + tmp.reg(),
|
| + strict_mode_flag());
|
|
|
| // Check that the receiver is not a smi.
|
| __ test(receiver.reg(), Immediate(kSmiTagMask));
|
| @@ -9958,7 +9981,7 @@
|
|
|
| deferred->BindExit();
|
| } else {
|
| - result = frame()->CallKeyedStoreIC();
|
| + result = frame()->CallKeyedStoreIC(strict_mode_flag());
|
| // Make sure that we do not have a test instruction after the
|
| // call. A test instruction after the call is used to
|
| // indicate that we have generated an inline version of the
|
|
|