| 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 6367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6378 // This should be caught before we reach here. | 6378 // This should be caught before we reach here. |
| 6379 FATAL1("Fatal error in Instructions::New: invalid size %"Pd"\n", size); | 6379 FATAL1("Fatal error in Instructions::New: invalid size %"Pd"\n", size); |
| 6380 } | 6380 } |
| 6381 Instructions& result = Instructions::Handle(); | 6381 Instructions& result = Instructions::Handle(); |
| 6382 { | 6382 { |
| 6383 uword aligned_size = Instructions::InstanceSize(size); | 6383 uword aligned_size = Instructions::InstanceSize(size); |
| 6384 RawObject* raw = Object::Allocate(Instructions::kClassId, | 6384 RawObject* raw = Object::Allocate(Instructions::kClassId, |
| 6385 aligned_size, | 6385 aligned_size, |
| 6386 Heap::kCode); | 6386 Heap::kCode); |
| 6387 NoGCScope no_gc; | 6387 NoGCScope no_gc; |
| 6388 // TODO(iposva): Remove premarking once old and code spaces are merged. | |
| 6389 raw->SetMarkBit(); | |
| 6390 result ^= raw; | 6388 result ^= raw; |
| 6391 result.set_size(size); | 6389 result.set_size(size); |
| 6392 } | 6390 } |
| 6393 return result.raw(); | 6391 return result.raw(); |
| 6394 } | 6392 } |
| 6395 | 6393 |
| 6396 | 6394 |
| 6397 const char* Instructions::ToCString() const { | 6395 const char* Instructions::ToCString() const { |
| 6398 return "Instructions"; | 6396 return "Instructions"; |
| 6399 } | 6397 } |
| (...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6960 void Code::set_deopt_info_array(const Array& array) const { | 6958 void Code::set_deopt_info_array(const Array& array) const { |
| 6961 StorePointer(&raw_ptr()->deopt_info_array_, array.raw()); | 6959 StorePointer(&raw_ptr()->deopt_info_array_, array.raw()); |
| 6962 } | 6960 } |
| 6963 | 6961 |
| 6964 | 6962 |
| 6965 void Code::set_object_table(const Array& array) const { | 6963 void Code::set_object_table(const Array& array) const { |
| 6966 StorePointer(&raw_ptr()->object_table_, array.raw()); | 6964 StorePointer(&raw_ptr()->object_table_, array.raw()); |
| 6967 } | 6965 } |
| 6968 | 6966 |
| 6969 | 6967 |
| 6968 void Code::set_resolved_static_calls(const GrowableObjectArray& val) const { |
| 6969 StorePointer(&raw_ptr()->resolved_static_calls_, val.raw()); |
| 6970 } |
| 6971 |
| 6972 |
| 6970 const Code::Comments& Code::comments() const { | 6973 const Code::Comments& Code::comments() const { |
| 6971 Comments* comments = new Code::Comments(raw_ptr()->comments_); | 6974 Comments* comments = new Code::Comments(raw_ptr()->comments_); |
| 6972 return *comments; | 6975 return *comments; |
| 6973 } | 6976 } |
| 6974 | 6977 |
| 6975 | 6978 |
| 6976 void Code::set_comments(const Code::Comments& comments) const { | 6979 void Code::set_comments(const Code::Comments& comments) const { |
| 6977 StorePointer(&raw_ptr()->comments_, comments.comments_.raw()); | 6980 StorePointer(&raw_ptr()->comments_, comments.comments_.raw()); |
| 6978 } | 6981 } |
| 6979 | 6982 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7101 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) { | 7104 bool Code::FindRawCodeVisitor::FindObject(RawObject* obj) { |
| 7102 return RawInstructions::ContainsPC(obj, pc_); | 7105 return RawInstructions::ContainsPC(obj, pc_); |
| 7103 } | 7106 } |
| 7104 | 7107 |
| 7105 | 7108 |
| 7106 RawCode* Code::LookupCode(uword pc) { | 7109 RawCode* Code::LookupCode(uword pc) { |
| 7107 Isolate* isolate = Isolate::Current(); | 7110 Isolate* isolate = Isolate::Current(); |
| 7108 NoGCScope no_gc; | 7111 NoGCScope no_gc; |
| 7109 FindRawCodeVisitor visitor(pc); | 7112 FindRawCodeVisitor visitor(pc); |
| 7110 RawInstructions* instr; | 7113 RawInstructions* instr; |
| 7111 instr = isolate->heap()->FindObjectInCodeSpace(&visitor); | 7114 instr = isolate->heap()->FindObjectInOldSpace(&visitor); |
| 7112 if (instr != Instructions::null()) { | 7115 if (instr != Instructions::null()) { |
| 7113 return instr->ptr()->code_; | 7116 return instr->ptr()->code_; |
| 7114 } | 7117 } |
| 7115 return Code::null(); | 7118 return Code::null(); |
| 7116 } | 7119 } |
| 7117 | 7120 |
| 7118 | 7121 |
| 7119 intptr_t Code::GetTokenIndexOfPC(uword pc) const { | 7122 intptr_t Code::GetTokenIndexOfPC(uword pc) const { |
| 7120 intptr_t token_pos = -1; | 7123 intptr_t token_pos = -1; |
| 7121 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); | 7124 const PcDescriptors& descriptors = PcDescriptors::Handle(pc_descriptors()); |
| (...skipping 5102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12224 } | 12227 } |
| 12225 return result.raw(); | 12228 return result.raw(); |
| 12226 } | 12229 } |
| 12227 | 12230 |
| 12228 | 12231 |
| 12229 const char* WeakProperty::ToCString() const { | 12232 const char* WeakProperty::ToCString() const { |
| 12230 return "_WeakProperty"; | 12233 return "_WeakProperty"; |
| 12231 } | 12234 } |
| 12232 | 12235 |
| 12233 } // namespace dart | 12236 } // namespace dart |
| OLD | NEW |