| 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 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE) | 661 TYPE_CHECKER(JSFunction, JS_FUNCTION_TYPE) |
| 662 | 662 |
| 663 | 663 |
| 664 template <> inline bool Is<JSFunction>(Object* obj) { | 664 template <> inline bool Is<JSFunction>(Object* obj) { |
| 665 return obj->IsJSFunction(); | 665 return obj->IsJSFunction(); |
| 666 } | 666 } |
| 667 | 667 |
| 668 | 668 |
| 669 TYPE_CHECKER(Code, CODE_TYPE) | 669 TYPE_CHECKER(Code, CODE_TYPE) |
| 670 TYPE_CHECKER(Oddball, ODDBALL_TYPE) | 670 TYPE_CHECKER(Oddball, ODDBALL_TYPE) |
| 671 TYPE_CHECKER(JSGlobalPropertyCell, JS_GLOBAL_PROPERTY_CELL_TYPE) | 671 TYPE_CHECKER(Cell, CELL_TYPE) |
| 672 TYPE_CHECKER(PropertyCell, PROPERTY_CELL_TYPE) |
| 672 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) | 673 TYPE_CHECKER(SharedFunctionInfo, SHARED_FUNCTION_INFO_TYPE) |
| 673 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) | 674 TYPE_CHECKER(JSGeneratorObject, JS_GENERATOR_OBJECT_TYPE) |
| 674 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) | 675 TYPE_CHECKER(JSModule, JS_MODULE_TYPE) |
| 675 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) | 676 TYPE_CHECKER(JSValue, JS_VALUE_TYPE) |
| 676 TYPE_CHECKER(JSDate, JS_DATE_TYPE) | 677 TYPE_CHECKER(JSDate, JS_DATE_TYPE) |
| 677 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) | 678 TYPE_CHECKER(JSMessageObject, JS_MESSAGE_OBJECT_TYPE) |
| 678 | 679 |
| 679 | 680 |
| 680 bool Object::IsStringWrapper() { | 681 bool Object::IsStringWrapper() { |
| 681 return IsJSValue() && JSValue::cast(this)->value()->IsString(); | 682 return IsJSValue() && JSValue::cast(this)->value()->IsString(); |
| (...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1614 byte Oddball::kind() { | 1615 byte Oddball::kind() { |
| 1615 return Smi::cast(READ_FIELD(this, kKindOffset))->value(); | 1616 return Smi::cast(READ_FIELD(this, kKindOffset))->value(); |
| 1616 } | 1617 } |
| 1617 | 1618 |
| 1618 | 1619 |
| 1619 void Oddball::set_kind(byte value) { | 1620 void Oddball::set_kind(byte value) { |
| 1620 WRITE_FIELD(this, kKindOffset, Smi::FromInt(value)); | 1621 WRITE_FIELD(this, kKindOffset, Smi::FromInt(value)); |
| 1621 } | 1622 } |
| 1622 | 1623 |
| 1623 | 1624 |
| 1624 Object* JSGlobalPropertyCell::value() { | 1625 Object* Cell::value() { |
| 1625 return READ_FIELD(this, kValueOffset); | 1626 return READ_FIELD(this, kValueOffset); |
| 1626 } | 1627 } |
| 1627 | 1628 |
| 1628 | 1629 |
| 1629 void JSGlobalPropertyCell::set_value(Object* val, WriteBarrierMode ignored) { | 1630 void Cell::set_value(Object* val, WriteBarrierMode ignored) { |
| 1630 // The write barrier is not used for global property cells. | 1631 // The write barrier is not used for global property cells. |
| 1631 ASSERT(!val->IsJSGlobalPropertyCell()); | 1632 ASSERT(!val->IsPropertyCell() && !val->IsCell()); |
| 1632 WRITE_FIELD(this, kValueOffset, val); | 1633 WRITE_FIELD(this, kValueOffset, val); |
| 1633 } | 1634 } |
| 1634 | 1635 |
| 1635 | 1636 |
| 1637 Object* PropertyCell::type_raw() { |
| 1638 return READ_FIELD(this, kTypeOffset); |
| 1639 } |
| 1640 |
| 1641 |
| 1642 void PropertyCell::set_type_raw(Object* val, WriteBarrierMode ignored) { |
| 1643 WRITE_FIELD(this, kTypeOffset, val); |
| 1644 } |
| 1645 |
| 1646 |
| 1636 int JSObject::GetHeaderSize() { | 1647 int JSObject::GetHeaderSize() { |
| 1637 InstanceType type = map()->instance_type(); | 1648 InstanceType type = map()->instance_type(); |
| 1638 // Check for the most common kind of JavaScript object before | 1649 // Check for the most common kind of JavaScript object before |
| 1639 // falling into the generic switch. This speeds up the internal | 1650 // falling into the generic switch. This speeds up the internal |
| 1640 // field operations considerably on average. | 1651 // field operations considerably on average. |
| 1641 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; | 1652 if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; |
| 1642 switch (type) { | 1653 switch (type) { |
| 1643 case JS_GENERATOR_OBJECT_TYPE: | 1654 case JS_GENERATOR_OBJECT_TYPE: |
| 1644 return JSGeneratorObject::kSize; | 1655 return JSGeneratorObject::kSize; |
| 1645 case JS_MODULE_TYPE: | 1656 case JS_MODULE_TYPE: |
| (...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 void FixedArray::set_the_hole(int index) { | 2084 void FixedArray::set_the_hole(int index) { |
| 2074 ASSERT(map() != HEAP->fixed_cow_array_map()); | 2085 ASSERT(map() != HEAP->fixed_cow_array_map()); |
| 2075 ASSERT(index >= 0 && index < this->length()); | 2086 ASSERT(index >= 0 && index < this->length()); |
| 2076 ASSERT(!HEAP->InNewSpace(HEAP->the_hole_value())); | 2087 ASSERT(!HEAP->InNewSpace(HEAP->the_hole_value())); |
| 2077 WRITE_FIELD(this, | 2088 WRITE_FIELD(this, |
| 2078 kHeaderSize + index * kPointerSize, | 2089 kHeaderSize + index * kPointerSize, |
| 2079 GetHeap()->the_hole_value()); | 2090 GetHeap()->the_hole_value()); |
| 2080 } | 2091 } |
| 2081 | 2092 |
| 2082 | 2093 |
| 2083 void FixedArray::set_unchecked(int index, Smi* value) { | |
| 2084 ASSERT(reinterpret_cast<Object*>(value)->IsSmi()); | |
| 2085 int offset = kHeaderSize + index * kPointerSize; | |
| 2086 WRITE_FIELD(this, offset, value); | |
| 2087 } | |
| 2088 | |
| 2089 | |
| 2090 void FixedArray::set_unchecked(Heap* heap, | |
| 2091 int index, | |
| 2092 Object* value, | |
| 2093 WriteBarrierMode mode) { | |
| 2094 int offset = kHeaderSize + index * kPointerSize; | |
| 2095 WRITE_FIELD(this, offset, value); | |
| 2096 CONDITIONAL_WRITE_BARRIER(heap, this, offset, value, mode); | |
| 2097 } | |
| 2098 | |
| 2099 | |
| 2100 void FixedArray::set_null_unchecked(Heap* heap, int index) { | |
| 2101 ASSERT(index >= 0 && index < this->length()); | |
| 2102 ASSERT(!heap->InNewSpace(heap->null_value())); | |
| 2103 WRITE_FIELD(this, kHeaderSize + index * kPointerSize, heap->null_value()); | |
| 2104 } | |
| 2105 | |
| 2106 | |
| 2107 double* FixedDoubleArray::data_start() { | 2094 double* FixedDoubleArray::data_start() { |
| 2108 return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize)); | 2095 return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize)); |
| 2109 } | 2096 } |
| 2110 | 2097 |
| 2111 | 2098 |
| 2112 Object** FixedArray::data_start() { | 2099 Object** FixedArray::data_start() { |
| 2113 return HeapObject::RawField(this, kHeaderSize); | 2100 return HeapObject::RawField(this, kHeaderSize); |
| 2114 } | 2101 } |
| 2115 | 2102 |
| 2116 | 2103 |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2545 CAST_ACCESSOR(ExternalAsciiString) | 2532 CAST_ACCESSOR(ExternalAsciiString) |
| 2546 CAST_ACCESSOR(ExternalTwoByteString) | 2533 CAST_ACCESSOR(ExternalTwoByteString) |
| 2547 CAST_ACCESSOR(Symbol) | 2534 CAST_ACCESSOR(Symbol) |
| 2548 CAST_ACCESSOR(Name) | 2535 CAST_ACCESSOR(Name) |
| 2549 CAST_ACCESSOR(JSReceiver) | 2536 CAST_ACCESSOR(JSReceiver) |
| 2550 CAST_ACCESSOR(JSObject) | 2537 CAST_ACCESSOR(JSObject) |
| 2551 CAST_ACCESSOR(Smi) | 2538 CAST_ACCESSOR(Smi) |
| 2552 CAST_ACCESSOR(HeapObject) | 2539 CAST_ACCESSOR(HeapObject) |
| 2553 CAST_ACCESSOR(HeapNumber) | 2540 CAST_ACCESSOR(HeapNumber) |
| 2554 CAST_ACCESSOR(Oddball) | 2541 CAST_ACCESSOR(Oddball) |
| 2555 CAST_ACCESSOR(JSGlobalPropertyCell) | 2542 CAST_ACCESSOR(Cell) |
| 2543 CAST_ACCESSOR(PropertyCell) |
| 2556 CAST_ACCESSOR(SharedFunctionInfo) | 2544 CAST_ACCESSOR(SharedFunctionInfo) |
| 2557 CAST_ACCESSOR(Map) | 2545 CAST_ACCESSOR(Map) |
| 2558 CAST_ACCESSOR(JSFunction) | 2546 CAST_ACCESSOR(JSFunction) |
| 2559 CAST_ACCESSOR(GlobalObject) | 2547 CAST_ACCESSOR(GlobalObject) |
| 2560 CAST_ACCESSOR(JSGlobalProxy) | 2548 CAST_ACCESSOR(JSGlobalProxy) |
| 2561 CAST_ACCESSOR(JSGlobalObject) | 2549 CAST_ACCESSOR(JSGlobalObject) |
| 2562 CAST_ACCESSOR(JSBuiltinsObject) | 2550 CAST_ACCESSOR(JSBuiltinsObject) |
| 2563 CAST_ACCESSOR(Code) | 2551 CAST_ACCESSOR(Code) |
| 2564 CAST_ACCESSOR(JSArray) | 2552 CAST_ACCESSOR(JSArray) |
| 2565 CAST_ACCESSOR(JSArrayBuffer) | 2553 CAST_ACCESSOR(JSArrayBuffer) |
| (...skipping 992 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3558 void Map::set_dictionary_map(bool value) { | 3546 void Map::set_dictionary_map(bool value) { |
| 3559 set_bit_field3(DictionaryMap::update(bit_field3(), value)); | 3547 set_bit_field3(DictionaryMap::update(bit_field3(), value)); |
| 3560 } | 3548 } |
| 3561 | 3549 |
| 3562 | 3550 |
| 3563 bool Map::is_dictionary_map() { | 3551 bool Map::is_dictionary_map() { |
| 3564 return DictionaryMap::decode(bit_field3()); | 3552 return DictionaryMap::decode(bit_field3()); |
| 3565 } | 3553 } |
| 3566 | 3554 |
| 3567 | 3555 |
| 3568 JSFunction* Map::unchecked_constructor() { | |
| 3569 return reinterpret_cast<JSFunction*>(READ_FIELD(this, kConstructorOffset)); | |
| 3570 } | |
| 3571 | |
| 3572 | |
| 3573 Code::Flags Code::flags() { | 3556 Code::Flags Code::flags() { |
| 3574 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); | 3557 return static_cast<Flags>(READ_INT_FIELD(this, kFlagsOffset)); |
| 3575 } | 3558 } |
| 3576 | 3559 |
| 3577 | 3560 |
| 3578 inline bool Map::CanTrackAllocationSite() { | 3561 inline bool Map::CanTrackAllocationSite() { |
| 3579 return instance_type() == JS_ARRAY_TYPE; | 3562 return instance_type() == JS_ARRAY_TYPE; |
| 3580 } | 3563 } |
| 3581 | 3564 |
| 3582 | 3565 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3634 if (FLAG_track_fields && details.representation().IsSmi()) { | 3617 if (FLAG_track_fields && details.representation().IsSmi()) { |
| 3635 return true; | 3618 return true; |
| 3636 } | 3619 } |
| 3637 if (FLAG_track_double_fields && details.representation().IsDouble()) { | 3620 if (FLAG_track_double_fields && details.representation().IsDouble()) { |
| 3638 return true; | 3621 return true; |
| 3639 } | 3622 } |
| 3640 if (FLAG_track_heap_object_fields && | 3623 if (FLAG_track_heap_object_fields && |
| 3641 details.representation().IsHeapObject()) { | 3624 details.representation().IsHeapObject()) { |
| 3642 return true; | 3625 return true; |
| 3643 } | 3626 } |
| 3627 if (FLAG_track_fields && details.type() == CONSTANT_FUNCTION) { |
| 3628 return true; |
| 3629 } |
| 3644 } | 3630 } |
| 3645 return false; | 3631 return false; |
| 3646 } | 3632 } |
| 3647 | 3633 |
| 3648 | 3634 |
| 3649 void Map::NotifyLeafMapLayoutChange() { | 3635 void Map::NotifyLeafMapLayoutChange() { |
| 3650 dependent_code()->DeoptimizeDependentCodeGroup( | 3636 dependent_code()->DeoptimizeDependentCodeGroup( |
| 3651 GetIsolate(), | 3637 GetIsolate(), |
| 3652 DependentCode::kPrototypeCheckGroup); | 3638 DependentCode::kPrototypeCheckGroup); |
| 3653 } | 3639 } |
| (...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4725 set_start_position_and_type((start_position << kStartPositionShift) | 4711 set_start_position_and_type((start_position << kStartPositionShift) |
| 4726 | (start_position_and_type() & ~kStartPositionMask)); | 4712 | (start_position_and_type() & ~kStartPositionMask)); |
| 4727 } | 4713 } |
| 4728 | 4714 |
| 4729 | 4715 |
| 4730 Code* SharedFunctionInfo::code() { | 4716 Code* SharedFunctionInfo::code() { |
| 4731 return Code::cast(READ_FIELD(this, kCodeOffset)); | 4717 return Code::cast(READ_FIELD(this, kCodeOffset)); |
| 4732 } | 4718 } |
| 4733 | 4719 |
| 4734 | 4720 |
| 4735 Code* SharedFunctionInfo::unchecked_code() { | |
| 4736 return reinterpret_cast<Code*>(READ_FIELD(this, kCodeOffset)); | |
| 4737 } | |
| 4738 | |
| 4739 | |
| 4740 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { | 4721 void SharedFunctionInfo::set_code(Code* value, WriteBarrierMode mode) { |
| 4741 WRITE_FIELD(this, kCodeOffset, value); | 4722 WRITE_FIELD(this, kCodeOffset, value); |
| 4742 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode); | 4723 CONDITIONAL_WRITE_BARRIER(value->GetHeap(), this, kCodeOffset, value, mode); |
| 4743 } | 4724 } |
| 4744 | 4725 |
| 4745 | 4726 |
| 4746 void SharedFunctionInfo::ReplaceCode(Code* value) { | 4727 void SharedFunctionInfo::ReplaceCode(Code* value) { |
| 4747 // If the GC metadata field is already used then the function was | 4728 // If the GC metadata field is already used then the function was |
| 4748 // enqueued as a code flushing candidate and we remove it now. | 4729 // enqueued as a code flushing candidate and we remove it now. |
| 4749 if (code()->gc_metadata() != NULL) { | 4730 if (code()->gc_metadata() != NULL) { |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4962 Context* JSFunction::context() { | 4943 Context* JSFunction::context() { |
| 4963 return Context::cast(READ_FIELD(this, kContextOffset)); | 4944 return Context::cast(READ_FIELD(this, kContextOffset)); |
| 4964 } | 4945 } |
| 4965 | 4946 |
| 4966 | 4947 |
| 4967 Object* JSFunction::unchecked_context() { | 4948 Object* JSFunction::unchecked_context() { |
| 4968 return READ_FIELD(this, kContextOffset); | 4949 return READ_FIELD(this, kContextOffset); |
| 4969 } | 4950 } |
| 4970 | 4951 |
| 4971 | 4952 |
| 4972 SharedFunctionInfo* JSFunction::unchecked_shared() { | |
| 4973 return reinterpret_cast<SharedFunctionInfo*>( | |
| 4974 READ_FIELD(this, kSharedFunctionInfoOffset)); | |
| 4975 } | |
| 4976 | |
| 4977 | |
| 4978 void JSFunction::set_context(Object* value) { | 4953 void JSFunction::set_context(Object* value) { |
| 4979 ASSERT(value->IsUndefined() || value->IsContext()); | 4954 ASSERT(value->IsUndefined() || value->IsContext()); |
| 4980 WRITE_FIELD(this, kContextOffset, value); | 4955 WRITE_FIELD(this, kContextOffset, value); |
| 4981 WRITE_BARRIER(GetHeap(), this, kContextOffset, value); | 4956 WRITE_BARRIER(GetHeap(), this, kContextOffset, value); |
| 4982 } | 4957 } |
| 4983 | 4958 |
| 4984 ACCESSORS(JSFunction, prototype_or_initial_map, Object, | 4959 ACCESSORS(JSFunction, prototype_or_initial_map, Object, |
| 4985 kPrototypeOrInitialMapOffset) | 4960 kPrototypeOrInitialMapOffset) |
| 4986 | 4961 |
| 4987 | 4962 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5272 byte* Code::instruction_end() { | 5247 byte* Code::instruction_end() { |
| 5273 return instruction_start() + instruction_size(); | 5248 return instruction_start() + instruction_size(); |
| 5274 } | 5249 } |
| 5275 | 5250 |
| 5276 | 5251 |
| 5277 int Code::body_size() { | 5252 int Code::body_size() { |
| 5278 return RoundUp(instruction_size(), kObjectAlignment); | 5253 return RoundUp(instruction_size(), kObjectAlignment); |
| 5279 } | 5254 } |
| 5280 | 5255 |
| 5281 | 5256 |
| 5282 FixedArray* Code::unchecked_deoptimization_data() { | |
| 5283 return reinterpret_cast<FixedArray*>( | |
| 5284 READ_FIELD(this, kDeoptimizationDataOffset)); | |
| 5285 } | |
| 5286 | |
| 5287 | |
| 5288 ByteArray* Code::unchecked_relocation_info() { | 5257 ByteArray* Code::unchecked_relocation_info() { |
| 5289 return reinterpret_cast<ByteArray*>(READ_FIELD(this, kRelocationInfoOffset)); | 5258 return reinterpret_cast<ByteArray*>(READ_FIELD(this, kRelocationInfoOffset)); |
| 5290 } | 5259 } |
| 5291 | 5260 |
| 5292 | 5261 |
| 5293 byte* Code::relocation_start() { | 5262 byte* Code::relocation_start() { |
| 5294 return unchecked_relocation_info()->GetDataStartAddress(); | 5263 return unchecked_relocation_info()->GetDataStartAddress(); |
| 5295 } | 5264 } |
| 5296 | 5265 |
| 5297 | 5266 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5353 | 5322 |
| 5354 | 5323 |
| 5355 JSRegExp::Type JSRegExp::TypeTag() { | 5324 JSRegExp::Type JSRegExp::TypeTag() { |
| 5356 Object* data = this->data(); | 5325 Object* data = this->data(); |
| 5357 if (data->IsUndefined()) return JSRegExp::NOT_COMPILED; | 5326 if (data->IsUndefined()) return JSRegExp::NOT_COMPILED; |
| 5358 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex)); | 5327 Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex)); |
| 5359 return static_cast<JSRegExp::Type>(smi->value()); | 5328 return static_cast<JSRegExp::Type>(smi->value()); |
| 5360 } | 5329 } |
| 5361 | 5330 |
| 5362 | 5331 |
| 5363 JSRegExp::Type JSRegExp::TypeTagUnchecked() { | |
| 5364 Smi* smi = Smi::cast(DataAtUnchecked(kTagIndex)); | |
| 5365 return static_cast<JSRegExp::Type>(smi->value()); | |
| 5366 } | |
| 5367 | |
| 5368 | |
| 5369 int JSRegExp::CaptureCount() { | 5332 int JSRegExp::CaptureCount() { |
| 5370 switch (TypeTag()) { | 5333 switch (TypeTag()) { |
| 5371 case ATOM: | 5334 case ATOM: |
| 5372 return 0; | 5335 return 0; |
| 5373 case IRREGEXP: | 5336 case IRREGEXP: |
| 5374 return Smi::cast(DataAt(kIrregexpCaptureCountIndex))->value(); | 5337 return Smi::cast(DataAt(kIrregexpCaptureCountIndex))->value(); |
| 5375 default: | 5338 default: |
| 5376 UNREACHABLE(); | 5339 UNREACHABLE(); |
| 5377 return -1; | 5340 return -1; |
| 5378 } | 5341 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 5394 return pattern; | 5357 return pattern; |
| 5395 } | 5358 } |
| 5396 | 5359 |
| 5397 | 5360 |
| 5398 Object* JSRegExp::DataAt(int index) { | 5361 Object* JSRegExp::DataAt(int index) { |
| 5399 ASSERT(TypeTag() != NOT_COMPILED); | 5362 ASSERT(TypeTag() != NOT_COMPILED); |
| 5400 return FixedArray::cast(data())->get(index); | 5363 return FixedArray::cast(data())->get(index); |
| 5401 } | 5364 } |
| 5402 | 5365 |
| 5403 | 5366 |
| 5404 Object* JSRegExp::DataAtUnchecked(int index) { | |
| 5405 FixedArray* fa = reinterpret_cast<FixedArray*>(data()); | |
| 5406 int offset = FixedArray::kHeaderSize + index * kPointerSize; | |
| 5407 return READ_FIELD(fa, offset); | |
| 5408 } | |
| 5409 | |
| 5410 | |
| 5411 void JSRegExp::SetDataAt(int index, Object* value) { | 5367 void JSRegExp::SetDataAt(int index, Object* value) { |
| 5412 ASSERT(TypeTag() != NOT_COMPILED); | 5368 ASSERT(TypeTag() != NOT_COMPILED); |
| 5413 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. | 5369 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. |
| 5414 FixedArray::cast(data())->set(index, value); | 5370 FixedArray::cast(data())->set(index, value); |
| 5415 } | 5371 } |
| 5416 | 5372 |
| 5417 | 5373 |
| 5418 void JSRegExp::SetDataAtUnchecked(int index, Object* value, Heap* heap) { | |
| 5419 ASSERT(index >= kDataIndex); // Only implementation data can be set this way. | |
| 5420 FixedArray* fa = reinterpret_cast<FixedArray*>(data()); | |
| 5421 if (value->IsSmi()) { | |
| 5422 fa->set_unchecked(index, Smi::cast(value)); | |
| 5423 } else { | |
| 5424 // We only do this during GC, so we don't need to notify the write barrier. | |
| 5425 fa->set_unchecked(heap, index, value, SKIP_WRITE_BARRIER); | |
| 5426 } | |
| 5427 } | |
| 5428 | |
| 5429 | |
| 5430 ElementsKind JSObject::GetElementsKind() { | 5374 ElementsKind JSObject::GetElementsKind() { |
| 5431 ElementsKind kind = map()->elements_kind(); | 5375 ElementsKind kind = map()->elements_kind(); |
| 5432 #if DEBUG | 5376 #if DEBUG |
| 5433 FixedArrayBase* fixed_array = | 5377 FixedArrayBase* fixed_array = |
| 5434 reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset)); | 5378 reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset)); |
| 5435 Map* map = fixed_array->map(); | 5379 Map* map = fixed_array->map(); |
| 5436 ASSERT((IsFastSmiOrObjectElementsKind(kind) && | 5380 ASSERT((IsFastSmiOrObjectElementsKind(kind) && |
| 5437 (map == GetHeap()->fixed_array_map() || | 5381 (map == GetHeap()->fixed_array_map() || |
| 5438 map == GetHeap()->fixed_cow_array_map())) || | 5382 map == GetHeap()->fixed_cow_array_map())) || |
| 5439 (IsFastDoubleElementsKind(kind) && | 5383 (IsFastDoubleElementsKind(kind) && |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6013 void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) { | 5957 void TypeFeedbackCells::SetAstId(int index, TypeFeedbackId id) { |
| 6014 set(1 + index * 2, Smi::FromInt(id.ToInt())); | 5958 set(1 + index * 2, Smi::FromInt(id.ToInt())); |
| 6015 } | 5959 } |
| 6016 | 5960 |
| 6017 | 5961 |
| 6018 TypeFeedbackId TypeFeedbackCells::AstId(int index) { | 5962 TypeFeedbackId TypeFeedbackCells::AstId(int index) { |
| 6019 return TypeFeedbackId(Smi::cast(get(1 + index * 2))->value()); | 5963 return TypeFeedbackId(Smi::cast(get(1 + index * 2))->value()); |
| 6020 } | 5964 } |
| 6021 | 5965 |
| 6022 | 5966 |
| 6023 void TypeFeedbackCells::SetCell(int index, JSGlobalPropertyCell* cell) { | 5967 void TypeFeedbackCells::SetCell(int index, Cell* cell) { |
| 6024 set(index * 2, cell); | 5968 set(index * 2, cell); |
| 6025 } | 5969 } |
| 6026 | 5970 |
| 6027 | 5971 |
| 6028 JSGlobalPropertyCell* TypeFeedbackCells::Cell(int index) { | 5972 Cell* TypeFeedbackCells::GetCell(int index) { |
| 6029 return JSGlobalPropertyCell::cast(get(index * 2)); | 5973 return Cell::cast(get(index * 2)); |
| 6030 } | 5974 } |
| 6031 | 5975 |
| 6032 | 5976 |
| 6033 Handle<Object> TypeFeedbackCells::UninitializedSentinel(Isolate* isolate) { | 5977 Handle<Object> TypeFeedbackCells::UninitializedSentinel(Isolate* isolate) { |
| 6034 return isolate->factory()->the_hole_value(); | 5978 return isolate->factory()->the_hole_value(); |
| 6035 } | 5979 } |
| 6036 | 5980 |
| 6037 | 5981 |
| 6038 Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) { | 5982 Handle<Object> TypeFeedbackCells::MegamorphicSentinel(Isolate* isolate) { |
| 6039 return isolate->factory()->undefined_value(); | 5983 return isolate->factory()->undefined_value(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6240 #undef WRITE_UINT32_FIELD | 6184 #undef WRITE_UINT32_FIELD |
| 6241 #undef READ_SHORT_FIELD | 6185 #undef READ_SHORT_FIELD |
| 6242 #undef WRITE_SHORT_FIELD | 6186 #undef WRITE_SHORT_FIELD |
| 6243 #undef READ_BYTE_FIELD | 6187 #undef READ_BYTE_FIELD |
| 6244 #undef WRITE_BYTE_FIELD | 6188 #undef WRITE_BYTE_FIELD |
| 6245 | 6189 |
| 6246 | 6190 |
| 6247 } } // namespace v8::internal | 6191 } } // namespace v8::internal |
| 6248 | 6192 |
| 6249 #endif // V8_OBJECTS_INL_H_ | 6193 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |