diff options
Diffstat (limited to 'deps/v8/src/arm64/full-codegen-arm64.cc')
-rw-r--r-- | deps/v8/src/arm64/full-codegen-arm64.cc | 112 |
1 files changed, 34 insertions, 78 deletions
diff --git a/deps/v8/src/arm64/full-codegen-arm64.cc b/deps/v8/src/arm64/full-codegen-arm64.cc index 426287540e..0d3d34b695 100644 --- a/deps/v8/src/arm64/full-codegen-arm64.cc +++ b/deps/v8/src/arm64/full-codegen-arm64.cc @@ -196,10 +196,10 @@ void FullCodeGenerator::Generate() { // Argument to NewContext is the function, which is still in x1. Comment cmnt(masm_, "[ Allocate context"); bool need_write_barrier = true; - if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { + if (FLAG_harmony_scoping && info->scope()->is_script_scope()) { __ Mov(x10, Operand(info->scope()->GetScopeInfo())); __ Push(x1, x10); - __ CallRuntime(Runtime::kNewGlobalContext, 2); + __ CallRuntime(Runtime::kNewScriptContext, 2); } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { FastNewContextStub stub(isolate(), heap_slots); __ CallStub(&stub); @@ -934,7 +934,7 @@ void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { EmitDebugCheckDeclarationContext(variable); // Load instance object. - __ LoadContext(x1, scope_->ContextChainLength(scope_->GlobalScope())); + __ LoadContext(x1, scope_->ContextChainLength(scope_->ScriptScope())); __ Ldr(x1, ContextMemOperand(x1, variable->interface()->Index())); __ Ldr(x1, ContextMemOperand(x1, Context::EXTENSION_INDEX)); @@ -1109,6 +1109,7 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { // Get the object to enumerate over. If the object is null or undefined, skip // over the loop. See ECMA-262 version 5, section 12.6.4. + SetExpressionPosition(stmt->enumerable()); VisitForAccumulatorValue(stmt->enumerable()); __ JumpIfRoot(x0, Heap::kUndefinedValueRootIndex, &exit); Register null_value = x15; @@ -1202,6 +1203,8 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { // Generate code for doing the condition check. PrepareForBailoutForId(stmt->BodyId(), NO_REGISTERS); __ Bind(&loop); + SetExpressionPosition(stmt->each()); + // Load the current count to x0, load the length to x1. __ PeekPair(x0, x1, 0); __ Cmp(x0, x1); // Compare to the array length. @@ -1271,48 +1274,6 @@ void FullCodeGenerator::VisitForInStatement(ForInStatement* stmt) { } -void FullCodeGenerator::VisitForOfStatement(ForOfStatement* stmt) { - Comment cmnt(masm_, "[ ForOfStatement"); - SetStatementPosition(stmt); - - Iteration loop_statement(this, stmt); - increment_loop_depth(); - - // var iterator = iterable[Symbol.iterator](); - VisitForEffect(stmt->assign_iterator()); - - // Loop entry. - __ Bind(loop_statement.continue_label()); - - // result = iterator.next() - VisitForEffect(stmt->next_result()); - - // if (result.done) break; - Label result_not_done; - VisitForControl(stmt->result_done(), - loop_statement.break_label(), - &result_not_done, - &result_not_done); - __ Bind(&result_not_done); - - // each = result.value - VisitForEffect(stmt->assign_each()); - - // Generate code for the body of the loop. - Visit(stmt->body()); - - // Check stack before looping. - PrepareForBailoutForId(stmt->BackEdgeId(), NO_REGISTERS); - EmitBackEdgeBookkeeping(stmt, loop_statement.continue_label()); - __ B(loop_statement.continue_label()); - - // Exit and decrement the loop depth. - PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); - __ Bind(loop_statement.break_label()); - decrement_loop_depth(); -} - - void FullCodeGenerator::EmitNewClosure(Handle<SharedFunctionInfo> info, bool pretenure) { // Use the fast case closure allocation code that allocates in new space for @@ -1372,6 +1333,18 @@ void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { } +void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer, + int offset) { + if (NeedsHomeObject(initializer)) { + __ Peek(StoreDescriptor::ReceiverRegister(), 0); + __ Mov(StoreDescriptor::NameRegister(), + Operand(isolate()->factory()->home_object_symbol())); + __ Peek(StoreDescriptor::ValueRegister(), offset * kPointerSize); + CallStoreIC(); + } +} + + void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, TypeofState typeof_state, Label* slow) { @@ -1721,6 +1694,14 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { __ Peek(StoreDescriptor::ReceiverRegister(), 0); CallStoreIC(key->LiteralFeedbackId()); PrepareForBailoutForId(key->id(), NO_REGISTERS); + + if (NeedsHomeObject(value)) { + __ Mov(StoreDescriptor::ReceiverRegister(), x0); + __ Mov(StoreDescriptor::NameRegister(), + Operand(isolate()->factory()->home_object_symbol())); + __ Peek(StoreDescriptor::ValueRegister(), 0); + CallStoreIC(); + } } else { VisitForEffect(value); } @@ -1732,6 +1713,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { __ Push(x0); VisitForStackValue(key); VisitForStackValue(value); + EmitSetHomeObjectIfNeeded(value, 2); __ Mov(x0, Smi::FromInt(SLOPPY)); // Strict mode __ Push(x0); __ CallRuntime(Runtime::kSetProperty, 4); @@ -1769,7 +1751,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { __ Push(x10); VisitForStackValue(it->first); EmitAccessor(it->second->getter); + EmitSetHomeObjectIfNeeded(it->second->getter, 2); EmitAccessor(it->second->setter); + EmitSetHomeObjectIfNeeded(it->second->setter, 3); __ Mov(x10, Smi::FromInt(NONE)); __ Push(x10); __ CallRuntime(Runtime::kDefineAccessorPropertyUnchecked, 5); @@ -2203,6 +2187,7 @@ void FullCodeGenerator::EmitClassDefineProperties(ClassLiteral* lit) { __ Push(scratch); VisitForStackValue(key); VisitForStackValue(value); + EmitSetHomeObjectIfNeeded(value, 2); switch (property->kind()) { case ObjectLiteral::Property::CONSTANT: @@ -2388,8 +2373,9 @@ void FullCodeGenerator::EmitVariableAssignment(Variable* var, } EmitStoreToStackLocalOrContextSlot(var, location); } + } else if (IsSignallingAssignmentToConst(var, op, strict_mode())) { + __ CallRuntime(Runtime::kThrowConstAssignError, 0); } - // Non-initializing assignments to consts are ignored. } @@ -4909,7 +4895,6 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator, Expression *value, JSGeneratorObject::ResumeMode resume_mode) { ASM_LOCATION("FullCodeGenerator::EmitGeneratorResume"); - Register value_reg = x0; Register generator_object = x1; Register the_hole = x2; Register operand_stack_size = w3; @@ -4923,15 +4908,6 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator, VisitForAccumulatorValue(value); __ Pop(generator_object); - // Check generator state. - Label wrong_state, closed_state, done; - __ Ldr(x10, FieldMemOperand(generator_object, - JSGeneratorObject::kContinuationOffset)); - STATIC_ASSERT(JSGeneratorObject::kGeneratorExecuting < 0); - STATIC_ASSERT(JSGeneratorObject::kGeneratorClosed == 0); - __ CompareAndBranch(x10, Smi::FromInt(0), eq, &closed_state); - __ CompareAndBranch(x10, Smi::FromInt(0), lt, &wrong_state); - // Load suspended function and context. __ Ldr(cp, FieldMemOperand(generator_object, JSGeneratorObject::kContextOffset)); @@ -4957,7 +4933,7 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator, // Enter a new JavaScript frame, and initialize its slots as they were when // the generator was suspended. - Label resume_frame; + Label resume_frame, done; __ Bl(&resume_frame); __ B(&done); @@ -5002,26 +4978,6 @@ void FullCodeGenerator::EmitGeneratorResume(Expression *generator, // Not reached: the runtime call returns elsewhere. __ Unreachable(); - // Reach here when generator is closed. - __ Bind(&closed_state); - if (resume_mode == JSGeneratorObject::NEXT) { - // Return completed iterator result when generator is closed. - __ LoadRoot(x10, Heap::kUndefinedValueRootIndex); - __ Push(x10); - // Pop value from top-of-stack slot; box result into result register. - EmitCreateIteratorResult(true); - } else { - // Throw the provided value. - __ Push(value_reg); - __ CallRuntime(Runtime::kThrow, 1); - } - __ B(&done); - - // Throw error if we attempt to operate on a running generator. - __ Bind(&wrong_state); - __ Push(generator_object); - __ CallRuntime(Runtime::kThrowGeneratorStateError, 1); - __ Bind(&done); context()->Plug(result_register()); } @@ -5111,7 +5067,7 @@ void FullCodeGenerator::LoadContextField(Register dst, int context_index) { void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { Scope* declaration_scope = scope()->DeclarationScope(); - if (declaration_scope->is_global_scope() || + if (declaration_scope->is_script_scope() || declaration_scope->is_module_scope()) { // Contexts nested in the native context have a canonical empty function // as their closure, not the anonymous closure containing the global |