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

Side by Side Diff: runtime/vm/snapshot.cc

Issue 2757783003: Set TARGET_OS_* from GN, falling back to HOST_OS_*. (Closed)
Patch Set: . Created 3 years, 9 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/snapshot.h" 5 #include "vm/snapshot.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 ASSERT(Utils::IsAligned(beginning, sizeof(uword))); 889 ASSERT(Utils::IsAligned(beginning, sizeof(uword)));
890 ASSERT(Utils::IsAligned(entry, sizeof(uword))); 890 ASSERT(Utils::IsAligned(entry, sizeof(uword)));
891 ASSERT(Utils::IsAligned(end, sizeof(uword))); 891 ASSERT(Utils::IsAligned(end, sizeof(uword)));
892 892
893 WriteByteSequence(entry, end); 893 WriteByteSequence(entry, end);
894 } 894 }
895 } 895 }
896 896
897 FrameUnwindEpilogue(); 897 FrameUnwindEpilogue();
898 898
899 #if defined(HOST_OS_LINUX) 899 #if defined(TARGET_OS_LINUX) || defined(TARGET_OS_ANDROID)
zra 2017/03/17 17:24:24 Would it make sense to speculatively include FUCHS
rmacnak 2017/03/17 18:22:16 Did a quick check and they are using the Linux var
zra 2017/03/17 19:39:16 Cool, thanks!
900 assembly_stream_.Print(".section .rodata\n"); 900 assembly_stream_.Print(".section .rodata\n");
901 #elif defined(HOST_OS_MACOS) 901 #elif defined(TARGET_OS_MACOS) || defined(TARGET_OS_IOS)
zra 2017/03/17 17:24:24 no define() around TARGET_OS_IOS, right?. (Maybe c
902 assembly_stream_.Print(".const\n"); 902 assembly_stream_.Print(".const\n");
903 #else 903 #else
904 // Unsupported platform. 904 UNIMPLEMENTED();
905 UNREACHABLE();
906 #endif 905 #endif
907 906
908 const char* data_symbol = 907 const char* data_symbol =
909 vm ? "_kDartVmSnapshotData" : "_kDartIsolateSnapshotData"; 908 vm ? "_kDartVmSnapshotData" : "_kDartIsolateSnapshotData";
910 assembly_stream_.Print(".globl %s\n", data_symbol); 909 assembly_stream_.Print(".globl %s\n", data_symbol);
911 assembly_stream_.Print(".balign %" Pd ", 0\n", 910 assembly_stream_.Print(".balign %" Pd ", 0\n",
912 OS::kMaxPreferredCodeAlignment); 911 OS::kMaxPreferredCodeAlignment);
913 assembly_stream_.Print("%s:\n", data_symbol); 912 assembly_stream_.Print("%s:\n", data_symbol);
914 uword buffer = reinterpret_cast<uword>(clustered_stream->buffer()); 913 uword buffer = reinterpret_cast<uword>(clustered_stream->buffer());
915 intptr_t length = clustered_stream->bytes_written(); 914 intptr_t length = clustered_stream->bytes_written();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 // Should be ".cfi_value_offset sp, 16", but requires gcc newer than late 946 // Should be ".cfi_value_offset sp, 16", but requires gcc newer than late
948 // 2016 and not supported by Android's libunwind. 947 // 2016 and not supported by Android's libunwind.
949 // DW_CFA_expression 0x10 948 // DW_CFA_expression 0x10
950 // uleb128 register (x31) 31 949 // uleb128 register (x31) 31
951 // uleb128 size of operation 2 950 // uleb128 size of operation 2
952 // DW_OP_plus_uconst 0x23 951 // DW_OP_plus_uconst 0x23
953 // uleb128 addend 16 952 // uleb128 addend 16
954 assembly_stream_.Print(".cfi_escape 0x10, 31, 2, 0x23, 16\n"); 953 assembly_stream_.Print(".cfi_escape 0x10, 31, 2, 0x23, 16\n");
955 954
956 #elif defined(TARGET_ARCH_ARM) 955 #elif defined(TARGET_ARCH_ARM)
957 #if defined(TARGET_ABI_EABI) 956 #if defined(TARGET_OS_MACOS) || TARGET_OS_IOS
957 COMPILE_ASSERT(FP == R7);
958 assembly_stream_.Print(".cfi_def_cfa r7, 0\n"); // CFA is fp+j0
959 assembly_stream_.Print(".cfi_offset r7, 0\n"); // saved fp is *(CFA+0)
960 #else
958 COMPILE_ASSERT(FP == R11); 961 COMPILE_ASSERT(FP == R11);
959 assembly_stream_.Print(".cfi_def_cfa r11, 0\n"); // CFA is fp+0 962 assembly_stream_.Print(".cfi_def_cfa r11, 0\n"); // CFA is fp+0
960 assembly_stream_.Print(".cfi_offset r11, 0\n"); // saved fp is *(CFA+0) 963 assembly_stream_.Print(".cfi_offset r11, 0\n"); // saved fp is *(CFA+0)
961 #elif defined(TARGET_ABI_IOS)
962 COMPILE_ASSERT(FP == R7);
963 assembly_stream_.Print(".cfi_def_cfa r7, 0\n"); // CFA is fp+0
964 assembly_stream_.Print(".cfi_offset r7, 0\n"); // saved fp is *(CFA+0)
965 #endif 964 #endif
966 assembly_stream_.Print(".cfi_offset lr, 4\n"); // saved pc is *(CFA+4) 965 assembly_stream_.Print(".cfi_offset lr, 4\n"); // saved pc is *(CFA+4)
967 // saved sp is CFA+8 966 // saved sp is CFA+8
968 // Should be ".cfi_value_offset sp, 8", but requires gcc newer than late 967 // Should be ".cfi_value_offset sp, 8", but requires gcc newer than late
969 // 2016 and not supported by Android's libunwind. 968 // 2016 and not supported by Android's libunwind.
970 // DW_CFA_expression 0x10 969 // DW_CFA_expression 0x10
971 // uleb128 register (sp) 13 970 // uleb128 register (sp) 13
972 // uleb128 size of operation 2 971 // uleb128 size of operation 2
973 // DW_OP_plus_uconst 0x23 972 // DW_OP_plus_uconst 0x23
974 // uleb128 addend 8 973 // uleb128 addend 8
975 assembly_stream_.Print(".cfi_escape 0x10, 13, 2, 0x23, 8\n"); 974 assembly_stream_.Print(".cfi_escape 0x10, 13, 2, 0x23, 8\n");
976 975
977 // libunwind on ARM may use .ARM.exidx instead of .debug_frame 976 // libunwind on ARM may use .ARM.exidx instead of .debug_frame
978 #if defined(TARGET_ABI_EABI) 977 #if defined(TARGET_OS_MACOS) || TARGET_OS_IOS
978 COMPILE_ASSERT(FP == R7);
979 assembly_stream_.Print(".fnstart\n");
980 assembly_stream_.Print(".save {r7, lr}\n");
981 assembly_stream_.Print(".setfp r7, sp, #0\n");
982 #else
979 COMPILE_ASSERT(FP == R11); 983 COMPILE_ASSERT(FP == R11);
980 assembly_stream_.Print(".fnstart\n"); 984 assembly_stream_.Print(".fnstart\n");
981 assembly_stream_.Print(".save {r11, lr}\n"); 985 assembly_stream_.Print(".save {r11, lr}\n");
982 assembly_stream_.Print(".setfp r11, sp, #0\n"); 986 assembly_stream_.Print(".setfp r11, sp, #0\n");
983 #elif defined(TARGET_ABI_IOS)
984 COMPILE_ASSERT(FP == R7);
985 assembly_stream_.Print(".fnstart\n");
986 assembly_stream_.Print(".save {r7, lr}\n");
987 assembly_stream_.Print(".setfp r7, sp, #0\n");
988 #endif 987 #endif
989 988
990 #elif defined(TARGET_ARCH_MIPS) 989 #elif defined(TARGET_ARCH_MIPS)
991 COMPILE_ASSERT(FP == R30); 990 COMPILE_ASSERT(FP == R30);
992 COMPILE_ASSERT(RA == R31); 991 COMPILE_ASSERT(RA == R31);
993 assembly_stream_.Print(".cfi_def_cfa r30, 0\n"); // CFA is fp+0 992 assembly_stream_.Print(".cfi_def_cfa r30, 0\n"); // CFA is fp+0
994 assembly_stream_.Print(".cfi_offset r30, 0\n"); // saved fp is *(CFA+0) 993 assembly_stream_.Print(".cfi_offset r30, 0\n"); // saved fp is *(CFA+0)
995 assembly_stream_.Print(".cfi_offset r31, 4\n"); // saved pc is *(CFA+4) 994 assembly_stream_.Print(".cfi_offset r31, 4\n"); // saved pc is *(CFA+4)
996 // saved sp is CFA+16 995 // saved sp is CFA+16
997 // Should be ".cfi_value_offset sp, 8", but requires gcc newer than late 996 // Should be ".cfi_value_offset sp, 8", but requires gcc newer than late
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after
2046 *buffer_len_ = BytesWritten(); 2045 *buffer_len_ = BytesWritten();
2047 } 2046 }
2048 } else { 2047 } else {
2049 FreeBuffer(); 2048 FreeBuffer();
2050 ThrowException(exception_type(), exception_msg()); 2049 ThrowException(exception_type(), exception_msg());
2051 } 2050 }
2052 } 2051 }
2053 2052
2054 2053
2055 } // namespace dart 2054 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698