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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 Scope* s = scope(); | 1082 Scope* s = scope(); |
1083 while (s != NULL) { | 1083 while (s != NULL) { |
1084 if (s->num_heap_slots() > 0) { | 1084 if (s->num_heap_slots() > 0) { |
1085 if (s->calls_eval()) { | 1085 if (s->calls_eval()) { |
1086 // Check that extension is NULL. | 1086 // Check that extension is NULL. |
1087 __ cmpq(ContextOperand(context, Context::EXTENSION_INDEX), | 1087 __ cmpq(ContextOperand(context, Context::EXTENSION_INDEX), |
1088 Immediate(0)); | 1088 Immediate(0)); |
1089 __ j(not_equal, slow); | 1089 __ j(not_equal, slow); |
1090 } | 1090 } |
1091 // Load next context in chain. | 1091 // Load next context in chain. |
1092 __ movq(temp, ContextOperand(context, Context::CLOSURE_INDEX)); | 1092 __ movq(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
1093 __ movq(temp, FieldOperand(temp, JSFunction::kContextOffset)); | |
1094 // Walk the rest of the chain without clobbering rsi. | 1093 // Walk the rest of the chain without clobbering rsi. |
1095 context = temp; | 1094 context = temp; |
1096 } | 1095 } |
1097 // If no outer scope calls eval, we do not need to check more | 1096 // If no outer scope calls eval, we do not need to check more |
1098 // context extensions. If we have reached an eval scope, we check | 1097 // context extensions. If we have reached an eval scope, we check |
1099 // all extensions from this point. | 1098 // all extensions from this point. |
1100 if (!s->outer_scope_calls_eval() || s->is_eval_scope()) break; | 1099 if (!s->outer_scope_calls_eval() || s->is_eval_scope()) break; |
1101 s = s->outer_scope(); | 1100 s = s->outer_scope(); |
1102 } | 1101 } |
1103 | 1102 |
1104 if (s != NULL && s->is_eval_scope()) { | 1103 if (s != NULL && s->is_eval_scope()) { |
1105 // Loop up the context chain. There is no frame effect so it is | 1104 // Loop up the context chain. There is no frame effect so it is |
1106 // safe to use raw labels here. | 1105 // safe to use raw labels here. |
1107 Label next, fast; | 1106 Label next, fast; |
1108 if (!context.is(temp)) { | 1107 if (!context.is(temp)) { |
1109 __ movq(temp, context); | 1108 __ movq(temp, context); |
1110 } | 1109 } |
1111 // Load map for comparison into register, outside loop. | 1110 // Load map for comparison into register, outside loop. |
1112 __ LoadRoot(kScratchRegister, Heap::kGlobalContextMapRootIndex); | 1111 __ LoadRoot(kScratchRegister, Heap::kGlobalContextMapRootIndex); |
1113 __ bind(&next); | 1112 __ bind(&next); |
1114 // Terminate at global context. | 1113 // Terminate at global context. |
1115 __ cmpq(kScratchRegister, FieldOperand(temp, HeapObject::kMapOffset)); | 1114 __ cmpq(kScratchRegister, FieldOperand(temp, HeapObject::kMapOffset)); |
1116 __ j(equal, &fast, Label::kNear); | 1115 __ j(equal, &fast, Label::kNear); |
1117 // Check that extension is NULL. | 1116 // Check that extension is NULL. |
1118 __ cmpq(ContextOperand(temp, Context::EXTENSION_INDEX), Immediate(0)); | 1117 __ cmpq(ContextOperand(temp, Context::EXTENSION_INDEX), Immediate(0)); |
1119 __ j(not_equal, slow); | 1118 __ j(not_equal, slow); |
1120 // Load next context in chain. | 1119 // Load next context in chain. |
1121 __ movq(temp, ContextOperand(temp, Context::CLOSURE_INDEX)); | 1120 __ movq(temp, ContextOperand(temp, Context::PREVIOUS_INDEX)); |
1122 __ movq(temp, FieldOperand(temp, JSFunction::kContextOffset)); | |
1123 __ jmp(&next); | 1121 __ jmp(&next); |
1124 __ bind(&fast); | 1122 __ bind(&fast); |
1125 } | 1123 } |
1126 | 1124 |
1127 // All extension objects were empty and it is safe to use a global | 1125 // All extension objects were empty and it is safe to use a global |
1128 // load IC call. | 1126 // load IC call. |
1129 __ movq(rax, GlobalObjectOperand()); | 1127 __ movq(rax, GlobalObjectOperand()); |
1130 __ Move(rcx, slot->var()->name()); | 1128 __ Move(rcx, slot->var()->name()); |
1131 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); | 1129 Handle<Code> ic = isolate()->builtins()->LoadIC_Initialize(); |
1132 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF) | 1130 RelocInfo::Mode mode = (typeof_state == INSIDE_TYPEOF) |
(...skipping 11 matching lines...) Expand all Loading... |
1144 Register temp = rbx; | 1142 Register temp = rbx; |
1145 | 1143 |
1146 for (Scope* s = scope(); s != slot->var()->scope(); s = s->outer_scope()) { | 1144 for (Scope* s = scope(); s != slot->var()->scope(); s = s->outer_scope()) { |
1147 if (s->num_heap_slots() > 0) { | 1145 if (s->num_heap_slots() > 0) { |
1148 if (s->calls_eval()) { | 1146 if (s->calls_eval()) { |
1149 // Check that extension is NULL. | 1147 // Check that extension is NULL. |
1150 __ cmpq(ContextOperand(context, Context::EXTENSION_INDEX), | 1148 __ cmpq(ContextOperand(context, Context::EXTENSION_INDEX), |
1151 Immediate(0)); | 1149 Immediate(0)); |
1152 __ j(not_equal, slow); | 1150 __ j(not_equal, slow); |
1153 } | 1151 } |
1154 __ movq(temp, ContextOperand(context, Context::CLOSURE_INDEX)); | 1152 __ movq(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
1155 __ movq(temp, FieldOperand(temp, JSFunction::kContextOffset)); | |
1156 // Walk the rest of the chain without clobbering rsi. | 1153 // Walk the rest of the chain without clobbering rsi. |
1157 context = temp; | 1154 context = temp; |
1158 } | 1155 } |
1159 } | 1156 } |
1160 // Check that last extension is NULL. | 1157 // Check that last extension is NULL. |
1161 __ cmpq(ContextOperand(context, Context::EXTENSION_INDEX), Immediate(0)); | 1158 __ cmpq(ContextOperand(context, Context::EXTENSION_INDEX), Immediate(0)); |
1162 __ j(not_equal, slow); | 1159 __ j(not_equal, slow); |
1163 | 1160 |
1164 // This function is used only for loads, not stores, so it's safe to | 1161 // This function is used only for loads, not stores, so it's safe to |
1165 // return an rsi-based operand (the write barrier cannot be allowed to | 1162 // return an rsi-based operand (the write barrier cannot be allowed to |
(...skipping 3145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4311 __ ret(0); | 4308 __ ret(0); |
4312 } | 4309 } |
4313 | 4310 |
4314 | 4311 |
4315 #undef __ | 4312 #undef __ |
4316 | 4313 |
4317 | 4314 |
4318 } } // namespace v8::internal | 4315 } } // namespace v8::internal |
4319 | 4316 |
4320 #endif // V8_TARGET_ARCH_X64 | 4317 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |