Chromium Code Reviews| Index: src/ia32/full-codegen-ia32.cc |
| diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
| index e76806e4f9d8b73ab727edba7b85ec693f19b07f..56cfa369965916dd0e5972e405699a4e59a42258 100644 |
| --- a/src/ia32/full-codegen-ia32.cc |
| +++ b/src/ia32/full-codegen-ia32.cc |
| @@ -178,14 +178,22 @@ void FullCodeGenerator::Generate() { |
| // Possibly allocate a local context. |
| int heap_slots = info->scope()->num_heap_slots() - Context::MIN_CONTEXT_SLOTS; |
| if (heap_slots > 0) { |
| - Comment cmnt(masm_, "[ Allocate local context"); |
| - // Argument to NewContext is the function, which is still in edi. |
| - __ push(edi); |
| - if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
| - FastNewContextStub stub(heap_slots); |
| - __ CallStub(&stub); |
| + if (info->scope()->is_global_scope()) { |
| + Comment cmnt(masm_, "[ Allocate global context"); |
| + // Argument to NewContext is the function, which is still in edi. |
| + __ 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.
|
| + __ Push(info->scope()->GetScopeInfo()); |
| + __ CallRuntime(Runtime::kNewGlobalContext, 2); |
| } else { |
| - __ CallRuntime(Runtime::kNewFunctionContext, 1); |
| + Comment cmnt(masm_, "[ Allocate function context"); |
| + // Argument to NewContext is the function, which is still in edi. |
| + __ push(edi); |
| + if (heap_slots <= FastNewContextStub::kMaximumSlots) { |
| + FastNewContextStub stub(heap_slots); |
| + __ CallStub(&stub); |
| + } else { |
| + __ CallRuntime(Runtime::kNewFunctionContext, 1); |
| + } |
| } |
| function_in_register = false; |
| // Context is returned in both eax and esi. It replaces the context |