OLD | NEW |
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 17 matching lines...) Expand all Loading... |
28 #include "v8.h" | 28 #include "v8.h" |
29 | 29 |
30 #include "codegen.h" | 30 #include "codegen.h" |
31 #include "compiler.h" | 31 #include "compiler.h" |
32 #include "debug.h" | 32 #include "debug.h" |
33 #include "full-codegen.h" | 33 #include "full-codegen.h" |
34 #include "liveedit.h" | 34 #include "liveedit.h" |
35 #include "macro-assembler.h" | 35 #include "macro-assembler.h" |
36 #include "prettyprinter.h" | 36 #include "prettyprinter.h" |
37 #include "scopes.h" | 37 #include "scopes.h" |
| 38 #include "scopeinfo.h" |
38 #include "stub-cache.h" | 39 #include "stub-cache.h" |
39 | 40 |
40 namespace v8 { | 41 namespace v8 { |
41 namespace internal { | 42 namespace internal { |
42 | 43 |
43 void BreakableStatementChecker::Check(Statement* stmt) { | 44 void BreakableStatementChecker::Check(Statement* stmt) { |
44 Visit(stmt); | 45 Visit(stmt); |
45 } | 46 } |
46 | 47 |
47 | 48 |
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 ASSERT(forward_bailout_pending_ == NULL); | 841 ASSERT(forward_bailout_pending_ == NULL); |
841 } | 842 } |
842 } | 843 } |
843 | 844 |
844 | 845 |
845 void FullCodeGenerator::VisitBlock(Block* stmt) { | 846 void FullCodeGenerator::VisitBlock(Block* stmt) { |
846 Comment cmnt(masm_, "[ Block"); | 847 Comment cmnt(masm_, "[ Block"); |
847 Breakable nested_statement(this, stmt); | 848 Breakable nested_statement(this, stmt); |
848 SetStatementPosition(stmt); | 849 SetStatementPosition(stmt); |
849 | 850 |
| 851 Scope* saved_scope = scope(); |
| 852 if (stmt->block_scope() != NULL) { |
| 853 { Comment cmnt(masm_, "[ Extend block context"); |
| 854 scope_ = stmt->block_scope(); |
| 855 __ Push(scope_->GetSerializedScopeInfo()); |
| 856 PushFunctionArgumentForContextAllocation(); |
| 857 __ CallRuntime(Runtime::kPushBlockContext, 2); |
| 858 StoreToFrameField(StandardFrameConstants::kContextOffset, |
| 859 context_register()); |
| 860 } |
| 861 { Comment cmnt(masm_, "[ Declarations"); |
| 862 VisitDeclarations(scope_->declarations()); |
| 863 } |
| 864 } |
850 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); | 865 PrepareForBailoutForId(stmt->EntryId(), NO_REGISTERS); |
851 VisitStatements(stmt->statements()); | 866 VisitStatements(stmt->statements()); |
| 867 scope_ = saved_scope; |
852 __ bind(nested_statement.break_target()); | 868 __ bind(nested_statement.break_target()); |
853 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); | 869 PrepareForBailoutForId(stmt->ExitId(), NO_REGISTERS); |
854 } | 870 } |
855 | 871 |
856 | 872 |
857 void FullCodeGenerator::VisitExpressionStatement(ExpressionStatement* stmt) { | 873 void FullCodeGenerator::VisitExpressionStatement(ExpressionStatement* stmt) { |
858 Comment cmnt(masm_, "[ ExpressionStatement"); | 874 Comment cmnt(masm_, "[ ExpressionStatement"); |
859 SetStatementPosition(stmt); | 875 SetStatementPosition(stmt); |
860 VisitForEffect(stmt->expression()); | 876 VisitForEffect(stmt->expression()); |
861 } | 877 } |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1334 } | 1350 } |
1335 | 1351 |
1336 return false; | 1352 return false; |
1337 } | 1353 } |
1338 | 1354 |
1339 | 1355 |
1340 #undef __ | 1356 #undef __ |
1341 | 1357 |
1342 | 1358 |
1343 } } // namespace v8::internal | 1359 } } // namespace v8::internal |
OLD | NEW |