| OLD | NEW | 
|---|
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 // | 4 // | 
| 5 // Review notes: | 5 // Review notes: | 
| 6 // | 6 // | 
| 7 // - The use of macros in these inline functions may seem superfluous | 7 // - The use of macros in these inline functions may seem superfluous | 
| 8 // but it is absolutely needed to make sure gcc generates optimal | 8 // but it is absolutely needed to make sure gcc generates optimal | 
| 9 // code. gcc is not happy when attempting to inline too deep. | 9 // code. gcc is not happy when attempting to inline too deep. | 
| 10 // | 10 // | 
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 148 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) | 148 TYPE_CHECKER(HeapNumber, HEAP_NUMBER_TYPE) | 
| 149 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE) | 149 TYPE_CHECKER(MutableHeapNumber, MUTABLE_HEAP_NUMBER_TYPE) | 
| 150 TYPE_CHECKER(Symbol, SYMBOL_TYPE) | 150 TYPE_CHECKER(Symbol, SYMBOL_TYPE) | 
| 151 TYPE_CHECKER(Simd128Value, SIMD128_VALUE_TYPE) | 151 TYPE_CHECKER(Simd128Value, SIMD128_VALUE_TYPE) | 
| 152 | 152 | 
| 153 #define SIMD128_TYPE_CHECKER(TYPE, Type, type, lane_count, lane_type) \ | 153 #define SIMD128_TYPE_CHECKER(TYPE, Type, type, lane_count, lane_type) \ | 
| 154   bool HeapObject::Is##Type() const { return map() == GetHeap()->type##_map(); } | 154   bool HeapObject::Is##Type() const { return map() == GetHeap()->type##_map(); } | 
| 155 SIMD128_TYPES(SIMD128_TYPE_CHECKER) | 155 SIMD128_TYPES(SIMD128_TYPE_CHECKER) | 
| 156 #undef SIMD128_TYPE_CHECKER | 156 #undef SIMD128_TYPE_CHECKER | 
| 157 | 157 | 
|  | 158 // TODO(cbruni): remove once all the isolate-based versions are in place. | 
| 158 #define IS_TYPE_FUNCTION_DEF(type_)                               \ | 159 #define IS_TYPE_FUNCTION_DEF(type_)                               \ | 
| 159   bool Object::Is##type_() const {                                \ | 160   bool Object::Is##type_() const {                                \ | 
| 160     return IsHeapObject() && HeapObject::cast(this)->Is##type_(); \ | 161     return IsHeapObject() && HeapObject::cast(this)->Is##type_(); \ | 
| 161   } | 162   } | 
| 162 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF) | 163 HEAP_OBJECT_TYPE_LIST(IS_TYPE_FUNCTION_DEF) | 
| 163 ODDBALL_LIST(IS_TYPE_FUNCTION_DEF) | 164 ODDBALL_LIST(IS_TYPE_FUNCTION_DEF) | 
| 164 #undef IS_TYPE_FUNCTION_DEF | 165 #undef IS_TYPE_FUNCTION_DEF | 
| 165 | 166 | 
|  | 167 bool HeapObject::IsTheHole(Isolate* isolate) const { | 
|  | 168   return this == isolate->heap()->the_hole_value(); | 
|  | 169 } | 
|  | 170 | 
|  | 171 bool HeapObject::IsUndefined(Isolate* isolate) const { | 
|  | 172   return this == isolate->heap()->undefined_value(); | 
|  | 173 } | 
|  | 174 | 
|  | 175 bool Object::IsTheHole(Isolate* isolate) const { | 
|  | 176   return this == isolate->heap()->the_hole_value(); | 
|  | 177 } | 
|  | 178 | 
|  | 179 bool Object::IsUndefined(Isolate* isolate) const { | 
|  | 180   return this == isolate->heap()->undefined_value(); | 
|  | 181 } | 
|  | 182 | 
| 166 bool HeapObject::IsString() const { | 183 bool HeapObject::IsString() const { | 
| 167   return map()->instance_type() < FIRST_NONSTRING_TYPE; | 184   return map()->instance_type() < FIRST_NONSTRING_TYPE; | 
| 168 } | 185 } | 
| 169 | 186 | 
| 170 bool HeapObject::IsName() const { | 187 bool HeapObject::IsName() const { | 
| 171   return map()->instance_type() <= LAST_NAME_TYPE; | 188   return map()->instance_type() <= LAST_NAME_TYPE; | 
| 172 } | 189 } | 
| 173 | 190 | 
| 174 bool HeapObject::IsUniqueName() const { | 191 bool HeapObject::IsUniqueName() const { | 
| 175   return IsInternalizedString() || IsSymbol(); | 192   return IsInternalizedString() || IsSymbol(); | 
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 238   return StringShape(String::cast(this)).IsExternal() && | 255   return StringShape(String::cast(this)).IsExternal() && | 
| 239          String::cast(this)->IsOneByteRepresentation(); | 256          String::cast(this)->IsOneByteRepresentation(); | 
| 240 } | 257 } | 
| 241 | 258 | 
| 242 bool HeapObject::IsExternalTwoByteString() const { | 259 bool HeapObject::IsExternalTwoByteString() const { | 
| 243   if (!IsString()) return false; | 260   if (!IsString()) return false; | 
| 244   return StringShape(String::cast(this)).IsExternal() && | 261   return StringShape(String::cast(this)).IsExternal() && | 
| 245          String::cast(this)->IsTwoByteRepresentation(); | 262          String::cast(this)->IsTwoByteRepresentation(); | 
| 246 } | 263 } | 
| 247 | 264 | 
| 248 |  | 
| 249 bool Object::HasValidElements() { | 265 bool Object::HasValidElements() { | 
| 250   // Dictionary is covered under FixedArray. | 266   // Dictionary is covered under FixedArray. | 
| 251   return IsFixedArray() || IsFixedDoubleArray() || IsFixedTypedArrayBase(); | 267   return IsFixedArray() || IsFixedDoubleArray() || IsFixedTypedArrayBase(); | 
| 252 } | 268 } | 
| 253 | 269 | 
| 254 | 270 | 
| 255 bool Object::KeyEquals(Object* second) { | 271 bool Object::KeyEquals(Object* second) { | 
| 256   Object* first = this; | 272   Object* first = this; | 
| 257   if (second->IsNumber()) { | 273   if (second->IsNumber()) { | 
| 258     if (first->IsNumber()) return first->Number() == second->Number(); | 274     if (first->IsNumber()) return first->Number() == second->Number(); | 
| (...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1795                                         Object** objects, | 1811                                         Object** objects, | 
| 1796                                         uint32_t count, | 1812                                         uint32_t count, | 
| 1797                                         EnsureElementsMode mode) { | 1813                                         EnsureElementsMode mode) { | 
| 1798   ElementsKind current_kind = object->GetElementsKind(); | 1814   ElementsKind current_kind = object->GetElementsKind(); | 
| 1799   ElementsKind target_kind = current_kind; | 1815   ElementsKind target_kind = current_kind; | 
| 1800   { | 1816   { | 
| 1801     DisallowHeapAllocation no_allocation; | 1817     DisallowHeapAllocation no_allocation; | 
| 1802     DCHECK(mode != ALLOW_COPIED_DOUBLE_ELEMENTS); | 1818     DCHECK(mode != ALLOW_COPIED_DOUBLE_ELEMENTS); | 
| 1803     bool is_holey = IsFastHoleyElementsKind(current_kind); | 1819     bool is_holey = IsFastHoleyElementsKind(current_kind); | 
| 1804     if (current_kind == FAST_HOLEY_ELEMENTS) return; | 1820     if (current_kind == FAST_HOLEY_ELEMENTS) return; | 
| 1805     Heap* heap = object->GetHeap(); | 1821     Object* the_hole = object->GetHeap()->the_hole_value(); | 
| 1806     Object* the_hole = heap->the_hole_value(); |  | 
| 1807     for (uint32_t i = 0; i < count; ++i) { | 1822     for (uint32_t i = 0; i < count; ++i) { | 
| 1808       Object* current = *objects++; | 1823       Object* current = *objects++; | 
| 1809       if (current == the_hole) { | 1824       if (current == the_hole) { | 
| 1810         is_holey = true; | 1825         is_holey = true; | 
| 1811         target_kind = GetHoleyElementsKind(target_kind); | 1826         target_kind = GetHoleyElementsKind(target_kind); | 
| 1812       } else if (!current->IsSmi()) { | 1827       } else if (!current->IsSmi()) { | 
| 1813         if (mode == ALLOW_CONVERTED_DOUBLE_ELEMENTS && current->IsNumber()) { | 1828         if (mode == ALLOW_CONVERTED_DOUBLE_ELEMENTS && current->IsNumber()) { | 
| 1814           if (IsFastSmiElementsKind(target_kind)) { | 1829           if (IsFastSmiElementsKind(target_kind)) { | 
| 1815             if (is_holey) { | 1830             if (is_holey) { | 
| 1816               target_kind = FAST_HOLEY_DOUBLE_ELEMENTS; | 1831               target_kind = FAST_HOLEY_DOUBLE_ELEMENTS; | 
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2002     WRITE_BARRIER(GetHeap(), this, kNextOffset, val); | 2017     WRITE_BARRIER(GetHeap(), this, kNextOffset, val); | 
| 2003   } | 2018   } | 
| 2004 } | 2019 } | 
| 2005 | 2020 | 
| 2006 | 2021 | 
| 2007 void WeakCell::clear_next(Object* the_hole_value) { | 2022 void WeakCell::clear_next(Object* the_hole_value) { | 
| 2008   DCHECK_EQ(GetHeap()->the_hole_value(), the_hole_value); | 2023   DCHECK_EQ(GetHeap()->the_hole_value(), the_hole_value); | 
| 2009   set_next(the_hole_value, SKIP_WRITE_BARRIER); | 2024   set_next(the_hole_value, SKIP_WRITE_BARRIER); | 
| 2010 } | 2025 } | 
| 2011 | 2026 | 
| 2012 | 2027 bool WeakCell::next_cleared() { return next()->IsTheHole(GetIsolate()); } | 
| 2013 bool WeakCell::next_cleared() { return next()->IsTheHole(); } |  | 
| 2014 |  | 
| 2015 | 2028 | 
| 2016 int JSObject::GetHeaderSize() { return GetHeaderSize(map()->instance_type()); } | 2029 int JSObject::GetHeaderSize() { return GetHeaderSize(map()->instance_type()); } | 
| 2017 | 2030 | 
| 2018 | 2031 | 
| 2019 int JSObject::GetHeaderSize(InstanceType type) { | 2032 int JSObject::GetHeaderSize(InstanceType type) { | 
| 2020   // Check for the most common kind of JavaScript object before | 2033   // Check for the most common kind of JavaScript object before | 
| 2021   // falling into the generic switch. This speeds up the internal | 2034   // falling into the generic switch. This speeds up the internal | 
| 2022   // field operations considerably on average. | 2035   // field operations considerably on average. | 
| 2023   if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; | 2036   if (type == JS_OBJECT_TYPE) return JSObject::kHeaderSize; | 
| 2024   switch (type) { | 2037   switch (type) { | 
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2274 bool Object::ToArrayLength(uint32_t* index) { return Object::ToUint32(index); } | 2287 bool Object::ToArrayLength(uint32_t* index) { return Object::ToUint32(index); } | 
| 2275 | 2288 | 
| 2276 | 2289 | 
| 2277 bool Object::ToArrayIndex(uint32_t* index) { | 2290 bool Object::ToArrayIndex(uint32_t* index) { | 
| 2278   return Object::ToUint32(index) && *index != kMaxUInt32; | 2291   return Object::ToUint32(index) && *index != kMaxUInt32; | 
| 2279 } | 2292 } | 
| 2280 | 2293 | 
| 2281 | 2294 | 
| 2282 void Object::VerifyApiCallResultType() { | 2295 void Object::VerifyApiCallResultType() { | 
| 2283 #if DEBUG | 2296 #if DEBUG | 
| 2284   if (!(IsSmi() || IsString() || IsSymbol() || IsJSReceiver() || | 2297   if (IsSmi()) return; | 
| 2285         IsHeapNumber() || IsSimd128Value() || IsUndefined() || IsTrue() || | 2298   DCHECK(IsHeapObject()); | 
| 2286         IsFalse() || IsNull())) { | 2299   Isolate* isolate = HeapObject::cast(this)->GetIsolate(); | 
|  | 2300   if (!(IsString() || IsSymbol() || IsJSReceiver() || IsHeapNumber() || | 
|  | 2301         IsSimd128Value() || IsUndefined(isolate) || IsTrue() || IsFalse() || | 
|  | 2302         IsNull())) { | 
| 2287     FATAL("API call returned invalid object"); | 2303     FATAL("API call returned invalid object"); | 
| 2288   } | 2304   } | 
| 2289 #endif  // DEBUG | 2305 #endif  // DEBUG | 
| 2290 } | 2306 } | 
| 2291 | 2307 | 
| 2292 | 2308 | 
| 2293 Object* FixedArray::get(int index) const { | 2309 Object* FixedArray::get(int index) const { | 
| 2294   SLOW_DCHECK(index >= 0 && index < this->length()); | 2310   SLOW_DCHECK(index >= 0 && index < this->length()); | 
| 2295   return READ_FIELD(this, kHeaderSize + index * kPointerSize); | 2311   return READ_FIELD(this, kHeaderSize + index * kPointerSize); | 
| 2296 } | 2312 } | 
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2459   return data_start() + kFirstIndex + index; | 2475   return data_start() + kFirstIndex + index; | 
| 2460 } | 2476 } | 
| 2461 | 2477 | 
| 2462 | 2478 | 
| 2463 void ArrayList::Set(int index, Object* obj) { | 2479 void ArrayList::Set(int index, Object* obj) { | 
| 2464   FixedArray::cast(this)->set(kFirstIndex + index, obj); | 2480   FixedArray::cast(this)->set(kFirstIndex + index, obj); | 
| 2465 } | 2481 } | 
| 2466 | 2482 | 
| 2467 | 2483 | 
| 2468 void ArrayList::Clear(int index, Object* undefined) { | 2484 void ArrayList::Clear(int index, Object* undefined) { | 
| 2469   DCHECK(undefined->IsUndefined()); | 2485   DCHECK(undefined->IsUndefined(GetIsolate())); | 
| 2470   FixedArray::cast(this) | 2486   FixedArray::cast(this) | 
| 2471       ->set(kFirstIndex + index, undefined, SKIP_WRITE_BARRIER); | 2487       ->set(kFirstIndex + index, undefined, SKIP_WRITE_BARRIER); | 
| 2472 } | 2488 } | 
| 2473 | 2489 | 
| 2474 | 2490 | 
| 2475 WriteBarrierMode HeapObject::GetWriteBarrierMode( | 2491 WriteBarrierMode HeapObject::GetWriteBarrierMode( | 
| 2476     const DisallowHeapAllocation& promise) { | 2492     const DisallowHeapAllocation& promise) { | 
| 2477   Heap* heap = GetHeap(); | 2493   Heap* heap = GetHeap(); | 
| 2478   if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; | 2494   if (heap->incremental_marking()->IsMarking()) return UPDATE_WRITE_BARRIER; | 
| 2479   if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; | 2495   if (heap->InNewSpace(this)) return SKIP_WRITE_BARRIER; | 
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 3034   const int kMinCapacity = 4; | 3050   const int kMinCapacity = 4; | 
| 3035   int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); | 3051   int capacity = base::bits::RoundUpToPowerOfTwo32(at_least_space_for * 2); | 
| 3036   return Max(capacity, kMinCapacity); | 3052   return Max(capacity, kMinCapacity); | 
| 3037 } | 3053 } | 
| 3038 | 3054 | 
| 3039 bool HashTableBase::IsKey(Heap* heap, Object* k) { | 3055 bool HashTableBase::IsKey(Heap* heap, Object* k) { | 
| 3040   return k != heap->the_hole_value() && k != heap->undefined_value(); | 3056   return k != heap->the_hole_value() && k != heap->undefined_value(); | 
| 3041 } | 3057 } | 
| 3042 | 3058 | 
| 3043 bool HashTableBase::IsKey(Object* k) { | 3059 bool HashTableBase::IsKey(Object* k) { | 
| 3044   return !k->IsTheHole() && !k->IsUndefined(); | 3060   Isolate* isolate = this->GetIsolate(); | 
|  | 3061   return !k->IsTheHole(isolate) && !k->IsUndefined(isolate); | 
| 3045 } | 3062 } | 
| 3046 | 3063 | 
| 3047 | 3064 | 
| 3048 void HashTableBase::SetNumberOfElements(int nof) { | 3065 void HashTableBase::SetNumberOfElements(int nof) { | 
| 3049   set(kNumberOfElementsIndex, Smi::FromInt(nof)); | 3066   set(kNumberOfElementsIndex, Smi::FromInt(nof)); | 
| 3050 } | 3067 } | 
| 3051 | 3068 | 
| 3052 | 3069 | 
| 3053 void HashTableBase::SetNumberOfDeletedElements(int nod) { | 3070 void HashTableBase::SetNumberOfDeletedElements(int nod) { | 
| 3054   set(kNumberOfDeletedElementsIndex, Smi::FromInt(nod)); | 3071   set(kNumberOfDeletedElementsIndex, Smi::FromInt(nod)); | 
| (...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 4234   ElementType cast_value = Traits::defaultValue(); | 4251   ElementType cast_value = Traits::defaultValue(); | 
| 4235   if (value->IsSmi()) { | 4252   if (value->IsSmi()) { | 
| 4236     int int_value = Smi::cast(value)->value(); | 4253     int int_value = Smi::cast(value)->value(); | 
| 4237     cast_value = from_int(int_value); | 4254     cast_value = from_int(int_value); | 
| 4238   } else if (value->IsHeapNumber()) { | 4255   } else if (value->IsHeapNumber()) { | 
| 4239     double double_value = HeapNumber::cast(value)->value(); | 4256     double double_value = HeapNumber::cast(value)->value(); | 
| 4240     cast_value = from_double(double_value); | 4257     cast_value = from_double(double_value); | 
| 4241   } else { | 4258   } else { | 
| 4242     // Clamp undefined to the default value. All other types have been | 4259     // Clamp undefined to the default value. All other types have been | 
| 4243     // converted to a number type further up in the call chain. | 4260     // converted to a number type further up in the call chain. | 
| 4244     DCHECK(value->IsUndefined()); | 4261     DCHECK(value->IsUndefined(GetIsolate())); | 
| 4245   } | 4262   } | 
| 4246   set(index, cast_value); | 4263   set(index, cast_value); | 
| 4247 } | 4264 } | 
| 4248 | 4265 | 
| 4249 | 4266 | 
| 4250 Handle<Object> Uint8ArrayTraits::ToHandle(Isolate* isolate, uint8_t scalar) { | 4267 Handle<Object> Uint8ArrayTraits::ToHandle(Isolate* isolate, uint8_t scalar) { | 
| 4251   return handle(Smi::FromInt(scalar), isolate); | 4268   return handle(Smi::FromInt(scalar), isolate); | 
| 4252 } | 4269 } | 
| 4253 | 4270 | 
| 4254 | 4271 | 
| (...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5418 void Map::set_prototype_info(Object* value, WriteBarrierMode mode) { | 5435 void Map::set_prototype_info(Object* value, WriteBarrierMode mode) { | 
| 5419   DCHECK(is_prototype_map()); | 5436   DCHECK(is_prototype_map()); | 
| 5420   WRITE_FIELD(this, Map::kTransitionsOrPrototypeInfoOffset, value); | 5437   WRITE_FIELD(this, Map::kTransitionsOrPrototypeInfoOffset, value); | 
| 5421   CONDITIONAL_WRITE_BARRIER( | 5438   CONDITIONAL_WRITE_BARRIER( | 
| 5422       GetHeap(), this, Map::kTransitionsOrPrototypeInfoOffset, value, mode); | 5439       GetHeap(), this, Map::kTransitionsOrPrototypeInfoOffset, value, mode); | 
| 5423 } | 5440 } | 
| 5424 | 5441 | 
| 5425 | 5442 | 
| 5426 void Map::SetBackPointer(Object* value, WriteBarrierMode mode) { | 5443 void Map::SetBackPointer(Object* value, WriteBarrierMode mode) { | 
| 5427   DCHECK(instance_type() >= FIRST_JS_RECEIVER_TYPE); | 5444   DCHECK(instance_type() >= FIRST_JS_RECEIVER_TYPE); | 
| 5428   DCHECK((value->IsMap() && GetBackPointer()->IsUndefined())); | 5445   DCHECK(value->IsMap()); | 
|  | 5446   DCHECK(GetBackPointer()->IsUndefined(GetIsolate())); | 
| 5429   DCHECK(!value->IsMap() || | 5447   DCHECK(!value->IsMap() || | 
| 5430          Map::cast(value)->GetConstructor() == constructor_or_backpointer()); | 5448          Map::cast(value)->GetConstructor() == constructor_or_backpointer()); | 
| 5431   set_constructor_or_backpointer(value, mode); | 5449   set_constructor_or_backpointer(value, mode); | 
| 5432 } | 5450 } | 
| 5433 | 5451 | 
| 5434 ACCESSORS(Map, code_cache, FixedArray, kCodeCacheOffset) | 5452 ACCESSORS(Map, code_cache, FixedArray, kCodeCacheOffset) | 
| 5435 ACCESSORS(Map, dependent_code, DependentCode, kDependentCodeOffset) | 5453 ACCESSORS(Map, dependent_code, DependentCode, kDependentCodeOffset) | 
| 5436 ACCESSORS(Map, weak_cell_cache, Object, kWeakCellCacheOffset) | 5454 ACCESSORS(Map, weak_cell_cache, Object, kWeakCellCacheOffset) | 
| 5437 ACCESSORS(Map, constructor_or_backpointer, Object, | 5455 ACCESSORS(Map, constructor_or_backpointer, Object, | 
| 5438           kConstructorOrBackPointerOffset) | 5456           kConstructorOrBackPointerOffset) | 
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 5957   return function_data()->IsFunctionTemplateInfo(); | 5975   return function_data()->IsFunctionTemplateInfo(); | 
| 5958 } | 5976 } | 
| 5959 | 5977 | 
| 5960 | 5978 | 
| 5961 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { | 5979 FunctionTemplateInfo* SharedFunctionInfo::get_api_func_data() { | 
| 5962   DCHECK(IsApiFunction()); | 5980   DCHECK(IsApiFunction()); | 
| 5963   return FunctionTemplateInfo::cast(function_data()); | 5981   return FunctionTemplateInfo::cast(function_data()); | 
| 5964 } | 5982 } | 
| 5965 | 5983 | 
| 5966 void SharedFunctionInfo::set_api_func_data(FunctionTemplateInfo* data) { | 5984 void SharedFunctionInfo::set_api_func_data(FunctionTemplateInfo* data) { | 
| 5967   DCHECK(function_data()->IsUndefined()); | 5985   DCHECK(function_data()->IsUndefined(GetIsolate())); | 
| 5968   set_function_data(data); | 5986   set_function_data(data); | 
| 5969 } | 5987 } | 
| 5970 | 5988 | 
| 5971 bool SharedFunctionInfo::HasBytecodeArray() { | 5989 bool SharedFunctionInfo::HasBytecodeArray() { | 
| 5972   return function_data()->IsBytecodeArray(); | 5990   return function_data()->IsBytecodeArray(); | 
| 5973 } | 5991 } | 
| 5974 | 5992 | 
| 5975 BytecodeArray* SharedFunctionInfo::bytecode_array() { | 5993 BytecodeArray* SharedFunctionInfo::bytecode_array() { | 
| 5976   DCHECK(HasBytecodeArray()); | 5994   DCHECK(HasBytecodeArray()); | 
| 5977   return BytecodeArray::cast(function_data()); | 5995   return BytecodeArray::cast(function_data()); | 
| 5978 } | 5996 } | 
| 5979 | 5997 | 
| 5980 void SharedFunctionInfo::set_bytecode_array(BytecodeArray* bytecode) { | 5998 void SharedFunctionInfo::set_bytecode_array(BytecodeArray* bytecode) { | 
| 5981   DCHECK(function_data()->IsUndefined()); | 5999   DCHECK(function_data()->IsUndefined(GetIsolate())); | 
| 5982   set_function_data(bytecode); | 6000   set_function_data(bytecode); | 
| 5983 } | 6001 } | 
| 5984 | 6002 | 
| 5985 void SharedFunctionInfo::ClearBytecodeArray() { | 6003 void SharedFunctionInfo::ClearBytecodeArray() { | 
| 5986   DCHECK(function_data()->IsUndefined() || HasBytecodeArray()); | 6004   DCHECK(function_data()->IsUndefined(GetIsolate()) || HasBytecodeArray()); | 
| 5987   set_function_data(GetHeap()->undefined_value()); | 6005   set_function_data(GetHeap()->undefined_value()); | 
| 5988 } | 6006 } | 
| 5989 | 6007 | 
| 5990 bool SharedFunctionInfo::HasBuiltinFunctionId() { | 6008 bool SharedFunctionInfo::HasBuiltinFunctionId() { | 
| 5991   return function_identifier()->IsSmi(); | 6009   return function_identifier()->IsSmi(); | 
| 5992 } | 6010 } | 
| 5993 | 6011 | 
| 5994 BuiltinFunctionId SharedFunctionInfo::builtin_function_id() { | 6012 BuiltinFunctionId SharedFunctionInfo::builtin_function_id() { | 
| 5995   DCHECK(HasBuiltinFunctionId()); | 6013   DCHECK(HasBuiltinFunctionId()); | 
| 5996   return static_cast<BuiltinFunctionId>( | 6014   return static_cast<BuiltinFunctionId>( | 
| 5997       Smi::cast(function_identifier())->value()); | 6015       Smi::cast(function_identifier())->value()); | 
| 5998 } | 6016 } | 
| 5999 | 6017 | 
| 6000 void SharedFunctionInfo::set_builtin_function_id(BuiltinFunctionId id) { | 6018 void SharedFunctionInfo::set_builtin_function_id(BuiltinFunctionId id) { | 
| 6001   set_function_identifier(Smi::FromInt(id)); | 6019   set_function_identifier(Smi::FromInt(id)); | 
| 6002 } | 6020 } | 
| 6003 | 6021 | 
| 6004 bool SharedFunctionInfo::HasInferredName() { | 6022 bool SharedFunctionInfo::HasInferredName() { | 
| 6005   return function_identifier()->IsString(); | 6023   return function_identifier()->IsString(); | 
| 6006 } | 6024 } | 
| 6007 | 6025 | 
| 6008 String* SharedFunctionInfo::inferred_name() { | 6026 String* SharedFunctionInfo::inferred_name() { | 
| 6009   if (HasInferredName()) { | 6027   if (HasInferredName()) { | 
| 6010     return String::cast(function_identifier()); | 6028     return String::cast(function_identifier()); | 
| 6011   } | 6029   } | 
| 6012   DCHECK(function_identifier()->IsUndefined() || HasBuiltinFunctionId()); | 6030   Isolate* isolate = GetIsolate(); | 
| 6013   return GetIsolate()->heap()->empty_string(); | 6031   DCHECK(function_identifier()->IsUndefined(isolate) || HasBuiltinFunctionId()); | 
|  | 6032   return isolate->heap()->empty_string(); | 
| 6014 } | 6033 } | 
| 6015 | 6034 | 
| 6016 void SharedFunctionInfo::set_inferred_name(String* inferred_name) { | 6035 void SharedFunctionInfo::set_inferred_name(String* inferred_name) { | 
| 6017   DCHECK(function_identifier()->IsUndefined() || HasInferredName()); | 6036   DCHECK(function_identifier()->IsUndefined(GetIsolate()) || HasInferredName()); | 
| 6018   set_function_identifier(inferred_name); | 6037   set_function_identifier(inferred_name); | 
| 6019 } | 6038 } | 
| 6020 | 6039 | 
| 6021 int SharedFunctionInfo::ic_age() { | 6040 int SharedFunctionInfo::ic_age() { | 
| 6022   return ICAgeBits::decode(counters()); | 6041   return ICAgeBits::decode(counters()); | 
| 6023 } | 6042 } | 
| 6024 | 6043 | 
| 6025 | 6044 | 
| 6026 void SharedFunctionInfo::set_ic_age(int ic_age) { | 6045 void SharedFunctionInfo::set_ic_age(int ic_age) { | 
| 6027   set_counters(ICAgeBits::update(counters(), ic_age)); | 6046   set_counters(ICAgeBits::update(counters(), ic_age)); | 
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6093 | 6112 | 
| 6094 | 6113 | 
| 6095 void SharedFunctionInfo::set_disable_optimization_reason(BailoutReason reason) { | 6114 void SharedFunctionInfo::set_disable_optimization_reason(BailoutReason reason) { | 
| 6096   set_opt_count_and_bailout_reason(DisabledOptimizationReasonBits::update( | 6115   set_opt_count_and_bailout_reason(DisabledOptimizationReasonBits::update( | 
| 6097       opt_count_and_bailout_reason(), reason)); | 6116       opt_count_and_bailout_reason(), reason)); | 
| 6098 } | 6117 } | 
| 6099 | 6118 | 
| 6100 | 6119 | 
| 6101 bool SharedFunctionInfo::IsBuiltin() { | 6120 bool SharedFunctionInfo::IsBuiltin() { | 
| 6102   Object* script_obj = script(); | 6121   Object* script_obj = script(); | 
| 6103   if (script_obj->IsUndefined()) return true; | 6122   if (script_obj->IsUndefined(GetIsolate())) return true; | 
| 6104   Script* script = Script::cast(script_obj); | 6123   Script* script = Script::cast(script_obj); | 
| 6105   Script::Type type = static_cast<Script::Type>(script->type()); | 6124   Script::Type type = static_cast<Script::Type>(script->type()); | 
| 6106   return type != Script::TYPE_NORMAL; | 6125   return type != Script::TYPE_NORMAL; | 
| 6107 } | 6126 } | 
| 6108 | 6127 | 
| 6109 | 6128 | 
| 6110 bool SharedFunctionInfo::IsSubjectToDebugging() { return !IsBuiltin(); } | 6129 bool SharedFunctionInfo::IsSubjectToDebugging() { return !IsBuiltin(); } | 
| 6111 | 6130 | 
| 6112 | 6131 | 
| 6113 bool SharedFunctionInfo::OptimizedCodeMapIsCleared() const { | 6132 bool SharedFunctionInfo::OptimizedCodeMapIsCleared() const { | 
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6226 | 6245 | 
| 6227 JSObject* JSFunction::global_proxy() { | 6246 JSObject* JSFunction::global_proxy() { | 
| 6228   return context()->global_proxy(); | 6247   return context()->global_proxy(); | 
| 6229 } | 6248 } | 
| 6230 | 6249 | 
| 6231 | 6250 | 
| 6232 Context* JSFunction::native_context() { return context()->native_context(); } | 6251 Context* JSFunction::native_context() { return context()->native_context(); } | 
| 6233 | 6252 | 
| 6234 | 6253 | 
| 6235 void JSFunction::set_context(Object* value) { | 6254 void JSFunction::set_context(Object* value) { | 
| 6236   DCHECK(value->IsUndefined() || value->IsContext()); | 6255   DCHECK(value->IsUndefined(GetIsolate()) || value->IsContext()); | 
| 6237   WRITE_FIELD(this, kContextOffset, value); | 6256   WRITE_FIELD(this, kContextOffset, value); | 
| 6238   WRITE_BARRIER(GetHeap(), this, kContextOffset, value); | 6257   WRITE_BARRIER(GetHeap(), this, kContextOffset, value); | 
| 6239 } | 6258 } | 
| 6240 | 6259 | 
| 6241 ACCESSORS(JSFunction, prototype_or_initial_map, Object, | 6260 ACCESSORS(JSFunction, prototype_or_initial_map, Object, | 
| 6242           kPrototypeOrInitialMapOffset) | 6261           kPrototypeOrInitialMapOffset) | 
| 6243 | 6262 | 
| 6244 | 6263 | 
| 6245 Map* JSFunction::initial_map() { | 6264 Map* JSFunction::initial_map() { | 
| 6246   return Map::cast(prototype_or_initial_map()); | 6265   return Map::cast(prototype_or_initial_map()); | 
| 6247 } | 6266 } | 
| 6248 | 6267 | 
| 6249 | 6268 | 
| 6250 bool JSFunction::has_initial_map() { | 6269 bool JSFunction::has_initial_map() { | 
| 6251   return prototype_or_initial_map()->IsMap(); | 6270   return prototype_or_initial_map()->IsMap(); | 
| 6252 } | 6271 } | 
| 6253 | 6272 | 
| 6254 | 6273 | 
| 6255 bool JSFunction::has_instance_prototype() { | 6274 bool JSFunction::has_instance_prototype() { | 
| 6256   return has_initial_map() || !prototype_or_initial_map()->IsTheHole(); | 6275   return has_initial_map() || | 
|  | 6276          !prototype_or_initial_map()->IsTheHole(GetIsolate()); | 
| 6257 } | 6277 } | 
| 6258 | 6278 | 
| 6259 | 6279 | 
| 6260 bool JSFunction::has_prototype() { | 6280 bool JSFunction::has_prototype() { | 
| 6261   return map()->has_non_instance_prototype() || has_instance_prototype(); | 6281   return map()->has_non_instance_prototype() || has_instance_prototype(); | 
| 6262 } | 6282 } | 
| 6263 | 6283 | 
| 6264 | 6284 | 
| 6265 Object* JSFunction::instance_prototype() { | 6285 Object* JSFunction::instance_prototype() { | 
| 6266   DCHECK(has_instance_prototype()); | 6286   DCHECK(has_instance_prototype()); | 
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 6642 #endif | 6662 #endif | 
| 6643 | 6663 | 
| 6644 | 6664 | 
| 6645 ACCESSORS(JSRegExp, data, Object, kDataOffset) | 6665 ACCESSORS(JSRegExp, data, Object, kDataOffset) | 
| 6646 ACCESSORS(JSRegExp, flags, Object, kFlagsOffset) | 6666 ACCESSORS(JSRegExp, flags, Object, kFlagsOffset) | 
| 6647 ACCESSORS(JSRegExp, source, Object, kSourceOffset) | 6667 ACCESSORS(JSRegExp, source, Object, kSourceOffset) | 
| 6648 | 6668 | 
| 6649 | 6669 | 
| 6650 JSRegExp::Type JSRegExp::TypeTag() { | 6670 JSRegExp::Type JSRegExp::TypeTag() { | 
| 6651   Object* data = this->data(); | 6671   Object* data = this->data(); | 
| 6652   if (data->IsUndefined()) return JSRegExp::NOT_COMPILED; | 6672   if (data->IsUndefined(GetIsolate())) return JSRegExp::NOT_COMPILED; | 
| 6653   Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex)); | 6673   Smi* smi = Smi::cast(FixedArray::cast(data)->get(kTagIndex)); | 
| 6654   return static_cast<JSRegExp::Type>(smi->value()); | 6674   return static_cast<JSRegExp::Type>(smi->value()); | 
| 6655 } | 6675 } | 
| 6656 | 6676 | 
| 6657 | 6677 | 
| 6658 int JSRegExp::CaptureCount() { | 6678 int JSRegExp::CaptureCount() { | 
| 6659   switch (TypeTag()) { | 6679   switch (TypeTag()) { | 
| 6660     case ATOM: | 6680     case ATOM: | 
| 6661       return 0; | 6681       return 0; | 
| 6662     case IRREGEXP: | 6682     case IRREGEXP: | 
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7331   return (getter() == getter_value) && (setter() == setter_value); | 7351   return (getter() == getter_value) && (setter() == setter_value); | 
| 7332 } | 7352 } | 
| 7333 | 7353 | 
| 7334 | 7354 | 
| 7335 bool AccessorPair::ContainsAccessor() { | 7355 bool AccessorPair::ContainsAccessor() { | 
| 7336   return IsJSAccessor(getter()) || IsJSAccessor(setter()); | 7356   return IsJSAccessor(getter()) || IsJSAccessor(setter()); | 
| 7337 } | 7357 } | 
| 7338 | 7358 | 
| 7339 | 7359 | 
| 7340 bool AccessorPair::IsJSAccessor(Object* obj) { | 7360 bool AccessorPair::IsJSAccessor(Object* obj) { | 
| 7341   return obj->IsCallable() || obj->IsUndefined(); | 7361   return obj->IsCallable() || obj->IsUndefined(GetIsolate()); | 
| 7342 } | 7362 } | 
| 7343 | 7363 | 
| 7344 | 7364 | 
| 7345 template<typename Derived, typename Shape, typename Key> | 7365 template<typename Derived, typename Shape, typename Key> | 
| 7346 void Dictionary<Derived, Shape, Key>::SetEntry(int entry, | 7366 void Dictionary<Derived, Shape, Key>::SetEntry(int entry, | 
| 7347                                                Handle<Object> key, | 7367                                                Handle<Object> key, | 
| 7348                                                Handle<Object> value) { | 7368                                                Handle<Object> value) { | 
| 7349   this->SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); | 7369   this->SetEntry(entry, key, value, PropertyDetails(Smi::FromInt(0))); | 
| 7350 } | 7370 } | 
| 7351 | 7371 | 
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7476   Object* raw_value = dict->ValueAt(entry); | 7496   Object* raw_value = dict->ValueAt(entry); | 
| 7477   DCHECK(raw_value->IsPropertyCell()); | 7497   DCHECK(raw_value->IsPropertyCell()); | 
| 7478   PropertyCell* cell = PropertyCell::cast(raw_value); | 7498   PropertyCell* cell = PropertyCell::cast(raw_value); | 
| 7479   cell->set_property_details(value); | 7499   cell->set_property_details(value); | 
| 7480 } | 7500 } | 
| 7481 | 7501 | 
| 7482 | 7502 | 
| 7483 template <typename Dictionary> | 7503 template <typename Dictionary> | 
| 7484 bool GlobalDictionaryShape::IsDeleted(Dictionary* dict, int entry) { | 7504 bool GlobalDictionaryShape::IsDeleted(Dictionary* dict, int entry) { | 
| 7485   DCHECK(dict->ValueAt(entry)->IsPropertyCell()); | 7505   DCHECK(dict->ValueAt(entry)->IsPropertyCell()); | 
| 7486   return PropertyCell::cast(dict->ValueAt(entry))->value()->IsTheHole(); | 7506   Isolate* isolate = dict->GetIsolate(); | 
|  | 7507   return PropertyCell::cast(dict->ValueAt(entry))->value()->IsTheHole(isolate); | 
| 7487 } | 7508 } | 
| 7488 | 7509 | 
| 7489 | 7510 | 
| 7490 bool ObjectHashTableShape::IsMatch(Handle<Object> key, Object* other) { | 7511 bool ObjectHashTableShape::IsMatch(Handle<Object> key, Object* other) { | 
| 7491   return key->SameValue(other); | 7512   return key->SameValue(other); | 
| 7492 } | 7513 } | 
| 7493 | 7514 | 
| 7494 | 7515 | 
| 7495 uint32_t ObjectHashTableShape::Hash(Handle<Object> key) { | 7516 uint32_t ObjectHashTableShape::Hash(Handle<Object> key) { | 
| 7496   return Smi::cast(key->GetHash())->value(); | 7517   return Smi::cast(key->GetHash())->value(); | 
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7750   DCHECK_EQ(isolate_->relocatable_top(), this); | 7771   DCHECK_EQ(isolate_->relocatable_top(), this); | 
| 7751   isolate_->set_relocatable_top(prev_); | 7772   isolate_->set_relocatable_top(prev_); | 
| 7752 } | 7773 } | 
| 7753 | 7774 | 
| 7754 | 7775 | 
| 7755 template<class Derived, class TableType> | 7776 template<class Derived, class TableType> | 
| 7756 Object* OrderedHashTableIterator<Derived, TableType>::CurrentKey() { | 7777 Object* OrderedHashTableIterator<Derived, TableType>::CurrentKey() { | 
| 7757   TableType* table(TableType::cast(this->table())); | 7778   TableType* table(TableType::cast(this->table())); | 
| 7758   int index = Smi::cast(this->index())->value(); | 7779   int index = Smi::cast(this->index())->value(); | 
| 7759   Object* key = table->KeyAt(index); | 7780   Object* key = table->KeyAt(index); | 
| 7760   DCHECK(!key->IsTheHole()); | 7781   DCHECK(!key->IsTheHole(table->GetIsolate())); | 
| 7761   return key; | 7782   return key; | 
| 7762 } | 7783 } | 
| 7763 | 7784 | 
| 7764 | 7785 | 
| 7765 void JSSetIterator::PopulateValueArray(FixedArray* array) { | 7786 void JSSetIterator::PopulateValueArray(FixedArray* array) { | 
| 7766   array->set(0, CurrentKey()); | 7787   array->set(0, CurrentKey()); | 
| 7767 } | 7788 } | 
| 7768 | 7789 | 
| 7769 | 7790 | 
| 7770 void JSMapIterator::PopulateValueArray(FixedArray* array) { | 7791 void JSMapIterator::PopulateValueArray(FixedArray* array) { | 
| 7771   array->set(0, CurrentKey()); | 7792   array->set(0, CurrentKey()); | 
| 7772   array->set(1, CurrentValue()); | 7793   array->set(1, CurrentValue()); | 
| 7773 } | 7794 } | 
| 7774 | 7795 | 
| 7775 | 7796 | 
| 7776 Object* JSMapIterator::CurrentValue() { | 7797 Object* JSMapIterator::CurrentValue() { | 
| 7777   OrderedHashMap* table(OrderedHashMap::cast(this->table())); | 7798   OrderedHashMap* table(OrderedHashMap::cast(this->table())); | 
| 7778   int index = Smi::cast(this->index())->value(); | 7799   int index = Smi::cast(this->index())->value(); | 
| 7779   Object* value = table->ValueAt(index); | 7800   Object* value = table->ValueAt(index); | 
| 7780   DCHECK(!value->IsTheHole()); | 7801   DCHECK(!value->IsTheHole(table->GetIsolate())); | 
| 7781   return value; | 7802   return value; | 
| 7782 } | 7803 } | 
| 7783 | 7804 | 
| 7784 | 7805 | 
| 7785 String::SubStringRange::SubStringRange(String* string, int first, int length) | 7806 String::SubStringRange::SubStringRange(String* string, int first, int length) | 
| 7786     : string_(string), | 7807     : string_(string), | 
| 7787       first_(first), | 7808       first_(first), | 
| 7788       length_(length == -1 ? string->length() : length) {} | 7809       length_(length == -1 ? string->length() : length) {} | 
| 7789 | 7810 | 
| 7790 | 7811 | 
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 7906 #undef WRITE_INT64_FIELD | 7927 #undef WRITE_INT64_FIELD | 
| 7907 #undef READ_BYTE_FIELD | 7928 #undef READ_BYTE_FIELD | 
| 7908 #undef WRITE_BYTE_FIELD | 7929 #undef WRITE_BYTE_FIELD | 
| 7909 #undef NOBARRIER_READ_BYTE_FIELD | 7930 #undef NOBARRIER_READ_BYTE_FIELD | 
| 7910 #undef NOBARRIER_WRITE_BYTE_FIELD | 7931 #undef NOBARRIER_WRITE_BYTE_FIELD | 
| 7911 | 7932 | 
| 7912 }  // namespace internal | 7933 }  // namespace internal | 
| 7913 }  // namespace v8 | 7934 }  // namespace v8 | 
| 7914 | 7935 | 
| 7915 #endif  // V8_OBJECTS_INL_H_ | 7936 #endif  // V8_OBJECTS_INL_H_ | 
| OLD | NEW | 
|---|