| 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 6054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6065 index += OS::SNPrint((buffer + index), | 6065 index += OS::SNPrint((buffer + index), |
| 6066 (len - index), | 6066 (len - index), |
| 6067 "%ld => 0x%x\n", | 6067 "%ld => 0x%x\n", |
| 6068 TryIndex(i), | 6068 TryIndex(i), |
| 6069 HandlerPC(i)); | 6069 HandlerPC(i)); |
| 6070 } | 6070 } |
| 6071 return buffer; | 6071 return buffer; |
| 6072 } | 6072 } |
| 6073 | 6073 |
| 6074 | 6074 |
| 6075 CodeComments CodeComments::New(int count) { |
| 6076 if (count == 0) return CodeComments(); |
| 6077 return CodeComments(Array::New(count * kNumberOfEntries)); |
| 6078 } |
| 6079 |
| 6080 |
| 6081 intptr_t CodeComments::Length() { |
| 6082 return comments_.IsNull() ? 0 : (comments_.Length() / kNumberOfEntries); |
| 6083 } |
| 6084 |
| 6085 |
| 6086 intptr_t CodeComments::PCAt(int idx) { |
| 6087 return Smi::CheckedHandle( |
| 6088 comments_.At(idx * kNumberOfEntries + kPCEntry)).Value(); |
| 6089 } |
| 6090 |
| 6091 |
| 6092 void CodeComments::SetPCAt(int idx, intptr_t pc) { |
| 6093 comments_.SetAt(idx * kNumberOfEntries + kPCEntry, |
| 6094 Smi::Handle(Smi::New(pc))); |
| 6095 } |
| 6096 |
| 6097 |
| 6098 const String& CodeComments::CommentAt(int idx) { |
| 6099 return String::CheckedHandle( |
| 6100 comments_.At(idx * kNumberOfEntries + kCommentEntry)); |
| 6101 } |
| 6102 |
| 6103 |
| 6104 void CodeComments::SetCommentAt(int idx, const String& comment) { |
| 6105 comments_.SetAt(idx * kNumberOfEntries + kCommentEntry, comment); |
| 6106 } |
| 6107 |
| 6108 |
| 6109 CodeComments::CodeComments(RawArray* comments) |
| 6110 : comments_(Array::Handle(comments)) { |
| 6111 } |
| 6112 |
| 6113 |
| 6114 CodeComments::CodeComments() |
| 6115 : comments_(Array::Handle()) { |
| 6116 } |
| 6117 |
| 6118 |
| 6075 void Code::set_stackmaps(const Array& maps) const { | 6119 void Code::set_stackmaps(const Array& maps) const { |
| 6076 StorePointer(&raw_ptr()->stackmaps_, maps.raw()); | 6120 StorePointer(&raw_ptr()->stackmaps_, maps.raw()); |
| 6077 } | 6121 } |
| 6078 | 6122 |
| 6079 | 6123 |
| 6124 CodeComments Code::comments() const { |
| 6125 return CodeComments(raw_ptr()->comments_); |
| 6126 } |
| 6127 |
| 6128 |
| 6129 void Code::set_comments(const CodeComments& comments) const { |
| 6130 StorePointer(&raw_ptr()->comments_, comments.comments_.raw()); |
| 6131 } |
| 6132 |
| 6133 |
| 6080 RawCode* Code::New(int pointer_offsets_length) { | 6134 RawCode* Code::New(int pointer_offsets_length) { |
| 6081 const Class& cls = Class::Handle(Object::code_class()); | 6135 const Class& cls = Class::Handle(Object::code_class()); |
| 6082 Code& result = Code::Handle(); | 6136 Code& result = Code::Handle(); |
| 6083 { | 6137 { |
| 6084 uword size = Code::InstanceSize(pointer_offsets_length); | 6138 uword size = Code::InstanceSize(pointer_offsets_length); |
| 6085 RawObject* raw = Object::Allocate(cls, size, Heap::kOld); | 6139 RawObject* raw = Object::Allocate(cls, size, Heap::kOld); |
| 6086 NoGCScope no_gc; | 6140 NoGCScope no_gc; |
| 6087 result ^= raw; | 6141 result ^= raw; |
| 6088 result.set_pointer_offsets_length(pointer_offsets_length); | 6142 result.set_pointer_offsets_length(pointer_offsets_length); |
| 6089 result.set_is_optimized(false); | 6143 result.set_is_optimized(false); |
| (...skipping 3853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9943 const String& str = String::Handle(pattern()); | 9997 const String& str = String::Handle(pattern()); |
| 9944 const char* format = "JSRegExp: pattern=%s flags=%s"; | 9998 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 9945 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 9999 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 9946 char* chars = reinterpret_cast<char*>( | 10000 char* chars = reinterpret_cast<char*>( |
| 9947 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10001 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 9948 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10002 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 9949 return chars; | 10003 return chars; |
| 9950 } | 10004 } |
| 9951 | 10005 |
| 9952 } // namespace dart | 10006 } // namespace dart |
| OLD | NEW |