OLD | NEW |
---|---|
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 2513 matching lines...) Loading... | |
2524 // Move up the chain of contexts to the context containing the slot. | 2524 // Move up the chain of contexts to the context containing the slot. |
2525 movq(dst, Operand(rsi, Context::SlotOffset(Context::CLOSURE_INDEX))); | 2525 movq(dst, Operand(rsi, Context::SlotOffset(Context::CLOSURE_INDEX))); |
2526 // Load the function context (which is the incoming, outer context). | 2526 // Load the function context (which is the incoming, outer context). |
2527 movq(dst, FieldOperand(dst, JSFunction::kContextOffset)); | 2527 movq(dst, FieldOperand(dst, JSFunction::kContextOffset)); |
2528 for (int i = 1; i < context_chain_length; i++) { | 2528 for (int i = 1; i < context_chain_length; i++) { |
2529 movq(dst, Operand(dst, Context::SlotOffset(Context::CLOSURE_INDEX))); | 2529 movq(dst, Operand(dst, Context::SlotOffset(Context::CLOSURE_INDEX))); |
2530 movq(dst, FieldOperand(dst, JSFunction::kContextOffset)); | 2530 movq(dst, FieldOperand(dst, JSFunction::kContextOffset)); |
2531 } | 2531 } |
2532 // The context may be an intermediate context, not a function context. | 2532 // The context may be an intermediate context, not a function context. |
2533 movq(dst, Operand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 2533 movq(dst, Operand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); |
2534 } else { // context is the current function context. | 2534 } else { |
2535 // The context may be an intermediate context, not a function context. | 2535 // Slot is in the current function context. Move it into the |
2536 movq(dst, Operand(rsi, Context::SlotOffset(Context::FCONTEXT_INDEX))); | 2536 // destination register in case we store into it (the write barrier |
2537 // cannot be allowed to destroy the context in esi). | |
William Hesse
2011/02/24 10:32:15
rsi, not esi.
Søren Thygesen Gjesse
2011/02/24 11:33:18
Done.
| |
2538 movq(dst, rsi); | |
2539 } | |
2540 | |
2541 // We should not have found a 'with' context by walking the context chain | |
2542 // (i.e., the static scope chain and runtime context chain do not agree). | |
2543 // A variable occurring in such a scope should have slot type LOOKUP and | |
2544 // not CONTEXT. | |
2545 if (FLAG_debug_code) { | |
2546 cmpq(dst, Operand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX))); | |
2547 Check(equal, "Yo dawg, I heard you liked function contexts " | |
2548 "so I put function contexts in all your contexts"); | |
2537 } | 2549 } |
2538 } | 2550 } |
2539 | 2551 |
2540 | 2552 |
2541 void MacroAssembler::LoadGlobalFunction(int index, Register function) { | 2553 void MacroAssembler::LoadGlobalFunction(int index, Register function) { |
2542 // Load the global or builtins object from the current context. | 2554 // Load the global or builtins object from the current context. |
2543 movq(function, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); | 2555 movq(function, Operand(rsi, Context::SlotOffset(Context::GLOBAL_INDEX))); |
2544 // Load the global context from the global or builtins object. | 2556 // Load the global context from the global or builtins object. |
2545 movq(function, FieldOperand(function, GlobalObject::kGlobalContextOffset)); | 2557 movq(function, FieldOperand(function, GlobalObject::kGlobalContextOffset)); |
2546 // Load the function from the global context. | 2558 // Load the function from the global context. |
(...skipping 87 matching lines...) Loading... | |
2634 CPU::FlushICache(address_, size_); | 2646 CPU::FlushICache(address_, size_); |
2635 | 2647 |
2636 // Check that the code was patched as expected. | 2648 // Check that the code was patched as expected. |
2637 ASSERT(masm_.pc_ == address_ + size_); | 2649 ASSERT(masm_.pc_ == address_ + size_); |
2638 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2650 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2639 } | 2651 } |
2640 | 2652 |
2641 } } // namespace v8::internal | 2653 } } // namespace v8::internal |
2642 | 2654 |
2643 #endif // V8_TARGET_ARCH_X64 | 2655 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |