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

Side by Side Diff: src/objects.cc

Issue 1530213002: Make generators non-constructable (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove broken tests Created 5 years 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 "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 12678 matching lines...) Expand 10 before | Expand all | Expand 10 after
12689 JSObject::OptimizeAsPrototype(Handle<JSObject>::cast(value), 12689 JSObject::OptimizeAsPrototype(Handle<JSObject>::cast(value),
12690 FAST_PROTOTYPE); 12690 FAST_PROTOTYPE);
12691 } 12691 }
12692 } 12692 }
12693 isolate->heap()->ClearInstanceofCache(); 12693 isolate->heap()->ClearInstanceofCache();
12694 } 12694 }
12695 12695
12696 12696
12697 void JSFunction::SetPrototype(Handle<JSFunction> function, 12697 void JSFunction::SetPrototype(Handle<JSFunction> function,
12698 Handle<Object> value) { 12698 Handle<Object> value) {
12699 DCHECK(function->IsConstructor()); 12699 DCHECK(function->IsConstructor() ||
12700 IsGeneratorFunction(function->shared()->kind()));
12700 Handle<Object> construct_prototype = value; 12701 Handle<Object> construct_prototype = value;
12701 12702
12702 // If the value is not a JSReceiver, store the value in the map's 12703 // If the value is not a JSReceiver, store the value in the map's
12703 // constructor field so it can be accessed. Also, set the prototype 12704 // constructor field so it can be accessed. Also, set the prototype
12704 // used for constructing objects to the original object prototype. 12705 // used for constructing objects to the original object prototype.
12705 // See ECMA-262 13.2.2. 12706 // See ECMA-262 13.2.2.
12706 if (!value->IsJSReceiver()) { 12707 if (!value->IsJSReceiver()) {
12707 // Copy the map so this does not affect unrelated functions. 12708 // Copy the map so this does not affect unrelated functions.
12708 // Remove map transitions because they point to maps with a 12709 // Remove map transitions because they point to maps with a
12709 // different prototype. 12710 // different prototype.
(...skipping 6632 matching lines...) Expand 10 before | Expand all | Expand 10 after
19342 if (cell->value() != *new_value) { 19343 if (cell->value() != *new_value) {
19343 cell->set_value(*new_value); 19344 cell->set_value(*new_value);
19344 Isolate* isolate = cell->GetIsolate(); 19345 Isolate* isolate = cell->GetIsolate();
19345 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19346 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19346 isolate, DependentCode::kPropertyCellChangedGroup); 19347 isolate, DependentCode::kPropertyCellChangedGroup);
19347 } 19348 }
19348 } 19349 }
19349 19350
19350 } // namespace internal 19351 } // namespace internal
19351 } // namespace v8 19352 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698