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

Side by Side Diff: src/factory.cc

Issue 450303003: Tag all prototypes as proto, except those set using __proto__ (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Remove is_shared from 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 | « src/bootstrapper.cc ('k') | src/generator.js » ('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 1271 matching lines...) Expand 10 before | Expand all | Expand 10 after
1282 // Allocate the function 1282 // Allocate the function
1283 Handle<JSFunction> function = NewFunction( 1283 Handle<JSFunction> function = NewFunction(
1284 name, code, prototype, read_only_prototype); 1284 name, code, prototype, read_only_prototype);
1285 1285
1286 Handle<Map> initial_map = NewMap( 1286 Handle<Map> initial_map = NewMap(
1287 type, instance_size, GetInitialFastElementsKind()); 1287 type, instance_size, GetInitialFastElementsKind());
1288 if (prototype->IsTheHole() && !function->shared()->is_generator()) { 1288 if (prototype->IsTheHole() && !function->shared()->is_generator()) {
1289 prototype = NewFunctionPrototype(function); 1289 prototype = NewFunctionPrototype(function);
1290 } 1290 }
1291 1291
1292 initial_map->set_prototype(*prototype); 1292 JSFunction::SetInitialMap(function, initial_map,
1293 JSFunction::SetInitialMap(function, initial_map); 1293 Handle<JSReceiver>::cast(prototype));
1294 1294
1295 return function; 1295 return function;
1296 } 1296 }
1297 1297
1298 1298
1299 Handle<JSFunction> Factory::NewFunction(Handle<String> name, 1299 Handle<JSFunction> Factory::NewFunction(Handle<String> name,
1300 Handle<Code> code, 1300 Handle<Code> code,
1301 InstanceType type, 1301 InstanceType type,
1302 int instance_size) { 1302 int instance_size) {
1303 return NewFunction(name, code, the_hole_value(), type, instance_size); 1303 return NewFunction(name, code, the_hole_value(), type, instance_size);
(...skipping 10 matching lines...) Expand all
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 DCHECK(object_function->has_initial_map()); 1320 DCHECK(object_function->has_initial_map());
1321 new_map = handle(object_function->initial_map()); 1321 new_map = handle(object_function->initial_map());
1322 } 1322 }
1323 1323
1324 DCHECK(!new_map->is_prototype_map());
1324 Handle<JSObject> prototype = NewJSObjectFromMap(new_map); 1325 Handle<JSObject> prototype = NewJSObjectFromMap(new_map);
1325 1326
1326 if (!function->shared()->is_generator()) { 1327 if (!function->shared()->is_generator()) {
1327 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM); 1328 JSObject::AddProperty(prototype, constructor_string(), function, DONT_ENUM);
1328 } 1329 }
1329 1330
1330 return prototype; 1331 return prototype;
1331 } 1332 }
1332 1333
1333 1334
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 return Handle<Object>::null(); 2366 return Handle<Object>::null();
2366 } 2367 }
2367 2368
2368 2369
2369 Handle<Object> Factory::ToBoolean(bool value) { 2370 Handle<Object> Factory::ToBoolean(bool value) {
2370 return value ? true_value() : false_value(); 2371 return value ? true_value() : false_value();
2371 } 2372 }
2372 2373
2373 2374
2374 } } // namespace v8::internal 2375 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/bootstrapper.cc ('k') | src/generator.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698