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

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

Issue 307593002: Preliminary support for block contexts in hydrogen. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Port to other architectures Created 6 years, 6 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 | « src/ast.h ('k') | src/hydrogen.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/compiler.h" 8 #include "src/compiler.h"
9 #include "src/debug.h" 9 #include "src/debug.h"
10 #include "src/full-codegen.h" 10 #include "src/full-codegen.h"
(...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 } 1045 }
1046 1046
1047 1047
1048 void FullCodeGenerator::VisitBlock(Block* stmt) { 1048 void FullCodeGenerator::VisitBlock(Block* stmt) {
1049 Comment cmnt(masm_, "[ Block"); 1049 Comment cmnt(masm_, "[ Block");
1050 NestedBlock nested_block(this, stmt); 1050 NestedBlock nested_block(this, stmt);
1051 SetStatementPosition(stmt); 1051 SetStatementPosition(stmt);
1052 1052
1053 Scope* saved_scope = scope(); 1053 Scope* saved_scope = scope();
1054 // Push a block context when entering a block with block scoped variables. 1054 // Push a block context when entering a block with block scoped variables.
1055 if (stmt->scope() != NULL) { 1055 if (stmt->scope() == NULL) {
1056 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
1057 } else {
1056 scope_ = stmt->scope(); 1058 scope_ = stmt->scope();
1057 ASSERT(!scope_->is_module_scope()); 1059 ASSERT(!scope_->is_module_scope());
1058 { Comment cmnt(masm_, "[ Extend block context"); 1060 { Comment cmnt(masm_, "[ Extend block context");
1059 __ Push(scope_->GetScopeInfo()); 1061 __ Push(scope_->GetScopeInfo());
1060 PushFunctionArgumentForContextAllocation(); 1062 PushFunctionArgumentForContextAllocation();
1061 __ CallRuntime(Runtime::kHiddenPushBlockContext, 2); 1063 __ CallRuntime(Runtime::kHiddenPushBlockContext, 2);
1062 1064
1063 // Replace the context stored in the frame. 1065 // Replace the context stored in the frame.
1064 StoreToFrameField(StandardFrameConstants::kContextOffset, 1066 StoreToFrameField(StandardFrameConstants::kContextOffset,
1065 context_register()); 1067 context_register());
1068 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
1066 } 1069 }
1067 { Comment cmnt(masm_, "[ Declarations"); 1070 { Comment cmnt(masm_, "[ Declarations");
1068 VisitDeclarations(scope_->declarations()); 1071 VisitDeclarations(scope_->declarations());
1072 PrepareForBailoutForId(stmt->DeclsId(), NO_REGISTERS);
1069 } 1073 }
1070 } 1074 }
1071 1075
1072 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS);
1073 VisitStatements(stmt->statements()); 1076 VisitStatements(stmt->statements());
1074 scope_ = saved_scope; 1077 scope_ = saved_scope;
1075 __ bind(nested_block.break_label()); 1078 __ bind(nested_block.break_label());
1076 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
1077 1079
1078 // Pop block context if necessary. 1080 // Pop block context if necessary.
1079 if (stmt->scope() != NULL) { 1081 if (stmt->scope() != NULL) {
1080 LoadContextField(context_register(), Context::PREVIOUS_INDEX); 1082 LoadContextField(context_register(), Context::PREVIOUS_INDEX);
1081 // Update local stack frame context field. 1083 // Update local stack frame context field.
1082 StoreToFrameField(StandardFrameConstants::kContextOffset, 1084 StoreToFrameField(StandardFrameConstants::kContextOffset,
1083 context_register()); 1085 context_register());
1084 } 1086 }
1087 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS);
1085 } 1088 }
1086 1089
1087 1090
1088 void FullCodeGenerator::VisitModuleStatement(ModuleStatement* stmt) { 1091 void FullCodeGenerator::VisitModuleStatement(ModuleStatement* stmt) {
1089 Comment cmnt(masm_, "[ Module context"); 1092 Comment cmnt(masm_, "[ Module context");
1090 1093
1091 __ Push(Smi::FromInt(stmt->proxy()->interface()->Index())); 1094 __ Push(Smi::FromInt(stmt->proxy()->interface()->Index()));
1092 __ Push(Smi::FromInt(0)); 1095 __ Push(Smi::FromInt(0));
1093 __ CallRuntime(Runtime::kHiddenPushModuleContext, 2); 1096 __ CallRuntime(Runtime::kHiddenPushModuleContext, 2);
1094 StoreToFrameField( 1097 StoreToFrameField(
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
1697 } 1700 }
1698 return true; 1701 return true;
1699 } 1702 }
1700 #endif // DEBUG 1703 #endif // DEBUG
1701 1704
1702 1705
1703 #undef __ 1706 #undef __
1704 1707
1705 1708
1706 } } // namespace v8::internal 1709 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698