Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(368)

Side by Side Diff: runtime/vm/object.h

Issue 1683113003: A type should be a subtype of Function if its class declares a call function, (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 // TODO(koda): Unite w/ hash table. 1179 // TODO(koda): Unite w/ hash table.
1180 RawArray* functions() const { return raw_ptr()->functions_; } 1180 RawArray* functions() const { return raw_ptr()->functions_; }
1181 void SetFunctions(const Array& value) const; 1181 void SetFunctions(const Array& value) const;
1182 void AddFunction(const Function& function) const; 1182 void AddFunction(const Function& function) const;
1183 void RemoveFunction(const Function& function) const; 1183 void RemoveFunction(const Function& function) const;
1184 RawFunction* FunctionFromIndex(intptr_t idx) const; 1184 RawFunction* FunctionFromIndex(intptr_t idx) const;
1185 intptr_t FindImplicitClosureFunctionIndex(const Function& needle) const; 1185 intptr_t FindImplicitClosureFunctionIndex(const Function& needle) const;
1186 RawFunction* ImplicitClosureFunctionFromIndex(intptr_t idx) const; 1186 RawFunction* ImplicitClosureFunctionFromIndex(intptr_t idx) const;
1187 1187
1188 RawFunction* LookupDynamicFunction(const String& name) const; 1188 RawFunction* LookupDynamicFunction(const String& name) const;
1189 RawFunction* LookupDynamicFunctionAllowAbstract(const String& name) const;
1189 RawFunction* LookupDynamicFunctionAllowPrivate(const String& name) const; 1190 RawFunction* LookupDynamicFunctionAllowPrivate(const String& name) const;
1190 RawFunction* LookupStaticFunction(const String& name) const; 1191 RawFunction* LookupStaticFunction(const String& name) const;
1191 RawFunction* LookupStaticFunctionAllowPrivate(const String& name) const; 1192 RawFunction* LookupStaticFunctionAllowPrivate(const String& name) const;
1192 RawFunction* LookupConstructor(const String& name) const; 1193 RawFunction* LookupConstructor(const String& name) const;
1193 RawFunction* LookupConstructorAllowPrivate(const String& name) const; 1194 RawFunction* LookupConstructorAllowPrivate(const String& name) const;
1194 RawFunction* LookupFactory(const String& name) const; 1195 RawFunction* LookupFactory(const String& name) const;
1195 RawFunction* LookupFactoryAllowPrivate(const String& name) const; 1196 RawFunction* LookupFactoryAllowPrivate(const String& name) const;
1196 RawFunction* LookupFunction(const String& name) const; 1197 RawFunction* LookupFunction(const String& name) const;
1197 RawFunction* LookupFunctionAllowPrivate(const String& name) const; 1198 RawFunction* LookupFunctionAllowPrivate(const String& name) const;
1198 RawFunction* LookupGetterFunction(const String& name) const; 1199 RawFunction* LookupGetterFunction(const String& name) const;
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 void set_cha_codes(const Array& value) const; 1367 void set_cha_codes(const Array& value) const;
1367 1368
1368 bool TraceAllocation(Isolate* isolate) const; 1369 bool TraceAllocation(Isolate* isolate) const;
1369 void SetTraceAllocation(bool trace_allocation) const; 1370 void SetTraceAllocation(bool trace_allocation) const;
1370 1371
1371 private: 1372 private:
1372 enum MemberKind { 1373 enum MemberKind {
1373 kAny = 0, 1374 kAny = 0,
1374 kStatic, 1375 kStatic,
1375 kInstance, 1376 kInstance,
1377 kInstanceAllowAbstract,
1376 kConstructor, 1378 kConstructor,
1377 kFactory, 1379 kFactory,
1378 }; 1380 };
1379 enum StateBits { 1381 enum StateBits {
1380 kConstBit = 0, 1382 kConstBit = 0,
1381 kImplementedBit = 1, 1383 kImplementedBit = 1,
1382 kTypeFinalizedBit = 2, 1384 kTypeFinalizedBit = 2,
1383 kClassFinalizedPos = 3, 1385 kClassFinalizedPos = 3,
1384 kClassFinalizedSize = 2, 1386 kClassFinalizedSize = 2,
1385 kAbstractBit = kClassFinalizedPos + kClassFinalizedSize, // = 5 1387 kAbstractBit = kClassFinalizedPos + kClassFinalizedSize, // = 5
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
2308 2310
2309 static const char* KindToCString(RawFunction::Kind kind); 2311 static const char* KindToCString(RawFunction::Kind kind);
2310 2312
2311 bool IsGenerativeConstructor() const { 2313 bool IsGenerativeConstructor() const {
2312 return (kind() == RawFunction::kConstructor) && !is_static(); 2314 return (kind() == RawFunction::kConstructor) && !is_static();
2313 } 2315 }
2314 bool IsImplicitConstructor() const; 2316 bool IsImplicitConstructor() const;
2315 bool IsFactory() const { 2317 bool IsFactory() const {
2316 return (kind() == RawFunction::kConstructor) && is_static(); 2318 return (kind() == RawFunction::kConstructor) && is_static();
2317 } 2319 }
2318 bool IsDynamicFunction() const { 2320 bool IsDynamicFunction(bool allow_abstract = false) const {
2319 if (is_static() || is_abstract()) { 2321 if (is_static() || (!allow_abstract && is_abstract())) {
2320 return false; 2322 return false;
2321 } 2323 }
2322 switch (kind()) { 2324 switch (kind()) {
2323 case RawFunction::kRegularFunction: 2325 case RawFunction::kRegularFunction:
2324 case RawFunction::kGetterFunction: 2326 case RawFunction::kGetterFunction:
2325 case RawFunction::kSetterFunction: 2327 case RawFunction::kSetterFunction:
2326 case RawFunction::kImplicitGetter: 2328 case RawFunction::kImplicitGetter:
2327 case RawFunction::kImplicitSetter: 2329 case RawFunction::kImplicitSetter:
2328 case RawFunction::kMethodExtractor: 2330 case RawFunction::kMethodExtractor:
2329 case RawFunction::kNoSuchMethodDispatcher: 2331 case RawFunction::kNoSuchMethodDispatcher:
(...skipping 6115 matching lines...) Expand 10 before | Expand all | Expand 10 after
8445 8447
8446 8448
8447 RawObject* MegamorphicCache::GetTargetFunction(const Array& array, 8449 RawObject* MegamorphicCache::GetTargetFunction(const Array& array,
8448 intptr_t index) { 8450 intptr_t index) {
8449 return array.At((index * kEntryLength) + kTargetFunctionIndex); 8451 return array.At((index * kEntryLength) + kTargetFunctionIndex);
8450 } 8452 }
8451 8453
8452 } // namespace dart 8454 } // namespace dart
8453 8455
8454 #endif // VM_OBJECT_H_ 8456 #endif // VM_OBJECT_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698