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

Side by Side Diff: src/factory.cc

Issue 422233010: Also mark as prototype when passing in while creating a function. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Don't recopy 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.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/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 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 1261
1262 1262
1263 Handle<JSFunction> Factory::NewFunction(Handle<String> name, 1263 Handle<JSFunction> Factory::NewFunction(Handle<String> name,
1264 Handle<Code> code, 1264 Handle<Code> code,
1265 Handle<Object> prototype, 1265 Handle<Object> prototype,
1266 bool read_only_prototype) { 1266 bool read_only_prototype) {
1267 Handle<Map> map = read_only_prototype 1267 Handle<Map> map = read_only_prototype
1268 ? isolate()->sloppy_function_with_readonly_prototype_map() 1268 ? isolate()->sloppy_function_with_readonly_prototype_map()
1269 : isolate()->sloppy_function_map(); 1269 : isolate()->sloppy_function_map();
1270 Handle<JSFunction> result = NewFunction(map, name, code); 1270 Handle<JSFunction> result = NewFunction(map, name, code);
1271 if (!prototype->IsTheHole()) {
1272 Handle<JSObject> js_proto = Handle<JSObject>::cast(prototype);
1273 Handle<Map> new_map = Map::CopyAsPrototypeMap(handle(js_proto->map()));
1274 JSObject::MigrateToMap(js_proto, new_map);
1275 }
1271 result->set_prototype_or_initial_map(*prototype); 1276 result->set_prototype_or_initial_map(*prototype);
1272 return result; 1277 return result;
1273 } 1278 }
1274 1279
1275 1280
1276 Handle<JSFunction> Factory::NewFunction(Handle<String> name, 1281 Handle<JSFunction> Factory::NewFunction(Handle<String> name,
1277 Handle<Code> code, 1282 Handle<Code> code,
1278 Handle<Object> prototype, 1283 Handle<Object> prototype,
1279 InstanceType type, 1284 InstanceType type,
1280 int instance_size, 1285 int instance_size,
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after
2365 return Handle<Object>::null(); 2370 return Handle<Object>::null();
2366 } 2371 }
2367 2372
2368 2373
2369 Handle<Object> Factory::ToBoolean(bool value) { 2374 Handle<Object> Factory::ToBoolean(bool value) {
2370 return value ? true_value() : false_value(); 2375 return value ? true_value() : false_value();
2371 } 2376 }
2372 2377
2373 2378
2374 } } // namespace v8::internal 2379 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698