| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 } | 193 } |
| 194 | 194 |
| 195 bool function_in_register = true; | 195 bool function_in_register = true; |
| 196 | 196 |
| 197 // Possibly allocate a local context. | 197 // Possibly allocate a local context. |
| 198 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; | 198 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| 199 if (heap_slots > 0) { | 199 if (heap_slots > 0) { |
| 200 // Argument to NewContext is the function, which is still in r4. | 200 // Argument to NewContext is the function, which is still in r4. |
| 201 Comment cmnt(masm_, "[ Allocate context"); | 201 Comment cmnt(masm_, "[ Allocate context"); |
| 202 bool need_write_barrier = true; | 202 bool need_write_barrier = true; |
| 203 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { | 203 if (FLAG_harmony_scoping && info->scope()->is_script_scope()) { |
| 204 __ push(r4); | 204 __ push(r4); |
| 205 __ Push(info->scope()->GetScopeInfo()); | 205 __ Push(info->scope()->GetScopeInfo()); |
| 206 __ CallRuntime(Runtime::kNewGlobalContext, 2); | 206 __ CallRuntime(Runtime::kNewScriptContext, 2); |
| 207 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { | 207 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
| 208 FastNewContextStub stub(isolate(), heap_slots); | 208 FastNewContextStub stub(isolate(), heap_slots); |
| 209 __ CallStub(&stub); | 209 __ CallStub(&stub); |
| 210 // Result of FastNewContextStub is always in new space. | 210 // Result of FastNewContextStub is always in new space. |
| 211 need_write_barrier = false; | 211 need_write_barrier = false; |
| 212 } else { | 212 } else { |
| 213 __ push(r4); | 213 __ push(r4); |
| 214 __ CallRuntime(Runtime::kNewFunctionContext, 1); | 214 __ CallRuntime(Runtime::kNewFunctionContext, 1); |
| 215 } | 215 } |
| 216 function_in_register = false; | 216 function_in_register = false; |
| (...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 | 890 |
| 891 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { | 891 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { |
| 892 Variable* variable = declaration->proxy()->var(); | 892 Variable* variable = declaration->proxy()->var(); |
| 893 DCHECK(variable->location() == Variable::CONTEXT); | 893 DCHECK(variable->location() == Variable::CONTEXT); |
| 894 DCHECK(variable->interface()->IsFrozen()); | 894 DCHECK(variable->interface()->IsFrozen()); |
| 895 | 895 |
| 896 Comment cmnt(masm_, "[ ModuleDeclaration"); | 896 Comment cmnt(masm_, "[ ModuleDeclaration"); |
| 897 EmitDebugCheckDeclarationContext(variable); | 897 EmitDebugCheckDeclarationContext(variable); |
| 898 | 898 |
| 899 // Load instance object. | 899 // Load instance object. |
| 900 __ LoadContext(r4, scope_->ContextChainLength(scope_->GlobalScope())); | 900 __ LoadContext(r4, scope_->ContextChainLength(scope_->ScriptScope())); |
| 901 __ LoadP(r4, ContextOperand(r4, variable->interface()->Index())); | 901 __ LoadP(r4, ContextOperand(r4, variable->interface()->Index())); |
| 902 __ LoadP(r4, ContextOperand(r4, Context::EXTENSION_INDEX)); | 902 __ LoadP(r4, ContextOperand(r4, Context::EXTENSION_INDEX)); |
| 903 | 903 |
| 904 // Assign it. | 904 // Assign it. |
| 905 __ StoreP(r4, ContextOperand(cp, variable->index()), r0); | 905 __ StoreP(r4, ContextOperand(cp, variable->index()), r0); |
| 906 // We know that we have written a module, which is not a smi. | 906 // We know that we have written a module, which is not a smi. |
| 907 __ RecordWriteContextSlot(cp, Context::SlotOffset(variable->index()), r4, r6, | 907 __ RecordWriteContextSlot(cp, Context::SlotOffset(variable->index()), r4, r6, |
| 908 kLRHasBeenSaved, kDontSaveFPRegs, | 908 kLRHasBeenSaved, kDontSaveFPRegs, |
| 909 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); | 909 EMIT_REMEMBERED_SET, OMIT_SMI_CHECK); |
| 910 PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS); | 910 PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS); |
| (...skipping 4177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5088 } | 5088 } |
| 5089 | 5089 |
| 5090 | 5090 |
| 5091 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { | 5091 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { |
| 5092 __ LoadP(dst, ContextOperand(cp, context_index), r0); | 5092 __ LoadP(dst, ContextOperand(cp, context_index), r0); |
| 5093 } | 5093 } |
| 5094 | 5094 |
| 5095 | 5095 |
| 5096 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { | 5096 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { |
| 5097 Scope* declaration_scope = scope()->DeclarationScope(); | 5097 Scope* declaration_scope = scope()->DeclarationScope(); |
| 5098 if (declaration_scope->is_global_scope() || | 5098 if (declaration_scope->is_script_scope() || |
| 5099 declaration_scope->is_module_scope()) { | 5099 declaration_scope->is_module_scope()) { |
| 5100 // Contexts nested in the native context have a canonical empty function | 5100 // Contexts nested in the native context have a canonical empty function |
| 5101 // as their closure, not the anonymous closure containing the global | 5101 // as their closure, not the anonymous closure containing the global |
| 5102 // code. Pass a smi sentinel and let the runtime look up the empty | 5102 // code. Pass a smi sentinel and let the runtime look up the empty |
| 5103 // function. | 5103 // function. |
| 5104 __ LoadSmiLiteral(ip, Smi::FromInt(0)); | 5104 __ LoadSmiLiteral(ip, Smi::FromInt(0)); |
| 5105 } else if (declaration_scope->is_eval_scope()) { | 5105 } else if (declaration_scope->is_eval_scope()) { |
| 5106 // Contexts created by a call to eval have the same closure as the | 5106 // Contexts created by a call to eval have the same closure as the |
| 5107 // context calling eval, not the anonymous closure containing the eval | 5107 // context calling eval, not the anonymous closure containing the eval |
| 5108 // code. Fetch it from the context. | 5108 // code. Fetch it from the context. |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5281 return ON_STACK_REPLACEMENT; | 5281 return ON_STACK_REPLACEMENT; |
| 5282 } | 5282 } |
| 5283 | 5283 |
| 5284 DCHECK(interrupt_address == | 5284 DCHECK(interrupt_address == |
| 5285 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5285 isolate->builtins()->OsrAfterStackCheck()->entry()); |
| 5286 return OSR_AFTER_STACK_CHECK; | 5286 return OSR_AFTER_STACK_CHECK; |
| 5287 } | 5287 } |
| 5288 } | 5288 } |
| 5289 } // namespace v8::internal | 5289 } // namespace v8::internal |
| 5290 #endif // V8_TARGET_ARCH_PPC | 5290 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |