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

Side by Side Diff: src/lookup.cc

Issue 1228113003: Fix non-standard element handling (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix and expand tests Created 5 years, 5 months 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
OLDNEW
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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 311
312 void LookupIterator::TransitionToAccessorPair(Handle<Object> pair, 312 void LookupIterator::TransitionToAccessorPair(Handle<Object> pair,
313 PropertyAttributes attributes) { 313 PropertyAttributes attributes) {
314 Handle<JSObject> receiver = GetStoreTarget(); 314 Handle<JSObject> receiver = GetStoreTarget();
315 holder_ = receiver; 315 holder_ = receiver;
316 316
317 PropertyDetails details(attributes, ACCESSOR_CONSTANT, 0, 317 PropertyDetails details(attributes, ACCESSOR_CONSTANT, 0,
318 PropertyCellType::kMutable); 318 PropertyCellType::kMutable);
319 319
320 if (IsElement()) { 320 if (IsElement()) {
321 // TODO(verwaest): Remove this hack once we have a quick way to check the 321 // TODO(verwaest): Remove this hack once we have a quick way to check the
Igor Sheludko 2015/07/15 10:53:17 This TODO does not belong here anymore. Maybe move
322 // prototype chain in element setters. 322 // prototype chain in element setters.
323 // TODO(verwaest): Move code into the element accessor. 323 // TODO(verwaest): Move code into the element accessor.
324 bool was_dictionary = receiver->HasDictionaryElements();
325 Handle<SeededNumberDictionary> dictionary = 324 Handle<SeededNumberDictionary> dictionary =
326 JSObject::NormalizeElements(receiver); 325 JSObject::NormalizeElements(receiver);
327 was_dictionary = was_dictionary && dictionary->requires_slow_elements();
328 326
329 dictionary = SeededNumberDictionary::Set(dictionary, index_, pair, details); 327 dictionary = SeededNumberDictionary::Set(dictionary, index_, pair, details);
330 dictionary->set_requires_slow_elements(); 328 JSObject::RequireSlowElements(receiver, dictionary);
331 329
332 if (receiver->HasSlowArgumentsElements()) { 330 if (receiver->HasSlowArgumentsElements()) {
333 FixedArray* parameter_map = FixedArray::cast(receiver->elements()); 331 FixedArray* parameter_map = FixedArray::cast(receiver->elements());
334 uint32_t length = parameter_map->length() - 2; 332 uint32_t length = parameter_map->length() - 2;
335 if (number_ < length) { 333 if (number_ < length) {
336 parameter_map->set(number_ + 2, heap()->the_hole_value()); 334 parameter_map->set(number_ + 2, heap()->the_hole_value());
337 } 335 }
338 FixedArray::cast(receiver->elements())->set(1, *dictionary); 336 FixedArray::cast(receiver->elements())->set(1, *dictionary);
339 } else { 337 } else {
340 receiver->set_elements(*dictionary); 338 receiver->set_elements(*dictionary);
341 if (!was_dictionary) heap()->ClearAllICsByKind(Code::KEYED_STORE_IC);
342 } 339 }
343 } else { 340 } else {
344 PropertyNormalizationMode mode = receiver->map()->is_prototype_map() 341 PropertyNormalizationMode mode = receiver->map()->is_prototype_map()
345 ? KEEP_INOBJECT_PROPERTIES 342 ? KEEP_INOBJECT_PROPERTIES
346 : CLEAR_INOBJECT_PROPERTIES; 343 : CLEAR_INOBJECT_PROPERTIES;
347 // Normalize object to make this operation simple. 344 // Normalize object to make this operation simple.
348 JSObject::NormalizeProperties(receiver, mode, 0, 345 JSObject::NormalizeProperties(receiver, mode, 0,
349 "TransitionToAccessorPair"); 346 "TransitionToAccessorPair");
350 347
351 JSObject::SetNormalizedProperty(receiver, name_, pair, details); 348 JSObject::SetNormalizedProperty(receiver, name_, pair, details);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 case InterceptorState::kSkipNonMasking: 557 case InterceptorState::kSkipNonMasking:
561 return true; 558 return true;
562 case InterceptorState::kProcessNonMasking: 559 case InterceptorState::kProcessNonMasking:
563 return false; 560 return false;
564 } 561 }
565 } 562 }
566 return interceptor_state_ == InterceptorState::kProcessNonMasking; 563 return interceptor_state_ == InterceptorState::kProcessNonMasking;
567 } 564 }
568 } // namespace internal 565 } // namespace internal
569 } // namespace v8 566 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698