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

Side by Side Diff: src/objects.cc

Issue 1272933004: [heap] Avoid inclusion of objects-visiting-inl.h header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 4 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 | « src/heap/objects-visiting-inl.h ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
11 #include "src/allocation-site-scopes.h" 11 #include "src/allocation-site-scopes.h"
12 #include "src/api.h" 12 #include "src/api.h"
13 #include "src/arguments.h" 13 #include "src/arguments.h"
14 #include "src/base/bits.h" 14 #include "src/base/bits.h"
15 #include "src/base/utils/random-number-generator.h" 15 #include "src/base/utils/random-number-generator.h"
16 #include "src/bootstrapper.h" 16 #include "src/bootstrapper.h"
17 #include "src/code-stubs.h" 17 #include "src/code-stubs.h"
18 #include "src/codegen.h" 18 #include "src/codegen.h"
19 #include "src/compilation-dependencies.h" 19 #include "src/compilation-dependencies.h"
20 #include "src/compiler.h" 20 #include "src/compiler.h"
21 #include "src/cpu-profiler.h" 21 #include "src/cpu-profiler.h"
22 #include "src/date.h" 22 #include "src/date.h"
23 #include "src/debug/debug.h" 23 #include "src/debug/debug.h"
24 #include "src/deoptimizer.h" 24 #include "src/deoptimizer.h"
25 #include "src/elements.h" 25 #include "src/elements.h"
26 #include "src/execution.h" 26 #include "src/execution.h"
27 #include "src/field-index-inl.h" 27 #include "src/field-index-inl.h"
28 #include "src/field-index.h" 28 #include "src/field-index.h"
29 #include "src/full-codegen/full-codegen.h" 29 #include "src/full-codegen/full-codegen.h"
30 #include "src/heap/objects-visiting-inl.h"
31 #include "src/hydrogen.h" 30 #include "src/hydrogen.h"
32 #include "src/ic/ic.h" 31 #include "src/ic/ic.h"
33 #include "src/interpreter/bytecodes.h" 32 #include "src/interpreter/bytecodes.h"
34 #include "src/log.h" 33 #include "src/log.h"
35 #include "src/lookup.h" 34 #include "src/lookup.h"
36 #include "src/macro-assembler.h" 35 #include "src/macro-assembler.h"
37 #include "src/messages.h" 36 #include "src/messages.h"
38 #include "src/objects-inl.h" 37 #include "src/objects-inl.h"
39 #include "src/prototype.h" 38 #include "src/prototype.h"
40 #include "src/safepoint-table.h" 39 #include "src/safepoint-table.h"
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after
1459 1458
1460 void HeapObject::Iterate(ObjectVisitor* v) { 1459 void HeapObject::Iterate(ObjectVisitor* v) {
1461 // Handle header 1460 // Handle header
1462 IteratePointer(v, kMapOffset); 1461 IteratePointer(v, kMapOffset);
1463 // Handle object body 1462 // Handle object body
1464 Map* m = map(); 1463 Map* m = map();
1465 IterateBody(m->instance_type(), SizeFromMap(m), v); 1464 IterateBody(m->instance_type(), SizeFromMap(m), v);
1466 } 1465 }
1467 1466
1468 1467
1469 void HeapObject::IterateBody(InstanceType type, int object_size,
1470 ObjectVisitor* v) {
1471 // Avoiding <Type>::cast(this) because it accesses the map pointer field.
1472 // During GC, the map pointer field is encoded.
1473 if (type < FIRST_NONSTRING_TYPE) {
1474 switch (type & kStringRepresentationMask) {
1475 case kSeqStringTag:
1476 break;
1477 case kConsStringTag:
1478 ConsString::BodyDescriptor::IterateBody(this, v);
1479 break;
1480 case kSlicedStringTag:
1481 SlicedString::BodyDescriptor::IterateBody(this, v);
1482 break;
1483 case kExternalStringTag:
1484 if ((type & kStringEncodingMask) == kOneByteStringTag) {
1485 reinterpret_cast<ExternalOneByteString*>(this)
1486 ->ExternalOneByteStringIterateBody(v);
1487 } else {
1488 reinterpret_cast<ExternalTwoByteString*>(this)->
1489 ExternalTwoByteStringIterateBody(v);
1490 }
1491 break;
1492 }
1493 return;
1494 }
1495
1496 switch (type) {
1497 case FIXED_ARRAY_TYPE:
1498 FixedArray::BodyDescriptor::IterateBody(this, object_size, v);
1499 break;
1500 case FIXED_DOUBLE_ARRAY_TYPE:
1501 break;
1502 case JS_OBJECT_TYPE:
1503 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1504 case JS_GENERATOR_OBJECT_TYPE:
1505 case JS_MODULE_TYPE:
1506 case JS_VALUE_TYPE:
1507 case JS_DATE_TYPE:
1508 case JS_ARRAY_TYPE:
1509 case JS_ARRAY_BUFFER_TYPE:
1510 case JS_TYPED_ARRAY_TYPE:
1511 case JS_DATA_VIEW_TYPE:
1512 case JS_SET_TYPE:
1513 case JS_MAP_TYPE:
1514 case JS_SET_ITERATOR_TYPE:
1515 case JS_MAP_ITERATOR_TYPE:
1516 case JS_WEAK_MAP_TYPE:
1517 case JS_WEAK_SET_TYPE:
1518 case JS_REGEXP_TYPE:
1519 case JS_GLOBAL_PROXY_TYPE:
1520 case JS_GLOBAL_OBJECT_TYPE:
1521 case JS_BUILTINS_OBJECT_TYPE:
1522 case JS_MESSAGE_OBJECT_TYPE:
1523 JSObject::BodyDescriptor::IterateBody(this, object_size, v);
1524 break;
1525 case JS_FUNCTION_TYPE:
1526 reinterpret_cast<JSFunction*>(this)
1527 ->JSFunctionIterateBody(object_size, v);
1528 break;
1529 case ODDBALL_TYPE:
1530 Oddball::BodyDescriptor::IterateBody(this, v);
1531 break;
1532 case JS_PROXY_TYPE:
1533 JSProxy::BodyDescriptor::IterateBody(this, v);
1534 break;
1535 case JS_FUNCTION_PROXY_TYPE:
1536 JSFunctionProxy::BodyDescriptor::IterateBody(this, v);
1537 break;
1538 case FOREIGN_TYPE:
1539 reinterpret_cast<Foreign*>(this)->ForeignIterateBody(v);
1540 break;
1541 case MAP_TYPE:
1542 Map::BodyDescriptor::IterateBody(this, v);
1543 break;
1544 case CODE_TYPE:
1545 reinterpret_cast<Code*>(this)->CodeIterateBody(v);
1546 break;
1547 case CELL_TYPE:
1548 Cell::BodyDescriptor::IterateBody(this, v);
1549 break;
1550 case PROPERTY_CELL_TYPE:
1551 PropertyCell::BodyDescriptor::IterateBody(this, v);
1552 break;
1553 case WEAK_CELL_TYPE:
1554 WeakCell::BodyDescriptor::IterateBody(this, v);
1555 break;
1556 case SYMBOL_TYPE:
1557 Symbol::BodyDescriptor::IterateBody(this, v);
1558 break;
1559
1560 case HEAP_NUMBER_TYPE:
1561 case MUTABLE_HEAP_NUMBER_TYPE:
1562 case SIMD128_VALUE_TYPE:
1563 case FILLER_TYPE:
1564 case BYTE_ARRAY_TYPE:
1565 case BYTECODE_ARRAY_TYPE:
1566 case FREE_SPACE_TYPE:
1567 break;
1568
1569 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
1570 case FIXED_##TYPE##_ARRAY_TYPE: \
1571 reinterpret_cast<FixedTypedArrayBase*>(this) \
1572 ->FixedTypedArrayBaseIterateBody(v); \
1573 break;
1574
1575
1576 TYPED_ARRAYS(TYPED_ARRAY_CASE)
1577 #undef TYPED_ARRAY_CASE
1578
1579 case SHARED_FUNCTION_INFO_TYPE: {
1580 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v);
1581 break;
1582 }
1583
1584 #define MAKE_STRUCT_CASE(NAME, Name, name) \
1585 case NAME##_TYPE:
1586 STRUCT_LIST(MAKE_STRUCT_CASE)
1587 #undef MAKE_STRUCT_CASE
1588 if (type == ALLOCATION_SITE_TYPE) {
1589 AllocationSite::BodyDescriptor::IterateBody(this, v);
1590 } else {
1591 StructBodyDescriptor::IterateBody(this, object_size, v);
1592 }
1593 break;
1594 default:
1595 PrintF("Unknown type: %d\n", type);
1596 UNREACHABLE();
1597 }
1598 }
1599
1600
1601 bool HeapNumber::HeapNumberBooleanValue() { 1468 bool HeapNumber::HeapNumberBooleanValue() {
1602 return DoubleToBoolean(value()); 1469 return DoubleToBoolean(value());
1603 } 1470 }
1604 1471
1605 1472
1606 void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT 1473 void HeapNumber::HeapNumberPrint(std::ostream& os) { // NOLINT
1607 os << value(); 1474 os << value();
1608 } 1475 }
1609 1476
1610 1477
(...skipping 14252 matching lines...) Expand 10 before | Expand all | Expand 10 after
15863 if (cell->value() != *new_value) { 15730 if (cell->value() != *new_value) {
15864 cell->set_value(*new_value); 15731 cell->set_value(*new_value);
15865 Isolate* isolate = cell->GetIsolate(); 15732 Isolate* isolate = cell->GetIsolate();
15866 cell->dependent_code()->DeoptimizeDependentCodeGroup( 15733 cell->dependent_code()->DeoptimizeDependentCodeGroup(
15867 isolate, DependentCode::kPropertyCellChangedGroup); 15734 isolate, DependentCode::kPropertyCellChangedGroup);
15868 } 15735 }
15869 } 15736 }
15870 15737
15871 } // namespace internal 15738 } // namespace internal
15872 } // namespace v8 15739 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/objects-visiting-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698