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

Unified Diff: src/full-codegen.cc

Issue 981203003: Stack allocate lexical locals + hoist stack slots (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Feedback + rebased Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/full-codegen.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen.cc
diff --git a/src/full-codegen.cc b/src/full-codegen.cc
index 5b1154ca2083010a75e415819efd8853b72278a2..08fe7a78448b6615fb9cadb75f768ca11872861d 100644
--- a/src/full-codegen.cc
+++ b/src/full-codegen.cc
@@ -1814,22 +1814,27 @@ bool BackEdgeTable::Verify(Isolate* isolate, Code* unoptimized) {
FullCodeGenerator::EnterBlockScopeIfNeeded::EnterBlockScopeIfNeeded(
FullCodeGenerator* codegen, Scope* scope, BailoutId entry_id,
BailoutId declarations_id, BailoutId exit_id)
- : codegen_(codegen), scope_(scope), exit_id_(exit_id) {
+ : codegen_(codegen), exit_id_(exit_id) {
saved_scope_ = codegen_->scope();
if (scope == NULL) {
codegen_->PrepareForBailoutForId(entry_id, NO_REGISTERS);
+ needs_block_context_ = false;
} else {
+ needs_block_context_ = scope->ContextLocalCount() > 0;
codegen_->scope_ = scope;
{
- Comment cmnt(masm(), "[ Extend block context");
- __ Push(scope->GetScopeInfo(codegen->isolate()));
- codegen_->PushFunctionArgumentForContextAllocation();
- __ CallRuntime(Runtime::kPushBlockContext, 2);
-
- // Replace the context stored in the frame.
- codegen_->StoreToFrameField(StandardFrameConstants::kContextOffset,
- codegen_->context_register());
+ if (needs_block_context_) {
+ Comment cmnt(masm(), "[ Extend block context");
+ __ Push(scope->GetScopeInfo(codegen->isolate()));
+ codegen_->PushFunctionArgumentForContextAllocation();
+ __ CallRuntime(Runtime::kPushBlockContext, 2);
+
+ // Replace the context stored in the frame.
+ codegen_->StoreToFrameField(StandardFrameConstants::kContextOffset,
+ codegen_->context_register());
+ }
+ CHECK_EQ(0, scope->num_stack_slots());
codegen_->PrepareForBailoutForId(entry_id, NO_REGISTERS);
}
{
@@ -1842,7 +1847,7 @@ FullCodeGenerator::EnterBlockScopeIfNeeded::EnterBlockScopeIfNeeded(
FullCodeGenerator::EnterBlockScopeIfNeeded::~EnterBlockScopeIfNeeded() {
- if (scope_ != NULL) {
+ if (needs_block_context_) {
codegen_->LoadContextField(codegen_->context_register(),
Context::PREVIOUS_INDEX);
// Update local stack frame context field.
« no previous file with comments | « src/full-codegen.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698