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

Side by Side Diff: src/bootstrapper.cc

Issue 3120006: Put direct code pointers into JSFunction objects. This is a first step... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 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 | « src/arm/macro-assembler-arm.cc ('k') | src/factory.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 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 // Allocate the empty function as the prototype for function ECMAScript 463 // Allocate the empty function as the prototype for function ECMAScript
464 // 262 15.3.4. 464 // 262 15.3.4.
465 Handle<String> symbol = Factory::LookupAsciiSymbol("Empty"); 465 Handle<String> symbol = Factory::LookupAsciiSymbol("Empty");
466 Handle<JSFunction> empty_function = 466 Handle<JSFunction> empty_function =
467 Factory::NewFunctionWithoutPrototype(symbol); 467 Factory::NewFunctionWithoutPrototype(symbol);
468 468
469 // --- E m p t y --- 469 // --- E m p t y ---
470 Handle<Code> code = 470 Handle<Code> code =
471 Handle<Code>(Builtins::builtin(Builtins::EmptyFunction)); 471 Handle<Code>(Builtins::builtin(Builtins::EmptyFunction));
472 empty_function->set_code(*code); 472 empty_function->set_code(*code);
473 empty_function->shared()->set_code(*code);
473 Handle<String> source = Factory::NewStringFromAscii(CStrVector("() {}")); 474 Handle<String> source = Factory::NewStringFromAscii(CStrVector("() {}"));
474 Handle<Script> script = Factory::NewScript(source); 475 Handle<Script> script = Factory::NewScript(source);
475 script->set_type(Smi::FromInt(Script::TYPE_NATIVE)); 476 script->set_type(Smi::FromInt(Script::TYPE_NATIVE));
476 empty_function->shared()->set_script(*script); 477 empty_function->shared()->set_script(*script);
477 empty_function->shared()->set_start_position(0); 478 empty_function->shared()->set_start_position(0);
478 empty_function->shared()->set_end_position(source->length()); 479 empty_function->shared()->set_end_position(source->length());
479 empty_function->shared()->DontAdaptArguments(); 480 empty_function->shared()->DontAdaptArguments();
480 global_context()->function_map()->set_prototype(*empty_function); 481 global_context()->function_map()->set_prototype(*empty_function);
481 global_context()->function_instance_map()->set_prototype(*empty_function); 482 global_context()->function_instance_map()->set_prototype(*empty_function);
482 global_context()->function_without_prototype_map()-> 483 global_context()->function_without_prototype_map()->
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 HandleScope scope; 1539 HandleScope scope;
1539 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) { 1540 for (int i = 0; i < Builtins::NumberOfJavaScriptBuiltins(); i++) {
1540 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i); 1541 Builtins::JavaScript id = static_cast<Builtins::JavaScript>(i);
1541 Handle<String> name = Factory::LookupAsciiSymbol(Builtins::GetName(id)); 1542 Handle<String> name = Factory::LookupAsciiSymbol(Builtins::GetName(id));
1542 Handle<JSFunction> function 1543 Handle<JSFunction> function
1543 = Handle<JSFunction>(JSFunction::cast(builtins->GetProperty(*name))); 1544 = Handle<JSFunction>(JSFunction::cast(builtins->GetProperty(*name)));
1544 builtins->set_javascript_builtin(id, *function); 1545 builtins->set_javascript_builtin(id, *function);
1545 Handle<SharedFunctionInfo> shared 1546 Handle<SharedFunctionInfo> shared
1546 = Handle<SharedFunctionInfo>(function->shared()); 1547 = Handle<SharedFunctionInfo>(function->shared());
1547 if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false; 1548 if (!EnsureCompiled(shared, CLEAR_EXCEPTION)) return false;
1549 // Set the code object on the function object.
1550 function->set_code(function->shared()->code());
1548 builtins->set_javascript_builtin_code(id, shared->code()); 1551 builtins->set_javascript_builtin_code(id, shared->code());
1549 } 1552 }
1550 return true; 1553 return true;
1551 } 1554 }
1552 1555
1553 1556
1554 bool Genesis::ConfigureGlobalObjects( 1557 bool Genesis::ConfigureGlobalObjects(
1555 v8::Handle<v8::ObjectTemplate> global_proxy_template) { 1558 v8::Handle<v8::ObjectTemplate> global_proxy_template) {
1556 Handle<JSObject> global_proxy( 1559 Handle<JSObject> global_proxy(
1557 JSObject::cast(global_context()->global_proxy())); 1560 JSObject::cast(global_context()->global_proxy()));
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
1810 } 1813 }
1811 1814
1812 1815
1813 // Restore statics that are thread local. 1816 // Restore statics that are thread local.
1814 char* BootstrapperActive::RestoreState(char* from) { 1817 char* BootstrapperActive::RestoreState(char* from) {
1815 nesting_ = *reinterpret_cast<int*>(from); 1818 nesting_ = *reinterpret_cast<int*>(from);
1816 return from + sizeof(nesting_); 1819 return from + sizeof(nesting_);
1817 } 1820 }
1818 1821
1819 } } // namespace v8::internal 1822 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698