| 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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 } | 1146 } |
| 1147 // Load next context in chain. | 1147 // Load next context in chain. |
| 1148 __ movp(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); | 1148 __ movp(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
| 1149 // Walk the rest of the chain without clobbering rsi. | 1149 // Walk the rest of the chain without clobbering rsi. |
| 1150 context = temp; | 1150 context = temp; |
| 1151 } | 1151 } |
| 1152 // If no outer scope calls eval, we do not need to check more | 1152 // If no outer scope calls eval, we do not need to check more |
| 1153 // context extensions. If we have reached an eval scope, we check | 1153 // context extensions. |
| 1154 // all extensions from this point. | 1154 if (!s->outer_scope_calls_sloppy_eval()) break; |
| 1155 if (!s->outer_scope_calls_sloppy_eval() || s->is_eval_scope()) break; | |
| 1156 s = s->outer_scope(); | 1155 s = s->outer_scope(); |
| 1157 } | 1156 } |
| 1158 | 1157 |
| 1159 if (s != NULL && s->is_eval_scope()) { | |
| 1160 // Loop up the context chain. There is no frame effect so it is | |
| 1161 // safe to use raw labels here. | |
| 1162 Label next, fast; | |
| 1163 if (!context.is(temp)) { | |
| 1164 __ movp(temp, context); | |
| 1165 } | |
| 1166 // Load map for comparison into register, outside loop. | |
| 1167 __ LoadRoot(kScratchRegister, Heap::kNativeContextMapRootIndex); | |
| 1168 __ bind(&next); | |
| 1169 // Terminate at native context. | |
| 1170 __ cmpp(kScratchRegister, FieldOperand(temp, HeapObject::kMapOffset)); | |
| 1171 __ j(equal, &fast, Label::kNear); | |
| 1172 // Check that extension is "the hole". | |
| 1173 __ JumpIfNotRoot(ContextOperand(temp, Context::EXTENSION_INDEX), | |
| 1174 Heap::kTheHoleValueRootIndex, slow); | |
| 1175 // Load next context in chain. | |
| 1176 __ movp(temp, ContextOperand(temp, Context::PREVIOUS_INDEX)); | |
| 1177 __ jmp(&next); | |
| 1178 __ bind(&fast); | |
| 1179 } | |
| 1180 | |
| 1181 // All extension objects were empty and it is safe to use a normal global | 1158 // All extension objects were empty and it is safe to use a normal global |
| 1182 // load machinery. | 1159 // load machinery. |
| 1183 EmitGlobalVariableLoad(proxy, typeof_mode); | 1160 EmitGlobalVariableLoad(proxy, typeof_mode); |
| 1184 } | 1161 } |
| 1185 | 1162 |
| 1186 | 1163 |
| 1187 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1164 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
| 1188 Label* slow) { | 1165 Label* slow) { |
| 1189 DCHECK(var->IsContextSlot()); | 1166 DCHECK(var->IsContextSlot()); |
| 1190 Register context = rsi; | 1167 Register context = rsi; |
| (...skipping 2472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3663 DCHECK_EQ( | 3640 DCHECK_EQ( |
| 3664 isolate->builtins()->OnStackReplacement()->entry(), | 3641 isolate->builtins()->OnStackReplacement()->entry(), |
| 3665 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3642 Assembler::target_address_at(call_target_address, unoptimized_code)); |
| 3666 return ON_STACK_REPLACEMENT; | 3643 return ON_STACK_REPLACEMENT; |
| 3667 } | 3644 } |
| 3668 | 3645 |
| 3669 } // namespace internal | 3646 } // namespace internal |
| 3670 } // namespace v8 | 3647 } // namespace v8 |
| 3671 | 3648 |
| 3672 #endif // V8_TARGET_ARCH_X64 | 3649 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |