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

Side by Side Diff: src/objects.cc

Issue 1979473003: Version 5.1.281.35 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@5.1
Patch Set: Created 4 years, 7 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/objects.h ('k') | src/objects-inl.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 1511 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 1522
1523 1523
1524 MaybeHandle<Object> Object::ArraySpeciesConstructor( 1524 MaybeHandle<Object> Object::ArraySpeciesConstructor(
1525 Isolate* isolate, Handle<Object> original_array) { 1525 Isolate* isolate, Handle<Object> original_array) {
1526 Handle<Context> native_context = isolate->native_context(); 1526 Handle<Context> native_context = isolate->native_context();
1527 Handle<Object> default_species = isolate->array_function(); 1527 Handle<Object> default_species = isolate->array_function();
1528 if (!FLAG_harmony_species) { 1528 if (!FLAG_harmony_species) {
1529 return default_species; 1529 return default_species;
1530 } 1530 }
1531 if (original_array->IsJSArray() && 1531 if (original_array->IsJSArray() &&
1532 Handle<JSReceiver>::cast(original_array)->map()->new_target_is_base() && 1532 Handle<JSArray>::cast(original_array)->HasArrayPrototype(isolate) &&
1533 isolate->IsArraySpeciesLookupChainIntact()) { 1533 isolate->IsArraySpeciesLookupChainIntact()) {
1534 return default_species; 1534 return default_species;
1535 } 1535 }
1536 Handle<Object> constructor = isolate->factory()->undefined_value(); 1536 Handle<Object> constructor = isolate->factory()->undefined_value();
1537 Maybe<bool> is_array = Object::IsArray(original_array); 1537 Maybe<bool> is_array = Object::IsArray(original_array);
1538 MAYBE_RETURN_NULL(is_array); 1538 MAYBE_RETURN_NULL(is_array);
1539 if (is_array.FromJust()) { 1539 if (is_array.FromJust()) {
1540 ASSIGN_RETURN_ON_EXCEPTION( 1540 ASSIGN_RETURN_ON_EXCEPTION(
1541 isolate, constructor, 1541 isolate, constructor,
1542 Object::GetProperty(original_array, 1542 Object::GetProperty(original_array,
(...skipping 14063 matching lines...) Expand 10 before | Expand all | Expand 10 after
15606 // 14. Return true. 15606 // 14. Return true.
15607 return Just(true); 15607 return Just(true);
15608 } 15608 }
15609 15609
15610 15610
15611 Maybe<bool> JSObject::SetPrototype(Handle<JSObject> object, 15611 Maybe<bool> JSObject::SetPrototype(Handle<JSObject> object,
15612 Handle<Object> value, bool from_javascript, 15612 Handle<Object> value, bool from_javascript,
15613 ShouldThrow should_throw) { 15613 ShouldThrow should_throw) {
15614 Isolate* isolate = object->GetIsolate(); 15614 Isolate* isolate = object->GetIsolate();
15615 15615
15616 // Setting the prototype of an Array instance invalidates the species
15617 // protector
15618 // because it could change the constructor property of the instance, which
15619 // could change the @@species constructor.
15620 if (object->IsJSArray() && isolate->IsArraySpeciesLookupChainIntact()) {
15621 isolate->CountUsage(
15622 v8::Isolate::UseCounterFeature::kArrayInstanceProtoModified);
15623 isolate->InvalidateArraySpeciesProtector();
15624 }
15625
15626 const bool observed = from_javascript && object->map()->is_observed(); 15616 const bool observed = from_javascript && object->map()->is_observed();
15627 Handle<Object> old_value; 15617 Handle<Object> old_value;
15628 if (observed) { 15618 if (observed) {
15629 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, old_value, 15619 ASSIGN_RETURN_ON_EXCEPTION_VALUE(isolate, old_value,
15630 JSReceiver::GetPrototype(isolate, object), 15620 JSReceiver::GetPrototype(isolate, object),
15631 Nothing<bool>()); 15621 Nothing<bool>());
15632 } 15622 }
15633 15623
15634 Maybe<bool> result = 15624 Maybe<bool> result =
15635 SetPrototypeUnobserved(object, value, from_javascript, should_throw); 15625 SetPrototypeUnobserved(object, value, from_javascript, should_throw);
(...skipping 4160 matching lines...) Expand 10 before | Expand all | Expand 10 after
19796 if (cell->value() != *new_value) { 19786 if (cell->value() != *new_value) {
19797 cell->set_value(*new_value); 19787 cell->set_value(*new_value);
19798 Isolate* isolate = cell->GetIsolate(); 19788 Isolate* isolate = cell->GetIsolate();
19799 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19789 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19800 isolate, DependentCode::kPropertyCellChangedGroup); 19790 isolate, DependentCode::kPropertyCellChangedGroup);
19801 } 19791 }
19802 } 19792 }
19803 19793
19804 } // namespace internal 19794 } // namespace internal
19805 } // namespace v8 19795 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698