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

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: Remove handle 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
« no previous file with comments | « src/elements.cc ('k') | src/objects.h » ('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 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
322 // prototype chain in element setters.
323 // TODO(verwaest): Move code into the element accessor. 321 // TODO(verwaest): Move code into the element accessor.
324 bool was_dictionary = receiver->HasDictionaryElements();
325 Handle<SeededNumberDictionary> dictionary = 322 Handle<SeededNumberDictionary> dictionary =
326 JSObject::NormalizeElements(receiver); 323 JSObject::NormalizeElements(receiver);
327 was_dictionary = was_dictionary && dictionary->requires_slow_elements();
328 324
329 dictionary = SeededNumberDictionary::Set(dictionary, index_, pair, details); 325 dictionary = SeededNumberDictionary::Set(dictionary, index_, pair, details);
330 dictionary->set_requires_slow_elements(); 326 receiver->RequireSlowElements(*dictionary);
331 327
332 if (receiver->HasSlowArgumentsElements()) { 328 if (receiver->HasSlowArgumentsElements()) {
333 FixedArray* parameter_map = FixedArray::cast(receiver->elements()); 329 FixedArray* parameter_map = FixedArray::cast(receiver->elements());
334 uint32_t length = parameter_map->length() - 2; 330 uint32_t length = parameter_map->length() - 2;
335 if (number_ < length) { 331 if (number_ < length) {
336 parameter_map->set(number_ + 2, heap()->the_hole_value()); 332 parameter_map->set(number_ + 2, heap()->the_hole_value());
337 } 333 }
338 FixedArray::cast(receiver->elements())->set(1, *dictionary); 334 FixedArray::cast(receiver->elements())->set(1, *dictionary);
339 } else { 335 } else {
340 receiver->set_elements(*dictionary); 336 receiver->set_elements(*dictionary);
341 if (!was_dictionary) heap()->ClearAllICsByKind(Code::KEYED_STORE_IC);
342 } 337 }
343 } else { 338 } else {
344 PropertyNormalizationMode mode = receiver->map()->is_prototype_map() 339 PropertyNormalizationMode mode = receiver->map()->is_prototype_map()
345 ? KEEP_INOBJECT_PROPERTIES 340 ? KEEP_INOBJECT_PROPERTIES
346 : CLEAR_INOBJECT_PROPERTIES; 341 : CLEAR_INOBJECT_PROPERTIES;
347 // Normalize object to make this operation simple. 342 // Normalize object to make this operation simple.
348 JSObject::NormalizeProperties(receiver, mode, 0, 343 JSObject::NormalizeProperties(receiver, mode, 0,
349 "TransitionToAccessorPair"); 344 "TransitionToAccessorPair");
350 345
351 JSObject::SetNormalizedProperty(receiver, name_, pair, details); 346 JSObject::SetNormalizedProperty(receiver, name_, pair, details);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
560 case InterceptorState::kSkipNonMasking: 555 case InterceptorState::kSkipNonMasking:
561 return true; 556 return true;
562 case InterceptorState::kProcessNonMasking: 557 case InterceptorState::kProcessNonMasking:
563 return false; 558 return false;
564 } 559 }
565 } 560 }
566 return interceptor_state_ == InterceptorState::kProcessNonMasking; 561 return interceptor_state_ == InterceptorState::kProcessNonMasking;
567 } 562 }
568 } // namespace internal 563 } // namespace internal
569 } // namespace v8 564 } // namespace v8
OLDNEW
« no previous file with comments | « src/elements.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698