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(JSGeneratorObject, JS_GENERATOR_OBJECT_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 911 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1577 } | 1578 } |
1578 | 1579 |
1579 | 1580 |
1580 int JSObject::GetHeaderSize() { | 1581 int JSObject::GetHeaderSize() { |
1581 InstanceType type = map()->instance_type(); | 1582 InstanceType type = map()->instance_type(); |
1582 // Check for the most common kind of JavaScript object before | 1583 // Check for the most common kind of JavaScript object before |
1583 // falling into the generic switch. This speeds up the internal | 1584 // falling into the generic switch. This speeds up the internal |
1584 // field operations considerably on average. | 1585 // field operations considerably on average. |
1585 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; | 1586 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; |
1586 switch (type) { | 1587 switch (type) { |
| 1588 case JS_GENERATOR_OBJECT_TYPE: |
| 1589 return JSGeneratorObject::kSize; |
1587 case JS_MODULE_TYPE: | 1590 case JS_MODULE_TYPE: |
1588 return JSModule::kSize; | 1591 return JSModule::kSize; |
1589 case JS_GLOBAL_PROXY_TYPE: | 1592 case JS_GLOBAL_PROXY_TYPE: |
1590 return JSGlobalProxy::kSize; | 1593 return JSGlobalProxy::kSize; |
1591 case JS_GLOBAL_OBJECT_TYPE: | 1594 case JS_GLOBAL_OBJECT_TYPE: |
1592 return JSGlobalObject::kSize; | 1595 return JSGlobalObject::kSize; |
1593 case JS_BUILTINS_OBJECT_TYPE: | 1596 case JS_BUILTINS_OBJECT_TYPE: |
1594 return JSBuiltinsObject::kSize; | 1597 return JSBuiltinsObject::kSize; |
1595 case JS_FUNCTION_TYPE: | 1598 case JS_FUNCTION_TYPE: |
1596 return JSFunction::kSize; | 1599 return JSFunction::kSize; |
(...skipping 3406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5003 Address Foreign::foreign_address() { | 5006 Address Foreign::foreign_address() { |
5004 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kForeignAddressOffset)); | 5007 return AddressFrom<Address>(READ_INTPTR_FIELD(this, kForeignAddressOffset)); |
5005 } | 5008 } |
5006 | 5009 |
5007 | 5010 |
5008 void Foreign::set_foreign_address(Address value) { | 5011 void Foreign::set_foreign_address(Address value) { |
5009 WRITE_INTPTR_FIELD(this, kForeignAddressOffset, OffsetFrom(value)); | 5012 WRITE_INTPTR_FIELD(this, kForeignAddressOffset, OffsetFrom(value)); |
5010 } | 5013 } |
5011 | 5014 |
5012 | 5015 |
| 5016 ACCESSORS(JSGeneratorObject, function, JSFunction, kFunctionOffset) |
| 5017 ACCESSORS(JSGeneratorObject, context, Object, kContextOffset) |
| 5018 SMI_ACCESSORS(JSGeneratorObject, continuation, kContinuationOffset) |
| 5019 ACCESSORS(JSGeneratorObject, operand_stack, FixedArray, kOperandStackOffset) |
| 5020 |
| 5021 |
| 5022 JSGeneratorObject* JSGeneratorObject::cast(Object* obj) { |
| 5023 ASSERT(obj->IsJSGeneratorObject()); |
| 5024 ASSERT(HeapObject::cast(obj)->Size() == JSGeneratorObject::kSize); |
| 5025 return reinterpret_cast<JSGeneratorObject*>(obj); |
| 5026 } |
| 5027 |
| 5028 |
5013 ACCESSORS(JSModule, context, Object, kContextOffset) | 5029 ACCESSORS(JSModule, context, Object, kContextOffset) |
5014 ACCESSORS(JSModule, scope_info, ScopeInfo, kScopeInfoOffset) | 5030 ACCESSORS(JSModule, scope_info, ScopeInfo, kScopeInfoOffset) |
5015 | 5031 |
5016 | 5032 |
5017 JSModule* JSModule::cast(Object* obj) { | 5033 JSModule* JSModule::cast(Object* obj) { |
5018 ASSERT(obj->IsJSModule()); | 5034 ASSERT(obj->IsJSModule()); |
5019 ASSERT(HeapObject::cast(obj)->Size() == JSModule::kSize); | 5035 ASSERT(HeapObject::cast(obj)->Size() == JSModule::kSize); |
5020 return reinterpret_cast<JSModule*>(obj); | 5036 return reinterpret_cast<JSModule*>(obj); |
5021 } | 5037 } |
5022 | 5038 |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6082 #undef WRITE_UINT32_FIELD | 6098 #undef WRITE_UINT32_FIELD |
6083 #undef READ_SHORT_FIELD | 6099 #undef READ_SHORT_FIELD |
6084 #undef WRITE_SHORT_FIELD | 6100 #undef WRITE_SHORT_FIELD |
6085 #undef READ_BYTE_FIELD | 6101 #undef READ_BYTE_FIELD |
6086 #undef WRITE_BYTE_FIELD | 6102 #undef WRITE_BYTE_FIELD |
6087 | 6103 |
6088 | 6104 |
6089 } } // namespace v8::internal | 6105 } } // namespace v8::internal |
6090 | 6106 |
6091 #endif // V8_OBJECTS_INL_H_ | 6107 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |