OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1091 Comment cmnt(masm_, "[ Block"); | 1091 Comment cmnt(masm_, "[ Block"); |
1092 NestedBlock nested_block(this, stmt); | 1092 NestedBlock nested_block(this, stmt); |
1093 SetStatementPosition(stmt); | 1093 SetStatementPosition(stmt); |
1094 | 1094 |
1095 Scope* saved_scope = scope(); | 1095 Scope* saved_scope = scope(); |
1096 // Push a block context when entering a block with block scoped variables. | 1096 // Push a block context when entering a block with block scoped variables. |
1097 if (stmt->scope() != NULL) { | 1097 if (stmt->scope() != NULL) { |
1098 scope_ = stmt->scope(); | 1098 scope_ = stmt->scope(); |
1099 ASSERT(!scope_->is_module_scope()); | 1099 ASSERT(!scope_->is_module_scope()); |
1100 { Comment cmnt(masm_, "[ Extend block context"); | 1100 { Comment cmnt(masm_, "[ Extend block context"); |
1101 Handle<ScopeInfo> scope_info = scope_->GetScopeInfo(); | 1101 __ Push(scope_->GetScopeInfo()); |
1102 int heap_slots = scope_info->ContextLength() - Context::MIN_CONTEXT_SLOTS; | |
1103 __ Push(scope_info); | |
1104 PushFunctionArgumentForContextAllocation(); | 1102 PushFunctionArgumentForContextAllocation(); |
1105 if (heap_slots <= FastNewBlockContextStub::kMaximumSlots) { | 1103 __ CallRuntime(Runtime::kPushBlockContext, 2); |
1106 FastNewBlockContextStub stub(heap_slots); | |
1107 __ CallStub(&stub); | |
1108 } else { | |
1109 __ CallRuntime(Runtime::kPushBlockContext, 2); | |
1110 } | |
1111 | 1104 |
1112 // Replace the context stored in the frame. | 1105 // Replace the context stored in the frame. |
1113 StoreToFrameField(StandardFrameConstants::kContextOffset, | 1106 StoreToFrameField(StandardFrameConstants::kContextOffset, |
1114 context_register()); | 1107 context_register()); |
1115 } | 1108 } |
1116 { Comment cmnt(masm_, "[ Declarations"); | 1109 { Comment cmnt(masm_, "[ Declarations"); |
1117 VisitDeclarations(scope_->declarations()); | 1110 VisitDeclarations(scope_->declarations()); |
1118 } | 1111 } |
1119 } | 1112 } |
1120 | 1113 |
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1746 } | 1739 } |
1747 return true; | 1740 return true; |
1748 } | 1741 } |
1749 #endif // DEBUG | 1742 #endif // DEBUG |
1750 | 1743 |
1751 | 1744 |
1752 #undef __ | 1745 #undef __ |
1753 | 1746 |
1754 | 1747 |
1755 } } // namespace v8::internal | 1748 } } // namespace v8::internal |
OLD | NEW |