OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/bootstrapper.h" | 7 #include "src/bootstrapper.h" |
8 #include "src/deoptimizer.h" | 8 #include "src/deoptimizer.h" |
9 #include "src/lookup.h" | 9 #include "src/lookup.h" |
10 #include "src/lookup-inl.h" | 10 #include "src/lookup-inl.h" |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 DCHECK(!current->IsJSProxy()); | 251 DCHECK(!current->IsJSProxy()); |
252 iter.Advance(); | 252 iter.Advance(); |
253 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); | 253 } while (!iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)); |
254 return false; | 254 return false; |
255 } | 255 } |
256 | 256 |
257 | 257 |
258 Handle<Object> LookupIterator::FetchValue() const { | 258 Handle<Object> LookupIterator::FetchValue() const { |
259 Object* result = NULL; | 259 Object* result = NULL; |
260 Handle<JSObject> holder = GetHolder<JSObject>(); | 260 Handle<JSObject> holder = GetHolder<JSObject>(); |
261 if (holder_map_->is_dictionary_map()) { | 261 if (holder_map_->IsGlobalObjectMap()) { |
| 262 result = holder->global_dictionary()->ValueAt(number_); |
| 263 DCHECK(result->IsPropertyCell()); |
| 264 result = PropertyCell::cast(result)->value(); |
| 265 } else if (holder_map_->is_dictionary_map()) { |
262 result = holder->property_dictionary()->ValueAt(number_); | 266 result = holder->property_dictionary()->ValueAt(number_); |
263 if (holder_map_->IsGlobalObjectMap()) { | |
264 DCHECK(result->IsPropertyCell()); | |
265 result = PropertyCell::cast(result)->value(); | |
266 } | |
267 } else if (property_details_.type() == v8::internal::DATA) { | 267 } else if (property_details_.type() == v8::internal::DATA) { |
268 FieldIndex field_index = FieldIndex::ForDescriptor(*holder_map_, number_); | 268 FieldIndex field_index = FieldIndex::ForDescriptor(*holder_map_, number_); |
269 return JSObject::FastPropertyAt(holder, property_details_.representation(), | 269 return JSObject::FastPropertyAt(holder, property_details_.representation(), |
270 field_index); | 270 field_index); |
271 } else { | 271 } else { |
272 result = holder_map_->instance_descriptors()->GetValue(number_); | 272 result = holder_map_->instance_descriptors()->GetValue(number_); |
273 } | 273 } |
274 return handle(result, isolate_); | 274 return handle(result, isolate_); |
275 } | 275 } |
276 | 276 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 DCHECK_EQ(v8::internal::DATA, property_details_.type()); | 308 DCHECK_EQ(v8::internal::DATA, property_details_.type()); |
309 return handle( | 309 return handle( |
310 holder_map_->instance_descriptors()->GetFieldType(descriptor_number()), | 310 holder_map_->instance_descriptors()->GetFieldType(descriptor_number()), |
311 isolate_); | 311 isolate_); |
312 } | 312 } |
313 | 313 |
314 | 314 |
315 Handle<PropertyCell> LookupIterator::GetPropertyCell() const { | 315 Handle<PropertyCell> LookupIterator::GetPropertyCell() const { |
316 Handle<JSObject> holder = GetHolder<JSObject>(); | 316 Handle<JSObject> holder = GetHolder<JSObject>(); |
317 Handle<GlobalObject> global = Handle<GlobalObject>::cast(holder); | 317 Handle<GlobalObject> global = Handle<GlobalObject>::cast(holder); |
318 Object* value = global->property_dictionary()->ValueAt(dictionary_entry()); | 318 Object* value = global->global_dictionary()->ValueAt(dictionary_entry()); |
319 DCHECK(value->IsPropertyCell()); | 319 DCHECK(value->IsPropertyCell()); |
320 return handle(PropertyCell::cast(value)); | 320 return handle(PropertyCell::cast(value)); |
321 } | 321 } |
322 | 322 |
323 | 323 |
324 Handle<Object> LookupIterator::GetAccessors() const { | 324 Handle<Object> LookupIterator::GetAccessors() const { |
325 DCHECK_EQ(ACCESSOR, state_); | 325 DCHECK_EQ(ACCESSOR, state_); |
326 return FetchValue(); | 326 return FetchValue(); |
327 } | 327 } |
328 | 328 |
329 | 329 |
330 Handle<Object> LookupIterator::GetDataValue() const { | 330 Handle<Object> LookupIterator::GetDataValue() const { |
331 DCHECK_EQ(DATA, state_); | 331 DCHECK_EQ(DATA, state_); |
332 Handle<Object> value = FetchValue(); | 332 Handle<Object> value = FetchValue(); |
333 return value; | 333 return value; |
334 } | 334 } |
335 | 335 |
336 | 336 |
337 void LookupIterator::WriteDataValue(Handle<Object> value) { | 337 void LookupIterator::WriteDataValue(Handle<Object> value) { |
338 DCHECK_EQ(DATA, state_); | 338 DCHECK_EQ(DATA, state_); |
339 Handle<JSObject> holder = GetHolder<JSObject>(); | 339 Handle<JSObject> holder = GetHolder<JSObject>(); |
340 if (holder_map_->is_dictionary_map()) { | 340 if (holder->IsGlobalObject()) { |
| 341 Handle<GlobalDictionary> property_dictionary = |
| 342 handle(holder->global_dictionary()); |
| 343 PropertyCell::UpdateCell(property_dictionary, dictionary_entry(), value, |
| 344 property_details_); |
| 345 } else if (holder_map_->is_dictionary_map()) { |
341 Handle<NameDictionary> property_dictionary = | 346 Handle<NameDictionary> property_dictionary = |
342 handle(holder->property_dictionary()); | 347 handle(holder->property_dictionary()); |
343 if (holder->IsGlobalObject()) { | 348 property_dictionary->ValueAtPut(dictionary_entry(), *value); |
344 PropertyCell::UpdateCell(property_dictionary, dictionary_entry(), value, | |
345 property_details_); | |
346 } else { | |
347 property_dictionary->ValueAtPut(dictionary_entry(), *value); | |
348 } | |
349 } else if (property_details_.type() == v8::internal::DATA) { | 349 } else if (property_details_.type() == v8::internal::DATA) { |
350 holder->WriteToField(descriptor_number(), *value); | 350 holder->WriteToField(descriptor_number(), *value); |
351 } else { | 351 } else { |
352 DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type()); | 352 DCHECK_EQ(v8::internal::DATA_CONSTANT, property_details_.type()); |
353 } | 353 } |
354 } | 354 } |
355 | 355 |
356 | 356 |
357 bool LookupIterator::IsIntegerIndexedExotic(JSReceiver* holder) { | 357 bool LookupIterator::IsIntegerIndexedExotic(JSReceiver* holder) { |
358 DCHECK(exotic_index_state_ != ExoticIndexState::kNotExotic); | 358 DCHECK(exotic_index_state_ != ExoticIndexState::kNotExotic); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 // Fall through. | 404 // Fall through. |
405 case InterceptorState::kSkipNonMasking: | 405 case InterceptorState::kSkipNonMasking: |
406 return true; | 406 return true; |
407 case InterceptorState::kProcessNonMasking: | 407 case InterceptorState::kProcessNonMasking: |
408 return false; | 408 return false; |
409 } | 409 } |
410 } | 410 } |
411 return interceptor_state_ == InterceptorState::kProcessNonMasking; | 411 return interceptor_state_ == InterceptorState::kProcessNonMasking; |
412 } | 412 } |
413 } } // namespace v8::internal | 413 } } // namespace v8::internal |
OLD | NEW |