OLD | NEW |
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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/code-factory.h" | 8 #include "src/code-factory.h" |
9 #include "src/code-stubs.h" | 9 #include "src/code-stubs.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 CallStoreIC(); | 1129 CallStoreIC(); |
1130 } | 1130 } |
1131 | 1131 |
1132 | 1132 |
1133 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, | 1133 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
1134 TypeofMode typeof_mode, | 1134 TypeofMode typeof_mode, |
1135 Label* slow) { | 1135 Label* slow) { |
1136 Register context = rsi; | 1136 Register context = rsi; |
1137 Register temp = rdx; | 1137 Register temp = rdx; |
1138 | 1138 |
1139 Scope* s = scope(); | 1139 int to_check = scope()->ContextChainLengthUntilOutermostSloppyEval(); |
1140 while (s != NULL) { | 1140 for (Scope* s = scope(); to_check > 0; s = s->outer_scope()) { |
1141 if (s->num_heap_slots() > 0) { | 1141 if (!s->NeedsContext()) continue; |
1142 if (s->calls_sloppy_eval()) { | 1142 if (s->calls_sloppy_eval()) { |
1143 // Check that extension is "the hole". | 1143 // Check that extension is "the hole". |
1144 __ JumpIfNotRoot(ContextOperand(context, Context::EXTENSION_INDEX), | 1144 __ JumpIfNotRoot(ContextOperand(context, Context::EXTENSION_INDEX), |
1145 Heap::kTheHoleValueRootIndex, slow); | 1145 Heap::kTheHoleValueRootIndex, slow); |
1146 } | |
1147 // Load next context in chain. | |
1148 __ movp(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); | |
1149 // Walk the rest of the chain without clobbering rsi. | |
1150 context = temp; | |
1151 } | 1146 } |
1152 // If no outer scope calls eval, we do not need to check more | 1147 // Load next context in chain. |
1153 // context extensions. | 1148 __ movp(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
1154 if (!s->outer_scope_calls_sloppy_eval()) break; | 1149 // Walk the rest of the chain without clobbering rsi. |
1155 s = s->outer_scope(); | 1150 context = temp; |
| 1151 to_check--; |
1156 } | 1152 } |
1157 | 1153 |
1158 // All extension objects were empty and it is safe to use a normal global | 1154 // All extension objects were empty and it is safe to use a normal global |
1159 // load machinery. | 1155 // load machinery. |
1160 EmitGlobalVariableLoad(proxy, typeof_mode); | 1156 EmitGlobalVariableLoad(proxy, typeof_mode); |
1161 } | 1157 } |
1162 | 1158 |
1163 | 1159 |
1164 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1160 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
1165 Label* slow) { | 1161 Label* slow) { |
(...skipping 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3640 DCHECK_EQ( | 3636 DCHECK_EQ( |
3641 isolate->builtins()->OnStackReplacement()->entry(), | 3637 isolate->builtins()->OnStackReplacement()->entry(), |
3642 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3638 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3643 return ON_STACK_REPLACEMENT; | 3639 return ON_STACK_REPLACEMENT; |
3644 } | 3640 } |
3645 | 3641 |
3646 } // namespace internal | 3642 } // namespace internal |
3647 } // namespace v8 | 3643 } // namespace v8 |
3648 | 3644 |
3649 #endif // V8_TARGET_ARCH_X64 | 3645 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |