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

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

Issue 10876067: Introduce global contexts to represent lexical global scope(s). (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 3 months 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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 __ push(eax); 171 __ push(eax);
172 } 172 }
173 } 173 }
174 } 174 }
175 175
176 bool function_in_register = true; 176 bool function_in_register = true;
177 177
178 // Possibly allocate a local context. 178 // Possibly allocate a local context.
179 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; 179 int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS;
180 if (heap_slots > 0) { 180 if (heap_slots > 0) {
181 Comment cmnt(masm_, "[ Allocate local context"); 181 if (info->scope()->is_global_scope()) {
182 // Argument to NewContext is the function, which is still in edi. 182 Comment cmnt(masm_, "[ Allocate global context");
183 __ push(edi); 183 // Argument to NewContext is the function, which is still in edi.
184 if (heap_slots <= FastNewContextStub::kMaximumSlots) { 184 __ push(edi);
Sven Panne 2012/08/27 06:24:54 Consider moving the push before the if.
rossberg 2012/08/27 09:07:16 Done.
185 FastNewContextStub stub(heap_slots); 185 __ Push(info->scope()->GetScopeInfo());
186 __ CallStub(&stub); 186 __ CallRuntime(Runtime::kNewGlobalContext, 2);
187 } else { 187 } else {
188 __ CallRuntime(Runtime::kNewFunctionContext, 1); 188 Comment cmnt(masm_, "[ Allocate function context");
189 // Argument to NewContext is the function, which is still in edi.
190 __ push(edi);
191 if (heap_slots <= FastNewContextStub::kMaximumSlots) {
192 FastNewContextStub stub(heap_slots);
193 __ CallStub(&stub);
194 } else {
195 __ CallRuntime(Runtime::kNewFunctionContext, 1);
196 }
189 } 197 }
190 function_in_register = false; 198 function_in_register = false;
191 // Context is returned in both eax and esi. It replaces the context 199 // Context is returned in both eax and esi. It replaces the context
192 // passed to us. It's saved in the stack and kept live in esi. 200 // passed to us. It's saved in the stack and kept live in esi.
193 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi); 201 __ mov(Operand(ebp, StandardFrameConstants::kContextOffset), esi);
194 202
195 // Copy parameters into context if necessary. 203 // Copy parameters into context if necessary.
196 int num_parameters = info->scope()->num_parameters(); 204 int num_parameters = info->scope()->num_parameters();
197 for (int i = 0; i < num_parameters; i++) { 205 for (int i = 0; i < num_parameters; i++) {
198 Variable* var = scope()->parameter(i); 206 Variable* var = scope()->parameter(i);
(...skipping 4344 matching lines...) Expand 10 before | Expand all | Expand 10 after
4543 *stack_depth = 0; 4551 *stack_depth = 0;
4544 *context_length = 0; 4552 *context_length = 0;
4545 return previous_; 4553 return previous_;
4546 } 4554 }
4547 4555
4548 #undef __ 4556 #undef __
4549 4557
4550 } } // namespace v8::internal 4558 } } // namespace v8::internal
4551 4559
4552 #endif // V8_TARGET_ARCH_IA32 4560 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698