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

Side by Side Diff: src/bootstrapper.cc

Issue 2430273007: [runtime] Object.create(null) creates a slow object (Closed)
Patch Set: fix GC mole issue Created 4 years, 1 month 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/builtins-object.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 3510 matching lines...) Expand 10 before | Expand all | Expand 10 after
3521 3521
3522 // Store the map for the %ObjectPrototype% after the natives has been compiled 3522 // Store the map for the %ObjectPrototype% after the natives has been compiled
3523 // and the Object function has been set up. 3523 // and the Object function has been set up.
3524 Handle<JSFunction> object_function(native_context()->object_function()); 3524 Handle<JSFunction> object_function(native_context()->object_function());
3525 DCHECK(JSObject::cast(object_function->initial_map()->prototype()) 3525 DCHECK(JSObject::cast(object_function->initial_map()->prototype())
3526 ->HasFastProperties()); 3526 ->HasFastProperties());
3527 native_context()->set_object_function_prototype_map( 3527 native_context()->set_object_function_prototype_map(
3528 HeapObject::cast(object_function->initial_map()->prototype())->map()); 3528 HeapObject::cast(object_function->initial_map()->prototype())->map());
3529 3529
3530 // Set up the map for Object.create(null) instances. 3530 // Set up the map for Object.create(null) instances.
3531 Handle<Map> object_with_null_prototype_map = 3531 Handle<Map> slow_object_with_null_prototype_map =
3532 Map::CopyInitialMap(handle(object_function->initial_map(), isolate())); 3532 Map::CopyInitialMap(handle(object_function->initial_map(), isolate()));
3533 Map::SetPrototype(object_with_null_prototype_map, 3533 slow_object_with_null_prototype_map->set_dictionary_map(true);
3534 Map::SetPrototype(slow_object_with_null_prototype_map,
3534 isolate()->factory()->null_value()); 3535 isolate()->factory()->null_value());
3535 native_context()->set_object_with_null_prototype_map( 3536 native_context()->set_slow_object_with_null_prototype_map(
3536 *object_with_null_prototype_map); 3537 *slow_object_with_null_prototype_map);
3537 3538
3538 // Store the map for the %StringPrototype% after the natives has been compiled 3539 // Store the map for the %StringPrototype% after the natives has been compiled
3539 // and the String function has been set up. 3540 // and the String function has been set up.
3540 Handle<JSFunction> string_function(native_context()->string_function()); 3541 Handle<JSFunction> string_function(native_context()->string_function());
3541 DCHECK(JSObject::cast( 3542 DCHECK(JSObject::cast(
3542 string_function->initial_map()->prototype())->HasFastProperties()); 3543 string_function->initial_map()->prototype())->HasFastProperties());
3543 native_context()->set_string_function_prototype_map( 3544 native_context()->set_string_function_prototype_map(
3544 HeapObject::cast(string_function->initial_map()->prototype())->map()); 3545 HeapObject::cast(string_function->initial_map()->prototype())->map());
3545 3546
3546 Handle<JSGlobalObject> global_object = 3547 Handle<JSGlobalObject> global_object =
(...skipping 1025 matching lines...) Expand 10 before | Expand all | Expand 10 after
4572 } 4573 }
4573 4574
4574 4575
4575 // Called when the top-level V8 mutex is destroyed. 4576 // Called when the top-level V8 mutex is destroyed.
4576 void Bootstrapper::FreeThreadResources() { 4577 void Bootstrapper::FreeThreadResources() {
4577 DCHECK(!IsActive()); 4578 DCHECK(!IsActive());
4578 } 4579 }
4579 4580
4580 } // namespace internal 4581 } // namespace internal
4581 } // namespace v8 4582 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/builtins/builtins-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698