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_X87 | 5 #if V8_TARGET_ARCH_X87 |
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 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 CallStoreIC(); | 1093 CallStoreIC(); |
1094 } | 1094 } |
1095 | 1095 |
1096 | 1096 |
1097 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, | 1097 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
1098 TypeofMode typeof_mode, | 1098 TypeofMode typeof_mode, |
1099 Label* slow) { | 1099 Label* slow) { |
1100 Register context = esi; | 1100 Register context = esi; |
1101 Register temp = edx; | 1101 Register temp = edx; |
1102 | 1102 |
1103 Scope* s = scope(); | 1103 int to_check = scope()->ContextChainLengthUntilOutermostSloppyEval(); |
1104 while (s != NULL) { | 1104 for (Scope* s = scope(); to_check > 0; s = s->outer_scope()) { |
1105 if (s->num_heap_slots() > 0) { | 1105 if (!s->NeedsContext()) continue; |
1106 if (s->calls_sloppy_eval()) { | 1106 if (s->calls_sloppy_eval()) { |
1107 // Check that extension is "the hole". | 1107 // Check that extension is "the hole". |
1108 __ JumpIfNotRoot(ContextOperand(context, Context::EXTENSION_INDEX), | 1108 __ JumpIfNotRoot(ContextOperand(context, Context::EXTENSION_INDEX), |
1109 Heap::kTheHoleValueRootIndex, slow); | 1109 Heap::kTheHoleValueRootIndex, slow); |
1110 } | |
1111 // Load next context in chain. | |
1112 __ mov(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); | |
1113 // Walk the rest of the chain without clobbering esi. | |
1114 context = temp; | |
1115 } | 1110 } |
1116 // If no outer scope calls eval, we do not need to check more | 1111 // Load next context in chain. |
1117 // context extensions. If we have reached an eval scope, we check | 1112 __ mov(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
1118 // all extensions from this point. | 1113 // Walk the rest of the chain without clobbering esi. |
1119 if (!s->outer_scope_calls_sloppy_eval()) break; | 1114 context = temp; |
1120 s = s->outer_scope(); | 1115 to_check--; |
1121 } | 1116 } |
1122 | 1117 |
1123 // All extension objects were empty and it is safe to use a normal global | 1118 // All extension objects were empty and it is safe to use a normal global |
1124 // load machinery. | 1119 // load machinery. |
1125 EmitGlobalVariableLoad(proxy, typeof_mode); | 1120 EmitGlobalVariableLoad(proxy, typeof_mode); |
1126 } | 1121 } |
1127 | 1122 |
1128 | 1123 |
1129 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1124 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
1130 Label* slow) { | 1125 Label* slow) { |
(...skipping 2512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3643 isolate->builtins()->OnStackReplacement()->entry(), | 3638 isolate->builtins()->OnStackReplacement()->entry(), |
3644 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3639 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3645 return ON_STACK_REPLACEMENT; | 3640 return ON_STACK_REPLACEMENT; |
3646 } | 3641 } |
3647 | 3642 |
3648 | 3643 |
3649 } // namespace internal | 3644 } // namespace internal |
3650 } // namespace v8 | 3645 } // namespace v8 |
3651 | 3646 |
3652 #endif // V8_TARGET_ARCH_X87 | 3647 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |