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

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

Issue 6489001: Change native RegExp call code to properly set C++ structures and (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge/build-x64
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
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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 } 441 }
442 442
443 443
444 void MacroAssembler::PopTryHandler() { 444 void MacroAssembler::PopTryHandler() {
445 ASSERT_EQ(0, StackHandlerConstants::kNextOffset); 445 ASSERT_EQ(0, StackHandlerConstants::kNextOffset);
446 pop(Operand::StaticVariable(ExternalReference(Top::k_handler_address))); 446 pop(Operand::StaticVariable(ExternalReference(Top::k_handler_address)));
447 add(Operand(esp), Immediate(StackHandlerConstants::kSize - kPointerSize)); 447 add(Operand(esp), Immediate(StackHandlerConstants::kSize - kPointerSize));
448 } 448 }
449 449
450 450
451 void MacroAssembler::Throw() {
452 // eax holds the exception.
453
454 // Adjust this code if not the case.
455 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
456
457 // Drop the sp to the top of the handler.
458 ExternalReference handler_address(Top::k_handler_address);
459 mov(esp, Operand::StaticVariable(handler_address));
460
461 // Restore next handler and frame pointer, discard handler state.
462 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
463 pop(Operand::StaticVariable(handler_address));
464 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize);
465 pop(ebp);
466 pop(edx); // Remove state.
467
468 // Before returning we restore the context from the frame pointer if
469 // not NULL. The frame pointer is NULL in the exception handler of
470 // a JS entry frame.
471 Set(esi, Immediate(0)); // Tentatively set context pointer to NULL.
472 NearLabel skip;
473 cmp(ebp, 0);
474 j(equal, &skip, not_taken);
475 mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
476 bind(&skip);
477
478 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize);
479 ret(0);
480 }
481
482
483 void MacroAssembler::ThrowUncatchable(UncatchableExceptionType type) {
484 // Adjust this code if not the case.
485 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
486
487 // Drop sp to the top stack handler.
488 ExternalReference handler_address(Top::k_handler_address);
489 mov(esp, Operand::StaticVariable(handler_address));
490
491 // Unwind the handlers until the ENTRY handler is found.
492 NearLabel loop, done;
493 bind(&loop);
494 // Load the type of the current stack handler.
495 const int kStateOffset = StackHandlerConstants::kStateOffset;
496 cmp(Operand(esp, kStateOffset), Immediate(StackHandler::ENTRY));
497 j(equal, &done);
498 // Fetch the next handler in the list.
499 const int kNextOffset = StackHandlerConstants::kNextOffset;
500 mov(esp, Operand(esp, kNextOffset));
501 jmp(&loop);
502 bind(&done);
503
504 // Set the top handler address to next handler past the current ENTRY handler.
505 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
506 pop(Operand::StaticVariable(handler_address));
507
508 if (type == OUT_OF_MEMORY) {
509 // Set external caught exception to false.
510 ExternalReference external_caught(Top::k_external_caught_exception_address);
511 mov(eax, false);
512 mov(Operand::StaticVariable(external_caught), eax);
513
514 // Set pending exception and eax to out of memory exception.
515 ExternalReference pending_exception(Top::k_pending_exception_address);
516 mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException()));
517 mov(Operand::StaticVariable(pending_exception), eax);
518 }
519
520 // Clear the context pointer.
521 Set(esi, Immediate(0));
522
523 // Restore fp from handler and discard handler state.
524 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize);
525 pop(ebp);
526 pop(edx); // State.
527
528 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize);
529 ret(0);
530 }
531
532
451 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, 533 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
452 Register scratch, 534 Register scratch,
453 Label* miss) { 535 Label* miss) {
454 Label same_contexts; 536 Label same_contexts;
455 537
456 ASSERT(!holder_reg.is(scratch)); 538 ASSERT(!holder_reg.is(scratch));
457 539
458 // Load current lexical context from the stack frame. 540 // Load current lexical context from the stack frame.
459 mov(scratch, Operand(ebp, StandardFrameConstants::kContextOffset)); 541 mov(scratch, Operand(ebp, StandardFrameConstants::kContextOffset));
460 542
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 1991
1910 // Check that the code was patched as expected. 1992 // Check that the code was patched as expected.
1911 ASSERT(masm_.pc_ == address_ + size_); 1993 ASSERT(masm_.pc_ == address_ + size_);
1912 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1994 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1913 } 1995 }
1914 1996
1915 1997
1916 } } // namespace v8::internal 1998 } } // namespace v8::internal
1917 1999
1918 #endif // V8_TARGET_ARCH_IA32 2000 #endif // V8_TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698