OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3833 | 3833 |
3834 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, | 3834 void JSBuiltinsObject::set_javascript_builtin_code(Builtins::JavaScript id, |
3835 Code* value) { | 3835 Code* value) { |
3836 ASSERT(id < kJSBuiltinsCount); // id is unsigned. | 3836 ASSERT(id < kJSBuiltinsCount); // id is unsigned. |
3837 WRITE_FIELD(this, OffsetOfCodeWithId(id), value); | 3837 WRITE_FIELD(this, OffsetOfCodeWithId(id), value); |
3838 ASSERT(!HEAP->InNewSpace(value)); | 3838 ASSERT(!HEAP->InNewSpace(value)); |
3839 } | 3839 } |
3840 | 3840 |
3841 | 3841 |
3842 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) | 3842 ACCESSORS(JSProxy, handler, Object, kHandlerOffset) |
| 3843 ACCESSORS(JSProxy, hash, Object, kHashOffset) |
3843 ACCESSORS(JSFunctionProxy, call_trap, Object, kCallTrapOffset) | 3844 ACCESSORS(JSFunctionProxy, call_trap, Object, kCallTrapOffset) |
3844 ACCESSORS(JSFunctionProxy, construct_trap, Object, kConstructTrapOffset) | 3845 ACCESSORS(JSFunctionProxy, construct_trap, Object, kConstructTrapOffset) |
3845 | 3846 |
3846 | 3847 |
3847 void JSProxy::InitializeBody(int object_size, Object* value) { | 3848 void JSProxy::InitializeBody(int object_size, Object* value) { |
3848 ASSERT(!value->IsHeapObject() || !GetHeap()->InNewSpace(value)); | 3849 ASSERT(!value->IsHeapObject() || !GetHeap()->InNewSpace(value)); |
3849 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { | 3850 for (int offset = kHeaderSize; offset < object_size; offset += kPointerSize) { |
3850 WRITE_FIELD(this, offset, value); | 3851 WRITE_FIELD(this, offset, value); |
3851 } | 3852 } |
3852 } | 3853 } |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4286 if (IsJSGlobalProxy()) { | 4287 if (IsJSGlobalProxy()) { |
4287 Object* proto = GetPrototype(); | 4288 Object* proto = GetPrototype(); |
4288 if (proto->IsNull()) return GetHeap()->undefined_value(); | 4289 if (proto->IsNull()) return GetHeap()->undefined_value(); |
4289 ASSERT(proto->IsJSGlobalObject()); | 4290 ASSERT(proto->IsJSGlobalObject()); |
4290 return proto; | 4291 return proto; |
4291 } | 4292 } |
4292 return this; | 4293 return this; |
4293 } | 4294 } |
4294 | 4295 |
4295 | 4296 |
| 4297 MaybeObject* JSReceiver::GetIdentityHash(CreationFlag flag) { |
| 4298 return IsJSProxy() |
| 4299 ? JSProxy::cast(this)->GetIdentityHash(flag) |
| 4300 : JSObject::cast(this)->GetIdentityHash(flag); |
| 4301 } |
| 4302 |
| 4303 |
4296 bool JSObject::HasHiddenPropertiesObject() { | 4304 bool JSObject::HasHiddenPropertiesObject() { |
4297 ASSERT(!IsJSGlobalProxy()); | 4305 ASSERT(!IsJSGlobalProxy()); |
4298 return GetPropertyAttributePostInterceptor(this, | 4306 return GetPropertyAttributePostInterceptor(this, |
4299 GetHeap()->hidden_symbol(), | 4307 GetHeap()->hidden_symbol(), |
4300 false) != ABSENT; | 4308 false) != ABSENT; |
4301 } | 4309 } |
4302 | 4310 |
4303 | 4311 |
4304 Object* JSObject::GetHiddenPropertiesObject() { | 4312 Object* JSObject::GetHiddenPropertiesObject() { |
4305 ASSERT(!IsJSGlobalProxy()); | 4313 ASSERT(!IsJSGlobalProxy()); |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4440 uint32_t StringDictionaryShape::HashForObject(String* key, Object* other) { | 4448 uint32_t StringDictionaryShape::HashForObject(String* key, Object* other) { |
4441 return String::cast(other)->Hash(); | 4449 return String::cast(other)->Hash(); |
4442 } | 4450 } |
4443 | 4451 |
4444 | 4452 |
4445 MaybeObject* StringDictionaryShape::AsObject(String* key) { | 4453 MaybeObject* StringDictionaryShape::AsObject(String* key) { |
4446 return key; | 4454 return key; |
4447 } | 4455 } |
4448 | 4456 |
4449 | 4457 |
4450 bool ObjectHashTableShape::IsMatch(JSObject* key, Object* other) { | 4458 bool ObjectHashTableShape::IsMatch(JSReceiver* key, Object* other) { |
4451 return key == JSObject::cast(other); | 4459 return key == JSReceiver::cast(other); |
4452 } | 4460 } |
4453 | 4461 |
4454 | 4462 |
4455 uint32_t ObjectHashTableShape::Hash(JSObject* key) { | 4463 uint32_t ObjectHashTableShape::Hash(JSReceiver* key) { |
4456 MaybeObject* maybe_hash = key->GetIdentityHash(JSObject::OMIT_CREATION); | 4464 MaybeObject* maybe_hash = key->GetIdentityHash(OMIT_CREATION); |
4457 ASSERT(!maybe_hash->IsFailure()); | 4465 ASSERT(!maybe_hash->IsFailure()); |
4458 return Smi::cast(maybe_hash->ToObjectUnchecked())->value(); | 4466 return Smi::cast(maybe_hash->ToObjectUnchecked())->value(); |
4459 } | 4467 } |
4460 | 4468 |
4461 | 4469 |
4462 uint32_t ObjectHashTableShape::HashForObject(JSObject* key, Object* other) { | 4470 uint32_t ObjectHashTableShape::HashForObject(JSReceiver* key, Object* other) { |
4463 MaybeObject* maybe_hash = JSObject::cast(other)->GetIdentityHash( | 4471 MaybeObject* maybe_hash = |
4464 JSObject::OMIT_CREATION); | 4472 JSReceiver::cast(other)->GetIdentityHash(OMIT_CREATION); |
4465 ASSERT(!maybe_hash->IsFailure()); | 4473 ASSERT(!maybe_hash->IsFailure()); |
4466 return Smi::cast(maybe_hash->ToObjectUnchecked())->value(); | 4474 return Smi::cast(maybe_hash->ToObjectUnchecked())->value(); |
4467 } | 4475 } |
4468 | 4476 |
4469 | 4477 |
4470 MaybeObject* ObjectHashTableShape::AsObject(JSObject* key) { | 4478 MaybeObject* ObjectHashTableShape::AsObject(JSReceiver* key) { |
4471 return key; | 4479 return key; |
4472 } | 4480 } |
4473 | 4481 |
4474 | 4482 |
4475 void ObjectHashTable::RemoveEntry(int entry) { | 4483 void ObjectHashTable::RemoveEntry(int entry) { |
4476 RemoveEntry(entry, GetHeap()); | 4484 RemoveEntry(entry, GetHeap()); |
4477 } | 4485 } |
4478 | 4486 |
4479 | 4487 |
4480 void Map::ClearCodeCache(Heap* heap) { | 4488 void Map::ClearCodeCache(Heap* heap) { |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4621 #undef WRITE_INT_FIELD | 4629 #undef WRITE_INT_FIELD |
4622 #undef READ_SHORT_FIELD | 4630 #undef READ_SHORT_FIELD |
4623 #undef WRITE_SHORT_FIELD | 4631 #undef WRITE_SHORT_FIELD |
4624 #undef READ_BYTE_FIELD | 4632 #undef READ_BYTE_FIELD |
4625 #undef WRITE_BYTE_FIELD | 4633 #undef WRITE_BYTE_FIELD |
4626 | 4634 |
4627 | 4635 |
4628 } } // namespace v8::internal | 4636 } } // namespace v8::internal |
4629 | 4637 |
4630 #endif // V8_OBJECTS_INL_H_ | 4638 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |