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

Side by Side Diff: src/bootstrapper.cc

Issue 39322: Mark special internal scripts as native scripts (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 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 | « no previous file | src/d8.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 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 511
512 // Allocate the empty function as the prototype for function ECMAScript 512 // Allocate the empty function as the prototype for function ECMAScript
513 // 262 15.3.4. 513 // 262 15.3.4.
514 Handle<String> symbol = Factory::LookupAsciiSymbol("Empty"); 514 Handle<String> symbol = Factory::LookupAsciiSymbol("Empty");
515 Handle<JSFunction> empty_function = 515 Handle<JSFunction> empty_function =
516 Factory::NewFunction(symbol, Factory::null_value()); 516 Factory::NewFunction(symbol, Factory::null_value());
517 517
518 { // --- E m p t y --- 518 { // --- E m p t y ---
519 Handle<Code> code = 519 Handle<Code> code =
520 Handle<Code>(Builtins::builtin(Builtins::EmptyFunction)); 520 Handle<Code>(Builtins::builtin(Builtins::EmptyFunction));
521 empty_function->set_code(*code);
521 Handle<String> source = Factory::NewStringFromAscii(CStrVector("() {}")); 522 Handle<String> source = Factory::NewStringFromAscii(CStrVector("() {}"));
522 523 Handle<Script> script = Factory::NewScript(source);
523 empty_function->set_code(*code); 524 script->set_type(Smi::FromInt(SCRIPT_TYPE_NATIVE));
524 empty_function->shared()->set_script(*Factory::NewScript(source)); 525 empty_function->shared()->set_script(*script);
525 empty_function->shared()->set_start_position(0); 526 empty_function->shared()->set_start_position(0);
526 empty_function->shared()->set_end_position(source->length()); 527 empty_function->shared()->set_end_position(source->length());
527 empty_function->shared()->DontAdaptArguments(); 528 empty_function->shared()->DontAdaptArguments();
528 global_context()->function_map()->set_prototype(*empty_function); 529 global_context()->function_map()->set_prototype(*empty_function);
529 global_context()->function_instance_map()->set_prototype(*empty_function); 530 global_context()->function_instance_map()->set_prototype(*empty_function);
530 531
531 // Allocate the function map first and then patch the prototype later 532 // Allocate the function map first and then patch the prototype later
532 Handle<Map> empty_fm = Factory::CopyMap(fm); 533 Handle<Map> empty_fm = Factory::CopyMap(fm);
533 empty_fm->set_instance_descriptors(*function_map_descriptors); 534 empty_fm->set_instance_descriptors(*function_map_descriptors);
534 empty_fm->set_prototype(global_context()->object_function()->prototype()); 535 empty_fm->set_prototype(global_context()->object_function()->prototype());
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 script_descriptors, 1022 script_descriptors,
1022 Factory::LookupAsciiSymbol("line_ends"), 1023 Factory::LookupAsciiSymbol("line_ends"),
1023 proxy_line_ends, 1024 proxy_line_ends,
1024 common_attributes); 1025 common_attributes);
1025 1026
1026 Handle<Map> script_map = Handle<Map>(script_fun->initial_map()); 1027 Handle<Map> script_map = Handle<Map>(script_fun->initial_map());
1027 script_map->set_instance_descriptors(*script_descriptors); 1028 script_map->set_instance_descriptors(*script_descriptors);
1028 1029
1029 // Allocate the empty script. 1030 // Allocate the empty script.
1030 Handle<Script> script = Factory::NewScript(Factory::empty_string()); 1031 Handle<Script> script = Factory::NewScript(Factory::empty_string());
1032 script->set_type(Smi::FromInt(SCRIPT_TYPE_NATIVE));
1031 global_context()->set_empty_script(*script); 1033 global_context()->set_empty_script(*script);
1032 } 1034 }
1033 1035
1034 if (FLAG_natives_file == NULL) { 1036 if (FLAG_natives_file == NULL) {
1035 // Without natives file, install default natives. 1037 // Without natives file, install default natives.
1036 for (int i = Natives::GetDelayCount(); 1038 for (int i = Natives::GetDelayCount();
1037 i < Natives::GetBuiltinsCount(); 1039 i < Natives::GetBuiltinsCount();
1038 i++) { 1040 i++) {
1039 if (!CompileBuiltin(i)) return false; 1041 if (!CompileBuiltin(i)) return false;
1040 } 1042 }
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
1510 } 1512 }
1511 1513
1512 1514
1513 // Restore statics that are thread local. 1515 // Restore statics that are thread local.
1514 char* Genesis::RestoreState(char* from) { 1516 char* Genesis::RestoreState(char* from) {
1515 current_ = *reinterpret_cast<Genesis**>(from); 1517 current_ = *reinterpret_cast<Genesis**>(from);
1516 return from + sizeof(current_); 1518 return from + sizeof(current_);
1517 } 1519 }
1518 1520
1519 } } // namespace v8::internal 1521 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/d8.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698