| Index: src/x64/full-codegen-x64.cc
|
| diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc
|
| index fe52d5f8dfd4f283a7476c2ee08fd9d5454c458b..cd4eef05b07d7ef8bbcc0cd69af59bbb99f82faf 100644
|
| --- a/src/x64/full-codegen-x64.cc
|
| +++ b/src/x64/full-codegen-x64.cc
|
| @@ -138,7 +138,7 @@ void FullCodeGenerator::Generate() {
|
| // 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_sloppy_mode() && !info->is_native()) {
|
| + if (info->strict_mode() == SLOPPY && !info->is_native()) {
|
| Label ok;
|
| // +1 for return address.
|
| StackArgumentsAccessor args(rsp, info->scope()->num_parameters());
|
| @@ -244,7 +244,7 @@ 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_sloppy_mode()) {
|
| + if (strict_mode() == STRICT) {
|
| type = ArgumentsAccessStub::NEW_STRICT;
|
| } else if (function()->has_duplicate_parameters()) {
|
| type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
|
| @@ -275,7 +275,7 @@ void FullCodeGenerator::Generate() {
|
| if (scope()->is_function_scope() && scope()->function() != NULL) {
|
| VariableDeclaration* function = scope()->function();
|
| ASSERT(function->proxy()->var()->mode() == CONST ||
|
| - function->proxy()->var()->mode() == CONST_HARMONY);
|
| + function->proxy()->var()->mode() == CONST_LEGACY);
|
| ASSERT(function->proxy()->var()->location() != Variable::UNALLOCATED);
|
| VisitVariableDeclaration(function);
|
| }
|
| @@ -758,7 +758,7 @@ void FullCodeGenerator::VisitVariableDeclaration(
|
| VariableProxy* proxy = declaration->proxy();
|
| VariableMode mode = declaration->mode();
|
| Variable* variable = proxy->var();
|
| - bool hole_init = mode == CONST || mode == CONST_HARMONY || mode == LET;
|
| + bool hole_init = mode == LET || mode == CONST || mode == CONST_LEGACY;
|
| switch (variable->location()) {
|
| case Variable::UNALLOCATED:
|
| globals_->Add(variable->name(), zone());
|
| @@ -1292,7 +1292,7 @@ void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info,
|
| !pretenure &&
|
| scope()->is_function_scope() &&
|
| info->num_literals() == 0) {
|
| - FastNewClosureStub stub(info->language_mode(), info->is_generator());
|
| + FastNewClosureStub stub(info->strict_mode(), info->is_generator());
|
| __ Move(rbx, info);
|
| __ CallStub(&stub);
|
| } else {
|
| @@ -1418,14 +1418,13 @@ void FullCodeGenerator::EmitDynamicLookupFastCase(Variable* var,
|
| } else if (var->mode() == DYNAMIC_LOCAL) {
|
| Variable* local = var->local_if_not_shadowed();
|
| __ movp(rax, ContextSlotOperandCheckExtensions(local, slow));
|
| - if (local->mode() == LET ||
|
| - local->mode() == CONST ||
|
| - local->mode() == CONST_HARMONY) {
|
| + if (local->mode() == LET || local->mode() == CONST ||
|
| + local->mode() == CONST_LEGACY) {
|
| __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
|
| __ j(not_equal, done);
|
| - if (local->mode() == CONST) {
|
| + if (local->mode() == CONST_LEGACY) {
|
| __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
|
| - } else { // LET || CONST_HARMONY
|
| + } else { // LET || CONST
|
| __ Push(var->name());
|
| __ CallRuntime(Runtime::kThrowReferenceError, 1);
|
| }
|
| @@ -1490,7 +1489,7 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
|
| // Check that we always have valid source position.
|
| ASSERT(var->initializer_position() != RelocInfo::kNoPosition);
|
| ASSERT(proxy->position() != RelocInfo::kNoPosition);
|
| - skip_init_check = var->mode() != CONST &&
|
| + skip_init_check = var->mode() != CONST_LEGACY &&
|
| var->initializer_position() < proxy->position();
|
| }
|
|
|
| @@ -1500,14 +1499,14 @@ void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy) {
|
| GetVar(rax, var);
|
| __ CompareRoot(rax, Heap::kTheHoleValueRootIndex);
|
| __ j(not_equal, &done, Label::kNear);
|
| - if (var->mode() == LET || var->mode() == CONST_HARMONY) {
|
| + if (var->mode() == LET || var->mode() == CONST) {
|
| // Throw a reference error when using an uninitialized let/const
|
| // binding in harmony mode.
|
| __ Push(var->name());
|
| __ CallRuntime(Runtime::kThrowReferenceError, 1);
|
| } else {
|
| // Uninitalized const bindings outside of harmony mode are unholed.
|
| - ASSERT(var->mode() == CONST);
|
| + ASSERT(var->mode() == CONST_LEGACY);
|
| __ LoadRoot(rax, Heap::kUndefinedValueRootIndex);
|
| }
|
| __ bind(&done);
|
| @@ -2389,7 +2388,7 @@ void FullCodeGenerator::EmitAssignment(Expression* expr) {
|
| __ movp(rcx, rax);
|
| __ pop(rdx);
|
| __ pop(rax); // Restore value.
|
| - Handle<Code> ic = is_sloppy_mode()
|
| + Handle<Code> ic = strict_mode() == SLOPPY
|
| ? isolate()->builtins()->KeyedStoreIC_Initialize()
|
| : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
| CallIC(ic);
|
| @@ -2412,11 +2411,11 @@ void FullCodeGenerator::EmitStoreToStackLocalOrContextSlot(
|
|
|
|
|
| void FullCodeGenerator::EmitCallStoreContextSlot(
|
| - Handle<String> name, LanguageMode mode) {
|
| + Handle<String> name, StrictMode strict_mode) {
|
| __ push(rax); // Value.
|
| __ push(rsi); // Context.
|
| __ Push(name);
|
| - __ Push(Smi::FromInt(mode));
|
| + __ Push(Smi::FromInt(strict_mode));
|
| __ CallRuntime(Runtime::kStoreContextSlot, 4);
|
| }
|
|
|
| @@ -2429,7 +2428,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
|
| __ movp(rdx, GlobalObjectOperand());
|
| CallStoreIC();
|
|
|
| - } else if (op == Token::INIT_CONST) {
|
| + } else if (op == Token::INIT_CONST_LEGACY) {
|
| // Const initializers need a write barrier.
|
| ASSERT(!var->IsParameter()); // No const parameters.
|
| if (var->IsLookupSlot()) {
|
| @@ -2451,7 +2450,7 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
|
| } else if (var->mode() == LET && op != Token::INIT_LET) {
|
| // Non-initializing assignment to let variable needs a write barrier.
|
| if (var->IsLookupSlot()) {
|
| - EmitCallStoreContextSlot(var->name(), language_mode());
|
| + EmitCallStoreContextSlot(var->name(), strict_mode());
|
| } else {
|
| ASSERT(var->IsStackAllocated() || var->IsContextSlot());
|
| Label assign;
|
| @@ -2465,11 +2464,11 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var,
|
| EmitStoreToStackLocalOrContextSlot(var, location);
|
| }
|
|
|
| - } else if (!var->is_const_mode() || op == Token::INIT_CONST_HARMONY) {
|
| + } else if (!var->is_const_mode() || op == Token::INIT_CONST) {
|
| // Assignment to var or initializing assignment to let/const
|
| // in harmony mode.
|
| if (var->IsLookupSlot()) {
|
| - EmitCallStoreContextSlot(var->name(), language_mode());
|
| + EmitCallStoreContextSlot(var->name(), strict_mode());
|
| } else {
|
| ASSERT(var->IsStackAllocated() || var->IsContextSlot());
|
| MemOperand location = VarOperand(var, rcx);
|
| @@ -2510,7 +2509,7 @@ void FullCodeGenerator::EmitKeyedPropertyAssignment(Assignment* expr) {
|
| __ pop(rdx);
|
| // Record source code position before IC call.
|
| SetSourcePosition(expr->position());
|
| - Handle<Code> ic = is_sloppy_mode()
|
| + Handle<Code> ic = strict_mode() == SLOPPY
|
| ? isolate()->builtins()->KeyedStoreIC_Initialize()
|
| : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
| CallIC(ic, expr->AssignmentFeedbackId());
|
| @@ -2681,7 +2680,7 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
|
| __ push(args.GetReceiverOperand());
|
|
|
| // Push the language mode.
|
| - __ Push(Smi::FromInt(language_mode()));
|
| + __ Push(Smi::FromInt(strict_mode()));
|
|
|
| // Push the start position of the scope the calls resides in.
|
| __ Push(Smi::FromInt(scope()->start_position()));
|
| @@ -4180,20 +4179,18 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
|
| if (property != NULL) {
|
| VisitForStackValue(property->obj());
|
| VisitForStackValue(property->key());
|
| - StrictModeFlag strict_mode_flag = (language_mode() == SLOPPY_MODE)
|
| - ? kSloppyMode : kStrictMode;
|
| - __ Push(Smi::FromInt(strict_mode_flag));
|
| + __ Push(Smi::FromInt(strict_mode()));
|
| __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
|
| context()->Plug(rax);
|
| } else if (proxy != NULL) {
|
| Variable* var = proxy->var();
|
| // Delete of an unqualified identifier is disallowed in strict mode
|
| // but "delete this" is allowed.
|
| - ASSERT(language_mode() == SLOPPY_MODE || var->is_this());
|
| + ASSERT(strict_mode() == SLOPPY || var->is_this());
|
| if (var->IsUnallocated()) {
|
| __ push(GlobalObjectOperand());
|
| __ Push(var->name());
|
| - __ Push(Smi::FromInt(kSloppyMode));
|
| + __ Push(Smi::FromInt(SLOPPY));
|
| __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
|
| context()->Plug(rax);
|
| } else if (var->IsStackAllocated() || var->IsContextSlot()) {
|
| @@ -4455,7 +4452,7 @@ void FullCodeGenerator::VisitCountOperation(CountOperation* expr) {
|
| case KEYED_PROPERTY: {
|
| __ pop(rcx);
|
| __ pop(rdx);
|
| - Handle<Code> ic = is_sloppy_mode()
|
| + Handle<Code> ic = strict_mode() == SLOPPY
|
| ? isolate()->builtins()->KeyedStoreIC_Initialize()
|
| : isolate()->builtins()->KeyedStoreIC_Initialize_Strict();
|
| CallIC(ic, expr->CountStoreFeedbackId());
|
|
|