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

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

Issue 405033: Fast-codegen: Arguments object working on all platforms. (Closed)
Patch Set: Addressed review coments. Created 11 years 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
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 2217 matching lines...) Expand 10 before | Expand all | Expand 10 after
2228 no_reg, 2228 no_reg,
2229 gc_required, 2229 gc_required,
2230 TAG_OBJECT); 2230 TAG_OBJECT);
2231 2231
2232 // Set the map. 2232 // Set the map.
2233 LoadRoot(kScratchRegister, Heap::kHeapNumberMapRootIndex); 2233 LoadRoot(kScratchRegister, Heap::kHeapNumberMapRootIndex);
2234 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister); 2234 movq(FieldOperand(result, HeapObject::kMapOffset), kScratchRegister);
2235 } 2235 }
2236 2236
2237 2237
2238 void MacroAssembler::LoadContext(Register dst, int context_chain_length) {
2239 if (context_chain_length > 0) {
2240 // Move up the chain of contexts to the context containing the slot.
2241 movq(dst, Operand(rsi, Context::SlotOffset(Context::CLOSURE_INDEX)));
2242 // Load the function context (which is the incoming, outer context).
2243 movq(rax, FieldOperand(rax, JSFunction::kContextOffset));
2244 for (int i = 1; i < context_chain_length; i++) {
2245 movq(dst, Operand(dst, Context::SlotOffset(Context::CLOSURE_INDEX)));
2246 movq(dst, FieldOperand(dst, JSFunction::kContextOffset));
2247 }
2248 // The context may be an intermediate context, not a function context.
2249 movq(dst, Operand(dst, Context::SlotOffset(Context::FCONTEXT_INDEX)));
2250 } else { // context is the current function context.
2251 // The context may be an intermediate context, not a function context.
2252 movq(dst, Operand(rsi, Context::SlotOffset(Context::FCONTEXT_INDEX)));
2253 }
2254 }
2255
2256
2238 CodePatcher::CodePatcher(byte* address, int size) 2257 CodePatcher::CodePatcher(byte* address, int size)
2239 : address_(address), size_(size), masm_(address, size + Assembler::kGap) { 2258 : address_(address), size_(size), masm_(address, size + Assembler::kGap) {
2240 // Create a new macro assembler pointing to the address of the code to patch. 2259 // Create a new macro assembler pointing to the address of the code to patch.
2241 // The size is adjusted with kGap on order for the assembler to generate size 2260 // The size is adjusted with kGap on order for the assembler to generate size
2242 // bytes of instructions without failing with buffer size constraints. 2261 // bytes of instructions without failing with buffer size constraints.
2243 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2262 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2244 } 2263 }
2245 2264
2246 2265
2247 CodePatcher::~CodePatcher() { 2266 CodePatcher::~CodePatcher() {
2248 // Indicate that code has changed. 2267 // Indicate that code has changed.
2249 CPU::FlushICache(address_, size_); 2268 CPU::FlushICache(address_, size_);
2250 2269
2251 // Check that the code was patched as expected. 2270 // Check that the code was patched as expected.
2252 ASSERT(masm_.pc_ == address_ + size_); 2271 ASSERT(masm_.pc_ == address_ + size_);
2253 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2272 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2254 } 2273 }
2255 2274
2256 } } // namespace v8::internal 2275 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698