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