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

Side by Side Diff: src/factory.cc

Issue 437083004: Keep function.prototype fast. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Add TODO and make .prototype fast on creating the initial map Created 6 years, 4 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 | « no previous file | src/objects.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 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/factory.h" 5 #include "src/factory.h"
6 6
7 #include "src/allocation-site-scopes.h" 7 #include "src/allocation-site-scopes.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/isolate-inl.h" 9 #include "src/isolate-inl.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 1300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1311 Handle<Map> new_map; 1311 Handle<Map> new_map;
1312 if (function->shared()->is_generator()) { 1312 if (function->shared()->is_generator()) {
1313 // Generator prototypes can share maps since they don't have "constructor" 1313 // Generator prototypes can share maps since they don't have "constructor"
1314 // properties. 1314 // properties.
1315 new_map = handle(native_context->generator_object_prototype_map()); 1315 new_map = handle(native_context->generator_object_prototype_map());
1316 } else { 1316 } else {
1317 // Each function prototype gets a fresh map to avoid unwanted sharing of 1317 // Each function prototype gets a fresh map to avoid unwanted sharing of
1318 // maps between prototypes of different constructors. 1318 // maps between prototypes of different constructors.
1319 Handle<JSFunction> object_function(native_context->object_function()); 1319 Handle<JSFunction> object_function(native_context->object_function());
1320 ASSERT(object_function->has_initial_map()); 1320 ASSERT(object_function->has_initial_map());
1321 new_map = Map::Copy(handle(object_function->initial_map())); 1321 new_map = Map::CopyAsPrototypeMap(handle(object_function->initial_map()));
1322 } 1322 }
1323 1323
1324 Handle<JSObject> prototype = NewJSObjectFromMap(new_map); 1324 Handle<JSObject> prototype = NewJSObjectFromMap(new_map);
1325 1325
1326 if (!function->shared()->is_generator()) { 1326 if (!function->shared()->is_generator()) {
1327 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM); 1327 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM);
1328 } 1328 }
1329 1329
1330 return prototype; 1330 return prototype;
1331 } 1331 }
(...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 return Handle<Object>::null(); 2365 return Handle<Object>::null();
2366 } 2366 }
2367 2367
2368 2368
2369 Handle<Object> Factory::ToBoolean(bool value) { 2369 Handle<Object> Factory::ToBoolean(bool value) {
2370 return value ? true_value() : false_value(); 2370 return value ? true_value() : false_value();
2371 } 2371 }
2372 2372
2373 2373
2374 } } // namespace v8::internal 2374 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698