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

Side by Side Diff: src/api-natives.cc

Issue 2474843003: Allow the global object to be frozen through the global template (Closed)
Patch Set: Nit cleanup Created 4 years, 1 month 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 | « no previous file | src/objects.cc » ('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/api-natives.h" 5 #include "src/api-natives.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/isolate-inl.h" 8 #include "src/isolate-inl.h"
9 #include "src/lookup.h" 9 #include "src/lookup.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 606
607 if (prototype->IsTheHole(isolate)) { 607 if (prototype->IsTheHole(isolate)) {
608 prototype = isolate->factory()->NewFunctionPrototype(result); 608 prototype = isolate->factory()->NewFunctionPrototype(result);
609 } else { 609 } else {
610 JSObject::AddProperty(Handle<JSObject>::cast(prototype), 610 JSObject::AddProperty(Handle<JSObject>::cast(prototype),
611 isolate->factory()->constructor_string(), result, 611 isolate->factory()->constructor_string(), result,
612 DONT_ENUM); 612 DONT_ENUM);
613 } 613 }
614 614
615 int internal_field_count = 0; 615 int internal_field_count = 0;
616 bool immutable_proto = false;
616 if (!obj->instance_template()->IsUndefined(isolate)) { 617 if (!obj->instance_template()->IsUndefined(isolate)) {
617 Handle<ObjectTemplateInfo> instance_template = Handle<ObjectTemplateInfo>( 618 Handle<ObjectTemplateInfo> instance_template = Handle<ObjectTemplateInfo>(
618 ObjectTemplateInfo::cast(obj->instance_template())); 619 ObjectTemplateInfo::cast(obj->instance_template()));
619 internal_field_count = instance_template->internal_field_count(); 620 internal_field_count = instance_template->internal_field_count();
621 immutable_proto = instance_template->immutable_proto();
620 } 622 }
621 623
622 // TODO(svenpanne) Kill ApiInstanceType and refactor things by generalizing 624 // TODO(svenpanne) Kill ApiInstanceType and refactor things by generalizing
623 // JSObject::GetHeaderSize. 625 // JSObject::GetHeaderSize.
624 int instance_size = kPointerSize * internal_field_count; 626 int instance_size = kPointerSize * internal_field_count;
625 InstanceType type; 627 InstanceType type;
626 switch (instance_type) { 628 switch (instance_type) {
627 case JavaScriptObjectType: 629 case JavaScriptObjectType:
628 if (!obj->needs_access_check() && 630 if (!obj->needs_access_check() &&
629 obj->named_property_handler()->IsUndefined(isolate) && 631 obj->named_property_handler()->IsUndefined(isolate) &&
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 if (!obj->indexed_property_handler()->IsUndefined(isolate)) { 671 if (!obj->indexed_property_handler()->IsUndefined(isolate)) {
670 map->set_has_indexed_interceptor(); 672 map->set_has_indexed_interceptor();
671 } 673 }
672 674
673 // Mark instance as callable in the map. 675 // Mark instance as callable in the map.
674 if (!obj->instance_call_handler()->IsUndefined(isolate)) { 676 if (!obj->instance_call_handler()->IsUndefined(isolate)) {
675 map->set_is_callable(); 677 map->set_is_callable();
676 map->set_is_constructor(true); 678 map->set_is_constructor(true);
677 } 679 }
678 680
681 if (immutable_proto) map->set_immutable_proto(true);
682
679 return result; 683 return result;
680 } 684 }
681 685
682 } // namespace internal 686 } // namespace internal
683 } // namespace v8 687 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698