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 2137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2148 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { | 2148 void MacroAssembler::LoadContext(Register dst, int context_chain_length) { |
2149 if (context_chain_length > 0) { | 2149 if (context_chain_length > 0) { |
2150 // Move up the chain of contexts to the context containing the slot. | 2150 // Move up the chain of contexts to the context containing the slot. |
2151 ldr(dst, MemOperand(cp, Context::SlotOffset(Context::CLOSURE_INDEX))); | 2151 ldr(dst, MemOperand(cp, Context::SlotOffset(Context::CLOSURE_INDEX))); |
2152 // Load the function context (which is the incoming, outer context). | 2152 // Load the function context (which is the incoming, outer context). |
2153 ldr(dst, FieldMemOperand(dst, JSFunction::kContextOffset)); | 2153 ldr(dst, FieldMemOperand(dst, JSFunction::kContextOffset)); |
2154 for (int i = 1; i < context_chain_length; i++) { | 2154 for (int i = 1; i < context_chain_length; i++) { |
2155 ldr(dst, MemOperand(dst, Context::SlotOffset(Context::CLOSURE_INDEX))); | 2155 ldr(dst, MemOperand(dst, Context::SlotOffset(Context::CLOSURE_INDEX))); |
2156 ldr(dst, FieldMemOperand(dst, JSFunction::kContextOffset)); | 2156 ldr(dst, FieldMemOperand(dst, JSFunction::kContextOffset)); |
2157 } | 2157 } |
2158 // The context may be an intermediate context, not a function context. | 2158 } else { |
2159 ldr(dst, MemOperand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 2159 // Slot is in the current function context. Move it into the |
2160 } else { // Slot is in the current function context. | 2160 // destination register in case we store into it (the write barrier |
2161 // The context may be an intermediate context, not a function context. | 2161 // cannot be allowed to destroy the context in esi). |
2162 ldr(dst, MemOperand(cp, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 2162 mov(dst, cp); |
2163 } | 2163 } |
| 2164 |
| 2165 // We should not have found a 'with' context by walking the context chain |
| 2166 // (i.e., the static scope chain and runtime context chain do not agree). |
| 2167 // A variable occurring in such a scope should have slot type LOOKUP and |
| 2168 // not CONTEXT. |
| 2169 if (FLAG_debug_code) { |
| 2170 ldr(ip, MemOperand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
| 2171 cmp(dst, ip); |
| 2172 Check(eq, "Yo dawg, I heard you liked function contexts " |
| 2173 "so I put function contexts in all your contexts"); |
| 2174 } |
| 2175 |
2164 } | 2176 } |
2165 | 2177 |
2166 | 2178 |
2167 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 2179 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
2168 // Load the global or builtins object from the current context. | 2180 // Load the global or builtins object from the current context. |
2169 ldr(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2181 ldr(function, MemOperand(cp, Context::SlotOffset(Context::GLOBAL_INDEX))); |
2170 // Load the global context from the global or builtins object. | 2182 // Load the global context from the global or builtins object. |
2171 ldr(function, FieldMemOperand(function, | 2183 ldr(function, FieldMemOperand(function, |
2172 GlobalObject::kGlobalContextOffset)); | 2184 GlobalObject::kGlobalContextOffset)); |
2173 // Load the function from the global context. | 2185 // Load the function from the global context. |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2550 void CodePatcher::EmitCondition(Condition cond) { | 2562 void CodePatcher::EmitCondition(Condition cond) { |
2551 Instr instr = Assembler::instr_at(masm_.pc_); | 2563 Instr instr = Assembler::instr_at(masm_.pc_); |
2552 instr = (instr & ~kCondMask) | cond; | 2564 instr = (instr & ~kCondMask) | cond; |
2553 masm_.emit(instr); | 2565 masm_.emit(instr); |
2554 } | 2566 } |
2555 | 2567 |
2556 | 2568 |
2557 } } // namespace v8::internal | 2569 } } // namespace v8::internal |
2558 | 2570 |
2559 #endif // V8_TARGET_ARCH_ARM | 2571 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |