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 "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
(...skipping 3591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3602 ASSERT(n >= 0); | 3602 ASSERT(n >= 0); |
3603 raw_ptr()->num_optional_parameters_ = n; | 3603 raw_ptr()->num_optional_parameters_ = n; |
3604 } | 3604 } |
3605 | 3605 |
3606 | 3606 |
3607 void Function::set_is_optimizable(bool value) const { | 3607 void Function::set_is_optimizable(bool value) const { |
3608 raw_ptr()->is_optimizable_ = value; | 3608 raw_ptr()->is_optimizable_ = value; |
3609 } | 3609 } |
3610 | 3610 |
3611 | 3611 |
| 3612 void Function::set_is_native(bool value) const { |
| 3613 raw_ptr()->is_native_ = value; |
| 3614 } |
| 3615 |
| 3616 |
3612 intptr_t Function::NumberOfParameters() const { | 3617 intptr_t Function::NumberOfParameters() const { |
3613 return num_fixed_parameters() + num_optional_parameters(); | 3618 return num_fixed_parameters() + num_optional_parameters(); |
3614 } | 3619 } |
3615 | 3620 |
3616 | 3621 |
3617 bool Function::AreValidArgumentCounts(int num_arguments, | 3622 bool Function::AreValidArgumentCounts(int num_arguments, |
3618 int num_named_arguments) const { | 3623 int num_named_arguments) const { |
3619 if (num_arguments > NumberOfParameters()) { | 3624 if (num_arguments > NumberOfParameters()) { |
3620 return false; // Too many arguments. | 3625 return false; // Too many arguments. |
3621 } | 3626 } |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3860 result.set_kind(kind); | 3865 result.set_kind(kind); |
3861 result.set_is_static(is_static); | 3866 result.set_is_static(is_static); |
3862 result.set_is_const(is_const); | 3867 result.set_is_const(is_const); |
3863 result.set_token_index(token_index); | 3868 result.set_token_index(token_index); |
3864 result.set_end_token_index(token_index); | 3869 result.set_end_token_index(token_index); |
3865 result.set_num_fixed_parameters(0); | 3870 result.set_num_fixed_parameters(0); |
3866 result.set_num_optional_parameters(0); | 3871 result.set_num_optional_parameters(0); |
3867 result.set_usage_counter(0); | 3872 result.set_usage_counter(0); |
3868 result.set_deoptimization_counter(0); | 3873 result.set_deoptimization_counter(0); |
3869 result.set_is_optimizable(true); | 3874 result.set_is_optimizable(true); |
| 3875 result.set_is_native(false); |
3870 return result.raw(); | 3876 return result.raw(); |
3871 } | 3877 } |
3872 | 3878 |
3873 | 3879 |
3874 RawFunction* Function::NewClosureFunction(const String& name, | 3880 RawFunction* Function::NewClosureFunction(const String& name, |
3875 const Function& parent, | 3881 const Function& parent, |
3876 intptr_t token_index) { | 3882 intptr_t token_index) { |
3877 ASSERT(!parent.IsNull()); | 3883 ASSERT(!parent.IsNull()); |
3878 const Class& parent_class = Class::Handle(parent.owner()); | 3884 const Class& parent_class = Class::Handle(parent.owner()); |
3879 ASSERT(!parent_class.IsNull()); | 3885 ASSERT(!parent_class.IsNull()); |
(...skipping 6233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10113 const String& str = String::Handle(pattern()); | 10119 const String& str = String::Handle(pattern()); |
10114 const char* format = "JSRegExp: pattern=%s flags=%s"; | 10120 const char* format = "JSRegExp: pattern=%s flags=%s"; |
10115 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 10121 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
10116 char* chars = reinterpret_cast<char*>( | 10122 char* chars = reinterpret_cast<char*>( |
10117 Isolate::Current()->current_zone()->Allocate(len + 1)); | 10123 Isolate::Current()->current_zone()->Allocate(len + 1)); |
10118 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 10124 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
10119 return chars; | 10125 return chars; |
10120 } | 10126 } |
10121 | 10127 |
10122 } // namespace dart | 10128 } // namespace dart |
OLD | NEW |