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

Unified Diff: src/api.cc

Issue 2108203002: Implement immutable prototype chains (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: IsImmutableProto 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 | « include/v8.h ('k') | src/api-natives.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 79eb6198ca3f37cde9a0ee0121b56f4fabde7a99..776f196d885eb126d4d4dd33ebf33c6dcb5c86af 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1416,7 +1416,7 @@ static Local<ObjectTemplate> ObjectTemplateNew(
obj->set_serial_number(i::Smi::FromInt(next_serial_number));
if (!constructor.IsEmpty())
obj->set_constructor(*Utils::OpenHandle(*constructor));
- obj->set_internal_field_count(i::Smi::FromInt(0));
+ obj->set_data(i::Smi::FromInt(0));
return Utils::ToLocal(obj);
}
@@ -1711,7 +1711,7 @@ void ObjectTemplate::SetCallAsFunctionHandler(FunctionCallback callback,
int ObjectTemplate::InternalFieldCount() {
- return i::Smi::cast(Utils::OpenHandle(this)->internal_field_count())->value();
+ return Utils::OpenHandle(this)->internal_field_count();
}
@@ -1729,9 +1729,18 @@ void ObjectTemplate::SetInternalFieldCount(int value) {
// function to do the setting.
EnsureConstructor(isolate, this);
}
- Utils::OpenHandle(this)->set_internal_field_count(i::Smi::FromInt(value));
+ Utils::OpenHandle(this)->set_internal_field_count(value);
}
+bool ObjectTemplate::IsImmutableProto() {
+ return Utils::OpenHandle(this)->immutable_proto();
+}
+
+void ObjectTemplate::SetImmutableProto() {
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ENTER_V8(isolate);
+ Utils::OpenHandle(this)->set_immutable_proto(true);
+}
// --- S c r i p t s ---
« no previous file with comments | « include/v8.h ('k') | src/api-natives.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698