| 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/bigint_operations.h" | 10 #include "vm/bigint_operations.h" |
| (...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1459 } | 1459 } |
| 1460 | 1460 |
| 1461 | 1461 |
| 1462 void Class::SetFunctions(const Array& value) const { | 1462 void Class::SetFunctions(const Array& value) const { |
| 1463 ASSERT(!value.IsNull()); | 1463 ASSERT(!value.IsNull()); |
| 1464 #if defined(DEBUG) | 1464 #if defined(DEBUG) |
| 1465 // Verify that all the functions in the array have this class as owner. | 1465 // Verify that all the functions in the array have this class as owner. |
| 1466 Function& func = Function::Handle(); | 1466 Function& func = Function::Handle(); |
| 1467 intptr_t len = value.Length(); | 1467 intptr_t len = value.Length(); |
| 1468 for (intptr_t i = 0; i < len; i++) { | 1468 for (intptr_t i = 0; i < len; i++) { |
| 1469 func ^= value.At(i); | 1469 func |= value.At(i); |
| 1470 ASSERT(func.Owner() == raw()); | 1470 ASSERT(func.Owner() == raw()); |
| 1471 } | 1471 } |
| 1472 #endif | 1472 #endif |
| 1473 StorePointer(&raw_ptr()->functions_, value.raw()); | 1473 StorePointer(&raw_ptr()->functions_, value.raw()); |
| 1474 } | 1474 } |
| 1475 | 1475 |
| 1476 | 1476 |
| 1477 void Class::AddFunction(const Function& function) const { | 1477 void Class::AddFunction(const Function& function) const { |
| 1478 const Array& arr = Array::Handle(functions()); | 1478 const Array& arr = Array::Handle(functions()); |
| 1479 const Array& new_arr = Array::Handle(Array::Grow(arr, arr.Length() + 1)); | 1479 const Array& new_arr = Array::Handle(Array::Grow(arr, arr.Length() + 1)); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1510 ASSERT(!closure.IsNull()); | 1510 ASSERT(!closure.IsNull()); |
| 1511 if ((closure.token_pos() <= token_pos) && | 1511 if ((closure.token_pos() <= token_pos) && |
| 1512 (token_pos < closure.end_token_pos()) && | 1512 (token_pos < closure.end_token_pos()) && |
| 1513 (best_fit_token_pos < closure.token_pos())) { | 1513 (best_fit_token_pos < closure.token_pos())) { |
| 1514 best_fit_index = i; | 1514 best_fit_index = i; |
| 1515 best_fit_token_pos = closure.token_pos(); | 1515 best_fit_token_pos = closure.token_pos(); |
| 1516 } | 1516 } |
| 1517 } | 1517 } |
| 1518 closure = Function::null(); | 1518 closure = Function::null(); |
| 1519 if (best_fit_index >= 0) { | 1519 if (best_fit_index >= 0) { |
| 1520 closure ^= closures.At(best_fit_index); | 1520 closure |= closures.At(best_fit_index); |
| 1521 } | 1521 } |
| 1522 return closure.raw(); | 1522 return closure.raw(); |
| 1523 } | 1523 } |
| 1524 | 1524 |
| 1525 | 1525 |
| 1526 void Class::set_signature_function(const Function& value) const { | 1526 void Class::set_signature_function(const Function& value) const { |
| 1527 ASSERT(value.IsClosureFunction() || value.IsSignatureFunction()); | 1527 ASSERT(value.IsClosureFunction() || value.IsSignatureFunction()); |
| 1528 StorePointer(&raw_ptr()->signature_function_, value.raw()); | 1528 StorePointer(&raw_ptr()->signature_function_, value.raw()); |
| 1529 } | 1529 } |
| 1530 | 1530 |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1784 } | 1784 } |
| 1785 | 1785 |
| 1786 | 1786 |
| 1787 void Class::SetFields(const Array& value) const { | 1787 void Class::SetFields(const Array& value) const { |
| 1788 ASSERT(!value.IsNull()); | 1788 ASSERT(!value.IsNull()); |
| 1789 #if defined(DEBUG) | 1789 #if defined(DEBUG) |
| 1790 // Verify that all the fields in the array have this class as owner. | 1790 // Verify that all the fields in the array have this class as owner. |
| 1791 Field& field = Field::Handle(); | 1791 Field& field = Field::Handle(); |
| 1792 intptr_t len = value.Length(); | 1792 intptr_t len = value.Length(); |
| 1793 for (intptr_t i = 0; i < len; i++) { | 1793 for (intptr_t i = 0; i < len; i++) { |
| 1794 field ^= value.At(i); | 1794 field |= value.At(i); |
| 1795 ASSERT(field.owner() == raw()); | 1795 ASSERT(field.owner() == raw()); |
| 1796 } | 1796 } |
| 1797 #endif | 1797 #endif |
| 1798 // The value of static fields is already initialized to null. | 1798 // The value of static fields is already initialized to null. |
| 1799 StorePointer(&raw_ptr()->fields_, value.raw()); | 1799 StorePointer(&raw_ptr()->fields_, value.raw()); |
| 1800 } | 1800 } |
| 1801 | 1801 |
| 1802 | 1802 |
| 1803 template <class FakeInstance> | 1803 template <class FakeInstance> |
| 1804 RawClass* Class::New(intptr_t index) { | 1804 RawClass* Class::New(intptr_t index) { |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2276 RawFunction* Class::LookupFactory(const String& name) const { | 2276 RawFunction* Class::LookupFactory(const String& name) const { |
| 2277 Function& function = Function::Handle(LookupFunction(name)); | 2277 Function& function = Function::Handle(LookupFunction(name)); |
| 2278 if (function.IsNull() || !function.IsFactory()) { | 2278 if (function.IsNull() || !function.IsFactory()) { |
| 2279 return Function::null(); | 2279 return Function::null(); |
| 2280 } | 2280 } |
| 2281 ASSERT(function.is_static()); | 2281 ASSERT(function.is_static()); |
| 2282 return function.raw(); | 2282 return function.raw(); |
| 2283 } | 2283 } |
| 2284 | 2284 |
| 2285 | 2285 |
| 2286 // Returns true if 'prefix' and 'accessor_name' match 'name'. |
| 2286 static bool MatchesAccessorName(const String& name, | 2287 static bool MatchesAccessorName(const String& name, |
| 2287 const char* prefix, | 2288 const char* prefix, |
| 2288 intptr_t prefix_length, | 2289 intptr_t prefix_length, |
| 2289 const String& accessor_name) { | 2290 const String& accessor_name) { |
| 2290 intptr_t name_len = name.Length(); | 2291 intptr_t name_len = name.Length(); |
| 2291 intptr_t accessor_name_len = accessor_name.Length(); | 2292 intptr_t accessor_name_len = accessor_name.Length(); |
| 2292 | 2293 |
| 2293 if (name_len != (accessor_name_len + prefix_length)) { | 2294 if (name_len != (accessor_name_len + prefix_length)) { |
| 2294 return false; | 2295 return false; |
| 2295 } | 2296 } |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3000 static void InsertIntoCanonicalTypeArguments(Isolate* isolate, | 3001 static void InsertIntoCanonicalTypeArguments(Isolate* isolate, |
| 3001 const Array& table, | 3002 const Array& table, |
| 3002 const TypeArguments& arguments, | 3003 const TypeArguments& arguments, |
| 3003 intptr_t index) { | 3004 intptr_t index) { |
| 3004 arguments.SetCanonical(); // Mark object as being canonical. | 3005 arguments.SetCanonical(); // Mark object as being canonical. |
| 3005 table.SetAt(index, arguments); // Remember the new element. | 3006 table.SetAt(index, arguments); // Remember the new element. |
| 3006 // Update used count. | 3007 // Update used count. |
| 3007 // Last element of the array is the number of used elements. | 3008 // Last element of the array is the number of used elements. |
| 3008 intptr_t table_size = table.Length() - 1; | 3009 intptr_t table_size = table.Length() - 1; |
| 3009 Smi& used = Smi::Handle(isolate); | 3010 Smi& used = Smi::Handle(isolate); |
| 3010 used ^= table.At(table_size); | 3011 used |= table.At(table_size); |
| 3011 intptr_t used_elements = used.Value() + 1; | 3012 intptr_t used_elements = used.Value() + 1; |
| 3012 used = Smi::New(used_elements); | 3013 used = Smi::New(used_elements); |
| 3013 table.SetAt(table_size, used); | 3014 table.SetAt(table_size, used); |
| 3014 | 3015 |
| 3015 // Rehash if table is 75% full. | 3016 // Rehash if table is 75% full. |
| 3016 if (used_elements > ((table_size / 4) * 3)) { | 3017 if (used_elements > ((table_size / 4) * 3)) { |
| 3017 GrowCanonicalTypeArguments(isolate, table); | 3018 GrowCanonicalTypeArguments(isolate, table); |
| 3018 } | 3019 } |
| 3019 } | 3020 } |
| 3020 | 3021 |
| (...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3503 | 3504 |
| 3504 | 3505 |
| 3505 void Function::set_parameter_types(const Array& value) const { | 3506 void Function::set_parameter_types(const Array& value) const { |
| 3506 StorePointer(&raw_ptr()->parameter_types_, value.raw()); | 3507 StorePointer(&raw_ptr()->parameter_types_, value.raw()); |
| 3507 } | 3508 } |
| 3508 | 3509 |
| 3509 | 3510 |
| 3510 RawString* Function::ParameterNameAt(intptr_t index) const { | 3511 RawString* Function::ParameterNameAt(intptr_t index) const { |
| 3511 const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_); | 3512 const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_); |
| 3512 String& parameter_name = String::Handle(); | 3513 String& parameter_name = String::Handle(); |
| 3513 parameter_name ^= parameter_names.At(index); | 3514 parameter_name |= parameter_names.At(index); |
| 3514 return parameter_name.raw(); | 3515 return parameter_name.raw(); |
| 3515 } | 3516 } |
| 3516 | 3517 |
| 3517 | 3518 |
| 3518 void Function::SetParameterNameAt(intptr_t index, const String& value) const { | 3519 void Function::SetParameterNameAt(intptr_t index, const String& value) const { |
| 3519 ASSERT(!value.IsNull() && value.IsSymbol()); | 3520 ASSERT(!value.IsNull() && value.IsSymbol()); |
| 3520 const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_); | 3521 const Array& parameter_names = Array::Handle(raw_ptr()->parameter_names_); |
| 3521 parameter_names.SetAt(index, value); | 3522 parameter_names.SetAt(index, value); |
| 3522 } | 3523 } |
| 3523 | 3524 |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3722 argument_names.IsNull() ? 0 : argument_names.Length(); | 3723 argument_names.IsNull() ? 0 : argument_names.Length(); |
| 3723 if (!AreValidArgumentCounts(num_arguments, | 3724 if (!AreValidArgumentCounts(num_arguments, |
| 3724 num_named_arguments, | 3725 num_named_arguments, |
| 3725 error_message)) { | 3726 error_message)) { |
| 3726 return false; | 3727 return false; |
| 3727 } | 3728 } |
| 3728 // Verify that all argument names are valid parameter names. | 3729 // Verify that all argument names are valid parameter names. |
| 3729 String& argument_name = String::Handle(); | 3730 String& argument_name = String::Handle(); |
| 3730 String& parameter_name = String::Handle(); | 3731 String& parameter_name = String::Handle(); |
| 3731 for (int i = 0; i < num_named_arguments; i++) { | 3732 for (int i = 0; i < num_named_arguments; i++) { |
| 3732 argument_name ^= argument_names.At(i); | 3733 argument_name |= argument_names.At(i); |
| 3733 ASSERT(argument_name.IsSymbol()); | 3734 ASSERT(argument_name.IsSymbol()); |
| 3734 bool found = false; | 3735 bool found = false; |
| 3735 const int num_positional_args = num_arguments - num_named_arguments; | 3736 const int num_positional_args = num_arguments - num_named_arguments; |
| 3736 const int num_parameters = NumParameters(); | 3737 const int num_parameters = NumParameters(); |
| 3737 for (int j = num_positional_args; !found && (j < num_parameters); j++) { | 3738 for (int j = num_positional_args; !found && (j < num_parameters); j++) { |
| 3738 parameter_name ^= ParameterNameAt(j); | 3739 parameter_name |= ParameterNameAt(j); |
| 3739 ASSERT(argument_name.IsSymbol()); | 3740 ASSERT(argument_name.IsSymbol()); |
| 3740 if (argument_name.Equals(parameter_name)) { | 3741 if (argument_name.Equals(parameter_name)) { |
| 3741 found = true; | 3742 found = true; |
| 3742 } | 3743 } |
| 3743 } | 3744 } |
| 3744 if (!found) { | 3745 if (!found) { |
| 3745 if (error_message != NULL) { | 3746 if (error_message != NULL) { |
| 3746 const intptr_t kMessageBufferSize = 64; | 3747 const intptr_t kMessageBufferSize = 64; |
| 3747 char message_buffer[kMessageBufferSize]; | 3748 char message_buffer[kMessageBufferSize]; |
| 3748 OS::SNPrint(message_buffer, | 3749 OS::SNPrint(message_buffer, |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4088 } | 4089 } |
| 4089 ASSERT(!IsSignatureFunction() && !IsClosureFunction()); | 4090 ASSERT(!IsSignatureFunction() && !IsClosureFunction()); |
| 4090 // Create closure function. | 4091 // Create closure function. |
| 4091 const String& closure_name = String::Handle(name()); | 4092 const String& closure_name = String::Handle(name()); |
| 4092 const Function& closure_function = Function::Handle( | 4093 const Function& closure_function = Function::Handle( |
| 4093 NewClosureFunction(closure_name, *this, token_pos())); | 4094 NewClosureFunction(closure_name, *this, token_pos())); |
| 4094 | 4095 |
| 4095 // Set closure function's context scope. | 4096 // Set closure function's context scope. |
| 4096 ContextScope& context_scope = ContextScope::Handle(); | 4097 ContextScope& context_scope = ContextScope::Handle(); |
| 4097 if (is_static()) { | 4098 if (is_static()) { |
| 4098 context_scope ^= ContextScope::New(0); | 4099 context_scope |= ContextScope::New(0); |
| 4099 } else { | 4100 } else { |
| 4100 context_scope ^= LocalScope::CreateImplicitClosureScope(*this); | 4101 context_scope |= LocalScope::CreateImplicitClosureScope(*this); |
| 4101 } | 4102 } |
| 4102 closure_function.set_context_scope(context_scope); | 4103 closure_function.set_context_scope(context_scope); |
| 4103 | 4104 |
| 4104 // Set closure function's result type to this result type. | 4105 // Set closure function's result type to this result type. |
| 4105 closure_function.set_result_type(AbstractType::Handle(result_type())); | 4106 closure_function.set_result_type(AbstractType::Handle(result_type())); |
| 4106 | 4107 |
| 4107 // Set closure function's formal parameters to this formal parameters, | 4108 // Set closure function's formal parameters to this formal parameters, |
| 4108 // removing the receiver if this is an instance method and adding the closure | 4109 // removing the receiver if this is an instance method and adding the closure |
| 4109 // object as first parameter. | 4110 // object as first parameter. |
| 4110 const int kClosure = 1; | 4111 const int kClosure = 1; |
| (...skipping 1093 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5204 Token::Kind kind = static_cast<Token::Kind>( | 5205 Token::Kind kind = static_cast<Token::Kind>( |
| 5205 Smi::Value(reinterpret_cast<RawSmi*>(obj.raw()))); | 5206 Smi::Value(reinterpret_cast<RawSmi*>(obj.raw()))); |
| 5206 ASSERT(kind < Token::kNumTokens); | 5207 ASSERT(kind < Token::kNumTokens); |
| 5207 if (Token::IsPseudoKeyword(kind) || Token::IsKeyword(kind)) { | 5208 if (Token::IsPseudoKeyword(kind) || Token::IsKeyword(kind)) { |
| 5208 Isolate* isolate = Isolate::Current(); | 5209 Isolate* isolate = Isolate::Current(); |
| 5209 ObjectStore* object_store = isolate->object_store(); | 5210 ObjectStore* object_store = isolate->object_store(); |
| 5210 String& str = String::Handle(isolate, String::null()); | 5211 String& str = String::Handle(isolate, String::null()); |
| 5211 const Array& symbols = Array::Handle(isolate, | 5212 const Array& symbols = Array::Handle(isolate, |
| 5212 object_store->keyword_symbols()); | 5213 object_store->keyword_symbols()); |
| 5213 ASSERT(!symbols.IsNull()); | 5214 ASSERT(!symbols.IsNull()); |
| 5214 str ^= symbols.At(kind - Token::kFirstKeyword); | 5215 str |= symbols.At(kind - Token::kFirstKeyword); |
| 5215 ASSERT(!str.IsNull()); | 5216 ASSERT(!str.IsNull()); |
| 5216 return str.raw(); | 5217 return str.raw(); |
| 5217 } | 5218 } |
| 5218 return Symbols::New(Token::Str(kind)); | 5219 return Symbols::New(Token::Str(kind)); |
| 5219 } else { | 5220 } else { |
| 5220 ASSERT(obj.IsLiteralToken()); // Must be a literal token. | 5221 ASSERT(obj.IsLiteralToken()); // Must be a literal token. |
| 5221 const LiteralToken& literal_token = LiteralToken::Cast(obj); | 5222 const LiteralToken& literal_token = LiteralToken::Cast(obj); |
| 5222 return literal_token.literal(); | 5223 return literal_token.literal(); |
| 5223 } | 5224 } |
| 5224 } | 5225 } |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5587 entry = dict.At(index); | 5588 entry = dict.At(index); |
| 5588 // An empty spot will be found because we keep the hash set at most 75% full. | 5589 // An empty spot will be found because we keep the hash set at most 75% full. |
| 5589 while (!entry.IsNull()) { | 5590 while (!entry.IsNull()) { |
| 5590 index = (index + 1) % dict_size; | 5591 index = (index + 1) % dict_size; |
| 5591 entry = dict.At(index); | 5592 entry = dict.At(index); |
| 5592 } | 5593 } |
| 5593 | 5594 |
| 5594 // Insert the object at the empty slot. | 5595 // Insert the object at the empty slot. |
| 5595 dict.SetAt(index, obj); | 5596 dict.SetAt(index, obj); |
| 5596 Smi& used = Smi::Handle(); | 5597 Smi& used = Smi::Handle(); |
| 5597 used ^= dict.At(dict_size); | 5598 used |= dict.At(dict_size); |
| 5598 intptr_t used_elements = used.Value() + 1; // One more element added. | 5599 intptr_t used_elements = used.Value() + 1; // One more element added. |
| 5599 used = Smi::New(used_elements); | 5600 used = Smi::New(used_elements); |
| 5600 dict.SetAt(dict_size, used); // Update used count. | 5601 dict.SetAt(dict_size, used); // Update used count. |
| 5601 | 5602 |
| 5602 // Rehash if symbol_table is 75% full. | 5603 // Rehash if symbol_table is 75% full. |
| 5603 if (used_elements > ((dict_size / 4) * 3)) { | 5604 if (used_elements > ((dict_size / 4) * 3)) { |
| 5604 GrowDictionary(dict, dict_size); | 5605 GrowDictionary(dict, dict_size); |
| 5605 } | 5606 } |
| 5606 | 5607 |
| 5607 // Invalidate the cache of loaded scripts. | 5608 // Invalidate the cache of loaded scripts. |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5846 Isolate* isolate = Isolate::Current(); | 5847 Isolate* isolate = Isolate::Current(); |
| 5847 Field& field = Field::Handle(isolate, Field::null()); | 5848 Field& field = Field::Handle(isolate, Field::null()); |
| 5848 Object& obj = Object::Handle(isolate, Object::null()); | 5849 Object& obj = Object::Handle(isolate, Object::null()); |
| 5849 obj = LookupLocalObject(name); | 5850 obj = LookupLocalObject(name); |
| 5850 if (obj.IsNull() && ShouldBePrivate(name)) { | 5851 if (obj.IsNull() && ShouldBePrivate(name)) { |
| 5851 String& private_name = String::Handle(isolate, PrivateName(name)); | 5852 String& private_name = String::Handle(isolate, PrivateName(name)); |
| 5852 obj = LookupLocalObject(private_name); | 5853 obj = LookupLocalObject(private_name); |
| 5853 } | 5854 } |
| 5854 if (!obj.IsNull()) { | 5855 if (!obj.IsNull()) { |
| 5855 if (obj.IsField()) { | 5856 if (obj.IsField()) { |
| 5856 field ^= obj.raw(); | 5857 field |= obj.raw(); |
| 5857 return field.raw(); | 5858 return field.raw(); |
| 5858 } | 5859 } |
| 5859 } | 5860 } |
| 5860 | 5861 |
| 5861 // No field found. | 5862 // No field found. |
| 5862 return Field::null(); | 5863 return Field::null(); |
| 5863 } | 5864 } |
| 5864 | 5865 |
| 5865 | 5866 |
| 5866 RawFunction* Library::LookupFunctionAllowPrivate(const String& name) const { | 5867 RawFunction* Library::LookupFunctionAllowPrivate(const String& name) const { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6000 return import.library(); | 6001 return import.library(); |
| 6001 } | 6002 } |
| 6002 | 6003 |
| 6003 | 6004 |
| 6004 RawNamespace* Library::ImportAt(intptr_t index) const { | 6005 RawNamespace* Library::ImportAt(intptr_t index) const { |
| 6005 if ((index < 0) || index >= num_imports()) { | 6006 if ((index < 0) || index >= num_imports()) { |
| 6006 return Namespace::null(); | 6007 return Namespace::null(); |
| 6007 } | 6008 } |
| 6008 const Array& import_list = Array::Handle(imports()); | 6009 const Array& import_list = Array::Handle(imports()); |
| 6009 Namespace& import = Namespace::Handle(); | 6010 Namespace& import = Namespace::Handle(); |
| 6010 import ^= import_list.At(index); | 6011 import |= import_list.At(index); |
| 6011 return import.raw(); | 6012 return import.raw(); |
| 6012 } | 6013 } |
| 6013 | 6014 |
| 6014 | 6015 |
| 6015 bool Library::ImportsCorelib() const { | 6016 bool Library::ImportsCorelib() const { |
| 6016 Isolate* isolate = Isolate::Current(); | 6017 Isolate* isolate = Isolate::Current(); |
| 6017 Library& imported = Library::Handle(isolate); | 6018 Library& imported = Library::Handle(isolate); |
| 6018 intptr_t count = num_imports(); | 6019 intptr_t count = num_imports(); |
| 6019 for (int i = 0; i < count; i++) { | 6020 for (int i = 0; i < count; i++) { |
| 6020 imported = ImportLibraryAt(i); | 6021 imported = ImportLibraryAt(i); |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6335 return false; | 6336 return false; |
| 6336 } | 6337 } |
| 6337 | 6338 |
| 6338 | 6339 |
| 6339 // Cannot handle qualified names properly as it only appends private key to | 6340 // Cannot handle qualified names properly as it only appends private key to |
| 6340 // the end (e.g. _Alfa.foo -> _Alfa.foo@...). | 6341 // the end (e.g. _Alfa.foo -> _Alfa.foo@...). |
| 6341 RawString* Library::PrivateName(const String& name) const { | 6342 RawString* Library::PrivateName(const String& name) const { |
| 6342 ASSERT(IsPrivate(name)); | 6343 ASSERT(IsPrivate(name)); |
| 6343 // ASSERT(strchr(name, '@') == NULL); | 6344 // ASSERT(strchr(name, '@') == NULL); |
| 6344 String& str = String::Handle(); | 6345 String& str = String::Handle(); |
| 6345 str ^= name.raw(); | 6346 str |= name.raw(); |
| 6346 str = String::Concat(str, String::Handle(this->private_key())); | 6347 str = String::Concat(str, String::Handle(this->private_key())); |
| 6347 str = Symbols::New(str); | 6348 str = Symbols::New(str); |
| 6348 return str.raw(); | 6349 return str.raw(); |
| 6349 } | 6350 } |
| 6350 | 6351 |
| 6351 | 6352 |
| 6352 RawLibrary* Library::GetLibrary(intptr_t index) { | 6353 RawLibrary* Library::GetLibrary(intptr_t index) { |
| 6353 Isolate* isolate = Isolate::Current(); | 6354 Isolate* isolate = Isolate::Current(); |
| 6354 const GrowableObjectArray& libs = | 6355 const GrowableObjectArray& libs = |
| 6355 GrowableObjectArray::Handle(isolate->object_store()->libraries()); | 6356 GrowableObjectArray::Handle(isolate->object_store()->libraries()); |
| 6356 ASSERT(!libs.IsNull()); | 6357 ASSERT(!libs.IsNull()); |
| 6357 if ((0 <= index) && (index < libs.Length())) { | 6358 if ((0 <= index) && (index < libs.Length())) { |
| 6358 Library& lib = Library::Handle(); | 6359 Library& lib = Library::Handle(); |
| 6359 lib ^= libs.At(index); | 6360 lib |= libs.At(index); |
| 6360 return lib.raw(); | 6361 return lib.raw(); |
| 6361 } | 6362 } |
| 6362 return Library::null(); | 6363 return Library::null(); |
| 6363 } | 6364 } |
| 6364 | 6365 |
| 6365 | 6366 |
| 6366 void Library::Register() const { | 6367 void Library::Register() const { |
| 6367 ASSERT(Library::LookupLibrary(String::Handle(url())) == Library::null()); | 6368 ASSERT(Library::LookupLibrary(String::Handle(url())) == Library::null()); |
| 6368 ObjectStore* object_store = Isolate::Current()->object_store(); | 6369 ObjectStore* object_store = Isolate::Current()->object_store(); |
| 6369 GrowableObjectArray& libs = | 6370 GrowableObjectArray& libs = |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6426 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 6427 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 6427 OS::SNPrint(chars, len, kFormat, name.ToCString()); | 6428 OS::SNPrint(chars, len, kFormat, name.ToCString()); |
| 6428 return chars; | 6429 return chars; |
| 6429 } | 6430 } |
| 6430 | 6431 |
| 6431 | 6432 |
| 6432 RawLibrary* LibraryPrefix::GetLibrary(int index) const { | 6433 RawLibrary* LibraryPrefix::GetLibrary(int index) const { |
| 6433 if ((index >= 0) || (index < num_imports())) { | 6434 if ((index >= 0) || (index < num_imports())) { |
| 6434 const Array& imports = Array::Handle(this->imports()); | 6435 const Array& imports = Array::Handle(this->imports()); |
| 6435 Namespace& import = Namespace::Handle(); | 6436 Namespace& import = Namespace::Handle(); |
| 6436 import ^= imports.At(index); | 6437 import |= imports.At(index); |
| 6437 return import.library(); | 6438 return import.library(); |
| 6438 } | 6439 } |
| 6439 return Library::null(); | 6440 return Library::null(); |
| 6440 } | 6441 } |
| 6441 | 6442 |
| 6442 | 6443 |
| 6443 bool LibraryPrefix::ContainsLibrary(const Library& library) const { | 6444 bool LibraryPrefix::ContainsLibrary(const Library& library) const { |
| 6444 intptr_t num_current_imports = num_imports(); | 6445 intptr_t num_current_imports = num_imports(); |
| 6445 if (num_current_imports > 0) { | 6446 if (num_current_imports > 0) { |
| 6446 Library& lib = Library::Handle(); | 6447 Library& lib = Library::Handle(); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6960 return chars; | 6961 return chars; |
| 6961 } | 6962 } |
| 6962 } | 6963 } |
| 6963 | 6964 |
| 6964 | 6965 |
| 6965 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { | 6966 RawString* LocalVarDescriptors::GetName(intptr_t var_index) const { |
| 6966 ASSERT(var_index < Length()); | 6967 ASSERT(var_index < Length()); |
| 6967 const Array& names = Array::Handle(raw_ptr()->names_); | 6968 const Array& names = Array::Handle(raw_ptr()->names_); |
| 6968 ASSERT(Length() == names.Length()); | 6969 ASSERT(Length() == names.Length()); |
| 6969 String& name = String::Handle(); | 6970 String& name = String::Handle(); |
| 6970 name ^= names.At(var_index); | 6971 name |= names.At(var_index); |
| 6971 return name.raw(); | 6972 return name.raw(); |
| 6972 } | 6973 } |
| 6973 | 6974 |
| 6974 | 6975 |
| 6975 void LocalVarDescriptors::SetVar(intptr_t var_index, | 6976 void LocalVarDescriptors::SetVar(intptr_t var_index, |
| 6976 const String& name, | 6977 const String& name, |
| 6977 RawLocalVarDescriptors::VarInfo* info) const { | 6978 RawLocalVarDescriptors::VarInfo* info) const { |
| 6978 ASSERT(var_index < Length()); | 6979 ASSERT(var_index < Length()); |
| 6979 const Array& names = Array::Handle(raw_ptr()->names_); | 6980 const Array& names = Array::Handle(raw_ptr()->names_); |
| 6980 ASSERT(Length() == names.Length()); | 6981 ASSERT(Length() == names.Length()); |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7293 intptr_t Code::Comments::Length() const { | 7294 intptr_t Code::Comments::Length() const { |
| 7294 if (comments_.IsNull()) { | 7295 if (comments_.IsNull()) { |
| 7295 return 0; | 7296 return 0; |
| 7296 } | 7297 } |
| 7297 return comments_.Length() / kNumberOfEntries; | 7298 return comments_.Length() / kNumberOfEntries; |
| 7298 } | 7299 } |
| 7299 | 7300 |
| 7300 | 7301 |
| 7301 intptr_t Code::Comments::PCOffsetAt(intptr_t idx) const { | 7302 intptr_t Code::Comments::PCOffsetAt(intptr_t idx) const { |
| 7302 Smi& result = Smi::Handle(); | 7303 Smi& result = Smi::Handle(); |
| 7303 result ^= comments_.At(idx * kNumberOfEntries + kPCOffsetEntry); | 7304 result |= comments_.At(idx * kNumberOfEntries + kPCOffsetEntry); |
| 7304 return result.Value(); | 7305 return result.Value(); |
| 7305 } | 7306 } |
| 7306 | 7307 |
| 7307 | 7308 |
| 7308 void Code::Comments::SetPCOffsetAt(intptr_t idx, intptr_t pc) { | 7309 void Code::Comments::SetPCOffsetAt(intptr_t idx, intptr_t pc) { |
| 7309 comments_.SetAt(idx * kNumberOfEntries + kPCOffsetEntry, | 7310 comments_.SetAt(idx * kNumberOfEntries + kPCOffsetEntry, |
| 7310 Smi::Handle(Smi::New(pc))); | 7311 Smi::Handle(Smi::New(pc))); |
| 7311 } | 7312 } |
| 7312 | 7313 |
| 7313 | 7314 |
| 7314 RawString* Code::Comments::CommentAt(intptr_t idx) const { | 7315 RawString* Code::Comments::CommentAt(intptr_t idx) const { |
| 7315 String& result = String::Handle(); | 7316 String& result = String::Handle(); |
| 7316 result ^= comments_.At(idx * kNumberOfEntries + kCommentEntry); | 7317 result |= comments_.At(idx * kNumberOfEntries + kCommentEntry); |
| 7317 return result.raw(); | 7318 return result.raw(); |
| 7318 } | 7319 } |
| 7319 | 7320 |
| 7320 | 7321 |
| 7321 void Code::Comments::SetCommentAt(intptr_t idx, const String& comment) { | 7322 void Code::Comments::SetCommentAt(intptr_t idx, const String& comment) { |
| 7322 comments_.SetAt(idx * kNumberOfEntries + kCommentEntry, comment); | 7323 comments_.SetAt(idx * kNumberOfEntries + kCommentEntry, comment); |
| 7323 } | 7324 } |
| 7324 | 7325 |
| 7325 | 7326 |
| 7326 Code::Comments::Comments(const Array& comments) | 7327 Code::Comments::Comments(const Array& comments) |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7658 if (stackmaps() == Array::null()) { | 7659 if (stackmaps() == Array::null()) { |
| 7659 // No stack maps are present in the code object which means this | 7660 // No stack maps are present in the code object which means this |
| 7660 // frame relies on tagged pointers. | 7661 // frame relies on tagged pointers. |
| 7661 return Stackmap::null(); | 7662 return Stackmap::null(); |
| 7662 } | 7663 } |
| 7663 // A stack map is present in the code object, use the stack map to visit | 7664 // A stack map is present in the code object, use the stack map to visit |
| 7664 // frame slots which are marked as having objects. | 7665 // frame slots which are marked as having objects. |
| 7665 *maps = stackmaps(); | 7666 *maps = stackmaps(); |
| 7666 *map = Stackmap::null(); | 7667 *map = Stackmap::null(); |
| 7667 for (intptr_t i = 0; i < maps->Length(); i++) { | 7668 for (intptr_t i = 0; i < maps->Length(); i++) { |
| 7668 *map ^= maps->At(i); | 7669 *map |= maps->At(i); |
| 7669 ASSERT(!map->IsNull()); | 7670 ASSERT(!map->IsNull()); |
| 7670 if (map->PC() == pc) { | 7671 if (map->PC() == pc) { |
| 7671 return map->raw(); // We found a stack map for this frame. | 7672 return map->raw(); // We found a stack map for this frame. |
| 7672 } | 7673 } |
| 7673 } | 7674 } |
| 7674 // If the code has stackmaps, it must have them for all safepoints. | 7675 // If the code has stackmaps, it must have them for all safepoints. |
| 7675 UNREACHABLE(); | 7676 UNREACHABLE(); |
| 7676 return Stackmap::null(); | 7677 return Stackmap::null(); |
| 7677 } | 7678 } |
| 7678 | 7679 |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7973 GrowableArray<intptr_t>* class_ids, | 7974 GrowableArray<intptr_t>* class_ids, |
| 7974 Function* target) const { | 7975 Function* target) const { |
| 7975 ASSERT(index < NumberOfChecks()); | 7976 ASSERT(index < NumberOfChecks()); |
| 7976 ASSERT(class_ids != NULL); | 7977 ASSERT(class_ids != NULL); |
| 7977 ASSERT(target != NULL); | 7978 ASSERT(target != NULL); |
| 7978 class_ids->Clear(); | 7979 class_ids->Clear(); |
| 7979 const Array& data = Array::Handle(ic_data()); | 7980 const Array& data = Array::Handle(ic_data()); |
| 7980 intptr_t data_pos = index * TestEntryLength(); | 7981 intptr_t data_pos = index * TestEntryLength(); |
| 7981 Smi& smi = Smi::Handle(); | 7982 Smi& smi = Smi::Handle(); |
| 7982 for (intptr_t i = 0; i < num_args_tested(); i++) { | 7983 for (intptr_t i = 0; i < num_args_tested(); i++) { |
| 7983 smi ^= data.At(data_pos++); | 7984 smi |= data.At(data_pos++); |
| 7984 class_ids->Add(smi.Value()); | 7985 class_ids->Add(smi.Value()); |
| 7985 } | 7986 } |
| 7986 (*target) ^= data.At(data_pos++); | 7987 (*target) |= data.At(data_pos++); |
| 7987 } | 7988 } |
| 7988 | 7989 |
| 7989 | 7990 |
| 7990 void ICData::GetOneClassCheckAt(intptr_t index, | 7991 void ICData::GetOneClassCheckAt(intptr_t index, |
| 7991 intptr_t* class_id, | 7992 intptr_t* class_id, |
| 7992 Function* target) const { | 7993 Function* target) const { |
| 7993 ASSERT(class_id != NULL); | 7994 ASSERT(class_id != NULL); |
| 7994 ASSERT(target != NULL); | 7995 ASSERT(target != NULL); |
| 7995 ASSERT(num_args_tested() == 1); | 7996 ASSERT(num_args_tested() == 1); |
| 7996 const Array& data = Array::Handle(ic_data()); | 7997 const Array& data = Array::Handle(ic_data()); |
| 7997 intptr_t data_pos = index * TestEntryLength(); | 7998 intptr_t data_pos = index * TestEntryLength(); |
| 7998 Smi& smi = Smi::Handle(); | 7999 Smi& smi = Smi::Handle(); |
| 7999 smi ^= data.At(data_pos); | 8000 smi |= data.At(data_pos); |
| 8000 *class_id = smi.Value(); | 8001 *class_id = smi.Value(); |
| 8001 *target ^= data.At(data_pos + 1); | 8002 *target |= data.At(data_pos + 1); |
| 8002 } | 8003 } |
| 8003 | 8004 |
| 8004 | 8005 |
| 8005 intptr_t ICData::GetClassIdAt(intptr_t index, intptr_t arg_nr) const { | 8006 intptr_t ICData::GetClassIdAt(intptr_t index, intptr_t arg_nr) const { |
| 8006 GrowableArray<intptr_t> class_ids; | 8007 GrowableArray<intptr_t> class_ids; |
| 8007 Function& target = Function::Handle(); | 8008 Function& target = Function::Handle(); |
| 8008 GetCheckAt(index, &class_ids, &target); | 8009 GetCheckAt(index, &class_ids, &target); |
| 8009 return class_ids[arg_nr]; | 8010 return class_ids[arg_nr]; |
| 8010 } | 8011 } |
| 8011 | 8012 |
| 8012 | 8013 |
| 8013 intptr_t ICData::GetReceiverClassIdAt(intptr_t index) const { | 8014 intptr_t ICData::GetReceiverClassIdAt(intptr_t index) const { |
| 8014 ASSERT(index < NumberOfChecks()); | 8015 ASSERT(index < NumberOfChecks()); |
| 8015 const Array& data = Array::Handle(ic_data()); | 8016 const Array& data = Array::Handle(ic_data()); |
| 8016 const intptr_t data_pos = index * TestEntryLength(); | 8017 const intptr_t data_pos = index * TestEntryLength(); |
| 8017 Smi& smi = Smi::Handle(); | 8018 Smi& smi = Smi::Handle(); |
| 8018 smi ^= data.At(data_pos); | 8019 smi |= data.At(data_pos); |
| 8019 return smi.Value(); | 8020 return smi.Value(); |
| 8020 } | 8021 } |
| 8021 | 8022 |
| 8022 | 8023 |
| 8023 RawFunction* ICData::GetTargetAt(intptr_t index) const { | 8024 RawFunction* ICData::GetTargetAt(intptr_t index) const { |
| 8024 const Array& data = Array::Handle(ic_data()); | 8025 const Array& data = Array::Handle(ic_data()); |
| 8025 const intptr_t data_pos = index * TestEntryLength() + num_args_tested(); | 8026 const intptr_t data_pos = index * TestEntryLength() + num_args_tested(); |
| 8026 ASSERT(Object::Handle(data.At(data_pos)).IsFunction()); | 8027 ASSERT(Object::Handle(data.At(data_pos)).IsFunction()); |
| 8027 return reinterpret_cast<RawFunction*>(data.At(data_pos)); | 8028 return reinterpret_cast<RawFunction*>(data.At(data_pos)); |
| 8028 } | 8029 } |
| 8029 | 8030 |
| 8030 | 8031 |
| 8031 intptr_t ICData::GetCountAt(intptr_t index) const { | 8032 intptr_t ICData::GetCountAt(intptr_t index) const { |
| 8032 const Array& data = Array::Handle(ic_data()); | 8033 const Array& data = Array::Handle(ic_data()); |
| 8033 const intptr_t data_pos = index * TestEntryLength() + | 8034 const intptr_t data_pos = index * TestEntryLength() + |
| 8034 CountIndexFor(num_args_tested()); | 8035 CountIndexFor(num_args_tested()); |
| 8035 Smi& smi = Smi::Handle(); | 8036 Smi& smi = Smi::Handle(); |
| 8036 smi ^= data.At(data_pos); | 8037 smi |= data.At(data_pos); |
| 8037 return smi.Value(); | 8038 return smi.Value(); |
| 8038 } | 8039 } |
| 8039 | 8040 |
| 8040 | 8041 |
| 8041 intptr_t ICData::AggregateCount() const { | 8042 intptr_t ICData::AggregateCount() const { |
| 8042 const intptr_t len = NumberOfChecks(); | 8043 const intptr_t len = NumberOfChecks(); |
| 8043 intptr_t count = 0; | 8044 intptr_t count = 0; |
| 8044 for (intptr_t i = 0; i < len; i++) { | 8045 for (intptr_t i = 0; i < len; i++) { |
| 8045 count += GetCountAt(i); | 8046 count += GetCountAt(i); |
| 8046 } | 8047 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8258 Isolate::Current()->megamorphic_cache_table()->miss_handler()); | 8259 Isolate::Current()->megamorphic_cache_table()->miss_handler()); |
| 8259 for (intptr_t i = 0; i < new_capacity; ++i) { | 8260 for (intptr_t i = 0; i < new_capacity; ++i) { |
| 8260 SetEntry(new_buckets, i, class_id, target); | 8261 SetEntry(new_buckets, i, class_id, target); |
| 8261 } | 8262 } |
| 8262 set_buckets(new_buckets); | 8263 set_buckets(new_buckets); |
| 8263 set_mask(new_capacity - 1); | 8264 set_mask(new_capacity - 1); |
| 8264 set_filled_entry_count(0); | 8265 set_filled_entry_count(0); |
| 8265 | 8266 |
| 8266 // Rehash the valid entries. | 8267 // Rehash the valid entries. |
| 8267 for (intptr_t i = 0; i < old_capacity; ++i) { | 8268 for (intptr_t i = 0; i < old_capacity; ++i) { |
| 8268 class_id ^= GetClassId(old_buckets, i); | 8269 class_id |= GetClassId(old_buckets, i); |
| 8269 if (class_id.Value() != kIllegalCid) { | 8270 if (class_id.Value() != kIllegalCid) { |
| 8270 target ^= GetTargetFunction(old_buckets, i); | 8271 target |= GetTargetFunction(old_buckets, i); |
| 8271 Insert(class_id, target); | 8272 Insert(class_id, target); |
| 8272 } | 8273 } |
| 8273 } | 8274 } |
| 8274 } | 8275 } |
| 8275 } | 8276 } |
| 8276 | 8277 |
| 8277 | 8278 |
| 8278 void MegamorphicCache::Insert(const Smi& class_id, | 8279 void MegamorphicCache::Insert(const Smi& class_id, |
| 8279 const Function& target) const { | 8280 const Function& target) const { |
| 8280 ASSERT(static_cast<double>(filled_entry_count() + 1) <= | 8281 ASSERT(static_cast<double>(filled_entry_count() + 1) <= |
| 8281 (kLoadFactor * static_cast<double>(mask() + 1))); | 8282 (kLoadFactor * static_cast<double>(mask() + 1))); |
| 8282 const Array& backing_array = Array::Handle(buckets()); | 8283 const Array& backing_array = Array::Handle(buckets()); |
| 8283 intptr_t id_mask = mask(); | 8284 intptr_t id_mask = mask(); |
| 8284 intptr_t index = class_id.Value() & id_mask; | 8285 intptr_t index = class_id.Value() & id_mask; |
| 8285 Smi& probe = Smi::Handle(); | 8286 Smi& probe = Smi::Handle(); |
| 8286 intptr_t i = index; | 8287 intptr_t i = index; |
| 8287 do { | 8288 do { |
| 8288 probe ^= GetClassId(backing_array, i); | 8289 probe |= GetClassId(backing_array, i); |
| 8289 if (probe.Value() == kIllegalCid) { | 8290 if (probe.Value() == kIllegalCid) { |
| 8290 SetEntry(backing_array, i, class_id, target); | 8291 SetEntry(backing_array, i, class_id, target); |
| 8291 set_filled_entry_count(filled_entry_count() + 1); | 8292 set_filled_entry_count(filled_entry_count() + 1); |
| 8292 return; | 8293 return; |
| 8293 } | 8294 } |
| 8294 i = (i + 1) & id_mask; | 8295 i = (i + 1) & id_mask; |
| 8295 } while (i != index); | 8296 } while (i != index); |
| 8296 UNREACHABLE(); | 8297 UNREACHABLE(); |
| 8297 } | 8298 } |
| 8298 | 8299 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8353 | 8354 |
| 8354 void SubtypeTestCache::GetCheck( | 8355 void SubtypeTestCache::GetCheck( |
| 8355 intptr_t ix, | 8356 intptr_t ix, |
| 8356 intptr_t* instance_class_id, | 8357 intptr_t* instance_class_id, |
| 8357 AbstractTypeArguments* instance_type_arguments, | 8358 AbstractTypeArguments* instance_type_arguments, |
| 8358 AbstractTypeArguments* instantiator_type_arguments, | 8359 AbstractTypeArguments* instantiator_type_arguments, |
| 8359 Bool* test_result) const { | 8360 Bool* test_result) const { |
| 8360 Array& data = Array::Handle(cache()); | 8361 Array& data = Array::Handle(cache()); |
| 8361 intptr_t data_pos = ix * kTestEntryLength; | 8362 intptr_t data_pos = ix * kTestEntryLength; |
| 8362 Smi& instance_class_id_handle = Smi::Handle(); | 8363 Smi& instance_class_id_handle = Smi::Handle(); |
| 8363 instance_class_id_handle ^= data.At(data_pos + kInstanceClassId); | 8364 instance_class_id_handle |= data.At(data_pos + kInstanceClassId); |
| 8364 *instance_class_id = instance_class_id_handle.Value(); | 8365 *instance_class_id = instance_class_id_handle.Value(); |
| 8365 *instance_type_arguments ^= data.At(data_pos + kInstanceTypeArguments); | 8366 *instance_type_arguments ^= data.At(data_pos + kInstanceTypeArguments); |
| 8366 *instantiator_type_arguments ^= | 8367 *instantiator_type_arguments ^= |
| 8367 data.At(data_pos + kInstantiatorTypeArguments); | 8368 data.At(data_pos + kInstantiatorTypeArguments); |
| 8368 *test_result ^= data.At(data_pos + kTestResult); | 8369 *test_result |= data.At(data_pos + kTestResult); |
| 8369 } | 8370 } |
| 8370 | 8371 |
| 8371 | 8372 |
| 8372 const char* SubtypeTestCache::ToCString() const { | 8373 const char* SubtypeTestCache::ToCString() const { |
| 8373 return "SubtypeTestCache"; | 8374 return "SubtypeTestCache"; |
| 8374 } | 8375 } |
| 8375 | 8376 |
| 8376 | 8377 |
| 8377 const char* Error::ToErrorCString() const { | 8378 const char* Error::ToErrorCString() const { |
| 8378 UNREACHABLE(); | 8379 UNREACHABLE(); |
| (...skipping 1295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9674 int Integer::CompareWith(const Integer& other) const { | 9675 int Integer::CompareWith(const Integer& other) const { |
| 9675 UNIMPLEMENTED(); | 9676 UNIMPLEMENTED(); |
| 9676 return 0; | 9677 return 0; |
| 9677 } | 9678 } |
| 9678 | 9679 |
| 9679 | 9680 |
| 9680 RawInteger* Integer::AsValidInteger() const { | 9681 RawInteger* Integer::AsValidInteger() const { |
| 9681 if (IsSmi()) return raw(); | 9682 if (IsSmi()) return raw(); |
| 9682 if (IsMint()) { | 9683 if (IsMint()) { |
| 9683 Mint& mint = Mint::Handle(); | 9684 Mint& mint = Mint::Handle(); |
| 9684 mint ^= raw(); | 9685 mint |= raw(); |
| 9685 if (Smi::IsValid64(mint.value())) { | 9686 if (Smi::IsValid64(mint.value())) { |
| 9686 return Smi::New(mint.value()); | 9687 return Smi::New(mint.value()); |
| 9687 } else { | 9688 } else { |
| 9688 return raw(); | 9689 return raw(); |
| 9689 } | 9690 } |
| 9690 } | 9691 } |
| 9691 ASSERT(IsBigint()); | 9692 ASSERT(IsBigint()); |
| 9692 Bigint& big_value = Bigint::Handle(); | 9693 Bigint& big_value = Bigint::Handle(); |
| 9693 big_value ^= raw(); | 9694 big_value |= raw(); |
| 9694 if (BigintOperations::FitsIntoSmi(big_value)) { | 9695 if (BigintOperations::FitsIntoSmi(big_value)) { |
| 9695 return BigintOperations::ToSmi(big_value); | 9696 return BigintOperations::ToSmi(big_value); |
| 9696 } else if (BigintOperations::FitsIntoMint(big_value)) { | 9697 } else if (BigintOperations::FitsIntoMint(big_value)) { |
| 9697 return Mint::New(BigintOperations::ToMint(big_value)); | 9698 return Mint::New(BigintOperations::ToMint(big_value)); |
| 9698 } else { | 9699 } else { |
| 9699 return big_value.raw(); | 9700 return big_value.raw(); |
| 9700 } | 9701 } |
| 9701 } | 9702 } |
| 9702 | 9703 |
| 9703 | 9704 |
| 9704 RawInteger* Integer::ArithmeticOp(Token::Kind operation, | 9705 RawInteger* Integer::ArithmeticOp(Token::Kind operation, |
| 9705 const Integer& other) const { | 9706 const Integer& other) const { |
| 9706 // In 32-bit mode, the result of any operation between two Smis will fit in a | 9707 // In 32-bit mode, the result of any operation between two Smis will fit in a |
| 9707 // 32-bit signed result, except the product of two Smis, which will be 64-bit. | 9708 // 32-bit signed result, except the product of two Smis, which will be 64-bit. |
| 9708 // In 64-bit mode, the result of any operation between two Smis will fit in a | 9709 // In 64-bit mode, the result of any operation between two Smis will fit in a |
| 9709 // 64-bit signed result, except the product of two Smis (unless the Smis are | 9710 // 64-bit signed result, except the product of two Smis (unless the Smis are |
| 9710 // 32-bit or less). | 9711 // 32-bit or less). |
| 9711 if (IsSmi() && other.IsSmi()) { | 9712 if (IsSmi() && other.IsSmi()) { |
| 9712 Smi& left_smi = Smi::Handle(); | 9713 Smi& left_smi = Smi::Handle(); |
| 9713 Smi& right_smi = Smi::Handle(); | 9714 Smi& right_smi = Smi::Handle(); |
| 9714 left_smi ^= raw(); | 9715 left_smi |= raw(); |
| 9715 right_smi ^= other.raw(); | 9716 right_smi |= other.raw(); |
| 9716 const intptr_t left_value = left_smi.Value(); | 9717 const intptr_t left_value = left_smi.Value(); |
| 9717 const intptr_t right_value = right_smi.Value(); | 9718 const intptr_t right_value = right_smi.Value(); |
| 9718 switch (operation) { | 9719 switch (operation) { |
| 9719 case Token::kADD: | 9720 case Token::kADD: |
| 9720 return Integer::New(left_value + right_value); | 9721 return Integer::New(left_value + right_value); |
| 9721 case Token::kSUB: | 9722 case Token::kSUB: |
| 9722 return Integer::New(left_value - right_value); | 9723 return Integer::New(left_value - right_value); |
| 9723 case Token::kMUL: { | 9724 case Token::kMUL: { |
| 9724 if (Smi::kBits < 32) { | 9725 if (Smi::kBits < 32) { |
| 9725 // In 32-bit mode, the product of two Smis fits in a 64-bit result. | 9726 // In 32-bit mode, the product of two Smis fits in a 64-bit result. |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9802 | 9803 |
| 9803 static bool Are64bitOperands(const Integer& op1, const Integer& op2) { | 9804 static bool Are64bitOperands(const Integer& op1, const Integer& op2) { |
| 9804 return !op1.IsBigint() && !op2.IsBigint(); | 9805 return !op1.IsBigint() && !op2.IsBigint(); |
| 9805 } | 9806 } |
| 9806 | 9807 |
| 9807 | 9808 |
| 9808 RawInteger* Integer::BitOp(Token::Kind kind, const Integer& other) const { | 9809 RawInteger* Integer::BitOp(Token::Kind kind, const Integer& other) const { |
| 9809 if (IsSmi() && other.IsSmi()) { | 9810 if (IsSmi() && other.IsSmi()) { |
| 9810 Smi& op1 = Smi::Handle(); | 9811 Smi& op1 = Smi::Handle(); |
| 9811 Smi& op2 = Smi::Handle(); | 9812 Smi& op2 = Smi::Handle(); |
| 9812 op1 ^= raw(); | 9813 op1 |= raw(); |
| 9813 op2 ^= other.raw(); | 9814 op2 |= other.raw(); |
| 9814 intptr_t result = 0; | 9815 intptr_t result = 0; |
| 9815 switch (kind) { | 9816 switch (kind) { |
| 9816 case Token::kBIT_AND: | 9817 case Token::kBIT_AND: |
| 9817 result = op1.Value() & op2.Value(); | 9818 result = op1.Value() & op2.Value(); |
| 9818 break; | 9819 break; |
| 9819 case Token::kBIT_OR: | 9820 case Token::kBIT_OR: |
| 9820 result = op1.Value() | op2.Value(); | 9821 result = op1.Value() | op2.Value(); |
| 9821 break; | 9822 break; |
| 9822 case Token::kBIT_XOR: | 9823 case Token::kBIT_XOR: |
| 9823 result = op1.Value() ^ op2.Value(); | 9824 result = op1.Value() ^ op2.Value(); |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9997 ASSERT(!Smi::IsValid64(value)); | 9998 ASSERT(!Smi::IsValid64(value)); |
| 9998 const Class& cls = | 9999 const Class& cls = |
| 9999 Class::Handle(Isolate::Current()->object_store()->mint_class()); | 10000 Class::Handle(Isolate::Current()->object_store()->mint_class()); |
| 10000 const Array& constants = Array::Handle(cls.constants()); | 10001 const Array& constants = Array::Handle(cls.constants()); |
| 10001 const intptr_t constants_len = constants.Length(); | 10002 const intptr_t constants_len = constants.Length(); |
| 10002 // Linear search to see whether this value is already present in the | 10003 // Linear search to see whether this value is already present in the |
| 10003 // list of canonicalized constants. | 10004 // list of canonicalized constants. |
| 10004 Mint& canonical_value = Mint::Handle(); | 10005 Mint& canonical_value = Mint::Handle(); |
| 10005 intptr_t index = 0; | 10006 intptr_t index = 0; |
| 10006 while (index < constants_len) { | 10007 while (index < constants_len) { |
| 10007 canonical_value ^= constants.At(index); | 10008 canonical_value |= constants.At(index); |
| 10008 if (canonical_value.IsNull()) { | 10009 if (canonical_value.IsNull()) { |
| 10009 break; | 10010 break; |
| 10010 } | 10011 } |
| 10011 if (canonical_value.value() == value) { | 10012 if (canonical_value.value() == value) { |
| 10012 return canonical_value.raw(); | 10013 return canonical_value.raw(); |
| 10013 } | 10014 } |
| 10014 index++; | 10015 index++; |
| 10015 } | 10016 } |
| 10016 // The value needs to be added to the constants list. Grow the list if | 10017 // The value needs to be added to the constants list. Grow the list if |
| 10017 // it is full. | 10018 // it is full. |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10151 RawDouble* Double::NewCanonical(double value) { | 10152 RawDouble* Double::NewCanonical(double value) { |
| 10152 const Class& cls = | 10153 const Class& cls = |
| 10153 Class::Handle(Isolate::Current()->object_store()->double_class()); | 10154 Class::Handle(Isolate::Current()->object_store()->double_class()); |
| 10154 const Array& constants = Array::Handle(cls.constants()); | 10155 const Array& constants = Array::Handle(cls.constants()); |
| 10155 const intptr_t constants_len = constants.Length(); | 10156 const intptr_t constants_len = constants.Length(); |
| 10156 // Linear search to see whether this value is already present in the | 10157 // Linear search to see whether this value is already present in the |
| 10157 // list of canonicalized constants. | 10158 // list of canonicalized constants. |
| 10158 Double& canonical_value = Double::Handle(); | 10159 Double& canonical_value = Double::Handle(); |
| 10159 intptr_t index = 0; | 10160 intptr_t index = 0; |
| 10160 while (index < constants_len) { | 10161 while (index < constants_len) { |
| 10161 canonical_value ^= constants.At(index); | 10162 canonical_value |= constants.At(index); |
| 10162 if (canonical_value.IsNull()) { | 10163 if (canonical_value.IsNull()) { |
| 10163 break; | 10164 break; |
| 10164 } | 10165 } |
| 10165 if (canonical_value.EqualsToDouble(value)) { | 10166 if (canonical_value.EqualsToDouble(value)) { |
| 10166 return canonical_value.raw(); | 10167 return canonical_value.raw(); |
| 10167 } | 10168 } |
| 10168 index++; | 10169 index++; |
| 10169 } | 10170 } |
| 10170 // The value needs to be added to the constants list. Grow the list if | 10171 // The value needs to be added to the constants list. Grow the list if |
| 10171 // it is full. | 10172 // it is full. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 10197 buffer[kBufferSize - 1] = '\0'; | 10198 buffer[kBufferSize - 1] = '\0'; |
| 10198 DoubleToCString(value(), buffer, kBufferSize); | 10199 DoubleToCString(value(), buffer, kBufferSize); |
| 10199 return buffer; | 10200 return buffer; |
| 10200 } | 10201 } |
| 10201 | 10202 |
| 10202 | 10203 |
| 10203 RawBigint* Integer::AsBigint() const { | 10204 RawBigint* Integer::AsBigint() const { |
| 10204 ASSERT(!IsNull()); | 10205 ASSERT(!IsNull()); |
| 10205 if (IsSmi()) { | 10206 if (IsSmi()) { |
| 10206 Smi& smi = Smi::Handle(); | 10207 Smi& smi = Smi::Handle(); |
| 10207 smi ^= raw(); | 10208 smi |= raw(); |
| 10208 return BigintOperations::NewFromSmi(smi); | 10209 return BigintOperations::NewFromSmi(smi); |
| 10209 } else if (IsMint()) { | 10210 } else if (IsMint()) { |
| 10210 Mint& mint = Mint::Handle(); | 10211 Mint& mint = Mint::Handle(); |
| 10211 mint ^= raw(); | 10212 mint |= raw(); |
| 10212 return BigintOperations::NewFromInt64(mint.value()); | 10213 return BigintOperations::NewFromInt64(mint.value()); |
| 10213 } else { | 10214 } else { |
| 10214 ASSERT(IsBigint()); | 10215 ASSERT(IsBigint()); |
| 10215 Bigint& big = Bigint::Handle(); | 10216 Bigint& big = Bigint::Handle(); |
| 10216 big ^= raw(); | 10217 big |= raw(); |
| 10217 ASSERT(!BigintOperations::FitsIntoSmi(big)); | 10218 ASSERT(!BigintOperations::FitsIntoSmi(big)); |
| 10218 return big.raw(); | 10219 return big.raw(); |
| 10219 } | 10220 } |
| 10220 } | 10221 } |
| 10221 | 10222 |
| 10222 | 10223 |
| 10223 RawBigint* Bigint::ArithmeticOp(Token::Kind operation, | 10224 RawBigint* Bigint::ArithmeticOp(Token::Kind operation, |
| 10224 const Bigint& other) const { | 10225 const Bigint& other) const { |
| 10225 switch (operation) { | 10226 switch (operation) { |
| 10226 case Token::kADD: | 10227 case Token::kADD: |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10284 ASSERT(!BigintOperations::FitsIntoMint(value)); | 10285 ASSERT(!BigintOperations::FitsIntoMint(value)); |
| 10285 const Class& cls = | 10286 const Class& cls = |
| 10286 Class::Handle(Isolate::Current()->object_store()->bigint_class()); | 10287 Class::Handle(Isolate::Current()->object_store()->bigint_class()); |
| 10287 const Array& constants = Array::Handle(cls.constants()); | 10288 const Array& constants = Array::Handle(cls.constants()); |
| 10288 const intptr_t constants_len = constants.Length(); | 10289 const intptr_t constants_len = constants.Length(); |
| 10289 // Linear search to see whether this value is already present in the | 10290 // Linear search to see whether this value is already present in the |
| 10290 // list of canonicalized constants. | 10291 // list of canonicalized constants. |
| 10291 Bigint& canonical_value = Bigint::Handle(); | 10292 Bigint& canonical_value = Bigint::Handle(); |
| 10292 intptr_t index = 0; | 10293 intptr_t index = 0; |
| 10293 while (index < constants_len) { | 10294 while (index < constants_len) { |
| 10294 canonical_value ^= constants.At(index); | 10295 canonical_value |= constants.At(index); |
| 10295 if (canonical_value.IsNull()) { | 10296 if (canonical_value.IsNull()) { |
| 10296 break; | 10297 break; |
| 10297 } | 10298 } |
| 10298 if (canonical_value.Equals(value)) { | 10299 if (canonical_value.Equals(value)) { |
| 10299 return canonical_value.raw(); | 10300 return canonical_value.raw(); |
| 10300 } | 10301 } |
| 10301 index++; | 10302 index++; |
| 10302 } | 10303 } |
| 10303 // The value needs to be added to the constants list. Grow the list if | 10304 // The value needs to be added to the constants list. Grow the list if |
| 10304 // it is full. | 10305 // it is full. |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10680 | 10681 |
| 10681 RawString* String::New(const String& str, Heap::Space space) { | 10682 RawString* String::New(const String& str, Heap::Space space) { |
| 10682 // Currently this just creates a copy of the string in the correct space. | 10683 // Currently this just creates a copy of the string in the correct space. |
| 10683 // Once we have external string support, this will also create a heap copy of | 10684 // Once we have external string support, this will also create a heap copy of |
| 10684 // the string if necessary. Some optimizations are possible, such as not | 10685 // the string if necessary. Some optimizations are possible, such as not |
| 10685 // copying internal strings into the same space. | 10686 // copying internal strings into the same space. |
| 10686 intptr_t len = str.Length(); | 10687 intptr_t len = str.Length(); |
| 10687 String& result = String::Handle(); | 10688 String& result = String::Handle(); |
| 10688 intptr_t char_size = str.CharSize(); | 10689 intptr_t char_size = str.CharSize(); |
| 10689 if (char_size == kOneByteChar) { | 10690 if (char_size == kOneByteChar) { |
| 10690 result ^= OneByteString::New(len, space); | 10691 result |= OneByteString::New(len, space); |
| 10691 } else { | 10692 } else { |
| 10692 ASSERT(char_size == kTwoByteChar); | 10693 ASSERT(char_size == kTwoByteChar); |
| 10693 result ^= TwoByteString::New(len, space); | 10694 result |= TwoByteString::New(len, space); |
| 10694 } | 10695 } |
| 10695 String::Copy(result, 0, str, 0, len); | 10696 String::Copy(result, 0, str, 0, len); |
| 10696 return result.raw(); | 10697 return result.raw(); |
| 10697 } | 10698 } |
| 10698 | 10699 |
| 10699 | 10700 |
| 10700 RawString* String::NewExternal(const uint8_t* characters, | 10701 RawString* String::NewExternal(const uint8_t* characters, |
| 10701 intptr_t len, | 10702 intptr_t len, |
| 10702 void* peer, | 10703 void* peer, |
| 10703 Dart_PeerFinalizer callback, | 10704 Dart_PeerFinalizer callback, |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10852 | 10853 |
| 10853 | 10854 |
| 10854 RawString* String::ConcatAll(const Array& strings, | 10855 RawString* String::ConcatAll(const Array& strings, |
| 10855 Heap::Space space) { | 10856 Heap::Space space) { |
| 10856 ASSERT(!strings.IsNull()); | 10857 ASSERT(!strings.IsNull()); |
| 10857 intptr_t result_len = 0; | 10858 intptr_t result_len = 0; |
| 10858 intptr_t strings_len = strings.Length(); | 10859 intptr_t strings_len = strings.Length(); |
| 10859 String& str = String::Handle(); | 10860 String& str = String::Handle(); |
| 10860 intptr_t char_size = kOneByteChar; | 10861 intptr_t char_size = kOneByteChar; |
| 10861 for (intptr_t i = 0; i < strings_len; i++) { | 10862 for (intptr_t i = 0; i < strings_len; i++) { |
| 10862 str ^= strings.At(i); | 10863 str |= strings.At(i); |
| 10863 result_len += str.Length(); | 10864 result_len += str.Length(); |
| 10864 char_size = Utils::Maximum(char_size, str.CharSize()); | 10865 char_size = Utils::Maximum(char_size, str.CharSize()); |
| 10865 } | 10866 } |
| 10866 if (char_size == kOneByteChar) { | 10867 if (char_size == kOneByteChar) { |
| 10867 return OneByteString::ConcatAll(strings, result_len, space); | 10868 return OneByteString::ConcatAll(strings, result_len, space); |
| 10868 } | 10869 } |
| 10869 ASSERT(char_size == kTwoByteChar); | 10870 ASSERT(char_size == kTwoByteChar); |
| 10870 return TwoByteString::ConcatAll(strings, result_len, space); | 10871 return TwoByteString::ConcatAll(strings, result_len, space); |
| 10871 } | 10872 } |
| 10872 | 10873 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 10900 intptr_t char_size = str.CharSize(); | 10901 intptr_t char_size = str.CharSize(); |
| 10901 if (char_size == kTwoByteChar) { | 10902 if (char_size == kTwoByteChar) { |
| 10902 for (intptr_t i = begin_index; i < begin_index + length; ++i) { | 10903 for (intptr_t i = begin_index; i < begin_index + length; ++i) { |
| 10903 if (!Utf::IsLatin1(str.CharAt(i))) { | 10904 if (!Utf::IsLatin1(str.CharAt(i))) { |
| 10904 is_one_byte_string = false; | 10905 is_one_byte_string = false; |
| 10905 break; | 10906 break; |
| 10906 } | 10907 } |
| 10907 } | 10908 } |
| 10908 } | 10909 } |
| 10909 if (is_one_byte_string) { | 10910 if (is_one_byte_string) { |
| 10910 result ^= OneByteString::New(length, space); | 10911 result |= OneByteString::New(length, space); |
| 10911 } else { | 10912 } else { |
| 10912 result ^= TwoByteString::New(length, space); | 10913 result |= TwoByteString::New(length, space); |
| 10913 } | 10914 } |
| 10914 String::Copy(result, 0, str, begin_index, length); | 10915 String::Copy(result, 0, str, begin_index, length); |
| 10915 return result.raw(); | 10916 return result.raw(); |
| 10916 } | 10917 } |
| 10917 | 10918 |
| 10918 | 10919 |
| 10919 const char* String::ToCString() const { | 10920 const char* String::ToCString() const { |
| 10920 intptr_t len = Utf8::Length(*this); | 10921 intptr_t len = Utf8::Length(*this); |
| 10921 Zone* zone = Isolate::Current()->current_zone(); | 10922 Zone* zone = Isolate::Current()->current_zone(); |
| 10922 uint8_t* result = zone->Alloc<uint8_t>(len + 1); | 10923 uint8_t* result = zone->Alloc<uint8_t>(len + 1); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11264 | 11265 |
| 11265 | 11266 |
| 11266 RawOneByteString* OneByteString::ConcatAll(const Array& strings, | 11267 RawOneByteString* OneByteString::ConcatAll(const Array& strings, |
| 11267 intptr_t len, | 11268 intptr_t len, |
| 11268 Heap::Space space) { | 11269 Heap::Space space) { |
| 11269 const String& result = String::Handle(OneByteString::New(len, space)); | 11270 const String& result = String::Handle(OneByteString::New(len, space)); |
| 11270 String& str = String::Handle(); | 11271 String& str = String::Handle(); |
| 11271 intptr_t strings_len = strings.Length(); | 11272 intptr_t strings_len = strings.Length(); |
| 11272 intptr_t pos = 0; | 11273 intptr_t pos = 0; |
| 11273 for (intptr_t i = 0; i < strings_len; i++) { | 11274 for (intptr_t i = 0; i < strings_len; i++) { |
| 11274 str ^= strings.At(i); | 11275 str |= strings.At(i); |
| 11275 intptr_t str_len = str.Length(); | 11276 intptr_t str_len = str.Length(); |
| 11276 String::Copy(result, pos, str, 0, str_len); | 11277 String::Copy(result, pos, str, 0, str_len); |
| 11277 pos += str_len; | 11278 pos += str_len; |
| 11278 } | 11279 } |
| 11279 return OneByteString::raw(result); | 11280 return OneByteString::raw(result); |
| 11280 } | 11281 } |
| 11281 | 11282 |
| 11282 | 11283 |
| 11283 RawOneByteString* OneByteString::Transform(int32_t (*mapping)(int32_t ch), | 11284 RawOneByteString* OneByteString::Transform(int32_t (*mapping)(int32_t ch), |
| 11284 const String& str, | 11285 const String& str, |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11433 | 11434 |
| 11434 | 11435 |
| 11435 RawTwoByteString* TwoByteString::ConcatAll(const Array& strings, | 11436 RawTwoByteString* TwoByteString::ConcatAll(const Array& strings, |
| 11436 intptr_t len, | 11437 intptr_t len, |
| 11437 Heap::Space space) { | 11438 Heap::Space space) { |
| 11438 const String& result = String::Handle(TwoByteString::New(len, space)); | 11439 const String& result = String::Handle(TwoByteString::New(len, space)); |
| 11439 String& str = String::Handle(); | 11440 String& str = String::Handle(); |
| 11440 intptr_t strings_len = strings.Length(); | 11441 intptr_t strings_len = strings.Length(); |
| 11441 intptr_t pos = 0; | 11442 intptr_t pos = 0; |
| 11442 for (intptr_t i = 0; i < strings_len; i++) { | 11443 for (intptr_t i = 0; i < strings_len; i++) { |
| 11443 str ^= strings.At(i); | 11444 str |= strings.At(i); |
| 11444 intptr_t str_len = str.Length(); | 11445 intptr_t str_len = str.Length(); |
| 11445 String::Copy(result, pos, str, 0, str_len); | 11446 String::Copy(result, pos, str, 0, str_len); |
| 11446 pos += str_len; | 11447 pos += str_len; |
| 11447 } | 11448 } |
| 11448 return TwoByteString::raw(result); | 11449 return TwoByteString::raw(result); |
| 11449 } | 11450 } |
| 11450 | 11451 |
| 11451 | 11452 |
| 11452 RawTwoByteString* TwoByteString::Transform(int32_t (*mapping)(int32_t ch), | 11453 RawTwoByteString* TwoByteString::Transform(int32_t (*mapping)(int32_t ch), |
| 11453 const String& str, | 11454 const String& str, |
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12617 | 12618 |
| 12618 void* JSRegExp::GetDataStartAddress() const { | 12619 void* JSRegExp::GetDataStartAddress() const { |
| 12619 intptr_t addr = reinterpret_cast<intptr_t>(raw_ptr()); | 12620 intptr_t addr = reinterpret_cast<intptr_t>(raw_ptr()); |
| 12620 return reinterpret_cast<void*>(addr + sizeof(RawJSRegExp)); | 12621 return reinterpret_cast<void*>(addr + sizeof(RawJSRegExp)); |
| 12621 } | 12622 } |
| 12622 | 12623 |
| 12623 | 12624 |
| 12624 RawJSRegExp* JSRegExp::FromDataStartAddress(void* data) { | 12625 RawJSRegExp* JSRegExp::FromDataStartAddress(void* data) { |
| 12625 JSRegExp& regexp = JSRegExp::Handle(); | 12626 JSRegExp& regexp = JSRegExp::Handle(); |
| 12626 intptr_t addr = reinterpret_cast<intptr_t>(data) - sizeof(RawJSRegExp); | 12627 intptr_t addr = reinterpret_cast<intptr_t>(data) - sizeof(RawJSRegExp); |
| 12627 regexp ^= RawObject::FromAddr(addr); | 12628 regexp |= RawObject::FromAddr(addr); |
| 12628 return regexp.raw(); | 12629 return regexp.raw(); |
| 12629 } | 12630 } |
| 12630 | 12631 |
| 12631 | 12632 |
| 12632 const char* JSRegExp::Flags() const { | 12633 const char* JSRegExp::Flags() const { |
| 12633 switch (raw_ptr()->flags_) { | 12634 switch (raw_ptr()->flags_) { |
| 12634 case kGlobal | kIgnoreCase | kMultiLine : | 12635 case kGlobal | kIgnoreCase | kMultiLine : |
| 12635 case kIgnoreCase | kMultiLine : | 12636 case kIgnoreCase | kMultiLine : |
| 12636 return "im"; | 12637 return "im"; |
| 12637 case kGlobal | kIgnoreCase : | 12638 case kGlobal | kIgnoreCase : |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12694 } | 12695 } |
| 12695 return result.raw(); | 12696 return result.raw(); |
| 12696 } | 12697 } |
| 12697 | 12698 |
| 12698 | 12699 |
| 12699 const char* WeakProperty::ToCString() const { | 12700 const char* WeakProperty::ToCString() const { |
| 12700 return "_WeakProperty"; | 12701 return "_WeakProperty"; |
| 12701 } | 12702 } |
| 12702 | 12703 |
| 12703 } // namespace dart | 12704 } // namespace dart |
| OLD | NEW |