OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 |
11 // with the distribution. | 11 // with the distribution. |
12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
15 // | 15 // |
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | 27 |
28 #ifndef V8_A64_SIMULATOR_A64_H_ | 28 #ifndef V8_ARM64_SIMULATOR_ARM64_H_ |
29 #define V8_A64_SIMULATOR_A64_H_ | 29 #define V8_ARM64_SIMULATOR_ARM64_H_ |
30 | 30 |
31 #include <stdarg.h> | 31 #include <stdarg.h> |
32 #include <vector> | 32 #include <vector> |
33 | 33 |
34 #include "v8.h" | 34 #include "v8.h" |
35 | 35 |
36 #include "globals.h" | 36 #include "globals.h" |
37 #include "utils.h" | 37 #include "utils.h" |
38 #include "allocation.h" | 38 #include "allocation.h" |
39 #include "assembler.h" | 39 #include "assembler.h" |
40 #include "a64/assembler-a64.h" | 40 #include "arm64/assembler-arm64.h" |
41 #include "a64/decoder-a64.h" | 41 #include "arm64/decoder-arm64.h" |
42 #include "a64/disasm-a64.h" | 42 #include "arm64/disasm-arm64.h" |
43 #include "a64/instrument-a64.h" | 43 #include "arm64/instrument-arm64.h" |
44 | 44 |
45 #define REGISTER_CODE_LIST(R) \ | 45 #define REGISTER_CODE_LIST(R) \ |
46 R(0) R(1) R(2) R(3) R(4) R(5) R(6) R(7) \ | 46 R(0) R(1) R(2) R(3) R(4) R(5) R(6) R(7) \ |
47 R(8) R(9) R(10) R(11) R(12) R(13) R(14) R(15) \ | 47 R(8) R(9) R(10) R(11) R(12) R(13) R(14) R(15) \ |
48 R(16) R(17) R(18) R(19) R(20) R(21) R(22) R(23) \ | 48 R(16) R(17) R(18) R(19) R(20) R(21) R(22) R(23) \ |
49 R(24) R(25) R(26) R(27) R(28) R(29) R(30) R(31) | 49 R(24) R(25) R(26) R(27) R(28) R(29) R(30) R(31) |
50 | 50 |
51 namespace v8 { | 51 namespace v8 { |
52 namespace internal { | 52 namespace internal { |
53 | 53 |
54 #if !defined(USE_SIMULATOR) | 54 #if !defined(USE_SIMULATOR) |
55 | 55 |
56 // Running without a simulator on a native A64 platform. | 56 // Running without a simulator on a native ARM64 platform. |
57 // When running without a simulator we call the entry directly. | 57 // When running without a simulator we call the entry directly. |
58 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ | 58 #define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4) \ |
59 (entry(p0, p1, p2, p3, p4)) | 59 (entry(p0, p1, p2, p3, p4)) |
60 | 60 |
61 typedef int (*a64_regexp_matcher)(String* input, | 61 typedef int (*arm64_regexp_matcher)(String* input, |
62 int64_t start_offset, | 62 int64_t start_offset, |
63 const byte* input_start, | 63 const byte* input_start, |
64 const byte* input_end, | 64 const byte* input_end, |
65 int* output, | 65 int* output, |
66 int64_t output_size, | 66 int64_t output_size, |
67 Address stack_base, | 67 Address stack_base, |
68 int64_t direct_call, | 68 int64_t direct_call, |
69 void* return_address, | 69 void* return_address, |
70 Isolate* isolate); | 70 Isolate* isolate); |
71 | 71 |
72 // Call the generated regexp code directly. The code at the entry address | 72 // Call the generated regexp code directly. The code at the entry address |
73 // should act as a function matching the type a64_regexp_matcher. | 73 // should act as a function matching the type arm64_regexp_matcher. |
74 // The ninth argument is a dummy that reserves the space used for | 74 // The ninth argument is a dummy that reserves the space used for |
75 // the return address added by the ExitFrame in native calls. | 75 // the return address added by the ExitFrame in native calls. |
76 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ | 76 #define CALL_GENERATED_REGEXP_CODE(entry, p0, p1, p2, p3, p4, p5, p6, p7, p8) \ |
77 (FUNCTION_CAST<a64_regexp_matcher>(entry)( \ | 77 (FUNCTION_CAST<arm64_regexp_matcher>(entry)( \ |
78 p0, p1, p2, p3, p4, p5, p6, p7, NULL, p8)) | 78 p0, p1, p2, p3, p4, p5, p6, p7, NULL, p8)) |
79 | 79 |
80 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ | 80 #define TRY_CATCH_FROM_ADDRESS(try_catch_address) \ |
81 reinterpret_cast<TryCatch*>(try_catch_address) | 81 reinterpret_cast<TryCatch*>(try_catch_address) |
82 | 82 |
83 // Running without a simulator there is nothing to do. | 83 // Running without a simulator there is nothing to do. |
84 class SimulatorStack : public v8::internal::AllStatic { | 84 class SimulatorStack : public v8::internal::AllStatic { |
85 public: | 85 public: |
86 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, | 86 static uintptr_t JsLimitFromCLimit(v8::internal::Isolate* isolate, |
87 uintptr_t c_limit) { | 87 uintptr_t c_limit) { |
(...skipping 810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
898 | 898 |
899 static void UnregisterCTryCatch() { | 899 static void UnregisterCTryCatch() { |
900 Simulator::current(Isolate::Current())->PopAddress(); | 900 Simulator::current(Isolate::Current())->PopAddress(); |
901 } | 901 } |
902 }; | 902 }; |
903 | 903 |
904 #endif // !defined(USE_SIMULATOR) | 904 #endif // !defined(USE_SIMULATOR) |
905 | 905 |
906 } } // namespace v8::internal | 906 } } // namespace v8::internal |
907 | 907 |
908 #endif // V8_A64_SIMULATOR_A64_H_ | 908 #endif // V8_ARM64_SIMULATOR_ARM64_H_ |
OLD | NEW |