OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/globals.h" | 5 #include "vm/globals.h" |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/code_generator.h" | 9 #include "vm/code_generator.h" |
10 #include "vm/heap.h" | 10 #include "vm/heap.h" |
11 #include "vm/heap_trace.h" | 11 #include "vm/heap_trace.h" |
12 #include "vm/memory_region.h" | 12 #include "vm/memory_region.h" |
13 #include "vm/runtime_entry.h" | 13 #include "vm/runtime_entry.h" |
14 #include "vm/stub_code.h" | 14 #include "vm/stub_code.h" |
15 | 15 |
16 namespace dart { | 16 namespace dart { |
17 | 17 |
18 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); | 18 DEFINE_FLAG(bool, print_stop_message, true, "Print stop message."); |
19 DEFINE_FLAG(bool, code_comments, false, | |
20 "Include comments into code and disassembly"); | |
21 DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available"); | 19 DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available"); |
22 | 20 |
23 | 21 |
24 bool CPUFeatures::sse2_supported_ = false; | 22 bool CPUFeatures::sse2_supported_ = false; |
25 bool CPUFeatures::sse4_1_supported_ = false; | 23 bool CPUFeatures::sse4_1_supported_ = false; |
26 #ifdef DEBUG | 24 #ifdef DEBUG |
27 bool CPUFeatures::initialized_ = false; | 25 bool CPUFeatures::initialized_ = false; |
28 #endif | 26 #endif |
29 | 27 |
30 | 28 |
(...skipping 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2045 | 2043 |
2046 | 2044 |
2047 void Assembler::CompareClassId(Register object, | 2045 void Assembler::CompareClassId(Register object, |
2048 intptr_t class_id, | 2046 intptr_t class_id, |
2049 Register scratch) { | 2047 Register scratch) { |
2050 LoadClassId(scratch, object); | 2048 LoadClassId(scratch, object); |
2051 cmpl(scratch, Immediate(class_id)); | 2049 cmpl(scratch, Immediate(class_id)); |
2052 } | 2050 } |
2053 | 2051 |
2054 | 2052 |
2055 void Assembler::Comment(const char* format, ...) { | |
2056 if (FLAG_code_comments) { | |
2057 char buffer[1024]; | |
2058 | |
2059 va_list args; | |
2060 va_start(args, format); | |
2061 OS::VSNPrint(buffer, sizeof(buffer), format, args); | |
2062 va_end(args); | |
2063 | |
2064 comments_.Add(new CodeComment(buffer_.GetPosition(), | |
2065 String::Handle(String::New(buffer)))); | |
2066 } | |
2067 } | |
2068 | |
2069 | |
2070 const Code::Comments& Assembler::GetCodeComments() const { | |
2071 Code::Comments& comments = Code::Comments::New(comments_.length()); | |
2072 | |
2073 for (intptr_t i = 0; i < comments_.length(); i++) { | |
2074 comments.SetPCOffsetAt(i, comments_[i]->pc_offset()); | |
2075 comments.SetCommentAt(i, comments_[i]->comment()); | |
2076 } | |
2077 | |
2078 return comments; | |
2079 } | |
2080 | |
2081 | |
2082 static const char* cpu_reg_names[kNumberOfCpuRegisters] = { | 2053 static const char* cpu_reg_names[kNumberOfCpuRegisters] = { |
2083 "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" | 2054 "eax", "ecx", "edx", "ebx", "esp", "ebp", "esi", "edi" |
2084 }; | 2055 }; |
2085 | 2056 |
2086 | 2057 |
2087 const char* Assembler::RegisterName(Register reg) { | 2058 const char* Assembler::RegisterName(Register reg) { |
2088 ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); | 2059 ASSERT((0 <= reg) && (reg < kNumberOfCpuRegisters)); |
2089 return cpu_reg_names[reg]; | 2060 return cpu_reg_names[reg]; |
2090 } | 2061 } |
2091 | 2062 |
2092 | 2063 |
2093 static const char* xmm_reg_names[kNumberOfXmmRegisters] = { | 2064 static const char* xmm_reg_names[kNumberOfXmmRegisters] = { |
2094 "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" | 2065 "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" |
2095 }; | 2066 }; |
2096 | 2067 |
2097 | 2068 |
2098 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 2069 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
2099 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); | 2070 ASSERT((0 <= reg) && (reg < kNumberOfXmmRegisters)); |
2100 return xmm_reg_names[reg]; | 2071 return xmm_reg_names[reg]; |
2101 } | 2072 } |
2102 | 2073 |
2103 | 2074 |
2104 } // namespace dart | 2075 } // namespace dart |
2105 | 2076 |
2106 #endif // defined TARGET_ARCH_IA32 | 2077 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |