OLD | NEW |
1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); | 376 ASSERT(ExitFrameConstants::kCallerFPOffset == 0 * kPointerSize); |
377 push(ebp); | 377 push(ebp); |
378 mov(ebp, Operand(esp)); | 378 mov(ebp, Operand(esp)); |
379 | 379 |
380 // Reserve room for entry stack pointer and push the debug marker. | 380 // Reserve room for entry stack pointer and push the debug marker. |
381 ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize); | 381 ASSERT(ExitFrameConstants::kSPOffset == -1 * kPointerSize); |
382 push(Immediate(0)); // Saved entry sp, patched before call. | 382 push(Immediate(0)); // Saved entry sp, patched before call. |
383 push(Immediate(CodeObject())); // Accessed from ExitFrame::code_slot. | 383 push(Immediate(CodeObject())); // Accessed from ExitFrame::code_slot. |
384 | 384 |
385 // Save the frame pointer and the context in top. | 385 // Save the frame pointer and the context in top. |
386 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address); | 386 ExternalReference c_entry_fp_address(Isolate::k_c_entry_fp_address); |
387 ExternalReference context_address(Top::k_context_address); | 387 ExternalReference context_address(Isolate::k_context_address); |
388 mov(Operand::StaticVariable(c_entry_fp_address), ebp); | 388 mov(Operand::StaticVariable(c_entry_fp_address), ebp); |
389 mov(Operand::StaticVariable(context_address), esi); | 389 mov(Operand::StaticVariable(context_address), esi); |
390 } | 390 } |
391 | 391 |
392 void MacroAssembler::EnterExitFrameEpilogue(ExitFrame::Mode mode, int argc) { | 392 void MacroAssembler::EnterExitFrameEpilogue(ExitFrame::Mode mode, int argc) { |
393 #ifdef ENABLE_DEBUGGER_SUPPORT | 393 #ifdef ENABLE_DEBUGGER_SUPPORT |
394 // Save the state of all registers to the stack from the memory | 394 // Save the state of all registers to the stack from the memory |
395 // location. This is needed to allow nested break points. | 395 // location. This is needed to allow nested break points. |
396 if (mode == ExitFrame::MODE_DEBUG) { | 396 if (mode == ExitFrame::MODE_DEBUG) { |
397 // TODO(1243899): This should be symmetric to | 397 // TODO(1243899): This should be symmetric to |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 #endif | 458 #endif |
459 | 459 |
460 // Get the return address from the stack and restore the frame pointer. | 460 // Get the return address from the stack and restore the frame pointer. |
461 mov(ecx, Operand(ebp, 1 * kPointerSize)); | 461 mov(ecx, Operand(ebp, 1 * kPointerSize)); |
462 mov(ebp, Operand(ebp, 0 * kPointerSize)); | 462 mov(ebp, Operand(ebp, 0 * kPointerSize)); |
463 | 463 |
464 // Pop the arguments and the receiver from the caller stack. | 464 // Pop the arguments and the receiver from the caller stack. |
465 lea(esp, Operand(esi, 1 * kPointerSize)); | 465 lea(esp, Operand(esi, 1 * kPointerSize)); |
466 | 466 |
467 // Restore current context from top and clear it in debug mode. | 467 // Restore current context from top and clear it in debug mode. |
468 ExternalReference context_address(Top::k_context_address); | 468 ExternalReference context_address(Isolate::k_context_address); |
469 mov(esi, Operand::StaticVariable(context_address)); | 469 mov(esi, Operand::StaticVariable(context_address)); |
470 #ifdef DEBUG | 470 #ifdef DEBUG |
471 mov(Operand::StaticVariable(context_address), Immediate(0)); | 471 mov(Operand::StaticVariable(context_address), Immediate(0)); |
472 #endif | 472 #endif |
473 | 473 |
474 // Push the return address to get ready to return. | 474 // Push the return address to get ready to return. |
475 push(ecx); | 475 push(ecx); |
476 | 476 |
477 // Clear the top frame. | 477 // Clear the top frame. |
478 ExternalReference c_entry_fp_address(Top::k_c_entry_fp_address); | 478 ExternalReference c_entry_fp_address(Isolate::k_c_entry_fp_address); |
479 mov(Operand::StaticVariable(c_entry_fp_address), Immediate(0)); | 479 mov(Operand::StaticVariable(c_entry_fp_address), Immediate(0)); |
480 } | 480 } |
481 | 481 |
482 | 482 |
483 void MacroAssembler::PushTryHandler(CodeLocation try_location, | 483 void MacroAssembler::PushTryHandler(CodeLocation try_location, |
484 HandlerType type) { | 484 HandlerType type) { |
485 // Adjust this code if not the case. | 485 // Adjust this code if not the case. |
486 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); | 486 ASSERT(StackHandlerConstants::kSize == 4 * kPointerSize); |
487 // The pc (return address) is already on TOS. | 487 // The pc (return address) is already on TOS. |
488 if (try_location == IN_JAVASCRIPT) { | 488 if (try_location == IN_JAVASCRIPT) { |
489 if (type == TRY_CATCH_HANDLER) { | 489 if (type == TRY_CATCH_HANDLER) { |
490 push(Immediate(StackHandler::TRY_CATCH)); | 490 push(Immediate(StackHandler::TRY_CATCH)); |
491 } else { | 491 } else { |
492 push(Immediate(StackHandler::TRY_FINALLY)); | 492 push(Immediate(StackHandler::TRY_FINALLY)); |
493 } | 493 } |
494 push(ebp); | 494 push(ebp); |
495 } else { | 495 } else { |
496 ASSERT(try_location == IN_JS_ENTRY); | 496 ASSERT(try_location == IN_JS_ENTRY); |
497 // The frame pointer does not point to a JS frame so we save NULL | 497 // The frame pointer does not point to a JS frame so we save NULL |
498 // for ebp. We expect the code throwing an exception to check ebp | 498 // for ebp. We expect the code throwing an exception to check ebp |
499 // before dereferencing it to restore the context. | 499 // before dereferencing it to restore the context. |
500 push(Immediate(StackHandler::ENTRY)); | 500 push(Immediate(StackHandler::ENTRY)); |
501 push(Immediate(0)); // NULL frame pointer. | 501 push(Immediate(0)); // NULL frame pointer. |
502 } | 502 } |
503 // Save the current handler as the next handler. | 503 // Save the current handler as the next handler. |
504 push(Operand::StaticVariable(ExternalReference(Top::k_handler_address))); | 504 push(Operand::StaticVariable(ExternalReference(Isolate::k_handler_address))); |
505 // Link this handler as the new current one. | 505 // Link this handler as the new current one. |
506 mov(Operand::StaticVariable(ExternalReference(Top::k_handler_address)), esp); | 506 mov(Operand::StaticVariable(ExternalReference(Isolate::k_handler_address)), |
| 507 esp); |
507 } | 508 } |
508 | 509 |
509 | 510 |
510 void MacroAssembler::PopTryHandler() { | 511 void MacroAssembler::PopTryHandler() { |
511 ASSERT_EQ(0, StackHandlerConstants::kNextOffset); | 512 ASSERT_EQ(0, StackHandlerConstants::kNextOffset); |
512 pop(Operand::StaticVariable(ExternalReference(Top::k_handler_address))); | 513 pop(Operand::StaticVariable(ExternalReference(Isolate::k_handler_address))); |
513 add(Operand(esp), Immediate(StackHandlerConstants::kSize - kPointerSize)); | 514 add(Operand(esp), Immediate(StackHandlerConstants::kSize - kPointerSize)); |
514 } | 515 } |
515 | 516 |
516 | 517 |
517 Register MacroAssembler::CheckMaps(JSObject* object, Register object_reg, | 518 Register MacroAssembler::CheckMaps(JSObject* object, Register object_reg, |
518 JSObject* holder, Register holder_reg, | 519 JSObject* holder, Register holder_reg, |
519 Register scratch, | 520 Register scratch, |
520 int save_at_depth, | 521 int save_at_depth, |
521 Label* miss) { | 522 Label* miss) { |
522 // Make sure there's no overlap between scratch and the other | 523 // Make sure there's no overlap between scratch and the other |
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1662 | 1663 |
1663 // Check that the code was patched as expected. | 1664 // Check that the code was patched as expected. |
1664 ASSERT(masm_.pc_ == address_ + size_); | 1665 ASSERT(masm_.pc_ == address_ + size_); |
1665 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 1666 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
1666 } | 1667 } |
1667 | 1668 |
1668 | 1669 |
1669 } } // namespace v8::internal | 1670 } } // namespace v8::internal |
1670 | 1671 |
1671 #endif // V8_TARGET_ARCH_IA32 | 1672 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |