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

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

Issue 6538019: Porting of revisions 6639, 6794 and 6805 to the 3.0 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.0
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/ia32/macro-assembler-ia32.h ('k') | src/ia32/simulator-ia32.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 } 451 }
452 452
453 453
454 void MacroAssembler::PopTryHandler() { 454 void MacroAssembler::PopTryHandler() {
455 ASSERT_EQ(0, StackHandlerConstants::kNextOffset); 455 ASSERT_EQ(0, StackHandlerConstants::kNextOffset);
456 pop(Operand::StaticVariable(ExternalReference(Top::k_handler_address))); 456 pop(Operand::StaticVariable(ExternalReference(Top::k_handler_address)));
457 add(Operand(esp), Immediate(StackHandlerConstants::kSize - kPointerSize)); 457 add(Operand(esp), Immediate(StackHandlerConstants::kSize - kPointerSize));
458 } 458 }
459 459
460 460
461 void MacroAssembler::Throw(Register value) {
462 // Adjust this code if not the case.
463 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
464
465 // eax must hold the exception.
466 if (!value.is(eax)) {
467 mov(eax, value);
468 }
469
470 // Drop the sp to the top of the handler.
471 ExternalReference handler_address(Top::k_handler_address);
472 mov(esp, Operand::StaticVariable(handler_address));
473
474 // Restore next handler and frame pointer, discard handler state.
475 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
476 pop(Operand::StaticVariable(handler_address));
477 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize);
478 pop(ebp);
479 pop(edx); // Remove state.
480
481 // Before returning we restore the context from the frame pointer if
482 // not NULL. The frame pointer is NULL in the exception handler of
483 // a JS entry frame.
484 Set(esi, Immediate(0)); // Tentatively set context pointer to NULL.
485 NearLabel skip;
486 cmp(ebp, 0);
487 j(equal, &skip, not_taken);
488 mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
489 bind(&skip);
490
491 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize);
492 ret(0);
493 }
494
495
496 void MacroAssembler::ThrowUncatchable(UncatchableExceptionType type,
497 Register value) {
498 // Adjust this code if not the case.
499 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
500
501 // eax must hold the exception.
502 if (!value.is(eax)) {
503 mov(eax, value);
504 }
505
506 // Drop sp to the top stack handler.
507 ExternalReference handler_address(Top::k_handler_address);
508 mov(esp, Operand::StaticVariable(handler_address));
509
510 // Unwind the handlers until the ENTRY handler is found.
511 NearLabel loop, done;
512 bind(&loop);
513 // Load the type of the current stack handler.
514 const int kStateOffset = StackHandlerConstants::kStateOffset;
515 cmp(Operand(esp, kStateOffset), Immediate(StackHandler::ENTRY));
516 j(equal, &done);
517 // Fetch the next handler in the list.
518 const int kNextOffset = StackHandlerConstants::kNextOffset;
519 mov(esp, Operand(esp, kNextOffset));
520 jmp(&loop);
521 bind(&done);
522
523 // Set the top handler address to next handler past the current ENTRY handler.
524 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
525 pop(Operand::StaticVariable(handler_address));
526
527 if (type == OUT_OF_MEMORY) {
528 // Set external caught exception to false.
529 ExternalReference external_caught(Top::k_external_caught_exception_address);
530 mov(eax, false);
531 mov(Operand::StaticVariable(external_caught), eax);
532
533 // Set pending exception and eax to out of memory exception.
534 ExternalReference pending_exception(Top::k_pending_exception_address);
535 mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException()));
536 mov(Operand::StaticVariable(pending_exception), eax);
537 }
538
539 // Clear the context pointer.
540 Set(esi, Immediate(0));
541
542 // Restore fp from handler and discard handler state.
543 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize);
544 pop(ebp);
545 pop(edx); // State.
546
547 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize);
548 ret(0);
549 }
550
551
461 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, 552 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
462 Register scratch, 553 Register scratch,
463 Label* miss) { 554 Label* miss) {
464 Label same_contexts; 555 Label same_contexts;
465 556
466 ASSERT(!holder_reg.is(scratch)); 557 ASSERT(!holder_reg.is(scratch));
467 558
468 // Load current lexical context from the stack frame. 559 // Load current lexical context from the stack frame.
469 mov(scratch, Operand(ebp, StandardFrameConstants::kContextOffset)); 560 mov(scratch, Operand(ebp, StandardFrameConstants::kContextOffset));
470 561
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 2000
1910 // Check that the code was patched as expected. 2001 // Check that the code was patched as expected.
1911 ASSERT(masm_.pc_ == address_ + size_); 2002 ASSERT(masm_.pc_ == address_ + size_);
1912 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2003 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1913 } 2004 }
1914 2005
1915 2006
1916 } } // namespace v8::internal 2007 } } // namespace v8::internal
1917 2008
1918 #endif // V8_TARGET_ARCH_IA32 2009 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/ia32/simulator-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698