| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 1057 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1068 | 1068 |
| 1069 | 1069 |
| 1070 void JSGlobalPropertyCell::set_value(Object* val, WriteBarrierMode ignored) { | 1070 void JSGlobalPropertyCell::set_value(Object* val, WriteBarrierMode ignored) { |
| 1071 // The write barrier is not used for global property cells. | 1071 // The write barrier is not used for global property cells. |
| 1072 ASSERT(!val->IsJSGlobalPropertyCell()); | 1072 ASSERT(!val->IsJSGlobalPropertyCell()); |
| 1073 WRITE_FIELD(this, kValueOffset, val); | 1073 WRITE_FIELD(this, kValueOffset, val); |
| 1074 } | 1074 } |
| 1075 | 1075 |
| 1076 | 1076 |
| 1077 int JSObject::GetHeaderSize() { | 1077 int JSObject::GetHeaderSize() { |
| 1078 switch (map()->instance_type()) { | 1078 InstanceType type = map()->instance_type(); |
| 1079 // Check for the most common kind of JavaScript object before |
| 1080 // falling into the generic switch. This speeds up the internal |
| 1081 // field operations considerably on average. |
| 1082 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; |
| 1083 switch (type) { |
| 1079 case JS_GLOBAL_PROXY_TYPE: | 1084 case JS_GLOBAL_PROXY_TYPE: |
| 1080 return JSGlobalProxy::kSize; | 1085 return JSGlobalProxy::kSize; |
| 1081 case JS_GLOBAL_OBJECT_TYPE: | 1086 case JS_GLOBAL_OBJECT_TYPE: |
| 1082 return JSGlobalObject::kSize; | 1087 return JSGlobalObject::kSize; |
| 1083 case JS_BUILTINS_OBJECT_TYPE: | 1088 case JS_BUILTINS_OBJECT_TYPE: |
| 1084 return JSBuiltinsObject::kSize; | 1089 return JSBuiltinsObject::kSize; |
| 1085 case JS_FUNCTION_TYPE: | 1090 case JS_FUNCTION_TYPE: |
| 1086 return JSFunction::kSize; | 1091 return JSFunction::kSize; |
| 1087 case JS_VALUE_TYPE: | 1092 case JS_VALUE_TYPE: |
| 1088 return JSValue::kSize; | 1093 return JSValue::kSize; |
| 1089 case JS_ARRAY_TYPE: | 1094 case JS_ARRAY_TYPE: |
| 1090 return JSValue::kSize; | 1095 return JSValue::kSize; |
| 1091 case JS_REGEXP_TYPE: | 1096 case JS_REGEXP_TYPE: |
| 1092 return JSValue::kSize; | 1097 return JSValue::kSize; |
| 1093 case JS_OBJECT_TYPE: | |
| 1094 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: | 1098 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: |
| 1095 return JSObject::kHeaderSize; | 1099 return JSObject::kHeaderSize; |
| 1096 default: | 1100 default: |
| 1097 UNREACHABLE(); | 1101 UNREACHABLE(); |
| 1098 return 0; | 1102 return 0; |
| 1099 } | 1103 } |
| 1100 } | 1104 } |
| 1101 | 1105 |
| 1102 | 1106 |
| 1103 int JSObject::GetInternalFieldCount() { | 1107 int JSObject::GetInternalFieldCount() { |
| (...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2765 #undef WRITE_INT_FIELD | 2769 #undef WRITE_INT_FIELD |
| 2766 #undef READ_SHORT_FIELD | 2770 #undef READ_SHORT_FIELD |
| 2767 #undef WRITE_SHORT_FIELD | 2771 #undef WRITE_SHORT_FIELD |
| 2768 #undef READ_BYTE_FIELD | 2772 #undef READ_BYTE_FIELD |
| 2769 #undef WRITE_BYTE_FIELD | 2773 #undef WRITE_BYTE_FIELD |
| 2770 | 2774 |
| 2771 | 2775 |
| 2772 } } // namespace v8::internal | 2776 } } // namespace v8::internal |
| 2773 | 2777 |
| 2774 #endif // V8_OBJECTS_INL_H_ | 2778 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |