| 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 13482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13493 | 13493 |
| 13494 bool Code::IsFunctionCode() const { | 13494 bool Code::IsFunctionCode() const { |
| 13495 const Object& obj = Object::Handle(owner()); | 13495 const Object& obj = Object::Handle(owner()); |
| 13496 return obj.IsFunction(); | 13496 return obj.IsFunction(); |
| 13497 } | 13497 } |
| 13498 | 13498 |
| 13499 | 13499 |
| 13500 void Code::DisableDartCode() const { | 13500 void Code::DisableDartCode() const { |
| 13501 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); | 13501 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); |
| 13502 ASSERT(IsFunctionCode()); | 13502 ASSERT(IsFunctionCode()); |
| 13503 ASSERT(instructions() == active_instructions()); | 13503 ASSERT(!IsDisabled()); |
| 13504 const Code& new_code = | 13504 const Code& new_code = |
| 13505 Code::Handle(StubCode::FixCallersTarget_entry()->code()); | 13505 Code::Handle(StubCode::FixCallersTarget_entry()->code()); |
| 13506 ASSERT(new_code.instructions()->IsVMHeapObject()); |
| 13506 SetActiveInstructions(new_code.instructions()); | 13507 SetActiveInstructions(new_code.instructions()); |
| 13507 } | 13508 } |
| 13508 | 13509 |
| 13509 | 13510 |
| 13510 void Code::DisableStubCode() const { | 13511 void Code::DisableStubCode() const { |
| 13511 ASSERT(Thread::Current()->IsMutatorThread()); | 13512 ASSERT(Thread::Current()->IsMutatorThread()); |
| 13512 ASSERT(IsAllocationStubCode()); | 13513 ASSERT(IsAllocationStubCode()); |
| 13513 ASSERT(instructions() == active_instructions()); | 13514 ASSERT(!IsDisabled()); |
| 13514 const Code& new_code = | 13515 const Code& new_code = |
| 13515 Code::Handle(StubCode::FixAllocationStubTarget_entry()->code()); | 13516 Code::Handle(StubCode::FixAllocationStubTarget_entry()->code()); |
| 13517 ASSERT(new_code.instructions()->IsVMHeapObject()); |
| 13516 SetActiveInstructions(new_code.instructions()); | 13518 SetActiveInstructions(new_code.instructions()); |
| 13517 } | 13519 } |
| 13518 | 13520 |
| 13519 | 13521 |
| 13520 void Code::SetActiveInstructions(RawInstructions* instructions) const { | 13522 void Code::SetActiveInstructions(RawInstructions* instructions) const { |
| 13521 DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive()); | 13523 DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive()); |
| 13522 // RawInstructions are never allocated in New space and hence a | 13524 // RawInstructions are never allocated in New space and hence a |
| 13523 // store buffer update is not needed here. | 13525 // store buffer update is not needed here. |
| 13524 StorePointer(&raw_ptr()->active_instructions_, instructions); | |
| 13525 StoreNonPointer(&raw_ptr()->entry_point_, | 13526 StoreNonPointer(&raw_ptr()->entry_point_, |
| 13526 reinterpret_cast<uword>(instructions->ptr()) + | 13527 reinterpret_cast<uword>(instructions->ptr()) + |
| 13527 Instructions::HeaderSize()); | 13528 Instructions::HeaderSize()); |
| 13528 } | 13529 } |
| 13529 | 13530 |
| 13530 | 13531 |
| 13531 uword Code::GetLazyDeoptPc() const { | 13532 uword Code::GetLazyDeoptPc() const { |
| 13532 return (lazy_deopt_pc_offset() != kInvalidPc) | 13533 return (lazy_deopt_pc_offset() != kInvalidPc) |
| 13533 ? EntryPoint() + lazy_deopt_pc_offset() : 0; | 13534 ? EntryPoint() + lazy_deopt_pc_offset() : 0; |
| 13534 } | 13535 } |
| (...skipping 8188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21723 return UserTag::null(); | 21724 return UserTag::null(); |
| 21724 } | 21725 } |
| 21725 | 21726 |
| 21726 | 21727 |
| 21727 const char* UserTag::ToCString() const { | 21728 const char* UserTag::ToCString() const { |
| 21728 const String& tag_label = String::Handle(label()); | 21729 const String& tag_label = String::Handle(label()); |
| 21729 return tag_label.ToCString(); | 21730 return tag_label.ToCString(); |
| 21730 } | 21731 } |
| 21731 | 21732 |
| 21732 } // namespace dart | 21733 } // namespace dart |
| OLD | NEW |