Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 #include "vm/assert.h" | 8 #include "vm/assert.h" |
| 9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
| 10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 384 // has been created. | 384 // has been created. |
| 385 cls.InitEmptyFields(); | 385 cls.InitEmptyFields(); |
| 386 | 386 |
| 387 // Setup the symbol table used within the String class. | 387 // Setup the symbol table used within the String class. |
| 388 const int kInitialSymbolTableSize = 16; | 388 const int kInitialSymbolTableSize = 16; |
| 389 array = Array::New(kInitialSymbolTableSize + 1); | 389 array = Array::New(kInitialSymbolTableSize + 1); |
| 390 // Last element contains the count of used slots. | 390 // Last element contains the count of used slots. |
| 391 array.SetAt(kInitialSymbolTableSize, Smi::Handle(Smi::New(0))); | 391 array.SetAt(kInitialSymbolTableSize, Smi::Handle(Smi::New(0))); |
| 392 object_store->set_symbol_table(array); | 392 object_store->set_symbol_table(array); |
| 393 | 393 |
| 394 // canonical_type_arguments_ are NULL terminated. | |
| 395 array = Array::New(4); | |
| 396 object_store->set_canonical_type_arguments(array); | |
| 397 | |
| 394 // Pre-allocate the OneByteString class needed by the symbol table. | 398 // Pre-allocate the OneByteString class needed by the symbol table. |
| 395 cls = Class::New<OneByteString>(); | 399 cls = Class::New<OneByteString>(); |
| 396 object_store->set_one_byte_string_class(cls); | 400 object_store->set_one_byte_string_class(cls); |
| 397 | 401 |
| 398 // Basic infrastructure has been setup, initialize the class dictionary. | 402 // Basic infrastructure has been setup, initialize the class dictionary. |
| 399 Library::InitCoreLibrary(isolate); | 403 Library::InitCoreLibrary(isolate); |
| 400 Library& core_lib = Library::Handle(Library::CoreLibrary()); | 404 Library& core_lib = Library::Handle(Library::CoreLibrary()); |
| 401 ASSERT(!core_lib.IsNull()); | 405 ASSERT(!core_lib.IsNull()); |
| 402 Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); | 406 Library& core_impl_lib = Library::Handle(Library::CoreImplLibrary()); |
| 403 ASSERT(!core_impl_lib.IsNull()); | 407 ASSERT(!core_impl_lib.IsNull()); |
| (...skipping 1901 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2305 return chars; | 2309 return chars; |
| 2306 } | 2310 } |
| 2307 | 2311 |
| 2308 | 2312 |
| 2309 RawClass* InstantiatedType::type_class() const { | 2313 RawClass* InstantiatedType::type_class() const { |
| 2310 return AbstractType::Handle(uninstantiated_type()).type_class(); | 2314 return AbstractType::Handle(uninstantiated_type()).type_class(); |
| 2311 } | 2315 } |
| 2312 | 2316 |
| 2313 | 2317 |
| 2314 RawAbstractTypeArguments* InstantiatedType::arguments() const { | 2318 RawAbstractTypeArguments* InstantiatedType::arguments() const { |
| 2315 return AbstractTypeArguments::NewInstantiatedTypeArguments( | 2319 return InstantiatedTypeArguments::New( |
| 2316 AbstractTypeArguments::Handle(AbstractType::Handle( | 2320 AbstractTypeArguments::Handle(AbstractType::Handle( |
| 2317 uninstantiated_type()).arguments()), | 2321 uninstantiated_type()).arguments()), |
| 2318 AbstractTypeArguments::Handle(instantiator_type_arguments())); | 2322 AbstractTypeArguments::Handle(instantiator_type_arguments())); |
| 2319 } | 2323 } |
| 2320 | 2324 |
| 2321 | 2325 |
| 2322 void InstantiatedType::set_uninstantiated_type( | 2326 void InstantiatedType::set_uninstantiated_type( |
| 2323 const AbstractType& value) const { | 2327 const AbstractType& value) const { |
| 2324 StorePointer(&raw_ptr()->uninstantiated_type_, value.raw()); | 2328 StorePointer(&raw_ptr()->uninstantiated_type_, value.raw()); |
| 2325 } | 2329 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2393 | 2397 |
| 2394 | 2398 |
| 2395 bool AbstractTypeArguments::IsUninstantiatedIdentity() const { | 2399 bool AbstractTypeArguments::IsUninstantiatedIdentity() const { |
| 2396 // AbstractTypeArguments is an abstract class. | 2400 // AbstractTypeArguments is an abstract class. |
| 2397 UNREACHABLE(); | 2401 UNREACHABLE(); |
| 2398 return false; | 2402 return false; |
| 2399 } | 2403 } |
| 2400 | 2404 |
| 2401 | 2405 |
| 2402 bool AbstractTypeArguments::Equals(const AbstractTypeArguments& other) const { | 2406 bool AbstractTypeArguments::Equals(const AbstractTypeArguments& other) const { |
| 2403 // AbstractTypeArguments is an abstract class. | 2407 if (this->raw() == other.raw()) { |
| 2404 UNREACHABLE(); | 2408 return true; |
| 2405 return false; | 2409 } |
| 2410 intptr_t num_types = Length(); | |
| 2411 if (num_types != other.Length()) { | |
| 2412 return false; | |
| 2413 } | |
| 2414 AbstractType& type = AbstractType::Handle(); | |
| 2415 AbstractType& other_type = AbstractType::Handle(); | |
| 2416 for (intptr_t i = 0; i < num_types; i++) { | |
| 2417 type = TypeAt(i); | |
| 2418 other_type = other.TypeAt(i); | |
| 2419 if (!type.IsNull() && !type.Equals(other_type)) { | |
|
regis
2011/12/05 23:16:35
What if type.IsNull() && !other_type.IsNull()?
srdjan
2011/12/06 17:24:15
Type can't be NULL, removed test (see comment belo
| |
| 2420 return false; | |
| 2421 } | |
| 2422 } | |
| 2423 return true; | |
| 2406 } | 2424 } |
| 2407 | 2425 |
| 2408 | 2426 |
| 2409 bool AbstractTypeArguments::AreEqual( | 2427 bool AbstractTypeArguments::AreEqual( |
| 2410 const AbstractTypeArguments& arguments, | 2428 const AbstractTypeArguments& arguments, |
| 2411 const AbstractTypeArguments& other_arguments) { | 2429 const AbstractTypeArguments& other_arguments) { |
| 2412 if (arguments.raw() == other_arguments.raw()) { | 2430 if (arguments.raw() == other_arguments.raw()) { |
| 2413 return true; | 2431 return true; |
| 2414 } | 2432 } |
| 2415 if (arguments.IsNull()) { | 2433 if (arguments.IsNull()) { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2465 other_type = other.TypeAt(i); | 2483 other_type = other.TypeAt(i); |
| 2466 ASSERT(!other_type.IsNull()); | 2484 ASSERT(!other_type.IsNull()); |
| 2467 if (!type.IsMoreSpecificThan(other_type)) { | 2485 if (!type.IsMoreSpecificThan(other_type)) { |
| 2468 return false; | 2486 return false; |
| 2469 } | 2487 } |
| 2470 } | 2488 } |
| 2471 return true; | 2489 return true; |
| 2472 } | 2490 } |
| 2473 | 2491 |
| 2474 | 2492 |
| 2475 RawAbstractTypeArguments* AbstractTypeArguments::NewInstantiatedTypeArguments( | |
| 2476 const AbstractTypeArguments& uninstantiated_type_arguments, | |
| 2477 const AbstractTypeArguments& instantiator_type_arguments) { | |
| 2478 return InstantiatedTypeArguments::New(uninstantiated_type_arguments, | |
| 2479 instantiator_type_arguments); | |
| 2480 } | |
| 2481 | |
| 2482 | |
| 2483 const char* AbstractTypeArguments::ToCString() const { | 2493 const char* AbstractTypeArguments::ToCString() const { |
| 2484 // AbstractTypeArguments is an abstract class. | 2494 // AbstractTypeArguments is an abstract class. |
| 2485 UNREACHABLE(); | 2495 UNREACHABLE(); |
| 2486 return "AbstractTypeArguments"; | 2496 return "AbstractTypeArguments"; |
| 2487 } | 2497 } |
| 2488 | 2498 |
| 2489 | 2499 |
| 2490 intptr_t TypeArguments::Length() const { | 2500 intptr_t TypeArguments::Length() const { |
| 2491 ASSERT(!IsNull()); | 2501 ASSERT(!IsNull()); |
| 2492 return Smi::Value(raw_ptr()->length_); | 2502 return Smi::Value(raw_ptr()->length_); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 2515 } | 2525 } |
| 2516 return true; | 2526 return true; |
| 2517 } | 2527 } |
| 2518 | 2528 |
| 2519 | 2529 |
| 2520 bool TypeArguments::IsInstantiated() const { | 2530 bool TypeArguments::IsInstantiated() const { |
| 2521 AbstractType& type = AbstractType::Handle(); | 2531 AbstractType& type = AbstractType::Handle(); |
| 2522 intptr_t num_types = Length(); | 2532 intptr_t num_types = Length(); |
| 2523 for (intptr_t i = 0; i < num_types; i++) { | 2533 for (intptr_t i = 0; i < num_types; i++) { |
| 2524 type = TypeAt(i); | 2534 type = TypeAt(i); |
| 2525 if (!type.IsInstantiated()) { | 2535 // type.IsNull() means it is Dynamic type. |
|
regis
2011/12/05 23:16:35
We should not encounter a Null type in a non-null
srdjan
2011/12/06 17:24:15
Removed isNull case (reverting the lines here). It
| |
| 2536 if (!type.IsNull() && !type.IsInstantiated()) { | |
| 2526 return false; | 2537 return false; |
| 2527 } | 2538 } |
| 2528 } | 2539 } |
| 2529 return true; | 2540 return true; |
| 2530 } | 2541 } |
| 2531 | 2542 |
| 2532 | 2543 |
| 2533 bool TypeArguments::IsUninstantiatedIdentity() const { | 2544 bool TypeArguments::IsUninstantiatedIdentity() const { |
| 2534 ASSERT(!IsInstantiated()); | 2545 ASSERT(!IsInstantiated()); |
| 2535 AbstractType& type = AbstractType::Handle(); | 2546 AbstractType& type = AbstractType::Handle(); |
| 2536 intptr_t num_types = Length(); | 2547 intptr_t num_types = Length(); |
| 2537 for (intptr_t i = 0; i < num_types; i++) { | 2548 for (intptr_t i = 0; i < num_types; i++) { |
| 2538 type = TypeAt(i); | 2549 type = TypeAt(i); |
| 2539 if (!type.IsTypeParameter() || (type.Index() != i)) { | 2550 if (!type.IsTypeParameter() || (type.Index() != i)) { |
| 2540 return false; | 2551 return false; |
| 2541 } | 2552 } |
| 2542 } | 2553 } |
| 2543 return true; | 2554 return true; |
| 2544 } | 2555 } |
| 2545 | 2556 |
| 2546 | 2557 |
| 2547 bool TypeArguments::Equals(const AbstractTypeArguments& other) const { | |
| 2548 intptr_t num_types = Length(); | |
| 2549 if (num_types != other.Length()) { | |
| 2550 return false; | |
| 2551 } | |
| 2552 AbstractType& type = AbstractType::Handle(); | |
| 2553 AbstractType& other_type = AbstractType::Handle(); | |
| 2554 for (intptr_t i = 0; i < num_types; i++) { | |
| 2555 type = TypeAt(i); | |
| 2556 other_type = other.TypeAt(i); | |
| 2557 if (!type.Equals(other_type)) { | |
| 2558 return false; | |
| 2559 } | |
| 2560 } | |
| 2561 return true; | |
| 2562 } | |
| 2563 | |
| 2564 | |
| 2565 RawAbstractTypeArguments* TypeArguments::InstantiateFrom( | 2558 RawAbstractTypeArguments* TypeArguments::InstantiateFrom( |
| 2566 const AbstractTypeArguments& instantiator_type_arguments, | 2559 const AbstractTypeArguments& instantiator_type_arguments, |
| 2567 intptr_t offset) const { | 2560 intptr_t offset) const { |
| 2568 ASSERT(!IsInstantiated()); | 2561 ASSERT(!IsInstantiated()); |
| 2569 if ((offset == 0) && | 2562 if ((offset == 0) && |
| 2570 !instantiator_type_arguments.IsNull() && | 2563 !instantiator_type_arguments.IsNull() && |
| 2571 IsUninstantiatedIdentity() && | 2564 IsUninstantiatedIdentity() && |
| 2572 (instantiator_type_arguments.Length() == Length())) { | 2565 (instantiator_type_arguments.Length() == Length())) { |
| 2573 return instantiator_type_arguments.raw(); | 2566 return instantiator_type_arguments.raw(); |
| 2574 } | 2567 } |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 2596 | 2589 |
| 2597 const Class& type_arguments_class = | 2590 const Class& type_arguments_class = |
| 2598 Class::Handle(Object::type_arguments_class()); | 2591 Class::Handle(Object::type_arguments_class()); |
| 2599 TypeArguments& result = TypeArguments::Handle(); | 2592 TypeArguments& result = TypeArguments::Handle(); |
| 2600 { | 2593 { |
| 2601 RawObject* raw = Object::Allocate(type_arguments_class, | 2594 RawObject* raw = Object::Allocate(type_arguments_class, |
| 2602 TypeArguments::InstanceSize(len), | 2595 TypeArguments::InstanceSize(len), |
| 2603 Heap::kOld); | 2596 Heap::kOld); |
| 2604 NoGCScope no_gc; | 2597 NoGCScope no_gc; |
| 2605 result ^= raw; | 2598 result ^= raw; |
| 2599 // Length must be set before we start storing into the array. | |
| 2606 result.SetLength(len); | 2600 result.SetLength(len); |
| 2607 for (intptr_t i = 0; i < len; i++) { | 2601 for (intptr_t i = 0; i < len; i++) { |
| 2608 *result.TypeAddr(i) = Type::null(); | 2602 *result.TypeAddr(i) = Type::null(); |
| 2609 } | 2603 } |
| 2610 } | 2604 } |
| 2605 result.set_is_canonical(false); | |
| 2611 return result.raw(); | 2606 return result.raw(); |
| 2612 } | 2607 } |
| 2613 | 2608 |
| 2614 | 2609 |
| 2610 | |
| 2615 RawAbstractType** TypeArguments::TypeAddr(intptr_t index) const { | 2611 RawAbstractType** TypeArguments::TypeAddr(intptr_t index) const { |
| 2616 // TODO(iposva): Determine if we should throw an exception here. | 2612 // TODO(iposva): Determine if we should throw an exception here. |
| 2617 ASSERT((index >= 0) && (index < Length())); | 2613 ASSERT((index >= 0) && (index < Length())); |
| 2618 return &raw_ptr()->types_[index]; | 2614 return &raw_ptr()->types_[index]; |
| 2619 } | 2615 } |
| 2620 | 2616 |
| 2621 | 2617 |
| 2622 void TypeArguments::SetLength(intptr_t value) { | 2618 void TypeArguments::SetLength(intptr_t value) { |
| 2623 // This is only safe because we create a new Smi, which does not cause | 2619 // This is only safe because we create a new Smi, which does not cause |
| 2624 // heap allocation. | 2620 // heap allocation. |
| 2625 raw_ptr()->length_ = Smi::New(value); | 2621 raw_ptr()->length_ = Smi::New(value); |
| 2626 } | 2622 } |
| 2627 | 2623 |
| 2628 | 2624 |
| 2625 RawAbstractTypeArguments* TypeArguments::Canonicalize() const { | |
|
regis
2011/12/05 23:16:35
I would add a comment that Canonicalize for a non-
srdjan
2011/12/06 17:24:15
Expanded the existing comment in header file.
| |
| 2626 if (IsNull() || is_canonical() || !IsInstantiated()) { | |
| 2627 return this->raw(); | |
| 2628 } | |
| 2629 ObjectStore* object_store = Isolate::Current()->object_store(); | |
| 2630 // 'table' must be null terminated. | |
| 2631 Array& table = Array::Handle(object_store->canonical_type_arguments()); | |
| 2632 ASSERT(table.Length() > 0); | |
| 2633 intptr_t ix = 0; | |
|
regis
2011/12/05 23:16:35
index?
srdjan
2011/12/06 17:24:15
Done.
| |
| 2634 TypeArguments& other = TypeArguments::Handle(); | |
| 2635 other ^= table.At(ix); | |
| 2636 while (!other.IsNull()) { | |
| 2637 if (this->Equals(other)) { | |
| 2638 return other.raw(); | |
| 2639 } | |
| 2640 other ^= table.At(++ix); | |
| 2641 } | |
| 2642 // Not found. Add 'this' to table. | |
| 2643 if (ix == table.Length() - 1) { | |
| 2644 table = Array::Grow(table, table.Length() + 4, Heap::kOld); | |
| 2645 object_store->set_canonical_type_arguments(table); | |
| 2646 } | |
| 2647 table.SetAt(ix, *this); | |
| 2648 this->set_is_canonical(true); | |
| 2649 return this->raw(); | |
| 2650 } | |
| 2651 | |
| 2652 | |
| 2653 bool TypeArguments::is_canonical() const { | |
| 2654 return raw_ptr()->is_canonical_ == Bool::True(); | |
| 2655 } | |
| 2656 | |
| 2657 | |
| 2658 void TypeArguments::set_is_canonical(bool value) const { | |
| 2659 raw_ptr()->is_canonical_ = value ? Bool::True() : Bool::False(); | |
|
regis
2011/12/05 23:16:35
Why do you store a dart value?
Other flags in clas
srdjan
2011/12/06 17:24:15
I am moving it to above the length of RawTypeArgum
| |
| 2660 } | |
| 2661 | |
| 2662 | |
| 2629 const char* TypeArguments::ToCString() const { | 2663 const char* TypeArguments::ToCString() const { |
| 2630 if (IsNull()) { | 2664 if (IsNull()) { |
| 2631 return "NULL TypeArguments"; | 2665 return "NULL TypeArguments"; |
| 2632 } | 2666 } |
| 2633 const char* format = "%s [%s]"; | 2667 const char* format = "%s [%s]"; |
| 2634 const char* prev_cstr = "TypeArguments:"; | 2668 const char* prev_cstr = "TypeArguments:"; |
| 2635 for (int i = 0; i < Length(); i++) { | 2669 for (int i = 0; i < Length(); i++) { |
| 2636 const char* type_cstr = AbstractType::Handle(TypeAt(i)).ToCString(); | 2670 const AbstractType& type_at = AbstractType::Handle(TypeAt(i)); |
| 2671 const char* type_cstr = type_at.IsNull() ? "null" : type_at.ToCString(); | |
| 2637 intptr_t len = OS::SNPrint(NULL, 0, format, prev_cstr, type_cstr) + 1; | 2672 intptr_t len = OS::SNPrint(NULL, 0, format, prev_cstr, type_cstr) + 1; |
| 2638 char* chars = reinterpret_cast<char*>( | 2673 char* chars = reinterpret_cast<char*>( |
| 2639 Isolate::Current()->current_zone()->Allocate(len)); | 2674 Isolate::Current()->current_zone()->Allocate(len)); |
| 2640 OS::SNPrint(chars, len, format, prev_cstr, type_cstr); | 2675 OS::SNPrint(chars, len, format, prev_cstr, type_cstr); |
| 2641 prev_cstr = chars; | 2676 prev_cstr = chars; |
| 2642 } | 2677 } |
| 2643 return prev_cstr; | 2678 return prev_cstr; |
| 2644 } | 2679 } |
| 2645 | 2680 |
| 2646 | 2681 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2705 result.set_uninstantiated_type_arguments(uninstantiated_type_arguments); | 2740 result.set_uninstantiated_type_arguments(uninstantiated_type_arguments); |
| 2706 result.set_instantiator_type_arguments(instantiator_type_arguments); | 2741 result.set_instantiator_type_arguments(instantiator_type_arguments); |
| 2707 return result.raw(); | 2742 return result.raw(); |
| 2708 } | 2743 } |
| 2709 | 2744 |
| 2710 | 2745 |
| 2711 const char* InstantiatedTypeArguments::ToCString() const { | 2746 const char* InstantiatedTypeArguments::ToCString() const { |
| 2712 if (IsNull()) { | 2747 if (IsNull()) { |
| 2713 return "NULL InstantiatedTypeArguments"; | 2748 return "NULL InstantiatedTypeArguments"; |
| 2714 } | 2749 } |
| 2715 const char* format = "InstantiatedTypeArguments: [%s] instantiator: [%s]\n"; | 2750 const char* format = "InstantiatedTypeArguments: [%s] instantiator: [%s]"; |
| 2716 const char* arg_cstr = | 2751 const char* arg_cstr = |
| 2717 AbstractTypeArguments::Handle( | 2752 AbstractTypeArguments::Handle( |
| 2718 uninstantiated_type_arguments()).ToCString(); | 2753 uninstantiated_type_arguments()).ToCString(); |
| 2719 const char* instantiator_cstr = | 2754 const char* instantiator_cstr = |
| 2720 AbstractTypeArguments::Handle(instantiator_type_arguments()).ToCString(); | 2755 AbstractTypeArguments::Handle(instantiator_type_arguments()).ToCString(); |
| 2721 intptr_t len = | 2756 intptr_t len = |
| 2722 OS::SNPrint(NULL, 0, format, arg_cstr, instantiator_cstr) + 1; | 2757 OS::SNPrint(NULL, 0, format, arg_cstr, instantiator_cstr) + 1; |
| 2723 char* chars = reinterpret_cast<char*>( | 2758 char* chars = reinterpret_cast<char*>( |
| 2724 Isolate::Current()->current_zone()->Allocate(len)); | 2759 Isolate::Current()->current_zone()->Allocate(len)); |
| 2725 OS::SNPrint(chars, len, format, arg_cstr, instantiator_cstr); | 2760 OS::SNPrint(chars, len, format, arg_cstr, instantiator_cstr); |
| (...skipping 2304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5030 AbstractTypeArguments& type_arguments = AbstractTypeArguments::Handle(); | 5065 AbstractTypeArguments& type_arguments = AbstractTypeArguments::Handle(); |
| 5031 type_arguments ^= *FieldAddrAtOffset(field_offset); | 5066 type_arguments ^= *FieldAddrAtOffset(field_offset); |
| 5032 return type_arguments.raw(); | 5067 return type_arguments.raw(); |
| 5033 } | 5068 } |
| 5034 | 5069 |
| 5035 | 5070 |
| 5036 void Instance::SetTypeArguments(const AbstractTypeArguments& value) const { | 5071 void Instance::SetTypeArguments(const AbstractTypeArguments& value) const { |
| 5037 const Class& cls = Class::Handle(clazz()); | 5072 const Class& cls = Class::Handle(clazz()); |
| 5038 intptr_t field_offset = cls.type_arguments_instance_field_offset(); | 5073 intptr_t field_offset = cls.type_arguments_instance_field_offset(); |
| 5039 ASSERT(field_offset != Class::kNoTypeArguments); | 5074 ASSERT(field_offset != Class::kNoTypeArguments); |
| 5040 *FieldAddrAtOffset(field_offset) = value.raw(); | 5075 *FieldAddrAtOffset(field_offset) = value.Canonicalize(); |
|
regis
2011/12/05 23:16:35
Same comment: What about inline assembly?
srdjan
2011/12/06 17:24:15
Discussed, not an issue.
| |
| 5041 } | 5076 } |
| 5042 | 5077 |
| 5043 | 5078 |
| 5044 bool Instance::TestType(TypeTestKind test, | 5079 bool Instance::TestType(TypeTestKind test, |
| 5045 const AbstractType& other, | 5080 const AbstractType& other, |
| 5046 const AbstractTypeArguments& other_instantiator) const { | 5081 const AbstractTypeArguments& other_instantiator) const { |
| 5047 ASSERT(other.IsFinalized()); | 5082 ASSERT(other.IsFinalized()); |
| 5048 ASSERT(!other.IsDynamicType()); | 5083 ASSERT(!other.IsDynamicType()); |
| 5049 ASSERT(!other.IsVoidType()); | 5084 ASSERT(!other.IsVoidType()); |
| 5050 if (IsNull()) { | 5085 if (IsNull()) { |
| (...skipping 2232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 7283 const String& str = String::Handle(pattern()); | 7318 const String& str = String::Handle(pattern()); |
| 7284 const char* format = "JSRegExp: pattern=%s flags=%s"; | 7319 const char* format = "JSRegExp: pattern=%s flags=%s"; |
| 7285 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); | 7320 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); |
| 7286 char* chars = reinterpret_cast<char*>( | 7321 char* chars = reinterpret_cast<char*>( |
| 7287 Isolate::Current()->current_zone()->Allocate(len + 1)); | 7322 Isolate::Current()->current_zone()->Allocate(len + 1)); |
| 7288 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); | 7323 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); |
| 7289 return chars; | 7324 return chars; |
| 7290 } | 7325 } |
| 7291 | 7326 |
| 7292 } // namespace dart | 7327 } // namespace dart |
| OLD | NEW |