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