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

Unified Diff: src/api-natives.cc

Issue 2108203002: Implement immutable prototype chains (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: simplify Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/api.cc ('k') | src/bootstrapper.cc » ('j') | src/objects.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api-natives.cc
diff --git a/src/api-natives.cc b/src/api-natives.cc
index f09f42d5f0480f76b8d6ac4c0e54efb0f6a9314e..adb5a303e26456c544eb24675b15c121be1e4b18 100644
--- a/src/api-natives.cc
+++ b/src/api-natives.cc
@@ -304,7 +304,8 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
JSFunction::cast(*new_target)->shared()->function_data() ==
info->constructor() &&
JSFunction::cast(*new_target)->context()->native_context() ==
- isolate->context()->native_context()) {
+ isolate->context()->native_context() &&
+ !info->immutable_proto()) {
constructor = Handle<JSFunction>::cast(new_target);
} else {
// Disable caching for subclass instantiation.
@@ -346,6 +347,11 @@ MaybeHandle<JSObject> InstantiateObject(Isolate* isolate,
ASSIGN_RETURN_ON_EXCEPTION(
isolate, result,
ConfigureInstance(isolate, object, info, is_hidden_prototype), JSObject);
+ if (info->immutable_proto()) {
+ MAYBE_RETURN(JSObject::SetImmutableProto(
Toon Verwaest 2016/06/30 15:35:33 I don't think we need to walk the hidden prototype
Dan Ehrenberg 2016/06/30 23:12:41 Removed all that extra useless code.
+ object, false, Object::ShouldThrow::THROW_ON_ERROR),
+ MaybeHandle<JSObject>());
+ }
// TODO(dcarney): is this necessary?
JSObject::MigrateSlowToFast(result, 0, "ApiNatives::InstantiateObject");
@@ -572,8 +578,7 @@ Handle<JSFunction> ApiNatives::CreateApiFunction(
if (!obj->instance_template()->IsUndefined(isolate)) {
Handle<ObjectTemplateInfo> instance_template = Handle<ObjectTemplateInfo>(
ObjectTemplateInfo::cast(obj->instance_template()));
- internal_field_count =
- Smi::cast(instance_template->internal_field_count())->value();
+ internal_field_count = instance_template->internal_field_count();
}
// TODO(svenpanne) Kill ApiInstanceType and refactor things by generalizing
« no previous file with comments | « src/api.cc ('k') | src/bootstrapper.cc » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698