Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(314)

Side by Side Diff: test/cctest/test-unboxed-doubles.cc

Issue 1612323003: Introduce {FAST,SLOW}_STRING_WRAPPER_ELEMENTS (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: one more DCHECK fix Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/cctest/test-inobject-slack-tracking.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 <stdlib.h> 5 #include <stdlib.h>
6 #include <utility> 6 #include <utility>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 CHECK(field_index.is_inobject() && field_index.is_double()); 1053 CHECK(field_index.is_inobject() && field_index.is_double());
1054 CHECK_EQ(FLAG_unbox_double_fields, map->IsUnboxedDoubleField(field_index)); 1054 CHECK_EQ(FLAG_unbox_double_fields, map->IsUnboxedDoubleField(field_index));
1055 CHECK_EQ(42.5, GetDoubleFieldValue(*obj, field_index)); 1055 CHECK_EQ(42.5, GetDoubleFieldValue(*obj, field_index));
1056 } 1056 }
1057 CHECK(isolate->heap()->new_space()->Contains(*obj)); 1057 CHECK(isolate->heap()->new_space()->Contains(*obj));
1058 1058
1059 // Do scavenge so that |obj| is moved to survivor space. 1059 // Do scavenge so that |obj| is moved to survivor space.
1060 CcTest::heap()->CollectGarbage(i::NEW_SPACE); 1060 CcTest::heap()->CollectGarbage(i::NEW_SPACE);
1061 1061
1062 // Create temp object in the new space. 1062 // Create temp object in the new space.
1063 Handle<JSArray> temp = factory->NewJSArray(FAST_ELEMENTS); 1063 Handle<JSArray> temp = factory->NewJSArray(0, FAST_ELEMENTS);
1064 CHECK(isolate->heap()->new_space()->Contains(*temp)); 1064 CHECK(isolate->heap()->new_space()->Contains(*temp));
1065 1065
1066 // Construct a double value that looks like a pointer to the new space object 1066 // Construct a double value that looks like a pointer to the new space object
1067 // and store it into the obj. 1067 // and store it into the obj.
1068 Address fake_object = reinterpret_cast<Address>(*temp) + kPointerSize; 1068 Address fake_object = reinterpret_cast<Address>(*temp) + kPointerSize;
1069 double boom_value = bit_cast<double>(fake_object); 1069 double boom_value = bit_cast<double>(fake_object);
1070 1070
1071 FieldIndex field_index = FieldIndex::ForDescriptor(obj->map(), 0); 1071 FieldIndex field_index = FieldIndex::ForDescriptor(obj->map(), 0);
1072 Handle<HeapNumber> boom_number = factory->NewHeapNumber(boom_value, MUTABLE); 1072 Handle<HeapNumber> boom_number = factory->NewHeapNumber(boom_value, MUTABLE);
1073 obj->FastPropertyAtPut(field_index, *boom_number); 1073 obj->FastPropertyAtPut(field_index, *boom_number);
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 } 1392 }
1393 CHECK(isolate->heap()->new_space()->Contains(*obj)); 1393 CHECK(isolate->heap()->new_space()->Contains(*obj));
1394 1394
1395 // Trigger GCs so that the newly allocated object moves to old gen. 1395 // Trigger GCs so that the newly allocated object moves to old gen.
1396 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now 1396 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now
1397 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now 1397 CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now
1398 1398
1399 CHECK(isolate->heap()->old_space()->Contains(*obj)); 1399 CHECK(isolate->heap()->old_space()->Contains(*obj));
1400 1400
1401 // Create temp object in the new space. 1401 // Create temp object in the new space.
1402 Handle<JSArray> temp = factory->NewJSArray(FAST_ELEMENTS); 1402 Handle<JSArray> temp = factory->NewJSArray(0, FAST_ELEMENTS);
1403 CHECK(isolate->heap()->new_space()->Contains(*temp)); 1403 CHECK(isolate->heap()->new_space()->Contains(*temp));
1404 1404
1405 // Construct a double value that looks like a pointer to the new space object 1405 // Construct a double value that looks like a pointer to the new space object
1406 // and store it into the obj. 1406 // and store it into the obj.
1407 Address fake_object = reinterpret_cast<Address>(*temp) + kPointerSize; 1407 Address fake_object = reinterpret_cast<Address>(*temp) + kPointerSize;
1408 double boom_value = bit_cast<double>(fake_object); 1408 double boom_value = bit_cast<double>(fake_object);
1409 1409
1410 FieldIndex field_index = FieldIndex::ForDescriptor(obj->map(), 0); 1410 FieldIndex field_index = FieldIndex::ForDescriptor(obj->map(), 0);
1411 Handle<HeapNumber> boom_number = factory->NewHeapNumber(boom_value, MUTABLE); 1411 Handle<HeapNumber> boom_number = factory->NewHeapNumber(boom_value, MUTABLE);
1412 obj->FastPropertyAtPut(field_index, *boom_number); 1412 obj->FastPropertyAtPut(field_index, *boom_number);
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
1622 1622
1623 // TODO(ishell): add respective tests for property kind reconfiguring from 1623 // TODO(ishell): add respective tests for property kind reconfiguring from
1624 // accessor field to double, once accessor fields are supported by 1624 // accessor field to double, once accessor fields are supported by
1625 // Map::ReconfigureProperty(). 1625 // Map::ReconfigureProperty().
1626 1626
1627 1627
1628 // TODO(ishell): add respective tests for fast property removal case once 1628 // TODO(ishell): add respective tests for fast property removal case once
1629 // Map::ReconfigureProperty() supports that. 1629 // Map::ReconfigureProperty() supports that.
1630 1630
1631 #endif 1631 #endif
OLDNEW
« no previous file with comments | « test/cctest/test-inobject-slack-tracking.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698