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

Side by Side Diff: runtime/vm/dart_api_impl.cc

Issue 10796004: Consolidate a few fields in RawFunction using bitfields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/object.h » ('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 #include "include/dart_api.h" 5 #include "include/dart_api.h"
6 6
7 #include "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/dart.h" 10 #include "vm/dart.h"
(...skipping 2735 matching lines...) Expand 10 before | Expand all | Expand 10 after
2746 CURRENT_FUNC); 2746 CURRENT_FUNC);
2747 } 2747 }
2748 2748
2749 #if defined(DEBUG) 2749 #if defined(DEBUG)
2750 if (!func.IsNull()) { 2750 if (!func.IsNull()) {
2751 // We only provide access to a subset of function kinds. 2751 // We only provide access to a subset of function kinds.
2752 RawFunction::Kind func_kind = func.kind(); 2752 RawFunction::Kind func_kind = func.kind();
2753 ASSERT(func_kind == RawFunction::kRegularFunction || 2753 ASSERT(func_kind == RawFunction::kRegularFunction ||
2754 func_kind == RawFunction::kGetterFunction || 2754 func_kind == RawFunction::kGetterFunction ||
2755 func_kind == RawFunction::kSetterFunction || 2755 func_kind == RawFunction::kSetterFunction ||
2756 func_kind == RawFunction::kConstructor || 2756 func_kind == RawFunction::kConstructor);
2757 func_kind == RawFunction::kAbstract);
2758 } 2757 }
2759 #endif 2758 #endif
2760 return Api::NewHandle(isolate, func.raw()); 2759 return Api::NewHandle(isolate, func.raw());
2761 } 2760 }
2762 2761
2763 2762
2764 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle) { 2763 DART_EXPORT bool Dart_IsFunction(Dart_Handle handle) {
2765 return Api::ClassId(handle) == kFunction; 2764 return Api::ClassId(handle) == kFunction;
2766 } 2765 }
2767 2766
(...skipping 20 matching lines...) Expand all
2788 bool* is_abstract) { 2787 bool* is_abstract) {
2789 Isolate* isolate = Isolate::Current(); 2788 Isolate* isolate = Isolate::Current();
2790 DARTSCOPE(isolate); 2789 DARTSCOPE(isolate);
2791 if (is_abstract == NULL) { 2790 if (is_abstract == NULL) {
2792 RETURN_NULL_ERROR(is_abstract); 2791 RETURN_NULL_ERROR(is_abstract);
2793 } 2792 }
2794 const Function& func = Api::UnwrapFunctionHandle(isolate, function); 2793 const Function& func = Api::UnwrapFunctionHandle(isolate, function);
2795 if (func.IsNull()) { 2794 if (func.IsNull()) {
2796 RETURN_TYPE_ERROR(isolate, function, Function); 2795 RETURN_TYPE_ERROR(isolate, function, Function);
2797 } 2796 }
2798 *is_abstract = (func.kind() == RawFunction::kAbstract); 2797 *is_abstract = func.is_abstract();
2799 return Api::Success(isolate); 2798 return Api::Success(isolate);
2800 } 2799 }
2801 2800
2802 2801
2803 DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function, 2802 DART_EXPORT Dart_Handle Dart_FunctionIsStatic(Dart_Handle function,
2804 bool* is_static) { 2803 bool* is_static) {
2805 Isolate* isolate = Isolate::Current(); 2804 Isolate* isolate = Isolate::Current();
2806 DARTSCOPE(isolate); 2805 DARTSCOPE(isolate);
2807 if (is_static == NULL) { 2806 if (is_static == NULL) {
2808 RETURN_NULL_ERROR(is_static); 2807 RETURN_NULL_ERROR(is_static);
(...skipping 27 matching lines...) Expand all
2836 bool* is_getter) { 2835 bool* is_getter) {
2837 Isolate* isolate = Isolate::Current(); 2836 Isolate* isolate = Isolate::Current();
2838 DARTSCOPE(isolate); 2837 DARTSCOPE(isolate);
2839 if (is_getter == NULL) { 2838 if (is_getter == NULL) {
2840 RETURN_NULL_ERROR(is_getter); 2839 RETURN_NULL_ERROR(is_getter);
2841 } 2840 }
2842 const Function& func = Api::UnwrapFunctionHandle(isolate, function); 2841 const Function& func = Api::UnwrapFunctionHandle(isolate, function);
2843 if (func.IsNull()) { 2842 if (func.IsNull()) {
2844 RETURN_TYPE_ERROR(isolate, function, Function); 2843 RETURN_TYPE_ERROR(isolate, function, Function);
2845 } 2844 }
2846 // TODO(turnidge): It would be nice if I could just use func.kind() 2845 *is_getter = (func.kind() == RawFunction::kGetterFunction);
2847 // to check for a getter function here, but unfortunately the only
2848 // way to distinguish abstract getter functions is to use the name
2849 // itself. Consider adding a RawFunction::kAbstractGetter type.
2850 const String& func_name = String::Handle(isolate, func.name());
2851 *is_getter = Field::IsGetterName(func_name);
2852
2853 return Api::Success(isolate); 2846 return Api::Success(isolate);
2854 } 2847 }
2855 2848
2856 2849
2857 DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function, 2850 DART_EXPORT Dart_Handle Dart_FunctionIsSetter(Dart_Handle function,
2858 bool* is_setter) { 2851 bool* is_setter) {
2859 Isolate* isolate = Isolate::Current(); 2852 Isolate* isolate = Isolate::Current();
2860 DARTSCOPE(isolate); 2853 DARTSCOPE(isolate);
2861 if (is_setter == NULL) { 2854 if (is_setter == NULL) {
2862 RETURN_NULL_ERROR(is_setter); 2855 RETURN_NULL_ERROR(is_setter);
2863 } 2856 }
2864 const Function& func = Api::UnwrapFunctionHandle(isolate, function); 2857 const Function& func = Api::UnwrapFunctionHandle(isolate, function);
2865 if (func.IsNull()) { 2858 if (func.IsNull()) {
2866 RETURN_TYPE_ERROR(isolate, function, Function); 2859 RETURN_TYPE_ERROR(isolate, function, Function);
2867 } 2860 }
2868 // TODO(turnidge): It would be nice if I could just use func.kind() 2861 *is_setter = (func.kind() == RawFunction::kSetterFunction);
2869 // to check for a setter function here, but unfortunately the only
2870 // way to distinguish abstract setter functions is to use the name
2871 // itself. Consider adding a RawFunction::kAbstractSetter type.
2872 const String& func_name = String::Handle(isolate, func.name());
2873 *is_setter = Field::IsSetterName(func_name);
2874
2875 return Api::Success(isolate); 2862 return Api::Success(isolate);
2876 } 2863 }
2877 2864
2878 2865
2879 DART_EXPORT Dart_Handle Dart_FunctionParameterCounts( 2866 DART_EXPORT Dart_Handle Dart_FunctionParameterCounts(
2880 Dart_Handle function, 2867 Dart_Handle function,
2881 int64_t* fixed_param_count, 2868 int64_t* fixed_param_count,
2882 int64_t* opt_param_count) { 2869 int64_t* opt_param_count) {
2883 Isolate* isolate = Isolate::Current(); 2870 Isolate* isolate = Isolate::Current();
2884 DARTSCOPE(isolate); 2871 DARTSCOPE(isolate);
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
4176 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) { 4163 DART_EXPORT void Dart_InitPerfEventsSupport(Dart_FileWriterFunction function) {
4177 Dart::set_perf_events_writer(function); 4164 Dart::set_perf_events_writer(function);
4178 } 4165 }
4179 4166
4180 4167
4181 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) { 4168 DART_EXPORT void Dart_InitFlowGraphPrinting(Dart_FileWriterFunction function) {
4182 Dart::set_flow_graph_writer(function); 4169 Dart::set_flow_graph_writer(function);
4183 } 4170 }
4184 4171
4185 } // namespace dart 4172 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/compiler.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698