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 #ifndef VM_OBJECT_H_ | 5 #ifndef VM_OBJECT_H_ |
6 #define VM_OBJECT_H_ | 6 #define VM_OBJECT_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 #include "platform/assert.h" | 9 #include "platform/assert.h" |
10 #include "platform/utils.h" | 10 #include "platform/utils.h" |
(...skipping 2117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2128 // Returns true if this function represents a non implicit closure function. | 2128 // Returns true if this function represents a non implicit closure function. |
2129 bool IsNonImplicitClosureFunction() const { | 2129 bool IsNonImplicitClosureFunction() const { |
2130 return IsClosureFunction() && !IsImplicitClosureFunction(); | 2130 return IsClosureFunction() && !IsImplicitClosureFunction(); |
2131 } | 2131 } |
2132 | 2132 |
2133 // Returns true if this function represents an implicit static closure | 2133 // Returns true if this function represents an implicit static closure |
2134 // function. | 2134 // function. |
2135 bool IsImplicitStaticClosureFunction() const { | 2135 bool IsImplicitStaticClosureFunction() const { |
2136 return is_static() && IsImplicitClosureFunction(); | 2136 return is_static() && IsImplicitClosureFunction(); |
2137 } | 2137 } |
| 2138 bool static IsImplicitStaticClosureFunction(RawFunction* func); |
2138 | 2139 |
2139 // Returns true if this function represents an implicit instance closure | 2140 // Returns true if this function represents an implicit instance closure |
2140 // function. | 2141 // function. |
2141 bool IsImplicitInstanceClosureFunction() const { | 2142 bool IsImplicitInstanceClosureFunction() const { |
2142 return !is_static() && IsImplicitClosureFunction(); | 2143 return !is_static() && IsImplicitClosureFunction(); |
2143 } | 2144 } |
2144 | 2145 |
2145 // Returns true if this function represents a local function. | 2146 // Returns true if this function represents a local function. |
2146 bool IsLocalFunction() const { | 2147 bool IsLocalFunction() const { |
2147 return parent_function() != Function::null(); | 2148 return parent_function() != Function::null(); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2370 bool TestParameterType(TypeTestKind test_kind, | 2371 bool TestParameterType(TypeTestKind test_kind, |
2371 intptr_t parameter_position, | 2372 intptr_t parameter_position, |
2372 intptr_t other_parameter_position, | 2373 intptr_t other_parameter_position, |
2373 const TypeArguments& type_arguments, | 2374 const TypeArguments& type_arguments, |
2374 const Function& other, | 2375 const Function& other, |
2375 const TypeArguments& other_type_arguments, | 2376 const TypeArguments& other_type_arguments, |
2376 Error* bound_error) const; | 2377 Error* bound_error) const; |
2377 | 2378 |
2378 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object); | 2379 FINAL_HEAP_OBJECT_IMPLEMENTATION(Function, Object); |
2379 friend class Class; | 2380 friend class Class; |
| 2381 friend class SnapshotWriter; |
2380 friend class Parser; // For set_eval_script. | 2382 friend class Parser; // For set_eval_script. |
2381 // RawFunction::VisitFunctionPointers accesses the private constructor of | 2383 // RawFunction::VisitFunctionPointers accesses the private constructor of |
2382 // Function. | 2384 // Function. |
2383 friend class RawFunction; | 2385 friend class RawFunction; |
2384 }; | 2386 }; |
2385 | 2387 |
2386 | 2388 |
2387 class ClosureData: public Object { | 2389 class ClosureData: public Object { |
2388 public: | 2390 public: |
2389 static intptr_t InstanceSize() { | 2391 static intptr_t InstanceSize() { |
(...skipping 4938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7328 closure.StorePointer(FunctionAddr(closure), value.raw()); | 7330 closure.StorePointer(FunctionAddr(closure), value.raw()); |
7329 } | 7331 } |
7330 static void set_context(const Instance& closure, | 7332 static void set_context(const Instance& closure, |
7331 const Context& value) { | 7333 const Context& value) { |
7332 closure.StorePointer(ContextAddr(closure), value.raw()); | 7334 closure.StorePointer(ContextAddr(closure), value.raw()); |
7333 } | 7335 } |
7334 static intptr_t NextFieldOffset() { | 7336 static intptr_t NextFieldOffset() { |
7335 // Indicates this class cannot be extended by dart code. | 7337 // Indicates this class cannot be extended by dart code. |
7336 return -kWordSize; | 7338 return -kWordSize; |
7337 } | 7339 } |
| 7340 static RawFunction* GetFunction(RawObject* obj) { |
| 7341 return *(reinterpret_cast<RawFunction**>( |
| 7342 reinterpret_cast<intptr_t>(obj->ptr()) + function_offset())); |
| 7343 } |
7338 | 7344 |
7339 friend class Class; | 7345 friend class Class; |
| 7346 friend class SnapshotWriter; |
7340 }; | 7347 }; |
7341 | 7348 |
7342 | 7349 |
7343 class Capability : public Instance { | 7350 class Capability : public Instance { |
7344 public: | 7351 public: |
7345 uint64_t Id() const { return raw_ptr()->id_; } | 7352 uint64_t Id() const { return raw_ptr()->id_; } |
7346 | 7353 |
7347 static intptr_t InstanceSize() { | 7354 static intptr_t InstanceSize() { |
7348 return RoundedAllocationSize(sizeof(RawCapability)); | 7355 return RoundedAllocationSize(sizeof(RawCapability)); |
7349 } | 7356 } |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7825 | 7832 |
7826 | 7833 |
7827 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, | 7834 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, |
7828 intptr_t index) { | 7835 intptr_t index) { |
7829 return array.At((index * kEntryLength) + kTargetFunctionIndex); | 7836 return array.At((index * kEntryLength) + kTargetFunctionIndex); |
7830 } | 7837 } |
7831 | 7838 |
7832 } // namespace dart | 7839 } // namespace dart |
7833 | 7840 |
7834 #endif // VM_OBJECT_H_ | 7841 #endif // VM_OBJECT_H_ |
OLD | NEW |