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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/factory.h ('k') | src/heap.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 573
574 574
575 Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) { 575 Handle<JSObject> Factory::NewFunctionPrototype(Handle<JSFunction> function) {
576 CALL_HEAP_FUNCTION( 576 CALL_HEAP_FUNCTION(
577 isolate(), 577 isolate(),
578 isolate()->heap()->AllocateFunctionPrototype(*function), 578 isolate()->heap()->AllocateFunctionPrototype(*function),
579 JSObject); 579 JSObject);
580 } 580 }
581 581
582 582
583 Handle<Map> Factory::NewInitialMap(Handle<JSFunction> function) {
584 CALL_HEAP_FUNCTION(
585 isolate(), isolate()->heap()->AllocateInitialMap(*function), Map);
586 }
587
588
583 Handle<Map> Factory::CopyWithPreallocatedFieldDescriptors(Handle<Map> src) { 589 Handle<Map> Factory::CopyWithPreallocatedFieldDescriptors(Handle<Map> src) {
584 CALL_HEAP_FUNCTION( 590 CALL_HEAP_FUNCTION(
585 isolate(), src->CopyWithPreallocatedFieldDescriptors(), Map); 591 isolate(), src->CopyWithPreallocatedFieldDescriptors(), Map);
586 } 592 }
587 593
588 594
589 Handle<Map> Factory::CopyMap(Handle<Map> src, 595 Handle<Map> Factory::CopyMap(Handle<Map> src,
590 int extra_inobject_properties) { 596 int extra_inobject_properties) {
591 Handle<Map> copy = CopyWithPreallocatedFieldDescriptors(src); 597 Handle<Map> copy = CopyWithPreallocatedFieldDescriptors(src);
592 // Check that we do not overflow the instance size when adding the 598 // Check that we do not overflow the instance size when adding the
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 1044
1039 1045
1040 Handle<String> Factory::InternalizedStringFromString(Handle<String> value) { 1046 Handle<String> Factory::InternalizedStringFromString(Handle<String> value) {
1041 CALL_HEAP_FUNCTION(isolate(), 1047 CALL_HEAP_FUNCTION(isolate(),
1042 isolate()->heap()->InternalizeString(*value), String); 1048 isolate()->heap()->InternalizeString(*value), String);
1043 } 1049 }
1044 1050
1045 1051
1046 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor, 1052 Handle<JSObject> Factory::NewJSObject(Handle<JSFunction> constructor,
1047 PretenureFlag pretenure) { 1053 PretenureFlag pretenure) {
1054 JSFunction::EnsureHasInitialMap(constructor);
1048 CALL_HEAP_FUNCTION( 1055 CALL_HEAP_FUNCTION(
1049 isolate(), 1056 isolate(),
1050 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject); 1057 isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject);
1051 } 1058 }
1052 1059
1053 1060
1054 Handle<JSModule> Factory::NewJSModule(Handle<Context> context, 1061 Handle<JSModule> Factory::NewJSModule(Handle<Context> context,
1055 Handle<ScopeInfo> scope_info) { 1062 Handle<ScopeInfo> scope_info) {
1056 CALL_HEAP_FUNCTION( 1063 CALL_HEAP_FUNCTION(
1057 isolate(), 1064 isolate(),
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1184 1191
1185 1192
1186 void Factory::SetContent(Handle<JSArray> array, 1193 void Factory::SetContent(Handle<JSArray> array,
1187 Handle<FixedArrayBase> elements) { 1194 Handle<FixedArrayBase> elements) {
1188 CALL_HEAP_FUNCTION_VOID( 1195 CALL_HEAP_FUNCTION_VOID(
1189 isolate(), 1196 isolate(),
1190 array->SetContent(*elements)); 1197 array->SetContent(*elements));
1191 } 1198 }
1192 1199
1193 1200
1201 Handle<JSGeneratorObject> Factory::NewJSGeneratorObject(
1202 Handle<JSFunction> function) {
1203 ASSERT(function->shared()->is_generator());
1204 JSFunction::EnsureHasInitialMap(function);
1205 Handle<Map> map(function->initial_map());
1206 ASSERT(map->instance_type() == JS_GENERATOR_OBJECT_TYPE);
1207 CALL_HEAP_FUNCTION(
1208 isolate(),
1209 isolate()->heap()->AllocateJSObjectFromMap(*map),
1210 JSGeneratorObject);
1211 }
1212
1213
1194 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer() { 1214 Handle<JSArrayBuffer> Factory::NewJSArrayBuffer() {
1195 Handle<JSFunction> array_buffer_fun( 1215 Handle<JSFunction> array_buffer_fun(
1196 isolate()->context()->native_context()->array_buffer_fun()); 1216 isolate()->context()->native_context()->array_buffer_fun());
1197 CALL_HEAP_FUNCTION( 1217 CALL_HEAP_FUNCTION(
1198 isolate(), 1218 isolate(),
1199 isolate()->heap()->AllocateJSObject(*array_buffer_fun), 1219 isolate()->heap()->AllocateJSObject(*array_buffer_fun),
1200 JSArrayBuffer); 1220 JSArrayBuffer);
1201 } 1221 }
1202 1222
1203 1223
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
1739 return Handle<Object>::null(); 1759 return Handle<Object>::null();
1740 } 1760 }
1741 1761
1742 1762
1743 Handle<Object> Factory::ToBoolean(bool value) { 1763 Handle<Object> Factory::ToBoolean(bool value) {
1744 return value ? true_value() : false_value(); 1764 return value ? true_value() : false_value();
1745 } 1765 }
1746 1766
1747 1767
1748 } } // namespace v8::internal 1768 } } // namespace v8::internal
OLDNEW
« 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