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

Side by Side Diff: src/bootstrapper.cc

Issue 6602081: Stop using plain Arrays internally in built-in functions. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Changed header in bootstrapper.cc Created 9 years, 9 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/array.js ('k') | src/ia32/builtins-ia32.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 Handle<JSFunction> opaque_reference_fun = 1233 Handle<JSFunction> opaque_reference_fun =
1234 InstallFunction(builtins, "OpaqueReference", JS_VALUE_TYPE, 1234 InstallFunction(builtins, "OpaqueReference", JS_VALUE_TYPE,
1235 JSValue::kSize, Top::initial_object_prototype(), 1235 JSValue::kSize, Top::initial_object_prototype(),
1236 Builtins::Illegal, false); 1236 Builtins::Illegal, false);
1237 Handle<JSObject> prototype = 1237 Handle<JSObject> prototype =
1238 Factory::NewJSObject(Top::object_function(), TENURED); 1238 Factory::NewJSObject(Top::object_function(), TENURED);
1239 SetPrototype(opaque_reference_fun, prototype); 1239 SetPrototype(opaque_reference_fun, prototype);
1240 global_context()->set_opaque_reference_function(*opaque_reference_fun); 1240 global_context()->set_opaque_reference_function(*opaque_reference_fun);
1241 } 1241 }
1242 1242
1243 { // --- I n t e r n a l A r r a y ---
1244 // An array constructor on the builtins object that works like
1245 // the public Array constructor, except that its prototype
1246 // doesn't inherit from Object.prototype.
1247 // To be used only for internal work by builtins. Instances
1248 // must not be leaked to user code.
1249 // Only works correctly when called as a constructor. The normal
1250 // Array code uses Array.prototype as prototype when called as
1251 // a function.
1252 Handle<JSFunction> array_function =
1253 InstallFunction(builtins,
1254 "InternalArray",
1255 JS_ARRAY_TYPE,
1256 JSArray::kSize,
1257 Top::initial_object_prototype(),
1258 Builtins::ArrayCode,
1259 true);
1260 Handle<JSObject> prototype =
1261 Factory::NewJSObject(Top::object_function(), TENURED);
1262 SetPrototype(array_function, prototype);
1263
1264 array_function->shared()->set_construct_stub(
1265 Builtins::builtin(Builtins::ArrayConstructCode));
1266 array_function->shared()->DontAdaptArguments();
1267
1268 // Make "length" magic on instances.
1269 Handle<DescriptorArray> array_descriptors =
1270 Factory::CopyAppendProxyDescriptor(
1271 Factory::empty_descriptor_array(),
1272 Factory::length_symbol(),
1273 Factory::NewProxy(&Accessors::ArrayLength),
1274 static_cast<PropertyAttributes>(DONT_ENUM | DONT_DELETE));
1275
1276 array_function->initial_map()->set_instance_descriptors(
1277 *array_descriptors);
1278 }
1279
1243 if (FLAG_disable_native_files) { 1280 if (FLAG_disable_native_files) {
1244 PrintF("Warning: Running without installed natives!\n"); 1281 PrintF("Warning: Running without installed natives!\n");
1245 return true; 1282 return true;
1246 } 1283 }
1247 1284
1248 // Install natives. 1285 // Install natives.
1249 for (int i = Natives::GetDebuggerCount(); 1286 for (int i = Natives::GetDebuggerCount();
1250 i < Natives::GetBuiltinsCount(); 1287 i < Natives::GetBuiltinsCount();
1251 i++) { 1288 i++) {
1252 Vector<const char> name = Natives::GetScriptName(i); 1289 Vector<const char> name = Natives::GetScriptName(i);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 reresult_descriptors->Sort(); 1388 reresult_descriptors->Sort();
1352 1389
1353 initial_map->set_inobject_properties(2); 1390 initial_map->set_inobject_properties(2);
1354 initial_map->set_pre_allocated_property_fields(2); 1391 initial_map->set_pre_allocated_property_fields(2);
1355 initial_map->set_unused_property_fields(0); 1392 initial_map->set_unused_property_fields(0);
1356 initial_map->set_instance_descriptors(*reresult_descriptors); 1393 initial_map->set_instance_descriptors(*reresult_descriptors);
1357 1394
1358 global_context()->set_regexp_result_map(*initial_map); 1395 global_context()->set_regexp_result_map(*initial_map);
1359 } 1396 }
1360 1397
1398
1361 #ifdef DEBUG 1399 #ifdef DEBUG
1362 builtins->Verify(); 1400 builtins->Verify();
1363 #endif 1401 #endif
1364 1402
1365 return true; 1403 return true;
1366 } 1404 }
1367 1405
1368 1406
1369 static Handle<JSObject> ResolveBuiltinIdHolder( 1407 static Handle<JSObject> ResolveBuiltinIdHolder(
1370 Handle<Context> global_context, 1408 Handle<Context> global_context,
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
1879 } 1917 }
1880 1918
1881 1919
1882 // Restore statics that are thread local. 1920 // Restore statics that are thread local.
1883 char* BootstrapperActive::RestoreState(char* from) { 1921 char* BootstrapperActive::RestoreState(char* from) {
1884 nesting_ = *reinterpret_cast<int*>(from); 1922 nesting_ = *reinterpret_cast<int*>(from);
1885 return from + sizeof(nesting_); 1923 return from + sizeof(nesting_);
1886 } 1924 }
1887 1925
1888 } } // namespace v8::internal 1926 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/array.js ('k') | src/ia32/builtins-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698