| 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 5302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5313 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize); | 5313 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize); |
| 5314 return reinterpret_cast<JSMessageObject*>(obj); | 5314 return reinterpret_cast<JSMessageObject*>(obj); |
| 5315 } | 5315 } |
| 5316 | 5316 |
| 5317 | 5317 |
| 5318 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) | 5318 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) |
| 5319 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) | 5319 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) |
| 5320 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) | 5320 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) |
| 5321 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) | 5321 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) |
| 5322 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) | 5322 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) |
| 5323 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset) |
| 5323 | 5324 |
| 5324 | 5325 |
| 5325 // Type feedback slot: type_feedback_info for FUNCTIONs, stub_info for STUBs. | 5326 void Code::WipeOutHeader() { |
| 5326 void Code::InitializeTypeFeedbackInfoNoWriteBarrier(Object* value) { | 5327 WRITE_FIELD(this, kRelocationInfoOffset, NULL); |
| 5327 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); | 5328 WRITE_FIELD(this, kHandlerTableOffset, NULL); |
| 5329 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL); |
| 5330 // Do not wipe out e.g. a minor key. |
| 5331 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) { |
| 5332 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL); |
| 5333 } |
| 5328 } | 5334 } |
| 5329 | 5335 |
| 5330 | 5336 |
| 5331 Object* Code::type_feedback_info() { | 5337 Object* Code::type_feedback_info() { |
| 5332 ASSERT(kind() == FUNCTION); | 5338 ASSERT(kind() == FUNCTION); |
| 5333 return Object::cast(READ_FIELD(this, kTypeFeedbackInfoOffset)); | 5339 return raw_type_feedback_info(); |
| 5334 } | 5340 } |
| 5335 | 5341 |
| 5336 | 5342 |
| 5337 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { | 5343 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { |
| 5338 ASSERT(kind() == FUNCTION); | 5344 ASSERT(kind() == FUNCTION); |
| 5339 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); | 5345 set_raw_type_feedback_info(value, mode); |
| 5340 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, | 5346 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, |
| 5341 value, mode); | 5347 value, mode); |
| 5342 } | 5348 } |
| 5343 | 5349 |
| 5344 | 5350 |
| 5345 Object* Code::next_code_link() { | 5351 Object* Code::next_code_link() { |
| 5346 CHECK(kind() == OPTIMIZED_FUNCTION); | 5352 CHECK(kind() == OPTIMIZED_FUNCTION); |
| 5347 return Object::cast(READ_FIELD(this, kTypeFeedbackInfoOffset)); | 5353 return raw_type_feedback_info(); |
| 5348 } | 5354 } |
| 5349 | 5355 |
| 5350 | 5356 |
| 5351 void Code::set_next_code_link(Object* value, WriteBarrierMode mode) { | 5357 void Code::set_next_code_link(Object* value, WriteBarrierMode mode) { |
| 5352 CHECK(kind() == OPTIMIZED_FUNCTION); | 5358 CHECK(kind() == OPTIMIZED_FUNCTION); |
| 5353 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); | 5359 set_raw_type_feedback_info(value); |
| 5354 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, | 5360 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, |
| 5355 value, mode); | 5361 value, mode); |
| 5356 } | 5362 } |
| 5357 | 5363 |
| 5358 | 5364 |
| 5359 int Code::stub_info() { | 5365 int Code::stub_info() { |
| 5360 ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC || | 5366 ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC || |
| 5361 kind() == BINARY_OP_IC || kind() == LOAD_IC); | 5367 kind() == BINARY_OP_IC || kind() == LOAD_IC); |
| 5362 Object* value = READ_FIELD(this, kTypeFeedbackInfoOffset); | 5368 return Smi::cast(raw_type_feedback_info())->value(); |
| 5363 return Smi::cast(value)->value(); | |
| 5364 } | 5369 } |
| 5365 | 5370 |
| 5366 | 5371 |
| 5367 void Code::set_stub_info(int value) { | 5372 void Code::set_stub_info(int value) { |
| 5368 ASSERT(kind() == COMPARE_IC || | 5373 ASSERT(kind() == COMPARE_IC || |
| 5369 kind() == COMPARE_NIL_IC || | 5374 kind() == COMPARE_NIL_IC || |
| 5370 kind() == BINARY_OP_IC || | 5375 kind() == BINARY_OP_IC || |
| 5371 kind() == STUB || | 5376 kind() == STUB || |
| 5372 kind() == LOAD_IC || | 5377 kind() == LOAD_IC || |
| 5373 kind() == KEYED_LOAD_IC || | 5378 kind() == KEYED_LOAD_IC || |
| 5374 kind() == STORE_IC || | 5379 kind() == STORE_IC || |
| 5375 kind() == KEYED_STORE_IC); | 5380 kind() == KEYED_STORE_IC); |
| 5376 WRITE_FIELD(this, kTypeFeedbackInfoOffset, Smi::FromInt(value)); | 5381 set_raw_type_feedback_info(Smi::FromInt(value)); |
| 5377 } | 5382 } |
| 5378 | 5383 |
| 5379 | 5384 |
| 5380 ACCESSORS(Code, gc_metadata, Object, kGCMetadataOffset) | 5385 ACCESSORS(Code, gc_metadata, Object, kGCMetadataOffset) |
| 5381 INT_ACCESSORS(Code, ic_age, kICAgeOffset) | 5386 INT_ACCESSORS(Code, ic_age, kICAgeOffset) |
| 5382 | 5387 |
| 5383 | 5388 |
| 5384 byte* Code::instruction_start() { | 5389 byte* Code::instruction_start() { |
| 5385 return FIELD_ADDR(this, kHeaderSize); | 5390 return FIELD_ADDR(this, kHeaderSize); |
| 5386 } | 5391 } |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5839 if (IsJSGlobalProxy()) { | 5844 if (IsJSGlobalProxy()) { |
| 5840 Object* proto = GetPrototype(); | 5845 Object* proto = GetPrototype(); |
| 5841 if (proto->IsNull()) return GetHeap()->undefined_value(); | 5846 if (proto->IsNull()) return GetHeap()->undefined_value(); |
| 5842 ASSERT(proto->IsJSGlobalObject()); | 5847 ASSERT(proto->IsJSGlobalObject()); |
| 5843 return proto; | 5848 return proto; |
| 5844 } | 5849 } |
| 5845 return this; | 5850 return this; |
| 5846 } | 5851 } |
| 5847 | 5852 |
| 5848 | 5853 |
| 5849 MaybeObject* JSReceiver::GetIdentityHash(CreationFlag flag) { | 5854 Handle<Object> JSReceiver::GetOrCreateIdentityHash(Handle<JSReceiver> object) { |
| 5850 return IsJSProxy() | 5855 return object->IsJSProxy() |
| 5851 ? JSProxy::cast(this)->GetIdentityHash(flag) | 5856 ? JSProxy::GetOrCreateIdentityHash(Handle<JSProxy>::cast(object)) |
| 5852 : JSObject::cast(this)->GetIdentityHash(flag); | 5857 : JSObject::GetOrCreateIdentityHash(Handle<JSObject>::cast(object)); |
| 5853 } | 5858 } |
| 5854 | 5859 |
| 5855 | 5860 |
| 5861 Object* JSReceiver::GetIdentityHash() { |
| 5862 return IsJSProxy() |
| 5863 ? JSProxy::cast(this)->GetIdentityHash() |
| 5864 : JSObject::cast(this)->GetIdentityHash(); |
| 5865 } |
| 5866 |
| 5867 |
| 5856 bool JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { | 5868 bool JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { |
| 5857 if (object->IsJSProxy()) { | 5869 if (object->IsJSProxy()) { |
| 5858 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); | 5870 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); |
| 5859 return JSProxy::HasElementWithHandler(proxy, index); | 5871 return JSProxy::HasElementWithHandler(proxy, index); |
| 5860 } | 5872 } |
| 5861 return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( | 5873 return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( |
| 5862 *object, index, true) != ABSENT; | 5874 *object, index, true) != ABSENT; |
| 5863 } | 5875 } |
| 5864 | 5876 |
| 5865 | 5877 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6042 | 6054 |
| 6043 | 6055 |
| 6044 template <int entrysize> | 6056 template <int entrysize> |
| 6045 bool ObjectHashTableShape<entrysize>::IsMatch(Object* key, Object* other) { | 6057 bool ObjectHashTableShape<entrysize>::IsMatch(Object* key, Object* other) { |
| 6046 return key->SameValue(other); | 6058 return key->SameValue(other); |
| 6047 } | 6059 } |
| 6048 | 6060 |
| 6049 | 6061 |
| 6050 template <int entrysize> | 6062 template <int entrysize> |
| 6051 uint32_t ObjectHashTableShape<entrysize>::Hash(Object* key) { | 6063 uint32_t ObjectHashTableShape<entrysize>::Hash(Object* key) { |
| 6052 MaybeObject* maybe_hash = key->GetHash(OMIT_CREATION); | 6064 return Smi::cast(key->GetHash())->value(); |
| 6053 return Smi::cast(maybe_hash->ToObjectChecked())->value(); | |
| 6054 } | 6065 } |
| 6055 | 6066 |
| 6056 | 6067 |
| 6057 template <int entrysize> | 6068 template <int entrysize> |
| 6058 uint32_t ObjectHashTableShape<entrysize>::HashForObject(Object* key, | 6069 uint32_t ObjectHashTableShape<entrysize>::HashForObject(Object* key, |
| 6059 Object* other) { | 6070 Object* other) { |
| 6060 MaybeObject* maybe_hash = other->GetHash(OMIT_CREATION); | 6071 return Smi::cast(other->GetHash())->value(); |
| 6061 return Smi::cast(maybe_hash->ToObjectChecked())->value(); | |
| 6062 } | 6072 } |
| 6063 | 6073 |
| 6064 | 6074 |
| 6065 template <int entrysize> | 6075 template <int entrysize> |
| 6066 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Heap* heap, | 6076 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Heap* heap, |
| 6067 Object* key) { | 6077 Object* key) { |
| 6068 return key; | 6078 return key; |
| 6069 } | 6079 } |
| 6070 | 6080 |
| 6071 | 6081 |
| (...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6400 #undef WRITE_UINT32_FIELD | 6410 #undef WRITE_UINT32_FIELD |
| 6401 #undef READ_SHORT_FIELD | 6411 #undef READ_SHORT_FIELD |
| 6402 #undef WRITE_SHORT_FIELD | 6412 #undef WRITE_SHORT_FIELD |
| 6403 #undef READ_BYTE_FIELD | 6413 #undef READ_BYTE_FIELD |
| 6404 #undef WRITE_BYTE_FIELD | 6414 #undef WRITE_BYTE_FIELD |
| 6405 | 6415 |
| 6406 | 6416 |
| 6407 } } // namespace v8::internal | 6417 } } // namespace v8::internal |
| 6408 | 6418 |
| 6409 #endif // V8_OBJECTS_INL_H_ | 6419 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |