OLD | NEW |
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/object.h" | 5 #include "vm/object.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
11 #include "vm/code_generator.h" | 11 #include "vm/code_generator.h" |
12 #include "vm/code_index_table.h" | |
13 #include "vm/code_patcher.h" | 12 #include "vm/code_patcher.h" |
14 #include "vm/compiler.h" | 13 #include "vm/compiler.h" |
15 #include "vm/compiler_stats.h" | 14 #include "vm/compiler_stats.h" |
16 #include "vm/class_finalizer.h" | 15 #include "vm/class_finalizer.h" |
17 #include "vm/dart.h" | 16 #include "vm/dart.h" |
18 #include "vm/dart_api_state.h" | 17 #include "vm/dart_api_state.h" |
19 #include "vm/dart_entry.h" | 18 #include "vm/dart_entry.h" |
20 #include "vm/debuginfo.h" | 19 #include "vm/debuginfo.h" |
21 #include "vm/double_conversion.h" | 20 #include "vm/double_conversion.h" |
22 #include "vm/exceptions.h" | 21 #include "vm/exceptions.h" |
23 #include "vm/growable_array.h" | 22 #include "vm/growable_array.h" |
24 #include "vm/heap.h" | 23 #include "vm/heap.h" |
25 #include "vm/object_store.h" | 24 #include "vm/object_store.h" |
26 #include "vm/parser.h" | 25 #include "vm/parser.h" |
27 #include "vm/runtime_entry.h" | 26 #include "vm/runtime_entry.h" |
28 #include "vm/scopes.h" | 27 #include "vm/scopes.h" |
| 28 #include "vm/stack_frame.h" |
29 #include "vm/timer.h" | 29 #include "vm/timer.h" |
30 #include "vm/unicode.h" | 30 #include "vm/unicode.h" |
31 | 31 |
32 namespace dart { | 32 namespace dart { |
33 | 33 |
34 DEFINE_FLAG(bool, generate_gdb_symbols, false, | 34 DEFINE_FLAG(bool, generate_gdb_symbols, false, |
35 "Generate symbols of generated dart functions for debugging with GDB"); | 35 "Generate symbols of generated dart functions for debugging with GDB"); |
36 DECLARE_FLAG(bool, trace_compiler); | 36 DECLARE_FLAG(bool, trace_compiler); |
37 DECLARE_FLAG(bool, enable_type_checks); | 37 DECLARE_FLAG(bool, enable_type_checks); |
38 | 38 |
(...skipping 8695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8734 } | 8734 } |
8735 | 8735 |
8736 | 8736 |
8737 void Stacktrace::set_pc_offset_array(const Array& pc_offset_array) const { | 8737 void Stacktrace::set_pc_offset_array(const Array& pc_offset_array) const { |
8738 StorePointer(&raw_ptr()->pc_offset_array_, pc_offset_array.raw()); | 8738 StorePointer(&raw_ptr()->pc_offset_array_, pc_offset_array.raw()); |
8739 } | 8739 } |
8740 | 8740 |
8741 | 8741 |
8742 void Stacktrace::SetupStacktrace(intptr_t index, | 8742 void Stacktrace::SetupStacktrace(intptr_t index, |
8743 const GrowableArray<uword>& frame_pcs) const { | 8743 const GrowableArray<uword>& frame_pcs) const { |
8744 ASSERT(Isolate::Current() != NULL); | 8744 Isolate* isolate = Isolate::Current(); |
8745 CodeIndexTable* code_index_table = Isolate::Current()->code_index_table(); | 8745 ASSERT(isolate != NULL); |
8746 ASSERT(code_index_table != NULL); | 8746 Function& function = Function::Handle(isolate, Function::null()); |
8747 Function& function = Function::Handle(); | 8747 Code& code = Code::Handle(isolate, Code::null()); |
8748 Code& code = Code::Handle(); | 8748 Smi& pc_offset = Smi::Handle(isolate, Smi::New(0)); |
8749 Smi& pc_offset = Smi::Handle(); | |
8750 const Array& function_array = Array::Handle(raw_ptr()->function_array_); | 8749 const Array& function_array = Array::Handle(raw_ptr()->function_array_); |
8751 const Array& code_array = Array::Handle(raw_ptr()->code_array_); | 8750 const Array& code_array = Array::Handle(raw_ptr()->code_array_); |
8752 const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); | 8751 const Array& pc_offset_array = Array::Handle(raw_ptr()->pc_offset_array_); |
8753 for (intptr_t i = 0; i < frame_pcs.length(); i++) { | 8752 for (intptr_t i = 0; i < frame_pcs.length(); i++) { |
8754 code = code_index_table->LookupCode(frame_pcs[i]); | 8753 code = StackFrame::LookupCode(isolate, frame_pcs[i]); |
8755 ASSERT(!code.IsNull()); | 8754 ASSERT(!code.IsNull()); |
8756 function = code.function(); | 8755 function = code.function(); |
8757 function_array.SetAt((index + i), function); | 8756 function_array.SetAt((index + i), function); |
8758 code_array.SetAt((index + i), code); | 8757 code_array.SetAt((index + i), code); |
8759 pc_offset = Smi::New(frame_pcs[i] - code.EntryPoint()); | 8758 pc_offset = Smi::New(frame_pcs[i] - code.EntryPoint()); |
8760 pc_offset_array.SetAt((index + i), pc_offset); | 8759 pc_offset_array.SetAt((index + i), pc_offset); |
8761 } | 8760 } |
8762 } | 8761 } |
8763 | 8762 |
8764 | 8763 |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8969 const String& str = String::Handle(pattern()); | 8968 const String& str = String::Handle(pattern()); |
8970 const char* format = "JSRegExp: pattern=%s flags=%s"; | 8969 const char* format = "JSRegExp: pattern=%s flags=%s"; |
8971 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 8970 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
8972 char* chars = reinterpret_cast<char*>( | 8971 char* chars = reinterpret_cast<char*>( |
8973 Isolate::Current()->current_zone()->Allocate(len + 1)); | 8972 Isolate::Current()->current_zone()->Allocate(len + 1)); |
8974 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 8973 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
8975 return chars; | 8974 return chars; |
8976 } | 8975 } |
8977 | 8976 |
8978 } // namespace dart | 8977 } // namespace dart |
OLD | NEW |