Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: src/objects-inl.h

Issue 71163006: Merge bleeding_edge r17376:17693. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Fix all.gyp Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 73
74 #define TYPE_CHECKER(type, instancetype) \ 74 #define TYPE_CHECKER(type, instancetype) \
75 bool Object::Is##type() { \ 75 bool Object::Is##type() { \
76 return Object::IsHeapObject() && \ 76 return Object::IsHeapObject() && \
77 HeapObject::cast(this)->map()->instance_type() == instancetype; \ 77 HeapObject::cast(this)->map()->instance_type() == instancetype; \
78 } 78 }
79 79
80 80
81 #define CAST_ACCESSOR(type) \ 81 #define CAST_ACCESSOR(type) \
82 type* type::cast(Object* object) { \ 82 type* type::cast(Object* object) { \
83 ASSERT(object->Is##type()); \ 83 SLOW_ASSERT(object->Is##type()); \
84 return reinterpret_cast<type*>(object); \ 84 return reinterpret_cast<type*>(object); \
85 } 85 }
86 86
87 87
88 #define INT_ACCESSORS(holder, name, offset) \ 88 #define INT_ACCESSORS(holder, name, offset) \
89 int holder::name() { return READ_INT_FIELD(this, offset); } \ 89 int holder::name() { return READ_INT_FIELD(this, offset); } \
90 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); } 90 void holder::set_##name(int value) { WRITE_INT_FIELD(this, offset, value); }
91 91
92 92
93 #define ACCESSORS(holder, name, type, offset) \ 93 #define ACCESSORS(holder, name, type, offset) \
(...skipping 1089 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 1183
1184 void HeapObject::VerifySmiField(int offset) { 1184 void HeapObject::VerifySmiField(int offset) {
1185 CHECK(READ_FIELD(this, offset)->IsSmi()); 1185 CHECK(READ_FIELD(this, offset)->IsSmi());
1186 } 1186 }
1187 #endif 1187 #endif
1188 1188
1189 1189
1190 Heap* HeapObject::GetHeap() { 1190 Heap* HeapObject::GetHeap() {
1191 Heap* heap = 1191 Heap* heap =
1192 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap(); 1192 MemoryChunk::FromAddress(reinterpret_cast<Address>(this))->heap();
1193 ASSERT(heap != NULL); 1193 SLOW_ASSERT(heap != NULL);
1194 return heap; 1194 return heap;
1195 } 1195 }
1196 1196
1197 1197
1198 Isolate* HeapObject::GetIsolate() { 1198 Isolate* HeapObject::GetIsolate() {
1199 return GetHeap()->isolate(); 1199 return GetHeap()->isolate();
1200 } 1200 }
1201 1201
1202 1202
1203 Map* HeapObject::map() { 1203 Map* HeapObject::map() {
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
1300 } 1300 }
1301 1301
1302 1302
1303 FixedArrayBase* JSObject::elements() { 1303 FixedArrayBase* JSObject::elements() {
1304 Object* array = READ_FIELD(this, kElementsOffset); 1304 Object* array = READ_FIELD(this, kElementsOffset);
1305 return static_cast<FixedArrayBase*>(array); 1305 return static_cast<FixedArrayBase*>(array);
1306 } 1306 }
1307 1307
1308 1308
1309 void JSObject::ValidateElements() { 1309 void JSObject::ValidateElements() {
1310 #if DEBUG 1310 #ifdef ENABLE_SLOW_ASSERTS
1311 if (FLAG_enable_slow_asserts) { 1311 if (FLAG_enable_slow_asserts) {
1312 ElementsAccessor* accessor = GetElementsAccessor(); 1312 ElementsAccessor* accessor = GetElementsAccessor();
1313 accessor->Validate(this); 1313 accessor->Validate(this);
1314 } 1314 }
1315 #endif 1315 #endif
1316 } 1316 }
1317 1317
1318 1318
1319 bool JSObject::ShouldTrackAllocationInfo() { 1319 bool JSObject::ShouldTrackAllocationInfo() {
1320 if (AllocationSite::CanTrack(map()->instance_type())) { 1320 if (AllocationSite::CanTrack(map()->instance_type())) {
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 return JSWeakMap::kSize; 1660 return JSWeakMap::kSize;
1661 case JS_WEAK_SET_TYPE: 1661 case JS_WEAK_SET_TYPE:
1662 return JSWeakSet::kSize; 1662 return JSWeakSet::kSize;
1663 case JS_REGEXP_TYPE: 1663 case JS_REGEXP_TYPE:
1664 return JSRegExp::kSize; 1664 return JSRegExp::kSize;
1665 case JS_CONTEXT_EXTENSION_OBJECT_TYPE: 1665 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
1666 return JSObject::kHeaderSize; 1666 return JSObject::kHeaderSize;
1667 case JS_MESSAGE_OBJECT_TYPE: 1667 case JS_MESSAGE_OBJECT_TYPE:
1668 return JSMessageObject::kSize; 1668 return JSMessageObject::kSize;
1669 default: 1669 default:
1670 UNREACHABLE(); 1670 // TODO(jkummerow): Re-enable this. Blink currently hits this
1671 // from its CustomElementConstructorBuilder.
1672 // UNREACHABLE();
1671 return 0; 1673 return 0;
1672 } 1674 }
1673 } 1675 }
1674 1676
1675 1677
1676 int JSObject::GetInternalFieldCount() { 1678 int JSObject::GetInternalFieldCount() {
1677 ASSERT(1 << kPointerSizeLog2 == kPointerSize); 1679 ASSERT(1 << kPointerSizeLog2 == kPointerSize);
1678 // Make sure to adjust for the number of in-object properties. These 1680 // Make sure to adjust for the number of in-object properties. These
1679 // properties do contribute to the size, but are not internal fields. 1681 // properties do contribute to the size, but are not internal fields.
1680 return ((Size() - GetHeaderSize()) >> kPointerSizeLog2) - 1682 return ((Size() - GetHeaderSize()) >> kPointerSizeLog2) -
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1894 1896
1895 1897
1896 FixedArrayBase* FixedArrayBase::cast(Object* object) { 1898 FixedArrayBase* FixedArrayBase::cast(Object* object) {
1897 ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray() || 1899 ASSERT(object->IsFixedArray() || object->IsFixedDoubleArray() ||
1898 object->IsConstantPoolArray()); 1900 object->IsConstantPoolArray());
1899 return reinterpret_cast<FixedArrayBase*>(object); 1901 return reinterpret_cast<FixedArrayBase*>(object);
1900 } 1902 }
1901 1903
1902 1904
1903 Object* FixedArray::get(int index) { 1905 Object* FixedArray::get(int index) {
1904 ASSERT(index >= 0 && index < this->length()); 1906 SLOW_ASSERT(index >= 0 && index < this->length());
1905 return READ_FIELD(this, kHeaderSize + index * kPointerSize); 1907 return READ_FIELD(this, kHeaderSize + index * kPointerSize);
1906 } 1908 }
1907 1909
1908 1910
1909 bool FixedArray::is_the_hole(int index) { 1911 bool FixedArray::is_the_hole(int index) {
1910 return get(index) == GetHeap()->the_hole_value(); 1912 return get(index) == GetHeap()->the_hole_value();
1911 } 1913 }
1912 1914
1913 1915
1914 void FixedArray::set(int index, Smi* value) { 1916 void FixedArray::set(int index, Smi* value) {
(...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after
2683 if (other == this) return true; 2685 if (other == this) return true;
2684 if ((this->IsInternalizedString() && other->IsInternalizedString()) || 2686 if ((this->IsInternalizedString() && other->IsInternalizedString()) ||
2685 this->IsSymbol() || other->IsSymbol()) { 2687 this->IsSymbol() || other->IsSymbol()) {
2686 return false; 2688 return false;
2687 } 2689 }
2688 return String::cast(this)->SlowEquals(String::cast(other)); 2690 return String::cast(this)->SlowEquals(String::cast(other));
2689 } 2691 }
2690 2692
2691 2693
2692 ACCESSORS(Symbol, name, Object, kNameOffset) 2694 ACCESSORS(Symbol, name, Object, kNameOffset)
2695 ACCESSORS(Symbol, flags, Smi, kFlagsOffset)
2696 BOOL_ACCESSORS(Symbol, flags, is_private, kPrivateBit)
2693 2697
2694 2698
2695 bool String::Equals(String* other) { 2699 bool String::Equals(String* other) {
2696 if (other == this) return true; 2700 if (other == this) return true;
2697 if (this->IsInternalizedString() && other->IsInternalizedString()) { 2701 if (this->IsInternalizedString() && other->IsInternalizedString()) {
2698 return false; 2702 return false;
2699 } 2703 }
2700 return SlowEquals(other); 2704 return SlowEquals(other);
2701 } 2705 }
2702 2706
(...skipping 2095 matching lines...) Expand 10 before | Expand all | Expand 10 after
4798 } 4802 }
4799 4803
4800 4804
4801 bool SharedFunctionInfo::is_classic_mode() { 4805 bool SharedFunctionInfo::is_classic_mode() {
4802 return !BooleanBit::get(compiler_hints(), kStrictModeFunction); 4806 return !BooleanBit::get(compiler_hints(), kStrictModeFunction);
4803 } 4807 }
4804 4808
4805 BOOL_GETTER(SharedFunctionInfo, compiler_hints, is_extended_mode, 4809 BOOL_GETTER(SharedFunctionInfo, compiler_hints, is_extended_mode,
4806 kExtendedModeFunction) 4810 kExtendedModeFunction)
4807 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative) 4811 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, native, kNative)
4812 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, inline_builtin,
4813 kInlineBuiltin)
4808 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, 4814 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints,
4809 name_should_print_as_anonymous, 4815 name_should_print_as_anonymous,
4810 kNameShouldPrintAsAnonymous) 4816 kNameShouldPrintAsAnonymous)
4811 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction) 4817 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, bound, kBoundFunction)
4812 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous) 4818 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_anonymous, kIsAnonymous)
4813 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction) 4819 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, is_function, kIsFunction)
4814 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_optimize, 4820 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_optimize,
4815 kDontOptimize) 4821 kDontOptimize)
4816 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_inline, kDontInline) 4822 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_inline, kDontInline)
4817 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_cache, kDontCache) 4823 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, dont_cache, kDontCache)
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
4858 | (start_position_and_type() & ~kStartPositionMask)); 4864 | (start_position_and_type() & ~kStartPositionMask));
4859 } 4865 }
4860 4866
4861 4867
4862 Code* SharedFunctionInfo::code() { 4868 Code* SharedFunctionInfo::code() {
4863 return Code::cast(READ_FIELD(this, kCodeOffset)); 4869 return Code::cast(READ_FIELD(this, kCodeOffset));
4864 } 4870 }
4865 4871
4866 4872
4867 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { 4873 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) {
4874 ASSERT(value->kind() != Code::OPTIMIZED_FUNCTION);
4868 WRITE_FIELD(this, kCodeOffset, value); 4875 WRITE_FIELD(this, kCodeOffset, value);
4869 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode); 4876 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode);
4870 } 4877 }
4871 4878
4872 4879
4873 void SharedFunctionInfo::ReplaceCode(Code* value) { 4880 void SharedFunctionInfo::ReplaceCode(Code* value) {
4874 // If the GC metadata field is already used then the function was 4881 // If the GC metadata field is already used then the function was
4875 // enqueued as a code flushing candidate and we remove it now. 4882 // enqueued as a code flushing candidate and we remove it now.
4876 if (code()->gc_metadata() != NULL) { 4883 if (code()->gc_metadata() != NULL) {
4877 CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher(); 4884 CodeFlusher* flusher = GetHeap()->mark_compact_collector()->code_flusher();
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
5311 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize); 5318 ASSERT(HeapObject::cast(obj)->Size() == JSMessageObject::kSize);
5312 return reinterpret_cast<JSMessageObject*>(obj); 5319 return reinterpret_cast<JSMessageObject*>(obj);
5313 } 5320 }
5314 5321
5315 5322
5316 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset) 5323 INT_ACCESSORS(Code, instruction_size, kInstructionSizeOffset)
5317 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset) 5324 INT_ACCESSORS(Code, prologue_offset, kPrologueOffset)
5318 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset) 5325 ACCESSORS(Code, relocation_info, ByteArray, kRelocationInfoOffset)
5319 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset) 5326 ACCESSORS(Code, handler_table, FixedArray, kHandlerTableOffset)
5320 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset) 5327 ACCESSORS(Code, deoptimization_data, FixedArray, kDeoptimizationDataOffset)
5328 ACCESSORS(Code, raw_type_feedback_info, Object, kTypeFeedbackInfoOffset)
5321 5329
5322 5330
5323 // Type feedback slot: type_feedback_info for FUNCTIONs, stub_info for STUBs. 5331 void Code::WipeOutHeader() {
5324 void Code::InitializeTypeFeedbackInfoNoWriteBarrier(Object* value) { 5332 WRITE_FIELD(this, kRelocationInfoOffset, NULL);
5325 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); 5333 WRITE_FIELD(this, kHandlerTableOffset, NULL);
5334 WRITE_FIELD(this, kDeoptimizationDataOffset, NULL);
5335 // Do not wipe out e.g. a minor key.
5336 if (!READ_FIELD(this, kTypeFeedbackInfoOffset)->IsSmi()) {
5337 WRITE_FIELD(this, kTypeFeedbackInfoOffset, NULL);
5338 }
5326 } 5339 }
5327 5340
5328 5341
5329 Object* Code::type_feedback_info() { 5342 Object* Code::type_feedback_info() {
5330 ASSERT(kind() == FUNCTION); 5343 ASSERT(kind() == FUNCTION);
5331 return Object::cast(READ_FIELD(this, kTypeFeedbackInfoOffset)); 5344 return raw_type_feedback_info();
5332 } 5345 }
5333 5346
5334 5347
5335 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) { 5348 void Code::set_type_feedback_info(Object* value, WriteBarrierMode mode) {
5336 ASSERT(kind() == FUNCTION); 5349 ASSERT(kind() == FUNCTION);
5337 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); 5350 set_raw_type_feedback_info(value, mode);
5338 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, 5351 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset,
5339 value, mode); 5352 value, mode);
5340 } 5353 }
5341 5354
5342 5355
5343 Object* Code::next_code_link() { 5356 Object* Code::next_code_link() {
5344 CHECK(kind() == OPTIMIZED_FUNCTION); 5357 CHECK(kind() == OPTIMIZED_FUNCTION);
5345 return Object::cast(READ_FIELD(this, kTypeFeedbackInfoOffset)); 5358 return raw_type_feedback_info();
5346 } 5359 }
5347 5360
5348 5361
5349 void Code::set_next_code_link(Object* value, WriteBarrierMode mode) { 5362 void Code::set_next_code_link(Object* value, WriteBarrierMode mode) {
5350 CHECK(kind() == OPTIMIZED_FUNCTION); 5363 CHECK(kind() == OPTIMIZED_FUNCTION);
5351 WRITE_FIELD(this, kTypeFeedbackInfoOffset, value); 5364 set_raw_type_feedback_info(value);
5352 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset, 5365 CONDITIONAL_WRITE_BARRIER(GetHeap(), this, kTypeFeedbackInfoOffset,
5353 value, mode); 5366 value, mode);
5354 } 5367 }
5355 5368
5356 5369
5357 int Code::stub_info() { 5370 int Code::stub_info() {
5358 ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC || 5371 ASSERT(kind() == COMPARE_IC || kind() == COMPARE_NIL_IC ||
5359 kind() == BINARY_OP_IC || kind() == LOAD_IC); 5372 kind() == BINARY_OP_IC || kind() == LOAD_IC);
5360 Object* value = READ_FIELD(this, kTypeFeedbackInfoOffset); 5373 return Smi::cast(raw_type_feedback_info())->value();
5361 return Smi::cast(value)->value();
5362 } 5374 }
5363 5375
5364 5376
5365 void Code::set_stub_info(int value) { 5377 void Code::set_stub_info(int value) {
5366 ASSERT(kind() == COMPARE_IC || 5378 ASSERT(kind() == COMPARE_IC ||
5367 kind() == COMPARE_NIL_IC || 5379 kind() == COMPARE_NIL_IC ||
5368 kind() == BINARY_OP_IC || 5380 kind() == BINARY_OP_IC ||
5369 kind() == STUB || 5381 kind() == STUB ||
5370 kind() == LOAD_IC || 5382 kind() == LOAD_IC ||
5371 kind() == KEYED_LOAD_IC || 5383 kind() == KEYED_LOAD_IC ||
5372 kind() == STORE_IC || 5384 kind() == STORE_IC ||
5373 kind() == KEYED_STORE_IC); 5385 kind() == KEYED_STORE_IC);
5374 WRITE_FIELD(this, kTypeFeedbackInfoOffset, Smi::FromInt(value)); 5386 set_raw_type_feedback_info(Smi::FromInt(value));
5375 } 5387 }
5376 5388
5377 5389
5378 ACCESSORS(Code, gc_metadata, Object, kGCMetadataOffset) 5390 ACCESSORS(Code, gc_metadata, Object, kGCMetadataOffset)
5379 INT_ACCESSORS(Code, ic_age, kICAgeOffset) 5391 INT_ACCESSORS(Code, ic_age, kICAgeOffset)
5380 5392
5381 5393
5382 byte* Code::instruction_start() { 5394 byte* Code::instruction_start() {
5383 return FIELD_ADDR(this, kHeaderSize); 5395 return FIELD_ADDR(this, kHeaderSize);
5384 } 5396 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
5509 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. 5521 ASSERT(index >= kDataIndex); // Only implementation data can be set this way.
5510 FixedArray::cast(data())->set(index, value); 5522 FixedArray::cast(data())->set(index, value);
5511 } 5523 }
5512 5524
5513 5525
5514 ElementsKind JSObject::GetElementsKind() { 5526 ElementsKind JSObject::GetElementsKind() {
5515 ElementsKind kind = map()->elements_kind(); 5527 ElementsKind kind = map()->elements_kind();
5516 #if DEBUG 5528 #if DEBUG
5517 FixedArrayBase* fixed_array = 5529 FixedArrayBase* fixed_array =
5518 reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset)); 5530 reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset));
5519 Map* map = fixed_array->map(); 5531
5520 ASSERT((IsFastSmiOrObjectElementsKind(kind) && 5532 // If a GC was caused while constructing this object, the elements
5521 (map == GetHeap()->fixed_array_map() || 5533 // pointer may point to a one pointer filler map.
5522 map == GetHeap()->fixed_cow_array_map())) || 5534 if (ElementsAreSafeToExamine()) {
5523 (IsFastDoubleElementsKind(kind) && 5535 Map* map = fixed_array->map();
5524 (fixed_array->IsFixedDoubleArray() || 5536 ASSERT((IsFastSmiOrObjectElementsKind(kind) &&
5525 fixed_array == GetHeap()->empty_fixed_array())) || 5537 (map == GetHeap()->fixed_array_map() ||
5526 (kind == DICTIONARY_ELEMENTS && 5538 map == GetHeap()->fixed_cow_array_map())) ||
5539 (IsFastDoubleElementsKind(kind) &&
5540 (fixed_array->IsFixedDoubleArray() ||
5541 fixed_array == GetHeap()->empty_fixed_array())) ||
5542 (kind == DICTIONARY_ELEMENTS &&
5527 fixed_array->IsFixedArray() && 5543 fixed_array->IsFixedArray() &&
5528 fixed_array->IsDictionary()) || 5544 fixed_array->IsDictionary()) ||
5529 (kind > DICTIONARY_ELEMENTS)); 5545 (kind > DICTIONARY_ELEMENTS));
5530 ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) || 5546 ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) ||
5531 (elements()->IsFixedArray() && elements()->length() >= 2)); 5547 (elements()->IsFixedArray() && elements()->length() >= 2));
5548 }
5532 #endif 5549 #endif
5533 return kind; 5550 return kind;
5534 } 5551 }
5535 5552
5536 5553
5537 ElementsAccessor* JSObject::GetElementsAccessor() { 5554 ElementsAccessor* JSObject::GetElementsAccessor() {
5538 return ElementsAccessor::ForKind(GetElementsKind()); 5555 return ElementsAccessor::ForKind(GetElementsKind());
5539 } 5556 }
5540 5557
5541 5558
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
5832 if (IsJSGlobalProxy()) { 5849 if (IsJSGlobalProxy()) {
5833 Object* proto = GetPrototype(); 5850 Object* proto = GetPrototype();
5834 if (proto->IsNull()) return GetHeap()->undefined_value(); 5851 if (proto->IsNull()) return GetHeap()->undefined_value();
5835 ASSERT(proto->IsJSGlobalObject()); 5852 ASSERT(proto->IsJSGlobalObject());
5836 return proto; 5853 return proto;
5837 } 5854 }
5838 return this; 5855 return this;
5839 } 5856 }
5840 5857
5841 5858
5842 MaybeObject* JSReceiver::GetIdentityHash(CreationFlag flag) { 5859 Handle<Object> JSReceiver::GetOrCreateIdentityHash(Handle<JSReceiver> object) {
5843 return IsJSProxy() 5860 return object->IsJSProxy()
5844 ? JSProxy::cast(this)->GetIdentityHash(flag) 5861 ? JSProxy::GetOrCreateIdentityHash(Handle<JSProxy>::cast(object))
5845 : JSObject::cast(this)->GetIdentityHash(flag); 5862 : JSObject::GetOrCreateIdentityHash(Handle<JSObject>::cast(object));
5846 } 5863 }
5847 5864
5848 5865
5866 Object* JSReceiver::GetIdentityHash() {
5867 return IsJSProxy()
5868 ? JSProxy::cast(this)->GetIdentityHash()
5869 : JSObject::cast(this)->GetIdentityHash();
5870 }
5871
5872
5849 bool JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) { 5873 bool JSReceiver::HasElement(Handle<JSReceiver> object, uint32_t index) {
5850 if (object->IsJSProxy()) { 5874 if (object->IsJSProxy()) {
5851 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object); 5875 Handle<JSProxy> proxy = Handle<JSProxy>::cast(object);
5852 return JSProxy::HasElementWithHandler(proxy, index); 5876 return JSProxy::HasElementWithHandler(proxy, index);
5853 } 5877 }
5854 return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver( 5878 return Handle<JSObject>::cast(object)->GetElementAttributeWithReceiver(
5855 *object, index, true) != ABSENT; 5879 *object, index, true) != ABSENT;
5856 } 5880 }
5857 5881
5858 5882
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
6035 6059
6036 6060
6037 template <int entrysize> 6061 template <int entrysize>
6038 bool ObjectHashTableShape<entrysize>::IsMatch(Object* key, Object* other) { 6062 bool ObjectHashTableShape<entrysize>::IsMatch(Object* key, Object* other) {
6039 return key->SameValue(other); 6063 return key->SameValue(other);
6040 } 6064 }
6041 6065
6042 6066
6043 template <int entrysize> 6067 template <int entrysize>
6044 uint32_t ObjectHashTableShape<entrysize>::Hash(Object* key) { 6068 uint32_t ObjectHashTableShape<entrysize>::Hash(Object* key) {
6045 MaybeObject* maybe_hash = key->GetHash(OMIT_CREATION); 6069 return Smi::cast(key->GetHash())->value();
6046 return Smi::cast(maybe_hash->ToObjectChecked())->value();
6047 } 6070 }
6048 6071
6049 6072
6050 template <int entrysize> 6073 template <int entrysize>
6051 uint32_t ObjectHashTableShape<entrysize>::HashForObject(Object* key, 6074 uint32_t ObjectHashTableShape<entrysize>::HashForObject(Object* key,
6052 Object* other) { 6075 Object* other) {
6053 MaybeObject* maybe_hash = other->GetHash(OMIT_CREATION); 6076 return Smi::cast(other->GetHash())->value();
6054 return Smi::cast(maybe_hash->ToObjectChecked())->value();
6055 } 6077 }
6056 6078
6057 6079
6058 template <int entrysize> 6080 template <int entrysize>
6059 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Heap* heap, 6081 MaybeObject* ObjectHashTableShape<entrysize>::AsObject(Heap* heap,
6060 Object* key) { 6082 Object* key) {
6061 return key; 6083 return key;
6062 } 6084 }
6063 6085
6064 6086
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
6393 #undef WRITE_UINT32_FIELD 6415 #undef WRITE_UINT32_FIELD
6394 #undef READ_SHORT_FIELD 6416 #undef READ_SHORT_FIELD
6395 #undef WRITE_SHORT_FIELD 6417 #undef WRITE_SHORT_FIELD
6396 #undef READ_BYTE_FIELD 6418 #undef READ_BYTE_FIELD
6397 #undef WRITE_BYTE_FIELD 6419 #undef WRITE_BYTE_FIELD
6398 6420
6399 6421
6400 } } // namespace v8::internal 6422 } } // namespace v8::internal
6401 6423
6402 #endif // V8_OBJECTS_INL_H_ 6424 #endif // V8_OBJECTS_INL_H_
OLDNEW
« no previous file with comments | « src/objects-debug.cc ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698