| 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 7130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7141 void Code::set_object_table(const Array& array) const { | 7141 void Code::set_object_table(const Array& array) const { |
| 7142 StorePointer(&raw_ptr()->object_table_, array.raw()); | 7142 StorePointer(&raw_ptr()->object_table_, array.raw()); |
| 7143 } | 7143 } |
| 7144 | 7144 |
| 7145 | 7145 |
| 7146 void Code::set_static_calls_target_table(const Array& value) const { | 7146 void Code::set_static_calls_target_table(const Array& value) const { |
| 7147 StorePointer(&raw_ptr()->static_calls_target_table_, value.raw()); | 7147 StorePointer(&raw_ptr()->static_calls_target_table_, value.raw()); |
| 7148 } | 7148 } |
| 7149 | 7149 |
| 7150 | 7150 |
| 7151 RawDeoptInfo* Code::GetDeoptInfoAtPc(uword pc, intptr_t* deopt_reason) const { |
| 7152 ASSERT(is_optimized()); |
| 7153 const Instructions& instrs = Instructions::Handle(instructions()); |
| 7154 uword code_entry = instrs.EntryPoint(); |
| 7155 const Array& table = Array::Handle(deopt_info_array()); |
| 7156 ASSERT(!table.IsNull()); |
| 7157 // Linear search for the PC offset matching the target PC. |
| 7158 intptr_t length = DeoptTable::GetLength(table); |
| 7159 Smi& offset = Smi::Handle(); |
| 7160 Smi& reason = Smi::Handle(); |
| 7161 DeoptInfo& info = DeoptInfo::Handle(); |
| 7162 for (intptr_t i = 0; i < length; ++i) { |
| 7163 DeoptTable::GetEntry(table, i, &offset, &info, &reason); |
| 7164 if (pc == (code_entry + offset.Value())) { |
| 7165 ASSERT(!info.IsNull()); |
| 7166 *deopt_reason = reason.Value(); |
| 7167 return info.raw(); |
| 7168 } |
| 7169 } |
| 7170 *deopt_reason = kDeoptUnknown; |
| 7171 return DeoptInfo::null(); |
| 7172 } |
| 7173 |
| 7174 |
| 7151 RawFunction* Code::GetStaticCallTargetFunctionAt(uword pc) const { | 7175 RawFunction* Code::GetStaticCallTargetFunctionAt(uword pc) const { |
| 7152 RawObject* raw_code_offset = | 7176 RawObject* raw_code_offset = |
| 7153 reinterpret_cast<RawObject*>(Smi::New(pc - EntryPoint())); | 7177 reinterpret_cast<RawObject*>(Smi::New(pc - EntryPoint())); |
| 7154 const Array& array = | 7178 const Array& array = |
| 7155 Array::Handle(raw_ptr()->static_calls_target_table_); | 7179 Array::Handle(raw_ptr()->static_calls_target_table_); |
| 7156 for (intptr_t i = 0; i < array.Length(); i += kSCallTableEntryLength) { | 7180 for (intptr_t i = 0; i < array.Length(); i += kSCallTableEntryLength) { |
| 7157 if (array.At(i) == raw_code_offset) { | 7181 if (array.At(i) == raw_code_offset) { |
| 7158 Function& function = Function::Handle(); | 7182 Function& function = Function::Handle(); |
| 7159 function ^= array.At(i + kSCallTableFunctionEntry); | 7183 function ^= array.At(i + kSCallTableFunctionEntry); |
| 7160 return function.raw(); | 7184 return function.raw(); |
| (...skipping 5307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12468 } | 12492 } |
| 12469 return result.raw(); | 12493 return result.raw(); |
| 12470 } | 12494 } |
| 12471 | 12495 |
| 12472 | 12496 |
| 12473 const char* WeakProperty::ToCString() const { | 12497 const char* WeakProperty::ToCString() const { |
| 12474 return "_WeakProperty"; | 12498 return "_WeakProperty"; |
| 12475 } | 12499 } |
| 12476 | 12500 |
| 12477 } // namespace dart | 12501 } // namespace dart |
| OLD | NEW |