| 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/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 13499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13510 | 13510 |
| 13511 bool Code::IsFunctionCode() const { | 13511 bool Code::IsFunctionCode() const { |
| 13512 const Object& obj = Object::Handle(owner()); | 13512 const Object& obj = Object::Handle(owner()); |
| 13513 return obj.IsFunction(); | 13513 return obj.IsFunction(); |
| 13514 } | 13514 } |
| 13515 | 13515 |
| 13516 | 13516 |
| 13517 void Code::DisableDartCode() const { | 13517 void Code::DisableDartCode() const { |
| 13518 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); | 13518 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); |
| 13519 ASSERT(IsFunctionCode()); | 13519 ASSERT(IsFunctionCode()); |
| 13520 ASSERT(!IsDisabled()); | 13520 ASSERT(instructions() == active_instructions()); |
| 13521 const Code& new_code = | 13521 const Code& new_code = |
| 13522 Code::Handle(StubCode::FixCallersTarget_entry()->code()); | 13522 Code::Handle(StubCode::FixCallersTarget_entry()->code()); |
| 13523 ASSERT(new_code.instructions()->IsVMHeapObject()); | |
| 13524 SetActiveInstructions(new_code.instructions()); | 13523 SetActiveInstructions(new_code.instructions()); |
| 13525 } | 13524 } |
| 13526 | 13525 |
| 13527 | 13526 |
| 13528 void Code::DisableStubCode() const { | 13527 void Code::DisableStubCode() const { |
| 13529 ASSERT(Thread::Current()->IsMutatorThread()); | 13528 ASSERT(Thread::Current()->IsMutatorThread()); |
| 13530 ASSERT(IsAllocationStubCode()); | 13529 ASSERT(IsAllocationStubCode()); |
| 13531 ASSERT(!IsDisabled()); | 13530 ASSERT(instructions() == active_instructions()); |
| 13532 const Code& new_code = | 13531 const Code& new_code = |
| 13533 Code::Handle(StubCode::FixAllocationStubTarget_entry()->code()); | 13532 Code::Handle(StubCode::FixAllocationStubTarget_entry()->code()); |
| 13534 ASSERT(new_code.instructions()->IsVMHeapObject()); | |
| 13535 SetActiveInstructions(new_code.instructions()); | 13533 SetActiveInstructions(new_code.instructions()); |
| 13536 } | 13534 } |
| 13537 | 13535 |
| 13538 | 13536 |
| 13539 void Code::SetActiveInstructions(RawInstructions* instructions) const { | 13537 void Code::SetActiveInstructions(RawInstructions* instructions) const { |
| 13540 DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive()); | 13538 DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive()); |
| 13541 // RawInstructions are never allocated in New space and hence a | 13539 // RawInstructions are never allocated in New space and hence a |
| 13542 // store buffer update is not needed here. | 13540 // store buffer update is not needed here. |
| 13541 StorePointer(&raw_ptr()->active_instructions_, instructions); |
| 13543 StoreNonPointer(&raw_ptr()->entry_point_, | 13542 StoreNonPointer(&raw_ptr()->entry_point_, |
| 13544 reinterpret_cast<uword>(instructions->ptr()) + | 13543 reinterpret_cast<uword>(instructions->ptr()) + |
| 13545 Instructions::HeaderSize()); | 13544 Instructions::HeaderSize()); |
| 13546 } | 13545 } |
| 13547 | 13546 |
| 13548 | 13547 |
| 13549 uword Code::GetLazyDeoptPc() const { | 13548 uword Code::GetLazyDeoptPc() const { |
| 13550 return (lazy_deopt_pc_offset() != kInvalidPc) | 13549 return (lazy_deopt_pc_offset() != kInvalidPc) |
| 13551 ? EntryPoint() + lazy_deopt_pc_offset() : 0; | 13550 ? EntryPoint() + lazy_deopt_pc_offset() : 0; |
| 13552 } | 13551 } |
| (...skipping 8188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21741 return UserTag::null(); | 21740 return UserTag::null(); |
| 21742 } | 21741 } |
| 21743 | 21742 |
| 21744 | 21743 |
| 21745 const char* UserTag::ToCString() const { | 21744 const char* UserTag::ToCString() const { |
| 21746 const String& tag_label = String::Handle(label()); | 21745 const String& tag_label = String::Handle(label()); |
| 21747 return tag_label.ToCString(); | 21746 return tag_label.ToCString(); |
| 21748 } | 21747 } |
| 21749 | 21748 |
| 21750 } // namespace dart | 21749 } // namespace dart |
| OLD | NEW |