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

Side by Side Diff: src/bootstrapper.cc

Issue 2083353002: Cache Object.create maps on the passed prototype's PrototypeInfo (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: properly set prototype 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/builtins.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/bootstrapper.h" 5 #include "src/bootstrapper.h"
6 6
7 #include "src/accessors.h" 7 #include "src/accessors.h"
8 #include "src/api-natives.h" 8 #include "src/api-natives.h"
9 #include "src/base/ieee754.h" 9 #include "src/base/ieee754.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2976 matching lines...) Expand 10 before | Expand all | Expand 10 after
2987 *template_instantiations_cache); 2987 *template_instantiations_cache);
2988 2988
2989 // Store the map for the %ObjectPrototype% after the natives has been compiled 2989 // Store the map for the %ObjectPrototype% after the natives has been compiled
2990 // and the Object function has been set up. 2990 // and the Object function has been set up.
2991 Handle<JSFunction> object_function(native_context()->object_function()); 2991 Handle<JSFunction> object_function(native_context()->object_function());
2992 DCHECK(JSObject::cast(object_function->initial_map()->prototype()) 2992 DCHECK(JSObject::cast(object_function->initial_map()->prototype())
2993 ->HasFastProperties()); 2993 ->HasFastProperties());
2994 native_context()->set_object_function_prototype_map( 2994 native_context()->set_object_function_prototype_map(
2995 HeapObject::cast(object_function->initial_map()->prototype())->map()); 2995 HeapObject::cast(object_function->initial_map()->prototype())->map());
2996 2996
2997 // Set up the map for Object.create(null) instances.
2998 Handle<Map> object_with_null_prototype_map =
2999 Map::CopyInitialMap(handle(object_function->initial_map(), isolate()));
3000 Map::SetPrototype(object_with_null_prototype_map,
3001 isolate()->factory()->null_value());
3002 native_context()->set_object_with_null_prototype_map(
3003 *object_with_null_prototype_map);
3004
2997 // Store the map for the %StringPrototype% after the natives has been compiled 3005 // Store the map for the %StringPrototype% after the natives has been compiled
2998 // and the String function has been set up. 3006 // and the String function has been set up.
2999 Handle<JSFunction> string_function(native_context()->string_function()); 3007 Handle<JSFunction> string_function(native_context()->string_function());
3000 DCHECK(JSObject::cast( 3008 DCHECK(JSObject::cast(
3001 string_function->initial_map()->prototype())->HasFastProperties()); 3009 string_function->initial_map()->prototype())->HasFastProperties());
3002 native_context()->set_string_function_prototype_map( 3010 native_context()->set_string_function_prototype_map(
3003 HeapObject::cast(string_function->initial_map()->prototype())->map()); 3011 HeapObject::cast(string_function->initial_map()->prototype())->map());
3004 3012
3005 Handle<JSGlobalObject> global_object = 3013 Handle<JSGlobalObject> global_object =
3006 handle(native_context()->global_object()); 3014 handle(native_context()->global_object());
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after
3979 } 3987 }
3980 3988
3981 3989
3982 // Called when the top-level V8 mutex is destroyed. 3990 // Called when the top-level V8 mutex is destroyed.
3983 void Bootstrapper::FreeThreadResources() { 3991 void Bootstrapper::FreeThreadResources() {
3984 DCHECK(!IsActive()); 3992 DCHECK(!IsActive());
3985 } 3993 }
3986 3994
3987 } // namespace internal 3995 } // namespace internal
3988 } // namespace v8 3996 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698