| OLD | NEW | 
|    1 // Copyright 2015 the V8 project authors. All rights reserved. |    1 // Copyright 2015 the V8 project authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #include "src/factory.h" |    5 #include "src/factory.h" | 
|    6 #include "src/identity-map.h" |    6 #include "src/identity-map.h" | 
|    7 #include "src/isolate.h" |    7 #include "src/isolate.h" | 
|    8 #include "src/objects.h" |    8 #include "src/objects.h" | 
|    9 // FIXME(mstarzinger, marja): This is weird, but required because of the missing |    9 // FIXME(mstarzinger, marja): This is weird, but required because of the missing | 
|   10 // (disallowed) include: src/factory.h -> src/objects-inl.h |   10 // (disallowed) include: src/factory.h -> src/objects-inl.h | 
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  328   Handle<Object> num_keys[] = {t.num(2.1), t.num(2.4), t.num(3.3), t.num(4.3), |  328   Handle<Object> num_keys[] = {t.num(2.1), t.num(2.4), t.num(3.3), t.num(4.3), | 
|  329                                t.num(7.5), t.num(6.4), t.num(7.3), t.num(8.3), |  329                                t.num(7.5), t.num(6.4), t.num(7.3), t.num(8.3), | 
|  330                                t.num(8.9), t.num(10.4)}; |  330                                t.num(8.9), t.num(10.4)}; | 
|  331  |  331  | 
|  332   // Insert some objects that should be in new space. |  332   // Insert some objects that should be in new space. | 
|  333   for (size_t i = 0; i < arraysize(num_keys); i++) { |  333   for (size_t i = 0; i < arraysize(num_keys); i++) { | 
|  334     t.map.Set(num_keys[i], &num_keys[i]); |  334     t.map.Set(num_keys[i], &num_keys[i]); | 
|  335   } |  335   } | 
|  336  |  336  | 
|  337   // Do an explicit, real GC. |  337   // Do an explicit, real GC. | 
|  338   t.heap()->CollectGarbage(i::NEW_SPACE); |  338   t.heap()->CollectGarbage(i::NEW_SPACE, i::GarbageCollectionReason::kTesting); | 
|  339  |  339  | 
|  340   // Check that searching for the numbers finds the same values. |  340   // Check that searching for the numbers finds the same values. | 
|  341   for (size_t i = 0; i < arraysize(num_keys); i++) { |  341   for (size_t i = 0; i < arraysize(num_keys); i++) { | 
|  342     t.CheckFind(num_keys[i], &num_keys[i]); |  342     t.CheckFind(num_keys[i], &num_keys[i]); | 
|  343     t.CheckGet(num_keys[i], &num_keys[i]); |  343     t.CheckGet(num_keys[i], &num_keys[i]); | 
|  344   } |  344   } | 
|  345 } |  345 } | 
|  346  |  346  | 
|  347  |  347  | 
|  348 TEST(CanonicalHandleScope) { |  348 TEST(CanonicalHandleScope) { | 
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  380  |  380  | 
|  381   // Test ordinary heap objects. |  381   // Test ordinary heap objects. | 
|  382   Handle<HeapNumber> number1 = isolate->factory()->NewHeapNumber(3.3); |  382   Handle<HeapNumber> number1 = isolate->factory()->NewHeapNumber(3.3); | 
|  383   Handle<String> string1 = |  383   Handle<String> string1 = | 
|  384       isolate->factory()->NewStringFromAsciiChecked("test"); |  384       isolate->factory()->NewStringFromAsciiChecked("test"); | 
|  385   next_handle = isolate->handle_scope_data()->next; |  385   next_handle = isolate->handle_scope_data()->next; | 
|  386   Handle<HeapNumber> number2(*number1); |  386   Handle<HeapNumber> number2(*number1); | 
|  387   Handle<String> string2(*string1); |  387   Handle<String> string2(*string1); | 
|  388   CHECK_EQ(number1.location(), number2.location()); |  388   CHECK_EQ(number1.location(), number2.location()); | 
|  389   CHECK_EQ(string1.location(), string2.location()); |  389   CHECK_EQ(string1.location(), string2.location()); | 
|  390   heap->CollectAllGarbage(); |  390   CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); | 
|  391   Handle<HeapNumber> number3(*number2); |  391   Handle<HeapNumber> number3(*number2); | 
|  392   Handle<String> string3(*string2); |  392   Handle<String> string3(*string2); | 
|  393   CHECK_EQ(number1.location(), number3.location()); |  393   CHECK_EQ(number1.location(), number3.location()); | 
|  394   CHECK_EQ(string1.location(), string3.location()); |  394   CHECK_EQ(string1.location(), string3.location()); | 
|  395   // Check that no new handles have been allocated. |  395   // Check that no new handles have been allocated. | 
|  396   CHECK_EQ(next_handle, isolate->handle_scope_data()->next); |  396   CHECK_EQ(next_handle, isolate->handle_scope_data()->next); | 
|  397  |  397  | 
|  398   // Inner handle scope do not create canonical handles. |  398   // Inner handle scope do not create canonical handles. | 
|  399   { |  399   { | 
|  400     HandleScope inner(isolate); |  400     HandleScope inner(isolate); | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
|  419     CHECK_NE(string4.location(), string6.location()); |  419     CHECK_NE(string4.location(), string6.location()); | 
|  420     CHECK_NE(number1.location(), number6.location()); |  420     CHECK_NE(number1.location(), number6.location()); | 
|  421     CHECK_NE(string1.location(), string6.location()); |  421     CHECK_NE(string1.location(), string6.location()); | 
|  422     CHECK_EQ(number5.location(), number6.location()); |  422     CHECK_EQ(number5.location(), number6.location()); | 
|  423     CHECK_EQ(string5.location(), string6.location()); |  423     CHECK_EQ(string5.location(), string6.location()); | 
|  424   } |  424   } | 
|  425 } |  425 } | 
|  426  |  426  | 
|  427 }  // namespace internal |  427 }  // namespace internal | 
|  428 }  // namespace v8 |  428 }  // namespace v8 | 
| OLD | NEW |