Chromium Code Reviews| 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/become.h" | 10 #include "vm/become.h" |
| (...skipping 11561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11572 | 11572 |
| 11573 #undef CHECK_FACTORY_FINGERPRINTS | 11573 #undef CHECK_FACTORY_FINGERPRINTS |
| 11574 | 11574 |
| 11575 if (has_errors) { | 11575 if (has_errors) { |
| 11576 FATAL("Fingerprint mismatch."); | 11576 FATAL("Fingerprint mismatch."); |
| 11577 } | 11577 } |
| 11578 } | 11578 } |
| 11579 #endif // defined(DART_NO_SNAPSHOT) && !defined(PRODUCT). | 11579 #endif // defined(DART_NO_SNAPSHOT) && !defined(PRODUCT). |
| 11580 | 11580 |
| 11581 | 11581 |
| 11582 RawInstructions* Instructions::New(intptr_t size) { | 11582 RawInstructions* Instructions::New(intptr_t size, bool has_single_entry_point) { |
| 11583 ASSERT(size >= 0); | |
| 11583 ASSERT(Object::instructions_class() != Class::null()); | 11584 ASSERT(Object::instructions_class() != Class::null()); |
| 11584 if (size < 0 || size > kMaxElements) { | 11585 if (size < 0 || size > kMaxElements) { |
| 11585 // This should be caught before we reach here. | 11586 // This should be caught before we reach here. |
| 11586 FATAL1("Fatal error in Instructions::New: invalid size %" Pd "\n", size); | 11587 FATAL1("Fatal error in Instructions::New: invalid size %" Pd "\n", size); |
| 11587 } | 11588 } |
| 11588 Instructions& result = Instructions::Handle(); | 11589 Instructions& result = Instructions::Handle(); |
| 11589 { | 11590 { |
| 11590 uword aligned_size = Instructions::InstanceSize(size); | 11591 uword aligned_size = Instructions::InstanceSize(size); |
| 11591 RawObject* raw = Object::Allocate(Instructions::kClassId, | 11592 RawObject* raw = Object::Allocate(Instructions::kClassId, |
| 11592 aligned_size, | 11593 aligned_size, |
| 11593 Heap::kCode); | 11594 Heap::kCode); |
| 11594 NoSafepointScope no_safepoint; | 11595 NoSafepointScope no_safepoint; |
| 11595 result ^= raw; | 11596 result ^= raw; |
| 11596 result.set_size(size); | 11597 result.set_size(has_single_entry_point ? size : -size); |
| 11597 } | 11598 } |
| 11598 return result.raw(); | 11599 return result.raw(); |
| 11599 } | 11600 } |
| 11600 | 11601 |
| 11601 | 11602 |
| 11602 const char* Instructions::ToCString() const { | 11603 const char* Instructions::ToCString() const { |
| 11603 return "Instructions"; | 11604 return "Instructions"; |
| 11604 } | 11605 } |
| 11605 | 11606 |
| 11606 | 11607 |
| (...skipping 2650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14257 ObjectPool::Handle(assembler->object_pool_wrapper().MakeObjectPool()); | 14258 ObjectPool::Handle(assembler->object_pool_wrapper().MakeObjectPool()); |
| 14258 | 14259 |
| 14259 // Allocate the Code and Instructions objects. Code is allocated first | 14260 // Allocate the Code and Instructions objects. Code is allocated first |
| 14260 // because a GC during allocation of the code will leave the instruction | 14261 // because a GC during allocation of the code will leave the instruction |
| 14261 // pages read-only. | 14262 // pages read-only. |
| 14262 intptr_t pointer_offset_count = assembler->CountPointerOffsets(); | 14263 intptr_t pointer_offset_count = assembler->CountPointerOffsets(); |
| 14263 Code& code = Code::ZoneHandle(Code::New(pointer_offset_count)); | 14264 Code& code = Code::ZoneHandle(Code::New(pointer_offset_count)); |
| 14264 #ifdef TARGET_ARCH_IA32 | 14265 #ifdef TARGET_ARCH_IA32 |
| 14265 assembler->set_code_object(code); | 14266 assembler->set_code_object(code); |
| 14266 #endif | 14267 #endif |
| 14267 Instructions& instrs = | 14268 Instructions& instrs = Instructions::ZoneHandle( |
| 14268 Instructions::ZoneHandle(Instructions::New(assembler->CodeSize())); | 14269 Instructions::New(assembler->CodeSize(), |
| 14270 assembler->has_single_entry_point())); | |
| 14269 INC_STAT(Thread::Current(), total_instr_size, assembler->CodeSize()); | 14271 INC_STAT(Thread::Current(), total_instr_size, assembler->CodeSize()); |
| 14270 INC_STAT(Thread::Current(), total_code_size, assembler->CodeSize()); | 14272 INC_STAT(Thread::Current(), total_code_size, assembler->CodeSize()); |
| 14271 | 14273 |
| 14272 // Copy the instructions into the instruction area and apply all fixups. | 14274 // Copy the instructions into the instruction area and apply all fixups. |
| 14273 // Embedded pointers are still in handles at this point. | 14275 // Embedded pointers are still in handles at this point. |
| 14274 MemoryRegion region(reinterpret_cast<void*>(instrs.PayloadStart()), | 14276 MemoryRegion region(reinterpret_cast<void*>(instrs.PayloadStart()), |
| 14275 instrs.size()); | 14277 instrs.size()); |
| 14276 assembler->FinalizeInstructions(region); | 14278 assembler->FinalizeInstructions(region); |
| 14277 CPU::FlushICache(instrs.PayloadStart(), instrs.size()); | 14279 CPU::FlushICache(instrs.PayloadStart(), instrs.size()); |
| 14278 | 14280 |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14565 // frame slots which are marked as having objects. | 14567 // frame slots which are marked as having objects. |
| 14566 *maps = stackmaps(); | 14568 *maps = stackmaps(); |
| 14567 *map = Stackmap::null(); | 14569 *map = Stackmap::null(); |
| 14568 for (intptr_t i = 0; i < maps->Length(); i++) { | 14570 for (intptr_t i = 0; i < maps->Length(); i++) { |
| 14569 *map ^= maps->At(i); | 14571 *map ^= maps->At(i); |
| 14570 ASSERT(!map->IsNull()); | 14572 ASSERT(!map->IsNull()); |
| 14571 if (map->PcOffset() == pc_offset) { | 14573 if (map->PcOffset() == pc_offset) { |
| 14572 return map->raw(); // We found a stack map for this frame. | 14574 return map->raw(); // We found a stack map for this frame. |
| 14573 } | 14575 } |
| 14574 } | 14576 } |
| 14577 // TODO(regis): What is the purpose of this ASSERT? Is it correct? | |
| 14575 ASSERT(!is_optimized() || (pc_offset == Instructions::kUncheckedEntryOffset)); | 14578 ASSERT(!is_optimized() || (pc_offset == Instructions::kUncheckedEntryOffset)); |
|
rmacnak
2016/11/01 00:50:17
If we are missing a stack map, this must either be
regis
2016/11/02 15:45:35
Thanks!
The flag indeed revealed the issue. I add
| |
| 14576 return Stackmap::null(); | 14579 return Stackmap::null(); |
| 14577 } | 14580 } |
| 14578 | 14581 |
| 14579 | 14582 |
| 14580 intptr_t Code::GetCallerId(intptr_t inlined_id) const { | 14583 intptr_t Code::GetCallerId(intptr_t inlined_id) const { |
| 14581 if (inlined_id < 0) { | 14584 if (inlined_id < 0) { |
| 14582 return -1; | 14585 return -1; |
| 14583 } | 14586 } |
| 14584 const Array& map = Array::Handle(GetInlinedCallerIdMap()); | 14587 const Array& map = Array::Handle(GetInlinedCallerIdMap()); |
| 14585 if (map.IsNull() || (map.Length() == 0)) { | 14588 if (map.IsNull() || (map.Length() == 0)) { |
| (...skipping 8449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 23035 return UserTag::null(); | 23038 return UserTag::null(); |
| 23036 } | 23039 } |
| 23037 | 23040 |
| 23038 | 23041 |
| 23039 const char* UserTag::ToCString() const { | 23042 const char* UserTag::ToCString() const { |
| 23040 const String& tag_label = String::Handle(label()); | 23043 const String& tag_label = String::Handle(label()); |
| 23041 return tag_label.ToCString(); | 23044 return tag_label.ToCString(); |
| 23042 } | 23045 } |
| 23043 | 23046 |
| 23044 } // namespace dart | 23047 } // namespace dart |
| OLD | NEW |