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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 197 } |
198 | 198 |
199 bool function_in_register = true; | 199 bool function_in_register = true; |
200 | 200 |
201 // Possibly allocate a local context. | 201 // Possibly allocate a local context. |
202 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 202 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
203 if (heap_slots > 0) { | 203 if (heap_slots > 0) { |
204 Comment cmnt(masm_, "[ Allocate context"); | 204 Comment cmnt(masm_, "[ Allocate context"); |
205 // Argument to NewContext is the function, which is still in a1. | 205 // Argument to NewContext is the function, which is still in a1. |
206 bool need_write_barrier = true; | 206 bool need_write_barrier = true; |
207 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { | 207 if (FLAG_harmony_scoping && info->scope()->is_script_scope()) { |
208 __ push(a1); | 208 __ push(a1); |
209 __ Push(info->scope()->GetScopeInfo()); | 209 __ Push(info->scope()->GetScopeInfo()); |
210 __ CallRuntime(Runtime::kNewGlobalContext, 2); | 210 __ CallRuntime(Runtime::kNewScriptContext, 2); |
211 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 211 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
212 FastNewContextStub stub(isolate(), heap_slots); | 212 FastNewContextStub stub(isolate(), heap_slots); |
213 __ CallStub(&stub); | 213 __ CallStub(&stub); |
214 // Result of FastNewContextStub is always in new space. | 214 // Result of FastNewContextStub is always in new space. |
215 need_write_barrier = false; | 215 need_write_barrier = false; |
216 } else { | 216 } else { |
217 __ push(a1); | 217 __ push(a1); |
218 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 218 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
219 } | 219 } |
220 function_in_register = false; | 220 function_in_register = false; |
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 | 922 |
923 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { | 923 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { |
924 Variable* variable = declaration->proxy()->var(); | 924 Variable* variable = declaration->proxy()->var(); |
925 DCHECK(variable->location() == Variable::CONTEXT); | 925 DCHECK(variable->location() == Variable::CONTEXT); |
926 DCHECK(variable->interface()->IsFrozen()); | 926 DCHECK(variable->interface()->IsFrozen()); |
927 | 927 |
928 Comment cmnt(masm_, "[ ModuleDeclaration"); | 928 Comment cmnt(masm_, "[ ModuleDeclaration"); |
929 EmitDebugCheckDeclarationContext(variable); | 929 EmitDebugCheckDeclarationContext(variable); |
930 | 930 |
931 // Load instance object. | 931 // Load instance object. |
932 __ LoadContext(a1, scope_->ContextChainLength(scope_->GlobalScope())); | 932 __ LoadContext(a1, scope_->ContextChainLength(scope_->ScriptScope())); |
933 __ lw(a1, ContextOperand(a1, variable->interface()->Index())); | 933 __ lw(a1, ContextOperand(a1, variable->interface()->Index())); |
934 __ lw(a1, ContextOperand(a1, Context::EXTENSION_INDEX)); | 934 __ lw(a1, ContextOperand(a1, Context::EXTENSION_INDEX)); |
935 | 935 |
936 // Assign it. | 936 // Assign it. |
937 __ sw(a1, ContextOperand(cp, variable->index())); | 937 __ sw(a1, ContextOperand(cp, variable->index())); |
938 // We know that we have written a module, which is not a smi. | 938 // We know that we have written a module, which is not a smi. |
939 __ RecordWriteContextSlot(cp, | 939 __ RecordWriteContextSlot(cp, |
940 Context::SlotOffset(variable->index()), | 940 Context::SlotOffset(variable->index()), |
941 a1, | 941 a1, |
942 a3, | 942 a3, |
(...skipping 4095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5038 } | 5038 } |
5039 | 5039 |
5040 | 5040 |
5041 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { | 5041 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { |
5042 __ lw(dst, ContextOperand(cp, context_index)); | 5042 __ lw(dst, ContextOperand(cp, context_index)); |
5043 } | 5043 } |
5044 | 5044 |
5045 | 5045 |
5046 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { | 5046 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { |
5047 Scope* declaration_scope = scope()->DeclarationScope(); | 5047 Scope* declaration_scope = scope()->DeclarationScope(); |
5048 if (declaration_scope->is_global_scope() || | 5048 if (declaration_scope->is_script_scope() || |
5049 declaration_scope->is_module_scope()) { | 5049 declaration_scope->is_module_scope()) { |
5050 // Contexts nested in the native context have a canonical empty function | 5050 // Contexts nested in the native context have a canonical empty function |
5051 // as their closure, not the anonymous closure containing the global | 5051 // as their closure, not the anonymous closure containing the global |
5052 // code. Pass a smi sentinel and let the runtime look up the empty | 5052 // code. Pass a smi sentinel and let the runtime look up the empty |
5053 // function. | 5053 // function. |
5054 __ li(at, Operand(Smi::FromInt(0))); | 5054 __ li(at, Operand(Smi::FromInt(0))); |
5055 } else if (declaration_scope->is_eval_scope()) { | 5055 } else if (declaration_scope->is_eval_scope()) { |
5056 // Contexts created by a call to eval have the same closure as the | 5056 // Contexts created by a call to eval have the same closure as the |
5057 // context calling eval, not the anonymous closure containing the eval | 5057 // context calling eval, not the anonymous closure containing the eval |
5058 // code. Fetch it from the context. | 5058 // code. Fetch it from the context. |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5240 Assembler::target_address_at(pc_immediate_load_address)) == | 5240 Assembler::target_address_at(pc_immediate_load_address)) == |
5241 reinterpret_cast<uint32_t>( | 5241 reinterpret_cast<uint32_t>( |
5242 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5242 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5243 return OSR_AFTER_STACK_CHECK; | 5243 return OSR_AFTER_STACK_CHECK; |
5244 } | 5244 } |
5245 | 5245 |
5246 | 5246 |
5247 } } // namespace v8::internal | 5247 } } // namespace v8::internal |
5248 | 5248 |
5249 #endif // V8_TARGET_ARCH_MIPS | 5249 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |