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 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 Scope* s = scope(); | 1071 Scope* s = scope(); |
1072 while (s != NULL) { | 1072 while (s != NULL) { |
1073 if (s->num_heap_slots() > 0) { | 1073 if (s->num_heap_slots() > 0) { |
1074 if (s->calls_eval()) { | 1074 if (s->calls_eval()) { |
1075 // Check that extension is NULL. | 1075 // Check that extension is NULL. |
1076 __ cmp(ContextOperand(context, Context::EXTENSION_INDEX), | 1076 __ cmp(ContextOperand(context, Context::EXTENSION_INDEX), |
1077 Immediate(0)); | 1077 Immediate(0)); |
1078 __ j(not_equal, slow); | 1078 __ j(not_equal, slow); |
1079 } | 1079 } |
1080 // Load next context in chain. | 1080 // Load next context in chain. |
1081 __ mov(temp, ContextOperand(context, Context::CLOSURE_INDEX)); | 1081 __ mov(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
1082 __ mov(temp, FieldOperand(temp, JSFunction::kContextOffset)); | |
1083 // Walk the rest of the chain without clobbering esi. | 1082 // Walk the rest of the chain without clobbering esi. |
1084 context = temp; | 1083 context = temp; |
1085 } | 1084 } |
1086 // If no outer scope calls eval, we do not need to check more | 1085 // If no outer scope calls eval, we do not need to check more |
1087 // context extensions. If we have reached an eval scope, we check | 1086 // context extensions. If we have reached an eval scope, we check |
1088 // all extensions from this point. | 1087 // all extensions from this point. |
1089 if (!s->outer_scope_calls_eval() || s->is_eval_scope()) break; | 1088 if (!s->outer_scope_calls_eval() || s->is_eval_scope()) break; |
1090 s = s->outer_scope(); | 1089 s = s->outer_scope(); |
1091 } | 1090 } |
1092 | 1091 |
1093 if (s != NULL && s->is_eval_scope()) { | 1092 if (s != NULL && s->is_eval_scope()) { |
1094 // Loop up the context chain. There is no frame effect so it is | 1093 // Loop up the context chain. There is no frame effect so it is |
1095 // safe to use raw labels here. | 1094 // safe to use raw labels here. |
1096 Label next, fast; | 1095 Label next, fast; |
1097 if (!context.is(temp)) { | 1096 if (!context.is(temp)) { |
1098 __ mov(temp, context); | 1097 __ mov(temp, context); |
1099 } | 1098 } |
1100 __ bind(&next); | 1099 __ bind(&next); |
1101 // Terminate at global context. | 1100 // Terminate at global context. |
1102 __ cmp(FieldOperand(temp, HeapObject::kMapOffset), | 1101 __ cmp(FieldOperand(temp, HeapObject::kMapOffset), |
1103 Immediate(isolate()->factory()->global_context_map())); | 1102 Immediate(isolate()->factory()->global_context_map())); |
1104 __ j(equal, &fast, Label::kNear); | 1103 __ j(equal, &fast, Label::kNear); |
1105 // Check that extension is NULL. | 1104 // Check that extension is NULL. |
1106 __ cmp(ContextOperand(temp, Context::EXTENSION_INDEX), Immediate(0)); | 1105 __ cmp(ContextOperand(temp, Context::EXTENSION_INDEX), Immediate(0)); |
1107 __ j(not_equal, slow); | 1106 __ j(not_equal, slow); |
1108 // Load next context in chain. | 1107 // Load next context in chain. |
1109 __ mov(temp, ContextOperand(temp, Context::CLOSURE_INDEX)); | 1108 __ mov(temp, ContextOperand(temp, Context::PREVIOUS_INDEX)); |
1110 __ mov(temp, FieldOperand(temp, JSFunction::kContextOffset)); | |
1111 __ jmp(&next); | 1109 __ jmp(&next); |
1112 __ bind(&fast); | 1110 __ bind(&fast); |
1113 } | 1111 } |
1114 | 1112 |
1115 // All extension objects were empty and it is safe to use a global | 1113 // All extension objects were empty and it is safe to use a global |
1116 // load IC call. | 1114 // load IC call. |
1117 __ mov(eax, GlobalObjectOperand()); | 1115 __ mov(eax, GlobalObjectOperand()); |
1118 __ mov(ecx, slot->var()->name()); | 1116 __ mov(ecx, slot->var()->name()); |
1119 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 1117 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
1120 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF) | 1118 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF) |
(...skipping 11 matching lines...) Expand all Loading... |
1132 Register temp = ebx; | 1130 Register temp = ebx; |
1133 | 1131 |
1134 for (Scope* s = scope(); s != slot->var()->scope(); s = s->outer_scope()) { | 1132 for (Scope* s = scope(); s != slot->var()->scope(); s = s->outer_scope()) { |
1135 if (s->num_heap_slots() > 0) { | 1133 if (s->num_heap_slots() > 0) { |
1136 if (s->calls_eval()) { | 1134 if (s->calls_eval()) { |
1137 // Check that extension is NULL. | 1135 // Check that extension is NULL. |
1138 __ cmp(ContextOperand(context, Context::EXTENSION_INDEX), | 1136 __ cmp(ContextOperand(context, Context::EXTENSION_INDEX), |
1139 Immediate(0)); | 1137 Immediate(0)); |
1140 __ j(not_equal, slow); | 1138 __ j(not_equal, slow); |
1141 } | 1139 } |
1142 __ mov(temp, ContextOperand(context, Context::CLOSURE_INDEX)); | 1140 __ mov(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
1143 __ mov(temp, FieldOperand(temp, JSFunction::kContextOffset)); | |
1144 // Walk the rest of the chain without clobbering esi. | 1141 // Walk the rest of the chain without clobbering esi. |
1145 context = temp; | 1142 context = temp; |
1146 } | 1143 } |
1147 } | 1144 } |
1148 // Check that last extension is NULL. | 1145 // Check that last extension is NULL. |
1149 __ cmp(ContextOperand(context, Context::EXTENSION_INDEX), Immediate(0)); | 1146 __ cmp(ContextOperand(context, Context::EXTENSION_INDEX), Immediate(0)); |
1150 __ j(not_equal, slow); | 1147 __ j(not_equal, slow); |
1151 | 1148 |
1152 // This function is used only for loads, not stores, so it's safe to | 1149 // This function is used only for loads, not stores, so it's safe to |
1153 // return an esi-based operand (the write barrier cannot be allowed to | 1150 // return an esi-based operand (the write barrier cannot be allowed to |
(...skipping 3176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4330 // And return. | 4327 // And return. |
4331 __ ret(0); | 4328 __ ret(0); |
4332 } | 4329 } |
4333 | 4330 |
4334 | 4331 |
4335 #undef __ | 4332 #undef __ |
4336 | 4333 |
4337 } } // namespace v8::internal | 4334 } } // namespace v8::internal |
4338 | 4335 |
4339 #endif // V8_TARGET_ARCH_IA32 | 4336 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |