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

Side by Side Diff: src/objects.cc

Issue 1143623002: [strong] Implement per-object restrictions behaviour for prototype setting (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: in test, make sure type feedback is reset for each object Created 5 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
OLDNEW
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 12588 matching lines...) Expand 10 before | Expand all | Expand 10 after
12599 12599
12600 12600
12601 MaybeHandle<Object> JSObject::SetPrototype(Handle<JSObject> object, 12601 MaybeHandle<Object> JSObject::SetPrototype(Handle<JSObject> object,
12602 Handle<Object> value, 12602 Handle<Object> value,
12603 bool from_javascript) { 12603 bool from_javascript) {
12604 #ifdef DEBUG 12604 #ifdef DEBUG
12605 int size = object->Size(); 12605 int size = object->Size();
12606 #endif 12606 #endif
12607 12607
12608 Isolate* isolate = object->GetIsolate(); 12608 Isolate* isolate = object->GetIsolate();
12609 // Strong objects may not have their prototype set via __proto__ or
12610 // setPrototypeOf.
12611 if (from_javascript && object->map()->is_strong()) {
12612 THROW_NEW_ERROR(isolate,
12613 NewTypeError(MessageTemplate::kStrongSetProto, object),
12614 Object);
12615 }
12609 Heap* heap = isolate->heap(); 12616 Heap* heap = isolate->heap();
12610 // Silently ignore the change if value is not a JSObject or null. 12617 // Silently ignore the change if value is not a JSObject or null.
12611 // SpiderMonkey behaves this way. 12618 // SpiderMonkey behaves this way.
12612 if (!value->IsJSReceiver() && !value->IsNull()) return value; 12619 if (!value->IsJSReceiver() && !value->IsNull()) return value;
12613 12620
12614 // From 8.6.2 Object Internal Methods 12621 // From 8.6.2 Object Internal Methods
12615 // ... 12622 // ...
12616 // In addition, if [[Extensible]] is false the value of the [[Class]] and 12623 // In addition, if [[Extensible]] is false the value of the [[Class]] and
12617 // [[Prototype]] internal properties of the object may not be modified. 12624 // [[Prototype]] internal properties of the object may not be modified.
12618 // ... 12625 // ...
(...skipping 4634 matching lines...) Expand 10 before | Expand all | Expand 10 after
17253 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell, 17260 void PropertyCell::SetValueWithInvalidation(Handle<PropertyCell> cell,
17254 Handle<Object> new_value) { 17261 Handle<Object> new_value) {
17255 if (cell->value() != *new_value) { 17262 if (cell->value() != *new_value) {
17256 cell->set_value(*new_value); 17263 cell->set_value(*new_value);
17257 Isolate* isolate = cell->GetIsolate(); 17264 Isolate* isolate = cell->GetIsolate();
17258 cell->dependent_code()->DeoptimizeDependentCodeGroup( 17265 cell->dependent_code()->DeoptimizeDependentCodeGroup(
17259 isolate, DependentCode::kPropertyCellChangedGroup); 17266 isolate, DependentCode::kPropertyCellChangedGroup);
17260 } 17267 }
17261 } 17268 }
17262 } } // namespace v8::internal 17269 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698