| 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/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 7642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7653 instrs.EntryPoint(), | 7653 instrs.EntryPoint(), |
| 7654 assembler->prologue_offset(), | 7654 assembler->prologue_offset(), |
| 7655 instrs.size(), | 7655 instrs.size(), |
| 7656 optimized); | 7656 optimized); |
| 7657 | 7657 |
| 7658 const ZoneGrowableArray<int>& pointer_offsets = | 7658 const ZoneGrowableArray<int>& pointer_offsets = |
| 7659 assembler->GetPointerOffsets(); | 7659 assembler->GetPointerOffsets(); |
| 7660 | 7660 |
| 7661 // Allocate the code object. | 7661 // Allocate the code object. |
| 7662 Code& code = Code::ZoneHandle(Code::New(pointer_offsets.length())); | 7662 Code& code = Code::ZoneHandle(Code::New(pointer_offsets.length())); |
| 7663 |
| 7664 // Clone the object pool in the old space, if necessary. |
| 7665 Array& object_pool = Array::Handle( |
| 7666 Array::MakeArray(assembler->object_pool())); |
| 7667 if (!object_pool.IsOld()) { |
| 7668 object_pool ^= Object::Clone(object_pool, Heap::kOld); |
| 7669 } |
| 7663 { | 7670 { |
| 7664 NoGCScope no_gc; | 7671 NoGCScope no_gc; |
| 7665 | 7672 |
| 7666 // Set pointer offsets list in Code object and resolve all handles in | 7673 // Set pointer offsets list in Code object and resolve all handles in |
| 7667 // the instruction stream to raw objects. | 7674 // the instruction stream to raw objects. |
| 7668 ASSERT(code.pointer_offsets_length() == pointer_offsets.length()); | 7675 ASSERT(code.pointer_offsets_length() == pointer_offsets.length()); |
| 7669 for (int i = 0; i < pointer_offsets.length(); i++) { | 7676 for (int i = 0; i < pointer_offsets.length(); i++) { |
| 7670 int offset_in_instrs = pointer_offsets[i]; | 7677 int offset_in_instrs = pointer_offsets[i]; |
| 7671 code.SetPointerOffsetAt(i, offset_in_instrs); | 7678 code.SetPointerOffsetAt(i, offset_in_instrs); |
| 7672 const Object* object = region.Load<const Object*>(offset_in_instrs); | 7679 const Object* object = region.Load<const Object*>(offset_in_instrs); |
| 7673 region.Store<RawObject*>(offset_in_instrs, object->raw()); | 7680 region.Store<RawObject*>(offset_in_instrs, object->raw()); |
| 7674 } | 7681 } |
| 7675 | 7682 |
| 7676 // Hook up Code and Instructions objects. | 7683 // Hook up Code and Instructions objects. |
| 7677 instrs.set_code(code.raw()); | 7684 instrs.set_code(code.raw()); |
| 7678 code.set_instructions(instrs.raw()); | 7685 code.set_instructions(instrs.raw()); |
| 7679 | 7686 |
| 7680 // Set object pool in Instructions object. | 7687 // Set object pool in Instructions object. |
| 7681 instrs.set_object_pool(Array::MakeArray(assembler->object_pool())); | 7688 instrs.set_object_pool(object_pool.raw()); |
| 7682 } | 7689 } |
| 7683 return code.raw(); | 7690 return code.raw(); |
| 7684 } | 7691 } |
| 7685 | 7692 |
| 7686 | 7693 |
| 7687 RawCode* Code::FinalizeCode(const Function& function, | 7694 RawCode* Code::FinalizeCode(const Function& function, |
| 7688 Assembler* assembler, | 7695 Assembler* assembler, |
| 7689 bool optimized) { | 7696 bool optimized) { |
| 7690 // Calling ToFullyQualifiedCString is very expensive, try to avoid it. | 7697 // Calling ToFullyQualifiedCString is very expensive, try to avoid it. |
| 7691 if (CodeObservers::AreActive()) { | 7698 if (CodeObservers::AreActive()) { |
| (...skipping 5926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13618 } | 13625 } |
| 13619 return result.raw(); | 13626 return result.raw(); |
| 13620 } | 13627 } |
| 13621 | 13628 |
| 13622 | 13629 |
| 13623 const char* WeakProperty::ToCString() const { | 13630 const char* WeakProperty::ToCString() const { |
| 13624 return "_WeakProperty"; | 13631 return "_WeakProperty"; |
| 13625 } | 13632 } |
| 13626 | 13633 |
| 13627 } // namespace dart | 13634 } // namespace dart |
| OLD | NEW |