| 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 "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 5370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5381 ASSERT(NodeId(k) != node_id); | 5381 ASSERT(NodeId(k) != node_id); |
| 5382 } | 5382 } |
| 5383 ASSERT(pc != PC(k)); | 5383 ASSERT(pc != PC(k)); |
| 5384 } | 5384 } |
| 5385 } | 5385 } |
| 5386 } | 5386 } |
| 5387 #endif // DEBUG | 5387 #endif // DEBUG |
| 5388 } | 5388 } |
| 5389 | 5389 |
| 5390 | 5390 |
| 5391 void Stackmap::SetCode(const Code& code) const { |
| 5392 StorePointer(&raw_ptr()->code_, code.raw()); |
| 5393 } |
| 5394 |
| 5395 |
| 5391 // Return the bit offset of the highest bit set. | 5396 // Return the bit offset of the highest bit set. |
| 5392 intptr_t Stackmap::Maximum() const { | 5397 intptr_t Stackmap::Maximum() const { |
| 5393 intptr_t bound = SizeInBits(); | 5398 intptr_t bound = SizeInBits(); |
| 5394 for (intptr_t i = (bound - 1); i >= 0; i--) { | 5399 for (intptr_t i = (bound - 1); i >= 0; i--) { |
| 5395 if (IsObject(i)) return i; | 5400 if (IsObject(i)) return i; |
| 5396 } | 5401 } |
| 5397 return kNoMaximum; | 5402 return kNoMaximum; |
| 5398 } | 5403 } |
| 5399 | 5404 |
| 5400 | 5405 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5471 | 5476 |
| 5472 void Stackmap::set_code(const Code& code) const { | 5477 void Stackmap::set_code(const Code& code) const { |
| 5473 StorePointer(&raw_ptr()->code_, code.raw()); | 5478 StorePointer(&raw_ptr()->code_, code.raw()); |
| 5474 } | 5479 } |
| 5475 | 5480 |
| 5476 | 5481 |
| 5477 const char* Stackmap::ToCString() const { | 5482 const char* Stackmap::ToCString() const { |
| 5478 if (IsNull()) { | 5483 if (IsNull()) { |
| 5479 return "{null}"; | 5484 return "{null}"; |
| 5480 } else { | 5485 } else { |
| 5481 intptr_t index = OS::SNPrint(NULL, 0, "0x%lx { ", pc()); | 5486 intptr_t index = OS::SNPrint(NULL, 0, "0x%lx { ", PC()); |
| 5482 intptr_t alloc_size = index + ((Maximum() + 1) * 2) + 2; // "{ 1 0 .... }". | 5487 intptr_t alloc_size = index + ((Maximum() + 1) * 2) + 2; // "{ 1 0 .... }". |
| 5483 Isolate* isolate = Isolate::Current(); | 5488 Isolate* isolate = Isolate::Current(); |
| 5484 char* chars = reinterpret_cast<char*>( | 5489 char* chars = reinterpret_cast<char*>( |
| 5485 isolate->current_zone()->Allocate(alloc_size)); | 5490 isolate->current_zone()->Allocate(alloc_size)); |
| 5486 index = OS::SNPrint(chars, alloc_size, "0x%lx { ", pc()); | 5491 index = OS::SNPrint(chars, alloc_size, "0x%lx { ", PC()); |
| 5487 for (intptr_t i = 0; i <= Maximum(); i++) { | 5492 for (intptr_t i = 0; i <= Maximum(); i++) { |
| 5488 index += OS::SNPrint((chars + index), | 5493 index += OS::SNPrint((chars + index), |
| 5489 (alloc_size - index), | 5494 (alloc_size - index), |
| 5490 "%d ", | 5495 "%d ", |
| 5491 IsObject(i) ? 1 : 0); | 5496 IsObject(i) ? 1 : 0); |
| 5492 } | 5497 } |
| 5493 OS::SNPrint((chars + index), (alloc_size - index), "}"); | 5498 OS::SNPrint((chars + index), (alloc_size - index), "}"); |
| 5494 return chars; | 5499 return chars; |
| 5495 } | 5500 } |
| 5496 } | 5501 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5636 index += OS::SNPrint((buffer + index), | 5641 index += OS::SNPrint((buffer + index), |
| 5637 (len - index), | 5642 (len - index), |
| 5638 "%ld => 0x%x\n", | 5643 "%ld => 0x%x\n", |
| 5639 TryIndex(i), | 5644 TryIndex(i), |
| 5640 HandlerPC(i)); | 5645 HandlerPC(i)); |
| 5641 } | 5646 } |
| 5642 return buffer; | 5647 return buffer; |
| 5643 } | 5648 } |
| 5644 | 5649 |
| 5645 | 5650 |
| 5651 void Code::set_stackmaps(const Array& maps) const { |
| 5652 StorePointer(&raw_ptr()->stackmaps_, maps.raw()); |
| 5653 } |
| 5654 |
| 5655 |
| 5646 RawCode* Code::New(int pointer_offsets_length) { | 5656 RawCode* Code::New(int pointer_offsets_length) { |
| 5647 const Class& cls = Class::Handle(Object::code_class()); | 5657 const Class& cls = Class::Handle(Object::code_class()); |
| 5648 Code& result = Code::Handle(); | 5658 Code& result = Code::Handle(); |
| 5649 { | 5659 { |
| 5650 uword size = Code::InstanceSize(pointer_offsets_length); | 5660 uword size = Code::InstanceSize(pointer_offsets_length); |
| 5651 RawObject* raw = Object::Allocate(cls, size, Heap::kOld); | 5661 RawObject* raw = Object::Allocate(cls, size, Heap::kOld); |
| 5652 NoGCScope no_gc; | 5662 NoGCScope no_gc; |
| 5653 result ^= raw; | 5663 result ^= raw; |
| 5654 result.set_pointer_offsets_length(pointer_offsets_length); | 5664 result.set_pointer_offsets_length(pointer_offsets_length); |
| 5655 result.set_is_optimized(false); | 5665 result.set_is_optimized(false); |
| (...skipping 3247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8903 const String& str = String::Handle(pattern()); | 8913 const String& str = String::Handle(pattern()); |
| 8904 const char* format = "JSRegExp: pattern=%s flags=%s"; | 8914 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 8905 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 8915 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 8906 char* chars = reinterpret_cast<char*>( | 8916 char* chars = reinterpret_cast<char*>( |
| 8907 Isolate::Current()->current_zone()->Allocate(len + 1)); | 8917 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 8908 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 8918 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 8909 return chars; | 8919 return chars; |
| 8910 } | 8920 } |
| 8911 | 8921 |
| 8912 } // namespace dart | 8922 } // namespace dart |
| OLD | NEW |