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 "include/dart_api.h" | 7 #include "include/dart_api.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
(...skipping 10771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10782 case RawLocalVarDescriptors::kContextVar: | 10782 case RawLocalVarDescriptors::kContextVar: |
10783 return "ContextVar"; | 10783 return "ContextVar"; |
10784 break; | 10784 break; |
10785 case RawLocalVarDescriptors::kContextLevel: | 10785 case RawLocalVarDescriptors::kContextLevel: |
10786 return "ContextLevel"; | 10786 return "ContextLevel"; |
10787 break; | 10787 break; |
10788 case RawLocalVarDescriptors::kSavedEntryContext: | 10788 case RawLocalVarDescriptors::kSavedEntryContext: |
10789 return "SavedEntryCtx"; | 10789 return "SavedEntryCtx"; |
10790 break; | 10790 break; |
10791 case RawLocalVarDescriptors::kSavedCurrentContext: | 10791 case RawLocalVarDescriptors::kSavedCurrentContext: |
10792 return "SavedCurrentCtx"; | 10792 return "CurrentCtx"; |
10793 break; | 10793 break; |
10794 default: | 10794 default: |
10795 UNREACHABLE(); | 10795 UNREACHABLE(); |
10796 return "Unknown"; | 10796 return "Unknown"; |
10797 } | 10797 } |
10798 } | 10798 } |
10799 | 10799 |
10800 | 10800 |
10801 static int PrintVarInfo(char* buffer, int len, | 10801 static int PrintVarInfo(char* buffer, int len, |
10802 intptr_t i, | 10802 intptr_t i, |
(...skipping 2683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13486 TypedData::Cast(native_fields).SetIntPtr(byte_offset, field_values[i]); | 13486 TypedData::Cast(native_fields).SetIntPtr(byte_offset, field_values[i]); |
13487 } | 13487 } |
13488 } | 13488 } |
13489 | 13489 |
13490 | 13490 |
13491 bool Instance::IsClosure() const { | 13491 bool Instance::IsClosure() const { |
13492 return Class::IsSignatureClass(clazz()); | 13492 return Class::IsSignatureClass(clazz()); |
13493 } | 13493 } |
13494 | 13494 |
13495 | 13495 |
13496 bool Instance::IsCallable(Function* function, Context* context) const { | 13496 bool Instance::IsCallable(Function* function) const { |
13497 Class& cls = Class::Handle(clazz()); | 13497 Class& cls = Class::Handle(clazz()); |
13498 if (cls.IsSignatureClass()) { | 13498 if (cls.IsSignatureClass()) { |
13499 if (function != NULL) { | 13499 if (function != NULL) { |
13500 *function = Closure::function(*this); | 13500 *function = Closure::function(*this); |
13501 } | 13501 } |
13502 if (context != NULL) { | |
13503 *context = Closure::context(*this); | |
13504 } | |
13505 return true; | 13502 return true; |
13506 } | 13503 } |
13507 // Try to resolve a "call" method. | 13504 // Try to resolve a "call" method. |
13508 Function& call_function = Function::Handle(); | 13505 Function& call_function = Function::Handle(); |
13509 do { | 13506 do { |
13510 call_function = cls.LookupDynamicFunction(Symbols::Call()); | 13507 call_function = cls.LookupDynamicFunction(Symbols::Call()); |
13511 if (!call_function.IsNull()) { | 13508 if (!call_function.IsNull()) { |
13512 if (function != NULL) { | 13509 if (function != NULL) { |
13513 *function = call_function.raw(); | 13510 *function = call_function.raw(); |
13514 } | 13511 } |
13515 if (context != NULL) { | |
13516 *context = Isolate::Current()->object_store()->empty_context(); | |
13517 } | |
13518 return true; | 13512 return true; |
13519 } | 13513 } |
13520 cls = cls.SuperClass(); | 13514 cls = cls.SuperClass(); |
13521 } while (!cls.IsNull()); | 13515 } while (!cls.IsNull()); |
13522 return false; | 13516 return false; |
13523 } | 13517 } |
13524 | 13518 |
13525 | 13519 |
13526 RawInstance* Instance::New(const Class& cls, Heap::Space space) { | 13520 RawInstance* Instance::New(const Class& cls, Heap::Space space) { |
13527 Isolate* isolate = Isolate::Current(); | 13521 Isolate* isolate = Isolate::Current(); |
(...skipping 6786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20314 return tag_label.ToCString(); | 20308 return tag_label.ToCString(); |
20315 } | 20309 } |
20316 | 20310 |
20317 | 20311 |
20318 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20312 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
20319 Instance::PrintJSONImpl(stream, ref); | 20313 Instance::PrintJSONImpl(stream, ref); |
20320 } | 20314 } |
20321 | 20315 |
20322 | 20316 |
20323 } // namespace dart | 20317 } // namespace dart |
OLD | NEW |