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 "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
(...skipping 7090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7101 void Code::set_object_table(const Array& array) const { | 7101 void Code::set_object_table(const Array& array) const { |
7102 StorePointer(&raw_ptr()->object_table_, array.raw()); | 7102 StorePointer(&raw_ptr()->object_table_, array.raw()); |
7103 } | 7103 } |
7104 | 7104 |
7105 | 7105 |
7106 void Code::set_static_calls_target_table(const Array& value) const { | 7106 void Code::set_static_calls_target_table(const Array& value) const { |
7107 StorePointer(&raw_ptr()->static_calls_target_table_, value.raw()); | 7107 StorePointer(&raw_ptr()->static_calls_target_table_, value.raw()); |
7108 } | 7108 } |
7109 | 7109 |
7110 | 7110 |
| 7111 RawDeoptInfo* Code::GetDeoptInfoAtPc(uword pc, intptr_t* deopt_reason) const { |
| 7112 ASSERT(is_optimized()); |
| 7113 const Instructions& instrs = Instructions::Handle(instructions()); |
| 7114 uword code_entry = instrs.EntryPoint(); |
| 7115 const Array& table = Array::Handle(deopt_info_array()); |
| 7116 ASSERT(!table.IsNull()); |
| 7117 // Linear search for the PC offset matching the target PC. |
| 7118 intptr_t length = DeoptTable::GetLength(table); |
| 7119 Smi& offset = Smi::Handle(); |
| 7120 Smi& reason = Smi::Handle(); |
| 7121 DeoptInfo& info = DeoptInfo::Handle(); |
| 7122 for (intptr_t i = 0; i < length; ++i) { |
| 7123 DeoptTable::GetEntry(table, i, &offset, &info, &reason); |
| 7124 if (pc == (code_entry + offset.Value())) { |
| 7125 ASSERT(!info.IsNull()); |
| 7126 *deopt_reason = reason.Value(); |
| 7127 return info.raw(); |
| 7128 } |
| 7129 } |
| 7130 *deopt_reason = kDeoptUnknown; |
| 7131 return DeoptInfo::null(); |
| 7132 } |
| 7133 |
| 7134 |
7111 RawFunction* Code::GetStaticCallTargetFunctionAt(uword pc) const { | 7135 RawFunction* Code::GetStaticCallTargetFunctionAt(uword pc) const { |
7112 RawObject* raw_code_offset = | 7136 RawObject* raw_code_offset = |
7113 reinterpret_cast<RawObject*>(Smi::New(pc - EntryPoint())); | 7137 reinterpret_cast<RawObject*>(Smi::New(pc - EntryPoint())); |
7114 const Array& array = | 7138 const Array& array = |
7115 Array::Handle(raw_ptr()->static_calls_target_table_); | 7139 Array::Handle(raw_ptr()->static_calls_target_table_); |
7116 for (intptr_t i = 0; i < array.Length(); i += kSCallTableEntryLength) { | 7140 for (intptr_t i = 0; i < array.Length(); i += kSCallTableEntryLength) { |
7117 if (array.At(i) == raw_code_offset) { | 7141 if (array.At(i) == raw_code_offset) { |
7118 Function& function = Function::Handle(); | 7142 Function& function = Function::Handle(); |
7119 function ^= array.At(i + kSCallTableFunctionEntry); | 7143 function ^= array.At(i + kSCallTableFunctionEntry); |
7120 return function.raw(); | 7144 return function.raw(); |
(...skipping 5307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12428 } | 12452 } |
12429 return result.raw(); | 12453 return result.raw(); |
12430 } | 12454 } |
12431 | 12455 |
12432 | 12456 |
12433 const char* WeakProperty::ToCString() const { | 12457 const char* WeakProperty::ToCString() const { |
12434 return "_WeakProperty"; | 12458 return "_WeakProperty"; |
12435 } | 12459 } |
12436 | 12460 |
12437 } // namespace dart | 12461 } // namespace dart |
OLD | NEW |