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

Side by Side Diff: src/bootstrapper.cc

Issue 2884: Stop adapting the arguments passed to the builtin implementations... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 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/builtins.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 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 void TransferNamedProperties(Handle<JSObject> from, Handle<JSObject> to); 284 void TransferNamedProperties(Handle<JSObject> from, Handle<JSObject> to);
285 void TransferIndexedProperties(Handle<JSObject> from, Handle<JSObject> to); 285 void TransferIndexedProperties(Handle<JSObject> from, Handle<JSObject> to);
286 286
287 Handle<DescriptorArray> ComputeFunctionInstanceDescriptor( 287 Handle<DescriptorArray> ComputeFunctionInstanceDescriptor(
288 bool make_prototype_read_only, 288 bool make_prototype_read_only,
289 bool make_prototype_enumerable = false); 289 bool make_prototype_enumerable = false);
290 void MakeFunctionInstancePrototypeWritable(); 290 void MakeFunctionInstancePrototypeWritable();
291 291
292 void AddSpecialFunction(Handle<JSObject> prototype, 292 void AddSpecialFunction(Handle<JSObject> prototype,
293 const char* name, 293 const char* name,
294 Handle<Code> code, 294 Handle<Code> code);
295 int parameter_count);
296 295
297 void BuildSpecialFunctionTable(); 296 void BuildSpecialFunctionTable();
298 297
299 static bool CompileBuiltin(int index); 298 static bool CompileBuiltin(int index);
300 static bool CompileNative(Vector<const char> name, Handle<String> source); 299 static bool CompileNative(Vector<const char> name, Handle<String> source);
301 static bool CompileScriptCached(Vector<const char> name, 300 static bool CompileScriptCached(Vector<const char> name,
302 Handle<String> source, 301 Handle<String> source,
303 SourceCodeCache* cache, 302 SourceCodeCache* cache,
304 v8::Extension* extension, 303 v8::Extension* extension,
305 bool use_runtime_context); 304 bool use_runtime_context);
(...skipping 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
1259 Handle<DescriptorArray> function_map_descriptors = 1258 Handle<DescriptorArray> function_map_descriptors =
1260 ComputeFunctionInstanceDescriptor(false, true); 1259 ComputeFunctionInstanceDescriptor(false, true);
1261 Handle<Map> fm = Factory::CopyMap(Top::function_map()); 1260 Handle<Map> fm = Factory::CopyMap(Top::function_map());
1262 fm->set_instance_descriptors(*function_map_descriptors); 1261 fm->set_instance_descriptors(*function_map_descriptors);
1263 Top::context()->global_context()->set_function_map(*fm); 1262 Top::context()->global_context()->set_function_map(*fm);
1264 } 1263 }
1265 1264
1266 1265
1267 void Genesis::AddSpecialFunction(Handle<JSObject> prototype, 1266 void Genesis::AddSpecialFunction(Handle<JSObject> prototype,
1268 const char* name, 1267 const char* name,
1269 Handle<Code> code, 1268 Handle<Code> code) {
1270 int parameter_count) {
1271 Handle<String> key = Factory::LookupAsciiSymbol(name); 1269 Handle<String> key = Factory::LookupAsciiSymbol(name);
1272 Handle<Object> value = Handle<Object>(prototype->GetProperty(*key)); 1270 Handle<Object> value = Handle<Object>(prototype->GetProperty(*key));
1273 if (value->IsJSFunction()) { 1271 if (value->IsJSFunction()) {
1274 Handle<JSFunction> optimized = Factory::NewFunction(key, 1272 Handle<JSFunction> optimized = Factory::NewFunction(key,
1275 JS_OBJECT_TYPE, 1273 JS_OBJECT_TYPE,
1276 JSObject::kHeaderSize, 1274 JSObject::kHeaderSize,
1277 code, 1275 code,
1278 false); 1276 false);
1279 optimized->shared()->set_formal_parameter_count(parameter_count); 1277 optimized->shared()->DontAdaptArguments();
1280 int len = global_context()->special_function_table()->length(); 1278 int len = global_context()->special_function_table()->length();
1281 Handle<FixedArray> new_array = Factory::NewFixedArray(len + 3); 1279 Handle<FixedArray> new_array = Factory::NewFixedArray(len + 3);
1282 for (int index = 0; index < len; index++) { 1280 for (int index = 0; index < len; index++) {
1283 new_array->set(index, 1281 new_array->set(index,
1284 global_context()->special_function_table()->get(index)); 1282 global_context()->special_function_table()->get(index));
1285 } 1283 }
1286 new_array->set(len+0, *prototype); 1284 new_array->set(len+0, *prototype);
1287 new_array->set(len+1, *value); 1285 new_array->set(len+1, *value);
1288 new_array->set(len+2, *optimized); 1286 new_array->set(len+2, *optimized);
1289 global_context()->set_special_function_table(*new_array); 1287 global_context()->set_special_function_table(*new_array);
1290 } 1288 }
1291 } 1289 }
1292 1290
1293 1291
1294 void Genesis::BuildSpecialFunctionTable() { 1292 void Genesis::BuildSpecialFunctionTable() {
1295 HandleScope scope; 1293 HandleScope scope;
1296 Handle<JSObject> global = Handle<JSObject>(global_context()->global()); 1294 Handle<JSObject> global = Handle<JSObject>(global_context()->global());
1297 // Add special versions for Array.prototype.pop and push. 1295 // Add special versions for Array.prototype.pop and push.
1298 Handle<JSFunction> function = 1296 Handle<JSFunction> function =
1299 Handle<JSFunction>( 1297 Handle<JSFunction>(
1300 JSFunction::cast(global->GetProperty(Heap::Array_symbol()))); 1298 JSFunction::cast(global->GetProperty(Heap::Array_symbol())));
1301 Handle<JSObject> prototype = 1299 Handle<JSObject> prototype =
1302 Handle<JSObject>(JSObject::cast(function->prototype())); 1300 Handle<JSObject>(JSObject::cast(function->prototype()));
1303 AddSpecialFunction(prototype, "pop", 1301 AddSpecialFunction(prototype, "pop",
1304 Handle<Code>(Builtins::builtin(Builtins::ArrayPop)), 1302 Handle<Code>(Builtins::builtin(Builtins::ArrayPop)));
1305 0);
1306 AddSpecialFunction(prototype, "push", 1303 AddSpecialFunction(prototype, "push",
1307 Handle<Code>(Builtins::builtin(Builtins::ArrayPush)), 1304 Handle<Code>(Builtins::builtin(Builtins::ArrayPush)));
1308 1);
1309 } 1305 }
1310 1306
1311 1307
1312 Genesis::Genesis(Handle<Object> global_object, 1308 Genesis::Genesis(Handle<Object> global_object,
1313 v8::Handle<v8::ObjectTemplate> global_template, 1309 v8::Handle<v8::ObjectTemplate> global_template,
1314 v8::ExtensionConfiguration* extensions) { 1310 v8::ExtensionConfiguration* extensions) {
1315 // Link this genesis object into the stacked genesis chain. This 1311 // Link this genesis object into the stacked genesis chain. This
1316 // must be done before any early exits because the deconstructor 1312 // must be done before any early exits because the deconstructor
1317 // will always do unlinking. 1313 // will always do unlinking.
1318 previous_ = current_; 1314 previous_ = current_;
(...skipping 16 matching lines...) Expand all
1335 if (!ConfigureGlobalObject(global_template)) return; 1331 if (!ConfigureGlobalObject(global_template)) return;
1336 1332
1337 if (!InstallExtensions(extensions)) return; 1333 if (!InstallExtensions(extensions)) return;
1338 1334
1339 if (!InstallSpecialObjects()) return; 1335 if (!InstallSpecialObjects()) return;
1340 1336
1341 result_ = global_context_; 1337 result_ = global_context_;
1342 } 1338 }
1343 1339
1344 } } // namespace v8::internal 1340 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/builtins.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698