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

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

Issue 7835027: Getting rid of ExitContextStatement for scoped blocks. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 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
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after
848 } 848 }
849 } 849 }
850 850
851 851
852 void FullCodeGenerator::VisitBlock(Block* stmt) { 852 void FullCodeGenerator::VisitBlock(Block* stmt) {
853 Comment cmnt(masm_, "[ Block"); 853 Comment cmnt(masm_, "[ Block");
854 NestedBlock nested_block(this, stmt); 854 NestedBlock nested_block(this, stmt);
855 SetStatementPosition(stmt); 855 SetStatementPosition(stmt);
856 856
857 Scope* saved_scope = scope(); 857 Scope* saved_scope = scope();
858 // Push a block context when entering a block with block scoped variables.
858 if (stmt->block_scope() != NULL) { 859 if (stmt->block_scope() != NULL) {
859 { Comment cmnt(masm_, "[ Extend block context"); 860 { Comment cmnt(masm_, "[ Extend block context");
860 scope_ = stmt->block_scope(); 861 scope_ = stmt->block_scope();
861 __ Push(scope_->GetSerializedScopeInfo()); 862 __ Push(scope_->GetSerializedScopeInfo());
862 PushFunctionArgumentForContextAllocation(); 863 PushFunctionArgumentForContextAllocation();
863 __ CallRuntime(Runtime::kPushBlockContext, 2); 864 __ CallRuntime(Runtime::kPushBlockContext, 2);
864 StoreToFrameField(StandardFrameConstants::kContextOffset, 865 StoreToFrameField(StandardFrameConstants::kContextOffset,
865 context_register()); 866 context_register());
866 } 867 }
867 { Comment cmnt(masm_, "[ Declarations"); 868 { Comment cmnt(masm_, "[ Declarations");
868 VisitDeclarations(scope_->declarations()); 869 VisitDeclarations(scope_->declarations());
869 } 870 }
870 } 871 }
871 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); 872 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
872 VisitStatements(stmt->statements()); 873 VisitStatements(stmt->statements());
873 scope_ = saved_scope; 874 scope_ = saved_scope;
874 __ bind(nested_block.break_label()); 875 __ bind(nested_block.break_label());
875 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); 876 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
877
878 // Pop block context if necessary.
879 if (stmt->block_scope() != NULL) {
880 LoadContextField(context_register(), Context::PREVIOUS_INDEX);
881 // Update local stack frame context field.
882 StoreToFrameField(StandardFrameConstants::kContextOffset,
883 context_register());
884 }
876 } 885 }
877 886
878 887
879 void FullCodeGenerator::VisitExpressionStatement(ExpressionStatement* stmt) { 888 void FullCodeGenerator::VisitExpressionStatement(ExpressionStatement* stmt) {
880 Comment cmnt(masm_, "[ ExpressionStatement"); 889 Comment cmnt(masm_, "[ ExpressionStatement");
881 SetStatementPosition(stmt); 890 SetStatementPosition(stmt);
882 VisitForEffect(stmt->expression()); 891 VisitForEffect(stmt->expression());
883 } 892 }
884 893
885 894
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 } 1401 }
1393 1402
1394 return false; 1403 return false;
1395 } 1404 }
1396 1405
1397 1406
1398 #undef __ 1407 #undef __
1399 1408
1400 1409
1401 } } // namespace v8::internal 1410 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698