Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <iomanip> | 5 #include <iomanip> |
| 6 #include <sstream> | 6 #include <sstream> |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/accessors.h" | 10 #include "src/accessors.h" |
| (...skipping 6384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6395 if (name->IsString()) name = String::Flatten(Handle<String>::cast(name)); | 6395 if (name->IsString()) name = String::Flatten(Handle<String>::cast(name)); |
| 6396 | 6396 |
| 6397 uint32_t index = 0; | 6397 uint32_t index = 0; |
| 6398 bool is_element = name->AsArrayIndex(&index); | 6398 bool is_element = name->AsArrayIndex(&index); |
| 6399 | 6399 |
| 6400 Handle<Object> old_value = isolate->factory()->the_hole_value(); | 6400 Handle<Object> old_value = isolate->factory()->the_hole_value(); |
| 6401 bool is_observed = object->map()->is_observed() && | 6401 bool is_observed = object->map()->is_observed() && |
| 6402 !isolate->IsInternallyUsedPropertyName(name); | 6402 !isolate->IsInternallyUsedPropertyName(name); |
| 6403 bool preexists = false; | 6403 bool preexists = false; |
| 6404 if (is_observed) { | 6404 if (is_observed) { |
| 6405 if (is_element) { | 6405 LookupIterator::Configuration c = LookupIterator::HIDDEN_SKIP_INTERCEPTOR; |
| 6406 Maybe<bool> maybe = HasOwnElement(object, index); | 6406 LookupIterator it = is_element ? LookupIterator(isolate, object, index, c) |
| 6407 // Workaround for a GCC 4.4.3 bug which leads to "‘preexists’ may be used | 6407 : LookupIterator(object, name, c); |
| 6408 // uninitialized in this function". | 6408 CHECK(GetPropertyAttributes(&it).IsJust()); |
|
Jakob Kummerow
2015/06/11 11:14:28
I'm not a fan of having a Release-mode CHECK here,
| |
| 6409 if (!maybe.IsJust()) { | 6409 preexists = it.IsFound(); |
| 6410 DCHECK(false); | 6410 if (preexists && (it.state() == LookupIterator::DATA || |
| 6411 return isolate->factory()->undefined_value(); | 6411 it.GetAccessors()->IsAccessorInfo())) { |
| 6412 } | 6412 old_value = GetProperty(&it).ToHandleChecked(); |
| 6413 preexists = maybe.FromJust(); | |
| 6414 if (preexists && GetOwnElementAccessorPair(object, index).is_null()) { | |
| 6415 old_value = | |
| 6416 Object::GetElement(isolate, object, index).ToHandleChecked(); | |
| 6417 } | |
| 6418 } else { | |
| 6419 LookupIterator it(object, name, LookupIterator::HIDDEN_SKIP_INTERCEPTOR); | |
| 6420 CHECK(GetPropertyAttributes(&it).IsJust()); | |
| 6421 preexists = it.IsFound(); | |
| 6422 if (preexists && (it.state() == LookupIterator::DATA || | |
| 6423 it.GetAccessors()->IsAccessorInfo())) { | |
| 6424 old_value = GetProperty(&it).ToHandleChecked(); | |
| 6425 } | |
| 6426 } | 6413 } |
| 6427 } | 6414 } |
| 6428 | 6415 |
| 6429 if (is_element) { | 6416 if (is_element) { |
| 6430 DefineElementAccessor(object, index, getter, setter, attributes); | 6417 DefineElementAccessor(object, index, getter, setter, attributes); |
| 6431 } else { | 6418 } else { |
| 6432 DCHECK(getter->IsSpecFunction() || getter->IsUndefined() || | 6419 DCHECK(getter->IsSpecFunction() || getter->IsUndefined() || |
| 6433 getter->IsNull()); | 6420 getter->IsNull()); |
| 6434 DCHECK(setter->IsSpecFunction() || setter->IsUndefined() || | 6421 DCHECK(setter->IsSpecFunction() || setter->IsUndefined() || |
| 6435 setter->IsNull()); | 6422 setter->IsNull()); |
| (...skipping 10240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 16676 Handle<Object> new_value) { | 16663 Handle<Object> new_value) { |
| 16677 if (cell->value() != *new_value) { | 16664 if (cell->value() != *new_value) { |
| 16678 cell->set_value(*new_value); | 16665 cell->set_value(*new_value); |
| 16679 Isolate* isolate = cell->GetIsolate(); | 16666 Isolate* isolate = cell->GetIsolate(); |
| 16680 cell->dependent_code()->DeoptimizeDependentCodeGroup( | 16667 cell->dependent_code()->DeoptimizeDependentCodeGroup( |
| 16681 isolate, DependentCode::kPropertyCellChangedGroup); | 16668 isolate, DependentCode::kPropertyCellChangedGroup); |
| 16682 } | 16669 } |
| 16683 } | 16670 } |
| 16684 } // namespace internal | 16671 } // namespace internal |
| 16685 } // namespace v8 | 16672 } // namespace v8 |
| OLD | NEW |