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

Unified Diff: src/bootstrapper.cc

Issue 12183018: Create pre-frozen change records for Object.observe (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 | « no previous file | src/contexts.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/bootstrapper.cc
diff --git a/src/bootstrapper.cc b/src/bootstrapper.cc
index 762c4f9962716b477224c59e76418d7e3db7132f..c37fe57b6a04eb692212e4c5ba3f49ac370b3560 100644
--- a/src/bootstrapper.cc
+++ b/src/bootstrapper.cc
@@ -1830,6 +1830,60 @@ bool Genesis::InstallNatives() {
native_context()->set_regexp_result_map(*initial_map);
}
+ // Should be flag-guarded with FLAG_harmony_observation, but can't due to
+ // context snapshotting.
+ {
+ Handle<Map> change_record_map =
+ factory()->NewMap(JS_OBJECT_TYPE, JSChangeRecord::kSize);
+ change_record_map->set_constructor(native_context()->object_function());
+ change_record_map->set_non_instance_prototype(false);
+ change_record_map->set_prototype(
+ native_context()->initial_object_prototype());
+
+ Handle<DescriptorArray> descriptors = factory()->NewDescriptorArray(0, 4);
+ DescriptorArray::WhitenessWitness witness(*descriptors);
+ change_record_map->set_instance_descriptors(*descriptors);
+
+ PropertyAttributes attrs =
+ static_cast<PropertyAttributes>(READ_ONLY | DONT_DELETE);
+ {
+ FieldDescriptor field(
+ heap()->type_symbol(), JSChangeRecord::kTypeIndex, attrs);
+ change_record_map->AppendDescriptor(&field, witness);
+ }
+ {
+ FieldDescriptor field(
+ heap()->object_symbol(), JSChangeRecord::kObjectIndex, attrs);
+ change_record_map->AppendDescriptor(&field, witness);
+ }
+ {
+ FieldDescriptor field(
+ heap()->name_symbol(), JSChangeRecord::kNameIndex, attrs);
+ change_record_map->AppendDescriptor(&field, witness);
+ }
+
+ change_record_map->set_inobject_properties(4);
+ change_record_map->set_pre_allocated_property_fields(3);
+ change_record_map->set_unused_property_fields(1);
+
+ change_record_map->set_is_extensible(false);
+
+ native_context()->set_change_record_map(*change_record_map);
+
+ // Create a different map for change records with an oldValue property.
+ {
+ FieldDescriptor field(
+ heap()->oldvalue_symbol(), JSChangeRecord::kOldValueIndex, attrs);
+ MaybeObject* maybe_map = change_record_map->CopyAddDescriptor(
+ &field, OMIT_TRANSITION);
+ if (!maybe_map->ToHandle(&change_record_map, isolate())) return false;
+ }
+ change_record_map->set_inobject_properties(4);
+ change_record_map->set_pre_allocated_property_fields(4);
+ change_record_map->set_unused_property_fields(0);
+ native_context()->set_change_record_oldvalue_map(*change_record_map);
+ }
+
#ifdef VERIFY_HEAP
builtins->Verify();
#endif
« no previous file with comments | « no previous file | src/contexts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698