Chromium Code Reviews| Index: runtime/vm/object.h |
| diff --git a/runtime/vm/object.h b/runtime/vm/object.h |
| index faf01cc65881fe6f86a4146bace35aba588d06a1..ac24661530a990e433632379eaa01e07ef007383 100644 |
| --- a/runtime/vm/object.h |
| +++ b/runtime/vm/object.h |
| @@ -3275,12 +3275,38 @@ class Code : public Object { |
| StorePointer(&raw_ptr()->exception_handlers_, handlers.raw()); |
| } |
| + bool OwnerIsFunction() const { |
| + return raw_ptr()->owner_->IsHeapObject(); |
| + } |
| + |
| + bool OwnerIsNotNullFunction() const { |
| + return (raw_ptr()->owner_->IsHeapObject()) && |
| + (raw_ptr()->owner_ != Function::null()); |
| + } |
| + |
| + bool OwnerIsAllocationStub() const { |
| + return !raw_ptr()->owner_->IsHeapObject(); |
| + } |
| + |
| RawFunction* function() const { |
| - return raw_ptr()->function_; |
| + ASSERT(OwnerIsFunction()); |
| + return reinterpret_cast<RawFunction*>(raw_ptr()->owner_); |
| + } |
| + |
| + RawSmi* allocation_stub_class_id() const { |
| + ASSERT(OwnerIsAllocationStub()); |
| + return reinterpret_cast<RawSmi*>(raw_ptr()->owner_); |
| } |
| - void set_function(const Function& function) const { |
| + |
| + void set_owner_function(const Function& function) const { |
|
turnidge
2014/02/28 19:23:37
Consider camel-case for this function and the one
|
| ASSERT(function.IsOld()); |
| - StorePointer(&raw_ptr()->function_, function.raw()); |
| + StorePointer(&raw_ptr()->owner_, |
| + reinterpret_cast<RawObject*>(function.raw())); |
| + } |
| + |
| + void set_owner_allocation_stub_class_id(RawSmi* cid) const { |
| + ASSERT(!cid->IsHeapObject()); |
| + raw_ptr()->owner_ = reinterpret_cast<RawObject*>(cid); |
| } |
| // We would have a VisitPointers function here to traverse all the |
| @@ -3305,6 +3331,7 @@ class Code : public Object { |
| Assembler* assembler, |
| bool optimized = false); |
| static RawCode* LookupCode(uword pc); |
| + static RawCode* LookupCodeInVmIsolate(uword pc); |
| int32_t GetPointerOffsetAt(int index) const { |
| return *PointerOffsetAddrAt(index); |
| @@ -3383,6 +3410,7 @@ class Code : public Object { |
| } |
| intptr_t BinarySearchInSCallTable(uword pc) const; |
| + static RawCode* LookupCodeInIsolate(Isolate* isolate, uword pc); |
| // New is a private method as RawInstruction and RawCode objects should |
| // only be created using the Code::FinalizeCode method. This method creates |
| @@ -4937,6 +4965,7 @@ class String : public Instance { |
| ch_(0), |
| index_(-1), |
| end_(str.Length()) { |
| + ASSERT(!str_.IsNull()); |
| } |
| CodePointIterator(const String& str, intptr_t start, intptr_t length) |