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 13460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13471 | 13471 |
13472 bool Code::IsFunctionCode() const { | 13472 bool Code::IsFunctionCode() const { |
13473 const Object& obj = Object::Handle(owner()); | 13473 const Object& obj = Object::Handle(owner()); |
13474 return obj.IsFunction(); | 13474 return obj.IsFunction(); |
13475 } | 13475 } |
13476 | 13476 |
13477 | 13477 |
13478 void Code::DisableDartCode() const { | 13478 void Code::DisableDartCode() const { |
13479 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); | 13479 DEBUG_ASSERT(IsMutatorOrAtSafepoint()); |
13480 ASSERT(IsFunctionCode()); | 13480 ASSERT(IsFunctionCode()); |
13481 ASSERT(instructions() == active_instructions()); | 13481 ASSERT(!IsDisabled()); |
13482 const Code& new_code = | 13482 const Code& new_code = |
13483 Code::Handle(StubCode::FixCallersTarget_entry()->code()); | 13483 Code::Handle(StubCode::FixCallersTarget_entry()->code()); |
| 13484 ASSERT(new_code.instructions()->IsVMHeapObject()); |
13484 SetActiveInstructions(new_code.instructions()); | 13485 SetActiveInstructions(new_code.instructions()); |
13485 } | 13486 } |
13486 | 13487 |
13487 | 13488 |
13488 void Code::DisableStubCode() const { | 13489 void Code::DisableStubCode() const { |
13489 ASSERT(Thread::Current()->IsMutatorThread()); | 13490 ASSERT(Thread::Current()->IsMutatorThread()); |
13490 ASSERT(IsAllocationStubCode()); | 13491 ASSERT(IsAllocationStubCode()); |
13491 ASSERT(instructions() == active_instructions()); | 13492 ASSERT(!IsDisabled()); |
13492 const Code& new_code = | 13493 const Code& new_code = |
13493 Code::Handle(StubCode::FixAllocationStubTarget_entry()->code()); | 13494 Code::Handle(StubCode::FixAllocationStubTarget_entry()->code()); |
| 13495 ASSERT(new_code.instructions()->IsVMHeapObject()); |
13494 SetActiveInstructions(new_code.instructions()); | 13496 SetActiveInstructions(new_code.instructions()); |
13495 } | 13497 } |
13496 | 13498 |
13497 | 13499 |
13498 void Code::SetActiveInstructions(RawInstructions* instructions) const { | 13500 void Code::SetActiveInstructions(RawInstructions* instructions) const { |
13499 DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive()); | 13501 DEBUG_ASSERT(IsMutatorOrAtSafepoint() || !is_alive()); |
13500 // RawInstructions are never allocated in New space and hence a | 13502 // RawInstructions are never allocated in New space and hence a |
13501 // store buffer update is not needed here. | 13503 // store buffer update is not needed here. |
13502 StorePointer(&raw_ptr()->active_instructions_, instructions); | |
13503 StoreNonPointer(&raw_ptr()->entry_point_, | 13504 StoreNonPointer(&raw_ptr()->entry_point_, |
13504 reinterpret_cast<uword>(instructions->ptr()) + | 13505 reinterpret_cast<uword>(instructions->ptr()) + |
13505 Instructions::HeaderSize()); | 13506 Instructions::HeaderSize()); |
13506 } | 13507 } |
13507 | 13508 |
13508 | 13509 |
13509 uword Code::GetLazyDeoptPc() const { | 13510 uword Code::GetLazyDeoptPc() const { |
13510 return (lazy_deopt_pc_offset() != kInvalidPc) | 13511 return (lazy_deopt_pc_offset() != kInvalidPc) |
13511 ? EntryPoint() + lazy_deopt_pc_offset() : 0; | 13512 ? EntryPoint() + lazy_deopt_pc_offset() : 0; |
13512 } | 13513 } |
(...skipping 8409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21922 return UserTag::null(); | 21923 return UserTag::null(); |
21923 } | 21924 } |
21924 | 21925 |
21925 | 21926 |
21926 const char* UserTag::ToCString() const { | 21927 const char* UserTag::ToCString() const { |
21927 const String& tag_label = String::Handle(label()); | 21928 const String& tag_label = String::Handle(label()); |
21928 return tag_label.ToCString(); | 21929 return tag_label.ToCString(); |
21929 } | 21930 } |
21930 | 21931 |
21931 } // namespace dart | 21932 } // namespace dart |
OLD | NEW |