Chromium Code Reviews| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 67 RawClass* Object::null_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 67 RawClass* Object::null_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 68 RawClass* Object::dynamic_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 68 RawClass* Object::dynamic_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 69 RawClass* Object::void_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 69 RawClass* Object::void_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 70 RawClass* Object::unresolved_class_class_ = | 70 RawClass* Object::unresolved_class_class_ = |
| 71 reinterpret_cast<RawClass*>(RAW_NULL); | 71 reinterpret_cast<RawClass*>(RAW_NULL); |
| 72 RawClass* Object::type_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 72 RawClass* Object::type_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 73 RawClass* Object::type_parameter_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 73 RawClass* Object::type_parameter_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 74 RawClass* Object::type_arguments_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 74 RawClass* Object::type_arguments_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 75 RawClass* Object::instantiated_type_arguments_class_ = | 75 RawClass* Object::instantiated_type_arguments_class_ = |
| 76 reinterpret_cast<RawClass*>(RAW_NULL); | 76 reinterpret_cast<RawClass*>(RAW_NULL); |
| 77 RawClass* Object::patch_class_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | |
| 77 RawClass* Object::function_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 78 RawClass* Object::function_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 78 RawClass* Object::field_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 79 RawClass* Object::field_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 79 RawClass* Object::literal_token_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 80 RawClass* Object::literal_token_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 80 RawClass* Object::token_stream_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 81 RawClass* Object::token_stream_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 81 RawClass* Object::script_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 82 RawClass* Object::script_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 82 RawClass* Object::library_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 83 RawClass* Object::library_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 83 RawClass* Object::library_prefix_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 84 RawClass* Object::library_prefix_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 84 RawClass* Object::code_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 85 RawClass* Object::code_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 85 RawClass* Object::instructions_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 86 RawClass* Object::instructions_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| 86 RawClass* Object::pc_descriptors_class_ = reinterpret_cast<RawClass*>(RAW_NULL); | 87 RawClass* Object::pc_descriptors_class_ = reinterpret_cast<RawClass*>(RAW_NULL); |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 | 282 |
| 282 cls = Class::New<TypeParameter>(); | 283 cls = Class::New<TypeParameter>(); |
| 283 type_parameter_class_ = cls.raw(); | 284 type_parameter_class_ = cls.raw(); |
| 284 | 285 |
| 285 cls = Class::New<TypeArguments>(); | 286 cls = Class::New<TypeArguments>(); |
| 286 type_arguments_class_ = cls.raw(); | 287 type_arguments_class_ = cls.raw(); |
| 287 | 288 |
| 288 cls = Class::New<InstantiatedTypeArguments>(); | 289 cls = Class::New<InstantiatedTypeArguments>(); |
| 289 instantiated_type_arguments_class_ = cls.raw(); | 290 instantiated_type_arguments_class_ = cls.raw(); |
| 290 | 291 |
| 292 cls = Class::New<PatchClass>(); | |
| 293 patch_class_class_ = cls.raw(); | |
| 294 | |
| 291 cls = Class::New<Function>(); | 295 cls = Class::New<Function>(); |
| 292 function_class_ = cls.raw(); | 296 function_class_ = cls.raw(); |
| 293 | 297 |
| 294 cls = Class::New<Field>(); | 298 cls = Class::New<Field>(); |
| 295 field_class_ = cls.raw(); | 299 field_class_ = cls.raw(); |
| 296 | 300 |
| 297 cls = Class::New<LiteralToken>(); | 301 cls = Class::New<LiteralToken>(); |
| 298 literal_token_class_ = cls.raw(); | 302 literal_token_class_ = cls.raw(); |
| 299 | 303 |
| 300 cls = Class::New<TokenStream>(); | 304 cls = Class::New<TokenStream>(); |
| (...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1223 } | 1227 } |
| 1224 | 1228 |
| 1225 void Class::SetFunctions(const Array& value) const { | 1229 void Class::SetFunctions(const Array& value) const { |
| 1226 ASSERT(!value.IsNull()); | 1230 ASSERT(!value.IsNull()); |
| 1227 #if defined(DEBUG) | 1231 #if defined(DEBUG) |
| 1228 // Verify that all the functions in the array have this class as owner. | 1232 // Verify that all the functions in the array have this class as owner. |
| 1229 Function& func = Function::Handle(); | 1233 Function& func = Function::Handle(); |
| 1230 intptr_t len = value.Length(); | 1234 intptr_t len = value.Length(); |
| 1231 for (intptr_t i = 0; i < len; i++) { | 1235 for (intptr_t i = 0; i < len; i++) { |
| 1232 func ^= value.At(i); | 1236 func ^= value.At(i); |
| 1233 ASSERT(func.owner() == raw()); | 1237 ASSERT(func.Owner() == raw()); |
| 1234 } | 1238 } |
| 1235 #endif | 1239 #endif |
| 1236 StorePointer(&raw_ptr()->functions_, value.raw()); | 1240 StorePointer(&raw_ptr()->functions_, value.raw()); |
| 1237 } | 1241 } |
| 1238 | 1242 |
| 1239 | 1243 |
| 1240 void Class::AddClosureFunction(const Function& function) const { | 1244 void Class::AddClosureFunction(const Function& function) const { |
| 1241 GrowableObjectArray& closures = | 1245 GrowableObjectArray& closures = |
| 1242 GrowableObjectArray::Handle(raw_ptr()->closure_functions_); | 1246 GrowableObjectArray::Handle(raw_ptr()->closure_functions_); |
| 1243 if (closures.IsNull()) { | 1247 if (closures.IsNull()) { |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1313 | 1317 |
| 1314 | 1318 |
| 1315 intptr_t Class::NumTypeArguments() const { | 1319 intptr_t Class::NumTypeArguments() const { |
| 1316 // To work properly, this call requires the super class of this class to be | 1320 // To work properly, this call requires the super class of this class to be |
| 1317 // resolved, which is checked by the SuperClass() call. | 1321 // resolved, which is checked by the SuperClass() call. |
| 1318 Class& cls = Class::Handle(raw()); | 1322 Class& cls = Class::Handle(raw()); |
| 1319 if (IsSignatureClass()) { | 1323 if (IsSignatureClass()) { |
| 1320 const Function& signature_fun = Function::Handle(signature_function()); | 1324 const Function& signature_fun = Function::Handle(signature_function()); |
| 1321 if (!signature_fun.is_static() && | 1325 if (!signature_fun.is_static() && |
| 1322 !signature_fun.HasInstantiatedSignature()) { | 1326 !signature_fun.HasInstantiatedSignature()) { |
| 1323 cls = signature_fun.owner(); | 1327 cls = signature_fun.Owner(); |
| 1324 } | 1328 } |
| 1325 } | 1329 } |
| 1326 intptr_t num_type_args = NumTypeParameters(); | 1330 intptr_t num_type_args = NumTypeParameters(); |
| 1327 const Class& superclass = Class::Handle(cls.SuperClass()); | 1331 const Class& superclass = Class::Handle(cls.SuperClass()); |
| 1328 // Object is its own super class during bootstrap. | 1332 // Object is its own super class during bootstrap. |
| 1329 if (!superclass.IsNull() && (superclass.raw() != raw())) { | 1333 if (!superclass.IsNull() && (superclass.raw() != raw())) { |
| 1330 num_type_args += superclass.NumTypeArguments(); | 1334 num_type_args += superclass.NumTypeArguments(); |
| 1331 } | 1335 } |
| 1332 return num_type_args; | 1336 return num_type_args; |
| 1333 } | 1337 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1473 // Prefinalized classes have a VM internal representation and no Dart fields. | 1477 // Prefinalized classes have a VM internal representation and no Dart fields. |
| 1474 // Their instance size is precomputed and field offsets are known. | 1478 // Their instance size is precomputed and field offsets are known. |
| 1475 if (!is_prefinalized()) { | 1479 if (!is_prefinalized()) { |
| 1476 // Compute offsets of instance fields and instance size. | 1480 // Compute offsets of instance fields and instance size. |
| 1477 CalculateFieldOffsets(); | 1481 CalculateFieldOffsets(); |
| 1478 } | 1482 } |
| 1479 set_is_finalized(); | 1483 set_is_finalized(); |
| 1480 } | 1484 } |
| 1481 | 1485 |
| 1482 | 1486 |
| 1487 void Class::ApplyPatch(const Class& with) const { | |
| 1488 ASSERT(!is_finalized()); | |
| 1489 const Script& patch_script = Script::Handle(with.script()); | |
| 1490 const String& str = String::Handle(patch_script.Source()); | |
| 1491 OS::PrintErr("patch_script: %s\n", str.ToCString()); | |
|
Ivan Posva
2012/08/14 01:21:49
Debug print removed...
| |
| 1492 const PatchClass& patch = PatchClass::Handle( | |
| 1493 PatchClass::New(*this, patch_script)); | |
| 1494 | |
| 1495 const Array& orig_functions = Array::Handle(functions()); | |
| 1496 intptr_t orig_len = orig_functions.Length(); | |
| 1497 | |
| 1498 const Array& patch_functions = Array::Handle(with.functions()); | |
| 1499 intptr_t patch_len = patch_functions.Length(); | |
| 1500 | |
| 1501 // TODO(iposva): Verify that only patching existing methods and adding only | |
| 1502 // new private methods. | |
| 1503 Function& func = Function::Handle(); | |
| 1504 const Array& new_functions = Array::Handle(Array::New(patch_len + orig_len)); | |
|
siva
2012/08/15 00:16:04
I think you should add a comment here that current
Ivan Posva
2012/08/15 06:50:39
I attempted to address the second part of your sug
| |
| 1505 for (intptr_t i = 0; i < patch_len; i++) { | |
| 1506 func ^= patch_functions.At(i); | |
| 1507 func.set_owner(patch); | |
| 1508 new_functions.SetAt(i, func); | |
| 1509 } | |
| 1510 for (intptr_t i = 0; i < orig_len; i++) { | |
| 1511 func ^= orig_functions.At(i); | |
| 1512 new_functions.SetAt(patch_len + i, func); | |
| 1513 } | |
| 1514 SetFunctions(new_functions); | |
| 1515 | |
| 1516 const Array& orig_fields = Array::Handle(fields()); | |
| 1517 orig_len = orig_fields.Length(); | |
| 1518 | |
| 1519 const Array& patch_fields = Array::Handle(with.fields()); | |
| 1520 patch_len = patch_fields.Length(); | |
|
siva
2012/08/15 00:16:04
why not call the array handle variables orig_list,
Ivan Posva
2012/08/15 06:50:39
ditto
| |
| 1521 | |
| 1522 // TODO(iposva): Verify that no duplicate fields are entered. | |
| 1523 Field& field = Field::Handle(); | |
| 1524 const Array& new_fields = Array::Handle(Array::New(patch_len + orig_len)); | |
| 1525 for (intptr_t i = 0; i < patch_len; i++) { | |
| 1526 field ^= patch_fields.At(i); | |
| 1527 field.set_owner(*this); | |
| 1528 new_fields.SetAt(i, field); | |
| 1529 } | |
| 1530 for (intptr_t i = 0; i < orig_len; i++) { | |
| 1531 field ^= orig_fields.At(i); | |
| 1532 new_fields.SetAt(patch_len + i, field); | |
| 1533 } | |
| 1534 SetFields(new_fields); | |
| 1535 } | |
| 1536 | |
| 1537 | |
| 1483 void Class::SetFields(const Array& value) const { | 1538 void Class::SetFields(const Array& value) const { |
| 1484 ASSERT(!value.IsNull()); | 1539 ASSERT(!value.IsNull()); |
| 1485 #if defined(DEBUG) | 1540 #if defined(DEBUG) |
| 1486 // Verify that all the fields in the array have this class as owner. | 1541 // Verify that all the fields in the array have this class as owner. |
| 1487 Field& field = Field::Handle(); | 1542 Field& field = Field::Handle(); |
| 1488 intptr_t len = value.Length(); | 1543 intptr_t len = value.Length(); |
| 1489 for (intptr_t i = 0; i < len; i++) { | 1544 for (intptr_t i = 0; i < len; i++) { |
| 1490 field ^= value.At(i); | 1545 field ^= value.At(i); |
| 1491 ASSERT(field.owner() == raw()); | 1546 ASSERT(field.owner() == raw()); |
| 1492 } | 1547 } |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1550 Class& result = Class::Handle(New<Instance>(name, script, token_pos)); | 1605 Class& result = Class::Handle(New<Instance>(name, script, token_pos)); |
| 1551 result.set_is_interface(); | 1606 result.set_is_interface(); |
| 1552 return result.raw(); | 1607 return result.raw(); |
| 1553 } | 1608 } |
| 1554 | 1609 |
| 1555 | 1610 |
| 1556 RawClass* Class::NewSignatureClass(const String& name, | 1611 RawClass* Class::NewSignatureClass(const String& name, |
| 1557 const Function& signature_function, | 1612 const Function& signature_function, |
| 1558 const Script& script) { | 1613 const Script& script) { |
| 1559 ASSERT(!signature_function.IsNull()); | 1614 ASSERT(!signature_function.IsNull()); |
| 1560 const Class& owner_class = Class::Handle(signature_function.owner()); | 1615 const Class& owner_class = Class::Handle(signature_function.Owner()); |
| 1561 ASSERT(!owner_class.IsNull()); | 1616 ASSERT(!owner_class.IsNull()); |
| 1562 TypeArguments& type_parameters = TypeArguments::Handle(); | 1617 TypeArguments& type_parameters = TypeArguments::Handle(); |
| 1563 // A signature class extends class Instance and is parameterized in the same | 1618 // A signature class extends class Instance and is parameterized in the same |
| 1564 // way as the owner class of its non-static signature function. | 1619 // way as the owner class of its non-static signature function. |
| 1565 // It is not type parameterized if its signature function is static. | 1620 // It is not type parameterized if its signature function is static. |
| 1566 if (!signature_function.is_static() && | 1621 if (!signature_function.is_static() && |
| 1567 (owner_class.NumTypeParameters() > 0) && | 1622 (owner_class.NumTypeParameters() > 0) && |
| 1568 !signature_function.HasInstantiatedSignature()) { | 1623 !signature_function.HasInstantiatedSignature()) { |
| 1569 type_parameters = owner_class.type_parameters(); | 1624 type_parameters = owner_class.type_parameters(); |
| 1570 } | 1625 } |
| (...skipping 1924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3495 const char* instantiator_cstr = | 3550 const char* instantiator_cstr = |
| 3496 AbstractTypeArguments::Handle(instantiator_type_arguments()).ToCString(); | 3551 AbstractTypeArguments::Handle(instantiator_type_arguments()).ToCString(); |
| 3497 intptr_t len = | 3552 intptr_t len = |
| 3498 OS::SNPrint(NULL, 0, format, arg_cstr, instantiator_cstr) + 1; | 3553 OS::SNPrint(NULL, 0, format, arg_cstr, instantiator_cstr) + 1; |
| 3499 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | 3554 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); |
| 3500 OS::SNPrint(chars, len, format, arg_cstr, instantiator_cstr); | 3555 OS::SNPrint(chars, len, format, arg_cstr, instantiator_cstr); |
| 3501 return chars; | 3556 return chars; |
| 3502 } | 3557 } |
| 3503 | 3558 |
| 3504 | 3559 |
| 3560 const char* PatchClass::ToCString() const { | |
| 3561 const char* kFormat = "PatchClass for %s"; | |
| 3562 const Class& cls = Class::Handle(patched_class()); | |
| 3563 const char* cls_name = cls.ToCString(); | |
| 3564 intptr_t len = OS::SNPrint(NULL, 0, kFormat, cls_name) + 1; | |
| 3565 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len); | |
| 3566 OS::SNPrint(chars, len, kFormat, cls_name); | |
| 3567 return chars; | |
| 3568 } | |
| 3569 | |
| 3570 | |
| 3571 RawPatchClass* PatchClass::New(const Class& patched_class, | |
| 3572 const Script& script) { | |
| 3573 const PatchClass& result = PatchClass::Handle(PatchClass::New()); | |
| 3574 result.set_patched_class(patched_class); | |
| 3575 result.set_script(script); | |
| 3576 return result.raw(); | |
| 3577 } | |
| 3578 | |
| 3579 | |
| 3580 RawPatchClass* PatchClass::New() { | |
| 3581 ASSERT(Object::patch_class_class() != Class::null()); | |
| 3582 RawObject* raw = Object::Allocate(PatchClass::kClassId, | |
| 3583 PatchClass::InstanceSize(), | |
| 3584 Heap::kOld); | |
| 3585 return reinterpret_cast<RawPatchClass*>(raw); | |
| 3586 } | |
| 3587 | |
| 3588 | |
| 3589 void PatchClass::set_patched_class(const Class& value) const { | |
| 3590 StorePointer(&raw_ptr()->patched_class_, value.raw()); | |
| 3591 } | |
| 3592 | |
| 3593 | |
| 3594 void PatchClass::set_script(const Script& value) const { | |
| 3595 StorePointer(&raw_ptr()->script_, value.raw()); | |
| 3596 } | |
| 3597 | |
| 3598 | |
| 3505 void Function::SetCode(const Code& value) const { | 3599 void Function::SetCode(const Code& value) const { |
| 3506 StorePointer(&raw_ptr()->code_, value.raw()); | 3600 StorePointer(&raw_ptr()->code_, value.raw()); |
| 3507 ASSERT(Function::Handle(value.function()).IsNull() || | 3601 ASSERT(Function::Handle(value.function()).IsNull() || |
| 3508 (value.function() == this->raw())); | 3602 (value.function() == this->raw())); |
| 3509 value.set_function(*this); | 3603 value.set_function(*this); |
| 3510 } | 3604 } |
| 3511 | 3605 |
| 3512 | 3606 |
| 3513 void Function::SwitchToUnoptimizedCode() const { | 3607 void Function::SwitchToUnoptimizedCode() const { |
| 3514 ASSERT(HasOptimizedCode()); | 3608 ASSERT(HasOptimizedCode()); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3562 return outer_function.IsFactory(); | 3656 return outer_function.IsFactory(); |
| 3563 } | 3657 } |
| 3564 | 3658 |
| 3565 | 3659 |
| 3566 void Function::set_name(const String& value) const { | 3660 void Function::set_name(const String& value) const { |
| 3567 ASSERT(value.IsSymbol()); | 3661 ASSERT(value.IsSymbol()); |
| 3568 StorePointer(&raw_ptr()->name_, value.raw()); | 3662 StorePointer(&raw_ptr()->name_, value.raw()); |
| 3569 } | 3663 } |
| 3570 | 3664 |
| 3571 | 3665 |
| 3572 void Function::set_owner(const Class& value) const { | 3666 void Function::set_owner(const Object& value) const { |
| 3573 ASSERT(!value.IsNull()); | 3667 ASSERT(!value.IsNull()); |
| 3574 StorePointer(&raw_ptr()->owner_, value.raw()); | 3668 StorePointer(&raw_ptr()->owner_, value.raw()); |
| 3575 } | 3669 } |
| 3576 | 3670 |
| 3577 | 3671 |
| 3578 void Function::set_result_type(const AbstractType& value) const { | 3672 void Function::set_result_type(const AbstractType& value) const { |
| 3579 ASSERT(!value.IsNull()); | 3673 ASSERT(!value.IsNull()); |
| 3580 StorePointer(&raw_ptr()->result_type_, value.raw()); | 3674 StorePointer(&raw_ptr()->result_type_, value.raw()); |
| 3581 } | 3675 } |
| 3582 | 3676 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3806 // Set 'chars' to allocated buffer and return number of written characters. | 3900 // Set 'chars' to allocated buffer and return number of written characters. |
| 3807 static intptr_t ConstructFunctionFullyQualifiedCString(const Function& function, | 3901 static intptr_t ConstructFunctionFullyQualifiedCString(const Function& function, |
| 3808 char** chars, | 3902 char** chars, |
| 3809 intptr_t reserve_len) { | 3903 intptr_t reserve_len) { |
| 3810 const char* name = String::Handle(function.name()).ToCString(); | 3904 const char* name = String::Handle(function.name()).ToCString(); |
| 3811 const char* function_format = (reserve_len == 0) ? "%s" : "%s_"; | 3905 const char* function_format = (reserve_len == 0) ? "%s" : "%s_"; |
| 3812 reserve_len += OS::SNPrint(NULL, 0, function_format, name); | 3906 reserve_len += OS::SNPrint(NULL, 0, function_format, name); |
| 3813 const Function& parent = Function::Handle(function.parent_function()); | 3907 const Function& parent = Function::Handle(function.parent_function()); |
| 3814 intptr_t written = 0; | 3908 intptr_t written = 0; |
| 3815 if (parent.IsNull()) { | 3909 if (parent.IsNull()) { |
| 3816 const Class& function_class = Class::Handle(function.owner()); | 3910 const Class& function_class = Class::Handle(function.Owner()); |
| 3817 ASSERT(!function_class.IsNull()); | 3911 ASSERT(!function_class.IsNull()); |
| 3818 const char* class_name = String::Handle(function_class.Name()).ToCString(); | 3912 const char* class_name = String::Handle(function_class.Name()).ToCString(); |
| 3819 ASSERT(class_name != NULL); | 3913 ASSERT(class_name != NULL); |
| 3820 const Library& library = Library::Handle(function_class.library()); | 3914 const Library& library = Library::Handle(function_class.library()); |
| 3821 ASSERT(!library.IsNull()); | 3915 ASSERT(!library.IsNull()); |
| 3822 const char* library_name = String::Handle(library.url()).ToCString(); | 3916 const char* library_name = String::Handle(library.url()).ToCString(); |
| 3823 ASSERT(library_name != NULL); | 3917 ASSERT(library_name != NULL); |
| 3824 const char* lib_class_format = | 3918 const char* lib_class_format = |
| 3825 (library_name[0] == '\0') ? "%s%s_" : "%s_%s_"; | 3919 (library_name[0] == '\0') ? "%s%s_" : "%s_%s_"; |
| 3826 reserve_len += | 3920 reserve_len += |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4046 result.set_is_native(false); | 4140 result.set_is_native(false); |
| 4047 return result.raw(); | 4141 return result.raw(); |
| 4048 } | 4142 } |
| 4049 | 4143 |
| 4050 | 4144 |
| 4051 RawFunction* Function::NewClosureFunction(const String& name, | 4145 RawFunction* Function::NewClosureFunction(const String& name, |
| 4052 const Function& parent, | 4146 const Function& parent, |
| 4053 intptr_t token_pos) { | 4147 intptr_t token_pos) { |
| 4054 ASSERT(name.IsOneByteString()); | 4148 ASSERT(name.IsOneByteString()); |
| 4055 ASSERT(!parent.IsNull()); | 4149 ASSERT(!parent.IsNull()); |
| 4056 const Class& parent_class = Class::Handle(parent.owner()); | 4150 const Class& parent_class = Class::Handle(parent.Owner()); |
| 4057 ASSERT(!parent_class.IsNull()); | 4151 ASSERT(!parent_class.IsNull()); |
| 4058 const Function& result = Function::Handle( | 4152 const Function& result = Function::Handle( |
| 4059 Function::New(name, | 4153 Function::New(name, |
| 4060 RawFunction::kClosureFunction, | 4154 RawFunction::kClosureFunction, |
| 4061 /* is_static = */ parent.is_static(), | 4155 /* is_static = */ parent.is_static(), |
| 4062 /* is_const = */ false, | 4156 /* is_const = */ false, |
| 4063 /* is_abstract = */ false, | 4157 /* is_abstract = */ false, |
| 4064 /* is_external = */ false, | 4158 /* is_external = */ false, |
| 4065 parent_class, | 4159 parent_class, |
| 4066 token_pos)); | 4160 token_pos)); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4108 String& param_name = String::Handle(); | 4202 String& param_name = String::Handle(); |
| 4109 for (int i = 0; i < num_params; i++) { | 4203 for (int i = 0; i < num_params; i++) { |
| 4110 param_type = ParameterTypeAt(i + has_receiver); | 4204 param_type = ParameterTypeAt(i + has_receiver); |
| 4111 closure_function.SetParameterTypeAt(i, param_type); | 4205 closure_function.SetParameterTypeAt(i, param_type); |
| 4112 param_name = ParameterNameAt(i + has_receiver); | 4206 param_name = ParameterNameAt(i + has_receiver); |
| 4113 closure_function.SetParameterNameAt(i, param_name); | 4207 closure_function.SetParameterNameAt(i, param_name); |
| 4114 } | 4208 } |
| 4115 | 4209 |
| 4116 // Lookup or create a new signature class for the closure function in the | 4210 // Lookup or create a new signature class for the closure function in the |
| 4117 // library of the owner class. | 4211 // library of the owner class. |
| 4118 const Class& owner_class = Class::Handle(owner()); | 4212 const Class& owner_class = Class::Handle(Owner()); |
| 4119 ASSERT(!owner_class.IsNull() && (owner() == closure_function.owner())); | 4213 ASSERT(!owner_class.IsNull() && (Owner() == closure_function.Owner())); |
| 4120 const Library& library = Library::Handle(owner_class.library()); | 4214 const Library& library = Library::Handle(owner_class.library()); |
| 4121 ASSERT(!library.IsNull()); | 4215 ASSERT(!library.IsNull()); |
| 4122 const String& signature = String::Handle(closure_function.Signature()); | 4216 const String& signature = String::Handle(closure_function.Signature()); |
| 4123 Class& signature_class = Class::ZoneHandle( | 4217 Class& signature_class = Class::ZoneHandle( |
| 4124 library.LookupLocalClass(signature)); | 4218 library.LookupLocalClass(signature)); |
| 4125 if (signature_class.IsNull()) { | 4219 if (signature_class.IsNull()) { |
| 4126 const Script& script = Script::Handle(owner_class.script()); | 4220 const Script& script = Script::Handle(this->script()); |
| 4127 signature_class = Class::NewSignatureClass(signature, | 4221 signature_class = Class::NewSignatureClass(signature, |
| 4128 closure_function, | 4222 closure_function, |
| 4129 script); | 4223 script); |
| 4130 library.AddClass(signature_class); | 4224 library.AddClass(signature_class); |
| 4131 } else { | 4225 } else { |
| 4132 closure_function.set_signature_class(signature_class); | 4226 closure_function.set_signature_class(signature_class); |
| 4133 } | 4227 } |
| 4134 const Type& signature_type = Type::Handle(signature_class.SignatureType()); | 4228 const Type& signature_type = Type::Handle(signature_class.SignatureType()); |
| 4135 if (!signature_type.IsFinalized()) { | 4229 if (!signature_type.IsFinalized()) { |
| 4136 ClassFinalizer::FinalizeType( | 4230 ClassFinalizer::FinalizeType( |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 4156 const String& kLBracket = String::Handle(Symbols::New("[")); | 4250 const String& kLBracket = String::Handle(Symbols::New("[")); |
| 4157 const String& kRBracket = String::Handle(Symbols::New("]")); | 4251 const String& kRBracket = String::Handle(Symbols::New("]")); |
| 4158 String& name = String::Handle(); | 4252 String& name = String::Handle(); |
| 4159 if (!instantiate && !is_static()) { | 4253 if (!instantiate && !is_static()) { |
| 4160 // Prefix the signature with its type parameters, if any (e.g. "<K, V>"). | 4254 // Prefix the signature with its type parameters, if any (e.g. "<K, V>"). |
| 4161 // The signature of static functions cannot be type parameterized. | 4255 // The signature of static functions cannot be type parameterized. |
| 4162 const String& kSpaceExtendsSpace = | 4256 const String& kSpaceExtendsSpace = |
| 4163 String::Handle(Symbols::New(" extends ")); | 4257 String::Handle(Symbols::New(" extends ")); |
| 4164 const String& kLAngleBracket = String::Handle(Symbols::New("<")); | 4258 const String& kLAngleBracket = String::Handle(Symbols::New("<")); |
| 4165 const String& kRAngleBracket = String::Handle(Symbols::New(">")); | 4259 const String& kRAngleBracket = String::Handle(Symbols::New(">")); |
| 4166 const Class& function_class = Class::Handle(owner()); | 4260 const Class& function_class = Class::Handle(Owner()); |
| 4167 ASSERT(!function_class.IsNull()); | 4261 ASSERT(!function_class.IsNull()); |
| 4168 const TypeArguments& type_parameters = TypeArguments::Handle( | 4262 const TypeArguments& type_parameters = TypeArguments::Handle( |
| 4169 function_class.type_parameters()); | 4263 function_class.type_parameters()); |
| 4170 if (!type_parameters.IsNull()) { | 4264 if (!type_parameters.IsNull()) { |
| 4171 intptr_t num_type_parameters = type_parameters.Length(); | 4265 intptr_t num_type_parameters = type_parameters.Length(); |
| 4172 pieces.Add(kLAngleBracket); | 4266 pieces.Add(kLAngleBracket); |
| 4173 TypeParameter& type_parameter = TypeParameter::Handle(); | 4267 TypeParameter& type_parameter = TypeParameter::Handle(); |
| 4174 AbstractType& bound = AbstractType::Handle(); | 4268 AbstractType& bound = AbstractType::Handle(); |
| 4175 for (intptr_t i = 0; i < num_type_parameters; i++) { | 4269 for (intptr_t i = 0; i < num_type_parameters; i++) { |
| 4176 type_parameter ^= type_parameters.TypeAt(i); | 4270 type_parameter ^= type_parameters.TypeAt(i); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4247 for (intptr_t i = 0; i < num_parameters; i++) { | 4341 for (intptr_t i = 0; i < num_parameters; i++) { |
| 4248 type = ParameterTypeAt(i); | 4342 type = ParameterTypeAt(i); |
| 4249 if (!type.IsInstantiated()) { | 4343 if (!type.IsInstantiated()) { |
| 4250 return false; | 4344 return false; |
| 4251 } | 4345 } |
| 4252 } | 4346 } |
| 4253 return true; | 4347 return true; |
| 4254 } | 4348 } |
| 4255 | 4349 |
| 4256 | 4350 |
| 4351 RawClass* Function::Owner() const { | |
| 4352 const Object& obj = Object::Handle(raw_ptr()->owner_); | |
|
hausner
2012/08/14 18:25:06
It would be nice if you could avoid this extra han
Ivan Posva
2012/08/15 06:50:39
I have seen 0% impact by this change on performanc
| |
| 4353 if (obj.IsClass()) { | |
| 4354 return Class::Cast(obj).raw(); | |
| 4355 } | |
| 4356 ASSERT(obj.IsPatchClass()); | |
| 4357 return PatchClass::Cast(obj).patched_class(); | |
| 4358 } | |
| 4359 | |
| 4360 | |
| 4361 RawScript* Function::script() const { | |
| 4362 const Object& obj = Object::Handle(raw_ptr()->owner_); | |
| 4363 if (obj.IsClass()) { | |
| 4364 return Class::Cast(obj).script(); | |
| 4365 } | |
| 4366 ASSERT(obj.IsPatchClass()); | |
| 4367 return PatchClass::Cast(obj).script(); | |
| 4368 } | |
| 4369 | |
| 4370 | |
| 4257 bool Function::HasOptimizedCode() const { | 4371 bool Function::HasOptimizedCode() const { |
| 4258 return HasCode() && Code::Handle(raw_ptr()->code_).is_optimized(); | 4372 return HasCode() && Code::Handle(raw_ptr()->code_).is_optimized(); |
| 4259 } | 4373 } |
| 4260 | 4374 |
| 4261 | 4375 |
| 4262 RawString* Function::UserVisibleName() const { | 4376 RawString* Function::UserVisibleName() const { |
| 4263 const String& str = String::Handle(name()); | 4377 const String& str = String::Handle(name()); |
| 4264 return IdentifierPrettyName(str); | 4378 return IdentifierPrettyName(str); |
| 4265 } | 4379 } |
| 4266 | 4380 |
| 4267 | 4381 |
| 4268 RawString* Function::QualifiedUserVisibleName() const { | 4382 RawString* Function::QualifiedUserVisibleName() const { |
| 4269 String& tmp = String::Handle(); | 4383 String& tmp = String::Handle(); |
| 4270 String& suffix = String::Handle(); | 4384 String& suffix = String::Handle(); |
| 4271 const Class& cls = Class::Handle(owner()); | 4385 const Class& cls = Class::Handle(Owner()); |
| 4272 | 4386 |
| 4273 if (IsClosureFunction()) { | 4387 if (IsClosureFunction()) { |
| 4274 if (IsLocalFunction()) { | 4388 if (IsLocalFunction()) { |
| 4275 const Function& parent = Function::Handle(parent_function()); | 4389 const Function& parent = Function::Handle(parent_function()); |
| 4276 tmp = parent.QualifiedUserVisibleName(); | 4390 tmp = parent.QualifiedUserVisibleName(); |
| 4277 } else { | 4391 } else { |
| 4278 return UserVisibleName(); | 4392 return UserVisibleName(); |
| 4279 } | 4393 } |
| 4280 } else { | 4394 } else { |
| 4281 if (cls.IsTopLevel()) { | 4395 if (cls.IsTopLevel()) { |
| (...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5492 | 5606 |
| 5493 | 5607 |
| 5494 RawArray* Library::LoadedScripts() const { | 5608 RawArray* Library::LoadedScripts() const { |
| 5495 // We compute the list of loaded scripts lazily. The result is | 5609 // We compute the list of loaded scripts lazily. The result is |
| 5496 // cached in loaded_scripts_. | 5610 // cached in loaded_scripts_. |
| 5497 if (loaded_scripts() == Array::null()) { | 5611 if (loaded_scripts() == Array::null()) { |
| 5498 // Iterate over the library dictionary and collect all scripts. | 5612 // Iterate over the library dictionary and collect all scripts. |
| 5499 const GrowableObjectArray& scripts = | 5613 const GrowableObjectArray& scripts = |
| 5500 GrowableObjectArray::Handle(GrowableObjectArray::New(8)); | 5614 GrowableObjectArray::Handle(GrowableObjectArray::New(8)); |
| 5501 Object& entry = Object::Handle(); | 5615 Object& entry = Object::Handle(); |
| 5502 Function& func = Function::Handle(); | |
| 5503 Field& field = Field::Handle(); | |
| 5504 Class& cls = Class::Handle(); | 5616 Class& cls = Class::Handle(); |
| 5505 Script& owner_script = Script::Handle(); | 5617 Script& owner_script = Script::Handle(); |
| 5506 DictionaryIterator it(*this); | 5618 DictionaryIterator it(*this); |
| 5507 Script& script_obj = Script::Handle(); | 5619 Script& script_obj = Script::Handle(); |
| 5508 while (it.HasNext()) { | 5620 while (it.HasNext()) { |
| 5509 entry = it.GetNext(); | 5621 entry = it.GetNext(); |
| 5510 if (entry.IsClass()) { | 5622 if (entry.IsClass()) { |
| 5511 cls ^= entry.raw(); | 5623 owner_script = Class::Cast(entry).script(); |
| 5512 } else if (entry.IsFunction()) { | 5624 } else if (entry.IsFunction()) { |
| 5513 func ^= entry.raw(); | 5625 owner_script = Function::Cast(entry).script(); |
| 5514 cls = func.owner(); | |
| 5515 } else if (entry.IsField()) { | 5626 } else if (entry.IsField()) { |
| 5516 field ^= entry.raw(); | 5627 cls = Field::Cast(entry).owner(); |
| 5517 cls = field.owner(); | 5628 owner_script = cls.script(); |
| 5518 } else { | 5629 } else { |
| 5519 continue; | 5630 continue; |
| 5520 } | 5631 } |
| 5521 owner_script = cls.script(); | |
| 5522 if (owner_script.IsNull()) { | 5632 if (owner_script.IsNull()) { |
| 5523 continue; | 5633 continue; |
| 5524 } | 5634 } |
| 5525 bool is_unique = true; | 5635 bool is_unique = true; |
| 5526 for (int i = 0; i < scripts.Length(); i++) { | 5636 for (int i = 0; i < scripts.Length(); i++) { |
| 5527 script_obj ^= scripts.At(i); | 5637 script_obj ^= scripts.At(i); |
| 5528 if (script_obj.raw() == owner_script.raw()) { | 5638 if (script_obj.raw() == owner_script.raw()) { |
| 5529 // We already have a reference to this script. | 5639 // We already have a reference to this script. |
| 5530 is_unique = false; | 5640 is_unique = false; |
| 5531 break; | 5641 break; |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5771 // library in which it is defined as it might be defined in one of | 5881 // library in which it is defined as it might be defined in one of |
| 5772 // the imported libraries. | 5882 // the imported libraries. |
| 5773 Class& cls = Class::Handle(isolate, Class::null()); | 5883 Class& cls = Class::Handle(isolate, Class::null()); |
| 5774 Function& func = Function::Handle(isolate, Function::null()); | 5884 Function& func = Function::Handle(isolate, Function::null()); |
| 5775 Field& field = Field::Handle(isolate, Field::null()); | 5885 Field& field = Field::Handle(isolate, Field::null()); |
| 5776 if (obj.IsClass()) { | 5886 if (obj.IsClass()) { |
| 5777 cls ^= obj.raw(); | 5887 cls ^= obj.raw(); |
| 5778 lib ^= cls.library(); | 5888 lib ^= cls.library(); |
| 5779 } else if (obj.IsFunction()) { | 5889 } else if (obj.IsFunction()) { |
| 5780 func ^= obj.raw(); | 5890 func ^= obj.raw(); |
| 5781 cls ^= func.owner(); | 5891 cls ^= func.Owner(); |
| 5782 lib ^= cls.library(); | 5892 lib ^= cls.library(); |
| 5783 } else if (obj.IsField()) { | 5893 } else if (obj.IsField()) { |
| 5784 field ^= obj.raw(); | 5894 field ^= obj.raw(); |
| 5785 cls ^= field.owner(); | 5895 cls ^= field.owner(); |
| 5786 lib ^= cls.library(); | 5896 lib ^= cls.library(); |
| 5787 } | 5897 } |
| 5788 return lib.raw(); | 5898 return lib.raw(); |
| 5789 } | 5899 } |
| 5790 } | 5900 } |
| 5791 return Library::null(); | 5901 return Library::null(); |
| (...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7635 } | 7745 } |
| 7636 } | 7746 } |
| 7637 return result.raw(); | 7747 return result.raw(); |
| 7638 } | 7748 } |
| 7639 | 7749 |
| 7640 | 7750 |
| 7641 bool ICData::AllTargetsHaveSameOwner(intptr_t owner_cid) const { | 7751 bool ICData::AllTargetsHaveSameOwner(intptr_t owner_cid) const { |
| 7642 if (NumberOfChecks() == 0) return false; | 7752 if (NumberOfChecks() == 0) return false; |
| 7643 Class& cls = Class::Handle(); | 7753 Class& cls = Class::Handle(); |
| 7644 for (intptr_t i = 0; i < NumberOfChecks(); i++) { | 7754 for (intptr_t i = 0; i < NumberOfChecks(); i++) { |
| 7645 cls = Function::Handle(GetTargetAt(i)).owner(); | 7755 cls = Function::Handle(GetTargetAt(i)).Owner(); |
| 7646 if (cls.id() != owner_cid) { | 7756 if (cls.id() != owner_cid) { |
| 7647 return false; | 7757 return false; |
| 7648 } | 7758 } |
| 7649 } | 7759 } |
| 7650 return true; | 7760 return true; |
| 7651 } | 7761 } |
| 7652 | 7762 |
| 7653 | 7763 |
| 7654 bool ICData::AllReceiversAreNumbers() const { | 7764 bool ICData::AllReceiversAreNumbers() const { |
| 7655 if (NumberOfChecks() == 0) return false; | 7765 if (NumberOfChecks() == 0) return false; |
| 7656 Class& cls = Class::Handle(); | 7766 Class& cls = Class::Handle(); |
| 7657 for (intptr_t i = 0; i < NumberOfChecks(); i++) { | 7767 for (intptr_t i = 0; i < NumberOfChecks(); i++) { |
| 7658 cls = Function::Handle(GetTargetAt(i)).owner(); | 7768 cls = Function::Handle(GetTargetAt(i)).Owner(); |
| 7659 const intptr_t cid = cls.id(); | 7769 const intptr_t cid = cls.id(); |
| 7660 if ((cid != kSmiCid) && | 7770 if ((cid != kSmiCid) && |
| 7661 (cid != kMintCid) && | 7771 (cid != kMintCid) && |
| 7662 (cid != kBigintCid) && | 7772 (cid != kBigintCid) && |
| 7663 (cid != kDoubleCid)) { | 7773 (cid != kDoubleCid)) { |
| 7664 return false; | 7774 return false; |
| 7665 } | 7775 } |
| 7666 } | 7776 } |
| 7667 return true; | 7777 return true; |
| 7668 } | 7778 } |
| (...skipping 3262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 10931 code_array.SetAt(i, obj); | 11041 code_array.SetAt(i, obj); |
| 10932 obj = pc_offset_list.At(j); | 11042 obj = pc_offset_list.At(j); |
| 10933 pc_offset_array.SetAt(i, obj); | 11043 pc_offset_array.SetAt(i, obj); |
| 10934 } | 11044 } |
| 10935 } | 11045 } |
| 10936 | 11046 |
| 10937 | 11047 |
| 10938 const char* Stacktrace::ToCString() const { | 11048 const char* Stacktrace::ToCString() const { |
| 10939 Function& function = Function::Handle(); | 11049 Function& function = Function::Handle(); |
| 10940 Code& code = Code::Handle(); | 11050 Code& code = Code::Handle(); |
| 10941 Class& owner = Class::Handle(); | |
| 10942 Script& script = Script::Handle(); | 11051 Script& script = Script::Handle(); |
| 10943 String& function_name = String::Handle(); | 11052 String& function_name = String::Handle(); |
| 10944 String& url = String::Handle(); | 11053 String& url = String::Handle(); |
| 10945 | 11054 |
| 10946 // Iterate through the stack frames and create C string description | 11055 // Iterate through the stack frames and create C string description |
| 10947 // for each frame. | 11056 // for each frame. |
| 10948 intptr_t total_len = 0; | 11057 intptr_t total_len = 0; |
| 10949 const char* kFormat = "#%-6d %s (%s:%d:%d)\n"; | 11058 const char* kFormat = "#%-6d %s (%s:%d:%d)\n"; |
| 10950 GrowableArray<char*> frame_strings; | 11059 GrowableArray<char*> frame_strings; |
| 10951 for (intptr_t i = 0; i < Length(); i++) { | 11060 for (intptr_t i = 0; i < Length(); i++) { |
| 10952 function = FunctionAtFrame(i); | 11061 function = FunctionAtFrame(i); |
| 10953 code = CodeAtFrame(i); | 11062 code = CodeAtFrame(i); |
| 10954 uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i)); | 11063 uword pc = code.EntryPoint() + Smi::Value(PcOffsetAtFrame(i)); |
| 10955 intptr_t token_pos = code.GetTokenIndexOfPC(pc); | 11064 intptr_t token_pos = code.GetTokenIndexOfPC(pc); |
| 10956 owner = function.owner(); | 11065 script = function.script(); |
| 10957 script = owner.script(); | |
| 10958 function_name = function.QualifiedUserVisibleName(); | 11066 function_name = function.QualifiedUserVisibleName(); |
| 10959 url = script.url(); | 11067 url = script.url(); |
| 10960 intptr_t line = -1; | 11068 intptr_t line = -1; |
| 10961 intptr_t column = -1; | 11069 intptr_t column = -1; |
| 10962 if (token_pos >= 0) { | 11070 if (token_pos >= 0) { |
| 10963 script.GetTokenLocation(token_pos, &line, &column); | 11071 script.GetTokenLocation(token_pos, &line, &column); |
| 10964 } | 11072 } |
| 10965 intptr_t len = OS::SNPrint(NULL, 0, kFormat, | 11073 intptr_t len = OS::SNPrint(NULL, 0, kFormat, |
| 10966 i, | 11074 i, |
| 10967 function_name.ToCString(), | 11075 function_name.ToCString(), |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 11081 const char* JSRegExp::ToCString() const { | 11189 const char* JSRegExp::ToCString() const { |
| 11082 const String& str = String::Handle(pattern()); | 11190 const String& str = String::Handle(pattern()); |
| 11083 const char* format = "JSRegExp: pattern=%s flags=%s"; | 11191 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 11084 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 11192 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 11085 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); | 11193 char* chars = Isolate::Current()->current_zone()->Alloc<char>(len + 1); |
| 11086 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 11194 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 11087 return chars; | 11195 return chars; |
| 11088 } | 11196 } |
| 11089 | 11197 |
| 11090 } // namespace dart | 11198 } // namespace dart |
| OLD | NEW |