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

Side by Side Diff: src/factory.cc

Issue 11631002: Extend API to allow setting length property for function templates. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Support length as argument to FunctionTempalte::New Created 8 years 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/api.cc ('k') | 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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1253 break; 1253 break;
1254 } 1254 }
1255 ASSERT(type != INVALID_TYPE); 1255 ASSERT(type != INVALID_TYPE);
1256 1256
1257 Handle<JSFunction> result = 1257 Handle<JSFunction> result =
1258 NewFunction(Factory::empty_symbol(), 1258 NewFunction(Factory::empty_symbol(),
1259 type, 1259 type,
1260 instance_size, 1260 instance_size,
1261 code, 1261 code,
1262 true); 1262 true);
1263
1264 // Set length.
1265 result->shared()->set_length(obj->length());
1266
1263 // Set class name. 1267 // Set class name.
1264 Handle<Object> class_name = Handle<Object>(obj->class_name()); 1268 Handle<Object> class_name = Handle<Object>(obj->class_name());
1265 if (class_name->IsString()) { 1269 if (class_name->IsString()) {
1266 result->shared()->set_instance_class_name(*class_name); 1270 result->shared()->set_instance_class_name(*class_name);
1267 result->shared()->set_name(*class_name); 1271 result->shared()->set_name(*class_name);
1268 } 1272 }
1269 1273
1270 Handle<Map> map = Handle<Map>(result->initial_map()); 1274 Handle<Map> map = Handle<Map>(result->initial_map());
1271 1275
1272 // Mark as undetectable if needed. 1276 // Mark as undetectable if needed.
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 1447
1444 1448
1445 Handle<Object> Factory::ToBoolean(bool value) { 1449 Handle<Object> Factory::ToBoolean(bool value) {
1446 return Handle<Object>(value 1450 return Handle<Object>(value
1447 ? isolate()->heap()->true_value() 1451 ? isolate()->heap()->true_value()
1448 : isolate()->heap()->false_value()); 1452 : isolate()->heap()->false_value());
1449 } 1453 }
1450 1454
1451 1455
1452 } } // namespace v8::internal 1456 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/api.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698