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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 | 646 |
647 template <> inline bool Is<JSFunction>(Object* obj) { | 647 template <> inline bool Is<JSFunction>(Object* obj) { |
648 return obj->IsJSFunction(); | 648 return obj->IsJSFunction(); |
649 } | 649 } |
650 | 650 |
651 | 651 |
652 TYPE_CHECKER(Code, CODE_TYPE) | 652 TYPE_CHECKER(Code, CODE_TYPE) |
653 TYPE_CHECKER(Oddball, ODDBALL_TYPE) | 653 TYPE_CHECKER(Oddball, ODDBALL_TYPE) |
654 TYPE_CHECKER(JSGlobalPropertyCell, JS_GLOBAL_PROPERTY_CELL_TYPE) | 654 TYPE_CHECKER(JSGlobalPropertyCell, JS_GLOBAL_PROPERTY_CELL_TYPE) |
655 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) | 655 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) |
| 656 TYPE_CHECKER(JSGeneratorIterator, JS_GENERATOR_ITERATOR_TYPE) |
656 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) | 657 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) |
657 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) | 658 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) |
658 TYPE_CHECKER(JSDate, JS_DATE_TYPE) | 659 TYPE_CHECKER(JSDate, JS_DATE_TYPE) |
659 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) | 660 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) |
660 | 661 |
661 | 662 |
662 bool Object::IsStringWrapper() { | 663 bool Object::IsStringWrapper() { |
663 return IsJSValue() && JSValue::cast(this)->value()->IsString(); | 664 return IsJSValue() && JSValue::cast(this)->value()->IsString(); |
664 } | 665 } |
665 | 666 |
(...skipping 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1540 } | 1541 } |
1541 | 1542 |
1542 | 1543 |
1543 int JSObject::GetHeaderSize() { | 1544 int JSObject::GetHeaderSize() { |
1544 InstanceType type = map()->instance_type(); | 1545 InstanceType type = map()->instance_type(); |
1545 // Check for the most common kind of JavaScript object before | 1546 // Check for the most common kind of JavaScript object before |
1546 // falling into the generic switch. This speeds up the internal | 1547 // falling into the generic switch. This speeds up the internal |
1547 // field operations considerably on average. | 1548 // field operations considerably on average. |
1548 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; | 1549 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; |
1549 switch (type) { | 1550 switch (type) { |
| 1551 case JS_GENERATOR_ITERATOR_TYPE: |
| 1552 return JSGeneratorIterator::kSize; |
1550 case JS_MODULE_TYPE: | 1553 case JS_MODULE_TYPE: |
1551 return JSModule::kSize; | 1554 return JSModule::kSize; |
1552 case JS_GLOBAL_PROXY_TYPE: | 1555 case JS_GLOBAL_PROXY_TYPE: |
1553 return JSGlobalProxy::kSize; | 1556 return JSGlobalProxy::kSize; |
1554 case JS_GLOBAL_OBJECT_TYPE: | 1557 case JS_GLOBAL_OBJECT_TYPE: |
1555 return JSGlobalObject::kSize; | 1558 return JSGlobalObject::kSize; |
1556 case JS_BUILTINS_OBJECT_TYPE: | 1559 case JS_BUILTINS_OBJECT_TYPE: |
1557 return JSBuiltinsObject::kSize; | 1560 return JSBuiltinsObject::kSize; |
1558 case JS_FUNCTION_TYPE: | 1561 case JS_FUNCTION_TYPE: |
1559 return JSFunction::kSize; | 1562 return JSFunction::kSize; |
(...skipping 3403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4963 Address Foreign::foreign_address() { | 4966 Address Foreign::foreign_address() { |
4964 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kForeignAddressOffset)); | 4967 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kForeignAddressOffset)); |
4965 } | 4968 } |
4966 | 4969 |
4967 | 4970 |
4968 void Foreign::set_foreign_address(Address value) { | 4971 void Foreign::set_foreign_address(Address value) { |
4969 WRITE_INTPTR_FIELD(this, kForeignAddressOffset, OffsetFrom(value)); | 4972 WRITE_INTPTR_FIELD(this, kForeignAddressOffset, OffsetFrom(value)); |
4970 } | 4973 } |
4971 | 4974 |
4972 | 4975 |
| 4976 ACCESSORS(JSGeneratorIterator, function, JSFunction, kFunctionOffset) |
| 4977 ACCESSORS(JSGeneratorIterator, context, Object, kContextOffset) |
| 4978 SMI_ACCESSORS(JSGeneratorIterator, continuation, kContinuationOffset) |
| 4979 ACCESSORS(JSGeneratorIterator, operand_stack, Object, kOperandStackOffset) |
| 4980 |
| 4981 |
| 4982 JSGeneratorIterator* JSGeneratorIterator::cast(Object* obj) { |
| 4983 ASSERT(obj->IsJSGeneratorIterator()); |
| 4984 ASSERT(HeapObject::cast(obj)->Size() == JSGeneratorIterator::kSize); |
| 4985 return reinterpret_cast<JSGeneratorIterator*>(obj); |
| 4986 } |
| 4987 |
| 4988 |
4973 ACCESSORS(JSModule, context, Object, kContextOffset) | 4989 ACCESSORS(JSModule, context, Object, kContextOffset) |
4974 ACCESSORS(JSModule, scope_info, ScopeInfo, kScopeInfoOffset) | 4990 ACCESSORS(JSModule, scope_info, ScopeInfo, kScopeInfoOffset) |
4975 | 4991 |
4976 | 4992 |
4977 JSModule* JSModule::cast(Object* obj) { | 4993 JSModule* JSModule::cast(Object* obj) { |
4978 ASSERT(obj->IsJSModule()); | 4994 ASSERT(obj->IsJSModule()); |
4979 ASSERT(HeapObject::cast(obj)->Size() == JSModule::kSize); | 4995 ASSERT(HeapObject::cast(obj)->Size() == JSModule::kSize); |
4980 return reinterpret_cast<JSModule*>(obj); | 4996 return reinterpret_cast<JSModule*>(obj); |
4981 } | 4997 } |
4982 | 4998 |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6042 #undef WRITE_UINT32_FIELD | 6058 #undef WRITE_UINT32_FIELD |
6043 #undef READ_SHORT_FIELD | 6059 #undef READ_SHORT_FIELD |
6044 #undef WRITE_SHORT_FIELD | 6060 #undef WRITE_SHORT_FIELD |
6045 #undef READ_BYTE_FIELD | 6061 #undef READ_BYTE_FIELD |
6046 #undef WRITE_BYTE_FIELD | 6062 #undef WRITE_BYTE_FIELD |
6047 | 6063 |
6048 | 6064 |
6049 } } // namespace v8::internal | 6065 } } // namespace v8::internal |
6050 | 6066 |
6051 #endif // V8_OBJECTS_INL_H_ | 6067 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |