OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 bool function_in_register_x1 = true; | 192 bool function_in_register_x1 = true; |
193 | 193 |
194 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 194 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
195 if (heap_slots > 0) { | 195 if (heap_slots > 0) { |
196 // Argument to NewContext is the function, which is still in x1. | 196 // Argument to NewContext is the function, which is still in x1. |
197 Comment cmnt(masm_, "[ Allocate context"); | 197 Comment cmnt(masm_, "[ Allocate context"); |
198 bool need_write_barrier = true; | 198 bool need_write_barrier = true; |
199 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { | 199 if (FLAG_harmony_scoping && info->scope()->is_script_scope()) { |
200 __ Mov(x10, Operand(info->scope()->GetScopeInfo())); | 200 __ Mov(x10, Operand(info->scope()->GetScopeInfo())); |
201 __ Push(x1, x10); | 201 __ Push(x1, x10); |
202 __ CallRuntime(Runtime::kNewGlobalContext, 2); | 202 __ CallRuntime(Runtime::kNewScriptContext, 2); |
203 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 203 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
204 FastNewContextStub stub(isolate(), heap_slots); | 204 FastNewContextStub stub(isolate(), heap_slots); |
205 __ CallStub(&stub); | 205 __ CallStub(&stub); |
206 // Result of FastNewContextStub is always in new space. | 206 // Result of FastNewContextStub is always in new space. |
207 need_write_barrier = false; | 207 need_write_barrier = false; |
208 } else { | 208 } else { |
209 __ Push(x1); | 209 __ Push(x1); |
210 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 210 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
211 } | 211 } |
212 function_in_register_x1 = false; | 212 function_in_register_x1 = false; |
(...skipping 714 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 | 927 |
928 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { | 928 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { |
929 Variable* variable = declaration->proxy()->var(); | 929 Variable* variable = declaration->proxy()->var(); |
930 DCHECK(variable->location() == Variable::CONTEXT); | 930 DCHECK(variable->location() == Variable::CONTEXT); |
931 DCHECK(variable->interface()->IsFrozen()); | 931 DCHECK(variable->interface()->IsFrozen()); |
932 | 932 |
933 Comment cmnt(masm_, "[ ModuleDeclaration"); | 933 Comment cmnt(masm_, "[ ModuleDeclaration"); |
934 EmitDebugCheckDeclarationContext(variable); | 934 EmitDebugCheckDeclarationContext(variable); |
935 | 935 |
936 // Load instance object. | 936 // Load instance object. |
937 __ LoadContext(x1, scope_->ContextChainLength(scope_->GlobalScope())); | 937 __ LoadContext(x1, scope_->ContextChainLength(scope_->ScriptScope())); |
938 __ Ldr(x1, ContextMemOperand(x1, variable->interface()->Index())); | 938 __ Ldr(x1, ContextMemOperand(x1, variable->interface()->Index())); |
939 __ Ldr(x1, ContextMemOperand(x1, Context::EXTENSION_INDEX)); | 939 __ Ldr(x1, ContextMemOperand(x1, Context::EXTENSION_INDEX)); |
940 | 940 |
941 // Assign it. | 941 // Assign it. |
942 __ Str(x1, ContextMemOperand(cp, variable->index())); | 942 __ Str(x1, ContextMemOperand(cp, variable->index())); |
943 // We know that we have written a module, which is not a smi. | 943 // We know that we have written a module, which is not a smi. |
944 __ RecordWriteContextSlot(cp, | 944 __ RecordWriteContextSlot(cp, |
945 Context::SlotOffset(variable->index()), | 945 Context::SlotOffset(variable->index()), |
946 x1, | 946 x1, |
947 x3, | 947 x3, |
(...skipping 4141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5089 } | 5089 } |
5090 | 5090 |
5091 | 5091 |
5092 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { | 5092 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { |
5093 __ Ldr(dst, ContextMemOperand(cp, context_index)); | 5093 __ Ldr(dst, ContextMemOperand(cp, context_index)); |
5094 } | 5094 } |
5095 | 5095 |
5096 | 5096 |
5097 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { | 5097 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { |
5098 Scope* declaration_scope = scope()->DeclarationScope(); | 5098 Scope* declaration_scope = scope()->DeclarationScope(); |
5099 if (declaration_scope->is_global_scope() || | 5099 if (declaration_scope->is_script_scope() || |
5100 declaration_scope->is_module_scope()) { | 5100 declaration_scope->is_module_scope()) { |
5101 // Contexts nested in the native context have a canonical empty function | 5101 // Contexts nested in the native context have a canonical empty function |
5102 // as their closure, not the anonymous closure containing the global | 5102 // as their closure, not the anonymous closure containing the global |
5103 // code. Pass a smi sentinel and let the runtime look up the empty | 5103 // code. Pass a smi sentinel and let the runtime look up the empty |
5104 // function. | 5104 // function. |
5105 DCHECK(kSmiTag == 0); | 5105 DCHECK(kSmiTag == 0); |
5106 __ Push(xzr); | 5106 __ Push(xzr); |
5107 } else if (declaration_scope->is_eval_scope()) { | 5107 } else if (declaration_scope->is_eval_scope()) { |
5108 // Contexts created by a call to eval have the same closure as the | 5108 // Contexts created by a call to eval have the same closure as the |
5109 // context calling eval, not the anonymous closure containing the eval | 5109 // context calling eval, not the anonymous closure containing the eval |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5308 return previous_; | 5308 return previous_; |
5309 } | 5309 } |
5310 | 5310 |
5311 | 5311 |
5312 #undef __ | 5312 #undef __ |
5313 | 5313 |
5314 | 5314 |
5315 } } // namespace v8::internal | 5315 } } // namespace v8::internal |
5316 | 5316 |
5317 #endif // V8_TARGET_ARCH_ARM64 | 5317 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |