Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(88)

Side by Side Diff: src/x87/full-codegen-x87.cc

Issue 716833002: Various clean-ups after top-level lexical declarations are done. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Patch for landing Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_X87 7 #if V8_TARGET_ARCH_X87
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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 } 181 }
182 182
183 bool function_in_register = true; 183 bool function_in_register = true;
184 184
185 // Possibly allocate a local context. 185 // Possibly allocate a local context.
186 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 186 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
187 if (heap_slots > 0) { 187 if (heap_slots > 0) {
188 Comment cmnt(masm_, "[ Allocate context"); 188 Comment cmnt(masm_, "[ Allocate context");
189 bool need_write_barrier = true; 189 bool need_write_barrier = true;
190 // Argument to NewContext is the function, which is still in edi. 190 // Argument to NewContext is the function, which is still in edi.
191 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { 191 if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
192 __ push(edi); 192 __ push(edi);
193 __ Push(info->scope()->GetScopeInfo()); 193 __ Push(info->scope()->GetScopeInfo());
194 __ CallRuntime(Runtime::kNewGlobalContext, 2); 194 __ CallRuntime(Runtime::kNewScriptContext, 2);
195 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { 195 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
196 FastNewContextStub stub(isolate(), heap_slots); 196 FastNewContextStub stub(isolate(), heap_slots);
197 __ CallStub(&stub); 197 __ CallStub(&stub);
198 // Result of FastNewContextStub is always in new space. 198 // Result of FastNewContextStub is always in new space.
199 need_write_barrier = false; 199 need_write_barrier = false;
200 } else { 200 } else {
201 __ push(edi); 201 __ push(edi);
202 __ CallRuntime(Runtime::kNewFunctionContext, 1); 202 __ CallRuntime(Runtime::kNewFunctionContext, 1);
203 } 203 }
204 function_in_register = false; 204 function_in_register = false;
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
858 858
859 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { 859 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
860 Variable* variable = declaration->proxy()->var(); 860 Variable* variable = declaration->proxy()->var();
861 DCHECK(variable->location() == Variable::CONTEXT); 861 DCHECK(variable->location() == Variable::CONTEXT);
862 DCHECK(variable->interface()->IsFrozen()); 862 DCHECK(variable->interface()->IsFrozen());
863 863
864 Comment cmnt(masm_, "[ ModuleDeclaration"); 864 Comment cmnt(masm_, "[ ModuleDeclaration");
865 EmitDebugCheckDeclarationContext(variable); 865 EmitDebugCheckDeclarationContext(variable);
866 866
867 // Load instance object. 867 // Load instance object.
868 __ LoadContext(eax, scope_->ContextChainLength(scope_->GlobalScope())); 868 __ LoadContext(eax, scope_->ContextChainLength(scope_->ScriptScope()));
869 __ mov(eax, ContextOperand(eax, variable->interface()->Index())); 869 __ mov(eax, ContextOperand(eax, variable->interface()->Index()));
870 __ mov(eax, ContextOperand(eax, Context::EXTENSION_INDEX)); 870 __ mov(eax, ContextOperand(eax, Context::EXTENSION_INDEX));
871 871
872 // Assign it. 872 // Assign it.
873 __ mov(ContextOperand(esi, variable->index()), eax); 873 __ mov(ContextOperand(esi, variable->index()), eax);
874 // We know that we have written a module, which is not a smi. 874 // We know that we have written a module, which is not a smi.
875 __ RecordWriteContextSlot(esi, Context::SlotOffset(variable->index()), eax, 875 __ RecordWriteContextSlot(esi, Context::SlotOffset(variable->index()), eax,
876 ecx, kDontSaveFPRegs, EMIT_REMEMBERED_SET, 876 ecx, kDontSaveFPRegs, EMIT_REMEMBERED_SET,
877 OMIT_SMI_CHECK); 877 OMIT_SMI_CHECK);
878 PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS); 878 PrepareForBailoutForId(declaration->proxy()->id(), NO_REGISTERS);
(...skipping 4117 matching lines...) Expand 10 before | Expand all | Expand 10 after
4996 } 4996 }
4997 4997
4998 4998
4999 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { 4999 void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
5000 __ mov(dst, ContextOperand(esi, context_index)); 5000 __ mov(dst, ContextOperand(esi, context_index));
5001 } 5001 }
5002 5002
5003 5003
5004 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { 5004 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
5005 Scope* declaration_scope = scope()->DeclarationScope(); 5005 Scope* declaration_scope = scope()->DeclarationScope();
5006 if (declaration_scope->is_global_scope() || 5006 if (declaration_scope->is_script_scope() ||
5007 declaration_scope->is_module_scope()) { 5007 declaration_scope->is_module_scope()) {
5008 // Contexts nested in the native context have a canonical empty function 5008 // Contexts nested in the native context have a canonical empty function
5009 // as their closure, not the anonymous closure containing the global 5009 // as their closure, not the anonymous closure containing the global
5010 // code. Pass a smi sentinel and let the runtime look up the empty 5010 // code. Pass a smi sentinel and let the runtime look up the empty
5011 // function. 5011 // function.
5012 __ push(Immediate(Smi::FromInt(0))); 5012 __ push(Immediate(Smi::FromInt(0)));
5013 } else if (declaration_scope->is_eval_scope()) { 5013 } else if (declaration_scope->is_eval_scope()) {
5014 // Contexts nested inside eval code have the same closure as the context 5014 // Contexts nested inside eval code have the same closure as the context
5015 // calling eval, not the anonymous closure containing the eval code. 5015 // calling eval, not the anonymous closure containing the eval code.
5016 // Fetch it from the context. 5016 // Fetch it from the context.
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
5190 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5190 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5191 Assembler::target_address_at(call_target_address, 5191 Assembler::target_address_at(call_target_address,
5192 unoptimized_code)); 5192 unoptimized_code));
5193 return OSR_AFTER_STACK_CHECK; 5193 return OSR_AFTER_STACK_CHECK;
5194 } 5194 }
5195 5195
5196 5196
5197 } } // namespace v8::internal 5197 } } // namespace v8::internal
5198 5198
5199 #endif // V8_TARGET_ARCH_X87 5199 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/cctest/test-decls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698