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

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

Issue 4402: Move more functionality from CEntryStub to the helper... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 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/macro-assembler-ia32.h ('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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 // Save the frame pointer and the context in top. 354 // Save the frame pointer and the context in top.
355 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address); 355 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address);
356 ExternalReference context_address(Top::k_context_address); 356 ExternalReference context_address(Top::k_context_address);
357 mov(Operand::StaticVariable(c_entry_fp_address), ebp); 357 mov(Operand::StaticVariable(c_entry_fp_address), ebp);
358 mov(Operand::StaticVariable(context_address), esi); 358 mov(Operand::StaticVariable(context_address), esi);
359 359
360 // Setup argc and argv in callee-saved registers. 360 // Setup argc and argv in callee-saved registers.
361 int offset = StandardFrameConstants::kCallerSPOffset - kPointerSize; 361 int offset = StandardFrameConstants::kCallerSPOffset - kPointerSize;
362 mov(edi, Operand(eax)); 362 mov(edi, Operand(eax));
363 lea(esi, Operand(ebp, eax, times_4, offset)); 363 lea(esi, Operand(ebp, eax, times_4, offset));
364
365 // Save the state of all registers to the stack from the memory
366 // location. This is needed to allow nested break points.
367 if (type == StackFrame::EXIT_DEBUG) {
368 // TODO(1243899): This should be symmetric to
369 // CopyRegistersFromStackToMemory() but it isn't! esp is assumed
370 // correct here, but computed for the other call. Very error
371 // prone! FIX THIS. Actually there are deeper problems with
372 // register saving than this asymmetry (see the bug report
373 // associated with this issue).
374 PushRegistersFromMemory(kJSCallerSaved);
375 }
376
377 // Reserve space for two arguments: argc and argv.
378 sub(Operand(esp), Immediate(2 * kPointerSize));
379
380 // Get the required frame alignment for the OS.
381 static const int kFrameAlignment = OS::ActivationFrameAlignment();
382 if (kFrameAlignment > 0) {
383 ASSERT(IsPowerOf2(kFrameAlignment));
384 and_(esp, -kFrameAlignment);
385 }
386
387 // Patch the saved entry sp.
388 mov(Operand(ebp, ExitFrameConstants::kSPOffset), esp);
364 } 389 }
365 390
366 391
367 void MacroAssembler::LeaveExitFrame() { 392 void MacroAssembler::LeaveExitFrame(StackFrame::Type type) {
393 // Restore the memory copy of the registers by digging them out from
394 // the stack. This is needed to allow nested break points.
395 if (type == StackFrame::EXIT_DEBUG) {
396 // It's okay to clobber register ebx below because we don't need
397 // the function pointer after this.
398 const int kCallerSavedSize = kNumJSCallerSaved * kPointerSize;
399 int kOffset = ExitFrameConstants::kDebugMarkOffset - kCallerSavedSize;
400 lea(ebx, Operand(ebp, kOffset));
401 CopyRegistersFromStackToMemory(ebx, ecx, kJSCallerSaved);
402 }
403
368 // Get the return address from the stack and restore the frame pointer. 404 // Get the return address from the stack and restore the frame pointer.
369 mov(ecx, Operand(ebp, 1 * kPointerSize)); 405 mov(ecx, Operand(ebp, 1 * kPointerSize));
370 mov(ebp, Operand(ebp, 0 * kPointerSize)); 406 mov(ebp, Operand(ebp, 0 * kPointerSize));
371 407
372 // Pop the arguments and the receiver from the caller stack. 408 // Pop the arguments and the receiver from the caller stack.
373 lea(esp, Operand(esi, 1 * kPointerSize)); 409 lea(esp, Operand(esi, 1 * kPointerSize));
374 410
375 // Restore current context from top and clear it in debug mode. 411 // Restore current context from top and clear it in debug mode.
376 ExternalReference context_address(Top::k_context_address); 412 ExternalReference context_address(Top::k_context_address);
377 mov(esi, Operand::StaticVariable(context_address)); 413 mov(esi, Operand::StaticVariable(context_address));
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
876 // Indicate that code has changed. 912 // Indicate that code has changed.
877 CPU::FlushICache(address_, size_); 913 CPU::FlushICache(address_, size_);
878 914
879 // Check that the code was patched as expected. 915 // Check that the code was patched as expected.
880 ASSERT(masm_.pc_ == address_ + size_); 916 ASSERT(masm_.pc_ == address_ + size_);
881 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 917 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
882 } 918 }
883 919
884 920
885 } } // namespace v8::internal 921 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/macro-assembler-ia32.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698