| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 | 688 |
| 689 void* Simulator::RedirectExternalReference(void* external_function, | 689 void* Simulator::RedirectExternalReference(void* external_function, |
| 690 bool fp_return) { | 690 bool fp_return) { |
| 691 Redirection* redirection = Redirection::Get(external_function, fp_return); | 691 Redirection* redirection = Redirection::Get(external_function, fp_return); |
| 692 return redirection->address_of_swi_instruction(); | 692 return redirection->address_of_swi_instruction(); |
| 693 } | 693 } |
| 694 | 694 |
| 695 | 695 |
| 696 // Get the active Simulator for the current thread. | 696 // Get the active Simulator for the current thread. |
| 697 Simulator* Simulator::current(Isolate* isolate) { | 697 Simulator* Simulator::current(Isolate* isolate) { |
| 698 v8::internal::Thread::LocalStorageKey* simulator_key = | 698 v8::internal::Isolate::PerIsolateThreadData* isolate_data = |
| 699 Isolate::Current()->simulator_key(); | 699 Isolate::CurrentPerIsolateThreadData(); |
| 700 Initialize(); | 700 if (isolate_data == NULL) { |
| 701 Simulator* sim = reinterpret_cast<Simulator*>( | 701 Isolate::EnterDefaultIsolate(); |
| 702 v8::internal::Thread::GetThreadLocal(*simulator_key)); | 702 isolate_data = Isolate::CurrentPerIsolateThreadData(); |
| 703 } |
| 704 ASSERT(isolate_data != NULL); |
| 705 |
| 706 Simulator* sim = isolate_data->simulator(); |
| 703 if (sim == NULL) { | 707 if (sim == NULL) { |
| 704 // TODO(146): delete the simulator object when a thread goes away. | 708 // TODO(146): delete the simulator object when a thread/isolate goes away. |
| 705 sim = new Simulator(); | 709 sim = new Simulator(); |
| 706 v8::internal::Thread::SetThreadLocal(*simulator_key, sim); | 710 isolate_data->set_simulator(sim); |
| 707 } | 711 } |
| 708 return sim; | 712 return sim; |
| 709 } | 713 } |
| 710 | 714 |
| 711 | 715 |
| 712 // Sets the register in the architecture state. It will also deal with updating | 716 // Sets the register in the architecture state. It will also deal with updating |
| 713 // Simulator internal state for special registers such as PC. | 717 // Simulator internal state for special registers such as PC. |
| 714 void Simulator::set_register(int reg, int32_t value) { | 718 void Simulator::set_register(int reg, int32_t value) { |
| 715 ASSERT((reg >= 0) && (reg < num_registers)); | 719 ASSERT((reg >= 0) && (reg < num_registers)); |
| 716 if (reg == pc) { | 720 if (reg == pc) { |
| (...skipping 2063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2780 uintptr_t address = *stack_slot; | 2784 uintptr_t address = *stack_slot; |
| 2781 set_register(sp, current_sp + sizeof(uintptr_t)); | 2785 set_register(sp, current_sp + sizeof(uintptr_t)); |
| 2782 return address; | 2786 return address; |
| 2783 } | 2787 } |
| 2784 | 2788 |
| 2785 } } // namespace assembler::arm | 2789 } } // namespace assembler::arm |
| 2786 | 2790 |
| 2787 #endif // __arm__ | 2791 #endif // __arm__ |
| 2788 | 2792 |
| 2789 #endif // V8_TARGET_ARCH_ARM | 2793 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |