Index: src/full-codegen.cc |
diff --git a/src/full-codegen.cc b/src/full-codegen.cc |
index 4101b29f507719905fa648fb50f58b2144e08b82..72bf57d0786e1a1185c07d060c9184f153313e59 100644 |
--- a/src/full-codegen.cc |
+++ b/src/full-codegen.cc |
@@ -818,9 +818,19 @@ void FullCodeGenerator::VisitBlock(Block* stmt) { |
if (stmt->block_scope() != NULL) { |
{ Comment cmnt(masm_, "[ Extend block context"); |
scope_ = stmt->block_scope(); |
- __ Push(scope_->GetSerializedScopeInfo()); |
+ Handle<SerializedScopeInfo> scope_info = scope_->GetSerializedScopeInfo(); |
+ int heap_slots = |
+ scope_info->NumberOfContextSlots() - Context::MIN_CONTEXT_SLOTS; |
+ __ Push(scope_info); |
PushFunctionArgumentForContextAllocation(); |
- __ CallRuntime(Runtime::kPushBlockContext, 2); |
+ if (heap_slots <= FastNewBlockContextStub::kMaximumSlots) { |
+ FastNewBlockContextStub stub(heap_slots); |
+ __ CallStub(&stub); |
+ } else { |
+ __ CallRuntime(Runtime::kPushBlockContext, 2); |
+ } |
+ |
+ // Replace the context stored in the frame. |
StoreToFrameField(StandardFrameConstants::kContextOffset, |
context_register()); |
} |