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

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

Issue 10821076: - Allow parsing of external methods. (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
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 "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/bigint_operations.h" 10 #include "vm/bigint_operations.h"
(...skipping 3734 matching lines...) Expand 10 before | Expand all | Expand 10 after
3745 void Function::set_is_static(bool is_static) const { 3745 void Function::set_is_static(bool is_static) const {
3746 raw_ptr()->is_static_ = is_static; 3746 raw_ptr()->is_static_ = is_static;
3747 } 3747 }
3748 3748
3749 3749
3750 void Function::set_is_const(bool is_const) const { 3750 void Function::set_is_const(bool is_const) const {
3751 raw_ptr()->is_const_ = is_const; 3751 raw_ptr()->is_const_ = is_const;
3752 } 3752 }
3753 3753
3754 3754
3755 void Function::set_is_external(bool value) const {
3756 raw_ptr()->is_external_ = value;
3757 }
3758
3759
3755 void Function::set_token_pos(intptr_t pos) const { 3760 void Function::set_token_pos(intptr_t pos) const {
3756 ASSERT(pos >= 0); 3761 ASSERT(pos >= 0);
3757 raw_ptr()->token_pos_ = pos; 3762 raw_ptr()->token_pos_ = pos;
3758 } 3763 }
3759 3764
3760 3765
3761 void Function::set_num_fixed_parameters(intptr_t n) const { 3766 void Function::set_num_fixed_parameters(intptr_t n) const {
3762 ASSERT(n >= 0); 3767 ASSERT(n >= 0);
3763 raw_ptr()->num_fixed_parameters_ = n; 3768 raw_ptr()->num_fixed_parameters_ = n;
3764 } 3769 }
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
4099 Function::InstanceSize(), 4104 Function::InstanceSize(),
4100 Heap::kOld); 4105 Heap::kOld);
4101 return reinterpret_cast<RawFunction*>(raw); 4106 return reinterpret_cast<RawFunction*>(raw);
4102 } 4107 }
4103 4108
4104 4109
4105 RawFunction* Function::New(const String& name, 4110 RawFunction* Function::New(const String& name,
4106 RawFunction::Kind kind, 4111 RawFunction::Kind kind,
4107 bool is_static, 4112 bool is_static,
4108 bool is_const, 4113 bool is_const,
4114 bool is_external,
4109 intptr_t token_pos) { 4115 intptr_t token_pos) {
4110 ASSERT(name.IsOneByteString()); 4116 ASSERT(name.IsOneByteString());
4111 const Function& result = Function::Handle(Function::New()); 4117 const Function& result = Function::Handle(Function::New());
4112 result.set_parameter_types(Array::Handle(Array::Empty())); 4118 result.set_parameter_types(Array::Handle(Array::Empty()));
4113 result.set_parameter_names(Array::Handle(Array::Empty())); 4119 result.set_parameter_names(Array::Handle(Array::Empty()));
4114 result.set_name(name); 4120 result.set_name(name);
4115 result.set_kind(kind); 4121 result.set_kind(kind);
4116 result.set_is_static(is_static); 4122 result.set_is_static(is_static);
4117 result.set_is_const(is_const); 4123 result.set_is_const(is_const);
4124 result.set_is_external(is_external);
4118 result.set_token_pos(token_pos); 4125 result.set_token_pos(token_pos);
4119 result.set_end_token_pos(token_pos); 4126 result.set_end_token_pos(token_pos);
4120 result.set_num_fixed_parameters(0); 4127 result.set_num_fixed_parameters(0);
4121 result.set_num_optional_parameters(0); 4128 result.set_num_optional_parameters(0);
4122 result.set_usage_counter(0); 4129 result.set_usage_counter(0);
4123 result.set_deoptimization_counter(0); 4130 result.set_deoptimization_counter(0);
4124 result.set_is_optimizable(true); 4131 result.set_is_optimizable(true);
4125 result.set_is_native(false); 4132 result.set_is_native(false);
4126 return result.raw(); 4133 return result.raw();
4127 } 4134 }
4128 4135
4129 4136
4130 RawFunction* Function::NewClosureFunction(const String& name, 4137 RawFunction* Function::NewClosureFunction(const String& name,
4131 const Function& parent, 4138 const Function& parent,
4132 intptr_t token_pos) { 4139 intptr_t token_pos) {
4133 ASSERT(name.IsOneByteString()); 4140 ASSERT(name.IsOneByteString());
4134 ASSERT(!parent.IsNull()); 4141 ASSERT(!parent.IsNull());
4135 const Class& parent_class = Class::Handle(parent.owner()); 4142 const Class& parent_class = Class::Handle(parent.owner());
4136 ASSERT(!parent_class.IsNull()); 4143 ASSERT(!parent_class.IsNull());
4137 const Function& result = Function::Handle( 4144 const Function& result = Function::Handle(
4138 Function::New(name, 4145 Function::New(name,
4139 RawFunction::kClosureFunction, 4146 RawFunction::kClosureFunction,
4140 /* is_static = */ parent.is_static(), 4147 /* is_static = */ parent.is_static(),
4141 /* is_const = */ false, 4148 /* is_const = */ false,
4149 /* is_external = */ false,
4142 token_pos)); 4150 token_pos));
4143 result.set_parent_function(parent); 4151 result.set_parent_function(parent);
4144 result.set_owner(parent_class); 4152 result.set_owner(parent_class);
4145 return result.raw(); 4153 return result.raw();
4146 } 4154 }
4147 4155
4148 4156
4149 RawFunction* Function::ImplicitClosureFunction() const { 4157 RawFunction* Function::ImplicitClosureFunction() const {
4150 // Return the existing implicit closure function if any. 4158 // Return the existing implicit closure function if any.
4151 if (raw_ptr()->implicit_closure_function_ != Function::null()) { 4159 if (raw_ptr()->implicit_closure_function_ != Function::null()) {
(...skipping 6702 matching lines...) Expand 10 before | Expand all | Expand 10 after
10854 const String& str = String::Handle(pattern()); 10862 const String& str = String::Handle(pattern());
10855 const char* format = "JSRegExp: pattern=%s flags=%s"; 10863 const char* format = "JSRegExp: pattern=%s flags=%s";
10856 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 10864 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
10857 char* chars = reinterpret_cast<char*>( 10865 char* chars = reinterpret_cast<char*>(
10858 Isolate::Current()->current_zone()->Allocate(len + 1)); 10866 Isolate::Current()->current_zone()->Allocate(len + 1));
10859 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 10867 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
10860 return chars; 10868 return chars;
10861 } 10869 }
10862 10870
10863 } // namespace dart 10871 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698