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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE) | 661 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE) |
662 | 662 |
663 | 663 |
664 template <> inline bool Is<JSFunction>(Object* obj) { | 664 template <> inline bool Is<JSFunction>(Object* obj) { |
665 return obj->IsJSFunction(); | 665 return obj->IsJSFunction(); |
666 } | 666 } |
667 | 667 |
668 | 668 |
669 TYPE_CHECKER(Code, CODE_TYPE) | 669 TYPE_CHECKER(Code, CODE_TYPE) |
670 TYPE_CHECKER(Oddball, ODDBALL_TYPE) | 670 TYPE_CHECKER(Oddball, ODDBALL_TYPE) |
671 TYPE_CHECKER(JSGlobalPropertyCell, JS_GLOBAL_PROPERTY_CELL_TYPE) | 671 TYPE_CHECKER(Cell, CELL_TYPE) |
| 672 TYPE_CHECKER(JSGlobalPropertyCell, PROPERTY_CELL_TYPE) |
672 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) | 673 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) |
673 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) | 674 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) |
674 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) | 675 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) |
675 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) | 676 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) |
676 TYPE_CHECKER(JSDate, JS_DATE_TYPE) | 677 TYPE_CHECKER(JSDate, JS_DATE_TYPE) |
677 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) | 678 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) |
678 | 679 |
679 | 680 |
680 bool Object::IsStringWrapper() { | 681 bool Object::IsStringWrapper() { |
681 return IsJSValue() && JSValue::cast(this)->value()->IsString(); | 682 return IsJSValue() && JSValue::cast(this)->value()->IsString(); |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1614 byte Oddball::kind() { | 1615 byte Oddball::kind() { |
1615 return Smi::cast(READ_FIELD(this, kKindOffset))->value(); | 1616 return Smi::cast(READ_FIELD(this, kKindOffset))->value(); |
1616 } | 1617 } |
1617 | 1618 |
1618 | 1619 |
1619 void Oddball::set_kind(byte value) { | 1620 void Oddball::set_kind(byte value) { |
1620 WRITE_FIELD(this, kKindOffset, Smi::FromInt(value)); | 1621 WRITE_FIELD(this, kKindOffset, Smi::FromInt(value)); |
1621 } | 1622 } |
1622 | 1623 |
1623 | 1624 |
1624 Object* JSGlobalPropertyCell::value() { | 1625 Object* Cell::value() { |
1625 return READ_FIELD(this, kValueOffset); | 1626 return READ_FIELD(this, kValueOffset); |
1626 } | 1627 } |
1627 | 1628 |
1628 | 1629 |
1629 void JSGlobalPropertyCell::set_value(Object* val, WriteBarrierMode ignored) { | 1630 void Cell::set_value(Object* val, WriteBarrierMode ignored) { |
1630 // The write barrier is not used for global property cells. | 1631 // The write barrier is not used for global property cells. |
1631 ASSERT(!val->IsJSGlobalPropertyCell()); | 1632 ASSERT(!val->IsJSGlobalPropertyCell() && !val->IsCell()); |
1632 WRITE_FIELD(this, kValueOffset, val); | 1633 WRITE_FIELD(this, kValueOffset, val); |
1633 } | 1634 } |
1634 | 1635 |
1635 | 1636 |
| 1637 Object* JSGlobalPropertyCell::type_raw() { |
| 1638 return READ_FIELD(this, kTypeOffset); |
| 1639 } |
| 1640 |
| 1641 |
| 1642 void JSGlobalPropertyCell::set_type_raw(Object* val, WriteBarrierMode ignored) { |
| 1643 WRITE_FIELD(this, kTypeOffset, val); |
| 1644 } |
| 1645 |
| 1646 |
1636 int JSObject::GetHeaderSize() { | 1647 int JSObject::GetHeaderSize() { |
1637 InstanceType type = map()->instance_type(); | 1648 InstanceType type = map()->instance_type(); |
1638 // Check for the most common kind of JavaScript object before | 1649 // Check for the most common kind of JavaScript object before |
1639 // falling into the generic switch. This speeds up the internal | 1650 // falling into the generic switch. This speeds up the internal |
1640 // field operations considerably on average. | 1651 // field operations considerably on average. |
1641 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; | 1652 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; |
1642 switch (type) { | 1653 switch (type) { |
1643 case JS_GENERATOR_OBJECT_TYPE: | 1654 case JS_GENERATOR_OBJECT_TYPE: |
1644 return JSGeneratorObject::kSize; | 1655 return JSGeneratorObject::kSize; |
1645 case JS_MODULE_TYPE: | 1656 case JS_MODULE_TYPE: |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2545 CAST_ACCESSOR(ExternalAsciiString) | 2556 CAST_ACCESSOR(ExternalAsciiString) |
2546 CAST_ACCESSOR(ExternalTwoByteString) | 2557 CAST_ACCESSOR(ExternalTwoByteString) |
2547 CAST_ACCESSOR(Symbol) | 2558 CAST_ACCESSOR(Symbol) |
2548 CAST_ACCESSOR(Name) | 2559 CAST_ACCESSOR(Name) |
2549 CAST_ACCESSOR(JSReceiver) | 2560 CAST_ACCESSOR(JSReceiver) |
2550 CAST_ACCESSOR(JSObject) | 2561 CAST_ACCESSOR(JSObject) |
2551 CAST_ACCESSOR(Smi) | 2562 CAST_ACCESSOR(Smi) |
2552 CAST_ACCESSOR(HeapObject) | 2563 CAST_ACCESSOR(HeapObject) |
2553 CAST_ACCESSOR(HeapNumber) | 2564 CAST_ACCESSOR(HeapNumber) |
2554 CAST_ACCESSOR(Oddball) | 2565 CAST_ACCESSOR(Oddball) |
| 2566 CAST_ACCESSOR(Cell) |
2555 CAST_ACCESSOR(JSGlobalPropertyCell) | 2567 CAST_ACCESSOR(JSGlobalPropertyCell) |
2556 CAST_ACCESSOR(SharedFunctionInfo) | 2568 CAST_ACCESSOR(SharedFunctionInfo) |
2557 CAST_ACCESSOR(Map) | 2569 CAST_ACCESSOR(Map) |
2558 CAST_ACCESSOR(JSFunction) | 2570 CAST_ACCESSOR(JSFunction) |
2559 CAST_ACCESSOR(GlobalObject) | 2571 CAST_ACCESSOR(GlobalObject) |
2560 CAST_ACCESSOR(JSGlobalProxy) | 2572 CAST_ACCESSOR(JSGlobalProxy) |
2561 CAST_ACCESSOR(JSGlobalObject) | 2573 CAST_ACCESSOR(JSGlobalObject) |
2562 CAST_ACCESSOR(JSBuiltinsObject) | 2574 CAST_ACCESSOR(JSBuiltinsObject) |
2563 CAST_ACCESSOR(Code) | 2575 CAST_ACCESSOR(Code) |
2564 CAST_ACCESSOR(JSArray) | 2576 CAST_ACCESSOR(JSArray) |
(...skipping 3448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6013 void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) { | 6025 void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) { |
6014 set(1 + index * 2, Smi::FromInt(id.ToInt())); | 6026 set(1 + index * 2, Smi::FromInt(id.ToInt())); |
6015 } | 6027 } |
6016 | 6028 |
6017 | 6029 |
6018 TypeFeedbackId TypeFeedbackCells::AstId(int index) { | 6030 TypeFeedbackId TypeFeedbackCells::AstId(int index) { |
6019 return TypeFeedbackId(Smi::cast(get(1 + index * 2))->value()); | 6031 return TypeFeedbackId(Smi::cast(get(1 + index * 2))->value()); |
6020 } | 6032 } |
6021 | 6033 |
6022 | 6034 |
6023 void TypeFeedbackCells::SetCell(int index, JSGlobalPropertyCell* cell) { | 6035 void TypeFeedbackCells::SetCell(int index, Cell* cell) { |
6024 set(index * 2, cell); | 6036 set(index * 2, cell); |
6025 } | 6037 } |
6026 | 6038 |
6027 | 6039 |
6028 JSGlobalPropertyCell* TypeFeedbackCells::Cell(int index) { | 6040 Cell* TypeFeedbackCells::GetCell(int index) { |
6029 return JSGlobalPropertyCell::cast(get(index * 2)); | 6041 return Cell::cast(get(index * 2)); |
6030 } | 6042 } |
6031 | 6043 |
6032 | 6044 |
6033 Handle<Object> TypeFeedbackCells::UninitializedSentinel(Isolate* isolate) { | 6045 Handle<Object> TypeFeedbackCells::UninitializedSentinel(Isolate* isolate) { |
6034 return isolate->factory()->the_hole_value(); | 6046 return isolate->factory()->the_hole_value(); |
6035 } | 6047 } |
6036 | 6048 |
6037 | 6049 |
6038 Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) { | 6050 Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) { |
6039 return isolate->factory()->undefined_value(); | 6051 return isolate->factory()->undefined_value(); |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6240 #undef WRITE_UINT32_FIELD | 6252 #undef WRITE_UINT32_FIELD |
6241 #undef READ_SHORT_FIELD | 6253 #undef READ_SHORT_FIELD |
6242 #undef WRITE_SHORT_FIELD | 6254 #undef WRITE_SHORT_FIELD |
6243 #undef READ_BYTE_FIELD | 6255 #undef READ_BYTE_FIELD |
6244 #undef WRITE_BYTE_FIELD | 6256 #undef WRITE_BYTE_FIELD |
6245 | 6257 |
6246 | 6258 |
6247 } } // namespace v8::internal | 6259 } } // namespace v8::internal |
6248 | 6260 |
6249 #endif // V8_OBJECTS_INL_H_ | 6261 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |