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

Side by Side Diff: src/x64/full-codegen-x64.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/variables.cc ('k') | src/x87/full-codegen-x87.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_X64 7 #if V8_TARGET_ARCH_X64
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 } 180 }
181 181
182 bool function_in_register = true; 182 bool function_in_register = true;
183 183
184 // Possibly allocate a local context. 184 // Possibly allocate a local context.
185 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 185 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
186 if (heap_slots > 0) { 186 if (heap_slots > 0) {
187 Comment cmnt(masm_, "[ Allocate context"); 187 Comment cmnt(masm_, "[ Allocate context");
188 bool need_write_barrier = true; 188 bool need_write_barrier = true;
189 // Argument to NewContext is the function, which is still in rdi. 189 // Argument to NewContext is the function, which is still in rdi.
190 if (FLAG_harmony_scoping && info->scope()->is_global_scope()) { 190 if (FLAG_harmony_scoping && info->scope()->is_script_scope()) {
191 __ Push(rdi); 191 __ Push(rdi);
192 __ Push(info->scope()->GetScopeInfo()); 192 __ Push(info->scope()->GetScopeInfo());
193 __ CallRuntime(Runtime::kNewGlobalContext, 2); 193 __ CallRuntime(Runtime::kNewScriptContext, 2);
194 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) { 194 } else if (heap_slots <= FastNewContextStub::kMaximumSlots) {
195 FastNewContextStub stub(isolate(), heap_slots); 195 FastNewContextStub stub(isolate(), heap_slots);
196 __ CallStub(&stub); 196 __ CallStub(&stub);
197 // Result of FastNewContextStub is always in new space. 197 // Result of FastNewContextStub is always in new space.
198 need_write_barrier = false; 198 need_write_barrier = false;
199 } else { 199 } else {
200 __ Push(rdi); 200 __ Push(rdi);
201 __ CallRuntime(Runtime::kNewFunctionContext, 1); 201 __ CallRuntime(Runtime::kNewFunctionContext, 1);
202 } 202 }
203 function_in_register = false; 203 function_in_register = false;
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 888
889 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) { 889 void FullCodeGenerator::VisitModuleDeclaration(ModuleDeclaration* declaration) {
890 Variable* variable = declaration->proxy()->var(); 890 Variable* variable = declaration->proxy()->var();
891 DCHECK(variable->location() == Variable::CONTEXT); 891 DCHECK(variable->location() == Variable::CONTEXT);
892 DCHECK(variable->interface()->IsFrozen()); 892 DCHECK(variable->interface()->IsFrozen());
893 893
894 Comment cmnt(masm_, "[ ModuleDeclaration"); 894 Comment cmnt(masm_, "[ ModuleDeclaration");
895 EmitDebugCheckDeclarationContext(variable); 895 EmitDebugCheckDeclarationContext(variable);
896 896
897 // Load instance object. 897 // Load instance object.
898 __ LoadContext(rax, scope_->ContextChainLength(scope_->GlobalScope())); 898 __ LoadContext(rax, scope_->ContextChainLength(scope_->ScriptScope()));
899 __ movp(rax, ContextOperand(rax, variable->interface()->Index())); 899 __ movp(rax, ContextOperand(rax, variable->interface()->Index()));
900 __ movp(rax, ContextOperand(rax, Context::EXTENSION_INDEX)); 900 __ movp(rax, ContextOperand(rax, Context::EXTENSION_INDEX));
901 901
902 // Assign it. 902 // Assign it.
903 __ movp(ContextOperand(rsi, variable->index()), rax); 903 __ movp(ContextOperand(rsi, variable->index()), rax);
904 // We know that we have written a module, which is not a smi. 904 // We know that we have written a module, which is not a smi.
905 __ RecordWriteContextSlot(rsi, 905 __ RecordWriteContextSlot(rsi,
906 Context::SlotOffset(variable->index()), 906 Context::SlotOffset(variable->index()),
907 rax, 907 rax,
908 rcx, 908 rcx,
(...skipping 4113 matching lines...) Expand 10 before | Expand all | Expand 10 after
5022 } 5022 }
5023 5023
5024 5024
5025 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { 5025 void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
5026 __ movp(dst, ContextOperand(rsi, context_index)); 5026 __ movp(dst, ContextOperand(rsi, context_index));
5027 } 5027 }
5028 5028
5029 5029
5030 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { 5030 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
5031 Scope* declaration_scope = scope()->DeclarationScope(); 5031 Scope* declaration_scope = scope()->DeclarationScope();
5032 if (declaration_scope->is_global_scope() || 5032 if (declaration_scope->is_script_scope() ||
5033 declaration_scope->is_module_scope()) { 5033 declaration_scope->is_module_scope()) {
5034 // Contexts nested in the native context have a canonical empty function 5034 // Contexts nested in the native context have a canonical empty function
5035 // as their closure, not the anonymous closure containing the global 5035 // as their closure, not the anonymous closure containing the global
5036 // code. Pass a smi sentinel and let the runtime look up the empty 5036 // code. Pass a smi sentinel and let the runtime look up the empty
5037 // function. 5037 // function.
5038 __ Push(Smi::FromInt(0)); 5038 __ Push(Smi::FromInt(0));
5039 } else if (declaration_scope->is_eval_scope()) { 5039 } else if (declaration_scope->is_eval_scope()) {
5040 // Contexts created by a call to eval have the same closure as the 5040 // Contexts created by a call to eval have the same closure as the
5041 // context calling eval, not the anonymous closure containing the eval 5041 // context calling eval, not the anonymous closure containing the eval
5042 // code. Fetch it from the context. 5042 // code. Fetch it from the context.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
5220 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5220 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5221 Assembler::target_address_at(call_target_address, 5221 Assembler::target_address_at(call_target_address,
5222 unoptimized_code)); 5222 unoptimized_code));
5223 return OSR_AFTER_STACK_CHECK; 5223 return OSR_AFTER_STACK_CHECK;
5224 } 5224 }
5225 5225
5226 5226
5227 } } // namespace v8::internal 5227 } } // namespace v8::internal
5228 5228
5229 #endif // V8_TARGET_ARCH_X64 5229 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/variables.cc ('k') | src/x87/full-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698