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: 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
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 4127 matching lines...) Expand 10 before | Expand all | Expand 10 after
5036 } 5036 }
5037 5037
5038 5038
5039 void FullCodeGenerator::LoadContextField(Register dst, int context_index) { 5039 void FullCodeGenerator::LoadContextField(Register dst, int context_index) {
5040 __ movp(dst, ContextOperand(rsi, context_index)); 5040 __ movp(dst, ContextOperand(rsi, context_index));
5041 } 5041 }
5042 5042
5043 5043
5044 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() { 5044 void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
5045 Scope* declaration_scope = scope()->DeclarationScope(); 5045 Scope* declaration_scope = scope()->DeclarationScope();
5046 if (declaration_scope->is_global_scope() || 5046 if (declaration_scope->is_script_scope() ||
5047 declaration_scope->is_module_scope()) { 5047 declaration_scope->is_module_scope()) {
5048 // Contexts nested in the native context have a canonical empty function 5048 // Contexts nested in the native context have a canonical empty function
5049 // as their closure, not the anonymous closure containing the global 5049 // as their closure, not the anonymous closure containing the global
5050 // code. Pass a smi sentinel and let the runtime look up the empty 5050 // code. Pass a smi sentinel and let the runtime look up the empty
5051 // function. 5051 // function.
5052 __ Push(Smi::FromInt(0)); 5052 __ Push(Smi::FromInt(0));
5053 } else if (declaration_scope->is_eval_scope()) { 5053 } else if (declaration_scope->is_eval_scope()) {
5054 // Contexts created by a call to eval have the same closure as the 5054 // Contexts created by a call to eval have the same closure as the
5055 // context calling eval, not the anonymous closure containing the eval 5055 // context calling eval, not the anonymous closure containing the eval
5056 // code. Fetch it from the context. 5056 // code. Fetch it from the context.
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
5234 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5234 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5235 Assembler::target_address_at(call_target_address, 5235 Assembler::target_address_at(call_target_address,
5236 unoptimized_code)); 5236 unoptimized_code));
5237 return OSR_AFTER_STACK_CHECK; 5237 return OSR_AFTER_STACK_CHECK;
5238 } 5238 }
5239 5239
5240 5240
5241 } } // namespace v8::internal 5241 } } // namespace v8::internal
5242 5242
5243 #endif // V8_TARGET_ARCH_X64 5243 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/scopes.cc ('K') | « 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