Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 6581029: X64: Port r6635 and r6659... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 movq(index, BitCast<int64_t>(kZapValue), RelocInfo::NONE); 129 movq(index, BitCast<int64_t>(kZapValue), RelocInfo::NONE);
130 } 130 }
131 } 131 }
132 132
133 133
134 void MacroAssembler::RecordWrite(Register object, 134 void MacroAssembler::RecordWrite(Register object,
135 Register address, 135 Register address,
136 Register value) { 136 Register value) {
137 // The compiled code assumes that record write doesn't change the 137 // The compiled code assumes that record write doesn't change the
138 // context register, so we check that none of the clobbered 138 // context register, so we check that none of the clobbered
139 // registers are esi. 139 // registers are rsi.
140 ASSERT(!object.is(rsi) && !value.is(rsi) && !address.is(rsi)); 140 ASSERT(!object.is(rsi) && !value.is(rsi) && !address.is(rsi));
141 141
142 // First, check if a write barrier is even needed. The tests below 142 // First, check if a write barrier is even needed. The tests below
143 // catch stores of Smis and stores into young gen. 143 // catch stores of Smis and stores into young gen.
144 Label done; 144 Label done;
145 JumpIfSmi(value, &done); 145 JumpIfSmi(value, &done);
146 146
147 InNewSpace(object, value, equal, &done); 147 InNewSpace(object, value, equal, &done);
148 148
149 RecordWriteHelper(object, address, value); 149 RecordWriteHelper(object, address, value);
(...skipping 2374 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 rsi).
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...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698