OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 188 } |
189 | 189 |
190 bool function_in_register = true; | 190 bool function_in_register = true; |
191 | 191 |
192 // Possibly allocate a local context. | 192 // Possibly allocate a local context. |
193 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 193 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
194 if (heap_slots > 0) { | 194 if (heap_slots > 0) { |
195 // Argument to NewContext is the function, which is still in r1. | 195 // Argument to NewContext is the function, which is still in r1. |
196 Comment cmnt(masm_, "[ Allocate context"); | 196 Comment cmnt(masm_, "[ Allocate context"); |
197 bool need_write_barrier = true; | 197 bool need_write_barrier = true; |
198 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { | 198 if (FLAG_harmony_scoping && info->scope()->is_script_scope()) { |
199 __ push(r1); | 199 __ push(r1); |
200 __ Push(info->scope()->GetScopeInfo()); | 200 __ Push(info->scope()->GetScopeInfo()); |
201 __ CallRuntime(Runtime::kNewGlobalContext, 2); | 201 __ CallRuntime(Runtime::kNewScriptContext, 2); |
202 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 202 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
203 FastNewContextStub stub(isolate(), heap_slots); | 203 FastNewContextStub stub(isolate(), heap_slots); |
204 __ CallStub(&stub); | 204 __ CallStub(&stub); |
205 // Result of FastNewContextStub is always in new space. | 205 // Result of FastNewContextStub is always in new space. |
206 need_write_barrier = false; | 206 need_write_barrier = false; |
207 } else { | 207 } else { |
208 __ push(r1); | 208 __ push(r1); |
209 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 209 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
210 } | 210 } |
211 function_in_register = false; | 211 function_in_register = false; |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 | 930 |
931 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { | 931 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { |
932 Variable* variable = declaration->proxy()->var(); | 932 Variable* variable = declaration->proxy()->var(); |
933 DCHECK(variable->location() == Variable::CONTEXT); | 933 DCHECK(variable->location() == Variable::CONTEXT); |
934 DCHECK(variable->interface()->IsFrozen()); | 934 DCHECK(variable->interface()->IsFrozen()); |
935 | 935 |
936 Comment cmnt(masm_, "[ ModuleDeclaration"); | 936 Comment cmnt(masm_, "[ ModuleDeclaration"); |
937 EmitDebugCheckDeclarationContext(variable); | 937 EmitDebugCheckDeclarationContext(variable); |
938 | 938 |
939 // Load instance object. | 939 // Load instance object. |
940 __ LoadContext(r1, scope_->ContextChainLength(scope_->GlobalScope())); | 940 __ LoadContext(r1, scope_->ContextChainLength(scope_->ScriptScope())); |
941 __ ldr(r1, ContextOperand(r1, variable->interface()->Index())); | 941 __ ldr(r1, ContextOperand(r1, variable->interface()->Index())); |
942 __ ldr(r1, ContextOperand(r1, Context::EXTENSION_INDEX)); | 942 __ ldr(r1, ContextOperand(r1, Context::EXTENSION_INDEX)); |
943 | 943 |
944 // Assign it. | 944 // Assign it. |
945 __ str(r1, ContextOperand(cp, variable->index())); | 945 __ str(r1, ContextOperand(cp, variable->index())); |
946 // We know that we have written a module, which is not a smi. | 946 // We know that we have written a module, which is not a smi. |
947 __ RecordWriteContextSlot(cp, | 947 __ RecordWriteContextSlot(cp, |
948 Context::SlotOffset(variable->index()), | 948 Context::SlotOffset(variable->index()), |
949 r1, | 949 r1, |
950 r3, | 950 r3, |
(...skipping 4113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5064 } | 5064 } |
5065 | 5065 |
5066 | 5066 |
5067 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { | 5067 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { |
5068 __ ldr(dst, ContextOperand(cp, context_index)); | 5068 __ ldr(dst, ContextOperand(cp, context_index)); |
5069 } | 5069 } |
5070 | 5070 |
5071 | 5071 |
5072 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { | 5072 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { |
5073 Scope* declaration_scope = scope()->DeclarationScope(); | 5073 Scope* declaration_scope = scope()->DeclarationScope(); |
5074 if (declaration_scope->is_global_scope() || | 5074 if (declaration_scope->is_script_scope() || |
5075 declaration_scope->is_module_scope()) { | 5075 declaration_scope->is_module_scope()) { |
5076 // Contexts nested in the native context have a canonical empty function | 5076 // Contexts nested in the native context have a canonical empty function |
5077 // as their closure, not the anonymous closure containing the global | 5077 // as their closure, not the anonymous closure containing the global |
5078 // code. Pass a smi sentinel and let the runtime look up the empty | 5078 // code. Pass a smi sentinel and let the runtime look up the empty |
5079 // function. | 5079 // function. |
5080 __ mov(ip, Operand(Smi::FromInt(0))); | 5080 __ mov(ip, Operand(Smi::FromInt(0))); |
5081 } else if (declaration_scope->is_eval_scope()) { | 5081 } else if (declaration_scope->is_eval_scope()) { |
5082 // Contexts created by a call to eval have the same closure as the | 5082 // Contexts created by a call to eval have the same closure as the |
5083 // context calling eval, not the anonymous closure containing the eval | 5083 // context calling eval, not the anonymous closure containing the eval |
5084 // code. Fetch it from the context. | 5084 // code. Fetch it from the context. |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5327 | 5327 |
5328 DCHECK(interrupt_address == | 5328 DCHECK(interrupt_address == |
5329 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5329 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5330 return OSR_AFTER_STACK_CHECK; | 5330 return OSR_AFTER_STACK_CHECK; |
5331 } | 5331 } |
5332 | 5332 |
5333 | 5333 |
5334 } } // namespace v8::internal | 5334 } } // namespace v8::internal |
5335 | 5335 |
5336 #endif // V8_TARGET_ARCH_ARM | 5336 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |