OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stdlib.h> | 5 #include <stdlib.h> |
6 #include <cmath> | 6 #include <cmath> |
7 #include <cstdarg> | 7 #include <cstdarg> |
8 #include "src/v8.h" | 8 #include "src/v8.h" |
9 | 9 |
10 #if V8_TARGET_ARCH_ARM64 | 10 #if V8_TARGET_ARCH_ARM64 |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 addr_of_hlt - OFFSET_OF(Redirection, redirect_call_); | 493 addr_of_hlt - OFFSET_OF(Redirection, redirect_call_); |
494 return reinterpret_cast<Redirection*>(addr_of_redirection); | 494 return reinterpret_cast<Redirection*>(addr_of_redirection); |
495 } | 495 } |
496 | 496 |
497 static void* ReverseRedirection(int64_t reg) { | 497 static void* ReverseRedirection(int64_t reg) { |
498 Redirection* redirection = | 498 Redirection* redirection = |
499 FromHltInstruction(reinterpret_cast<Instruction*>(reg)); | 499 FromHltInstruction(reinterpret_cast<Instruction*>(reg)); |
500 return redirection->external_function<void*>(); | 500 return redirection->external_function<void*>(); |
501 } | 501 } |
502 | 502 |
| 503 static void DeleteChain(Redirection* redirection) { |
| 504 while (redirection != nullptr) { |
| 505 Redirection* next = redirection->next_; |
| 506 delete redirection; |
| 507 redirection = next; |
| 508 } |
| 509 } |
| 510 |
503 private: | 511 private: |
504 void* external_function_; | 512 void* external_function_; |
505 Instruction redirect_call_; | 513 Instruction redirect_call_; |
506 ExternalReference::Type type_; | 514 ExternalReference::Type type_; |
507 Redirection* next_; | 515 Redirection* next_; |
508 }; | 516 }; |
509 | 517 |
510 | 518 |
| 519 // static |
| 520 void Simulator::TearDown(HashMap* i_cache, Redirection* first) { |
| 521 Redirection::DeleteChain(first); |
| 522 } |
| 523 |
| 524 |
511 // Calls into the V8 runtime are based on this very simple interface. | 525 // Calls into the V8 runtime are based on this very simple interface. |
512 // Note: To be able to return two values from some calls the code in runtime.cc | 526 // Note: To be able to return two values from some calls the code in runtime.cc |
513 // uses the ObjectPair structure. | 527 // uses the ObjectPair structure. |
514 // The simulator assumes all runtime calls return two 64-bits values. If they | 528 // The simulator assumes all runtime calls return two 64-bits values. If they |
515 // don't, register x1 is clobbered. This is fine because x1 is caller-saved. | 529 // don't, register x1 is clobbered. This is fine because x1 is caller-saved. |
516 struct ObjectPair { | 530 struct ObjectPair { |
517 int64_t res0; | 531 int64_t res0; |
518 int64_t res1; | 532 int64_t res1; |
519 }; | 533 }; |
520 | 534 |
(...skipping 3298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3819 | 3833 |
3820 delete[] format; | 3834 delete[] format; |
3821 } | 3835 } |
3822 | 3836 |
3823 | 3837 |
3824 #endif // USE_SIMULATOR | 3838 #endif // USE_SIMULATOR |
3825 | 3839 |
3826 } } // namespace v8::internal | 3840 } } // namespace v8::internal |
3827 | 3841 |
3828 #endif // V8_TARGET_ARCH_ARM64 | 3842 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |