| 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 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 void FullCodeGenerator::VisitBlock(Block* stmt) { | 809 void FullCodeGenerator::VisitBlock(Block* stmt) { |
| 810 Comment cmnt(masm_, "[ Block"); | 810 Comment cmnt(masm_, "[ Block"); |
| 811 NestedBlock nested_block(this, stmt); | 811 NestedBlock nested_block(this, stmt); |
| 812 SetStatementPosition(stmt); | 812 SetStatementPosition(stmt); |
| 813 | 813 |
| 814 Scope* saved_scope = scope(); | 814 Scope* saved_scope = scope(); |
| 815 // Push a block context when entering a block with block scoped variables. | 815 // Push a block context when entering a block with block scoped variables. |
| 816 if (stmt->block_scope() != NULL) { | 816 if (stmt->block_scope() != NULL) { |
| 817 { Comment cmnt(masm_, "[ Extend block context"); | 817 { Comment cmnt(masm_, "[ Extend block context"); |
| 818 scope_ = stmt->block_scope(); | 818 scope_ = stmt->block_scope(); |
| 819 Handle<SerializedScopeInfo> scope_info = scope_->GetSerializedScopeInfo(); | 819 Handle<ScopeInfo> scope_info = scope_->GetScopeInfo(); |
| 820 int heap_slots = | 820 int heap_slots = scope_info->ContextLength() - Context::MIN_CONTEXT_SLOTS; |
| 821 scope_info->NumberOfContextSlots() - Context::MIN_CONTEXT_SLOTS; | |
| 822 __ Push(scope_info); | 821 __ Push(scope_info); |
| 823 PushFunctionArgumentForContextAllocation(); | 822 PushFunctionArgumentForContextAllocation(); |
| 824 if (heap_slots <= FastNewBlockContextStub::kMaximumSlots) { | 823 if (heap_slots <= FastNewBlockContextStub::kMaximumSlots) { |
| 825 FastNewBlockContextStub stub(heap_slots); | 824 FastNewBlockContextStub stub(heap_slots); |
| 826 __ CallStub(&stub); | 825 __ CallStub(&stub); |
| 827 } else { | 826 } else { |
| 828 __ CallRuntime(Runtime::kPushBlockContext, 2); | 827 __ CallRuntime(Runtime::kPushBlockContext, 2); |
| 829 } | 828 } |
| 830 | 829 |
| 831 // Replace the context stored in the frame. | 830 // Replace the context stored in the frame. |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1329 } | 1328 } |
| 1330 | 1329 |
| 1331 return false; | 1330 return false; |
| 1332 } | 1331 } |
| 1333 | 1332 |
| 1334 | 1333 |
| 1335 #undef __ | 1334 #undef __ |
| 1336 | 1335 |
| 1337 | 1336 |
| 1338 } } // namespace v8::internal | 1337 } } // namespace v8::internal |
| OLD | NEW |