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

Unified Diff: src/factory.cc

Issue 32323013: Introduce JSFunction::EnsureHasInitialMap method. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 2 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/factory.h ('k') | src/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index 4927cac376176dbea65ca4ed45c2d893ee0b8d02..fb14663341c604a7ba546a4cd5a3b91904546386 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -580,6 +580,12 @@ Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) {
}
+Handle<Map> Factory::NewInitialMap(Handle<JSFunction> function) {
+ CALL_HEAP_FUNCTION(
+ isolate(), isolate()->heap()->AllocateInitialMap(*function), Map);
+}
+
+
Handle<Map> Factory::CopyWithPreallocatedFieldDescriptors(Handle<Map> src) {
CALL_HEAP_FUNCTION(
isolate(), src->CopyWithPreallocatedFieldDescriptors(), Map);
@@ -1045,6 +1051,7 @@ Handle<String> Factory::InternalizedStringFromString(Handle<String> value) {
Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor,
PretenureFlag pretenure) {
+ JSFunction::EnsureHasInitialMap(constructor);
CALL_HEAP_FUNCTION(
isolate(),
isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject);
@@ -1191,6 +1198,19 @@ void Factory::SetContent(Handle<JSArray> array,
}
+Handle<JSGeneratorObject> Factory::NewJSGeneratorObject(
+ Handle<JSFunction> function) {
+ ASSERT(function->shared()->is_generator());
+ JSFunction::EnsureHasInitialMap(function);
+ Handle<Map> map(function->initial_map());
+ ASSERT(map->instance_type() == JS_GENERATOR_OBJECT_TYPE);
+ CALL_HEAP_FUNCTION(
+ isolate(),
+ isolate()->heap()->AllocateJSObjectFromMap(*map),
+ JSGeneratorObject);
+}
+
+
Handle<JSArrayBuffer> Factory::NewJSArrayBuffer() {
Handle<JSFunction> array_buffer_fun(
isolate()->context()->native_context()->array_buffer_fun());
« no previous file with comments | « src/factory.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698