| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 "var", | 588 "var", |
| 589 "void", | 589 "void", |
| 590 "volatile", | 590 "volatile", |
| 591 "while", | 591 "while", |
| 592 "with", | 592 "with", |
| 593 0 | 593 0 |
| 594 }; | 594 }; |
| 595 | 595 |
| 596 | 596 |
| 597 static void CheckInternalizedStrings(const char** strings) { | 597 static void CheckInternalizedStrings(const char** strings) { |
| 598 Factory* factory = CcTest::i_isolate()->factory(); | 598 Isolate* isolate = CcTest::i_isolate(); |
| 599 Factory* factory = isolate->factory(); |
| 599 for (const char* string = *strings; *strings != 0; string = *strings++) { | 600 for (const char* string = *strings; *strings != 0; string = *strings++) { |
| 600 Handle<String> a = factory->InternalizeUtf8String(string); | 601 HandleScope scope(isolate); |
| 602 Handle<String> a = |
| 603 isolate->factory()->InternalizeUtf8String(CStrVector(string)); |
| 604 // InternalizeUtf8String may return a failure if a GC is needed. |
| 601 CHECK(a->IsInternalizedString()); | 605 CHECK(a->IsInternalizedString()); |
| 602 Handle<String> b = factory->InternalizeUtf8String(string); | 606 Handle<String> b = factory->InternalizeUtf8String(string); |
| 603 CHECK_EQ(*b, *a); | 607 CHECK_EQ(*b, *a); |
| 604 CHECK(String::cast(*b)->IsUtf8EqualTo(CStrVector(string))); | 608 CHECK(b->IsUtf8EqualTo(CStrVector(string))); |
| 609 b = isolate->factory()->InternalizeUtf8String(CStrVector(string)); |
| 610 CHECK_EQ(*b, *a); |
| 611 CHECK(b->IsUtf8EqualTo(CStrVector(string))); |
| 605 } | 612 } |
| 606 } | 613 } |
| 607 | 614 |
| 608 | 615 |
| 609 TEST(StringTable) { | 616 TEST(StringTable) { |
| 610 CcTest::InitializeVM(); | 617 CcTest::InitializeVM(); |
| 611 | 618 |
| 612 v8::HandleScope sc(CcTest::isolate()); | 619 v8::HandleScope sc(CcTest::isolate()); |
| 613 CheckInternalizedStrings(not_so_random_string_table); | 620 CheckInternalizedStrings(not_so_random_string_table); |
| 614 CheckInternalizedStrings(not_so_random_string_table); | 621 CheckInternalizedStrings(not_so_random_string_table); |
| (...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 | 977 |
| 971 static int LenFromSize(int size) { | 978 static int LenFromSize(int size) { |
| 972 return (size - FixedArray::kHeaderSize) / kPointerSize; | 979 return (size - FixedArray::kHeaderSize) / kPointerSize; |
| 973 } | 980 } |
| 974 | 981 |
| 975 | 982 |
| 976 TEST(Regression39128) { | 983 TEST(Regression39128) { |
| 977 // Test case for crbug.com/39128. | 984 // Test case for crbug.com/39128. |
| 978 CcTest::InitializeVM(); | 985 CcTest::InitializeVM(); |
| 979 Isolate* isolate = CcTest::i_isolate(); | 986 Isolate* isolate = CcTest::i_isolate(); |
| 980 Heap* heap = isolate->heap(); | 987 TestHeap* heap = CcTest::test_heap(); |
| 981 | 988 |
| 982 // Increase the chance of 'bump-the-pointer' allocation in old space. | 989 // Increase the chance of 'bump-the-pointer' allocation in old space. |
| 983 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); | 990 heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); |
| 984 | 991 |
| 985 v8::HandleScope scope(CcTest::isolate()); | 992 v8::HandleScope scope(CcTest::isolate()); |
| 986 | 993 |
| 987 // The plan: create JSObject which references objects in new space. | 994 // The plan: create JSObject which references objects in new space. |
| 988 // Then clone this object (forcing it to go into old space) and check | 995 // Then clone this object (forcing it to go into old space) and check |
| 989 // that region dirty marks are updated correctly. | 996 // that region dirty marks are updated correctly. |
| 990 | 997 |
| (...skipping 3224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4215 "array;"); | 4222 "array;"); |
| 4216 | 4223 |
| 4217 Handle<JSObject> o = | 4224 Handle<JSObject> o = |
| 4218 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); | 4225 v8::Utils::OpenHandle(*v8::Handle<v8::Object>::Cast(result)); |
| 4219 CHECK(heap->InOldPointerSpace(o->elements())); | 4226 CHECK(heap->InOldPointerSpace(o->elements())); |
| 4220 CHECK(heap->InOldPointerSpace(*o)); | 4227 CHECK(heap->InOldPointerSpace(*o)); |
| 4221 Page* page = Page::FromAddress(o->elements()->address()); | 4228 Page* page = Page::FromAddress(o->elements()->address()); |
| 4222 CHECK(page->WasSwept() || | 4229 CHECK(page->WasSwept() || |
| 4223 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); | 4230 Marking::IsBlack(Marking::MarkBitFrom(o->elements()))); |
| 4224 } | 4231 } |
| OLD | NEW |