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