| OLD | NEW |
| 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 Loading... |
| 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 } | |
| 1276 result->set_prototype_or_initial_map(*prototype); | 1271 result->set_prototype_or_initial_map(*prototype); |
| 1277 return result; | 1272 return result; |
| 1278 } | 1273 } |
| 1279 | 1274 |
| 1280 | 1275 |
| 1281 Handle<JSFunction> Factory::NewFunction(Handle<String> name, | 1276 Handle<JSFunction> Factory::NewFunction(Handle<String> name, |
| 1282 Handle<Code> code, | 1277 Handle<Code> code, |
| 1283 Handle<Object> prototype, | 1278 Handle<Object> prototype, |
| 1284 InstanceType type, | 1279 InstanceType type, |
| 1285 int instance_size, | 1280 int instance_size, |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2370 return Handle<Object>::null(); | 2365 return Handle<Object>::null(); |
| 2371 } | 2366 } |
| 2372 | 2367 |
| 2373 | 2368 |
| 2374 Handle<Object> Factory::ToBoolean(bool value) { | 2369 Handle<Object> Factory::ToBoolean(bool value) { |
| 2375 return value ? true_value() : false_value(); | 2370 return value ? true_value() : false_value(); |
| 2376 } | 2371 } |
| 2377 | 2372 |
| 2378 | 2373 |
| 2379 } } // namespace v8::internal | 2374 } } // namespace v8::internal |
| OLD | NEW |