Chromium Code Reviews| Index: src/x64/full-codegen-x64.cc |
| diff --git a/src/x64/full-codegen-x64.cc b/src/x64/full-codegen-x64.cc |
| index cbd6b277bb1b2cb812f3e99e923c4a3b0c6f5a54..33495216a25b4f31ecc5e0af996fe08dc8d624dc 100644 |
| --- a/src/x64/full-codegen-x64.cc |
| +++ b/src/x64/full-codegen-x64.cc |
| @@ -174,14 +174,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 rdi. |
| - __ push(rdi); |
| - 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. |
|
Sven Panne
2012/08/27 06:24:54
copy-n-paste typo: should be rdi. Consider moving
rossberg
2012/08/27 09:07:16
Done.
|
| + __ push(rdi); |
| + __ 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(rdi); |
| + 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 rax and rsi. It replaces the context |