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

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: Ob-lintfix. 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/macro-assembler.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 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(Register value) {
452 // Adjust this code if not the case.
453 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
454
455 // eax must hold the exception.
456 if (!value.is(eax)) {
457 mov(eax, value);
458 }
459
460 // Drop the sp to the top of the handler.
461 ExternalReference handler_address(Top::k_handler_address);
462 mov(esp, Operand::StaticVariable(handler_address));
463
464 // Restore next handler and frame pointer, discard handler state.
465 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
466 pop(Operand::StaticVariable(handler_address));
467 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize);
468 pop(ebp);
469 pop(edx); // Remove state.
470
471 // Before returning we restore the context from the frame pointer if
472 // not NULL. The frame pointer is NULL in the exception handler of
473 // a JS entry frame.
474 Set(esi, Immediate(0)); // Tentatively set context pointer to NULL.
475 NearLabel skip;
476 cmp(ebp, 0);
477 j(equal, &skip, not_taken);
478 mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
479 bind(&skip);
480
481 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize);
482 ret(0);
483 }
484
485
486 void MacroAssembler::ThrowUncatchable(UncatchableExceptionType type,
487 Register value) {
488 // Adjust this code if not the case.
489 STATIC_ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize);
490
491 // eax must hold the exception.
492 if (!value.is(eax)) {
493 mov(eax, value);
494 }
495
496 // Drop sp to the top stack handler.
497 ExternalReference handler_address(Top::k_handler_address);
498 mov(esp, Operand::StaticVariable(handler_address));
499
500 // Unwind the handlers until the ENTRY handler is found.
501 NearLabel loop, done;
502 bind(&loop);
503 // Load the type of the current stack handler.
504 const int kStateOffset = StackHandlerConstants::kStateOffset;
505 cmp(Operand(esp, kStateOffset), Immediate(StackHandler::ENTRY));
506 j(equal, &done);
507 // Fetch the next handler in the list.
508 const int kNextOffset = StackHandlerConstants::kNextOffset;
509 mov(esp, Operand(esp, kNextOffset));
510 jmp(&loop);
511 bind(&done);
512
513 // Set the top handler address to next handler past the current ENTRY handler.
514 STATIC_ASSERT(StackHandlerConstants::kNextOffset == 0);
515 pop(Operand::StaticVariable(handler_address));
516
517 if (type == OUT_OF_MEMORY) {
518 // Set external caught exception to false.
519 ExternalReference external_caught(Top::k_external_caught_exception_address);
520 mov(eax, false);
521 mov(Operand::StaticVariable(external_caught), eax);
522
523 // Set pending exception and eax to out of memory exception.
524 ExternalReference pending_exception(Top::k_pending_exception_address);
525 mov(eax, reinterpret_cast<int32_t>(Failure::OutOfMemoryException()));
526 mov(Operand::StaticVariable(pending_exception), eax);
527 }
528
529 // Clear the context pointer.
530 Set(esi, Immediate(0));
531
532 // Restore fp from handler and discard handler state.
533 STATIC_ASSERT(StackHandlerConstants::kFPOffset == 1 * kPointerSize);
534 pop(ebp);
535 pop(edx); // State.
536
537 STATIC_ASSERT(StackHandlerConstants::kPCOffset == 3 * kPointerSize);
538 ret(0);
539 }
540
541
451 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, 542 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
452 Register scratch, 543 Register scratch,
453 Label* miss) { 544 Label* miss) {
454 Label same_contexts; 545 Label same_contexts;
455 546
456 ASSERT(!holder_reg.is(scratch)); 547 ASSERT(!holder_reg.is(scratch));
457 548
458 // Load current lexical context from the stack frame. 549 // Load current lexical context from the stack frame.
459 mov(scratch, Operand(ebp, StandardFrameConstants::kContextOffset)); 550 mov(scratch, Operand(ebp, StandardFrameConstants::kContextOffset));
460 551
(...skipping 1448 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/macro-assembler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698